diff options
Diffstat (limited to 'Tests/RunCMake')
17 files changed, 31 insertions, 15 deletions
diff --git a/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake b/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake index f268de7..27a609d 100644 --- a/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake +++ b/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake @@ -12,7 +12,7 @@ if("${RunCMake_GENERATOR}" MATCHES "Watcom WMake|Borland Makefiles") endif() # we build debug so the say.exe will be found in Debug/say.exe for # Visual Studio generators -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio|Xcode") +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) set(INTDIR "Debug/") endif() # build AutoExport diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake index 1bf8fbc..3445beb 100644 --- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake +++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake @@ -11,7 +11,7 @@ function(run_BuildDepends CASE) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${CASE}-build) set(RunCMake_TEST_NO_CLEAN 1) - if(RunCMake_GENERATOR MATCHES "Make|Ninja") + if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) endif() file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") diff --git a/Tests/RunCMake/CMP0060/CMP0060-Common.cmake b/Tests/RunCMake/CMP0060/CMP0060-Common.cmake index e0a56e6..06955ee 100644 --- a/Tests/RunCMake/CMP0060/CMP0060-Common.cmake +++ b/Tests/RunCMake/CMP0060/CMP0060-Common.cmake @@ -1,6 +1,7 @@ # Always build in a predictable configuration. For multi-config # generators we depend on RunCMakeTest.cmake to do this for us. -if(NOT CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(NOT _isMultiConfig) set(CMAKE_BUILD_TYPE Debug) endif() diff --git a/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt b/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt index f6cc978..e2c280e 100644 --- a/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt +++ b/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt @@ -12,5 +12,5 @@ will ask the linker to search for these by library name. Call Stack \(most recent call first\): CMP0060-WARN-ON.cmake:[0-9]+ \(include\) - CMakeLists.txt:3 \(include\) + CMakeLists.txt:4 \(include\) This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/CMP0060/CMakeLists.txt b/Tests/RunCMake/CMP0060/CMakeLists.txt index db6b701..291d34d 100644 --- a/Tests/RunCMake/CMP0060/CMakeLists.txt +++ b/Tests/RunCMake/CMP0060/CMakeLists.txt @@ -1,3 +1,4 @@ -cmake_minimum_required(VERSION 3.2) +cmake_minimum_required(VERSION 3.9) +cmake_policy(VERSION 3.2) project(${RunCMake_TEST} C) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index aa075b0..8eb8568 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -1,5 +1,8 @@ # See adjacent README.rst for documentation of this test infrastructure. +# Note that the _isMultiConfig variable is set in the parent directory's +# CMakeLists.txt (slightly complex logic to support CMake versions before 3.9) + macro(add_RunCMake_test test) set(TEST_ARGS ${ARGN}) if ("${ARGV1}" STREQUAL "TEST_DIR") @@ -14,6 +17,7 @@ macro(add_RunCMake_test test) endif() add_test(NAME RunCMake.${test} COMMAND ${CMAKE_CMAKE_COMMAND} -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} + -DRunCMake_GENERATOR_IS_MULTI_CONFIG=${_isMultiConfig} -DRunCMake_GENERATOR=${CMAKE_GENERATOR} -DRunCMake_GENERATOR_INSTANCE=${CMAKE_GENERATOR_INSTANCE} -DRunCMake_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} @@ -47,6 +51,7 @@ function(add_RunCMake_test_group test types) add_test(NAME RunCMake.${test}_${type} COMMAND ${CMAKE_CMAKE_COMMAND} -DTEST_TYPE=${type} -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} + -DRunCMake_GENERATOR_IS_MULTI_CONFIG=${_isMultiConfig} -DRunCMake_GENERATOR=${CMAKE_GENERATOR} -DRunCMake_GENERATOR_INSTANCE=${CMAKE_GENERATOR_INSTANCE} -DRunCMake_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake index 1f76fd0..dcb992d 100644 --- a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake @@ -1,4 +1,5 @@ -if(NOT CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(NOT _isMultiConfig) set(CMAKE_BUILD_TYPE Debug) endif() include(ExternalProject) diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake index 1b619c8..4b4b40e 100644 --- a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake @@ -1,4 +1,5 @@ -if(NOT CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(NOT _isMultiConfig) set(CMAKE_BUILD_TYPE Debug) endif() include(ExternalProject) diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake index 192776b..2fb0705 100644 --- a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake @@ -1,4 +1,5 @@ -if(NOT CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(NOT _isMultiConfig) set(CMAKE_BUILD_TYPE Debug) endif() include(ExternalProject) diff --git a/Tests/RunCMake/ExternalProject/UsesTerminal.cmake b/Tests/RunCMake/ExternalProject/UsesTerminal.cmake index cd87403..d3494fd 100644 --- a/Tests/RunCMake/ExternalProject/UsesTerminal.cmake +++ b/Tests/RunCMake/ExternalProject/UsesTerminal.cmake @@ -1,4 +1,5 @@ -if(NOT CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(NOT _isMultiConfig) set(CMAKE_BUILD_TYPE Debug) endif() include(ExternalProject) diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index 616e210..94aaca8 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -5,7 +5,7 @@ run_cmake(CMP0070-OLD) run_cmake(CMP0070-WARN) run_cmake(CommandConflict) -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio|Xcode") +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) run_cmake(OutputConflict) endif() run_cmake(EmptyCondition1) diff --git a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake index 9423ef5..55625a8 100644 --- a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake @@ -4,7 +4,7 @@ function(run_GEH) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/GEH-build) set(RunCMake_TEST_NO_CLEAN 1) - if(RunCMake_GENERATOR MATCHES "Make|Ninja") + if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) endif() file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake index 38e47f9..a66394b 100644 --- a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake @@ -3,7 +3,8 @@ enable_language(C) add_library(empty SHARED empty.c) -if(CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG) set(GENERATE_CONDITION CONDITION $<CONFIG:${FIRST_CONFIG}>) endif() diff --git a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake index 73014d1..209e769 100644 --- a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake +++ b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake @@ -4,7 +4,7 @@ function(run_GoogleTest) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/GoogleTest-build) set(RunCMake_TEST_NO_CLEAN 1) - if(RunCMake_GENERATOR MATCHES "Make|Ninja") + if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) endif() file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") diff --git a/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake b/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake index a9a7f05..3f238f2 100644 --- a/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake +++ b/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake @@ -5,7 +5,7 @@ function(run_SymlinkImplicit) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SymlinkImplicit-build) set(RunCMake_TEST_NO_CLEAN 1) - if(RunCMake_GENERATOR MATCHES "Make|Ninja") + if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) endif() file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") diff --git a/Tests/RunCMake/get_property/RunCMakeTest.cmake b/Tests/RunCMake/get_property/RunCMakeTest.cmake index 017990f..06a0c67 100644 --- a/Tests/RunCMake/get_property/RunCMakeTest.cmake +++ b/Tests/RunCMake/get_property/RunCMakeTest.cmake @@ -23,6 +23,10 @@ run_cmake(NoSource) run_cmake(NoProperty) run_cmake(NoCache) +# Since we are testing the GENERATOR_IS_MULTI_CONFIG property itself, +# don't rely on RunCMake_GENERATOR_IS_MULTI_CONFIG being set correctly +# and instead explicitly check for a match against those generators we +# expect to be multi-config if(RunCMake_GENERATOR MATCHES "Visual Studio|Xcode") run_cmake(IsMultiConfig) else() diff --git a/Tests/RunCMake/test_include_dirs/RunCMakeTest.cmake b/Tests/RunCMake/test_include_dirs/RunCMakeTest.cmake index d1633e4..72056ae 100644 --- a/Tests/RunCMake/test_include_dirs/RunCMakeTest.cmake +++ b/Tests/RunCMake/test_include_dirs/RunCMakeTest.cmake @@ -4,7 +4,7 @@ function(run_TID) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TID-build) set(RunCMake_TEST_NO_CLEAN 1) - if(RunCMake_GENERATOR MATCHES "Make|Ninja") + if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) endif() file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") |