From 3f1f68029e18f66cdf9d53d84bd4e9a71e75228f Mon Sep 17 00:00:00 2001 From: Sophie Wenzel-Teuber Date: Wed, 2 Sep 2020 17:04:22 +0100 Subject: [PATCH] Update cmake for use with CentOS 8 rpms * Update Findspdlog.cmake script to use spdlog's own cmake scripts * Add linking to spdlog::spdlog to all deimos targets * Clean up and update Findphobos.cmake --- cmake/Findphobos.cmake | 36 ++++++++--------------- cmake/Findspdlog.cmake | 40 ++++++++++++++------------ src/CMakeLists.txt | 1 + src/server/CMakeLists.txt | 1 + src/server/s3_utilities/CMakeLists.txt | 1 + src/storage/CMakeLists.txt | 1 + src/stream/CMakeLists.txt | 1 + 7 files changed, 38 insertions(+), 43 deletions(-) diff --git a/cmake/Findphobos.cmake b/cmake/Findphobos.cmake index 5f1ede7..3db7d35 100644 --- a/cmake/Findphobos.cmake +++ b/cmake/Findphobos.cmake @@ -5,22 +5,16 @@ include(FindPackageHandleStandardArgs) if(NOT PHOBOS_FOUND) find_path( PHOBOS_INCLUDE_DIR HINTS ./ - ../phobos/include/ - ../include/phobos/ - ../../phobos/include/ - ../../include/phobos/ - ../../../phobos/include/ - ../../../include/phobos/ /usr/include/ /usr/include/phobos/ /usr/local/include/ /usr/local/include/phobos/ - ${CMAKE_PREFIX_PATH}/include/phobos/ - ${CMAKE_PREFIX_PATH}/phobos/include/ - ${CMAKE_INSTALL_PREFIX}/../include/phobos/ - ${CMAKE_INSTALL_PREFIX}/../phobos/include/ + ${CMAKE_INSTALL_PREFIX}/include/ ${CMAKE_INSTALL_PREFIX}/include/phobos/ ${CMAKE_INSTALL_PREFIX}/phobos/include/ + ${CMAKE_INSTALL_PREFIX}/../include/ + ${CMAKE_INSTALL_PREFIX}/../include/phobos/ + ${CMAKE_INSTALL_PREFIX}/../phobos/include/ NAMES phobos_store.h pho_attrs.h DOC "Phobos headers" ) @@ -58,23 +52,17 @@ if(NOT PHOBOS_FOUND) ) find_path( PHOBOS_LIBRARY_DIR - HINTS ./ - ../phobos/lib/ - ../lib/phobos/ - ../../phobos/lib/ - ../../lib/phobos/ - ../../../phobos/lib/ - ../../../lib/phobos/ + HINTS ./ /usr/lib/ - /usr/lib/phobos/ + /usr/lib64/ /usr/local/lib/ - /usr/local/lib/phobos/ - ${CMAKE_PREFIX_PATH}/lib/phobos/ - ${CMAKE_PREFIX_PATH}/phobos/lib/ - ${CMAKE_INSTALL_PREFIX}/../lib/phobos/ - ${CMAKE_INSTALL_PREFIX}/../phobos/lib/ - ${CMAKE_INSTALL_PREFIX}/lib/phobos/ + /usr/local/lib64/ + ${CMAKE_INSTALL_PREFIX}/lib/ + ${CMAKE_INSTALL_PREFIX}/lib64/ ${CMAKE_INSTALL_PREFIX}/phobos/lib/ + ${CMAKE_INSTALL_PREFIX}/phobos/lib64/ + ${CMAKE_INSTALL_PREFIX}/../phobos/lib/ + ${CMAKE_INSTALL_PREFIX}/../phobos/lib64/ NAMES libphobos_store.so libphobos_store.la DOC "Phobos library" ) diff --git a/cmake/Findspdlog.cmake b/cmake/Findspdlog.cmake index 66bb445..49f97cc 100644 --- a/cmake/Findspdlog.cmake +++ b/cmake/Findspdlog.cmake @@ -3,27 +3,29 @@ include(FindPackageHandleStandardArgs) # message("Looking for SpdLog") if(NOT SPDLOG_FOUND) - find_path( SPDLOG_INCLUDE_DIR + find_path( SPDLOG_CONFIG HINTS ./ - ./spdlog/include/ - ../spdlog/include/ - ../../spdlog/include/ - ../../../spdlog/include/ - /usr/spdlog/include/ - /usr/local/include/ - /usr/local/spdlog/include/ - ${CMAKE_PREFIX_PATH}/include/spdlog/include/ - ${CMAKE_PREFIX_PATH}/spdlog/include/ - ${CMAKE_INSTALL_PREFIX}/../include/spdlog/include/ - ${CMAKE_INSTALL_PREFIX}/../spdlog/include/ - ${CMAKE_INSTALL_PREFIX}/include/spdlog/include/ - ${CMAKE_INSTALL_PREFIX}/spdlog/include/ - NAMES spdlog/spdlog.h - DOC "SpdLog headers" + ./spdlog/lib64/cmake/spdlog/ + ../spdlog/lib64/cmake/spdlog/ + ../../spdlog/lib64/cmake/spdlog/ + ../../../spdlog/lib64/cmake/spdlog/ + /usr/lib64/cmake/spdlog/ + /usr/local/lib64/cmake/spdlog/ + ${CMAKE_PREFIX_PATH}/lib64/cmake/spdlog/ + ${CMAKE_PREFIX_PATH}/spdlog/lib64/cmake/spdlog/ + ${CMAKE_INSTALL_PREFIX}/../lib64/cmake/spdlog/ + ${CMAKE_INSTALL_PREFIX}/../spdlog/lib64/cmake/spdlog/ + ${CMAKE_INSTALL_PREFIX}/lib64/cmake/spdlog/ + ${CMAKE_INSTALL_PREFIX}/spdlog/lib64/cmake/spdlog/ + NAMES spdlogConfig.cmake + DOC "SpdLog cmake Config" ) - find_package_handle_standard_args(spdlog - REQUIRED_VARS SPDLOG_INCLUDE_DIR - HANDLE_COMPONENTS) + if(NOT SPDLOG_CONFIG) + MESSAGE(FATAL_ERROR + "Could not find spdlog Cmake config file") + endif() + + include(${SPDLOG_CONFIG}/spdlogConfig.cmake) endif() \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5f6291f..000bf10 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -20,6 +20,7 @@ target_compile_features(deimos PUBLIC cxx_std_14) target_link_system_libraries(deimos PUBLIC proxygen::proxygen) target_link_system_libraries(deimos PUBLIC proxygen::proxygenhttpserver) +target_link_system_libraries(deimos PUBLIC spdlog::spdlog) target_link_libraries(deimos PUBLIC server) diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt index 9cbe5bc..f900918 100644 --- a/src/server/CMakeLists.txt +++ b/src/server/CMakeLists.txt @@ -22,5 +22,6 @@ endif(NOT DEIMOS_AUTHORISATION) #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -O1") target_link_system_libraries(server PUBLIC proxygen::proxygen) +target_link_system_libraries(server PUBLIC spdlog::spdlog) target_link_libraries(server PUBLIC stream) target_link_libraries(server PUBLIC s3_utilities) diff --git a/src/server/s3_utilities/CMakeLists.txt b/src/server/s3_utilities/CMakeLists.txt index a93bb1d..3e2dc61 100644 --- a/src/server/s3_utilities/CMakeLists.txt +++ b/src/server/s3_utilities/CMakeLists.txt @@ -8,5 +8,6 @@ add_library( ) target_link_system_libraries(s3_utilities PUBLIC proxygen::proxygen) +target_link_system_libraries(s3_utilities PUBLIC spdlog::spdlog) target_link_system_libraries(s3_utilities PUBLIC OpenSSL::Crypto) diff --git a/src/storage/CMakeLists.txt b/src/storage/CMakeLists.txt index 6c60350..e717c4a 100644 --- a/src/storage/CMakeLists.txt +++ b/src/storage/CMakeLists.txt @@ -13,4 +13,5 @@ target_include_directories( ${PHOBOS_INCLUDE_DIR} ) +target_link_system_libraries(storage PUBLIC spdlog::spdlog) target_link_system_libraries(storage PUBLIC phobos_cpp_wrapper) diff --git a/src/stream/CMakeLists.txt b/src/stream/CMakeLists.txt index 026b1d2..6d90d52 100644 --- a/src/stream/CMakeLists.txt +++ b/src/stream/CMakeLists.txt @@ -4,4 +4,5 @@ add_library( ) #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -O1") +target_link_system_libraries(stream PUBLIC spdlog::spdlog) target_link_libraries(stream PUBLIC storage) -- GitLab