1
0
Fork 0
mirror of https://github.com/TheLartians/ModernCppStarter.git synced 2025-09-03 23:50:53 +02:00

add options.cmake project config file

common options used for every cmake project
prevent reame of standalone executable via cmake properties
This commit is contained in:
ClausKlein 2021-02-17 10:31:56 +01:00
parent 9391ce636a
commit 6ea6bdd2ea
11 changed files with 84 additions and 103 deletions

View file

@ -25,14 +25,14 @@ CPMAddPackage(NAME Greeter SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/..)
file(GLOB sources CONFIGURE_DEPENDS source/*.cpp)
add_executable(GreeterStandalone ${sources})
# TODO: why rename in this way? Seems only for CI with GitHub actions! CK
set_target_properties(
GreeterStandalone PROPERTIES CXX_STANDARD ${CMAKE_CXX_STANDARD} OUTPUT_NAME "Greeter"
)
set_target_properties(GreeterStandalone PROPERTIES CXX_STANDARD ${CMAKE_CXX_STANDARD})
# WORKAROUND missing ALIAS target error! CK
if(NOT TARGET cxxopts::cxxopts)
add_library(cxxopts::cxxopts ALIAS cxxopts)
endif()
target_link_libraries(GreeterStandalone Greeter::Greeter cxxopts::cxxopts)
# ---- run the standalone executable ----
enable_testing()
add_test(NAME GreeterStandalone COMMAND GreeterStandalone)