2019-02-10 12:30:44 +11:00
|
|
|
###############################################################################
|
2024-07-18 09:51:47 +10:00
|
|
|
cmake_minimum_required(VERSION 3.20.0)
|
2019-02-10 12:30:44 +11:00
|
|
|
project(cruft-cxx CXX)
|
|
|
|
|
|
|
|
|
2024-07-18 09:51:47 +10:00
|
|
|
###############################################################################
|
|
|
|
if (NOT TARGET cruft::util)
|
|
|
|
find_package (cruft CONFIG REQUIRED COMPONENTS util)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2019-02-10 12:30:44 +11:00
|
|
|
###############################################################################
|
|
|
|
list (APPEND sources
|
|
|
|
src/type_traits
|
|
|
|
src/exception
|
|
|
|
src/exception.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
##-----------------------------------------------------------------------------
|
2024-07-18 09:51:47 +10:00
|
|
|
add_library (libcruft-cxx STATIC ${sources})
|
|
|
|
add_library (cruft::cxx ALIAS libcruft-cxx)
|
2019-02-10 12:30:44 +11:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
option (TESTS "enable unit testing" ON)
|
|
|
|
|
|
|
|
|
|
|
|
if (TESTS)
|
|
|
|
include (CTest)
|
|
|
|
enable_testing ()
|
|
|
|
|
|
|
|
foreach (t type_traits exception)
|
|
|
|
string(REPLACE "/" "_" name "test/${t}")
|
|
|
|
add_executable(cxx_${name} test/${t}.cpp)
|
2024-07-18 09:51:47 +10:00
|
|
|
target_link_libraries(cxx_${name} PRIVATE cruft::cxx cruft::util)
|
2019-02-10 12:30:44 +11:00
|
|
|
target_include_directories(cxx_${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
add_test(NAME cxx_${name} COMMAND cxx_${name})
|
|
|
|
endforeach()
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
configure_file(libcruft-cxx.pc.in libcruft-cxx.pc)
|
|
|
|
configure_file(Doxyfile.in Doxyfile)
|