@@ -4,27 +4,60 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
44
55set (CMAKE_EXPORT_COMPILE_COMMANDS ON )
66
7+ include (GNUInstallDirs)
78include (ThirdParties)
89include (ClangTidy)
910include (PedanticCompiler)
1011
1112set (boxed_cpp_HEADERS
12- include /boxed-cpp/boxed.hpp
13+ ${PROJECT_SOURCE_DIR} / include /boxed-cpp/boxed.hpp
1314)
1415add_library (boxed-cpp INTERFACE )
16+ add_library (boxed-cpp::boxed-cpp ALIAS boxed-cpp)
1517
1618target_compile_features (boxed-cpp INTERFACE cxx_std_20)
1719target_include_directories (boxed-cpp INTERFACE
1820 $<BUILD_INTERFACE:${${PROJECT_NAME} _SOURCE_DIR}/include >
19- $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} /include >
21+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} >
22+ )
23+
24+ # Generate the version, config and target files
25+ include (CMakePackageConfigHelpers)
26+ write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR} /boxed-cpp-config-version .cmake
27+ VERSION ${PROJECT_VERSION}
28+ COMPATIBILITY SameMajorVersion
29+ )
30+ configure_package_config_file(boxed-cpp-config.cmake.in
31+ ${CMAKE_CURRENT_BINARY_DIR} /boxed-cpp-config.cmake
32+ INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR} /cmake/boxed-cpp
33+ )
34+
35+ install (FILES ${boxed_cpp_HEADERS}
36+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} /boxed-cpp
37+ )
38+ install (TARGETS boxed-cpp
39+ EXPORT boxed-cpp-targets
40+ DESTINATION ${CMAKE_INSTALL_LIBDIR}
41+ )
42+
43+ install (FILES ${CMAKE_CURRENT_BINARY_DIR} /boxed-cpp-config.cmake
44+ ${CMAKE_CURRENT_BINARY_DIR} /boxed-cpp-config-version .cmake
45+ DESTINATION ${CMAKE_INSTALL_LIBDIR} /cmake/boxed-cpp
46+ )
47+ install (EXPORT boxed-cpp-targets
48+ DESTINATION ${CMAKE_INSTALL_LIBDIR} /cmake/boxed-cpp
49+ NAMESPACE boxed-cpp::
2050)
2151
2252# ---------------------------------------------------------------------------
2353# unit tests
2454
25- option (BOXED_CPP_TESTS "Enables building of unittests for boxed-cpp [default: ON ]" OFF )
55+ option (BOXED_CPP_TESTS "Enables building of unittests for boxed-cpp [default: OFF ]" OFF )
2656if (BOXED_CPP_TESTS)
27- ThirdPartiesAdd_Catch2()
57+ find_package (Catch2)
58+ if (NOT Catch2_FOUND)
59+ ThirdPartiesAdd_Catch2()
60+ endif ()
2861 enable_testing ()
2962 add_executable (test -boxed-cpp
3063 test -boxed-cpp.cpp
0 commit comments