Commit c267ea1c authored by Craig Scott's avatar Craig Scott

GENERATOR_IS_MULTI_CONFIG: Use for multi-config checks in Tests

parent 497f4bb9
......@@ -29,11 +29,10 @@ if(RESULT)
message(FATAL_ERROR "Error running cmake --build")
endif()
# check for configuration types
set(CMAKE_CONFIGURATION_TYPES @CMAKE_CONFIGURATION_TYPES@)
# run the executable out of the Debug directory if there
# are configuration types
if(CMAKE_CONFIGURATION_TYPES)
# run the executable out of the Debug directory if using a
# multi-config generator
set(_isMultiConfig @_isMultiConfig@)
if(_isMultiConfig)
set(RUN_TEST "@CMAKE_BUILD_TEST_BINARY_DIR@/Debug/@CMAKE_BUILD_TEST_EXE@")
else()
set(RUN_TEST "@CMAKE_BUILD_TEST_BINARY_DIR@/@CMAKE_BUILD_TEST_EXE@")
......
......@@ -14,7 +14,18 @@ if(CMake_TEST_INSTALL)
set(CMake_TEST_INSTALL_PREFIX ${CMake_BINARY_DIR}/Tests/CMakeInstall)
set(CMAKE_INSTALL_PREFIX "${CMake_TEST_INSTALL_PREFIX}")
if(CMAKE_CONFIGURATION_TYPES)
# 3.9 or later provides a definitive answer to whether we are multi-config
# through a global property. Prior to 3.9, CMAKE_CONFIGURATION_TYPES being set
# is assumed to mean multi-config, but developers might modify it so it is
# technically not as reliable.
if(NOT CMAKE_VERSION VERSION_LESS 3.9)
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
elseif(CMAKE_CONFIGURATION_TYPES)
set(_isMultiConfig True)
else()
set(_isMultiConfig False)
endif()
if(_isMultiConfig)
# There are multiple configurations. Make sure the tested
# configuration is the one that is installed.
set(CMake_TEST_INSTALL_CONFIG --config $<CONFIGURATION>)
......
......@@ -38,9 +38,21 @@ set(ENV{HOME} \"${TEST_HOME}\")
")
endif()
# 3.9 or later provides a definitive answer to whether we are multi-config
# through a global property. Prior to 3.9, CMAKE_CONFIGURATION_TYPES being set
# is assumed to mean multi-config, but developers might modify it so it is
# technically not as reliable.
if(NOT CMAKE_VERSION VERSION_LESS 3.9)
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
elseif(CMAKE_CONFIGURATION_TYPES)
set(_isMultiConfig True)
else()
set(_isMultiConfig False)
endif()
# Choose a default configuration for CTest tests.
set(CTestTest_CONFIG Debug)
if(NOT CMAKE_CONFIGURATION_TYPES AND CMAKE_BUILD_TYPE)
if(NOT _isMultiConfig AND CMAKE_BUILD_TYPE)
set(CTestTest_CONFIG ${CMAKE_BUILD_TYPE})
endif()
......@@ -3190,7 +3202,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE _result
)
if(_result EQUAL 0)
if(CMAKE_CONFIGURATION_TYPES)
if(_isMultiConfig)
set (JAVAH_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaJavah/$<CONFIGURATION>)
else()
set (JAVAH_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaJavah)
......
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.9)
project(SelectLibraryConfigurations NONE)
......@@ -15,7 +15,8 @@ macro(check_slc basename expect)
endif ()
endmacro(check_slc)
if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if (NOT _isMultiConfig AND NOT CMAKE_BUILD_TYPE)
set(NOTYPE_RELONLY_LIBRARY_RELEASE "opt")
check_slc(NOTYPE_RELONLY "opt")
......
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.9)
project(CTestConfig)
include(CTest)
......@@ -8,32 +8,41 @@ include(CTest)
# 'ctest -S script.cmake' call.
#
# In either case, we expect CMAKE_BUILD_TYPE to be defined for single-configuration
# build trees and not defined for multi-configuration build trees.
# build trees and not defined for multi-configuration build trees. The value of
# CMAKE_CONFIGURATION_TYPES should not be relied upon to determine whether we
# are using a multi-config generator or not, the GENERATOR_IS_MULTI_CONFIG
# global property is the canonical way to do that as of CMake 3.9.
#
if(CMAKE_CONFIGURATION_TYPES)
# multi-configuration: expect not defined, error if defined
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(_isMultiConfig)
if(NOT DEFINED CMAKE_CONFIGURATION_TYPES OR CMAKE_CONFIGURATION_TYPES STREQUAL "")
message(FATAL_ERROR "CMAKE_CONFIGURATION_TYPES is not defined or is empty "
"(but must be defined and non-empty for a multi-configuration generator)")
endif()
if(DEFINED CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE STREQUAL "")
message(FATAL_ERROR "CMAKE_CONFIGURATION_TYPES='${CMAKE_CONFIGURATION_TYPES}' CMAKE_BUILD_TYPE='${CMAKE_BUILD_TYPE}' is defined and non-empty (but should not be for a multi-configuration generator)")
message(FATAL_ERROR "CMAKE_BUILD_TYPE='${CMAKE_BUILD_TYPE}' is defined and non-empty "
"(but should not be for a multi-configuration generator)")
endif()
set(_configs ${CMAKE_CONFIGURATION_TYPES})
else()
# single-configuration: expect defined, error if not defined
# Populating CMAKE_CONFIGURATION_TYPES even for single config generators is
# common enough for user projects that we don't want to consider it an error.
# We just need CMAKE_BUILD_TYPE to be set and ignore CMAKE_CONFIGURATION_TYPES.
if(NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "")
message(FATAL_ERROR "CMAKE_BUILD_TYPE is not defined or is empty (but should be defined and non-empty for a single-configuration generator)")
message(FATAL_ERROR "CMAKE_BUILD_TYPE is not defined or is empty "
"(but should be defined and non-empty for a single-configuration generator)")
endif()
endif()
if(DEFINED CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE STREQUAL "")
add_definitions(-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}")
set(_configs ${CMAKE_BUILD_TYPE})
endif()
add_executable(ctc CTestConfig.cxx)
foreach(cfg ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE})
foreach(cfg ${_configs})
add_test(NAME ctc-${cfg} CONFIGURATIONS ${cfg} COMMAND ctc --config $<CONFIGURATION>)
if(CMAKE_CONFIGURATION_TYPES)
if(_isMultiConfig)
set_property(TEST ctc-${cfg}
PROPERTY PASS_REGULAR_EXPRESSION "CMAKE_INTDIR is ${cfg}")
set_property(TEST ctc-${cfg}
......
set(CMAKE_CONFIGURATION_TYPES "@CMAKE_CONFIGURATION_TYPES@")
set(_isMultiConfig "@_isMultiConfig@")
set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestConfig")
set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestConfig/@cfg@-dashboard")
......@@ -11,7 +11,7 @@ message("CMAKE_COMMAND='${CMAKE_COMMAND}'")
message("CMAKE_CTEST_COMMAND='${CMAKE_CTEST_COMMAND}'")
set(arg "")
if(NOT CMAKE_CONFIGURATION_TYPES)
if(NOT _isMultiConfig)
set(arg "-DCMAKE_BUILD_TYPE:STRING=@cfg@")
endif()
......
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.9)
cmake_policy(SET CMP0058 OLD)
project(CustomCommandByproducts C)
# Generate a byproduct in a rule that runs in the target consuming it.
......@@ -81,7 +82,8 @@ add_custom_command(OUTPUT timestamp8.txt
# Generate the library file of an imported target as a byproduct
# of an external project.
if(CMAKE_CONFIGURATION_TYPES)
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(_isMultiConfig)
set(cfg /${CMAKE_CFG_INTDIR})
else()
set(cfg)
......@@ -105,7 +107,7 @@ add_dependencies(ExternalLibrary ExternalTarget)
# Generate the library file of an imported target as a byproduct
# of an external project. The byproduct uses <BINARY_DIR> that is substituted
# by the real binary path
if(CMAKE_CONFIGURATION_TYPES)
if(_isMultiConfig)
set(cfg /${CMAKE_CFG_INTDIR})
else()
set(cfg)
......
cmake_minimum_required (VERSION 2.7.20090711)
cmake_minimum_required (VERSION 3.9)
project(ExportImport C CXX)
if(NOT DEFINED CMake_TEST_NESTED_MAKE_PROGRAM AND NOT CMAKE_GENERATOR MATCHES "Visual Studio")
set(CMake_TEST_NESTED_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}")
......@@ -15,7 +15,8 @@ set_property(
PROPERTY SYMBOLIC 1
)
if(CMAKE_CONFIGURATION_TYPES)
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(_isMultiConfig)
set(NESTED_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}")
else()
if(CMAKE_BUILD_TYPE)
......
cmake_minimum_required (VERSION 3.1)
cmake_minimum_required (VERSION 3.9)
project(FortranModules Fortran)
if(NOT DEFINED CMake_TEST_NESTED_MAKE_PROGRAM AND NOT CMAKE_GENERATOR MATCHES "Visual Studio")
......@@ -56,7 +56,8 @@ add_executable(test_non_pp_include test_non_pp_include_main.f90)
# Build the external project separately using a custom target.
# Make sure it uses the same build configuration as this test.
if(CMAKE_CONFIGURATION_TYPES)
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(_isMultiConfig)
set(External_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}")
set(External_BUILD_TYPE)
else()
......
cmake_minimum_required (VERSION 3.5)
cmake_minimum_required (VERSION 3.9)
project(JavaExportImport)
if(NOT DEFINED CMake_TEST_NESTED_MAKE_PROGRAM AND NOT CMAKE_GENERATOR MATCHES "Visual Studio")
set(CMake_TEST_NESTED_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}")
......@@ -17,7 +17,8 @@ set_property(
PROPERTY SYMBOLIC 1
)
if(CMAKE_CONFIGURATION_TYPES)
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(_isMultiConfig)
set(NESTED_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}")
else()
if(CMAKE_BUILD_TYPE)
......
cmake_minimum_required (VERSION 2.8)
cmake_minimum_required (VERSION 3.9)
project(MacRuntimePath)
if(NOT DEFINED CMake_TEST_NESTED_MAKE_PROGRAM AND NOT CMAKE_GENERATOR MATCHES "Visual Studio")
set(CMake_TEST_NESTED_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}")
......@@ -18,7 +18,8 @@ set_property(
configure_file(${MacRuntimePath_SOURCE_DIR}/InitialCache.cmake.in
${MacRuntimePath_BINARY_DIR}/InitialCache.cmake @ONLY)
if(CMAKE_CONFIGURATION_TYPES)
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(_isMultiConfig)
set(NESTED_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}")
else()
if(CMAKE_BUILD_TYPE)
......
cmake_minimum_required (VERSION 2.8.12)
cmake_minimum_required (VERSION 3.9)
project(TestMissingInstall)
set(CMAKE_SKIP_INSTALL_RULES ON)
......@@ -8,11 +8,7 @@ set(CMAKE_SKIP_INSTALL_RULES ON)
set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1)
set(CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY 1)
if(CMAKE_CONFIGURATION_TYPES)
set(MULTI_CONFIG ON)
else()
set(MULTI_CONFIG OFF)
endif()
get_property(MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
add_executable(mybin mybin.cpp)
install(TARGETS mybin RUNTIME DESTINATION bin)
......
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.9)
project(OutDir C)
if(CMAKE_CONFIGURATION_TYPES)
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(_isMultiConfig)
foreach(config ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER "${config}" CONFIG)
list(APPEND configs "${CONFIG}")
......
cmake_minimum_required (VERSION 2.6)
cmake_minimum_required (VERSION 3.9)
project(PrecompiledHeader C)
# Make sure the proper compiler is in use.
......@@ -7,7 +7,8 @@ if(NOT MSVC AND NOT CMAKE_C_COMPILER_ID STREQUAL "Intel")
endif()
# Compute a custom name for the precompiled header.
if(CMAKE_CONFIGURATION_TYPES)
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(_isMultiConfig)
set(PCH_DIR "${CMAKE_CURRENT_BINARY_DIR}/PCH/${CMAKE_CFG_INTDIR}")
foreach(cfg ${CMAKE_CONFIGURATION_TYPES})
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/PCH/${cfg})
......
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.9)
project(Qt4Deploy)
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/install)
......@@ -10,7 +10,8 @@ add_executable(testdeploy MACOSX_BUNDLE testdeploy.cpp)
target_link_libraries(testdeploy ${QT_LIBRARIES})
set_target_properties(testdeploy PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}")
if(CMAKE_CONFIGURATION_TYPES AND QT_QTCORE_LIBRARY_RELEASE AND QT_QTCORE_LIBRARY_DEBUG)
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(_isMultiConfig AND QT_QTCORE_LIBRARY_RELEASE AND QT_QTCORE_LIBRARY_DEBUG)
# note: installing debug Qt libraries from a Qt installation configured with
# -debug-and-release not yet supported (very low priority).
install(CODE "
......@@ -58,7 +59,7 @@ if(QT_QSQLITE_PLUGIN_DEBUG OR QT_QSQLITE_PLUGIN_RELEASE)
endif()
# custom target to install and test the installation at build time
if(CMAKE_CONFIGURATION_TYPES)
if(_isMultiConfig)
set(install_config "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_CFG_INTDIR}")
endif()
......
......@@ -36,7 +36,8 @@ add_custom_command(
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/myotherinterface.h.in"
)
if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_GENERATOR STREQUAL Ninja)
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(NOT _isMultiConfig AND NOT CMAKE_GENERATOR STREQUAL Ninja)
set(debug_srcs "$<$<CONFIG:Debug>:debug_class.cpp>" $<$<CONFIG:Debug>:debug_resource.qrc>)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:TEST_DEBUG_CLASS>)
endif()
......
# Autogen build options
set(Autogen_BUILD_OPTIONS "-DQT_TEST_VERSION=${QT_TEST_VERSION}")
if(NOT CMAKE_CONFIGURATION_TYPES)
if(NOT _isMultiConfig) # Set in Tests/CMakeLists.txt
list(APPEND Autogen_BUILD_OPTIONS "-DCMAKE_BUILD_TYPE=$<CONFIGURATION>")
endif()
list(APPEND Autogen_BUILD_OPTIONS
......
......@@ -35,8 +35,8 @@ set_property(TARGET KI18n APPEND PROPERTY
# END upstream
get_property(_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(_GENERATOR_IS_MULTI_CONFIG)
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(_isMultiConfig)
set(INC_DIR "include_$<CONFIG>" )
else()
set(INC_DIR "include" )
......
......@@ -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
......
......@@ -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}")
......
# 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()
......
......@@ -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.$
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)
# 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}
......
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)
......
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)
......
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)
......
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)
......
......@@ -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)
......
......@@ -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}")
......
......@@ -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()
......
......@@ -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}")
......
......@@ -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}")
......
......@@ -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()
......
......@@ -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}")
......
cmake_minimum_required (VERSION 2.6)
cmake_minimum_required (VERSION 3.9)
project (TestSimpleInstall)
set(CMAKE_VERBOSE_MAKEFILE 1)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
......@@ -307,7 +307,8 @@ else()
INSTALL_NAME_DIR @executable_path/../lib)
endif()
if(CMAKE_CONFIGURATION_TYPES)
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(_isMultiConfig)
set(SI_CONFIG --config $<CONFIGURATION>)
else()
set(SI_CONFIG)
......
cmake_minimum_required (VERSION 2.6)
cmake_minimum_required (VERSION 3.9)
project (TestSimpleInstall)
set(CMAKE_VERBOSE_MAKEFILE 1)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
......@@ -307,7 +307,8 @@ else()
INSTALL_NAME_DIR @executable_path/../lib)
endif()
if(CMAKE_CONFIGURATION_TYPES)
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(_isMultiConfig)
set(SI_CONFIG --config $<CONFIGURATION>)
else()
set(SI_CONFIG)
......
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.9)
project(StagingPrefix)
# Wipe out the install tree
......@@ -17,7 +17,8 @@ set_property(
PROPERTY SYMBOLIC 1
)
if(CMAKE_CONFIGURATION_TYPES)
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(_isMultiConfig)
set(NESTED_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}")
else()
if(CMAKE_BUILD_TYPE)
......
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.9)
project(VSGNUFortran)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
......@@ -9,7 +9,8 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
# because gmake build of fortran will not be in a config
# directory, and for easier testing we want the exe and .dll
# to be in the same directory.
if(CMAKE_CONFIGURATION_TYPES)
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(_isMultiConfig)
foreach(config ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER "${config}" config)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${config}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment