From 0ab40dc1ab4e689921da54080b135e1d22b1c586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Tue, 14 Mar 2017 21:45:23 +0100 Subject: Refactoring louloulibs and cmake Use OBJECT libraries Remove the louloulibs directory Write FOUND variables in the cache --- cmake/Modules/FindBOTAN.cmake | 43 +++++++++++++++++++++++++++++ cmake/Modules/FindGCRYPT.cmake | 41 ++++++++++++++++++++++++++++ cmake/Modules/FindICONV.cmake | 60 +++++++++++++++++++++++++++++++++++++++++ cmake/Modules/FindLIBIDN.cmake | 42 +++++++++++++++++++++++++++++ cmake/Modules/FindLIBUUID.cmake | 42 +++++++++++++++++++++++++++++ cmake/Modules/FindLITESQL.cmake | 2 +- cmake/Modules/FindSYSTEMD.cmake | 40 +++++++++++++++++++++++++++ cmake/Modules/FindUDNS.cmake | 38 ++++++++++++++++++++++++++ 8 files changed, 307 insertions(+), 1 deletion(-) create mode 100644 cmake/Modules/FindBOTAN.cmake create mode 100644 cmake/Modules/FindGCRYPT.cmake create mode 100644 cmake/Modules/FindICONV.cmake create mode 100644 cmake/Modules/FindLIBIDN.cmake create mode 100644 cmake/Modules/FindLIBUUID.cmake create mode 100644 cmake/Modules/FindSYSTEMD.cmake create mode 100644 cmake/Modules/FindUDNS.cmake (limited to 'cmake/Modules') diff --git a/cmake/Modules/FindBOTAN.cmake b/cmake/Modules/FindBOTAN.cmake new file mode 100644 index 0000000..13d2de4 --- /dev/null +++ b/cmake/Modules/FindBOTAN.cmake @@ -0,0 +1,43 @@ +# - Find botan +# Find the botan cryptographic library +# +# This module defines the following variables: +# BOTAN_FOUND - True if library and include directory are found +# If set to TRUE, the following are also defined: +# BOTAN_INCLUDE_DIRS - The directory where to find the header file +# BOTAN_LIBRARIES - Where to find the library file +# +# For conveniance, these variables are also set. They have the same values +# than the variables above. The user can thus choose his/her prefered way +# to write them. +# BOTAN_LIBRARY +# BOTAN_INCLUDE_DIR +# +# This file is in the public domain + +include(FindPkgConfig) + +pkg_check_modules(BOTAN botan-2) +pkg_check_modules(BOTAN botan-1.11) + +if(NOT BOTAN_FOUND) + find_path(BOTAN_INCLUDE_DIRS NAMES botan/botan.h + PATH_SUFFIXES botan-2 botan-1.11 + DOC "The botan include directory") + + find_library(BOTAN_LIBRARIES NAMES botan botan-2 botan-1.11 + DOC "The botan library") + + # Use some standard module to handle the QUIETLY and REQUIRED arguments, and + # set BOTAN_FOUND to TRUE if these two variables are set. + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(BOTAN REQUIRED_VARS BOTAN_LIBRARIES BOTAN_INCLUDE_DIRS) + + if(BOTAN_FOUND) + set(BOTAN_LIBRARY ${BOTAN_LIBRARIES} CACHE INTERNAL "") + set(BOTAN_INCLUDE_DIR ${BOTAN_INCLUDE_DIRS} CACHE INTERNAL "") + set(BOTAN_FOUND ${BOTAN_FOUND} CACHE INTERNAL "") + endif() +endif() + +mark_as_advanced(BOTAN_INCLUDE_DIRS BOTAN_LIBRARIES) diff --git a/cmake/Modules/FindGCRYPT.cmake b/cmake/Modules/FindGCRYPT.cmake new file mode 100644 index 0000000..b73bfd0 --- /dev/null +++ b/cmake/Modules/FindGCRYPT.cmake @@ -0,0 +1,41 @@ +# - Find gcrypt +# Find the gcrypt cryptographic library +# +# This module defines the following variables: +# GCRYPT_FOUND - True if library and include directory are found +# If set to TRUE, the following are also defined: +# GCRYPT_INCLUDE_DIRS - The directory where to find the header file +# GCRYPT_LIBRARIES - Where to find the library file +# +# For conveniance, these variables are also set. They have the same values +# than the variables above. The user can thus choose his/her prefered way +# to write them. +# GCRYPT_LIBRARY +# GCRYPT_INCLUDE_DIR +# +# This file is in the public domain + +include(FindPkgConfig) +pkg_check_modules(GCRYPT gcrypt) + +if(NOT GCRYPT_FOUND) + find_path(GCRYPT_INCLUDE_DIRS NAMES gcrypt.h + PATH_SUFFIXES gcrypt + DOC "The gcrypt include directory") + + find_library(GCRYPT_LIBRARIES NAMES gcrypt + DOC "The gcrypt library") + + # Use some standard module to handle the QUIETLY and REQUIRED arguments, and + # set GCRYPT_FOUND to TRUE if these two variables are set. + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(GCRYPT REQUIRED_VARS GCRYPT_LIBRARIES GCRYPT_INCLUDE_DIRS) + + if(GCRYPT_FOUND) + set(GCRYPT_LIBRARY ${GCRYPT_LIBRARIES} CACHE INTERNAL "") + set(GCRYPT_INCLUDE_DIR ${GCRYPT_INCLUDE_DIRS} CACHE INTERNAL "") + set(GCRYPT_FOUND ${GCRYPT_FOUND} CACHE INTERNAL "") + endif() +endif() + +mark_as_advanced(GCRYPT_INCLUDE_DIRS GCRYPT_LIBRARIES) diff --git a/cmake/Modules/FindICONV.cmake b/cmake/Modules/FindICONV.cmake new file mode 100644 index 0000000..fb78ac7 --- /dev/null +++ b/cmake/Modules/FindICONV.cmake @@ -0,0 +1,60 @@ +# - Find iconv +# Find the iconv (character set conversion) library +# +# This module defines the following variables: +# ICONV_FOUND - True if library and include directory are found +# If set to TRUE, the following are also defined: +# ICONV_INCLUDE_DIRS - The directory where to find the header file +# ICONV_LIBRARIES - Where to find the library file +# ICONV_SECOND_ARGUMENT_IS_CONST - The second argument for iconv() is const +# +# For conveniance, these variables are also set. They have the same values +# than the variables above. The user can thus choose his/her prefered way +# to write them. +# ICONV_LIBRARY +# ICONV_INCLUDE_DIR +# +# This file is in the public domain + +find_path(ICONV_INCLUDE_DIRS NAMES iconv.h + DOC "The iconv include directory") + +find_library(ICONV_LIBRARIES NAMES iconv libiconv libiconv-2 c + DOC "The iconv library") + +# Use some standard module to handle the QUIETLY and REQUIRED arguments, and +# set ICONV_FOUND to TRUE if these two variables are set. +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Iconv REQUIRED_VARS ICONV_LIBRARIES ICONV_INCLUDE_DIRS) + +# Check if the prototype is +# size_t iconv(iconv_t cd, char** inbuf, size_t* inbytesleft, +# char** outbuf, size_t* outbytesleft); +# or +# size_t iconv (iconv_t cd, const char** inbuf, size_t* inbytesleft, +# char** outbuf, size_t* outbytesleft); +if(ICONV_FOUND) + include(CheckCXXSourceCompiles) + + # Set the parameters needed to compile the following code. + set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES}) + + check_cxx_source_compiles(" + #include + int main(){ + iconv_t conv = 0; + const char* in = 0; + size_t ilen = 0; + char* out = 0; + size_t olen = 0; + iconv(conv, &in, &ilen, &out, &olen); + return 0;}" + ICONV_SECOND_ARGUMENT_IS_CONST) + + # Compatibility for all the ways of writing these variables + set(ICONV_LIBRARY ${ICONV_LIBRARIES}) + set(ICONV_INCLUDE_DIR ${ICONV_INCLUDE_DIRS}) +endif() + +mark_as_advanced(ICONV_INCLUDE_DIRS ICONV_LIBRARIES ICONV_SECOND_ARGUMENT_IS_CONST) diff --git a/cmake/Modules/FindLIBIDN.cmake b/cmake/Modules/FindLIBIDN.cmake new file mode 100644 index 0000000..d42257f --- /dev/null +++ b/cmake/Modules/FindLIBIDN.cmake @@ -0,0 +1,42 @@ +# - Find libidn +# Find the libidn library, and more particularly the stringprep header. +# +# This module defines the following variables: +# LIBIDN_FOUND - True if library and include directory are found +# If set to TRUE, the following are also defined: +# LIBIDN_INCLUDE_DIRS - The directory where to find the header file +# LIBIDN_LIBRARIES - Where to find the library file +# +# For conveniance, these variables are also set. They have the same values +# than the variables above. The user can thus choose his/her prefered way +# to write them. +# LIBIDN_INCLUDE_DIR +# LIBIDN_LIBRARY +# +# This file is in the public domain + +include(FindPkgConfig) +pkg_check_modules(LIBIDN libidn) + +if(NOT LIBIDN_FOUND) + find_path(LIBIDN_INCLUDE_DIRS NAMES stringprep.h + DOC "The libidn include directory") + + # The library containing the stringprep module is libidn + find_library(LIBIDN_LIBRARIES NAMES idn + DOC "The libidn library") + + # Use some standard module to handle the QUIETLY and REQUIRED arguments, and + # set LIBIDN_FOUND to TRUE if these two variables are set. + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(LIBIDN REQUIRED_VARS LIBIDN_LIBRARIES LIBIDN_INCLUDE_DIRS) + + # Compatibility for all the ways of writing these variables + if(LIBIDN_FOUND) + set(LIBIDN_INCLUDE_DIR ${LIBIDN_INCLUDE_DIRS} CACHE INTERNAL "") + set(LIBIDN_LIBRARY ${LIBIDN_LIBRARIES} CACHE INTERNAL "") + set(LIBIDN_FOUN ${LIBIDN_FOUND} CACHE INTERNAL "") + endif() +endif() + +mark_as_advanced(LIBIDN_INCLUDE_DIRS LIBIDN_LIBRARIES) diff --git a/cmake/Modules/FindLIBUUID.cmake b/cmake/Modules/FindLIBUUID.cmake new file mode 100644 index 0000000..b4bf341 --- /dev/null +++ b/cmake/Modules/FindLIBUUID.cmake @@ -0,0 +1,42 @@ +# - Find libuuid +# Find the libuuid library +# +# This module defines the following variables: +# LIBUUID_FOUND - True if library and include directory are found +# If set to TRUE, the following are also defined: +# LIBUUID_INCLUDE_DIRS - The directory where to find the header file +# LIBUUID_LIBRARIES - Where to find the library file +# +# For conveniance, these variables are also set. They have the same values +# than the variables above. The user can thus choose his/her prefered way +# to write them. +# LIBUUID_INCLUDE_DIR +# LIBUUID_LIBRARY +# +# This file is in the public domain + +include(FindPkgConfig) +pkg_check_modules(LIBUUID uuid) + +if(NOT LIBUUID_FOUND) + find_path(LIBUUID_INCLUDE_DIRS NAMES uuid/uuid.h + PATH_SUFFIXES uuid + DOC "The libuuid include directory") + + find_library(LIBUUID_LIBRARIES NAMES uuid + DOC "The libuuid library") + + # Use some standard module to handle the QUIETLY and REQUIRED arguments, and + # set LIBUUID_FOUND to TRUE if these two variables are set. + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(LIBUUID REQUIRED_VARS LIBUUID_LIBRARIES LIBUUID_INCLUDE_DIRS) + + # Compatibility for all the ways of writing these variables + if(LIBUUID_FOUND) + set(LIBUUID_INCLUDE_DIR ${LIBUUID_INCLUDE_DIRS} CACHE INTERNAL "") + set(LIBUUID_LIBRARY ${LIBUUID_LIBRARIES} CACHE INTERNAL "") + set(LIBUUID_FOUND ${LIBUUID_FOUND} CACHE INTERNAL "") + endif() +endif() + +mark_as_advanced(LIBUUID_INCLUDE_DIRS LIBUUID_LIBRARIES) diff --git a/cmake/Modules/FindLITESQL.cmake b/cmake/Modules/FindLITESQL.cmake index 91155bb..18f0bfa 100644 --- a/cmake/Modules/FindLITESQL.cmake +++ b/cmake/Modules/FindLITESQL.cmake @@ -64,7 +64,7 @@ function(LITESQL_GENERATE_CPP set(${OUTPUT_SOURCES}) add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_NAME}.cpp" - "${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_NAME}.hpp" + "${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_NAME}.hpp" COMMAND ${LITESQLGEN_EXECUTABLE} ARGS -t c++ --output-dir=${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE} DEPENDS ${SOURCE_FILE} diff --git a/cmake/Modules/FindSYSTEMD.cmake b/cmake/Modules/FindSYSTEMD.cmake new file mode 100644 index 0000000..899d07a --- /dev/null +++ b/cmake/Modules/FindSYSTEMD.cmake @@ -0,0 +1,40 @@ +# - Find SystemdDaemon +# Find the systemd daemon library +# +# This module defines the following variables: +# SYSTEMD_FOUND - True if library and include directory are found +# If set to TRUE, the following are also defined: +# SYSTEMD_INCLUDE_DIRS - The directory where to find the header file +# SYSTEMD_LIBRARIES - Where to find the library file +# +# For conveniance, these variables are also set. They have the same values +# than the variables above. The user can thus choose his/her prefered way +# to write them. +# SYSTEMD_LIBRARY +# SYSTEMD_INCLUDE_DIR +# +# This file is in the public domain + +include(FindPkgConfig) +pkg_check_modules(SYSTEMD libsystemd) + +if(NOT SYSTEMD_FOUND) + find_path(SYSTEMD_INCLUDE_DIRS NAMES systemd/sd-daemon.h + DOC "The Systemd include directory") + + find_library(SYSTEMD_LIBRARIES NAMES systemd + DOC "The Systemd library") + + # Use some standard module to handle the QUIETLY and REQUIRED arguments, and + # set SYSTEMD_FOUND to TRUE if these two variables are set. + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(SYSTEMD REQUIRED_VARS SYSTEMD_LIBRARIES SYSTEMD_INCLUDE_DIRS) + + if(SYSTEMD_FOUND) + set(SYSTEMD_LIBRARY ${SYSTEMD_LIBRARIES} CACHE INTERNAL "") + set(SYSTEMD_INCLUDE_DIR ${SYSTEMD_INCLUDE_DIRS} CACHE INTERNAL "") + set(SYSTEMD_FOUND ${SYSTEMD_FOUND} CACHE INTERNAL "") + endif() +endif() + +mark_as_advanced(SYSTEMD_INCLUDE_DIRS SYSTEMD_LIBRARIES) diff --git a/cmake/Modules/FindUDNS.cmake b/cmake/Modules/FindUDNS.cmake new file mode 100644 index 0000000..9576b2a --- /dev/null +++ b/cmake/Modules/FindUDNS.cmake @@ -0,0 +1,38 @@ +# - Find udns +# Find the udns library +# +# This module defines the following variables: +# UDNS_FOUND - True if library and include directory are found +# If set to TRUE, the following are also defined: +# UDNS_INCLUDE_DIRS - The directory where to find the header file +# UDNS_LIBRARIES - Where to find the library file +# +# For conveniance, these variables are also set. They have the same values +# as the variables above. The user can thus choose his/her prefered way +# to write them. +# UDNS_INCLUDE_DIR +# UDNS_LIBRARY +# +# This file is in the public domain + +if(NOT UDNS_FOUND) + find_path(UDNS_INCLUDE_DIRS NAMES udns.h + DOC "The udns include directory") + + find_library(UDNS_LIBRARIES NAMES udns + DOC "The udns library") + + # Use some standard module to handle the QUIETLY and REQUIRED arguments, and + # set UDNS_FOUND to TRUE if these two variables are set. + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(UDNS REQUIRED_VARS UDNS_LIBRARIES UDNS_INCLUDE_DIRS) + + # Compatibility for all the ways of writing these variables + if(UDNS_FOUND) + set(UDNS_INCLUDE_DIR ${UDNS_INCLUDE_DIRS} CACHE INTERNAL "") + set(UDNS_LIBRARY ${UDNS_LIBRARIES} CACHE INTERNAL "") + set(UDNS_FOUND ${UDNS_FOUND} CACHE INTERNAL "") + endif() +endif() + +mark_as_advanced(UDNS_INCLUDE_DIRS UDNS_LIBRARIES) -- cgit v1.2.3