diff options
Diffstat (limited to 'Source/Modules')
-rw-r--r-- | Source/Modules/FindJsonCpp.cmake | 107 | ||||
-rw-r--r-- | Source/Modules/FindLibRHash.cmake | 73 | ||||
-rw-r--r-- | Source/Modules/FindLibUUID.cmake | 85 | ||||
-rw-r--r-- | Source/Modules/FindLibUV.cmake | 123 | ||||
-rw-r--r-- | Source/Modules/OverrideC.cmake | 3 | ||||
-rw-r--r-- | Source/Modules/OverrideCXX.cmake | 3 |
6 files changed, 394 insertions, 0 deletions
diff --git a/Source/Modules/FindJsonCpp.cmake b/Source/Modules/FindJsonCpp.cmake new file mode 100644 index 0000000..1951b61 --- /dev/null +++ b/Source/Modules/FindJsonCpp.cmake @@ -0,0 +1,107 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindJsonCpp +----------- + +Find JsonCpp includes and library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +An :ref:`imported target <Imported targets>` named +``JsonCpp::JsonCpp`` is provided if JsonCpp has been found. + +Result Variables +^^^^^^^^^^^^^^^^ + +This module defines the following variables: + +``JsonCpp_FOUND`` + True if JsonCpp was found, false otherwise. +``JsonCpp_INCLUDE_DIRS`` + Include directories needed to include JsonCpp headers. +``JsonCpp_LIBRARIES`` + Libraries needed to link to JsonCpp. +``JsonCpp_VERSION_STRING`` + The version of JsonCpp found. + May not be set for JsonCpp versions prior to 1.0. +``JsonCpp_VERSION_MAJOR`` + The major version of JsonCpp. +``JsonCpp_VERSION_MINOR`` + The minor version of JsonCpp. +``JsonCpp_VERSION_PATCH`` + The patch version of JsonCpp. + +Cache Variables +^^^^^^^^^^^^^^^ + +This module uses the following cache variables: + +``JsonCpp_LIBRARY`` + The location of the JsonCpp library file. +``JsonCpp_INCLUDE_DIR`` + The location of the JsonCpp include directory containing ``json/json.h``. + +The cache variables should not be used by project code. +They may be set by end users to point at JsonCpp components. +#]=======================================================================] + +#----------------------------------------------------------------------------- +find_library(JsonCpp_LIBRARY + NAMES jsoncpp + ) +mark_as_advanced(JsonCpp_LIBRARY) + +find_path(JsonCpp_INCLUDE_DIR + NAMES json/json.h + PATH_SUFFIXES jsoncpp + ) +mark_as_advanced(JsonCpp_INCLUDE_DIR) + +#----------------------------------------------------------------------------- +# Extract version number if possible. +set(_JsonCpp_H_REGEX "^#[ \t]*define[ \t]+JSONCPP_VERSION_STRING[ \t]+\"(([0-9]+)\\.([0-9]+)\\.([0-9]+)[^\"]*)\".*$") +if(JsonCpp_INCLUDE_DIR AND EXISTS "${JsonCpp_INCLUDE_DIR}/json/version.h") + file(STRINGS "${JsonCpp_INCLUDE_DIR}/json/version.h" _JsonCpp_H REGEX "${_JsonCpp_H_REGEX}") +else() + set(_JsonCpp_H "") +endif() +if(_JsonCpp_H MATCHES "${_JsonCpp_H_REGEX}") + set(JsonCpp_VERSION_STRING "${CMAKE_MATCH_1}") + set(JsonCpp_VERSION_MAJOR "${CMAKE_MATCH_2}") + set(JsonCpp_VERSION_MINOR "${CMAKE_MATCH_3}") + set(JsonCpp_VERSION_PATCH "${CMAKE_MATCH_4}") +else() + set(JsonCpp_VERSION_STRING "") + set(JsonCpp_VERSION_MAJOR "") + set(JsonCpp_VERSION_MINOR "") + set(JsonCpp_VERSION_PATCH "") +endif() +unset(_JsonCpp_H_REGEX) +unset(_JsonCpp_H) + +#----------------------------------------------------------------------------- +include(${CMAKE_CURRENT_LIST_DIR}/../../Modules/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(JsonCpp + FOUND_VAR JsonCpp_FOUND + REQUIRED_VARS JsonCpp_LIBRARY JsonCpp_INCLUDE_DIR + VERSION_VAR JsonCpp_VERSION_STRING + ) +set(JSONCPP_FOUND ${JsonCpp_FOUND}) + +#----------------------------------------------------------------------------- +# Provide documented result variables and targets. +if(JsonCpp_FOUND) + set(JsonCpp_INCLUDE_DIRS ${JsonCpp_INCLUDE_DIR}) + set(JsonCpp_LIBRARIES ${JsonCpp_LIBRARY}) + if(NOT TARGET JsonCpp::JsonCpp) + add_library(JsonCpp::JsonCpp UNKNOWN IMPORTED) + set_target_properties(JsonCpp::JsonCpp PROPERTIES + IMPORTED_LOCATION "${JsonCpp_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${JsonCpp_INCLUDE_DIRS}" + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + ) + endif() +endif() diff --git a/Source/Modules/FindLibRHash.cmake b/Source/Modules/FindLibRHash.cmake new file mode 100644 index 0000000..86c6189 --- /dev/null +++ b/Source/Modules/FindLibRHash.cmake @@ -0,0 +1,73 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindLibRHash +------------ + +Find LibRHash include directory and library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +An :ref:`imported target <Imported targets>` named +``LibRHash::LibRHash`` is provided if LibRHash has been found. + +Result Variables +^^^^^^^^^^^^^^^^ + +This module defines the following variables: + +``LibRHash_FOUND`` + True if LibRHash was found, false otherwise. +``LibRHash_INCLUDE_DIRS`` + Include directories needed to include LibRHash headers. +``LibRHash_LIBRARIES`` + Libraries needed to link to LibRHash. + +Cache Variables +^^^^^^^^^^^^^^^ + +This module uses the following cache variables: + +``LibRHash_LIBRARY`` + The location of the LibRHash library file. +``LibRHash_INCLUDE_DIR`` + The location of the LibRHash include directory containing ``rhash.h``. + +The cache variables should not be used by project code. +They may be set by end users to point at LibRHash components. +#]=======================================================================] + +#----------------------------------------------------------------------------- +find_library(LibRHash_LIBRARY + NAMES rhash + ) +mark_as_advanced(LibRHash_LIBRARY) + +find_path(LibRHash_INCLUDE_DIR + NAMES rhash.h + ) +mark_as_advanced(LibRHash_INCLUDE_DIR) + +#----------------------------------------------------------------------------- +include(${CMAKE_CURRENT_LIST_DIR}/../../Modules/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibRHash + FOUND_VAR LibRHash_FOUND + REQUIRED_VARS LibRHash_LIBRARY LibRHash_INCLUDE_DIR + ) +set(LIBRHASH_FOUND ${LibRHash_FOUND}) + +#----------------------------------------------------------------------------- +# Provide documented result variables and targets. +if(LibRHash_FOUND) + set(LibRHash_INCLUDE_DIRS ${LibRHash_INCLUDE_DIR}) + set(LibRHash_LIBRARIES ${LibRHash_LIBRARY}) + if(NOT TARGET LibRHash::LibRHash) + add_library(LibRHash::LibRHash UNKNOWN IMPORTED) + set_target_properties(LibRHash::LibRHash PROPERTIES + IMPORTED_LOCATION "${LibRHash_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${LibRHash_INCLUDE_DIRS}" + ) + endif() +endif() diff --git a/Source/Modules/FindLibUUID.cmake b/Source/Modules/FindLibUUID.cmake new file mode 100644 index 0000000..17f11c1 --- /dev/null +++ b/Source/Modules/FindLibUUID.cmake @@ -0,0 +1,85 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindLibUUID +------------ + +Find LibUUID include directory and library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +An :ref:`imported target <Imported targets>` named +``LibUUID::LibUUID`` is provided if LibUUID has been found. + +Result Variables +^^^^^^^^^^^^^^^^ + +This module defines the following variables: + +``LibUUID_FOUND`` + True if LibUUID was found, false otherwise. +``LibUUID_INCLUDE_DIRS`` + Include directories needed to include LibUUID headers. +``LibUUID_LIBRARIES`` + Libraries needed to link to LibUUID. + +Cache Variables +^^^^^^^^^^^^^^^ + +This module uses the following cache variables: + +``LibUUID_LIBRARY`` + The location of the LibUUID library file. +``LibUUID_INCLUDE_DIR`` + The location of the LibUUID include directory containing ``uuid/uuid.h``. + +The cache variables should not be used by project code. +They may be set by end users to point at LibUUID components. +#]=======================================================================] + +#----------------------------------------------------------------------------- +if(CYGWIN) + # Note: on current version of Cygwin, linking to libuuid.dll.a doesn't + # import the right symbols sometimes. Fix this by linking directly + # to the DLL that provides the symbols, instead. + set(old_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES}) + set(CMAKE_FIND_LIBRARY_SUFFIXES .dll) + find_library(LibUUID_LIBRARY + NAMES cyguuid-1.dll + ) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${old_suffixes}) +else() + find_library(LibUUID_LIBRARY + NAMES uuid + ) +endif() +mark_as_advanced(LibUUID_LIBRARY) + +find_path(LibUUID_INCLUDE_DIR + NAMES uuid/uuid.h + ) +mark_as_advanced(LibUUID_INCLUDE_DIR) + +#----------------------------------------------------------------------------- +include(${CMAKE_CURRENT_LIST_DIR}/../../Modules/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibUUID + FOUND_VAR LibUUID_FOUND + REQUIRED_VARS LibUUID_LIBRARY LibUUID_INCLUDE_DIR + ) +set(LIBUUID_FOUND ${LibUUID_FOUND}) + +#----------------------------------------------------------------------------- +# Provide documented result variables and targets. +if(LibUUID_FOUND) + set(LibUUID_INCLUDE_DIRS ${LibUUID_INCLUDE_DIR}) + set(LibUUID_LIBRARIES ${LibUUID_LIBRARY}) + if(NOT TARGET LibUUID::LibUUID) + add_library(LibUUID::LibUUID UNKNOWN IMPORTED) + set_target_properties(LibUUID::LibUUID PROPERTIES + IMPORTED_LOCATION "${LibUUID_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${LibUUID_INCLUDE_DIRS}" + ) + endif() +endif() diff --git a/Source/Modules/FindLibUV.cmake b/Source/Modules/FindLibUV.cmake new file mode 100644 index 0000000..0554d62 --- /dev/null +++ b/Source/Modules/FindLibUV.cmake @@ -0,0 +1,123 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindLibUV +--------- + +Find libuv includes and library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +An :ref:`imported target <Imported targets>` named +``LibUV::LibUV`` is provided if libuv has been found. + +Result Variables +^^^^^^^^^^^^^^^^ + +This module defines the following variables: + +``LibUV_FOUND`` + True if libuv was found, false otherwise. +``LibUV_INCLUDE_DIRS`` + Include directories needed to include libuv headers. +``LibUV_LIBRARIES`` + Libraries needed to link to libuv. +``LibUV_VERSION`` + The version of libuv found. +``LibUV_VERSION_MAJOR`` + The major version of libuv. +``LibUV_VERSION_MINOR`` + The minor version of libuv. +``LibUV_VERSION_PATCH`` + The patch version of libuv. + +Cache Variables +^^^^^^^^^^^^^^^ + +This module uses the following cache variables: + +``LibUV_LIBRARY`` + The location of the libuv library file. +``LibUV_INCLUDE_DIR`` + The location of the libuv include directory containing ``uv.h``. + +The cache variables should not be used by project code. +They may be set by end users to point at libuv components. +#]=======================================================================] + +#----------------------------------------------------------------------------- +find_library(LibUV_LIBRARY + NAMES uv libuv + ) +mark_as_advanced(LibUV_LIBRARY) + +find_path(LibUV_INCLUDE_DIR + NAMES uv.h + ) +mark_as_advanced(LibUV_INCLUDE_DIR) + +#----------------------------------------------------------------------------- +# Extract version number if possible. +set(_LibUV_H_REGEX "#[ \t]*define[ \t]+UV_VERSION_(MAJOR|MINOR|PATCH)[ \t]+[0-9]+") +if(LibUV_INCLUDE_DIR AND EXISTS "${LibUV_INCLUDE_DIR}/uv-version.h") + file(STRINGS "${LibUV_INCLUDE_DIR}/uv-version.h" _LibUV_H REGEX "${_LibUV_H_REGEX}") +elseif(LibUV_INCLUDE_DIR AND EXISTS "${LibUV_INCLUDE_DIR}/uv/version.h") + file(STRINGS "${LibUV_INCLUDE_DIR}/uv/version.h" _LibUV_H REGEX "${_LibUV_H_REGEX}") +elseif(LibUV_INCLUDE_DIR AND EXISTS "${LibUV_INCLUDE_DIR}/uv.h") + file(STRINGS "${LibUV_INCLUDE_DIR}/uv.h" _LibUV_H REGEX "${_LibUV_H_REGEX}") +else() + set(_LibUV_H "") +endif() +foreach(c MAJOR MINOR PATCH) + if(_LibUV_H MATCHES "#[ \t]*define[ \t]+UV_VERSION_${c}[ \t]+([0-9]+)") + set(_LibUV_VERSION_${c} "${CMAKE_MATCH_1}") + else() + unset(_LibUV_VERSION_${c}) + endif() +endforeach() +if(DEFINED _LibUV_VERSION_MAJOR AND DEFINED _LibUV_VERSION_MINOR) + set(LibUV_VERSION_MAJOR "${_LibUV_VERSION_MAJOR}") + set(LibUV_VERSION_MINOR "${_LibUV_VERSION_MINOR}") + set(LibUV_VERSION "${LibUV_VERSION_MAJOR}.${LibUV_VERSION_MINOR}") + if(DEFINED _LibUV_VERSION_PATCH) + set(LibUV_VERSION_PATCH "${_LibUV_VERSION_PATCH}") + set(LibUV_VERSION "${LibUV_VERSION}.${LibUV_VERSION_PATCH}") + else() + unset(LibUV_VERSION_PATCH) + endif() +else() + set(LibUV_VERSION_MAJOR "") + set(LibUV_VERSION_MINOR "") + set(LibUV_VERSION_PATCH "") + set(LibUV_VERSION "") +endif() +unset(_LibUV_VERSION_MAJOR) +unset(_LibUV_VERSION_MINOR) +unset(_LibUV_VERSION_PATCH) +unset(_LibUV_H_REGEX) +unset(_LibUV_H) + +#----------------------------------------------------------------------------- +include(${CMAKE_CURRENT_LIST_DIR}/../../Modules/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibUV + FOUND_VAR LibUV_FOUND + REQUIRED_VARS LibUV_LIBRARY LibUV_INCLUDE_DIR + VERSION_VAR LibUV_VERSION + ) +set(LIBUV_FOUND ${LibUV_FOUND}) + +#----------------------------------------------------------------------------- +# Provide documented result variables and targets. +if(LibUV_FOUND) + set(LibUV_INCLUDE_DIRS ${LibUV_INCLUDE_DIR}) + set(LibUV_LIBRARIES ${LibUV_LIBRARY}) + if(NOT TARGET LibUV::LibUV) + add_library(LibUV::LibUV UNKNOWN IMPORTED) + set_target_properties(LibUV::LibUV PROPERTIES + IMPORTED_LOCATION "${LibUV_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${LibUV_INCLUDE_DIRS}" + ) + endif() +endif() diff --git a/Source/Modules/OverrideC.cmake b/Source/Modules/OverrideC.cmake new file mode 100644 index 0000000..f8299ad --- /dev/null +++ b/Source/Modules/OverrideC.cmake @@ -0,0 +1,3 @@ +if("${CMAKE_SYSTEM_NAME};${CMAKE_C_COMPILER_ID}" STREQUAL "AIX;GNU") + string(APPEND CMAKE_C_FLAGS_INIT " -pthread") +endif() diff --git a/Source/Modules/OverrideCXX.cmake b/Source/Modules/OverrideCXX.cmake new file mode 100644 index 0000000..13689e2 --- /dev/null +++ b/Source/Modules/OverrideCXX.cmake @@ -0,0 +1,3 @@ +if("${CMAKE_SYSTEM_NAME};${CMAKE_CXX_COMPILER_ID}" STREQUAL "AIX;GNU") + string(APPEND CMAKE_CXX_FLAGS_INIT " -pthread") +endif() |