Import civetweb ans jsoncpp

This commit is contained in:
2016-02-27 00:07:26 +01:00
parent 5ed9eb9715
commit 3bc376da33
1153 changed files with 554633 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
# - Adds a compiler flag if it is supported by the compiler
#
# This function checks that the supplied compiler flag is supported and then
# adds it to the corresponding compiler flags
#
# add_c_compiler_flag(<FLAG> [<VARIANT>])
#
# - Example
#
# include(AddCCompilerFlag)
# add_c_compiler_flag(-Wall)
# add_c_compiler_flag(-no-strict-aliasing RELEASE)
# Requires CMake 2.6+
if(__add_c_compiler_flag)
return()
endif()
set(__add_c_compiler_flag INCLUDED)
include(CheckCCompilerFlag)
function(add_c_compiler_flag FLAG)
string(TOUPPER "HAVE_C_FLAG_${FLAG}" SANITIZED_FLAG)
string(REPLACE "+" "X" SANITIZED_FLAG ${SANITIZED_FLAG})
string(REGEX REPLACE "[^A-Za-z_0-9]" "_" SANITIZED_FLAG ${SANITIZED_FLAG})
string(REGEX REPLACE "_+" "_" SANITIZED_FLAG ${SANITIZED_FLAG})
set(CMAKE_REQUIRED_FLAGS "${FLAG}")
check_c_compiler_flag("" ${SANITIZED_FLAG})
if(${SANITIZED_FLAG})
set(VARIANT ${ARGV1})
if(ARGV1)
string(REGEX REPLACE "[^A-Za-z_0-9]" "_" VARIANT "${VARIANT}")
string(TOUPPER "_${VARIANT}" VARIANT)
endif()
set(CMAKE_C_FLAGS${VARIANT} "${CMAKE_C_FLAGS${VARIANT}} ${FLAG}" PARENT_SCOPE)
endif()
endfunction()

View File

@@ -0,0 +1,38 @@
# - Adds a compiler flag if it is supported by the compiler
#
# This function checks that the supplied compiler flag is supported and then
# adds it to the corresponding compiler flags
#
# add_cxx_compiler_flag(<FLAG> [<VARIANT>])
#
# - Example
#
# include(AddCXXCompilerFlag)
# add_cxx_compiler_flag(-Wall)
# add_cxx_compiler_flag(-no-strict-aliasing RELEASE)
# Requires CMake 2.6+
if(__add_cxx_compiler_flag)
return()
endif()
set(__add_cxx_compiler_flag INCLUDED)
include(CheckCXXCompilerFlag)
function(add_cxx_compiler_flag FLAG)
string(TOUPPER "HAVE_CXX_FLAG_${FLAG}" SANITIZED_FLAG)
string(REPLACE "+" "X" SANITIZED_FLAG ${SANITIZED_FLAG})
string(REGEX REPLACE "[^A-Za-z_0-9]" "_" SANITIZED_FLAG ${SANITIZED_FLAG})
string(REGEX REPLACE "_+" "_" SANITIZED_FLAG ${SANITIZED_FLAG})
set(CMAKE_REQUIRED_FLAGS "${FLAG}")
check_cxx_compiler_flag("" ${SANITIZED_FLAG})
if(${SANITIZED_FLAG})
set(VARIANT ${ARGV1})
if(ARGV1)
string(REGEX REPLACE "[^A-Za-z_0-9]" "_" VARIANT "${VARIANT}")
string(TOUPPER "_${VARIANT}" VARIANT)
endif()
set(CMAKE_CXX_FLAGS${VARIANT} "${CMAKE_CXX_FLAGS${VARIANT}} ${FLAG}" PARENT_SCOPE)
endif()
endfunction()

View File

