From 807ac95e798185aca35d6b2f3bf425a9c8b03744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Thu, 8 Dec 2016 02:32:49 +0100 Subject: Use a portable way to get the relative paths into __FILENAME__ --- louloulibs/CMakeLists.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'louloulibs/CMakeLists.txt') diff --git a/louloulibs/CMakeLists.txt b/louloulibs/CMakeLists.txt index 908c35f..c5ed7a7 100644 --- a/louloulibs/CMakeLists.txt +++ b/louloulibs/CMakeLists.txt @@ -6,10 +6,6 @@ set(${PROJECT_NAME}_VERSION_SUFFIX "~dev") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -pedantic -Wall -Wextra") -# Define a __FILENAME__ macro to get the filename of each file, instead of -# the full path as in __FILE__ -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__FILENAME__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'") - # ## Look for external libraries # @@ -143,6 +139,14 @@ if(SYSTEMD_FOUND) target_link_libraries(xmpplib ${SYSTEMD_LIBRARIES}) endif() +# Define a __FILENAME__ macro with the relative path (from the base project directory) +# of each source file +file(GLOB_RECURSE source_all *.[hc]pp) +foreach(file ${source_all}) + file(RELATIVE_PATH shorter_file ${CMAKE_CURRENT_SOURCE_DIR} ${file}) + set_property(SOURCE ${file} APPEND PROPERTY COMPILE_DEFINITIONS __FILENAME__="${shorter_file}") +endforeach() + # ## Check if we have std::get_time # -- cgit v1.2.3 From 4cc3dc03fc8419abde6e77dceda773a19a246c43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Sat, 10 Dec 2016 03:58:27 +0100 Subject: =?UTF-8?q?The=20config=20module=20doesn=E2=80=99t=20use=20the=20l?= =?UTF-8?q?ogger=20at=20all?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- louloulibs/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) (limited to 'louloulibs/CMakeLists.txt') diff --git a/louloulibs/CMakeLists.txt b/louloulibs/CMakeLists.txt index c5ed7a7..2251eed 100644 --- a/louloulibs/CMakeLists.txt +++ b/louloulibs/CMakeLists.txt @@ -99,7 +99,6 @@ target_link_libraries(utils ${ICONV_LIBRARIES}) file(GLOB source_config config/*.[hc]pp) add_library(config STATIC ${source_config}) -target_link_libraries(config utils) # ## logger -- cgit v1.2.3 From 5b56007828f20c763df3f36ceed809188880663e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Fri, 6 Jan 2017 22:58:18 +0100 Subject: Use udns instead of c-ares fix #3226 --- louloulibs/CMakeLists.txt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'louloulibs/CMakeLists.txt') diff --git a/louloulibs/CMakeLists.txt b/louloulibs/CMakeLists.txt index 2251eed..f672833 100644 --- a/louloulibs/CMakeLists.txt +++ b/louloulibs/CMakeLists.txt @@ -33,10 +33,10 @@ elseif(NOT WITHOUT_BOTAN) find_package(BOTAN) endif() -if(WITH_CARES) - find_package(CARES REQUIRED) -elseif(NOT WITHOUT_CARES) - find_package(CARES) +if(WITH_UDNS) + find_package(UDNS REQUIRED) +elseif(NOT WITHOUT_UDNS) + find_package(UDNS) endif() # To be able to include the config.h file generated by cmake @@ -68,10 +68,10 @@ if(BOTAN_FOUND) set(BOTAN_INCLUDE_DIRS ${BOTAN_INCLUDE_DIRS} PARENT_SCOPE) endif() -if(CARES_FOUND) - include_directories(${CARES_INCLUDE_DIRS}) - set(CARES_FOUND ${CARES_FOUND} PARENT_SCOPE) - set(CARES_INCLUDE_DIRS ${CARES_INCLUDE_DIRS} PARENT_SCOPE) +if(UDNS_FOUND) + include_directories(${UDNS_INCLUDE_DIRS}) + set(UDNS_FOUND ${UDNS_FOUND} PARENT_SCOPE) + set(UDNS_INCLUDE_DIRS ${UDNS_INCLUDE_DIRS} PARENT_SCOPE) endif() set(POLLER_DOCSTRING "Choose the poller between POLL and EPOLL (Linux-only)") @@ -118,8 +118,8 @@ target_link_libraries(network logger) if(BOTAN_FOUND) target_link_libraries(network ${BOTAN_LIBRARIES}) endif() -if(CARES_FOUND) - target_link_libraries(network ${CARES_LIBRARIES}) +if(UDNS_FOUND) + target_link_libraries(network ${UDNS_LIBRARIES}) endif() # -- cgit v1.2.3 From 99a4ddedaf903d27b781341108433ae2d9533ad1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Mon, 6 Mar 2017 00:51:43 +0100 Subject: Remove the embedded sha1 code, and use one of botan or gcrypt This adds a hard dependency on one of Botan or gcrypt. Botan is already a recommended dependency, and gcrypt is probably packaged almost everywhere, so this should not be a big deal. ref #3241 --- louloulibs/CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'louloulibs/CMakeLists.txt') diff --git a/louloulibs/CMakeLists.txt b/louloulibs/CMakeLists.txt index f672833..2268571 100644 --- a/louloulibs/CMakeLists.txt +++ b/louloulibs/CMakeLists.txt @@ -33,6 +33,10 @@ elseif(NOT WITHOUT_BOTAN) find_package(BOTAN) endif() +if(NOT BOTAN_FOUND) + find_package(GCRYPT REQUIRED) +endif() + if(WITH_UDNS) find_package(UDNS REQUIRED) elseif(NOT WITHOUT_UDNS) @@ -67,6 +71,11 @@ if(BOTAN_FOUND) set(BOTAN_FOUND ${BOTAN_FOUND} PARENT_SCOPE) set(BOTAN_INCLUDE_DIRS ${BOTAN_INCLUDE_DIRS} PARENT_SCOPE) endif() +if(GCRYPT_FOUND) + include_directories(SYSTEM ${GCRYPT_INCLUDE_DIRS}) + set(GCRYPT_FOUND ${GCRYPT_FOUND} PARENT_SCOPE) + set(GCRYPT_INCLUDE_DIRS ${GCRYPT_INCLUDE_DIRS} PARENT_SCOPE) +endif() if(UDNS_FOUND) include_directories(${UDNS_INCLUDE_DIRS}) @@ -117,6 +126,8 @@ add_library(network STATIC ${source_network}) target_link_libraries(network logger) if(BOTAN_FOUND) target_link_libraries(network ${BOTAN_LIBRARIES}) +elseif(GCRYPT_FOUND) + target_link_libraries(network ${GCRYPT_LIBRARIES}) endif() if(UDNS_FOUND) target_link_libraries(network ${UDNS_LIBRARIES}) -- cgit v1.2.3 From 2013ed6f98c0bffdb00fe06df5dca1d1ad422305 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Fri, 10 Mar 2017 10:20:03 +0100 Subject: cmake: Remove the intermediate static libs Should compile faster (and also take less space on disk) --- louloulibs/CMakeLists.txt | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) (limited to 'louloulibs/CMakeLists.txt') diff --git a/louloulibs/CMakeLists.txt b/louloulibs/CMakeLists.txt index 2268571..4c37c20 100644 --- a/louloulibs/CMakeLists.txt +++ b/louloulibs/CMakeLists.txt @@ -51,8 +51,11 @@ include_directories(${ICONV_INCLUDE_DIRS}) include_directories(${LIBUUID_INCLUDE_DIRS}) set(EXPAT_INCLUDE_DIRS ${EXPAT_INCLUDE_DIRS} PARENT_SCOPE) +set(EXPAT_LIBRARIES ${EXPAT_LIBRARIES} PARENT_SCOPE) set(ICONV_INCLUDE_DIRS ${ICONV_INCLUDE_DIRS} PARENT_SCOPE) +set(ICONV_LIBRARIES ${ICONV_LIBRARIES} PARENT_SCOPE) set(LIBUUID_INCLUDE_DIRS ${LIBUUID_INCLUDE_DIRS} PARENT_SCOPE) +set(LIBUUID_LIBRARIES ${LIBUUID_LIBRARIES} PARENT_SCOPE) if(LIBIDN_FOUND) include_directories(${LIBIDN_INCLUDE_DIRS}) @@ -99,55 +102,35 @@ endif() # file(GLOB source_utils utils/*.[hc]pp) -add_library(utils STATIC ${source_utils}) -target_link_libraries(utils ${ICONV_LIBRARIES}) +add_library(utils OBJECT ${source_utils}) # ## config # file(GLOB source_config config/*.[hc]pp) -add_library(config STATIC ${source_config}) +add_library(config OBJECT ${source_config}) # ## logger # file(GLOB source_logger logger/*.[hc]pp) -add_library(logger STATIC ${source_logger}) -target_link_libraries(logger config) +add_library(logger OBJECT ${source_logger}) # ## network # file(GLOB source_network network/*.[hc]pp) -add_library(network STATIC ${source_network}) -target_link_libraries(network logger) -if(BOTAN_FOUND) - target_link_libraries(network ${BOTAN_LIBRARIES}) -elseif(GCRYPT_FOUND) - target_link_libraries(network ${GCRYPT_LIBRARIES}) -endif() -if(UDNS_FOUND) - target_link_libraries(network ${UDNS_LIBRARIES}) -endif() +add_library(network OBJECT ${source_network}) # ## xmpplib # file(GLOB source_xmpplib xmpp/*.[hc]pp) -add_library(xmpplib STATIC ${source_xmpplib}) -target_link_libraries(xmpplib network utils logger - ${EXPAT_LIBRARIES} - ${LIBUUID_LIBRARIES}) -if(LIBIDN_FOUND) - target_link_libraries(xmpplib ${LIBIDN_LIBRARIES}) -endif() -if(SYSTEMD_FOUND) - target_link_libraries(xmpplib ${SYSTEMD_LIBRARIES}) -endif() +add_library(xmpplib OBJECT ${source_xmpplib}) # Define a __FILENAME__ macro with the relative path (from the base project directory) # of each source file -- cgit v1.2.3 From 2b6b577375cad899bcd4c00b8ea91fb5ef4c907c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Fri, 10 Mar 2017 11:11:08 +0100 Subject: cmake: do not use intermediate libraries at all (not even OBJECTS) --- louloulibs/CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'louloulibs/CMakeLists.txt') diff --git a/louloulibs/CMakeLists.txt b/louloulibs/CMakeLists.txt index 4c37c20..e1e402f 100644 --- a/louloulibs/CMakeLists.txt +++ b/louloulibs/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 3.0) set(${PROJECT_NAME}_VERSION_MAJOR 1) set(${PROJECT_NAME}_VERSION_MINOR 0) @@ -102,35 +102,35 @@ endif() # file(GLOB source_utils utils/*.[hc]pp) -add_library(utils OBJECT ${source_utils}) +set(source_utils ${source_utils} PARENT_SCOPE) # ## config # file(GLOB source_config config/*.[hc]pp) -add_library(config OBJECT ${source_config}) +set(source_config ${source_config} PARENT_SCOPE) # ## logger # file(GLOB source_logger logger/*.[hc]pp) -add_library(logger OBJECT ${source_logger}) +set(source_logger ${source_logger} PARENT_SCOPE) # ## network # file(GLOB source_network network/*.[hc]pp) -add_library(network OBJECT ${source_network}) +set(source_network ${source_network} PARENT_SCOPE) # ## xmpplib # file(GLOB source_xmpplib xmpp/*.[hc]pp) -add_library(xmpplib OBJECT ${source_xmpplib}) +set(source_xmpplib ${source_xmpplib} PARENT_SCOPE) # Define a __FILENAME__ macro with the relative path (from the base project directory) # of each source file -- cgit v1.2.3 From a6f6e36594979a83ad16b3c4de350ed95e79daf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Sun, 12 Mar 2017 16:51:19 +0100 Subject: cmake: Improve the usage of PARENT_SCOPE --- louloulibs/CMakeLists.txt | 40 ++-------------------------------------- 1 file changed, 2 insertions(+), 38 deletions(-) (limited to 'louloulibs/CMakeLists.txt') diff --git a/louloulibs/CMakeLists.txt b/louloulibs/CMakeLists.txt index e1e402f..80b1f5f 100644 --- a/louloulibs/CMakeLists.txt +++ b/louloulibs/CMakeLists.txt @@ -10,10 +10,10 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -pedantic -Wall -Wextra") ## Look for external libraries # set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/") -include(FindEXPAT) -find_package(EXPAT REQUIRED) find_package(ICONV REQUIRED) find_package(LIBUUID REQUIRED) +find_package(EXPAT REQUIRED) +set(EXPAT_FOUND ${EXPAT_FOUND} PARENT_SCOPE) if(WITH_LIBIDN) find_package(LIBIDN REQUIRED) @@ -50,42 +50,6 @@ include_directories(${EXPAT_INCLUDE_DIRS}) include_directories(${ICONV_INCLUDE_DIRS}) include_directories(${LIBUUID_INCLUDE_DIRS}) -set(EXPAT_INCLUDE_DIRS ${EXPAT_INCLUDE_DIRS} PARENT_SCOPE) -set(EXPAT_LIBRARIES ${EXPAT_LIBRARIES} PARENT_SCOPE) -set(ICONV_INCLUDE_DIRS ${ICONV_INCLUDE_DIRS} PARENT_SCOPE) -set(ICONV_LIBRARIES ${ICONV_LIBRARIES} PARENT_SCOPE) -set(LIBUUID_INCLUDE_DIRS ${LIBUUID_INCLUDE_DIRS} PARENT_SCOPE) -set(LIBUUID_LIBRARIES ${LIBUUID_LIBRARIES} PARENT_SCOPE) - -if(LIBIDN_FOUND) - include_directories(${LIBIDN_INCLUDE_DIRS}) - set(LIBDIN_FOUND ${LIBDIN_FOUND} PARENT_SCOPE) - set(LIBDIN_INCLUDE_DIRS ${LIBDIN_INCLUDE_DIRS} PARENT_SCOPE) -endif() - -if(SYSTEMD_FOUND) - include_directories(${SYSTEMD_INCLUDE_DIRS}) - set(SYSTEMD_FOUND ${SYSTEMD_FOUND} PARENT_SCOPE) - set(SYSTEMD_INCLUDE_DIRS ${SYSTEMD_INCLUDE_DIRS} PARENT_SCOPE) -endif() - -if(BOTAN_FOUND) - include_directories(SYSTEM ${BOTAN_INCLUDE_DIRS}) - set(BOTAN_FOUND ${BOTAN_FOUND} PARENT_SCOPE) - set(BOTAN_INCLUDE_DIRS ${BOTAN_INCLUDE_DIRS} PARENT_SCOPE) -endif() -if(GCRYPT_FOUND) - include_directories(SYSTEM ${GCRYPT_INCLUDE_DIRS}) - set(GCRYPT_FOUND ${GCRYPT_FOUND} PARENT_SCOPE) - set(GCRYPT_INCLUDE_DIRS ${GCRYPT_INCLUDE_DIRS} PARENT_SCOPE) -endif() - -if(UDNS_FOUND) - include_directories(${UDNS_INCLUDE_DIRS}) - set(UDNS_FOUND ${UDNS_FOUND} PARENT_SCOPE) - set(UDNS_INCLUDE_DIRS ${UDNS_INCLUDE_DIRS} PARENT_SCOPE) -endif() - set(POLLER_DOCSTRING "Choose the poller between POLL and EPOLL (Linux-only)") if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(POLLER "EPOLL" CACHE STRING ${POLLER_DOCSTRING}) -- cgit v1.2.3 From ef08e53b7e5dd3fcd27859af5183575008715c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Sun, 12 Mar 2017 16:52:27 +0100 Subject: make: trivial quote fix --- louloulibs/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'louloulibs/CMakeLists.txt') diff --git a/louloulibs/CMakeLists.txt b/louloulibs/CMakeLists.txt index 80b1f5f..b3056f2 100644 --- a/louloulibs/CMakeLists.txt +++ b/louloulibs/CMakeLists.txt @@ -44,8 +44,9 @@ elseif(NOT WITHOUT_UDNS) endif() # To be able to include the config.h file generated by cmake -include_directories("${CMAKE_CURRENT_BINARY_DIR}") -include_directories("${CMAKE_CURRENT_SOURCE_DIR}") +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + include_directories(${EXPAT_INCLUDE_DIRS}) include_directories(${ICONV_INCLUDE_DIRS}) include_directories(${LIBUUID_INCLUDE_DIRS}) -- cgit v1.2.3 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 --- louloulibs/CMakeLists.txt | 129 ---------------------------------------------- 1 file changed, 129 deletions(-) delete mode 100644 louloulibs/CMakeLists.txt (limited to 'louloulibs/CMakeLists.txt') diff --git a/louloulibs/CMakeLists.txt b/louloulibs/CMakeLists.txt deleted file mode 100644 index b3056f2..0000000 --- a/louloulibs/CMakeLists.txt +++ /dev/null @@ -1,129 +0,0 @@ -cmake_minimum_required(VERSION 3.0) - -set(${PROJECT_NAME}_VERSION_MAJOR 1) -set(${PROJECT_NAME}_VERSION_MINOR 0) -set(${PROJECT_NAME}_VERSION_SUFFIX "~dev") - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -pedantic -Wall -Wextra") - -# -## Look for external libraries -# -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/") -find_package(ICONV REQUIRED) -find_package(LIBUUID REQUIRED) -find_package(EXPAT REQUIRED) -set(EXPAT_FOUND ${EXPAT_FOUND} PARENT_SCOPE) - -if(WITH_LIBIDN) - find_package(LIBIDN REQUIRED) -elseif(NOT WITHOUT_LIBIDN) - find_package(LIBIDN) -endif() - -if(WITH_SYSTEMD) - find_package(SYSTEMD REQUIRED) -elseif(NOT WITHOUT_SYSTEMD) - find_package(SYSTEMD) -endif() - -if(WITH_BOTAN) - find_package(BOTAN REQUIRED) -elseif(NOT WITHOUT_BOTAN) - find_package(BOTAN) -endif() - -if(NOT BOTAN_FOUND) - find_package(GCRYPT REQUIRED) -endif() - -if(WITH_UDNS) - find_package(UDNS REQUIRED) -elseif(NOT WITHOUT_UDNS) - find_package(UDNS) -endif() - -# To be able to include the config.h file generated by cmake -include_directories(${CMAKE_CURRENT_BINARY_DIR}) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - -include_directories(${EXPAT_INCLUDE_DIRS}) -include_directories(${ICONV_INCLUDE_DIRS}) -include_directories(${LIBUUID_INCLUDE_DIRS}) - -set(POLLER_DOCSTRING "Choose the poller between POLL and EPOLL (Linux-only)") -if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - set(POLLER "EPOLL" CACHE STRING ${POLLER_DOCSTRING}) -else() - set(POLLER "POLL" CACHE STRING ${POLLER_DOCSTRING}) -endif() -if((NOT ${POLLER} MATCHES "POLL") AND - (NOT ${POLLER} MATCHES "EPOLL")) - message(FATAL_ERROR "POLLER must be either POLL or EPOLL") -endif() - -# -## utils -# -file(GLOB source_utils - utils/*.[hc]pp) -set(source_utils ${source_utils} PARENT_SCOPE) - -# -## config -# -file(GLOB source_config - config/*.[hc]pp) -set(source_config ${source_config} PARENT_SCOPE) - -# -## logger -# -file(GLOB source_logger - logger/*.[hc]pp) -set(source_logger ${source_logger} PARENT_SCOPE) - -# -## network -# -file(GLOB source_network - network/*.[hc]pp) -set(source_network ${source_network} PARENT_SCOPE) - -# -## xmpplib -# -file(GLOB source_xmpplib - xmpp/*.[hc]pp) -set(source_xmpplib ${source_xmpplib} PARENT_SCOPE) - -# Define a __FILENAME__ macro with the relative path (from the base project directory) -# of each source file -file(GLOB_RECURSE source_all *.[hc]pp) -foreach(file ${source_all}) - file(RELATIVE_PATH shorter_file ${CMAKE_CURRENT_SOURCE_DIR} ${file}) - set_property(SOURCE ${file} APPEND PROPERTY COMPILE_DEFINITIONS __FILENAME__="${shorter_file}") -endforeach() - -# -## Check if we have std::get_time -# -include(CheckCXXSourceCompiles) - -check_cxx_source_compiles(" - #include - int main() - { std::get_time(nullptr, \"\"); }" - HAS_GET_TIME) - -mark_as_advanced(HAS_GET_TIME) - -check_cxx_source_compiles(" - #include - int main() - { std::put_time(nullptr, \"\"); }" - HAS_PUT_TIME) - -mark_as_advanced(HAS_PUT_TIME) - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/louloulibs.h.cmake ${CMAKE_BINARY_DIR}/src/louloulibs.h) -- cgit v1.2.3