changeset 624:01e01777ff50

CMake: initial import of CMake modules, closes #720
author David Demelier <markand@malikania.fr>
date Fri, 20 Oct 2017 14:18:37 +0200
parents 2081e695bfbd
children dccaf66c8b9f
files cmake/FindEditline.cmake cmake/FindHunspell.cmake cmake/FindIrrlicht.cmake cmake/FindJansson.cmake cmake/FindKDChart.cmake cmake/FindNLS.cmake cmake/FindNode.cmake cmake/FindOCC.cmake cmake/FindPandoc.cmake cmake/FindQtIFW.cmake cmake/FindQuazip.cmake cmake/FindSDL2.cmake cmake/FindSysQueue.cmake cmake/FindZIP.cmake cmake/functions/DefineOption.cmake
diffstat 15 files changed, 928 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake/FindEditline.cmake	Fri Oct 20 14:18:37 2017 +0200
@@ -0,0 +1,24 @@
+# FindEditline
+# ------------
+#
+# Find libedit library, this modules defines:
+#
+# Editline_INCLUDE_DIRS, where to find histedit.h
+# Editline_LIBRARIES, where to find library
+# Editline_FOUND, if it is found
+
+find_path(Editline_INCLUDE_DIR NAMES histedit.h)
+find_library(Editline_LIBRARY NAMES libedit edit)
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(
+    Editline
+    FOUND_VAR Editline_FOUND
+    REQUIRED_VARS Editline_LIBRARY Editline_INCLUDE_DIR
+)
+
+set(Editline_LIBRARIES ${Editline_LIBRARY})
+set(Editline_INCLUDE_DIRS ${Editline_INCLUDE_DIR})
+
+mark_as_advanced(Editline_INCLUDE_DIR Editline_LIBRARY)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake/FindHunspell.cmake	Fri Oct 20 14:18:37 2017 +0200
@@ -0,0 +1,28 @@
+# FindHunspell
+# ------------
+#
+# Find Hunspell library, this modules defines:
+#
+# Hunspell_INCLUDE_DIRS, where to find hunspell.hxx
+# Hunspell_LIBRARIES, where to find library
+# Hunspell_FOUND, if it is found
+
+find_path(
+    Hunspell_INCLUDE_DIR
+    NAMES hunspell.hxx
+    PATH_SUFFIXES hunspell
+)
+find_library(Hunspell_LIBRARY NAMES libhunspell hunspell)
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(
+    Hunspell
+    FOUND_VAR Hunspell_FOUND
+    REQUIRED_VARS Hunspell_LIBRARY Hunspell_INCLUDE_DIR
+)
+
+set(Hunspell_LIBRARIES ${Hunspell_LIBRARY})
+set(Hunspell_INCLUDE_DIRS ${Hunspell_INCLUDE_DIR})
+
+mark_as_advanced(Hunspell_INCLUDE_DIR Hunspell_LIBRARY)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake/FindIrrlicht.cmake	Fri Oct 20 14:18:37 2017 +0200
@@ -0,0 +1,32 @@
+# FindIrrlicht
+# ------------
+#
+# Find Irrlicht library, this modules defines:
+#
+#  Irrlicht_LIBRARY, the name of the library to link against
+#  Irrlicht_FOUND, if false, do not try to link to Irrlicht
+#  Irrlicht_INCLUDE_DIR, where to find irrlicht.h
+
+find_path(
+    Irrlicht_INCLUDE_DIR
+    NAMES irrlicht.h
+    PATH_SUFFIXES include/irrlicht
+)
+
+find_library(
+    Irrlicht_LIBRARY
+    NAMES Irrlicht libIrrlicht
+)
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(
+    Irrlicht
+    FOUND_VAR Irrlicht_FOUND
+    REQUIRED_VARS Irrlicht_LIBRARY Irrlicht_INCLUDE_DIR
+)
+
+set(Irrlicht_LIBRARIES ${Irrlicht_LIBRARY})
+set(Irrlicht_INCLUDE_DIRS ${Irrlicht_INCLUDE_DIR})
+
+mark_as_advanced(Irrlicht_INCLUDE_DIR Irrlicht_LIBRARY)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake/FindJansson.cmake	Fri Oct 20 14:18:37 2017 +0200
@@ -0,0 +1,24 @@
+# FindJansson
+# -----------
+#
+# Find Jansson library, this modules defines:
+#
+# Jansson_INCLUDE_DIRS, where to find jansson.h
+# Jansson_LIBRARIES, where to find library
+# Jansson_FOUND, if it is found
+
+find_path(Jansson_INCLUDE_DIR NAMES jansson.h)
+find_library(Jansson_LIBRARY NAMES libjansson jansson)
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(
+    Jansson
+    FOUND_VAR Jansson_FOUND
+    REQUIRED_VARS Jansson_LIBRARY Jansson_INCLUDE_DIR
+)
+
+set(Jansson_LIBRARIES ${Jansson_LIBRARY})
+set(Jansson_INCLUDE_DIRS ${Jansson_INCLUDE_DIR})
+
+mark_as_advanced(Jansson_INCLUDE_DIR Jansson_LIBRARY)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake/FindKDChart.cmake	Fri Oct 20 14:18:37 2017 +0200
@@ -0,0 +1,38 @@
+# FindKDChart
+# -----------
+#
+# Find KDChart library, this modules defines:
+#
+# KDChart_FOUND         Set to TRUE if KDChart was found.
+# KDChart_LIBRARIES     Path to KDChart libraries.
+# KDChart_INCLUDE_DIRS  Path to the KDChart include directory.
+
+find_package(Qt5Widgets QUIET)
+find_package(Qt5PrintSupport QUIET)
+
+find_library(KDChart_LIBRARY NAMES KDChart2 KDChartd2 kdchart2 kdchartd2)
+
+find_path(
+    KDChart_Chart_INCLUDE_DIR
+    NAMES KDChart KDChartGlobal
+    PATH_SUFFIXES KDChart
+)
+
+find_path(
+    KDChart_Gantt_INCLUDE_DIR
+    NAMES KDGantt KDGanttGlobal
+    PATH_SUFFIXES KDGantt
+)
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(
+    KDChart
+    FOUND_VAR KDChart_FOUND
+    REQUIRED_VARS KDChart_LIBRARY KDChart_Chart_INCLUDE_DIR KDChart_Gantt_INCLUDE_DIR Qt5Widgets_FOUND Qt5PrintSupport_FOUND
+)
+
+set(KDChart_LIBRARIES ${KDChart_LIBRARY} Qt5::Widgets Qt5::PrintSupport)
+set(KDChart_INCLUDE_DIRS ${KDChart_Chart_INCLUDE_DIR} ${KDChart_Gantt_INCLUDE_DIR})
+
+mark_as_advanced(KDChart_LIBRARIES KDChart_INCLUDE_DIR)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake/FindNLS.cmake	Fri Oct 20 14:18:37 2017 +0200
@@ -0,0 +1,35 @@
+# FindNLS
+# -------
+#
+# NLS_INCLUDE_DIRS, where to find libintl.h
+# NLS_LIBRARIES, where to find library
+# NLS_FOUND, if it is found
+
+include(CheckFunctionExists)
+
+# find libintl.h
+find_path(NLS_INCLUDE_DIR libintl.h)
+
+# find libintl.so
+find_library(NLS_LIBRARY NAMES libintl intl)
+
+# On Linux gettext is directly in libc
+if (NOT NLS_LIBRARY)
+    check_function_exists(gettext _HAVE_GETTEXT_FUNC)
+    check_function_exists(bindtextdomain _HAVE_BINDTEXTDOMAIN_FUNC)
+    set(NLS_LIBRARY "c")
+endif ()
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(
+    NLS
+    REQUIRED_VARS NLS_INCLUDE_DIR NLS_LIBRARY
+)
+
+if (NLS_FOUND)
+    set(NLS_INCLUDE_DIRS ${NLS_INCLUDE_DIR})
+    set(NLS_LIBRARIES ${NLS_LIBRARIES})
+endif ()
+
+mark_as_advanced(NLS_INCLUDE_DIR NLS_LIBRARY)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake/FindNode.cmake	Fri Oct 20 14:18:37 2017 +0200
@@ -0,0 +1,35 @@
+# FindNode
+# --------
+#
+# Find Node.js, this module defines:
+#
+# Node_FOUND, if node was found
+# Node_EXECUTABLE, where to find node executable
+# Node_VERSION, the version (without leading `v')
+
+find_program(
+    Node_EXECUTABLE
+    NAMES node
+    DOC "Node executable"
+)
+
+include(FindPackageHandleStandardArgs)
+
+# Extract the version
+if (Node_EXECUTABLE)
+    execute_process(
+        COMMAND ${Node_EXECUTABLE} --version
+        OUTPUT_VARIABLE _node_version_tmp
+    )
+
+    if (_node_version_tmp MATCHES "^v([0-9]+\\.[0-9]+\\.[0-9]+)")
+        set(Node_VERSION "${CMAKE_MATCH_1}")
+    endif ()
+endif ()
+
+find_package_handle_standard_args(
+    Node
+    FOUND_VAR Node_FOUND Node_VERSION
+    REQUIRED_VARS Node_EXECUTABLE
+    VERSION_VAR Node_VERSION
+)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake/FindOCC.cmake	Fri Oct 20 14:18:37 2017 +0200
@@ -0,0 +1,59 @@
+# FindOCC
+# -------
+#
+# Find vanilla OpenCascade libraries. It has *not* been tested with OpenCascade
+# community edition.
+#
+# This modules defines:
+# OCC_INCLUDE_DIRS, where to find OSD.hxx
+# OCC_LIBRARIES, where to find components libraries
+# OCC_FOUND, if it is found
+#
+# This module understand components. Just pass the library name to
+# the components variable and the following variables will
+# be defined:
+#
+# e.g find_package(OCC COMPONENTS TKbool)
+#
+# OCC_Xxx_LIBRARY where to find the library
+# OCC_Xxx_FOUND if the variable is found
+#
+# The OCC_LIBRARIES is automatically filled with all components.
+
+include(FindPackageMessage)
+
+# find OSD.hxx
+find_path(
+    OCC_INCLUDE_DIR OSD.hxx
+    PATH_SUFFIXES
+        OpenCASCADE
+        inc
+)
+
+foreach (c ${OCC_FIND_COMPONENTS})
+    find_library(
+        OCC_${c}_LIBRARY ${c}
+        PATH_SUFFIXES
+            win32/vc11/lib
+    )
+
+    if (OCC_${c}_LIBRARY)
+        set(OCC_${c}_FOUND TRUE)
+        list(APPEND OCC_LIBRARIES ${OCC_${c}_LIBRARY})
+        mark_as_advanced(OCC_${c}_LIBRARY)
+    endif ()
+endforeach ()
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(
+    OCC
+    HANDLE_COMPONENTS
+    REQUIRED_VARS OCC_INCLUDE_DIR
+)
+
+if (OCC_FOUND)
+    set(OCC_INCLUDE_DIRS ${OCC_INCLUDE_DIR})
+endif ()
+
+mark_as_advanced(OCC_INCLUDE_DIR OCC_LIBRARIES)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake/FindPandoc.cmake	Fri Oct 20 14:18:37 2017 +0200
@@ -0,0 +1,231 @@
+# FindPandoc
+# ----------
+#
+# Find Pandoc executable, this modules defines:
+#
+# Pandoc_EXECUTABLE, where to find pandoc's executable
+# Pandoc_FOUND, if it is found
+# Pandoc_VERSION, the version
+#
+# This module also defines the following macros:
+#
+# pandoc(
+#    SOURCES file1 [file2 ...]
+#    OUTPUT output
+#    [FROM format]
+#    [TO format]
+#    [TARGET target]
+#    [DEPENDS dependency ...]
+#    [ALL]
+#    [TOC]
+#    [STANDALONE]
+#    [MAKE_DIRECTORY]
+#    [TEMPLATE file]
+#    [FILTER filter]
+#    [HEADER header ...]
+#    [FOOTER footer ...]
+#    [BODY body ...]
+#    [VARIABLE var ...]
+#    [METADATA meta ...]
+#    [ARGS argument ...]
+#    [WORKING_DIRECTORY directory]
+# )
+#
+# The sources files are listed in the parameter SOURCES, all files are passed
+# in the same order they are passed to that variable.
+#
+# The OUTPUT file is set with OUTPUT. It is generated only if one of the file
+# has changed.
+#
+# The FROM (-f) and TO (-t) arguments specify respectively the source and
+# destinations formats.
+#
+# If the parameter TARGET is set, then a target named `target` will be added
+# with the OUTPUT file as the dependency but not listed as sources files.
+# But the SOURCES files will be added as the target sources in the IDE.
+#
+# Optional dependencies can be added to the output command (not the target) with
+# the DEPENDS parameter.
+#
+# If ALL is set and TARGET is also set, the target will be added to the ALL_BUILD.
+#
+# If TOC (--toc) is specified, a table of content will be automatically created.
+#
+# If STANDALONE (-s) is set, the compilation will assume that it is standalone
+# and adds the necessary of the output format.
+#
+# Optional MAKE_DIRECTORY can be set to create the output directory before
+# pandoc processes the file (recommended).
+#
+# The TEMPLATE parameter can be used to specify the formate template file.
+#
+# You can set a filter with the parameter FILTER. The filter will be added to
+# the output dependencies so you can safely use CMake's targets.
+#
+# The HEADER (-H), FOOTER (-A) and BODY (-B) are copied verbatim before, just
+# after and after the body respectively. They can be set more than once.
+#
+# You can pass variables (-V) and metadata (-M) to the parameters VARIABLE
+# and METADATA, be sure to pass the same syntax as pandoc.  (e.g VARIABLE foo=1)
+#
+# ARGS is an optional list of additional arguments to pass to pandoc.
+#
+# The parameter WORKING_DIRECTORY can be set to change the directory when pandoc
+# is invoked.
+#
+
+find_program(
+    Pandoc_EXECUTABLE
+    NAMES pandoc
+    DOC "Pandoc executable"
+)
+
+include(FindPackageHandleStandardArgs)
+include(CMakeParseArguments)
+
+# Extract the version
+if (Pandoc_EXECUTABLE)
+    execute_process(
+        COMMAND ${Pandoc_EXECUTABLE} --version
+        OUTPUT_VARIABLE _pandoc_version_tmp
+    )
+
+    if (_pandoc_version_tmp MATCHES "^pandoc[^ ]* ([0-9]+\\.[0-9]+\\.[0-9]+)")
+        set(Pandoc_VERSION "${CMAKE_MATCH_1}")
+    endif ()
+endif ()
+
+find_package_handle_standard_args(
+    Pandoc
+    FOUND_VAR Pandoc_FOUND
+    VERSION_VAR Pandoc_VERSION
+    REQUIRED_VARS Pandoc_EXECUTABLE
+)
+
+if (Pandoc_FOUND)
+    function(pandoc)
+        set(options MAKE_DIRECTORY STANDALONE TOC)
+        set(oneValueArgs FILTER FROM TARGET TEMPLATE TO OUTPUT WORKING_DIRECTORY)
+        set(multiValueArgs ARGS FOOTER HEADER METADATA SOURCES VARIABLE)
+
+        #
+        # The following variables will be set in that scope:
+        #   _pandoc_arguments        - List of all arguments that will passed to pandoc invocation.
+        #   _pandoc_depends        - List of all dependencies attached to the add_custom_command.
+        #   _pandoc_mkdir        - The mkdir command if MAKE_DIRECTORY is set
+        #   _pandoc_output_base        - The base output directory
+        #
+        cmake_parse_arguments(PANDOC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+        #
+        # Output and sources are mandatory
+        #
+        if (NOT PANDOC_OUTPUT)
+            message(FATAL_ERROR "Please define OUTPUT")
+        elseif (NOT PANDOC_SOURCES)
+            message(FATAL_ERROR "Please defines SOURCES")
+        endif ()
+
+        #
+        # Handle the filter with care.
+        #
+        # 1. If it is a target, depend on it and use a generator
+        #    expression to get its full path on the disk.
+        # 2. If it is not a target, just use the user provided path.
+        #
+        if (PANDOC_FILTER)
+            # If it is a target, add a dependency so that it is built
+            if (TARGET ${PANDOC_FILTER})
+                list(APPEND _pandoc_arguments --filter "$<TARGET_FILE:${PANDOC_FILTER}>")
+                list(APPEND _pandoc_depends ${PANDOC_FILTER})
+            else ()
+                list(APPEND _pandoc_arguments --filter ${PANDOC_FILTER})
+            endif ()
+        endif ()
+
+        if (PANDOC_TOC)
+            list(APPEND _pandoc_arguments --toc)
+        endif ()
+        if (PANDOC_STANDALONE)
+            list(APPEND _pandoc_arguments -s)
+        endif ()
+        if (PANDOC_FROM)
+            list(APPEND _pandoc_arguments -f ${PANDOC_FROM})
+        endif ()
+        if (PANDOC_TO)
+            list(APPEND _pandoc_arguments -t ${PANDOC_TO})
+        endif ()
+        if (PANDOC_TEMPLATE)
+            list(APPEND _pandoc_arguments --template ${PANDOC_TEMPLATE})
+            list(APPEND _pandoc_depends ${PANDOC_TEMPLATE})
+        endif ()
+
+        # Header, footers and body
+        foreach (h ${PANDOC_HEADER})
+            list(APPEND _pandoc_arguments -H ${h})
+            list(APPEND _pandoc_depends ${h})
+        endforeach ()
+        foreach (b ${PANDOC_BODY})
+            list(APPEND _pandoc_arguments -B ${b})
+            list(APPEND _pandoc_depends ${b})
+        endforeach ()
+        foreach (f ${PANDOC_FOOTER})
+            list(APPEND _pandoc_arguments -A ${f})
+            list(APPEND _pandoc_depends ${f})
+        endforeach ()
+
+        # Variables and metadata
+        foreach (var ${PANDOC_VARIABLE})
+            list(APPEND _pandoc_arguments -V ${var})
+        endforeach ()
+        foreach (meta ${PANDOC_METADATA})
+            list(APPEND _pandoc_arguments -M ${meta})
+        endforeach ()
+
+        # Optional list of arguments
+        foreach (arg ${PANDOC_ARGS})
+            list(APPEND _pandoc_arguments ${arg})
+        endforeach ()
+
+        # Output and sources
+        list(APPEND _pandoc_arguments -o ${PANDOC_OUTPUT})
+
+        #
+        # The following variables are set within the loop:
+        #
+        #   _pandoc_input           The absolute path to the input file.
+        #   _pandoc_output_base     The base output directory.
+        #
+        foreach (s ${PANDOC_SOURCES})
+            get_filename_component(_pandoc_input ${s} ABSOLUTE)
+            get_filename_component(_pandoc_output_base ${PANDOC_OUTPUT} DIRECTORY)
+            list(APPEND _pandoc_depends ${_pandoc_input})
+            list(APPEND _pandoc_arguments ${_pandoc_input})
+        endforeach ()
+
+        # Create the output directory if requested
+        if (PANDOC_MAKE_DIRECTORY)
+            set(_pandoc_mkdir ${CMAKE_COMMAND} -E make_directory ${_pandoc_output_base})
+        endif ()
+
+        add_custom_command(
+            OUTPUT ${PANDOC_OUTPUT}
+            COMMAND    ${_pandoc_mkdir}
+            COMMAND    ${Pandoc_EXECUTABLE} ${_pandoc_arguments}
+            DEPENDS ${_pandoc_depends} ${PANDOC_DEPENDS}
+            WORKING_DIRECTORY ${PANDOC_WORKING_DIRECTORY}
+            VERBATIM
+        )
+
+        if (PANDOC_TARGET)
+            add_custom_target(
+                ${PANDOC_TARGET} ${PANDOC_ALL}
+                SOURCES ${_pandoc_depends}
+                DEPENDS ${PANDOC_OUTPUT}
+                WORKING_DIRECTORY ${PANDOC_WORKING_DIRECTORY}
+            )
+        endif ()
+    endfunction()
+endif ()
+
+mark_as_advanced(Pandoc_EXECUTABLE)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake/FindQtIFW.cmake	Fri Oct 20 14:18:37 2017 +0200
@@ -0,0 +1,83 @@
+# FindQtIFW
+# ---------
+#
+# Find Qt Installer Framework, this module defines:
+#
+# QtIFW_CREATOR, where to find binarycreator.exe
+# QtIFW_ARCHIVEGEN, where to find archivegen.exe
+# QtIFW_FOUND, if the InnoSetup installation was found
+#
+# This module also defines the following macros:
+#
+# qtifw_create(
+#    OUTPUT installerfile
+#    CONFIG configuration file
+#    PACKAGES packages directory
+#    [TARGET name]
+#    [SOURCES sources ...]
+#    [DEPENDS dependencies ...]
+#    [RESOURCES resources ...]
+#    [ONLINE|OFFLINE]
+#    [ARGS args ...]
+# )
+#
+# This function adds a new custom command that generate the installer file specified by OUTPUT.
+#
+# The CONFIG and PACKAGES parameters are equivalent to -c and -p options respectively.
+#
+# You can add optional dependencies to the custom command with the DEPENDS parameter.
+#
+# If TARGET is specified, an additional target is created with the supplied name, the output file will be added as
+# target dependency and optional sources files can be listed in the SOURCES parameter.
+#
+# You can specify .qrc files to be bundled with the RESOURCES parameter.
+#
+# The ONLINE and OFFLINE parameters are equivalent to -n and -f options respectively. They are mutually exclusive.
+#
+# If you need to pass additional arguments to binarycreator, you can use the ARGS parameter.
+#
+# qtifw_archive(
+#    OUTPUT archive.7z
+#    SOURCES sources ...
+#    [TARGET name]
+#    [DEPENDS dependencies ...]
+# )
+#
+# This function adds a new custom command that generate .7z files using QtIFW's archivegen tool.
+#
+# The output file must be specified by OUTPUT, sources can be either files or directories specified by SOURCES.
+#
+# If TARGET is specified, an additional target is created with the supplied name, the output file will be added as
+# target dependency and source files will also be listed.
+#
+# You can add optional dependencies to the custom command with the DEPENDS parameter.
+#
+
+find_program(
+       QtIFW_CREATOR
+       NAMES binarycreator
+       DOC "QtIFW binarycreator executable"
+)
+
+find_program(
+    QtIFW_ARCHIVEGEN
+    NAMES archivegen
+    DOC "QtIFW archivegen executable"
+)
+
+include(CMakeParseArguments)
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(
+       QtIFW
+       FOUND_VAR QtIFW_FOUND
+       REQUIRED_VARS QtIFW_CREATOR QtIFW_ARCHIVEGEN
+)
+
+if (QtIFW_FOUND)
+    function (qtifw_create)
+    
+    endfunction ()
+endif ()
+
+mark_as_advanced(QtIFW_CREATOR)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake/FindQuazip.cmake	Fri Oct 20 14:18:37 2017 +0200
@@ -0,0 +1,28 @@
+# FindQuazip
+# ----------
+#
+# Find Quazip library, this modules defines:
+#
+# Quazip_INCLUDE_DIRS, where to find quazip/quazip.h
+# Quazip_LIBRARIES, where to find library
+# Quazip_FOUND, if it is found
+
+find_package(ZLIB QUIET)
+
+find_path(Quazip_INCLUDE_DIR NAMES quazip/quazip.h)
+find_library(Quazip_LIBRARY NAMES libquazip quazip)
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(
+    Quazip
+    FOUND_VAR Quazip_FOUND
+    REQUIRED_VARS Quazip_LIBRARY Quazip_INCLUDE_DIR ZLIB_LIBRARIES ZLIB_INCLUDE_DIRS
+)
+
+if (ZLIB_FOUND AND Quazip_LIBRARY AND Quazip_INCLUDE_DIR)
+    set(Quazip_LIBRARIES ${Quazip_LIBRARY} ${ZLIB_LIBRARIES})
+    set(Quazip_INCLUDE_DIRS ${Quazip_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS})
+endif ()
+
+mark_as_advanced(Quazip_INCLUDE_DIR Quazip_LIBRARY)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake/FindSDL2.cmake	Fri Oct 20 14:18:37 2017 +0200
@@ -0,0 +1,28 @@
+# FindSDL2
+# --------
+#
+# Find SDL2 library, this modules defines:
+#
+#  SDL2_LIBRARY, the name of the library to link against
+#  SDL2_FOUND, if false, do not try to link to SDL
+#  SDL2_INCLUDE_DIR, where to find SDL.h
+
+find_path(
+    SDL2_INCLUDE_DIR
+    NAMES SDL.h
+    PATH_SUFFIXES include/SDL2 include
+)
+
+find_library(SDL2_LIBRARY NAMES SDL2 SDL2-2.0 libSDL2 libSDL2-2.0)
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(
+    SDL2
+    REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR
+)
+
+set(SDL2_LIBRARIES ${SDL2_LIBRARY})
+set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
+
+mark_as_advanced(SDL2_INCLUDE_DIR SDL2_LIBRARY)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake/FindSysQueue.cmake	Fri Oct 20 14:18:37 2017 +0200
@@ -0,0 +1,52 @@
+# FindSysQueue
+# ------------
+#
+# Locate and check sys/queue.h presence
+#
+# SYSQUEUE_FOUND - system has sys/queue.h
+# SYSQUEUE_SLIST - queue.h has SLIST macros
+# SYSQUEUE_STAILQ - queue.h has STAILQ macros
+# SYSQUEUE_LIST - queue.h has LIST macros
+# SYSQUEUE_TAILQ - queue.h has TAILQ macros
+# SYSQUEUE_SIMPLEQ - queue.h has SIMPLEQ macros
+# SYSQUEUE_CIRCLEQ - queue.h has CIRCLEQ macros
+# SYSQUEUE_TAILQ - queue.h has TAILQ macros
+#
+# Some macros are not available on every systems, these variables are
+# defined if they are found in the queue.h file
+#
+# SYSQUEUE_SLIST_FOREACH - queue.h has SLIST_FOREACH macros
+# SYSQUEUE_SLIST_FOREACH_SAFE - queue.h has SLIST_FOREACH_SAFE macros
+# SYSQUEUE_STAILQ_FOREACH - queue.h has STAILQ_FOREACH macros
+# SYSQUEUE_STAILQ_FOREACH - queue.h has STAILQ_FOREACH_SAFE macros
+# SYSQUEUE_LIST_FOREACH - queue.h has LIST_FOREACH macros
+# SYSQUEUE_LIST_FOREACH_SAFE - queue.h has LIST_FOREACH_SAFE macros
+# SYSQUEUE_TAILQ_FOREACH - queue.h has TAILQ_FOREACH macros
+# SYSQUEUE_TAILQ_FOREACH - queue.h has TAILQ_FOREACH_SAFE macros
+#
+
+include(CheckIncludeFile)
+include(CheckSymbolExists)
+
+check_include_file(sys/queue.h SYSQUEUE_FOUND)
+if (SYSQUEUE_FOUND)
+    foreach (type "SLIST" "STAILQ" "LIST" "TAILQ" "SIMPLEQ" "CIRCLEQ")
+        check_symbol_exists(${type}_HEAD sys/queue.h SYSQUEUE_${type})
+
+        if (SYSQUEUE_${type})
+            # Check for _FOREACH.
+            check_symbol_exists(
+                ${type}_FOREACH
+                sys/queue.h
+                SYSQUEUE_${type}_FOREACH
+            )
+
+            # Check for _FOREACH_SAFE.
+            check_symbol_exists(
+                ${type}_FOREACH_SAFE
+                sys/queue.h
+                SYSQUEUE_${type}_FOREACH_SAFE
+            )
+        endif ()
+    endforeach ()
+endif ()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake/FindZIP.cmake	Fri Oct 20 14:18:37 2017 +0200
@@ -0,0 +1,51 @@
+# FindZIP
+# -------
+#
+# Find libzip library, this modules defines:
+#
+# ZIP_INCLUDE_DIRS, where to find zip.h
+# ZIP_LIBRARIES, where to find library
+# ZIP_FOUND, if it is found
+
+find_package(ZLIB QUIET)
+
+find_path(
+    ZIP_INCLUDE_DIR
+    NAMES zip.h
+)
+
+find_library(
+    ZIP_LIBRARY
+    NAMES zip libzip
+)
+
+find_path(
+    ZIPCONF_INCLUDE_DIR
+    NAMES zipconf.h
+)
+
+if (NOT ZIPCONF_INCLUDE_DIR)
+    # zipconf.h is sometimes directly in the include/ folder but on some systems
+    # like Windows, it is installed in the lib/ directory.
+    get_filename_component(_ZIP_PRIVATE_LIBRARY "${ZIP_LIBRARY}" DIRECTORY)
+
+    find_path(
+        ZIPCONF_INCLUDE_DIR
+        NAMES zipconf.h
+        PATHS "${_ZIP_PRIVATE_LIBRARY}/libzip/include"
+    )
+endif ()
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(
+    ZIP
+    REQUIRED_VARS ZLIB_LIBRARIES ZLIB_INCLUDE_DIRS ZIP_LIBRARY ZIP_INCLUDE_DIR ZIPCONF_INCLUDE_DIR
+)
+
+if (ZIP_FOUND)
+    set(ZIP_LIBRARIES ${ZIP_LIBRARY} ${ZLIB_LIBRARIES})
+    set(ZIP_INCLUDE_DIRS ${ZIP_INCLUDE_DIR} ${ZIPCONF_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS})
+endif ()
+
+mark_as_advanced(ZIP_LIBRARY ZIP_INCLUDE_DIR ZIPCONF_INCLUDE_DIR)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake/functions/DefineOption.cmake	Fri Oct 20 14:18:37 2017 +0200
@@ -0,0 +1,180 @@
+#
+# DefineOption.cmake -- evolved option definition
+#
+# Copyright (c) 2016-2017 David Demelier <markand@malikania.fr>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+
+# 
+# define_option
+# -------------------------------------------------------------------
+#
+# Define an option.
+#
+# The option may have different types, it can be STRING, PATH, BOOL and FEATURE,
+# it will create cache variables using set() or option depending on the type.
+#
+# General invocation takes the following arguments:
+#
+# define_option(
+#   NAME variable name
+#   TYPE BOOL | FEATURE | PATH | STRING
+#   DOC (Optional) option description
+#   DEFAULT (Optional) default value
+# )
+#
+# Some types can takes more arguments, see below the following sections.
+#
+# ## String and paths
+#
+# If type is set to PATH, an additional ${NAME}_ABS variable is defined as the
+# absolute directory to CMAKE_INSTALL_PREFIX if the value is relative.
+#
+# Example:
+#
+# if an option WITH_DOCDIR is of type PATH and set to "share/doc", the variable
+# WITH_DOCDIR_ABS will be set to CMAKE_INSTALL_PREFIX/share/doc.
+#
+# ## Booleans
+#
+# If type is set to BOOL, an additional variable ${NAME}_MSG is set to "Yes" or
+# to "No" depending if the option value is set.
+#
+# If no default value is given, it is set to On.
+#
+# Example:
+#
+# If an option WITH_FOO is of type BOOL and set to On, WITH_FOO_MSG will be set
+# to "Yes".
+#
+# ## Features
+#
+# The FEATURE type is a superset of BOOL. It is designed to check if an option
+# is enabled and able to build. For example, the user requests the feature
+# 'abc' but can't be enabled because the system lacks missing tools.
+#
+# If no default value is given, it is set ${CONDITION}.
+#
+# The command may take the new following extra arguments:
+#
+#   - CONDITION The condition to enable the feature,
+#   - CONDITION_MESSAGE (Optional: default "${OPT_NAME} not found") the reason
+#     to set if the condition is not matched,
+#   - DISABLED_MESSAGE (Optional: default: "${OPT_NAME} disabled by user") the
+#     reason when the option has been disabled by the user.
+#
+# This command create the same variables as BOOL type. It adds also
+# ${NAME}_ENABLED variable which is set to On if both ${CONDITION} and ${NAME}
+# are set to On.
+#
+# Example:
+#
+# find_package(OpenSSL)
+#
+# define_option(
+#   NAME SSL
+#   TYPE FEATURE
+#   CONDITION ${OPENSSL_FOUND}
+#   CONDITION_MESSAGE "OpenSSL not found"
+#   DISABLED_MESSAGE "OpenSSL disabled by user"
+# )
+#
+# By default, if OpenSSL is not found and SSL kept to On, SSL_ENABLED will be
+# set to Off and SSL_MSG will be set to "OpenSSL not found".
+#
+# If SSL is set to Off, SSL_ENABLED will be set to Off and SSL_MSG set to
+# "OpenSSL disabled by user".
+#
+
+include(CMakeParseArguments)
+
+macro (define_option)
+    set(args CONDITION CONDITION_MESSAGE DEFAULT DOC NAME TYPE)
+
+    cmake_parse_arguments(OPT "" "${args}" "" ${ARGN})
+
+    if (NOT DEFINED OPT_NAME)
+        message(FATAL_ERROR "Missing NAME argument")
+    endif ()
+    if (NOT DEFINED OPT_DOC)
+        set(OPT_DOC "Option ${OPT_NAME}")
+    endif ()
+
+    if (${OPT_TYPE} MATCHES BOOL)
+        if (DEFINED OPT_DEFAULT)
+            option(${OPT_NAME} ${OPT_DOC} ${OPT_DEFAULT})
+        else ()
+            option(${OPT_NAME} ${OPT_DOC} On)
+        endif ()
+
+        if (${OPT_NAME})
+            set(${OPT_NAME}_MSG "Yes")
+        else ()
+            set(${OPT_NAME}_MSG "No")
+        endif ()
+    elseif (${OPT_TYPE} MATCHES FEATURE)
+        if (NOT DEFINED OPT_CONDITION)
+            message(FATAL_ERROR "Missing CONDITION argument for FEATURE type")
+        endif ()
+        if (NOT DEFINED OPT_CONDITION_MESSAGE)
+            set(OPT_CONDITION_MESSAGE "${OPT_NAME} not found")
+        endif ()
+        if (NOT DEFINED OPT_DISABLED_MESSAGE)
+            set(OPT_DISABLED_MESSAGE "${OPT_NAME} disabled by user")
+        endif ()
+
+        if (DEFINED OPT_DEFAULT)
+            option(${OPT_NAME} ${OPT_DOC} ${OPT_DEFAULT})
+        else ()
+            option(${OPT_NAME} ${OPT_DOC} ${OPT_CONDITION})
+        endif ()
+
+        if (NOT ${OPT_CONDITION})
+            set(${OPT_NAME}_ENABLED Off)
+            set(${OPT_NAME}_MSG ${OPT_CONDITION_MESSAGE})
+        elseif (NOT ${OPT_NAME})
+            set(${OPT_NAME}_ENABLED Off)
+            set(${OPT_NAME}_MSG ${OPT_DISABLED_MESSAGE})
+        else ()
+            set(${OPT_NAME}_ENABLED On)
+            set(${OPT_NAME}_MSG "Yes")
+        endif ()
+
+        unset(OPT_CONDITION)
+        unset(OPT_CONDITION_MESSAGE)
+        unset(OPT_DISABLED_MESSAGE)
+    elseif (${OPT_TYPE} MATCHES STRING OR ${OPT_TYPE} MATCHES PATH)
+        # Force usage of string because FILEPATH, PATH always use absolute paths.
+        if (OPT_DEFAULT)
+            set(${OPT_NAME} ${OPT_DEFAULT} CACHE STRING ${OPT_DOC})
+        else ()
+            set(${OPT_NAME} "" CACHE STRING ${OPT_DOC})
+        endif ()
+
+        if (${OPT_TYPE} MATCHES PATH)
+            if (IS_ABSOLUTE "${${OPT_NAME}}")
+                set(${OPT_NAME}_ABS ${${OPT_NAME}})
+            else ()
+                set(${OPT_NAME}_ABS ${CMAKE_INSTALL_PREFIX}/${${OPT_NAME}})
+            endif ()
+        endif ()
+    else ()
+        message(FATAL_ERROR "Invalid ${OPT_TYPE} type given")
+    endif ()
+
+    unset(OPT_DEFAULT)
+    unset(OPT_DOC)
+    unset(OPT_NAME)
+    unset(OPT_TYPE)
+endmacro ()