@@ -0,0 +1,47 @@
# - Determines the target architecture of the compilation
#
# This function checks the architecture that will be built by the compiler
# and sets a variable to the architecture
#
# determine_target_architecture(<OUTPUT_VAR>)
#
# - Example
#
# include(DetermineTargetArchitecture)
# determine_target_architecture(PROJECT_NAME_ARCHITECTURE)
if(__determine_target_architecture)
return()
endif()
set(__determine_target_architecture INCLUDED)
function(determine_target_architecture FLAG)
if (MSVC)
if("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "X86")
set(ARCH "i686")
elseif("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "x64")
set(ARCH "x86_64")
elseif("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "ARM")
set(ARCH "arm")
else()
message(FATAL_ERROR "Failed to determine the MSVC target architecture: ${MSVC_C_ARCHITECTURE_ID}")
endif()
else()
execute_process(
COMMAND ${CMAKE_C_COMPILER} -dumpmachine
RESULT_VARIABLE RESULT
OUTPUT_VARIABLE ARCH
ERROR_QUIET
)
if (RESULT)
message(FATAL_ERROR "Failed to determine target architecture triplet: ${RESULT}")
endif()
string(REGEX MATCH "([^-]+).*" ARCH_MATCH ${ARCH})
if (NOT CMAKE_MATCH_1 OR NOT ARCH_MATCH)
message(FATAL_ERROR "Failed to match the target architecture triplet: ${ARCH}")
endif()
set(ARCH ${CMAKE_MATCH_1})
endif()
message(STATUS "Target architecture - ${ARCH}")
set(FLAG ${ARCH} PARENT_SCOPE)
endfunction()

View File

@@ -0,0 +1,46 @@
#.rst:
# FindLibDl
# --------
#
# Find the native realtime includes and library.
#
# IMPORTED Targets
# ^^^^^^^^^^^^^^^^
#
# This module defines :prop_tgt:`IMPORTED` target ``LIBDL::LIBDL``, if
# LIBDL has been found.
#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
# This module defines the following variables:
#
# ::
#
# LIBDL_INCLUDE_DIRS - where to find dlfcn.h, etc.
# LIBDL_LIBRARIES - List of libraries when using libdl.
# LIBDL_FOUND - True if dynamic linking library found.
#
# Hints
# ^^^^^
#
# A user may set ``LIBDL_ROOT`` to a library installation root to tell this
# module where to look.
find_path(LIBDL_INCLUDE_DIRS
NAMES dlfcn.h
PATHS ${LIBDL_ROOT}/include/
)
find_library(LIBDL_LIBRARIES dl)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LibDl DEFAULT_MSG LIBDL_LIBRARIES LIBDL_INCLUDE_DIRS)
mark_as_advanced(LIBDL_INCLUDE_DIRS LIBDL_LIBRARIES)
if(LIBDL_FOUND)
if(NOT TARGET LIBDL::LIBDL)
add_library(LIBDL::LIBDL UNKNOWN IMPORTED)
set_target_properties(LIBDL::LIBDL PROPERTIES
IMPORTED_LOCATION "${LIBDL_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${LIBDL_INCLUDE_DIRS}")
endif()
endif()

View File

@@ -0,0 +1,46 @@
#.rst:
# FindLibM
# --------
#
# Find the native realtime includes and library.
#
# IMPORTED Targets
# ^^^^^^^^^^^^^^^^
#
# This module defines :prop_tgt:`IMPORTED` target ``LIBM::LIBM``, if
# LIBM has been found.
#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
# This module defines the following variables:
#
# ::
#
# LIBM_INCLUDE_DIRS - where to find math.h, etc.
# LIBM_LIBRARIES - List of libraries when using libm.
# LIBM_FOUND - True if math library found.
#
# Hints
# ^^^^^
#
# A user may set ``LIBM_ROOT`` to a math library installation root to tell this
# module where to look.
find_path(LIBM_INCLUDE_DIRS
NAMES math.h
PATHS ${LIBM_ROOT}/include/
)
find_library(LIBM_LIBRARIES m)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LibM DEFAULT_MSG LIBM_LIBRARIES LIBM_INCLUDE_DIRS)
mark_as_advanced(LIBM_INCLUDE_DIRS LIBM_LIBRARIES)
if(LIBM_FOUND)
if(NOT TARGET LIBM::LIBM)
add_library(LIBM::LIBM UNKNOWN IMPORTED)
set_target_properties(LIBM::LIBM PROPERTIES
IMPORTED_LOCATION "${LIBM_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${LIBM_INCLUDE_DIRS}")
endif()
endif()

View File

@@ -0,0 +1,46 @@
#.rst:
# FindLibRt
# --------
#
# Find the native realtime includes and library.
#
# IMPORTED Targets
# ^^^^^^^^^^^^^^^^
#
# This module defines :prop_tgt:`IMPORTED` target ``LIBRT::LIBRT``, if
# LIBRT has been found.
#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
# This module defines the following variables:
#
# ::
#
# LIBRT_INCLUDE_DIRS - where to find time.h, etc.
# LIBRT_LIBRARIES - List of libraries when using librt.
# LIBRT_FOUND - True if realtime library found.
#
# Hints
# ^^^^^
#
# A user may set ``LIBRT_ROOT`` to a realtime installation root to tell this
# module where to look.
find_path(LIBRT_INCLUDE_DIRS
NAMES time.h
PATHS ${LIBRT_ROOT}/include/
)
find_library(LIBRT_LIBRARIES rt)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LibRt DEFAULT_MSG LIBRT_LIBRARIES LIBRT_INCLUDE_DIRS)
mark_as_advanced(LIBRT_INCLUDE_DIRS LIBRT_LIBRARIES)
if(LIBRT_FOUND)
if(NOT TARGET LIBRT::LIBRT)
add_library(LIBRT::LIBRT UNKNOWN IMPORTED)
set_target_properties(LIBRT::LIBRT PROPERTIES
IMPORTED_LOCATION "${LIBRT_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${LIBRT_INCLUDE_DIRS}")
endif()
endif()

View File

