From c1f19faba427697218a1b01d60cc53ab58c8cca5 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Sun, 6 Dec 2020 06:59:56 +1000 Subject: [PATCH] build: move higher level CMake directives to top of file --- CMakeLists.txt | 39 +++++++++++++++++++++++++-------------- cmake | 2 +- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f9ed57..705221f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,13 +7,24 @@ set(CMAKE_CXX_STANDARD 20) list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) include (nc) -include_directories(.) +find_package(PkgConfig REQUIRED) ############################################################################### -add_library(libemory - acl.cpp - acl.hpp +option (TESTS "enable unit testing" ON) +if (TESTS) + enable_testing () +endif () + + +############################################################################### +include_directories(.) + +add_subdirectory(cruft/util) +add_subdirectory(cruft/crypto) + +############################################################################### +list(APPEND libemory_sources emory/chunk/fwd.cpp emory/chunk/fwd.hpp emory/chunk/map.cpp @@ -38,20 +49,20 @@ add_library(libemory emory/store/repo.hpp ) -target_link_libraries(libemory cruft acl) -set_target_properties(libemory PROPERTIES OUTPUT_NAME emory) - -############################################################################### -option (TESTS "enable unit testing" ON) -if (TESTS) - enable_testing () +if (NOT WIN32) + pkg_check_modules(ACL REQUIRED IMPORTED_TARGET libacl) + list (APPEND libemory_sources + acl.cpp + acl.hpp + ) + list (APPEND libemory_libs PkgConfig::ACL) endif () +add_library(libemory ${libemory_sources}) -############################################################################### -add_subdirectory(cruft/util) -add_subdirectory(cruft/crypto) +target_link_libraries(libemory cruft ${libemory_libs}) +set_target_properties(libemory PROPERTIES OUTPUT_NAME emory) ############################################################################### diff --git a/cmake b/cmake index bf694b3..60a1dc6 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit bf694b3085fa97c2f7f94473b652f84f28048d52 +Subproject commit 60a1dc65ef41e1d18e283dba48c993aeee629c00