From: Michael Wallner Date: Mon, 2 Nov 2020 10:13:37 +0000 (+0100) Subject: cmake X-Git-Tag: 1.1.0-beta1~137 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=30c51379a982cb3e7682a90cdb2469c5e72a6045;p=awesomized%2Flibmemcached cmake --- diff --git a/CMake/CheckDependency.cmake b/CMake/CheckDependency.cmake index f57d12ae..bb6fd7d0 100644 --- a/CMake/CheckDependency.cmake +++ b/CMake/CheckDependency.cmake @@ -25,6 +25,7 @@ function(check_dependency_basic NAME LIB HEADER) if(FOUND) message("-- Found library '${LIB${LIB}}'") message("-- Found include '${${HEADER_CONST}_ROOT}'") + set(${NAME} ${NAME} PARENT_SCOPE) add_library(${NAME} INTERFACE IMPORTED) set_target_properties(${NAME} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${${HEADER_CONST}_ROOT} @@ -42,7 +43,7 @@ function(check_dependency NAME LIB HEADER) pkg_check_modules(${NAME} ${LIB}${ARGN}) endif() if(${NAME}_FOUND) - add_library(${NAME} ALIAS PkgConfig::${NAME}) + set(${NAME} PkgConfig::${NAME} PARENT_SCOPE) endif() endif() if(NOT ${NAME}_FOUND) diff --git a/CMake/CheckTbb.cmake b/CMake/CheckTbb.cmake index 1245e03b..11abb4ab 100644 --- a/CMake/CheckTbb.cmake +++ b/CMake/CheckTbb.cmake @@ -5,8 +5,8 @@ function(CHECK_TBB) check_dependency(LIBTBB tbb tbb/task.h) if(HAVE_LIBTBB) cmake_push_check_state(RESET) - get_property(LIBTBB_INCLUDEDIR TARGET LIBTBB PROPERTY INTERFACE_INCLUDE_DIRECTORIES) - get_property(LIBTBB_LIBRARIES TARGET LIBTBB PROPERTY INTERFACE_LINK_LIBRARIES) + get_property(LIBTBB_INCLUDEDIR TARGET ${LIBTBB} PROPERTY INTERFACE_INCLUDE_DIRECTORIES) + get_property(LIBTBB_LIBRARIES TARGET ${LIBTBB} PROPERTY INTERFACE_LINK_LIBRARIES) set(CMAKE_REQUIRED_INCLUDES "${LIBTBB_INCLUDEDIR}") set(CMAKE_REQUIRED_LIBRARIES "${LIBTBB_LIBRARIES}") set(CMAKE_REQUIRED_FLAGS -std=c++17) diff --git a/CMake/_Include.cmake b/CMake/_Include.cmake index 93f4fb4e..579d8532 100644 --- a/CMake/_Include.cmake +++ b/CMake/_Include.cmake @@ -128,6 +128,7 @@ check_decl(abi::__cxa_demangle cxxabi.h) find_package(Backtrace) if(Backtrace_FOUND) set(HAVE_BACKTRACE 1) + set(BACKTRACE BACKTRACE) add_library(BACKTRACE INTERFACE IMPORTED) set_target_properties(BACKTRACE PROPERTIES INTERFACE_LINK_LIBRARIES "${Backtrace_LIBRARIES}" diff --git a/src/bin/CMakeLists.txt b/src/bin/CMakeLists.txt index 988f4809..54b1fa76 100644 --- a/src/bin/CMakeLists.txt +++ b/src/bin/CMakeLists.txt @@ -34,7 +34,7 @@ if(HAVE_MEMASLAP) memaslap/ms_task.c memaslap/ms_thread.c) target_include_directories(memaslap PRIVATE memaslap) - target_link_libraries(memaslap PRIVATE libclient_common Threads::Threads LIBEVENT) + target_link_libraries(memaslap PRIVATE libclient_common Threads::Threads ${LIBEVENT}) if(CMAKE_INSTALL_RPATH) set_target_properties(${CLIENT} PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_RPATH}/../${CMAKE_INSTALL_LIBDIR}) diff --git a/src/libmemcached/CMakeLists.txt b/src/libmemcached/CMakeLists.txt index 4f483011..6dd760d3 100644 --- a/src/libmemcached/CMakeLists.txt +++ b/src/libmemcached/CMakeLists.txt @@ -93,10 +93,10 @@ set_target_properties(libmemcached PROPERTIES target_compile_definitions(libmemcached PRIVATE -DBUILDING_LIBMEMCACHED) target_link_libraries(libmemcached PUBLIC libhashkit Threads::Threads ${CMAKE_DL_LIBS}) if(HAVE_BACKTRACE) - target_link_libraries(libmemcached PRIVATE BACKTRACE) + target_link_libraries(libmemcached PRIVATE ${BACKTRACE}) endif() if(HAVE_LIBSASL) - target_link_libraries(libmemcached PUBLIC LIBSASL) + target_link_libraries(libmemcached PUBLIC ${LIBSASL}) endif() target_include_directories(libmemcached PRIVATE ${CMAKE_SOURCE_DIR}/src @@ -127,11 +127,13 @@ add_library(libmemcachedinternal STATIC add_library(memcachedinternal ALIAS libmemcachedinternal) set_target_properties(libmemcachedinternal PROPERTIES CXX_STANDARD ${CXX_STANDARD} LIBRARY_OUTPUT_NAME memcachedinternal) target_compile_definitions(libmemcachedinternal PRIVATE -DBUILDING_LIBMEMCACHEDINTERNAL) -target_link_libraries(libmemcachedinternal PUBLIC libhashkit Threads::Threads ${CMAKE_DL_LIBS} ${Backtrace_LIBRARIES}) +target_link_libraries(libmemcachedinternal PUBLIC libhashkit Threads::Threads ${CMAKE_DL_LIBS}) if(HAVE_LIBSASL) - target_link_libraries(libmemcachedinternal PUBLIC LIBSASL) + target_link_libraries(libmemcachedinternal PUBLIC ${LIBSASL}) +endif() +if(HAVE_BACKTRACE) + target_link_libraries(libmemcachedinternal PRIVATE ${BACKTRACE}) endif() -target_include_directories(libmemcachedinternal PRIVATE ${Backtrace_INCLUDE_DIR}) target_include_directories(libmemcachedinternal PRIVATE ${CMAKE_SOURCE_DIR}/src ${CMAKE_BINARY_DIR}/src diff --git a/src/libmemcachedutil/CMakeLists.txt b/src/libmemcachedutil/CMakeLists.txt index 32808800..6bad745b 100644 --- a/src/libmemcachedutil/CMakeLists.txt +++ b/src/libmemcachedutil/CMakeLists.txt @@ -23,7 +23,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL AppleClang) endif() target_link_libraries(libmemcachedutil PUBLIC Threads::Threads) if(HAVE_LIBSASL) - target_link_libraries(libmemcachedutil PUBLIC LIBSASL) + target_link_libraries(libmemcachedutil PUBLIC ${LIBSASL}) endif() target_include_directories(libmemcachedutil PRIVATE ${CMAKE_SOURCE_DIR}/src diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 040a8c61..75fb187b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -31,7 +31,7 @@ target_link_libraries(runtests PRIVATE libhashkit libmemcachedinternal libmemcac check_tbb() if(HAVE_TBB) message("HAVE TBB") - target_link_libraries(runtests PRIVATE LIBTBB) + target_link_libraries(runtests PRIVATE ${LIBTBB}) endif() add_dependencies(runtests ${CLIENTS})