@@ -0,0 +1,102 @@
#.rst:
# FindWinSock
# --------
#
# Find the native realtime includes and library.
#
# IMPORTED Targets
# ^^^^^^^^^^^^^^^^
#
# This module defines :prop_tgt:`IMPORTED` target ``WINSOCK::WINSOCK``, if
# WINSOCK has been found.
#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
# This module defines the following variables:
#
# ::
#
# WINSOCK_INCLUDE_DIRS - where to find winsock.h, etc.
# WINSOCK_LIBRARIES - List of libraries when using librt.
# WINSOCK_FOUND - True if realtime library found.
#
# Hints
# ^^^^^
#
# A user may set ``WINSOCK_ROOT`` to a realtime installation root to tell this
# module where to look.
macro(REMOVE_DUPLICATE_PATHS LIST_VAR)
set(WINSOCK_LIST "")
foreach(PATH IN LISTS ${LIST_VAR})
get_filename_component(PATH "${PATH}" REALPATH)
list(APPEND WINSOCK_LIST "${PATH}")
endforeach(PATH)
set(${LIST_VAR} ${WINSOCK_LIST})
list(REMOVE_DUPLICATES ${LIST_VAR})
endmacro(REMOVE_DUPLICATE_PATHS)
set(WINSOCK_INCLUDE_PATHS "${WINSOCK_ROOT}/include/")
if(MINGW)
execute_process(
COMMAND ${CMAKE_C_COMPILER} -xc -E -v -
RESULT_VARIABLE RESULT
INPUT_FILE nul
ERROR_VARIABLE ERR
OUTPUT_QUIET
)
if (NOT RESULT)
string(FIND "${ERR}" "#include <...> search starts here:" START)
string(FIND "${ERR}" "End of search list." END)
if (NOT ${START} EQUAL -1 AND NOT ${END} EQUAL -1)
math(EXPR START "${START} + 36")
math(EXPR END "${END} - 1")
math(EXPR LENGTH "${END} - ${START}")
string(SUBSTRING "${ERR}" ${START} ${LENGTH} WINSOCK_INCLUDE_PATHS)
string(REPLACE "\n " ";" WINSOCK_INCLUDE_PATHS "${WINSOCK_INCLUDE_PATHS}")
list(REVERSE WINSOCK_INCLUDE_PATHS)
endif()
endif()
endif()
remove_duplicate_paths(WINSOCK_INCLUDE_PATHS)
set(WINSOCK_LIBRARY_PATHS "${WINSOCK_ROOT}/lib/")
if(MINGW)
execute_process(
COMMAND ${CMAKE_C_COMPILER} -print-search-dirs
RESULT_VARIABLE RESULT
OUTPUT_VARIABLE OUT
ERROR_QUIET
)
if (NOT RESULT)
string(REGEX MATCH "libraries: =([^\r\n]*)" OUT "${OUT}")
list(APPEND WINSOCK_LIBRARY_PATHS "${CMAKE_MATCH_1}")
endif()
endif()
if (${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "AMD64" AND ${CMAKE_SIZEOF_VOID_P} EQUAL 4)
list(APPEND WINSOCK_LIBRARY_PATHS "C:/Windows/SysWOW64")
endif()
list(APPEND WINSOCK_LIBRARY_PATHS "C:/Windows/System32")
remove_duplicate_paths(WINSOCK_LIBRARY_PATHS)
find_path(WINSOCK_INCLUDE_DIRS
NAMES winsock2.h
PATHS ${WINSOCK_INCLUDE_PATHS}
)
find_library(WINSOCK_LIBRARIES ws2_32
PATHS ${WINSOCK_LIBRARY_PATHS}
NO_DEFAULT_PATH
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(WinSock DEFAULT_MSG WINSOCK_LIBRARIES WINSOCK_INCLUDE_DIRS)
mark_as_advanced(WINSOCK_INCLUDE_DIRS WINSOCK_LIBRARIES)
if(WINSOCK_FOUND)
if(NOT TARGET WINSOCK::WINSOCK)
add_library(WINSOCK::WINSOCK UNKNOWN IMPORTED)
set_target_properties(WINSOCK::WINSOCK PROPERTIES
IMPORTED_LOCATION "${WINSOCK_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${WINSOCK_INCLUDE_DIRS}")
endif()
endif()

View File

@@ -0,0 +1,12 @@
message(STATUS "Patching check ${VERSION} ${SOURCE_DIR}")
# Patch checks for MinGW
# https://sourceforge.net/p/check/patches/53/
set(CMAKE_LISTS_LOCATION "${SOURCE_DIR}/CMakeLists.txt")
file(READ ${CMAKE_LISTS_LOCATION} CMAKE_LISTS)
string(REGEX REPLACE
"(check_type_size\\((clock|clockid|timer)_t [A-Z_]+\\)[\r\n]+[^\r\n]+[\r\n]+[^\r\n]+[\r\n]+endif\\(NOT HAVE[A-Z_]+\\))"
"set(CMAKE_EXTRA_INCLUDE_FILES time.h)\n\\1\nunset(CMAKE_EXTRA_INCLUDE_FILES)"
CMAKE_LISTS "${CMAKE_LISTS}")
file(WRITE ${CMAKE_LISTS_LOCATION} "${CMAKE_LISTS}")
message(STATUS "Patched ${CMAKE_LISTS_LOCATION}")