summaryrefslogtreecommitdiffstats
path: root/third-party/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'third-party/cmake')
-rw-r--r--third-party/cmake/BoostTestTargets.cmake262
-rw-r--r--third-party/cmake/BoostTestTargetsDynamic.h9
-rw-r--r--third-party/cmake/BoostTestTargetsIncluded.h7
-rw-r--r--third-party/cmake/BoostTestTargetsStatic.h7
-rw-r--r--third-party/cmake/CopyResourcesToBuildTree.cmake83
-rw-r--r--third-party/cmake/FindBISON.cmake221
-rw-r--r--third-party/cmake/FindEditline.cmake86
-rw-r--r--third-party/cmake/FindFLEX.cmake185
-rw-r--r--third-party/cmake/FindGit.cmake73
-rw-r--r--third-party/cmake/FindMySQL.cmake142
-rw-r--r--third-party/cmake/FindPostgreSQL.cmake185
-rw-r--r--third-party/cmake/FindTermcap.cmake68
-rw-r--r--third-party/cmake/GNUInstallDirs.cmake245
-rw-r--r--third-party/cmake/GetForceIncludeDefinitions.cmake44
-rw-r--r--third-party/cmake/GetGitRevisionDescription.cmake284
-rw-r--r--third-party/cmake/GetGitRevisionDescription.cmake.in43
16 files changed, 1944 insertions, 0 deletions
diff --git a/third-party/cmake/BoostTestTargets.cmake b/third-party/cmake/BoostTestTargets.cmake
new file mode 100644
index 0000000..4555dff
--- /dev/null
+++ b/third-party/cmake/BoostTestTargets.cmake
@@ -0,0 +1,262 @@
+# - Add tests using boost::test
+#
+# Add this line to your test files in place of including a basic boost test header:
+# #include <BoostTestTargetConfig.h>
+#
+# If you cannot do that and must use the included form for a given test,
+# include the line
+# // OVERRIDE_BOOST_TEST_INCLUDED_WARNING
+# in the same file with the boost test include.
+#
+# include(BoostTestTargets)
+# add_boost_test(<testdriver_name> SOURCES <source1> [<more sources...>]
+# [FAIL_REGULAR_EXPRESSION <additional fail regex>]
+# [LAUNCHER <generic launcher script>]
+# [LIBRARIES <library> [<library>...]]
+# [RESOURCES <resource> [<resource>...]]
+# [TESTS <testcasename> [<testcasename>...]]
+# [DEPENDENCIES <dependency> [<dependency>...]])
+#
+# If for some reason you need access to the executable target created,
+# it can be found in ${${testdriver_name}_TARGET_NAME} as specified when
+# you called add_boost_test
+#
+# Requires CMake 2.6 or newer (uses the 'function' command)
+#
+# Requires:
+# GetForceIncludeDefinitions
+# CopyResourcesToBuildTree
+#
+# Original Author:
+# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
+# http://academic.cleardefinition.com
+# Iowa State University HCI Graduate Program/VRAC
+#
+# Copyright Iowa State University 2009-2010.
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+if(__add_boost_test)
+ return()
+endif()
+set(__add_boost_test YES)
+
+set(BOOST_TEST_TARGET_PREFIX "boosttest")
+
+if(NOT Boost_FOUND)
+ find_package(Boost 1.34.0 QUIET)
+endif()
+
+include(GetForceIncludeDefinitions)
+include(CopyResourcesToBuildTree)
+
+if(Boost_FOUND)
+ set(_boosttesttargets_libs)
+ set(_boostConfig "BoostTestTargetsIncluded.h")
+ if(NOT Boost_UNIT_TEST_FRAMEWORK_LIBRARY)
+ find_package(Boost 1.34.0 QUIET COMPONENTS unit_test_framework)
+ endif()
+ if(Boost_UNIT_TEST_FRAMEWORK_LIBRARY)
+ set(_boosttesttargets_libs "${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}")
+ if(Boost_USE_STATIC_LIBS)
+ set(_boostConfig "BoostTestTargetsStatic.h")
+ else()
+ set(_boostConfig "BoostTestTargetsDynamic.h")
+ endif()
+ endif()
+ get_filename_component(_moddir ${CMAKE_CURRENT_LIST_FILE} PATH)
+ configure_file("${_moddir}/${_boostConfig}"
+ "${CMAKE_CURRENT_BINARY_DIR}/BoostTestTargetConfig.h"
+ COPYONLY)
+ include_directories("${CMAKE_CURRENT_BINARY_DIR}")
+endif()
+
+function(add_boost_test _name)
+ if(NOT BUILD_TESTING)
+ return()
+ endif()
+ if("${CMAKE_VERSION}" VERSION_LESS "2.8.0")
+ if(NOT "${_boost_test_cmakever_pestered}x" EQUAL "${CMAKE_VERSION}x")
+ message(STATUS
+ "Not adding boost::test targets - CMake 2.8.0 or newer required, using ${CMAKE_VERSION}")
+ set(_boost_test_cmakever_pestered
+ "${CMAKE_VERSION}"
+ CACHE
+ INTERNAL
+ ""
+ FORCE)
+ endif()
+ return()
+ endif()
+
+ # parse arguments
+ set(_nowhere)
+ set(_curdest _nowhere)
+ set(_val_args
+ SOURCES
+ FAIL_REGULAR_EXPRESSION
+ LAUNCHER
+ LIBRARIES
+ RESOURCES
+ TESTS
+ DEPENDENCIES)
+ set(_bool_args
+ USE_COMPILED_LIBRARY)
+ foreach(_arg ${_val_args} ${_bool_args})
+ set(${_arg})
+ endforeach()
+ foreach(_element ${ARGN})
+ list(FIND _val_args "${_element}" _val_arg_find)
+ list(FIND _bool_args "${_element}" _bool_arg_find)
+ if("${_val_arg_find}" GREATER "-1")
+ set(_curdest "${_element}")
+ elseif("${_bool_arg_find}" GREATER "-1")
+ set("${_element}" ON)
+ set(_curdest _nowhere)
+ else()
+ list(APPEND ${_curdest} "${_element}")
+ endif()
+ endforeach()
+
+ if(_nowhere)
+ message(FATAL_ERROR "Syntax error in use of add_boost_test!")
+ endif()
+
+ if(NOT SOURCES)
+ message(FATAL_ERROR
+ "Syntax error in use of add_boost_test: at least one source file required!")
+ endif()
+
+ if(Boost_FOUND)
+
+ include_directories(${Boost_INCLUDE_DIRS})
+
+ set(includeType)
+ foreach(src ${SOURCES})
+ file(READ ${src} thefile)
+ if("${thefile}" MATCHES ".*BoostTestTargetConfig.h.*")
+ set(includeType CONFIGURED)
+ set(includeFileLoc ${src})
+ break()
+ elseif("${thefile}" MATCHES ".*boost/test/included/unit_test.hpp.*")
+ set(includeType INCLUDED)
+ set(includeFileLoc ${src})
+ set(_boosttesttargets_libs) # clear this out - linking would be a bad idea
+ if(NOT
+ "${thefile}"
+ MATCHES
+ ".*OVERRIDE_BOOST_TEST_INCLUDED_WARNING.*")
+ message("Please replace the include line in ${src} with this alternate include line instead:")
+ message(" \#include <BoostTestTargetConfig.h>")
+ message("Once you've saved your changes, re-run CMake. (See BoostTestTargets.cmake for more info)")
+ endif()
+ break()
+ endif()
+ endforeach()
+
+ if(NOT _boostTestTargetsNagged${_name} STREQUAL "${includeType}")
+ if("${includeType}" STREQUAL "CONFIGURED")
+ message(STATUS
+ "Test '${_name}' uses the CMake-configurable form of the boost test framework - congrats! (Including File: ${includeFileLoc})")
+ elseif("${includeType}" STREQUAL "INCLUDED")
+ message("In test '${_name}': ${includeFileLoc} uses the 'included' form of the boost unit test framework.")
+ else()
+ message("In test '${_name}': Didn't detect the CMake-configurable boost test include.")
+ message("Please replace your existing boost test include in that test with the following:")
+ message(" \#include <BoostTestTargetConfig.h>")
+ message("Once you've saved your changes, re-run CMake. (See BoostTestTargets.cmake for more info)")
+ endif()
+ endif()
+ set(_boostTestTargetsNagged${_name}
+ "${includeType}"
+ CACHE
+ INTERNAL
+ ""
+ FORCE)
+
+
+ if(RESOURCES)
+ list(APPEND SOURCES ${RESOURCES})
+ endif()
+
+ # Generate a unique target name, using the relative binary dir
+ # and provided name. (transform all / into _ and remove all other
+ # non-alphabet characters)
+ file(RELATIVE_PATH
+ targetpath
+ "${CMAKE_BINARY_DIR}"
+ "${CMAKE_CURRENT_BINARY_DIR}")
+ string(REGEX REPLACE "[^A-Za-z/_]" "" targetpath "${targetpath}")
+ string(REPLACE "/" "_" targetpath "${targetpath}")
+
+ set(_target_name ${BOOST_TEST_TARGET_PREFIX}-${targetpath}-${_name})
+ set(${_name}_TARGET_NAME "${_target_name}" PARENT_SCOPE)
+
+ # Build the test.
+ add_executable(${_target_name} ${SOURCES})
+
+ list(APPEND LIBRARIES ${_boosttesttargets_libs})
+
+ if(LIBRARIES)
+ target_link_libraries(${_target_name} ${LIBRARIES})
+ endif()
+
+ if(RESOURCES)
+ set_property(TARGET ${_target_name} PROPERTY RESOURCE ${RESOURCES})
+ copy_resources_to_build_tree(${_target_name})
+ endif()
+
+ if(NOT Boost_TEST_FLAGS)
+# set(Boost_TEST_FLAGS --catch_system_error=yes --output_format=XML)
+ set(Boost_TEST_FLAGS --catch_system_error=yes)
+ endif()
+
+ # TODO: Figure out why only recent boost handles individual test running properly
+
+ if(LAUNCHER)
+ set(_test_command ${LAUNCHER} "\$<TARGET_FILE:${_target_name}>")
+ else()
+ set(_test_command ${_target_name})
+ endif()
+
+ if(TESTS)
+ foreach(_test ${TESTS})
+ add_test(NAME
+ ${_name}-${_test}
+ COMMAND
+ ${_test_command}
+ --run_test=${_test}
+ ${Boost_TEST_FLAGS})
+ if(FAIL_REGULAR_EXPRESSION)
+ set_tests_properties(${_name}-${_test}
+ PROPERTIES
+ FAIL_REGULAR_EXPRESSION
+ "${FAIL_REGULAR_EXPRESSION}")
+ endif()
+ endforeach()
+ else()
+ add_test(NAME
+ ${_name}-boost_test
+ COMMAND
+ ${_test_command}
+ ${Boost_TEST_FLAGS})
+ if(FAIL_REGULAR_EXPRESSION)
+ set_tests_properties(${_name}-${_test}
+ PROPERTIES
+ FAIL_REGULAR_EXPRESSION
+ "${FAIL_REGULAR_EXPRESSION}")
+ endif()
+ endif()
+
+ if (DEPENDENCIES)
+ add_dependencies(${_target_name} ${DEPENDENCIES})
+ endif()
+
+ # CppCheck the test if we can.
+ if(COMMAND add_cppcheck)
+ add_cppcheck(${_target_name} STYLE UNUSED_FUNCTIONS)
+ endif()
+
+ endif()
+endfunction()
diff --git a/third-party/cmake/BoostTestTargetsDynamic.h b/third-party/cmake/BoostTestTargetsDynamic.h
new file mode 100644
index 0000000..ae1f38e
--- /dev/null
+++ b/third-party/cmake/BoostTestTargetsDynamic.h
@@ -0,0 +1,9 @@
+// Small header computed by CMake to set up boost test.
+// include AFTER #define BOOST_TEST_MODULE whatever
+// but before any other boost test includes.
+
+// Using the Boost UTF dynamic library
+
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/unit_test.hpp>
+
diff --git a/third-party/cmake/BoostTestTargetsIncluded.h b/third-party/cmake/BoostTestTargetsIncluded.h
new file mode 100644
index 0000000..253133c
--- /dev/null
+++ b/third-party/cmake/BoostTestTargetsIncluded.h
@@ -0,0 +1,7 @@
+// Small header computed by CMake to set up boost test.
+// include AFTER #define BOOST_TEST_MODULE whatever
+// but before any other boost test includes.
+
+// Using the Boost UTF included framework
+
+#include <boost/test/included/unit_test.hpp>
diff --git a/third-party/cmake/BoostTestTargetsStatic.h b/third-party/cmake/BoostTestTargetsStatic.h
new file mode 100644
index 0000000..dd3cdda
--- /dev/null
+++ b/third-party/cmake/BoostTestTargetsStatic.h
@@ -0,0 +1,7 @@
+// Small header computed by CMake to set up boost test.
+// include AFTER #define BOOST_TEST_MODULE whatever
+// but before any other boost test includes.
+
+// Using the Boost UTF static library
+
+#include <boost/test/unit_test.hpp>
diff --git a/third-party/cmake/CopyResourcesToBuildTree.cmake b/third-party/cmake/CopyResourcesToBuildTree.cmake
new file mode 100644
index 0000000..3512cc4
--- /dev/null
+++ b/third-party/cmake/CopyResourcesToBuildTree.cmake
@@ -0,0 +1,83 @@
+# - Copy the resources your app needs to the build tree.
+#
+# copy_resources_to_build_tree(<target_name>)
+#
+# Requires CMake 2.6 or newer (uses the 'function' command)
+#
+# Original Author:
+# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
+# http://academic.cleardefinition.com
+# Iowa State University HCI Graduate Program/VRAC
+#
+# Copyright Iowa State University 2009-2010.
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+if(__copy_resources_to_build_tree)
+ return()
+endif()
+set(__copy_resources_to_build_tree YES)
+
+function(copy_resources_to_build_tree _target)
+ get_target_property(_resources ${_target} RESOURCE)
+ if(NOT _resources)
+ # Bail if no resources
+ message(STATUS
+ "Told to copy resources for target ${_target}, but "
+ "no resources are set!")
+ return()
+ endif()
+
+ get_target_property(_path ${_target} LOCATION)
+ get_filename_component(_path "${_path}" PATH)
+
+ if(NOT MSVC AND NOT "${CMAKE_GENERATOR}" MATCHES "Makefiles")
+ foreach(_config ${CMAKE_CONFIGURATION_TYPES})
+ get_target_property(_path${_config} ${_target} LOCATION_${_config})
+ get_filename_component(_path${_config} "${_path${_config}}" PATH)
+ add_custom_command(TARGET ${_target}
+ POST_BUILD
+ COMMAND
+ ${CMAKE_COMMAND}
+ ARGS -E make_directory "${_path${_config}}/"
+ COMMENT "Creating directory ${_path${_config}}/")
+ endforeach()
+ endif()
+
+ foreach(_res ${_resources})
+ if(NOT IS_ABSOLUTE "${_res}")
+ get_filename_component(_res "${_res}" ABSOLUTE)
+ endif()
+ get_filename_component(_name "${_res}" NAME)
+
+ if(MSVC)
+ # Working dir is solution file dir, not exe file dir.
+ add_custom_command(TARGET ${_target}
+ POST_BUILD
+ COMMAND
+ ${CMAKE_COMMAND}
+ ARGS -E copy "${_res}" "${CMAKE_BINARY_DIR}/"
+ COMMENT "Copying ${_name} to ${CMAKE_BINARY_DIR}/ for MSVC")
+ else()
+ if("${CMAKE_GENERATOR}" MATCHES "Makefiles")
+ add_custom_command(TARGET ${_target}
+ POST_BUILD
+ COMMAND
+ ${CMAKE_COMMAND}
+ ARGS -E copy "${_res}" "${_path}/"
+ COMMENT "Copying ${_name} to ${_path}/")
+ else()
+ foreach(_config ${CMAKE_CONFIGURATION_TYPES})
+ add_custom_command(TARGET ${_target}
+ POST_BUILD
+ COMMAND
+ ${CMAKE_COMMAND}
+ ARGS -E copy "${_res}" "${_path${_config}}"
+ COMMENT "Copying ${_name} to ${_path${_config}}")
+ endforeach()
+
+ endif()
+ endif()
+ endforeach()
+endfunction()
diff --git a/third-party/cmake/FindBISON.cmake b/third-party/cmake/FindBISON.cmake
new file mode 100644
index 0000000..6c6b420
--- /dev/null
+++ b/third-party/cmake/FindBISON.cmake
@@ -0,0 +1,221 @@
+# - Find bison executable and provides macros to generate custom build rules
+# The module defines the following variables:
+#
+# BISON_EXECUTABLE - path to the bison program
+# BISON_VERSION - version of bison
+# BISON_FOUND - true if the program was found
+#
+# If bison is found, the module defines the macros:
+# BISON_TARGET(<Name> <YaccInput> <CodeOutput> [VERBOSE <file>]
+# [COMPILE_FLAGS <string>] [HEADER <FILE>])
+# which will create a custom rule to generate a parser. <YaccInput> is
+# the path to a yacc file. <CodeOutput> is the name of the source file
+# generated by bison. A header file containing the token list is also
+# generated according to bison's -d option by default or if the HEADER
+# option is used, the argument is passed to bison's --defines option to
+# specify output file. If COMPILE_FLAGS option is specified, the next
+# parameter is added in the bison command line. if VERBOSE option is
+# specified, <file> is created and contains verbose descriptions of the
+# grammar and parser. The macro defines a set of variables:
+# BISON_${Name}_DEFINED - true is the macro ran successfully
+# BISON_${Name}_INPUT - The input source file, an alias for <YaccInput>
+# BISON_${Name}_OUTPUT_SOURCE - The source file generated by bison
+# BISON_${Name}_OUTPUT_HEADER - The header file generated by bison
+# BISON_${Name}_OUTPUTS - The sources files generated by bison
+# BISON_${Name}_COMPILE_FLAGS - Options used in the bison command line
+#
+# ====================================================================
+# Example:
+#
+# find_package(BISON)
+# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp)
+# add_executable(Foo main.cpp ${BISON_MyParser_OUTPUTS})
+# ====================================================================
+
+#=============================================================================
+# Copyright 2009 Kitware, Inc.
+# Copyright 2006 Tristan Carel
+# Modified 2010 by Jon Siwek, adding HEADER option
+#
+# Distributed under the OSI-approved BSD License (the "License"):
+# CMake - Cross Platform Makefile Generator
+# Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+# All rights reserved.
+
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the names of Kitware, Inc., the Insight Software Consortium,
+# nor the names of their contributors may be used to endorse or promote
+# products derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+FIND_PROGRAM(BISON_EXECUTABLE bison DOC "path to the bison executable")
+MARK_AS_ADVANCED(BISON_EXECUTABLE)
+
+IF(BISON_EXECUTABLE)
+
+ EXECUTE_PROCESS(COMMAND ${BISON_EXECUTABLE} --version
+ OUTPUT_VARIABLE BISON_version_output
+ ERROR_VARIABLE BISON_version_error
+ RESULT_VARIABLE BISON_version_result
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ IF(NOT ${BISON_version_result} EQUAL 0)
+ MESSAGE(SEND_ERROR "Command \"${BISON_EXECUTABLE} --version\" failed with output:\n${BISON_version_error}")
+ ELSE()
+ STRING(REGEX REPLACE "^bison \\(GNU Bison\\) ([^\n]+)\n.*" "\\1"
+ BISON_VERSION "${BISON_version_output}")
+ ENDIF()
+
+ # internal macro
+ MACRO(BISON_TARGET_option_verbose Name BisonOutput filename)
+ LIST(APPEND BISON_TARGET_cmdopt "--verbose")
+ GET_FILENAME_COMPONENT(BISON_TARGET_output_path "${BisonOutput}" PATH)
+ GET_FILENAME_COMPONENT(BISON_TARGET_output_name "${BisonOutput}" NAME_WE)
+ ADD_CUSTOM_COMMAND(OUTPUT ${filename}
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy
+ "${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output"
+ "${filename}"
+ DEPENDS
+ "${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output"
+ COMMENT "[BISON][${Name}] Copying bison verbose table to ${filename}"
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+ SET(BISON_${Name}_VERBOSE_FILE ${filename})
+ LIST(APPEND BISON_TARGET_extraoutputs
+ "${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output")
+ ENDMACRO(BISON_TARGET_option_verbose)
+
+ # internal macro
+ MACRO(BISON_TARGET_option_extraopts Options)
+ SET(BISON_TARGET_extraopts "${Options}")
+ SEPARATE_ARGUMENTS(BISON_TARGET_extraopts)
+ LIST(APPEND BISON_TARGET_cmdopt ${BISON_TARGET_extraopts})
+ ENDMACRO(BISON_TARGET_option_extraopts)
+
+ #============================================================
+ # BISON_TARGET (public macro)
+ #============================================================
+ #
+ MACRO(BISON_TARGET Name BisonInput BisonOutput)
+ SET(BISON_TARGET_output_header "")
+ #SET(BISON_TARGET_command_opt "")
+ SET(BISON_TARGET_cmdopt "")
+ SET(BISON_TARGET_outputs "${BisonOutput}")
+ IF(NOT ${ARGC} EQUAL 3 AND
+ NOT ${ARGC} EQUAL 5 AND
+ NOT ${ARGC} EQUAL 7 AND
+ NOT ${ARGC} EQUAL 9)
+ MESSAGE(SEND_ERROR "Usage")
+ ELSE()
+ # Parsing parameters
+ IF(${ARGC} GREATER 5 OR ${ARGC} EQUAL 5)
+ IF("${ARGV3}" STREQUAL "VERBOSE")
+ BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${ARGV4}")
+ ENDIF()
+ IF("${ARGV3}" STREQUAL "COMPILE_FLAGS")
+ BISON_TARGET_option_extraopts("${ARGV4}")
+ ENDIF()
+ IF("${ARGV3}" STREQUAL "HEADER")
+ set(BISON_TARGET_output_header "${ARGV4}")
+ ENDIF()
+ ENDIF()
+
+ IF(${ARGC} GREATER 7 OR ${ARGC} EQUAL 7)
+ IF("${ARGV5}" STREQUAL "VERBOSE")
+ BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${ARGV6}")
+ ENDIF()
+
+ IF("${ARGV5}" STREQUAL "COMPILE_FLAGS")
+ BISON_TARGET_option_extraopts("${ARGV6}")
+ ENDIF()
+
+ IF("${ARGV5}" STREQUAL "HEADER")
+ set(BISON_TARGET_output_header "${ARGV6}")
+ ENDIF()
+ ENDIF()
+
+ IF(${ARGC} EQUAL 9)
+ IF("${ARGV7}" STREQUAL "VERBOSE")
+ BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${ARGV8}")
+ ENDIF()
+
+ IF("${ARGV7}" STREQUAL "COMPILE_FLAGS")
+ BISON_TARGET_option_extraopts("${ARGV8}")
+ ENDIF()
+
+ IF("${ARGV7}" STREQUAL "HEADER")
+ set(BISON_TARGET_output_header "${ARGV8}")
+ ENDIF()
+ ENDIF()
+
+ IF(BISON_TARGET_output_header)
+ # Header's name passed in as argument to be used in --defines option
+ LIST(APPEND BISON_TARGET_cmdopt
+ "--defines=${BISON_TARGET_output_header}")
+ set(BISON_${Name}_OUTPUT_HEADER ${BISON_TARGET_output_header})
+ ELSE()
+ # Header's name generated by bison (see option -d)
+ LIST(APPEND BISON_TARGET_cmdopt "-d")
+ STRING(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${ARGV2}")
+ STRING(REPLACE "c" "h" _fileext ${_fileext})
+ STRING(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}"
+ BISON_${Name}_OUTPUT_HEADER "${ARGV2}")
+ ENDIF()
+
+ LIST(APPEND BISON_TARGET_outputs "${BISON_${Name}_OUTPUT_HEADER}")
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${BISON_TARGET_outputs}
+ ${BISON_TARGET_extraoutputs}
+ COMMAND ${BISON_EXECUTABLE}
+ ARGS ${BISON_TARGET_cmdopt} -o ${ARGV2} ${ARGV1}
+ DEPENDS ${ARGV1}
+ COMMENT "[BISON][${Name}] Building parser with bison ${BISON_VERSION}"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+
+ # define target variables
+ SET(BISON_${Name}_DEFINED TRUE)
+ SET(BISON_${Name}_INPUT ${ARGV1})
+ SET(BISON_${Name}_OUTPUTS ${BISON_TARGET_outputs})
+ SET(BISON_${Name}_COMPILE_FLAGS ${BISON_TARGET_cmdopt})
+ SET(BISON_${Name}_OUTPUT_SOURCE "${BisonOutput}")
+
+ ENDIF(NOT ${ARGC} EQUAL 3 AND
+ NOT ${ARGC} EQUAL 5 AND
+ NOT ${ARGC} EQUAL 7 AND
+ NOT ${ARGC} EQUAL 9)
+ ENDMACRO(BISON_TARGET)
+ #
+ #============================================================
+
+ENDIF(BISON_EXECUTABLE)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(BISON DEFAULT_MSG BISON_EXECUTABLE)
+
+# FindBISON.cmake ends here \ No newline at end of file
diff --git a/third-party/cmake/FindEditline.cmake b/third-party/cmake/FindEditline.cmake
new file mode 100644
index 0000000..eb84e4b
--- /dev/null
+++ b/third-party/cmake/FindEditline.cmake
@@ -0,0 +1,86 @@
+# Copyright (c) 2014, Matthias Vallentin
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+# Tries to find editline headers and libraries
+#
+# Usage of this module as follows:
+#
+# find_package(Editline)
+#
+# Variables used by this module, they can change the default behaviour and need
+# to be set before calling find_package:
+#
+# EDITLINE_ROOT_DIR Set this variable to the root installation of
+# editline if the module has problems finding
+# the proper installation path.
+#
+# Variables defined by this module:
+#
+# EDITLINE_FOUND System has Editline libs/headers
+# EDITLINE_LIBRARIES The Editline libraries
+# EDITLINE_INCLUDE_DIR The location of Editline headers
+# EDITLINE_VERSION The full version of Editline
+# EDITLINE_VERSION_MAJOR The version major of Editline
+# EDITLINE_VERSION_MINOR The version minor of Editline
+
+find_path(EDITLINE_INCLUDE_DIR
+ NAMES histedit.h
+ HINTS ${EDITLINE_ROOT_DIR}/include)
+
+if (EDITLINE_INCLUDE_DIR)
+ file(STRINGS ${EDITLINE_INCLUDE_DIR}/histedit.h editline_header REGEX "^#define.LIBEDIT_[A-Z]+.*$")
+
+ string(REGEX REPLACE ".*#define.LIBEDIT_MAJOR[ \t]+([0-9]+).*" "\\1" EDITLINE_VERSION_MAJOR "${editline_header}")
+ string(REGEX REPLACE ".*#define.LIBEDIT_MINOR[ \t]+([0-9]+).*" "\\1" EDITLINE_VERSION_MINOR "${editline_header}")
+
+ set(EDITLINE_VERSION_MAJOR ${EDITLINE_VERSION_MAJOR} CACHE STRING "" FORCE)
+ set(EDITLINE_VERSION_MINOR ${EDITLINE_VERSION_MINOR} CACHE STRING "" FORCE)
+ set(EDITLINE_VERSION ${EDITLINE_VERSION_MAJOR}.${EDITLINE_VERSION_MINOR}
+ CACHE STRING "" FORCE)
+endif ()
+
+find_library(EDITLINE_LIBRARIES
+ NAMES edit
+ HINTS ${EDITLINE_ROOT_DIR}/lib)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+ Editline
+ DEFAULT_MSG
+ EDITLINE_LIBRARIES
+ EDITLINE_INCLUDE_DIR)
+
+mark_as_advanced(
+ EDITLINE_ROOT_DIR
+ EDITLINE_LIBRARIES
+ EDITLINE_INCLUDE_DIR
+ EDITLINE_VERSION
+ EDITLINE_VERSION_MAJOR
+ EDITLINE_VERSION_MINOR
+ )
diff --git a/third-party/cmake/FindFLEX.cmake b/third-party/cmake/FindFLEX.cmake
new file mode 100644
index 0000000..7cd5c84
--- /dev/null
+++ b/third-party/cmake/FindFLEX.cmake
@@ -0,0 +1,185 @@
+# - Find flex executable and provides a macro to generate custom build rules
+#
+# The module defines the following variables:
+# FLEX_FOUND - true is flex executable is found
+# FLEX_EXECUTABLE - the path to the flex executable
+# FLEX_VERSION - the version of flex
+# FLEX_LIBRARIES - The flex libraries
+#
+# The minimum required version of flex can be specified using the
+# standard syntax, e.g. FIND_PACKAGE(FLEX 2.5.13)
+#
+#
+# If flex is found on the system, the module provides the macro:
+# FLEX_TARGET(Name FlexInput FlexOutput [COMPILE_FLAGS <string>])
+# which creates a custom command to generate the <FlexOutput> file from
+# the <FlexInput> file. If COMPILE_FLAGS option is specified, the next
+# parameter is added to the flex command line. Name is an alias used to
+# get details of this custom command. Indeed the macro defines the
+# following variables:
+# FLEX_${Name}_DEFINED - true is the macro ran successfully
+# FLEX_${Name}_OUTPUTS - the source file generated by the custom rule, an
+# alias for FlexOutput
+# FLEX_${Name}_INPUT - the flex source file, an alias for ${FlexInput}
+#
+# Flex scanners oftenly use tokens defined by Bison: the code generated
+# by Flex depends of the header generated by Bison. This module also
+# defines a macro:
+# ADD_FLEX_BISON_DEPENDENCY(FlexTarget BisonTarget)
+# which adds the required dependency between a scanner and a parser
+# where <FlexTarget> and <BisonTarget> are the first parameters of
+# respectively FLEX_TARGET and BISON_TARGET macros.
+#
+# ====================================================================
+# Example:
+#
+# find_package(BISON)
+# find_package(FLEX)
+#
+# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp
+# FLEX_TARGET(MyScanner lexer.l ${CMAKE_CURRENT_BIANRY_DIR}/lexer.cpp)
+# ADD_FLEX_BISON_DEPENDENCY(MyScanner MyParser)
+#
+# include_directories(${CMAKE_CURRENT_BINARY_DIR})
+# add_executable(Foo
+# Foo.cc
+# ${BISON_MyParser_OUTPUTS}
+# ${FLEX_MyScanner_OUTPUTS}
+# )
+# ====================================================================
+
+#=============================================================================
+# Copyright 2009 Kitware, Inc.
+# Copyright 2006 Tristan Carel
+# Modified 2010 by Jon Siwek, backporting for CMake 2.6 compat
+#
+# Distributed under the OSI-approved BSD License (the "License"):
+# CMake - Cross Platform Makefile Generator
+# Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+# All rights reserved.
+
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the names of Kitware, Inc., the Insight Software Consortium,
+# nor the names of their contributors may be used to endorse or promote
+# products derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+FIND_PROGRAM(FLEX_EXECUTABLE flex DOC "path to the flex executable")
+MARK_AS_ADVANCED(FLEX_EXECUTABLE)
+
+FIND_LIBRARY(FL_LIBRARY NAMES fl
+ DOC "path to the fl library")
+MARK_AS_ADVANCED(FL_LIBRARY)
+SET(FLEX_LIBRARIES ${FL_LIBRARY})
+
+IF(FLEX_EXECUTABLE)
+ GET_FILENAME_COMPONENT(FLEX_EXECUTABLE_NAME ${FLEX_EXECUTABLE} NAME)
+ EXECUTE_PROCESS(COMMAND ${FLEX_EXECUTABLE} --version
+ OUTPUT_VARIABLE FLEX_version_output
+ ERROR_VARIABLE FLEX_version_error
+ RESULT_VARIABLE FLEX_version_result
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ IF(NOT ${FLEX_version_result} EQUAL 0)
+ IF(FLEX_FIND_REQUIRED)
+ MESSAGE(SEND_ERROR "Command \"${FLEX_EXECUTABLE} --version\" failed with output:\n${FLEX_version_output}\n${FLEX_version_error}")
+ ELSE()
+ MESSAGE("Command \"${FLEX_EXECUTABLE} --version\" failed with output:\n${FLEX_version_output}\n${FLEX_version_error}\nFLEX_VERSION will not be available")
+ ENDIF()
+ ELSE()
+ STRING(REGEX REPLACE "^${FLEX_EXECUTABLE_NAME}[^ ]* (.*)$" "\\1"
+ FLEX_VERSION "${FLEX_version_output}")
+ ENDIF()
+
+ IF(FLEX_FIND_VERSION)
+ IF("${FLEX_VERSION}" VERSION_LESS "${FLEX_FIND_VERSION}")
+ MESSAGE(SEND_ERROR "Your version of flex is too old. You can specify an alternative path using -DFLEX_EXECUTABLE=/path/to/flex")
+ ENDIF()
+ ENDIF()
+
+ #============================================================
+ # FLEX_TARGET (public macro)
+ #============================================================
+ #
+ MACRO(FLEX_TARGET Name Input Output)
+ SET(FLEX_TARGET_usage "FLEX_TARGET(<Name> <Input> <Output> [COMPILE_FLAGS <string>]")
+ IF(${ARGC} GREATER 3)
+ IF(${ARGC} EQUAL 5)
+ IF("${ARGV3}" STREQUAL "COMPILE_FLAGS")
+ SET(FLEX_EXECUTABLE_opts "${ARGV4}")
+ SEPARATE_ARGUMENTS(FLEX_EXECUTABLE_opts)
+ ELSE()
+ MESSAGE(SEND_ERROR ${FLEX_TARGET_usage})
+ ENDIF()
+ ELSE()
+ MESSAGE(SEND_ERROR ${FLEX_TARGET_usage})
+ ENDIF()
+ ENDIF()
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${Output}
+ COMMAND ${FLEX_EXECUTABLE}
+ ARGS ${FLEX_EXECUTABLE_opts} -o${Output} ${Input}
+ DEPENDS ${Input}
+ COMMENT "[FLEX][${Name}] Building scanner with flex ${FLEX_VERSION}"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+
+ SET(FLEX_${Name}_DEFINED TRUE)
+ SET(FLEX_${Name}_OUTPUTS ${Output})
+ SET(FLEX_${Name}_INPUT ${Input})
+ SET(FLEX_${Name}_COMPILE_FLAGS ${FLEX_EXECUTABLE_opts})
+ ENDMACRO(FLEX_TARGET)
+ #============================================================
+
+
+ #============================================================
+ # ADD_FLEX_BISON_DEPENDENCY (public macro)
+ #============================================================
+ #
+ MACRO(ADD_FLEX_BISON_DEPENDENCY FlexTarget BisonTarget)
+
+ IF(NOT FLEX_${FlexTarget}_OUTPUTS)
+ MESSAGE(SEND_ERROR "Flex target `${FlexTarget}' does not exists.")
+ ENDIF()
+
+ IF(NOT BISON_${BisonTarget}_OUTPUT_HEADER)
+ MESSAGE(SEND_ERROR "Bison target `${BisonTarget}' does not exists.")
+ ENDIF()
+
+ SET_SOURCE_FILES_PROPERTIES(${FLEX_${FlexTarget}_OUTPUTS}
+ PROPERTIES OBJECT_DEPENDS ${BISON_${BisonTarget}_OUTPUT_HEADER})
+ ENDMACRO(ADD_FLEX_BISON_DEPENDENCY)
+ #============================================================
+
+ENDIF(FLEX_EXECUTABLE)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(FLEX FLEX_EXECUTABLE
+ FLEX_VERSION)
+
+# FindFLEX.cmake ends here
diff --git a/third-party/cmake/FindGit.cmake b/third-party/cmake/FindGit.cmake
new file mode 100644
index 0000000..d23e6f1
--- /dev/null
+++ b/third-party/cmake/FindGit.cmake
@@ -0,0 +1,73 @@
+#.rst:
+# FindGit
+# -------
+#
+#
+#
+# The module defines the following variables:
+#
+# ::
+#
+# GIT_EXECUTABLE - path to git command line client
+# GIT_FOUND - true if the command line client was found
+# GIT_VERSION_STRING - the version of git found (since CMake 2.8.8)
+#
+# Example usage:
+#
+# ::
+#
+# find_package(Git)
+# if(GIT_FOUND)
+# message("git found: ${GIT_EXECUTABLE}")
+# endif()
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+# Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# Look for 'git' or 'eg' (easy git)
+#
+set(git_names git eg)
+
+# Prefer .cmd variants on Windows unless running in a Makefile
+# in the MSYS shell.
+#
+if(WIN32)
+ if(NOT CMAKE_GENERATOR MATCHES "MSYS")
+ set(git_names git.cmd git eg.cmd eg)
+ endif()
+endif()
+
+find_program(GIT_EXECUTABLE
+ NAMES ${git_names}
+ PATH_SUFFIXES Git/cmd Git/bin
+ DOC "git command line client"
+ )
+mark_as_advanced(GIT_EXECUTABLE)
+
+if(GIT_EXECUTABLE)
+ execute_process(COMMAND ${GIT_EXECUTABLE} --version
+ OUTPUT_VARIABLE git_version
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if (git_version MATCHES "^git version [0-9]")
+ string(REPLACE "git version " "" GIT_VERSION_STRING "${git_version}")
+ endif()
+endif()
+
+# Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if
+# all listed variables are TRUE
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Git GIT_EXECUTABLE
+ GIT_VERSION_STRING)
diff --git a/third-party/cmake/FindMySQL.cmake b/third-party/cmake/FindMySQL.cmake
new file mode 100644
index 0000000..d3a6e7f
--- /dev/null
+++ b/third-party/cmake/FindMySQL.cmake
@@ -0,0 +1,142 @@
+#--------------------------------------------------------
+# Copyright (C) 1995-2007 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of version 2 of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# There are special exceptions to the terms and conditions of the GPL
+# as it is applied to this software. View the full text of the exception
+# in file LICENSE.exceptions in the top-level directory of this software
+# distribution.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# The MySQL Connector/ODBC is licensed under the terms of the
+# GPL, like most MySQL Connectors. There are special exceptions
+# to the terms and conditions of the GPL as it is applied to
+# this software, see the FLOSS License Exception available on
+# mysql.com.
+
+##########################################################################
+
+
+FILE(GLOB _macports_include_dirs /opt/local/include/mysql*/mysql)
+
+#-------------- FIND MYSQL_INCLUDE_DIR ------------------
+FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
+ $ENV{MYSQL_INCLUDE_DIR}
+ $ENV{MYSQL_DIR}/include
+ /usr/include/mysql
+ /usr/local/include/mysql
+ /usr/include/mariadb
+ /usr/local/include/mariadb
+ /opt/mysql/mysql/include
+ /opt/mysql/mysql/include/mysql
+ /opt/mysql/include
+ /opt/mariadb/include/mysql
+ /opt/local/include/mysql5
+ /usr/local/mysql/include
+ /usr/local/mysql/include/mysql
+ ${_macports_include_dirs}
+ $ENV{ProgramFiles}/MySQL/*/include
+ $ENV{SystemDrive}/MySQL/*/include
+ $ENV{ProgramFiles}/MariaDB*/include/mysql
+ $ENV{SystemDrive}/MariaDB*/include/mysql
+)
+
+UNSET(_macports_include_dirs)
+
+#----------------- FIND MYSQL_LIB_DIR -------------------
+IF (WIN32)
+ SET(MYSQL_CLIENT_LIBS libmysql)
+
+ # Set lib path suffixes
+ # dist = for mysql binary distributions
+ # build = for custom built tree
+ IF (CMAKE_BUILD_TYPE STREQUAL Debug)
+ SET(libsuffixDist debug)
+ SET(libsuffixBuild Debug)
+ ELSE (CMAKE_BUILD_TYPE STREQUAL Debug)
+ SET(libsuffixDist opt)
+ SET(libsuffixBuild Release)
+ ADD_DEFINITIONS(-DDBUG_OFF)
+ ENDIF (CMAKE_BUILD_TYPE STREQUAL Debug)
+
+ FIND_LIBRARY(MYSQL_LIB NAMES mysqlclient
+ PATHS
+ $ENV{MYSQL_DIR}
+ $ENV{MYSQL_DIR}/lib/${libsuffixDist}
+ $ENV{MYSQL_DIR}/libmysql
+ $ENV{MYSQL_DIR}/libmysql/${libsuffixBuild}
+ $ENV{MYSQL_DIR}/client/${libsuffixBuild}
+ $ENV{MYSQL_DIR}/libmysql/${libsuffixBuild}
+ $ENV{ProgramFiles}/MySQL/*/lib/${libsuffixDist}
+ $ENV{SystemDrive}/MySQL/*/lib/${libsuffixDist})
+ELSE (WIN32)
+ IF (NOT MYSQL_CLIENT_LIBS)
+ SET(MYSQL_CLIENT_LIBS mysqlclient mariadbclient)
+ ENDIF (NOT MYSQL_CLIENT_LIBS)
+
+ FILE(GLOB _macports_lib_dirs /opt/local/lib/mysql*/mysql)
+
+ FIND_LIBRARY(MYSQL_LIB NAMES ${MYSQL_CLIENT_LIBS}
+ PATHS
+ $ENV{MYSQL_DIR}
+ $ENV{MYSQL_DIR}/libmysql_r/.libs
+ $ENV{MYSQL_DIR}/lib
+ $ENV{MYSQL_DIR}/lib/mysql
+ /usr/lib/mysql
+ /usr/local/lib/mysql
+ /usr/local/mysql/lib
+ /usr/local/mysql/lib/mysql
+ /opt/local/mysql5/lib
+ /opt/local/lib/mysql5/mysql
+ /opt/mysql/mysql/lib/mysql
+ /opt/mysql/lib/mysql
+ ${_macports_lib_dirs})
+
+ UNSET(_macports_lib_dirs)
+ENDIF (WIN32)
+
+IF(MYSQL_LIB)
+ GET_FILENAME_COMPONENT(MYSQL_LIB_DIR ${MYSQL_LIB} PATH)
+ENDIF(MYSQL_LIB)
+
+IF (MYSQL_INCLUDE_DIR AND MYSQL_LIB_DIR)
+ SET(MYSQL_FOUND TRUE)
+
+ INCLUDE_DIRECTORIES(${MYSQL_INCLUDE_DIR})
+ LINK_DIRECTORIES(${MYSQL_LIB_DIR})
+
+ FIND_LIBRARY(MYSQL_ZLIB zlib PATHS ${MYSQL_LIB_DIR})
+ FIND_LIBRARY(MYSQL_YASSL yassl PATHS ${MYSQL_LIB_DIR})
+ FIND_LIBRARY(MYSQL_TAOCRYPT taocrypt PATHS ${MYSQL_LIB_DIR})
+
+ IF (MYSQL_ZLIB)
+ SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} zlib)
+ ENDIF (MYSQL_ZLIB)
+ IF (MYSQL_YASSL)
+ SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} yassl)
+ ENDIF (MYSQL_YASSL)
+ IF (MYSQL_TAOCRYPT)
+ SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} taocrypt)
+ ENDIF (MYSQL_TAOCRYPT)
+ # Added needed mysqlclient dependencies on Windows
+ IF (WIN32)
+ SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} ws2_32)
+ ENDIF (WIN32)
+
+ MESSAGE(STATUS "MySQL Include dir: ${MYSQL_INCLUDE_DIR} library dir: ${MYSQL_LIB_DIR}")
+ MESSAGE(STATUS "MySQL client libraries: ${MYSQL_CLIENT_LIBS}")
+ELSE (MYSQL_INCLUDE_DIR AND MYSQL_LIB_DIR)
+ MESSAGE(STATUS "Cannot find MySQL. Include dir: ${MYSQL_INCLUDE_DIR} library dir: ${MYSQL_LIB_DIR}")
+ SET(MYSQL_FOUND FALSE)
+ENDIF (MYSQL_INCLUDE_DIR AND MYSQL_LIB_DIR)
diff --git a/third-party/cmake/FindPostgreSQL.cmake b/third-party/cmake/FindPostgreSQL.cmake
new file mode 100644
index 0000000..4d213d2
--- /dev/null
+++ b/third-party/cmake/FindPostgreSQL.cmake
@@ -0,0 +1,185 @@
+#.rst:
+# FindPostgreSQL
+# --------------
+#
+# Find the PostgreSQL installation.
+#
+# In Windows, we make the assumption that, if the PostgreSQL files are
+# installed, the default directory will be C:\Program Files\PostgreSQL.
+#
+# This module defines
+#
+# ::
+#
+# PostgreSQL_LIBRARIES - the PostgreSQL libraries needed for linking
+# PostgreSQL_INCLUDE_DIRS - the directories of the PostgreSQL headers
+
+#=============================================================================
+# Copyright 2004-2009 Kitware, Inc.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the names of Kitware, Inc., the Insight Software Consortium,
+# nor the names of their contributors may be used to endorse or promote
+# products derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+# ----------------------------------------------------------------------------
+# History:
+# This module is derived from the module originally found in the VTK source tree.
+#
+# ----------------------------------------------------------------------------
+# Note:
+# PostgreSQL_ADDITIONAL_VERSIONS is a variable that can be used to set the
+# version mumber of the implementation of PostgreSQL.
+# In Windows the default installation of PostgreSQL uses that as part of the path.
+# E.g C:\Program Files\PostgreSQL\8.4.
+# Currently, the following version numbers are known to this module:
+# "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0"
+#
+# To use this variable just do something like this:
+# set(PostgreSQL_ADDITIONAL_VERSIONS "9.2" "8.4.4")
+# before calling find_package(PostgreSQL) in your CMakeLists.txt file.
+# This will mean that the versions you set here will be found first in the order
+# specified before the default ones are searched.
+#
+# ----------------------------------------------------------------------------
+# You may need to manually set:
+# PostgreSQL_INCLUDE_DIR - the path to where the PostgreSQL include files are.
+# PostgreSQL_LIBRARY_DIR - The path to where the PostgreSQL library files are.
+# If FindPostgreSQL.cmake cannot find the include files or the library files.
+#
+# ----------------------------------------------------------------------------
+# The following variables are set if PostgreSQL is found:
+# PostgreSQL_FOUND - Set to true when PostgreSQL is found.
+# PostgreSQL_INCLUDE_DIRS - Include directories for PostgreSQL
+# PostgreSQL_LIBRARY_DIRS - Link directories for PostgreSQL libraries
+# PostgreSQL_LIBRARIES - The PostgreSQL libraries.
+#
+# ----------------------------------------------------------------------------
+# If you have installed PostgreSQL in a non-standard location.
+# (Please note that in the following comments, it is assumed that <Your Path>
+# points to the root directory of the include directory of PostgreSQL.)
+# Then you have three options.
+# 1) After CMake runs, set PostgreSQL_INCLUDE_DIR to <Your Path>/include and
+# PostgreSQL_LIBRARY_DIR to wherever the library pq (or libpq in windows) is
+# 2) Use CMAKE_INCLUDE_PATH to set a path to <Your Path>/PostgreSQL<-version>. This will allow find_path()
+# to locate PostgreSQL_INCLUDE_DIR by utilizing the PATH_SUFFIXES option. e.g. In your CMakeLists.txt file
+# set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "<Your Path>/include")
+# 3) Set an environment variable called ${PostgreSQL_ROOT} that points to the root of where you have
+# installed PostgreSQL, e.g. <Your Path>.
+#
+# ----------------------------------------------------------------------------
+
+set(PostgreSQL_INCLUDE_PATH_DESCRIPTION "top-level directory containing the PostgreSQL include directories. E.g /usr/local/include/PostgreSQL/8.4 or C:/Program Files/PostgreSQL/8.4/include")
+set(PostgreSQL_INCLUDE_DIR_MESSAGE "Set the PostgreSQL_INCLUDE_DIR cmake cache entry to the ${PostgreSQL_INCLUDE_PATH_DESCRIPTION}")
+set(PostgreSQL_LIBRARY_PATH_DESCRIPTION "top-level directory containing the PostgreSQL libraries.")
+set(PostgreSQL_LIBRARY_DIR_MESSAGE "Set the PostgreSQL_LIBRARY_DIR cmake cache entry to the ${PostgreSQL_LIBRARY_PATH_DESCRIPTION}")
+set(PostgreSQL_ROOT_DIR_MESSAGE "Set the PostgreSQL_ROOT system variable to where PostgreSQL is found on the machine E.g C:/Program Files/PostgreSQL/8.4")
+
+
+set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS}
+ "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0")
+
+# Define additional search paths for root directories.
+if ( WIN32 )
+ foreach (suffix ${PostgreSQL_KNOWN_VERSIONS} )
+ set(PostgreSQL_ADDITIONAL_SEARCH_PATHS ${PostgreSQL_ADDITIONAL_SEARCH_PATHS} "C:/Program Files/PostgreSQL/${suffix}" )
+ endforeach()
+else()
+ set(PostgreSQL_ADDITIONAL_SEARCH_PATHS ${PostgreSQL_ADDITIONAL_SEARCH_PATHS} "/Library/PostgreSQL/*")
+endif()
+set( PostgreSQL_ROOT_DIRECTORIES
+ ENV PostgreSQL_ROOT
+ ${PostgreSQL_ROOT}
+ ${PostgreSQL_ADDITIONAL_SEARCH_PATHS}
+)
+
+#
+# Look for an installation.
+#
+find_path(PostgreSQL_INCLUDE_DIR
+ NAMES libpq-fe.h
+ PATHS
+ # Look in other places.
+ ${PostgreSQL_ROOT_DIRECTORIES}
+ PATH_SUFFIXES
+ pgsql
+ postgresql
+ include
+ # Help the user find it if we cannot.
+ DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}"
+)
+
+# The PostgreSQL library.
+set (PostgreSQL_LIBRARY_TO_FIND pq)
+# Setting some more prefixes for the library
+set (PostgreSQL_LIB_PREFIX "")
+if ( WIN32 )
+ set (PostgreSQL_LIB_PREFIX ${PostgreSQL_LIB_PREFIX} "lib")
+ set ( PostgreSQL_LIBRARY_TO_FIND ${PostgreSQL_LIB_PREFIX}${PostgreSQL_LIBRARY_TO_FIND})
+endif()
+
+find_library( PostgreSQL_LIBRARY
+ NAMES ${PostgreSQL_LIBRARY_TO_FIND}
+ PATHS
+ ${PostgreSQL_ROOT_DIRECTORIES}
+ PATH_SUFFIXES
+ lib
+)
+get_filename_component(PostgreSQL_LIBRARY_DIR ${PostgreSQL_LIBRARY} PATH)
+
+if (PostgreSQL_INCLUDE_DIR AND EXISTS "${PostgreSQL_INCLUDE_DIR}/pg_config.h")
+ file(STRINGS "${PostgreSQL_INCLUDE_DIR}/pg_config.h" pgsql_version_str
+ REGEX "^#define[\t ]+PG_VERSION[\t ]+\".*\"")
+
+ string(REGEX REPLACE "^#define[\t ]+PG_VERSION[\t ]+\"([^\"]*)\".*" "\\1"
+ PostgreSQL_VERSION_STRING "${pgsql_version_str}")
+ set(pgsql_version_str "")
+endif()
+
+# Did we find anything?
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(PostgreSQL DEFAULT_MSG
+ PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR)
+set( PostgreSQL_FOUND ${POSTGRESQL_FOUND})
+
+# Now try to get the include and library path.
+if(PostgreSQL_FOUND)
+
+ set(PostgreSQL_INCLUDE_DIRS ${PostgreSQL_INCLUDE_DIR} )
+ set(PostgreSQL_LIBRARY_DIRS ${PostgreSQL_LIBRARY_DIR} )
+ set(PostgreSQL_LIBRARIES ${PostgreSQL_LIBRARY_TO_FIND})
+
+ #message("Final PostgreSQL include dir: ${PostgreSQL_INCLUDE_DIRS}")
+ #message("Final PostgreSQL library dir: ${PostgreSQL_LIBRARY_DIRS}")
+ #message("Final PostgreSQL libraries: ${PostgreSQL_LIBRARIES}")
+endif()
+
+mark_as_advanced(PostgreSQL_INCLUDE_DIR PostgreSQL_LIBRARY )
diff --git a/third-party/cmake/FindTermcap.cmake b/third-party/cmake/FindTermcap.cmake
new file mode 100644
index 0000000..ba7c97b
--- /dev/null
+++ b/third-party/cmake/FindTermcap.cmake
@@ -0,0 +1,68 @@
+# Copyright (c) 2014, Matthias Vallentin
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+# Tries to find termcap headers and libraries
+#
+# Usage of this module as follows:
+#
+# find_package(Termcap)
+#
+# Variables used by this module, they can change the default behaviour and need
+# to be set before calling find_package:
+#
+# TERMCAP_ROOT_DIR Set this variable to the root installation of
+# termcap if the module has problems finding
+# the proper installation path.
+#
+# Variables defined by this module:
+#
+# TERMCAP_FOUND System has Termcap libs/headers
+# TERMCAP_LIBRARIES The Termcap libraries
+# TERMCAP_INCLUDE_DIR The location of Termcap headers
+
+find_path(TERMCAP_INCLUDE_DIR
+ NAMES termcap.h
+ HINTS ${TERMCAP_ROOT_DIR}/include)
+
+find_library(TERMCAP_LIBRARIES
+ NAMES termcap ncurses
+ HINTS ${TERMCAP_ROOT_DIR}/lib)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+ Termcap
+ DEFAULT_MSG
+ TERMCAP_LIBRARIES
+ TERMCAP_INCLUDE_DIR)
+
+mark_as_advanced(
+ TERMCAP_ROOT_DIR
+ TERMCAP_LIBRARIES
+ TERMCAP_INCLUDE_DIR
+ )
diff --git a/third-party/cmake/GNUInstallDirs.cmake b/third-party/cmake/GNUInstallDirs.cmake
new file mode 100644
index 0000000..60e9099
--- /dev/null
+++ b/third-party/cmake/GNUInstallDirs.cmake
@@ -0,0 +1,245 @@
+#.rst:
+# GNUInstallDirs
+# --------------
+#
+# Define GNU standard installation directories
+#
+# Provides install directory variables as defined for GNU software:
+#
+# ::
+#
+# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
+#
+# Inclusion of this module defines the following variables:
+#
+# ::
+#
+# CMAKE_INSTALL_<dir> - destination for files of a given type
+# CMAKE_INSTALL_FULL_<dir> - corresponding absolute path
+#
+# where <dir> is one of:
+#
+# ::
+#
+# BINDIR - user executables (bin)
+# SBINDIR - system admin executables (sbin)
+# LIBEXECDIR - program executables (libexec)
+# SYSCONFDIR - read-only single-machine data (etc)
+# SHAREDSTATEDIR - modifiable architecture-independent data (com)
+# LOCALSTATEDIR - modifiable single-machine data (var)
+# LIBDIR - object code libraries (lib or lib64 or lib/<multiarch-tuple> on Debian)
+# INCLUDEDIR - C header files (include)
+# OLDINCLUDEDIR - C header files for non-gcc (/usr/include)
+# DATAROOTDIR - read-only architecture-independent data root (share)
+# DATADIR - read-only architecture-independent data (DATAROOTDIR)
+# INFODIR - info documentation (DATAROOTDIR/info)
+# LOCALEDIR - locale-dependent data (DATAROOTDIR/locale)
+# MANDIR - man documentation (DATAROOTDIR/man)
+# DOCDIR - documentation root (DATAROOTDIR/doc/PROJECT_NAME)
+#
+# Each CMAKE_INSTALL_<dir> value may be passed to the DESTINATION
+# options of install() commands for the corresponding file type. If the
+# includer does not define a value the above-shown default will be used
+# and the value will appear in the cache for editing by the user. Each
+# CMAKE_INSTALL_FULL_<dir> value contains an absolute path constructed
+# from the corresponding destination by prepending (if necessary) the
+# value of CMAKE_INSTALL_PREFIX.
+
+#=============================================================================
+# Copyright 2011 Nikita Krupen'ko <krnekit@gmail.com>
+# Copyright 2011 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# Installation directories
+#
+if(NOT DEFINED CMAKE_INSTALL_BINDIR)
+ set(CMAKE_INSTALL_BINDIR "bin" CACHE PATH "user executables (bin)")
+endif()
+
+if(NOT DEFINED CMAKE_INSTALL_SBINDIR)
+ set(CMAKE_INSTALL_SBINDIR "sbin" CACHE PATH "system admin executables (sbin)")
+endif()
+
+if(NOT DEFINED CMAKE_INSTALL_LIBEXECDIR)
+ set(CMAKE_INSTALL_LIBEXECDIR "libexec" CACHE PATH "program executables (libexec)")
+endif()
+
+if(NOT DEFINED CMAKE_INSTALL_SYSCONFDIR)
+ set(CMAKE_INSTALL_SYSCONFDIR "etc" CACHE PATH "read-only single-machine data (etc)")
+endif()
+
+if(NOT DEFINED CMAKE_INSTALL_SHAREDSTATEDIR)
+ set(CMAKE_INSTALL_SHAREDSTATEDIR "com" CACHE PATH "modifiable architecture-independent data (com)")
+endif()
+
+if(NOT DEFINED CMAKE_INSTALL_LOCALSTATEDIR)
+ set(CMAKE_INSTALL_LOCALSTATEDIR "var" CACHE PATH "modifiable single-machine data (var)")
+endif()
+
+if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
+ set(_LIBDIR_DEFAULT "lib")
+ # Override this default 'lib' with 'lib64' iff:
+ # - we are on Linux system but NOT cross-compiling
+ # - we are NOT on debian
+ # - we are on a 64 bits system
+ # reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf
+ # For Debian with multiarch, use 'lib/${CMAKE_LIBRARY_ARCHITECTURE}' if
+ # CMAKE_LIBRARY_ARCHITECTURE is set (which contains e.g. "i386-linux-gnu"
+ # and CMAKE_INSTALL_PREFIX is "/usr"
+ # See http://wiki.debian.org/Multiarch
+ if(DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX)
+ set(__LAST_LIBDIR_DEFAULT "lib")
+ # __LAST_LIBDIR_DEFAULT is the default value that we compute from
+ # _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX, not a cache entry for
+ # the value that was last used as the default.
+ # This value is used to figure out whether the user changed the
+ # CMAKE_INSTALL_LIBDIR value manually, or if the value was the
+ # default one. When CMAKE_INSTALL_PREFIX changes, the value is
+ # updated to the new default, unless the user explicitly changed it.
+ endif()
+ if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$"
+ AND NOT CMAKE_CROSSCOMPILING)
+ if (EXISTS "/etc/debian_version") # is this a debian system ?
+ if(CMAKE_LIBRARY_ARCHITECTURE)
+ if("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$")
+ set(_LIBDIR_DEFAULT "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
+ endif()
+ if(DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX
+ AND "${_GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$")
+ set(__LAST_LIBDIR_DEFAULT "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
+ endif()
+ endif()
+ else() # not debian, rely on CMAKE_SIZEOF_VOID_P:
+ if(NOT DEFINED CMAKE_SIZEOF_VOID_P)
+ message(AUTHOR_WARNING
+ "Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. "
+ "Please enable at least one language before including GNUInstallDirs.")
+ else()
+ if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
+ set(_LIBDIR_DEFAULT "lib64")
+ if(DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX)
+ set(__LAST_LIBDIR_DEFAULT "lib64")
+ endif()
+ endif()
+ endif()
+ endif()
+ endif()
+ if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
+ set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})")
+ elseif(DEFINED __LAST_LIBDIR_DEFAULT
+ AND "${__LAST_LIBDIR_DEFAULT}" STREQUAL "${CMAKE_INSTALL_LIBDIR}")
+ set_property(CACHE CMAKE_INSTALL_LIBDIR PROPERTY VALUE "${_LIBDIR_DEFAULT}")
+ endif()
+endif()
+# Save for next run
+set(_GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE INTERNAL "CMAKE_INSTALL_PREFIX during last run")
+
+
+if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR)
+ set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE PATH "C header files (include)")
+endif()
+
+if(NOT DEFINED CMAKE_INSTALL_OLDINCLUDEDIR)
+ set(CMAKE_INSTALL_OLDINCLUDEDIR "/usr/include" CACHE PATH "C header files for non-gcc (/usr/include)")
+endif()
+
+if(NOT DEFINED CMAKE_INSTALL_DATAROOTDIR)
+ set(CMAKE_INSTALL_DATAROOTDIR "share" CACHE PATH "read-only architecture-independent data root (share)")
+endif()
+
+#-----------------------------------------------------------------------------
+# Values whose defaults are relative to DATAROOTDIR. Store empty values in
+# the cache and store the defaults in local variables if the cache values are
+# not set explicitly. This auto-updates the defaults as DATAROOTDIR changes.
+
+if(NOT CMAKE_INSTALL_DATADIR)
+ set(CMAKE_INSTALL_DATADIR "" CACHE PATH "read-only architecture-independent data (DATAROOTDIR)")
+ set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR}")
+endif()
+
+if(CMAKE_SYSTEM_NAME MATCHES "(DragonFly|FreeBSD|OpenBSD|NetBSD)")
+ if(NOT CMAKE_INSTALL_INFODIR)
+ set(CMAKE_INSTALL_INFODIR "" CACHE PATH "info documentation (info)")
+ set(CMAKE_INSTALL_INFODIR "info")
+ endif()
+
+ if(NOT CMAKE_INSTALL_MANDDIR)
+ set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (man)")
+ set(CMAKE_INSTALL_MANDIR "man")
+ endif()
+else()
+ if(NOT CMAKE_INSTALL_INFODIR)
+ set(CMAKE_INSTALL_INFODIR "" CACHE PATH "info documentation (DATAROOTDIR/info)")
+ set(CMAKE_INSTALL_INFODIR "${CMAKE_INSTALL_DATAROOTDIR}/info")
+ endif()
+
+ if(NOT CMAKE_INSTALL_MANDDIR)
+ set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (DATAROOTDIR/man)")
+ set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_DATAROOTDIR}/man")
+ endif()
+endif()
+
+if(NOT CMAKE_INSTALL_LOCALEDIR)
+ set(CMAKE_INSTALL_LOCALEDIR "" CACHE PATH "locale-dependent data (DATAROOTDIR/locale)")
+ set(CMAKE_INSTALL_LOCALEDIR "${CMAKE_INSTALL_DATAROOTDIR}/locale")
+endif()
+
+if(NOT CMAKE_INSTALL_DOCDIR)
+ set(CMAKE_INSTALL_DOCDIR "" CACHE PATH "documentation root (DATAROOTDIR/doc/PROJECT_NAME)")
+ set(CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}")
+endif()
+
+#-----------------------------------------------------------------------------
+
+mark_as_advanced(
+ CMAKE_INSTALL_BINDIR
+ CMAKE_INSTALL_SBINDIR
+ CMAKE_INSTALL_LIBEXECDIR
+ CMAKE_INSTALL_SYSCONFDIR
+ CMAKE_INSTALL_SHAREDSTATEDIR
+ CMAKE_INSTALL_LOCALSTATEDIR
+ CMAKE_INSTALL_LIBDIR
+ CMAKE_INSTALL_INCLUDEDIR
+ CMAKE_INSTALL_OLDINCLUDEDIR
+ CMAKE_INSTALL_DATAROOTDIR
+ CMAKE_INSTALL_DATADIR
+ CMAKE_INSTALL_INFODIR
+ CMAKE_INSTALL_LOCALEDIR
+ CMAKE_INSTALL_MANDIR
+ CMAKE_INSTALL_DOCDIR
+ )
+
+# Result directories
+#
+foreach(dir
+ BINDIR
+ SBINDIR
+ LIBEXECDIR
+ SYSCONFDIR
+ SHAREDSTATEDIR
+ LOCALSTATEDIR
+ LIBDIR
+ INCLUDEDIR
+ OLDINCLUDEDIR
+ DATAROOTDIR
+ DATADIR
+ INFODIR
+ LOCALEDIR
+ MANDIR
+ DOCDIR
+ )
+ if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}})
+ set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
+ else()
+ set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}")
+ endif()
+endforeach()
diff --git a/third-party/cmake/GetForceIncludeDefinitions.cmake b/third-party/cmake/GetForceIncludeDefinitions.cmake
new file mode 100644
index 0000000..efcca04
--- /dev/null
+++ b/third-party/cmake/GetForceIncludeDefinitions.cmake
@@ -0,0 +1,44 @@
+# - Get the platform-appropriate flags to add to force inclusion of a file
+#
+# The most common use of this is to use a generated config.h-type file
+# placed out of the source tree in all files.
+#
+# get_force_include_definitions(var forcedincludefiles...) -
+# where var is the name of your desired output variable, and everything
+# else is a source file to forcibly include.
+# a list item to be filtered.
+#
+# Original Author:
+# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
+# http://academic.cleardefinition.com
+# Iowa State University HCI Graduate Program/VRAC
+#
+# Copyright Iowa State University 2009-2010.
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+if(__get_force_include_definitions)
+ return()
+endif()
+set(__get_force_include_definitions YES)
+
+function(get_force_include_definitions var)
+ set(_flagprefix)
+ if(CMAKE_COMPILER_IS_GNUCXX)
+ set(_flag "-include")
+ elseif(MSVC)
+ set(_flag "/FI")
+ else()
+ message(SEND_ERROR "You don't seem to be using MSVC or GCC, but")
+ message(SEND_ERROR "the project called get_force_include_definitions.")
+ message(SEND_ERROR "Contact this project with the name of your")
+ message(FATAL_ERROR "compiler and preferably the flag to force includes")
+ endif()
+
+ set(_out)
+ foreach(_item ${ARGN})
+ list(APPEND _out "${_flag} \"${_item}\"")
+ endforeach()
+ set(${var} "${_out}" PARENT_SCOPE)
+endfunction()
diff --git a/third-party/cmake/GetGitRevisionDescription.cmake b/third-party/cmake/GetGitRevisionDescription.cmake
new file mode 100644
index 0000000..4fbd90d
--- /dev/null
+++ b/third-party/cmake/GetGitRevisionDescription.cmake
@@ -0,0 +1,284 @@
+# - Returns a version string from Git
+#
+# These functions force a re-configure on each git commit so that you can
+# trust the values of the variables in your build system.
+#
+# get_git_head_revision(<refspecvar> <hashvar> [ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR])
+#
+# Returns the refspec and sha hash of the current head revision
+#
+# git_describe(<var> [<additional arguments to git describe> ...])
+#
+# Returns the results of git describe on the source tree, and adjusting
+# the output so that it tests false if an error occurs.
+#
+# git_describe_working_tree(<var> [<additional arguments to git describe> ...])
+#
+# Returns the results of git describe on the working tree (--dirty option),
+# and adjusting the output so that it tests false if an error occurs.
+#
+# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
+#
+# Returns the results of git describe --exact-match on the source tree,
+# and adjusting the output so that it tests false if there was no exact
+# matching tag.
+#
+# git_local_changes(<var>)
+#
+# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes.
+# Uses the return code of "git diff-index --quiet HEAD --".
+# Does not regard untracked files.
+#
+# Requires CMake 2.6 or newer (uses the 'function' command)
+#
+# Original Author:
+# 2009-2020 Ryan Pavlik <ryan.pavlik@gmail.com> <abiryan@ryand.net>
+# http://academic.cleardefinition.com
+#
+# Copyright 2009-2013, Iowa State University.
+# Copyright 2013-2020, Ryan Pavlik
+# Copyright 2013-2020, Contributors
+# SPDX-License-Identifier: BSL-1.0
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+if(__get_git_revision_description)
+ return()
+endif()
+set(__get_git_revision_description YES)
+
+# We must run the following at "include" time, not at function call time,
+# to find the path to this module rather than the path to a calling list file
+get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
+
+# Function _git_find_closest_git_dir finds the next closest .git directory
+# that is part of any directory in the path defined by _start_dir.
+# The result is returned in the parent scope variable whose name is passed
+# as variable _git_dir_var. If no .git directory can be found, the
+# function returns an empty string via _git_dir_var.
+#
+# Example: Given a path C:/bla/foo/bar and assuming C:/bla/.git exists and
+# neither foo nor bar contain a file/directory .git. This wil return
+# C:/bla/.git
+#
+function(_git_find_closest_git_dir _start_dir _git_dir_var)
+ set(cur_dir "${_start_dir}")
+ set(git_dir "${_start_dir}/.git")
+ while(NOT EXISTS "${git_dir}")
+ # .git dir not found, search parent directories
+ set(git_previous_parent "${cur_dir}")
+ get_filename_component(cur_dir "${cur_dir}" DIRECTORY)
+ if(cur_dir STREQUAL git_previous_parent)
+ # We have reached the root directory, we are not in git
+ set(${_git_dir_var}
+ ""
+ PARENT_SCOPE)
+ return()
+ endif()
+ set(git_dir "${cur_dir}/.git")
+ endwhile()
+ set(${_git_dir_var}
+ "${git_dir}"
+ PARENT_SCOPE)
+endfunction()
+
+function(get_git_head_revision _refspecvar _hashvar)
+ _git_find_closest_git_dir("${CMAKE_CURRENT_SOURCE_DIR}" GIT_DIR)
+
+ if("${ARGN}" STREQUAL "ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR")
+ set(ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR TRUE)
+ else()
+ set(ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR FALSE)
+ endif()
+ if(NOT "${GIT_DIR}" STREQUAL "")
+ file(RELATIVE_PATH _relative_to_source_dir "${CMAKE_SOURCE_DIR}"
+ "${GIT_DIR}")
+ if("${_relative_to_source_dir}" MATCHES "[.][.]" AND NOT ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR)
+ # We've gone above the CMake root dir.
+ set(GIT_DIR "")
+ endif()
+ endif()
+ if("${GIT_DIR}" STREQUAL "")
+ set(${_refspecvar}
+ "GITDIR-NOTFOUND"
+ PARENT_SCOPE)
+ set(${_hashvar}
+ "GITDIR-NOTFOUND"
+ PARENT_SCOPE)
+ return()
+ endif()
+
+ # Check if the current source dir is a git submodule or a worktree.
+ # In both cases .git is a file instead of a directory.
+ #
+ if(NOT IS_DIRECTORY ${GIT_DIR})
+ # The following git command will return a non empty string that
+ # points to the super project working tree if the current
+ # source dir is inside a git submodule.
+ # Otherwise the command will return an empty string.
+ #
+ execute_process(
+ COMMAND "${GIT_EXECUTABLE}" rev-parse
+ --show-superproject-working-tree
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+ OUTPUT_VARIABLE out
+ ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(NOT "${out}" STREQUAL "")
+ # If out is empty, GIT_DIR/CMAKE_CURRENT_SOURCE_DIR is in a submodule
+ file(READ ${GIT_DIR} submodule)
+ string(REGEX REPLACE "gitdir: (.*)$" "\\1" GIT_DIR_RELATIVE
+ ${submodule})
+ string(STRIP ${GIT_DIR_RELATIVE} GIT_DIR_RELATIVE)
+ get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
+ get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE}
+ ABSOLUTE)
+ set(HEAD_SOURCE_FILE "${GIT_DIR}/HEAD")
+ else()
+ # GIT_DIR/CMAKE_CURRENT_SOURCE_DIR is in a worktree
+ file(READ ${GIT_DIR} worktree_ref)
+ # The .git directory contains a path to the worktree information directory
+ # inside the parent git repo of the worktree.
+ #
+ string(REGEX REPLACE "gitdir: (.*)$" "\\1" git_worktree_dir
+ ${worktree_ref})
+ string(STRIP ${git_worktree_dir} git_worktree_dir)
+ _git_find_closest_git_dir("${git_worktree_dir}" GIT_DIR)
+ set(HEAD_SOURCE_FILE "${git_worktree_dir}/HEAD")
+ endif()
+ else()
+ set(HEAD_SOURCE_FILE "${GIT_DIR}/HEAD")
+ endif()
+ set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
+ if(NOT EXISTS "${GIT_DATA}")
+ file(MAKE_DIRECTORY "${GIT_DATA}")
+ endif()
+
+ if(NOT EXISTS "${HEAD_SOURCE_FILE}")
+ return()
+ endif()
+ set(HEAD_FILE "${GIT_DATA}/HEAD")
+ configure_file("${HEAD_SOURCE_FILE}" "${HEAD_FILE}" COPYONLY)
+
+ configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
+ "${GIT_DATA}/grabRef.cmake" @ONLY)
+ include("${GIT_DATA}/grabRef.cmake")
+
+ set(${_refspecvar}
+ "${HEAD_REF}"
+ PARENT_SCOPE)
+ set(${_hashvar}
+ "${HEAD_HASH}"
+ PARENT_SCOPE)
+endfunction()
+
+function(git_describe _var)
+ if(NOT GIT_FOUND)
+ find_package(Git QUIET)
+ endif()
+ get_git_head_revision(refspec hash)
+ if(NOT GIT_FOUND)
+ set(${_var}
+ "GIT-NOTFOUND"
+ PARENT_SCOPE)
+ return()
+ endif()
+ if(NOT hash)
+ set(${_var}
+ "HEAD-HASH-NOTFOUND"
+ PARENT_SCOPE)
+ return()
+ endif()
+
+ # TODO sanitize
+ #if((${ARGN}" MATCHES "&&") OR
+ # (ARGN MATCHES "||") OR
+ # (ARGN MATCHES "\\;"))
+ # message("Please report the following error to the project!")
+ # message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
+ #endif()
+
+ #message(STATUS "Arguments to execute_process: ${ARGN}")
+
+ execute_process(
+ COMMAND "${GIT_EXECUTABLE}" describe --tags --always ${hash} ${ARGN}
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+ RESULT_VARIABLE res
+ OUTPUT_VARIABLE out
+ ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(NOT res EQUAL 0)
+ set(out "${out}-${res}-NOTFOUND")
+ endif()
+
+ set(${_var}
+ "${out}"
+ PARENT_SCOPE)
+endfunction()
+
+function(git_describe_working_tree _var)
+ if(NOT GIT_FOUND)
+ find_package(Git QUIET)
+ endif()
+ if(NOT GIT_FOUND)
+ set(${_var}
+ "GIT-NOTFOUND"
+ PARENT_SCOPE)
+ return()
+ endif()
+
+ execute_process(
+ COMMAND "${GIT_EXECUTABLE}" describe --dirty ${ARGN}
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+ RESULT_VARIABLE res
+ OUTPUT_VARIABLE out
+ ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(NOT res EQUAL 0)
+ set(out "${out}-${res}-NOTFOUND")
+ endif()
+
+ set(${_var}
+ "${out}"
+ PARENT_SCOPE)
+endfunction()
+
+function(git_get_exact_tag _var)
+ git_describe(out --exact-match ${ARGN})
+ set(${_var}
+ "${out}"
+ PARENT_SCOPE)
+endfunction()
+
+function(git_local_changes _var)
+ if(NOT GIT_FOUND)
+ find_package(Git QUIET)
+ endif()
+ get_git_head_revision(refspec hash)
+ if(NOT GIT_FOUND)
+ set(${_var}
+ "GIT-NOTFOUND"
+ PARENT_SCOPE)
+ return()
+ endif()
+ if(NOT hash)
+ set(${_var}
+ "HEAD-HASH-NOTFOUND"
+ PARENT_SCOPE)
+ return()
+ endif()
+
+ execute_process(
+ COMMAND "${GIT_EXECUTABLE}" diff-index --quiet HEAD --
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+ RESULT_VARIABLE res
+ OUTPUT_VARIABLE out
+ ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(res EQUAL 0)
+ set(${_var}
+ "CLEAN"
+ PARENT_SCOPE)
+ else()
+ set(${_var}
+ "DIRTY"
+ PARENT_SCOPE)
+ endif()
+endfunction()
diff --git a/third-party/cmake/GetGitRevisionDescription.cmake.in b/third-party/cmake/GetGitRevisionDescription.cmake.in
new file mode 100644
index 0000000..116efc4
--- /dev/null
+++ b/third-party/cmake/GetGitRevisionDescription.cmake.in
@@ -0,0 +1,43 @@
+#
+# Internal file for GetGitRevisionDescription.cmake
+#
+# Requires CMake 2.6 or newer (uses the 'function' command)
+#
+# Original Author:
+# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
+# http://academic.cleardefinition.com
+# Iowa State University HCI Graduate Program/VRAC
+#
+# Copyright 2009-2012, Iowa State University
+# Copyright 2011-2015, Contributors
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+# SPDX-License-Identifier: BSL-1.0
+
+set(HEAD_HASH)
+
+file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
+
+string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
+if(HEAD_CONTENTS MATCHES "ref")
+ # named branch
+ string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
+ if(EXISTS "@GIT_DIR@/${HEAD_REF}")
+ configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
+ else()
+ configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
+ file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
+ if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
+ set(HEAD_HASH "${CMAKE_MATCH_1}")
+ endif()
+ endif()
+else()
+ # detached HEAD
+ configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
+endif()
+
+if(NOT HEAD_HASH)
+ file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
+ string(STRIP "${HEAD_HASH}" HEAD_HASH)
+endif()