From 55a0bebdd3d253f81bd89782702d481ac81110b3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 2 Oct 2019 13:59:15 -0400 Subject: VS: Add support for per-config sources Since commit 97cc29c766 (VS: Teach generators how to mark per-config source files, 2017-04-10, v3.9.0-rc1~268^2~2) the VS generators have known how to generate per-config sources. We've now converted most other code paths to support per-config sources, so drop the check that disallows it. This leaves only per-config support for precompiled headers and unity build transformations, but those are optional features that can be addressed later. Fixes: #18233 Issue: #19789 --- Help/release/dev/vs-per-config-sources.rst | 5 +++++ Source/cmGlobalVisualStudioGenerator.cxx | 9 --------- Tests/CMakeLists.txt | 8 ++++++-- Tests/RunCMake/TargetSources/RunCMakeTest.cmake | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 Help/release/dev/vs-per-config-sources.rst diff --git a/Help/release/dev/vs-per-config-sources.rst b/Help/release/dev/vs-per-config-sources.rst new file mode 100644 index 0000000..bf7572b --- /dev/null +++ b/Help/release/dev/vs-per-config-sources.rst @@ -0,0 +1,5 @@ +vs-per-config-sources +--------------------- + +* :ref:`Visual Studio Generators` learned to support per-config sources. + Previously only :ref:`Command-Line Build Tool Generators` supported them. diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 6569e5e..5412407 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -799,15 +799,6 @@ void RegisterVisualStudioMacros(const std::string& macrosFile, bool cmGlobalVisualStudioGenerator::TargetIsFortranOnly( cmGeneratorTarget const* gt) { - // check to see if this is a fortran build - { - // Issue diagnostic if the source files depend on the config. - std::vector sources; - if (!gt->GetConfigCommonSourceFiles(sources)) { - return false; - } - } - // If there's only one source language, Fortran has to be used // in order for the sources to compile. std::set languages = gt->GetAllConfigCompileLanguages(); diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index b29638b..185401f 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -451,8 +451,12 @@ if(BUILD_TESTING) ADD_TEST_MACRO(StagingPrefix StagingPrefix) ADD_TEST_MACRO(ImportedSameName ImportedSameName) ADD_TEST_MACRO(InterfaceLibrary InterfaceLibrary) - if(NOT _isMultiConfig) - set(ConfigSources_BUILD_OPTIONS -DCMAKE_BUILD_TYPE=$) + if(NOT CMAKE_GENERATOR STREQUAL "Xcode") + if(_isMultiConfig) + set(ConfigSources_CTEST_OPTIONS --build-config $) + else() + set(ConfigSources_BUILD_OPTIONS -DCMAKE_BUILD_TYPE=$) + endif() ADD_TEST_MACRO(ConfigSources ConfigSources) endif() ADD_TEST_MACRO(SourcesProperty SourcesProperty) diff --git a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake index bee8c4e..0d462ba 100644 --- a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake +++ b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake @@ -1,6 +1,6 @@ include(RunCMake) -if(RunCMake_GENERATOR MATCHES "Visual Studio|Xcode") +if(RunCMake_GENERATOR STREQUAL "Xcode") run_cmake(ConfigNotAllowed) endif() -- cgit v0.12