From d172dc08141734fbb07d8516c726435d48141dc8 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 31 Mar 2017 12:49:34 +0100 Subject: [PATCH] [Minor] Some fixes for static build --- CMakeLists.txt | 14 +++++++++----- src/CMakeLists.txt | 3 +++ src/client/CMakeLists.txt | 2 +- src/rspamadm/CMakeLists.txt | 4 +++- test/CMakeLists.txt | 2 ++ utils/CMakeLists.txt | 2 +- 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e4a02586..b7790b693 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,8 +74,9 @@ IF(NOT RAGEL_FOUND) ENDIF() IF ("${ARCH}" STREQUAL "x86_64") - IF (ENABLE_HYPERSCAN MATCHES "ON") + IF (ENABLE_HYPERSCAN MATCHES "ON" OR ENABLE_STATIC MATCHES "ON") ENABLE_LANGUAGE(CXX) + SET(USE_CXX_LINKER 1) ENDIF() ELSE() MESSAGE(STATUS "Hyperscan support is possible only for x86_64 architecture") @@ -566,16 +567,19 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE) ENDIF(BUILD_CPU_MODE STREQUAL "32") # Workaround with architecture specific includes - IF(IS_DIRECTORY "/usr/include/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu/") - INCLUDE_DIRECTORIES("/usr/include/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu/") - LIST(APPEND CMAKE_REQUIRED_INCLUDES "/usr/include/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu/") - ENDIF(IS_DIRECTORY "/usr/include/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu/") + #IF(IS_DIRECTORY "/usr/include/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu/") + # INCLUDE_DIRECTORIES("/usr/include/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu/") + # LIST(APPEND CMAKE_REQUIRED_INCLUDES "/usr/include/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu/") + #ENDIF(IS_DIRECTORY "/usr/include/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu/") LIST(APPEND CMAKE_REQUIRED_LIBRARIES rt) LIST(APPEND CMAKE_REQUIRED_LIBRARIES dl) LIST(APPEND CMAKE_REQUIRED_LIBRARIES resolv) LIST(APPEND CMAKE_REQUIRED_LIBRARIES nsl) MESSAGE(STATUS "Configuring for Linux") + IF(ENABLE_STATIC MATCHES "ON") + LIST(APPEND CMAKE_REQUIRED_LIBRARIES z) + ENDIF() IF(EXISTS "/etc/debian_version") SET(LINUX_START_SCRIPT "rspamd_debian.in") ELSE(EXISTS "/etc/debian_version") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 33bc45406..a318af59e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -192,6 +192,9 @@ ENDIF () IF (ENABLE_HYPERSCAN MATCHES "ON") TARGET_LINK_LIBRARIES(rspamd hs) +ENDIF() + +IF(USE_CXX_LINKER) SET_TARGET_PROPERTIES(rspamd PROPERTIES LINKER_LANGUAGE CXX) ENDIF() diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index 51def34d7..0a92019d8 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -8,7 +8,7 @@ ADD_EXECUTABLE(rspamc ${RSPAMCSRC} ${LIBRSPAMDCLIENTSRC}) SET_TARGET_PROPERTIES(rspamc PROPERTIES COMPILE_FLAGS "-I${CMAKE_SOURCE_DIR}/lib") TARGET_LINK_LIBRARIES(rspamc rspamd-server) TARGET_LINK_LIBRARIES(rspamc ${RSPAMD_REQUIRED_LIBRARIES}) -IF (ENABLE_HYPERSCAN MATCHES "ON") +IF(USE_CXX_LINKER) SET_TARGET_PROPERTIES(rspamc PROPERTIES LINKER_LANGUAGE CXX) ENDIF() diff --git a/src/rspamadm/CMakeLists.txt b/src/rspamadm/CMakeLists.txt index 91e14d749..752e23d8b 100644 --- a/src/rspamadm/CMakeLists.txt +++ b/src/rspamadm/CMakeLists.txt @@ -49,7 +49,9 @@ IF (ENABLE_FANN MATCHES "ON") ENDIF () IF (ENABLE_HYPERSCAN MATCHES "ON") TARGET_LINK_LIBRARIES(rspamadm hs) - SET_TARGET_PROPERTIES(rspamadm PROPERTIES LINKER_LANGUAGE CXX) ENDIF () +IF(USE_CXX_LINKER) + SET_TARGET_PROPERTIES(rspamadm PROPERTIES LINKER_LANGUAGE CXX) +ENDIF() INSTALL(TARGETS rspamadm RUNTIME DESTINATION bin) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d4feffcc0..c6e7108b7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -37,6 +37,8 @@ IF(ENABLE_HIREDIS MATCHES "ON") ENDIF() IF (ENABLE_HYPERSCAN MATCHES "ON") TARGET_LINK_LIBRARIES(rspamd-test hs) +ENDIF() +IF(USE_CXX_LINKER) SET_TARGET_PROPERTIES(rspamd-test PROPERTIES LINKER_LANGUAGE CXX) ENDIF() TARGET_LINK_LIBRARIES(rspamd-test rspamd-actrie) diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 8bc0ff604..9d42c604e 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -7,7 +7,7 @@ SET(MIMESRC mime_tool.c) MACRO(ADD_UTIL NAME) ADD_EXECUTABLE("${NAME}" "${ARGN}") - IF (ENABLE_HYPERSCAN MATCHES "ON") + IF (USE_CXX_LINKER) SET_TARGET_PROPERTIES("${NAME}" PROPERTIES LINKER_LANGUAGE CXX) ELSE() SET_TARGET_PROPERTIES("${NAME}" PROPERTIES LINKER_LANGUAGE C) -- 2.39.5