Files
Structive/extensions/main.cmake
T
2026-08-08 21:21:23 +08:00

32 lines
2.2 KiB
CMake

add_library(structive_property_extensions STATIC "${CMAKE_CURRENT_LIST_DIR}/src/presentation.cpp")
add_library(structive::property_extensions ALIAS structive_property_extensions)
set_target_properties(structive_property_extensions PROPERTIES EXPORT_NAME property_extensions)
target_include_directories(structive_property_extensions PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>" "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
target_link_libraries(structive_property_extensions PUBLIC structive::property_core)
target_compile_features(structive_property_extensions PUBLIC cxx_std_20)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(structive_property_extensions PRIVATE -Wall -Wextra -Wpedantic)
endif()
if(STRUCTIVE_BUILD_EXAMPLES)
add_executable(structive_property_extensions_example "${CMAKE_CURRENT_LIST_DIR}/example/main.cpp")
target_link_libraries(structive_property_extensions_example PRIVATE structive::property_extensions)
endif()
if(STRUCTIVE_BUILD_TESTS)
add_executable(structive_property_extensions_test "${CMAKE_CURRENT_LIST_DIR}/tests/presentation_test.cpp")
target_link_libraries(structive_property_extensions_test PRIVATE structive::property_extensions)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(structive_property_extensions_test PRIVATE -Wall -Wextra -Wpedantic)
endif()
add_test(NAME structive_property_extensions_test COMMAND structive_property_extensions_test)
set_tests_properties(structive_property_extensions_test PROPERTIES LABELS "unit;extensions")
set(header structive/property/extensions/presentation.hpp)
set(target structive_header_structive_property_extensions_presentation_hpp)
set(source "${CMAKE_CURRENT_BINARY_DIR}/structive_header_tests/${target}.cpp")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/structive_header_tests")
file(WRITE "${source}" "#include <${header}>\nint main() {\n return 0;\n}\n")
add_executable("${target}" "${source}")
target_link_libraries("${target}" PRIVATE structive::property_extensions)
add_test(NAME "${target}" COMMAND "${target}")
set_tests_properties("${target}" PROPERTIES LABELS "header;extensions")
endif()