diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/ConfigSources/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Tests/FindDoxygen/SimpleTest/CMakeLists.txt | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/Tests/ConfigSources/CMakeLists.txt b/Tests/ConfigSources/CMakeLists.txt index 21f923e..c5f9c50 100644 --- a/Tests/ConfigSources/CMakeLists.txt +++ b/Tests/ConfigSources/CMakeLists.txt @@ -1,4 +1,8 @@ cmake_minimum_required(VERSION 3.0) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(NOT _isMultiConfig AND NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build") +endif() project(ConfigSources CXX) # Per-config sources via INTERFACE_SOURCES. @@ -55,3 +59,13 @@ target_compile_definitions(ConfigSourcesLinkIface PRIVATE "$<$<NOT:$<CONFIG:Debug>>:CFG_OTHER>" ) target_link_libraries(ConfigSourcesLinkIface ConfigSourcesIface) + +# A target with sources in only one configuration that is not the +# first in CMAKE_CONFIGURATION_TYPES. +if(CMAKE_CONFIGURATION_TYPES MATCHES ";([^;]+)") + set(one_config "${CMAKE_MATCH_1}") +else() + set(one_config "${CMAKE_BUILD_TYPE}") +endif() +add_library(OneConfigOnly OBJECT "$<$<CONFIG:${one_config}>:${CMAKE_CURRENT_SOURCE_DIR}/iface_src.cpp>") +set_property(TARGET OneConfigOnly PROPERTY LINKER_LANGUAGE CXX) diff --git a/Tests/FindDoxygen/SimpleTest/CMakeLists.txt b/Tests/FindDoxygen/SimpleTest/CMakeLists.txt index 332cecc..deec4fd 100644 --- a/Tests/FindDoxygen/SimpleTest/CMakeLists.txt +++ b/Tests/FindDoxygen/SimpleTest/CMakeLists.txt @@ -22,6 +22,7 @@ else() message(FATAL_ERROR "Import target Doxygen::doxygen not defined") endif() +set(DOXYGEN_OUTPUT_DIRECTORY noArgs) doxygen_add_docs(docsNoArgs) if(NOT EXISTS "${PROJECT_BINARY_DIR}/Doxyfile.docsNoArgs") message(FATAL_ERROR "Missing generated file: Doxyfile.docsNoArgs") @@ -30,6 +31,7 @@ if(NOT TARGET docsNoArgs) message(FATAL_ERROR "Target docsNoArgs not created") endif() +set(DOXYGEN_OUTPUT_DIRECTORY withArgs) configure_file(spaces_in_name.cpp.in "spaces in name.cpp" COPYONLY) doxygen_add_docs(docsWithArgs "${CMAKE_CURRENT_BINARY_DIR}/spaces in name.cpp" |