TU-Programmieren_2/lab3/modules/iue-rnd/CMakeLists.txt
2025-04-09 10:22:44 +02:00

31 lines
1.1 KiB
CMake

cmake_minimum_required(VERSION 3.28)
# define CXX interface library
# define target & alias (for other projects consuming the "source-tree")
add_library(iue-rnd_rnd INTERFACE)
# define sources of target
target_sources(iue-rnd_rnd
INTERFACE FILE_SET public_headers TYPE HEADERS BASE_DIRS ${PROJECT_SOURCE_DIR} FILES random.hpp)
# define installation step
install(TARGETS iue-rnd_rnd EXPORT iue-rnd-export
FILE_SET public_headers DESTINATION "./")
# define test
if(BUILD_TESTING AND PROJECT_IS_TOP_LEVEL)
add_executable(iue-rnd_rnd.test random.test.cpp)
target_link_libraries(iue-rnd_rnd.test iue-rnd_rnd)
add_test(NAME iue-rnd_rnd.test COMMAND iue-rnd_rnd.test)
endif()
# export targets for consuming cmake projects
# generate and install a .cmake file to allow dependend projects consuming the "install-tree" to import all targets
install(EXPORT iue-rnd-export DESTINATION "iue-rnd" )
# allow dependend projects consuming the "build-tree" to use all targets
export(EXPORT iue-rnd-export)