From: Michael Wallner Date: Mon, 14 Sep 2020 07:45:20 +0000 (+0200) Subject: cmake: fix include directories X-Git-Tag: 1.1.0-beta1~236^2~75 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=5d6f037cd773ec09a91ed63bbc794a44b1ffbf84;p=awesomized%2Flibmemcached cmake: fix include directories --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 09d1ad50..e13c1fd4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,13 +18,6 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) include(CMakeConfig.txt) if(NOT BUILD_DOCSONLY) - foreach(INCLUDE IN ITEMS ${CMAKE_BINARY_DIR} .) - include_directories( - ${INCLUDE}/ - ${INCLUDE}/include - ${INCLUDE}/src - ) - endforeach() set(AUTOHEADER_FILE mem_config.h) diff --git a/src/bin/CMakeLists.txt b/src/bin/CMakeLists.txt index 8cd42462..a568dd1c 100644 --- a/src/bin/CMakeLists.txt +++ b/src/bin/CMakeLists.txt @@ -1,7 +1,14 @@ add_library(libclient_utilities STATIC utilities.cc generator.cc execute.cc) add_library(client_utilities ALIAS libclient_utilities) -target_link_libraries(libclient_utilities libmemcachedinternal) +target_link_libraries(libclient_utilities PRIVATE libmemcachedinternal) +target_include_directories(libclient_utilities PUBLIC + ${CMAKE_SOURCE_DIR}/include + ${CMAKE_BINARY_DIR}/include + ${CMAKE_SOURCE_DIR}/src + ${CMAKE_BINARY_DIR}/src + ${CMAKE_BINARY_DIR}) + foreach(CLIENT IN LISTS CLIENTS) add_executable(${CLIENT} ${CLIENT}.cc) diff --git a/src/libhashkit/CMakeLists.txt b/src/libhashkit/CMakeLists.txt index d31a5490..a75e08e7 100644 --- a/src/libhashkit/CMakeLists.txt +++ b/src/libhashkit/CMakeLists.txt @@ -33,7 +33,14 @@ add_library(libhashkit SHARED add_library(hashkit ALIAS libhashkit) set_target_properties(libhashkit PROPERTIES LIBRARY_OUTPUT_NAME hashkit) target_compile_options(libhashkit PRIVATE -DBUILDING_HASHKIT) - +target_include_directories(libhashkit PRIVATE + ${CMAKE_SOURCE_DIR}/src + ${CMAKE_BINARY_DIR}/src + ${CMAKE_BINARY_DIR}) +target_include_directories(libhashkit PUBLIC + $ + $ + $) configure_file(hashkitcon.h.in hashkitcon.h @ONLY) set_target_properties(libhashkit PROPERTIES SOVERSION ${LIBHASHKIT_SO_VERSION}) diff --git a/src/libmemcached/CMakeLists.txt b/src/libmemcached/CMakeLists.txt index ebb0d83b..96338c9b 100644 --- a/src/libmemcached/CMakeLists.txt +++ b/src/libmemcached/CMakeLists.txt @@ -90,9 +90,17 @@ add_library(libmemcached SHARED ${LIBMEMCACHED_SOURCES}) add_library(memcached ALIAS libmemcached) set_target_properties(libmemcached PROPERTIES LIBRARY_OUTPUT_NAME memcached) -target_link_libraries(libmemcached libhashkit Threads::Threads ${LIBSASL_LIBRARIES} ${CMAKE_DL_LIBS}) -target_include_directories(libmemcached PRIVATE ${LIBSASL_INCLUDEDIR}) target_compile_definitions(libmemcached PRIVATE -DBUILDING_LIBMEMCACHED) +target_link_libraries(libmemcached PUBLIC libhashkit Threads::Threads ${LIBSASL_LIBRARIES} ${CMAKE_DL_LIBS}) +target_include_directories(libmemcached PRIVATE ${LIBSASL_INCLUDEDIR}) +target_include_directories(libmemcached PRIVATE + ${CMAKE_SOURCE_DIR}/src + ${CMAKE_BINARY_DIR}/src + ${CMAKE_BINARY_DIR}) +target_include_directories(libmemcached PUBLIC + $ + $ + $) set_target_properties(libmemcached PROPERTIES SOVERSION ${LIBMEMCACHED_SO_VERSION}) install(TARGETS libmemcached EXPORT libmemcached @@ -112,9 +120,17 @@ add_library(libmemcachedinternal STATIC ${LIBMEMCACHED_SOURCES}) add_library(memcachedinternal ALIAS libmemcachedinternal) set_target_properties(libmemcachedinternal PROPERTIES LIBRARY_OUTPUT_NAME memcachedinternal) -target_link_libraries(libmemcachedinternal libhashkit Threads::Threads ${LIBSASL_LIBRARIES} ${CMAKE_DL_LIBS}) -target_include_directories(libmemcachedinternal PRIVATE ${LIBSASL_INCLUDEDIR}) target_compile_definitions(libmemcachedinternal PRIVATE -DBUILDING_LIBMEMCACHEDINTERNAL) +target_link_libraries(libmemcachedinternal PUBLIC libhashkit Threads::Threads ${LIBSASL_LIBRARIES} ${CMAKE_DL_LIBS}) +target_include_directories(libmemcachedinternal PRIVATE ${LIBSASL_INCLUDEDIR}) +target_include_directories(libmemcachedinternal PRIVATE + ${CMAKE_SOURCE_DIR}/src + ${CMAKE_BINARY_DIR}/src + ${CMAKE_BINARY_DIR}) +target_include_directories(libmemcachedinternal PUBLIC + $ + $ + $) # let libmemcached depend on libmemcachedinternal to ensure that they do not # compete for the same generated dependencies diff --git a/src/libmemcachedprotocol/CMakeLists.txt b/src/libmemcachedprotocol/CMakeLists.txt index 3712cf44..a826e0aa 100644 --- a/src/libmemcachedprotocol/CMakeLists.txt +++ b/src/libmemcachedprotocol/CMakeLists.txt @@ -10,7 +10,15 @@ add_library(libmemcachedprotocol SHARED add_library(memcachedprotocol ALIAS libmemcachedprotocol) set_target_properties(libmemcachedprotocol PROPERTIES LIBRARY_OUTPUT_NAME memcachedprotocol) target_compile_definitions(libmemcachedprotocol PRIVATE -DBUILDING_LIBMEMCACHED) -target_link_libraries(libmemcachedprotocol libmemcached Threads::Threads) +target_link_libraries(libmemcachedprotocol PUBLIC libmemcached Threads::Threads) +target_include_directories(libmemcachedprotocol PRIVATE + ${CMAKE_SOURCE_DIR}/src + ${CMAKE_BINARY_DIR}/src + ${CMAKE_BINARY_DIR}) +target_include_directories(libmemcachedprotocol PUBLIC + $ + $ + $) set_target_properties(libmemcachedprotocol PROPERTIES SOVERSION ${LIBMEMCACHEDPROTOCOL_SO_VERSION}) install(TARGETS libmemcachedprotocol EXPORT libmemcachedprotocol diff --git a/src/libmemcachedutil/CMakeLists.txt b/src/libmemcachedutil/CMakeLists.txt index e99e7256..d087d63d 100644 --- a/src/libmemcachedutil/CMakeLists.txt +++ b/src/libmemcachedutil/CMakeLists.txt @@ -11,7 +11,15 @@ add_library(libmemcachedutil SHARED add_library(memcachedutil ALIAS libmemcachedutil) set_target_properties(libmemcachedutil PROPERTIES LIBRARY_OUTPUT_NAME memcachedutil) target_compile_definitions(libmemcachedutil PRIVATE -DBUILDING_LIBMEMCACHED) -target_link_libraries(libmemcachedutil libmemcached Threads::Threads) +target_link_libraries(libmemcachedutil PUBLIC libmemcached Threads::Threads) +target_include_directories(libmemcachedutil PRIVATE + ${CMAKE_SOURCE_DIR}/src + ${CMAKE_BINARY_DIR}/src + ${CMAKE_BINARY_DIR}) +target_include_directories(libmemcachedutil PUBLIC + $ + $ + $) set_target_properties(libmemcachedutil PROPERTIES SOVERSION ${LIBMEMCACHEDUTIL_SO_VERSION}) install(TARGETS libmemcachedutil EXPORT libmemcachedutil