diff --git a/CMakeLists.txt b/CMakeLists.txt index 42b66f7..7d66956 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,14 @@ ############################################################################### -cmake_minimum_required(VERSION 3.7.0) +cmake_minimum_required(VERSION 3.20.0) project(cruft-cxx CXX) +############################################################################### +if (NOT TARGET cruft::util) + find_package (cruft CONFIG REQUIRED COMPONENTS util) +endif() + + ############################################################################### list (APPEND sources src/type_traits @@ -12,8 +18,8 @@ list (APPEND sources ##----------------------------------------------------------------------------- -add_library (cruft-cxx STATIC ${sources}) - +add_library (libcruft-cxx STATIC ${sources}) +add_library (cruft::cxx ALIAS libcruft-cxx) ############################################################################### option (TESTS "enable unit testing" ON) @@ -26,7 +32,7 @@ if (TESTS) foreach (t type_traits exception) string(REPLACE "/" "_" name "test/${t}") add_executable(cxx_${name} test/${t}.cpp) - target_link_libraries(cxx_${name} PRIVATE cruft-cxx cruft) + target_link_libraries(cxx_${name} PRIVATE cruft::cxx cruft::util) target_include_directories(cxx_${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) add_test(NAME cxx_${name} COMMAND cxx_${name}) endforeach()