emory/CMakeLists.txt

92 lines
2.3 KiB
CMake

###############################################################################
cmake_minimum_required(VERSION 3.8.0)
project(emory CXX)
set(CMAKE_CXX_STANDARD 20)
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include (nc)
find_package(PkgConfig REQUIRED)
###############################################################################
option (TESTS "enable unit testing" ON)
if (TESTS)
enable_testing ()
endif ()
###############################################################################
include_directories(.)
add_subdirectory(cruft/util)
add_subdirectory(cruft/crypto)
include (${CMAKE_BINARY_DIR}/conan_paths.cmake)
find_package (fmt REQUIRED)
###############################################################################
list(APPEND libemory_sources
emory/chunk/fwd.cpp
emory/chunk/fwd.hpp
emory/chunk/find.hpp
emory/chunk/find.cpp
emory/chunk/match.cpp
emory/chunk/match.hpp
emory/chunk/ostream.cpp
emory/chunk/ostream.hpp
emory/chunk/params.cpp
emory/chunk/params.hpp
emory/chunk/region.cpp
emory/chunk/region.hpp
emory/fs/acl.cpp
emory/fs/acl.hpp
emory/fs/ostream.cpp
emory/fs/ostream.hpp
emory/fs/xattr.cpp
emory/fs/xattr.hpp
emory/store/bits.cpp
emory/store/bits.hpp
emory/store/repo.cpp
emory/store/repo.hpp
)
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})
target_link_libraries(libemory cruft ${libemory_libs})
set_target_properties(libemory PROPERTIES OUTPUT_NAME emory)
###############################################################################
foreach (t analyse compare stat)
add_executable ("${t}" "tools/${t}.cpp")
target_link_libraries ("${t}" libemory cruft-crypto cruft fmt::fmt)
set_target_properties ("${t}" PROPERTIES
OUTPUT_NAME "emory-${t}"
)
install (TARGETS "${t}")
endforeach()
add_executable (emory tools/emory.cpp)
target_link_libraries (emory libemory)
install (TARGETS emory)
###############################################################################
set (CPACK_GENERATOR "TXZ")
set (CPACK_STRIP_FILES TRUE)
include (CPack)