diff options
-rw-r--r-- | CMakeLists.txt | 10 | ||||
-rw-r--r-- | lib/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/CMakeLists.txt | 5 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 2 |
4 files changed, 20 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 189100d..d2d1d89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ cmake_minimum_required(VERSION 3.11) project(spm C) +include(FindPkgConfig) include(CTest) include(CheckSymbolExists) @@ -10,6 +11,15 @@ set(CMAKE_INSTALL_RPATH $ORIGIN/../lib) enable_testing() check_symbol_exists(strsep string.h HAVE_STRSEP) check_symbol_exists(reallocarray stdlib.h HAVE_REALLOCARRAY) +pkg_check_modules(OpenSSL openssl>=1.1) +pkg_check_modules(CURL libcurl>=7.0) +find_program(RELOC reloc) +find_program(TAR tar) +find_program(WHICH which) +find_program(FILE file) +find_program(OBJDUMP objdump) +find_program(RSYNC rsync) + configure_file(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/include/config.h) add_subdirectory(lib) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 2185ef4..96147e1 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1,6 +1,8 @@ include_directories( ${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include + ${OpenSSL_INCLUDE_DIRS} + ${CURL_INCLUDE_DIRS} ) set(libspm_src @@ -39,7 +41,8 @@ add_library(libspm SHARED $<TARGET_OBJECTS:libspm_obj>) add_library(libspm_static STATIC $<TARGET_OBJECTS:libspm_obj>) -target_link_libraries(libspm crypto ssl curl) +target_link_directories(libspm PUBLIC ${OpenSSL_LIBRARY_DIRS} ${CURL_LIBRARY_DIRS}) +target_link_libraries(libspm ${OpenSSL_LIBRARIES} ${CURL_LIBRARIES}) if (LINUX) target_link_libraries(libspm rt) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2bd023c..b8c042f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,13 +1,16 @@ include_directories( ${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include + ${OpenSSL_INCLUDE_DIRS} + ${CURL_INCLUDE_DIRS} ) add_executable(spm spm.c ) -target_link_libraries(spm libspm crypto ssl curl) +target_link_directories(spm PUBLIC ${OpenSSL_LIBRARY_DIRS} ${CURL_LIBRARY_DIRS}) +target_link_libraries(spm libspm ${OpenSSL_LIBRARIES} ${CURL_LIBRARIES}) if (LINUX) target_link_libraries(spm libspm rt) endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e4d069c..287c37f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,6 +1,8 @@ include_directories( ${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include + ${OpenSSL_INCLUDE_DIRS} + ${CURL_INCLUDE_DIRS} ) set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/tests) set(CTEST_BINARY_DIRECTORY ${PROJECT_BINARY_DIR}/tests) |