From de9a2f1ef6795d83a42c9b93baa7f7a0062744aa Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 14 Sep 2020 11:40:03 -0400 Subject: Help: Move CMAKE_XCODE_GENERATE_SCHEME to proper manual section --- Help/manual/cmake-variables.7.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index d50005c..b5bc7b1 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -125,7 +125,6 @@ Variables that Provide Information /variable/CMAKE_VS_PLATFORM_TOOLSET_VERSION /variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION /variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM - /variable/CMAKE_XCODE_GENERATE_SCHEME /variable/CMAKE_XCODE_PLATFORM_TOOLSET /variable/PROJECT-NAME_BINARY_DIR /variable/PROJECT-NAME_DESCRIPTION @@ -246,6 +245,7 @@ Variables that Change Behavior /variable/CMAKE_USER_MAKE_RULES_OVERRIDE /variable/CMAKE_WARN_DEPRECATED /variable/CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION + /variable/CMAKE_XCODE_GENERATE_SCHEME /variable/CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY /variable/CMAKE_XCODE_LINK_BUILD_PHASE_MODE /variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER -- cgit v0.12 From 52a1ba62dffc1e929b8cf1e519e353b2c1846882 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 14 Sep 2020 14:42:16 -0400 Subject: Tests: Simplify RunCMake.ExternalProject Add_StepDependencies stderr Set CMP0114 to OLD for this case to suppress the policy warning. The warning is covered by the `NO_DEPENDS-CMP0114-WARN` case. --- .../RunCMake/ExternalProject/Add_StepDependencies-stderr.txt | 12 ------------ Tests/RunCMake/ExternalProject/Add_StepDependencies.cmake | 1 + .../Add_StepDependencies_no_target-stderr.txt | 12 ------------ .../ExternalProject/Add_StepDependencies_no_target.cmake | 1 + 4 files changed, 2 insertions(+), 24 deletions(-) delete mode 100644 Tests/RunCMake/ExternalProject/Add_StepDependencies-stderr.txt delete mode 100644 Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target-stderr.txt diff --git a/Tests/RunCMake/ExternalProject/Add_StepDependencies-stderr.txt b/Tests/RunCMake/ExternalProject/Add_StepDependencies-stderr.txt deleted file mode 100644 index d0ff15f..0000000 --- a/Tests/RunCMake/ExternalProject/Add_StepDependencies-stderr.txt +++ /dev/null @@ -1,12 +0,0 @@ -^CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+ \(message\): - Policy CMP0114 is not set: ExternalProject step targets fully adopt their - steps. Run "cmake --help-policy CMP0114" for policy details. Use the - cmake_policy command to set the policy and suppress this warning. - - ExternalProject target 'FOO' would depend on the targets for step\(s\) - 'do_something' under policy CMP0114, but this is being left out for - compatibility since the policy is not set. -Call Stack \(most recent call first\): - Add_StepDependencies.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) - CMakeLists.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/ExternalProject/Add_StepDependencies.cmake b/Tests/RunCMake/ExternalProject/Add_StepDependencies.cmake index 38683f1..4e43ab3 100644 --- a/Tests/RunCMake/ExternalProject/Add_StepDependencies.cmake +++ b/Tests/RunCMake/ExternalProject/Add_StepDependencies.cmake @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION ${CMAKE_VERSION}) +cmake_policy(SET CMP0114 OLD) # Test deprecated behavior. include(ExternalProject) diff --git a/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target-stderr.txt b/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target-stderr.txt deleted file mode 100644 index 2ae2b53..0000000 --- a/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target-stderr.txt +++ /dev/null @@ -1,12 +0,0 @@ -^CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+ \(message\): - Policy CMP0114 is not set: ExternalProject step targets fully adopt their - steps. Run "cmake --help-policy CMP0114" for policy details. Use the - cmake_policy command to set the policy and suppress this warning. - - ExternalProject target 'FOO' would depend on the targets for step\(s\) - 'do_something' under policy CMP0114, but this is being left out for - compatibility since the policy is not set. -Call Stack \(most recent call first\): - Add_StepDependencies_no_target.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) - CMakeLists.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target.cmake b/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target.cmake index 264c3f0..7c75007 100644 --- a/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target.cmake +++ b/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target.cmake @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION ${CMAKE_VERSION}) +cmake_policy(SET CMP0114 OLD) # Test deprecated behavior. include(ExternalProject) -- cgit v0.12 From 0fa9392583f2e1dbe5badd9279e5c5b907221b76 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 15 Sep 2020 13:23:45 -0400 Subject: Tests: Remove RunCMake.ExternalProject unnecessary CMake version check --- Tests/RunCMake/ExternalProject/MultiCommand.cmake | 2 -- 1 file changed, 2 deletions(-) diff --git a/Tests/RunCMake/ExternalProject/MultiCommand.cmake b/Tests/RunCMake/ExternalProject/MultiCommand.cmake index c8d0457..dbf67eb 100644 --- a/Tests/RunCMake/ExternalProject/MultiCommand.cmake +++ b/Tests/RunCMake/ExternalProject/MultiCommand.cmake @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 3.9) - include(ExternalProject) # Verify COMMAND keyword is recognised after various *_COMMAND options -- cgit v0.12 From 5a15fcf5970f1ba8b5fe86494ffbf0128ba08e96 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 18 Sep 2020 12:49:09 -0400 Subject: Tests: Avoid duplicate custom commands in QtAutogen.AutogenOriginDependsOff --- Tests/QtAutogen/AutogenOriginDependsOff/CMakeLists.txt | 13 +++++++++---- Tests/QtAutogen/AutogenOriginDependsOff/a_qt.hpp | 2 +- Tests/QtAutogen/AutogenOriginDependsOff/b_qt.hpp | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Tests/QtAutogen/AutogenOriginDependsOff/CMakeLists.txt b/Tests/QtAutogen/AutogenOriginDependsOff/CMakeLists.txt index 9e6fe8b..d9fc2b0 100644 --- a/Tests/QtAutogen/AutogenOriginDependsOff/CMakeLists.txt +++ b/Tests/QtAutogen/AutogenOriginDependsOff/CMakeLists.txt @@ -9,8 +9,8 @@ include_directories(${CBD}) # A GENERATED file ensures there will be an _autogen target in VS add_custom_command ( - OUTPUT "${CBD}/config.hpp" - COMMAND ${CMAKE_COMMAND} -E copy "${CSD}/config.hpp.in" "${CBD}/config.hpp" + OUTPUT "${CBD}/config_a.hpp" + COMMAND ${CMAKE_COMMAND} -E copy "${CSD}/config.hpp.in" "${CBD}/config_a.hpp" ) @@ -30,13 +30,18 @@ add_dependencies ( a_mc a_qt_autogen ) # - depends on a GENERATED file # - AUTOMOC enabled # - depends on a target (a_mc) that depends on a_qt_qutogen -add_library ( a_qt a_qt.cpp "${CBD}/config.hpp" ) +add_library ( a_qt a_qt.cpp "${CBD}/config_a.hpp" ) add_dependencies ( a_qt a_mc ) target_link_libraries ( a_qt ${QT_QTCORE_TARGET}) set_target_properties ( a_qt PROPERTIES AUTOMOC TRUE) # Disable AUTOGEN_ORIGIN_DEPENDS to avoid loop dependencies set_target_properties ( a_qt PROPERTIES AUTOGEN_ORIGIN_DEPENDS OFF) +# A GENERATED file ensures there will be an _autogen target in VS +add_custom_command ( + OUTPUT "${CBD}/config_b.hpp" + COMMAND ${CMAKE_COMMAND} -E copy "${CSD}/config.hpp.in" "${CBD}/config_b.hpp" + ) # Library "b_mc" provides a header that holds a string function that returns # the content of mocs_compilation.cpp from b_qt. @@ -57,7 +62,7 @@ add_library ( b_mc ${CSD}/b_mc.hpp ${CBD}/b_mc.cpp ) # - depends on a GENERATED file # - AUTOMOC enabled # - depends on a library (b_mc) that depends on b_qt_qutogen -add_library ( b_qt b_qt.cpp "${CBD}/config.hpp" ) +add_library ( b_qt b_qt.cpp "${CBD}/config_b.hpp" ) target_link_libraries ( b_qt b_mc ) target_link_libraries ( b_qt ${QT_QTCORE_TARGET}) set_target_properties ( b_qt PROPERTIES AUTOMOC TRUE) diff --git a/Tests/QtAutogen/AutogenOriginDependsOff/a_qt.hpp b/Tests/QtAutogen/AutogenOriginDependsOff/a_qt.hpp index fafc8a2..313b58b 100644 --- a/Tests/QtAutogen/AutogenOriginDependsOff/a_qt.hpp +++ b/Tests/QtAutogen/AutogenOriginDependsOff/a_qt.hpp @@ -3,7 +3,7 @@ #include -#include +#include #include diff --git a/Tests/QtAutogen/AutogenOriginDependsOff/b_qt.hpp b/Tests/QtAutogen/AutogenOriginDependsOff/b_qt.hpp index b798e71..2e5775e 100644 --- a/Tests/QtAutogen/AutogenOriginDependsOff/b_qt.hpp +++ b/Tests/QtAutogen/AutogenOriginDependsOff/b_qt.hpp @@ -3,7 +3,7 @@ #include -#include +#include #include -- cgit v0.12 From 0d037179964c0786b6a8da181854de524ac2158d Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 14 Sep 2020 14:47:42 -0400 Subject: Xcode: Clarify name of legacy run script build phase helper --- Source/cmGlobalXCodeGenerator.cxx | 10 +++++----- Source/cmGlobalXCodeGenerator.h | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 2f27128..ae83573 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1545,7 +1545,7 @@ bool cmGlobalXCodeGenerator::IsHeaderFile(cmSourceFile* sf) sf->GetExtension()); } -cmXCodeObject* cmGlobalXCodeGenerator::CreateBuildPhase( +cmXCodeObject* cmGlobalXCodeGenerator::CreateLegacyRunScriptBuildPhase( const char* name, const char* name2, cmGeneratorTarget* target, const std::vector& commands) { @@ -1609,16 +1609,16 @@ void cmGlobalXCodeGenerator::CreateCustomCommands( } } // create prebuild phase - cmXCodeObject* cmakeRulesBuildPhase = this->CreateBuildPhase( + cmXCodeObject* cmakeRulesBuildPhase = this->CreateLegacyRunScriptBuildPhase( "CMake Rules", "cmakeRulesBuildPhase", gtgt, commands); // create prebuild phase - cmXCodeObject* preBuildPhase = this->CreateBuildPhase( + cmXCodeObject* preBuildPhase = this->CreateLegacyRunScriptBuildPhase( "CMake PreBuild Rules", "preBuildCommands", gtgt, prebuild); // create prelink phase - cmXCodeObject* preLinkPhase = this->CreateBuildPhase( + cmXCodeObject* preLinkPhase = this->CreateLegacyRunScriptBuildPhase( "CMake PreLink Rules", "preLinkCommands", gtgt, prelink); // create postbuild phase - cmXCodeObject* postBuildPhase = this->CreateBuildPhase( + cmXCodeObject* postBuildPhase = this->CreateLegacyRunScriptBuildPhase( "CMake PostBuild Rules", "postBuildPhase", gtgt, postbuild); // The order here is the order they will be built in. diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index c7524e8..4e68682 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -221,9 +221,9 @@ private: void SetGenerationRoot(cmLocalGenerator* root); void AddExtraTargets(cmLocalGenerator* root, std::vector& gens); - cmXCodeObject* CreateBuildPhase(const char* name, const char* name2, - cmGeneratorTarget* target, - const std::vector&); + cmXCodeObject* CreateLegacyRunScriptBuildPhase( + const char* name, const char* name2, cmGeneratorTarget* target, + const std::vector&); void CreateReRunCMakeFile(cmLocalGenerator* root, std::vector const& gens); -- cgit v0.12 From 3ab18c870dc00499f33a40a193e95cc4e1df54ba Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 14 Sep 2020 14:50:14 -0400 Subject: Xcode: Factor out build phase variable declarations --- Source/cmGlobalXCodeGenerator.cxx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index ae83573..be4f9ad 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1596,6 +1596,11 @@ void cmGlobalXCodeGenerator::CreateCustomCommands( postbuild.push_back(std::move(command)); } + cmXCodeObject* legacyCustomCommandsBuildPhase = nullptr; + cmXCodeObject* preBuildPhase = nullptr; + cmXCodeObject* preLinkPhase = nullptr; + cmXCodeObject* postBuildPhase = nullptr; + std::vector classes; if (!gtgt->GetConfigCommonSourceFiles(classes)) { return; @@ -1608,17 +1613,17 @@ void cmGlobalXCodeGenerator::CreateCustomCommands( commands.push_back(*sourceFile->GetCustomCommand()); } } - // create prebuild phase - cmXCodeObject* cmakeRulesBuildPhase = this->CreateLegacyRunScriptBuildPhase( + // create custom commands phase + legacyCustomCommandsBuildPhase = this->CreateLegacyRunScriptBuildPhase( "CMake Rules", "cmakeRulesBuildPhase", gtgt, commands); // create prebuild phase - cmXCodeObject* preBuildPhase = this->CreateLegacyRunScriptBuildPhase( + preBuildPhase = this->CreateLegacyRunScriptBuildPhase( "CMake PreBuild Rules", "preBuildCommands", gtgt, prebuild); // create prelink phase - cmXCodeObject* preLinkPhase = this->CreateLegacyRunScriptBuildPhase( + preLinkPhase = this->CreateLegacyRunScriptBuildPhase( "CMake PreLink Rules", "preLinkCommands", gtgt, prelink); // create postbuild phase - cmXCodeObject* postBuildPhase = this->CreateLegacyRunScriptBuildPhase( + postBuildPhase = this->CreateLegacyRunScriptBuildPhase( "CMake PostBuild Rules", "postBuildPhase", gtgt, postbuild); // The order here is the order they will be built in. @@ -1628,8 +1633,8 @@ void cmGlobalXCodeGenerator::CreateCustomCommands( if (preBuildPhase) { buildPhases->AddObject(preBuildPhase); } - if (cmakeRulesBuildPhase) { - buildPhases->AddObject(cmakeRulesBuildPhase); + if (legacyCustomCommandsBuildPhase) { + buildPhases->AddObject(legacyCustomCommandsBuildPhase); } if (headerBuildPhase) { buildPhases->AddObject(headerBuildPhase); -- cgit v0.12 From 2db623f554d5522350214a7c5bacd5ec2dec1b34 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 14 Sep 2020 11:52:31 -0400 Subject: Xcode: Add option to specify build system variant Extend the `-T ` option to support a `buildsystem=` field with the Xcode generator. Add a `CMAKE_XCODE_BUILD_SYSTEM` variable to inform project code about the selected build system variant. --- Help/generator/Xcode.rst | 23 ++++- Help/manual/cmake-variables.7.rst | 1 + Help/variable/CMAKE_XCODE_BUILD_SYSTEM.rst | 17 +++ Source/cmGlobalXCodeGenerator.cxx | 115 ++++++++++++++++++--- Source/cmGlobalXCodeGenerator.h | 11 ++ Tests/RunCMake/CMakeLists.txt | 3 + .../BadToolsetHostArchXcode-stderr.txt | 6 +- .../BadToolsetXcodeBuildSystem-result.txt | 1 + .../BadToolsetXcodeBuildSystem-stderr.txt | 10 ++ .../BadToolsetXcodeBuildSystem.cmake | 1 + Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake | 4 + .../TestToolsetXcodeBuildSystemDefault1-result.txt | 1 + .../TestToolsetXcodeBuildSystemDefault1-stderr.txt | 4 + .../TestToolsetXcodeBuildSystemDefault1-stdout.txt | 1 + .../TestToolsetXcodeBuildSystemDefault1.cmake | 8 ++ 15 files changed, 187 insertions(+), 19 deletions(-) create mode 100644 Help/variable/CMAKE_XCODE_BUILD_SYSTEM.rst create mode 100644 Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-result.txt create mode 100644 Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-stderr.txt create mode 100644 Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem.cmake create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-result.txt create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-stderr.txt create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-stdout.txt create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1.cmake diff --git a/Help/generator/Xcode.rst b/Help/generator/Xcode.rst index d893ac5..c0745dc 100644 --- a/Help/generator/Xcode.rst +++ b/Help/generator/Xcode.rst @@ -5,9 +5,28 @@ Generate Xcode project files. This supports Xcode 5.0 and above. -Toolset Selection -^^^^^^^^^^^^^^^^^ +.. _`Xcode Build System Selection`: + +Toolset and Build System Selection +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ By default Xcode is allowed to select its own default toolchain. The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps via the :manual:`cmake(1)` ``-T`` option, to specify another toolset. + +This generator supports toolset specification using one of these forms: + +* ``toolset`` +* ``toolset[,key=value]*`` +* ``key=value[,key=value]*`` + +The ``toolset`` specifies the toolset name. The selected toolset name +is provided in the :variable:`CMAKE_XCODE_PLATFORM_TOOLSET` variable. + +The ``key=value`` pairs form a comma-separated list of options to +specify generator-specific details of the toolset selection. +Supported pairs are: + +``buildsystem=`` + Specify the buildsystem variant to use. + See the :variable:`CMAKE_XCODE_BUILD_SYSTEM` variable for allowed values. diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index b5bc7b1..17d0882 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -125,6 +125,7 @@ Variables that Provide Information /variable/CMAKE_VS_PLATFORM_TOOLSET_VERSION /variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION /variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM + /variable/CMAKE_XCODE_BUILD_SYSTEM /variable/CMAKE_XCODE_PLATFORM_TOOLSET /variable/PROJECT-NAME_BINARY_DIR /variable/PROJECT-NAME_DESCRIPTION diff --git a/Help/variable/CMAKE_XCODE_BUILD_SYSTEM.rst b/Help/variable/CMAKE_XCODE_BUILD_SYSTEM.rst new file mode 100644 index 0000000..8696bbf --- /dev/null +++ b/Help/variable/CMAKE_XCODE_BUILD_SYSTEM.rst @@ -0,0 +1,17 @@ +CMAKE_XCODE_BUILD_SYSTEM +------------------------ + +Xcode build system selection. + +The :generator:`Xcode` generator defines this variable to indicate which +variant of the Xcode build system will be used. The value is the +version of Xcode in which the corresponding build system first became +mature enough for use by CMake. The possible values are: + +``1`` + The original Xcode build system. + This is the default. + +The ``CMAKE_XCODE_BUILD_SYSTEM`` variable is informational and should not +be modified by project code. See the :ref:`Xcode Build System Selection` +documentation section to select the Xcode build system. diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index be4f9ad..cceaea0 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -280,32 +281,122 @@ bool cmGlobalXCodeGenerator::SetSystemName(std::string const& s, return this->cmGlobalGenerator::SetSystemName(s, mf); } +namespace { +cm::string_view cmXcodeBuildSystemString(cmGlobalXCodeGenerator::BuildSystem b) +{ + switch (b) { + case cmGlobalXCodeGenerator::BuildSystem::One: + return "1"_s; + } + return {}; +} +} + bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts, bool build, cmMakefile* mf) { - if (ts.find_first_of(",=") != std::string::npos) { - std::ostringstream e; - /* clang-format off */ - e << - "Generator\n" - " " << this->GetName() << "\n" - "does not recognize the toolset\n" - " " << ts << "\n" - "that was specified."; - /* clang-format on */ - mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + if (!this->ParseGeneratorToolset(ts, mf)) { return false; } - this->GeneratorToolset = ts; if (build) { return true; } if (!this->GeneratorToolset.empty()) { mf->AddDefinition("CMAKE_XCODE_PLATFORM_TOOLSET", this->GeneratorToolset); } + mf->AddDefinition("CMAKE_XCODE_BUILD_SYSTEM", + cmXcodeBuildSystemString(this->XcodeBuildSystem)); return true; } +bool cmGlobalXCodeGenerator::ParseGeneratorToolset(std::string const& ts, + cmMakefile* mf) +{ + std::vector const fields = cmTokenize(ts, ","); + auto fi = fields.cbegin(); + if (fi == fields.cend()) { + return true; + } + + // The first field may be the Xcode GCC_VERSION. + if (fi->find('=') == fi->npos) { + this->GeneratorToolset = *fi; + ++fi; + } + + std::unordered_set handled; + + // The rest of the fields must be key=value pairs. + for (; fi != fields.cend(); ++fi) { + std::string::size_type pos = fi->find('='); + if (pos == fi->npos) { + /* clang-format off */ + std::string const& e = cmStrCat( + "Generator\n" + " ", this->GetName(), "\n" + "given toolset specification\n" + " ", ts, "\n" + "that contains a field after the first ',' with no '='." + ); + /* clang-format on */ + mf->IssueMessage(MessageType::FATAL_ERROR, e); + return false; + } + std::string const key = fi->substr(0, pos); + std::string const value = fi->substr(pos + 1); + if (!handled.insert(key).second) { + /* clang-format off */ + std::string const& e = cmStrCat( + "Generator\n" + " ", this->GetName(), "\n" + "given toolset specification\n" + " ", ts, "\n" + "that contains duplicate field key '", key, "'." + ); + /* clang-format on */ + mf->IssueMessage(MessageType::FATAL_ERROR, e); + return false; + } + if (!this->ProcessGeneratorToolsetField(key, value, mf)) { + return false; + } + } + + return true; +} + +bool cmGlobalXCodeGenerator::ProcessGeneratorToolsetField( + std::string const& key, std::string const& value, cmMakefile* mf) +{ + if (key == "buildsystem") { + if (value == "1"_s) { + this->XcodeBuildSystem = BuildSystem::One; + } else { + /* clang-format off */ + std::string const& e = cmStrCat( + "Generator\n" + " ", this->GetName(), "\n" + "toolset specification field\n" + " buildsystem=", value, "\n" + "value is unkonwn. It must be '1'." + ); + /* clang-format on */ + mf->IssueMessage(MessageType::FATAL_ERROR, e); + return false; + } + return true; + } + /* clang-format off */ + std::string const& e = cmStrCat( + "Generator\n" + " ", this->GetName(), "\n" + "given toolset specification that contains invalid field '", key, "'." + ); + /* clang-format on */ + mf->IssueMessage(MessageType::FATAL_ERROR, e); + return false; +} + void cmGlobalXCodeGenerator::EnableLanguage( std::vector const& lang, cmMakefile* mf, bool optional) { diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 4e68682..bbf3ee9 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -113,11 +113,20 @@ public: cmMakefile* mf) override; void AppendFlag(std::string& flags, std::string const& flag) const; + enum class BuildSystem + { + One = 1, + }; + protected: void AddExtraIDETargets() override; void Generate() override; private: + bool ParseGeneratorToolset(std::string const& ts, cmMakefile* mf); + bool ProcessGeneratorToolsetField(std::string const& key, + std::string const& value, cmMakefile* mf); + cmXCodeObject* CreateOrGetPBXGroup(cmGeneratorTarget* gtgt, cmSourceGroup* sg); cmXCodeObject* CreatePBXGroup(cmXCodeObject* parent, @@ -254,6 +263,8 @@ protected: std::vector> XCodeObjects; cmXCodeObject* RootObject; + BuildSystem XcodeBuildSystem = BuildSystem::One; + private: std::string const& GetXcodeBuildCommand(); std::string FindXcodeBuildCommand(); diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index e586961..39455b7 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -238,6 +238,9 @@ add_RunCMake_test(GenEx-GENEX_EVAL) add_RunCMake_test(GeneratorExpression) add_RunCMake_test(GeneratorInstance) add_RunCMake_test(GeneratorPlatform) +if(XCODE_VERSION) + set(GeneratorToolset_ARGS -DXCODE_VERSION=${XCODE_VERSION}) +endif() add_RunCMake_test(GeneratorToolset) add_RunCMake_test(GetPrerequisites) add_RunCMake_test(GNUInstallDirs -DSYSTEM_NAME=${CMAKE_SYSTEM_NAME}) diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetHostArchXcode-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArchXcode-stderr.txt index 5737e95..a86bd02 100644 --- a/Tests/RunCMake/GeneratorToolset/BadToolsetHostArchXcode-stderr.txt +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArchXcode-stderr.txt @@ -3,8 +3,4 @@ CMake Error at CMakeLists.txt:[0-9]+ \(project\): .* - does not recognize the toolset - - Test Toolset,host=x6[45] - - that was specified\.$ + given toolset specification that contains invalid field 'host'\.$ diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-result.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-stderr.txt new file mode 100644 index 0000000..9ef6b20 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + Xcode + + toolset specification field + + buildsystem=bad + + value is unkonwn. It must be '1'\.$ diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem.cmake b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake index bb22841..af59019 100644 --- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake @@ -54,6 +54,10 @@ elseif("${RunCMake_GENERATOR}" STREQUAL "Xcode") run_cmake(TestToolset) set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64") run_cmake(BadToolsetHostArchXcode) + set(RunCMake_GENERATOR_TOOLSET "buildsystem=bad") + run_cmake(BadToolsetXcodeBuildSystem) + set(RunCMake_GENERATOR_TOOLSET "Test Toolset") + run_cmake(TestToolsetXcodeBuildSystemDefault1) else() set(RunCMake_GENERATOR_TOOLSET "Bad Toolset") run_cmake(BadToolset) diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-result.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-stderr.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-stderr.txt new file mode 100644 index 0000000..0adbd0c --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TestToolsetXcodeBuildSystemDefault1.cmake:[0-9]+ \(message\): + CMAKE_GENERATOR_TOOLSET is "Test Toolset" as expected. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-stdout.txt new file mode 100644 index 0000000..cba95ce --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-stdout.txt @@ -0,0 +1 @@ +CMAKE_XCODE_BUILD_SYSTEM='1' diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1.cmake new file mode 100644 index 0000000..645bb19 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1.cmake @@ -0,0 +1,8 @@ +message(STATUS "CMAKE_XCODE_BUILD_SYSTEM='${CMAKE_XCODE_BUILD_SYSTEM}'") +if(CMAKE_GENERATOR_TOOLSET STREQUAL "Test Toolset") + message(FATAL_ERROR "CMAKE_GENERATOR_TOOLSET is \"Test Toolset\" as expected.") +else() + message(FATAL_ERROR + "CMAKE_GENERATOR_TOOLSET is \"${CMAKE_GENERATOR_TOOLSET}\" " + "but should be \"Test Toolset\"!") +endif() -- cgit v0.12 From 8d5f4c4db93959f77dc8fb185e4630df4ec26d98 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 14 Sep 2020 15:02:47 -0400 Subject: Xcode: Switch to the "new build system" for Xcode 12 and above Provide an option to switch back to the original build system via `-T buildsystem=1`. Fixes: #18088 --- Help/generator/Xcode.rst | 3 + Help/release/dev/xcode-12-new-build-system.rst | 7 + Help/variable/CMAKE_XCODE_BUILD_SYSTEM.rst | 7 +- Source/cmGlobalXCodeGenerator.cxx | 329 +++++++++++++++++++-- Source/cmGlobalXCodeGenerator.h | 16 + .../BadToolsetXcodeBuildSystem-stderr.txt | 2 +- .../BadToolsetXcodeBuildSystem12-result.txt | 1 + .../BadToolsetXcodeBuildSystem12-stderr.txt | 10 + .../BadToolsetXcodeBuildSystem12.cmake | 1 + Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake | 15 +- .../TestToolsetXcodeBuildSystem1-result.txt | 1 + .../TestToolsetXcodeBuildSystem1-stderr.txt | 4 + .../TestToolsetXcodeBuildSystem1-stdout.txt | 1 + .../TestToolsetXcodeBuildSystem1.cmake | 8 + .../TestToolsetXcodeBuildSystem12-result.txt | 1 + .../TestToolsetXcodeBuildSystem12-stderr.txt | 4 + .../TestToolsetXcodeBuildSystem12-stdout.txt | 1 + .../TestToolsetXcodeBuildSystem12.cmake | 8 + ...TestToolsetXcodeBuildSystemDefault12-result.txt | 1 + ...TestToolsetXcodeBuildSystemDefault12-stderr.txt | 4 + ...TestToolsetXcodeBuildSystemDefault12-stdout.txt | 1 + .../TestToolsetXcodeBuildSystemDefault12.cmake | 8 + Tests/RunCMake/XcodeProject/RunCMakeTest.cmake | 4 + .../XcodeDuplicateCustomCommand-result.txt | 1 + .../XcodeDuplicateCustomCommand-stderr.txt | 13 + .../XcodeProject/XcodeDuplicateCustomCommand.cmake | 3 + 26 files changed, 423 insertions(+), 31 deletions(-) create mode 100644 Help/release/dev/xcode-12-new-build-system.rst create mode 100644 Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12-result.txt create mode 100644 Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12-stderr.txt create mode 100644 Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12.cmake create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-result.txt create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-stderr.txt create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-stdout.txt create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1.cmake create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-result.txt create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-stderr.txt create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-stdout.txt create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12.cmake create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-result.txt create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-stderr.txt create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-stdout.txt create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12.cmake create mode 100644 Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand-result.txt create mode 100644 Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand-stderr.txt create mode 100644 Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand.cmake diff --git a/Help/generator/Xcode.rst b/Help/generator/Xcode.rst index c0745dc..be03a22 100644 --- a/Help/generator/Xcode.rst +++ b/Help/generator/Xcode.rst @@ -30,3 +30,6 @@ Supported pairs are: ``buildsystem=`` Specify the buildsystem variant to use. See the :variable:`CMAKE_XCODE_BUILD_SYSTEM` variable for allowed values. + + For example, to select the original build system under Xcode 12, + run :manual:`cmake(1)` with the option ``-T buildsystem=1``. diff --git a/Help/release/dev/xcode-12-new-build-system.rst b/Help/release/dev/xcode-12-new-build-system.rst new file mode 100644 index 0000000..7a497b0 --- /dev/null +++ b/Help/release/dev/xcode-12-new-build-system.rst @@ -0,0 +1,7 @@ +xcode-12-new-build-system +------------------------- + +* The :generator:`Xcode` generator now uses the Xcode "new build system" + when generating for Xcode 12.0 or higher. + See the :variable:`CMAKE_XCODE_BUILD_SYSTEM` variable. + One may use ``-T buildsystem=1`` to switch to the legacy build system. diff --git a/Help/variable/CMAKE_XCODE_BUILD_SYSTEM.rst b/Help/variable/CMAKE_XCODE_BUILD_SYSTEM.rst index 8696bbf..587a5c9 100644 --- a/Help/variable/CMAKE_XCODE_BUILD_SYSTEM.rst +++ b/Help/variable/CMAKE_XCODE_BUILD_SYSTEM.rst @@ -10,7 +10,12 @@ mature enough for use by CMake. The possible values are: ``1`` The original Xcode build system. - This is the default. + This is the default when using Xcode 11.x or below. + +``12`` + The Xcode "new build system" introduced by Xcode 10. + It became mature enough for use by CMake in Xcode 12. + This is the default when using Xcode 12.x or above. The ``CMAKE_XCODE_BUILD_SYSTEM`` variable is informational and should not be modified by project code. See the :ref:`Xcode Build System Selection` diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index cceaea0..b2014e0 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -171,6 +171,11 @@ cmGlobalXCodeGenerator::cmGlobalXCodeGenerator( { this->VersionString = version_string; this->XcodeVersion = version_number; + if (this->XcodeVersion >= 120) { + this->XcodeBuildSystem = BuildSystem::Twelve; + } else { + this->XcodeBuildSystem = BuildSystem::One; + } this->RootObject = nullptr; this->MainGroupChildren = nullptr; @@ -287,6 +292,8 @@ cm::string_view cmXcodeBuildSystemString(cmGlobalXCodeGenerator::BuildSystem b) switch (b) { case cmGlobalXCodeGenerator::BuildSystem::One: return "1"_s; + case cmGlobalXCodeGenerator::BuildSystem::Twelve: + return "12"_s; } return {}; } @@ -371,6 +378,8 @@ bool cmGlobalXCodeGenerator::ProcessGeneratorToolsetField( if (key == "buildsystem") { if (value == "1"_s) { this->XcodeBuildSystem = BuildSystem::One; + } else if (value == "12"_s) { + this->XcodeBuildSystem = BuildSystem::Twelve; } else { /* clang-format off */ std::string const& e = cmStrCat( @@ -378,7 +387,21 @@ bool cmGlobalXCodeGenerator::ProcessGeneratorToolsetField( " ", this->GetName(), "\n" "toolset specification field\n" " buildsystem=", value, "\n" - "value is unkonwn. It must be '1'." + "value is unkonwn. It must be '1' or '12'." + ); + /* clang-format on */ + mf->IssueMessage(MessageType::FATAL_ERROR, e); + return false; + } + if (this->XcodeBuildSystem == BuildSystem::Twelve && + this->XcodeVersion < 120) { + /* clang-format off */ + std::string const& e = cmStrCat( + "Generator\n" + " ", this->GetName(), "\n" + "toolset specification field\n" + " buildsystem=", value, "\n" + "is not allowed with Xcode ", this->VersionString, '.' ); /* clang-format on */ mf->IssueMessage(MessageType::FATAL_ERROR, e); @@ -479,6 +502,9 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( } } + if (this->XcodeBuildSystem >= BuildSystem::Twelve) { + makeCommand.Add("-parallelizeTargets"); + } makeCommand.Add("-configuration", (config.empty() ? "Debug" : config)); if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) { @@ -499,8 +525,15 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( std::unique_ptr cmGlobalXCodeGenerator::CreateLocalGenerator( cmMakefile* mf) { - return std::unique_ptr( + std::unique_ptr lg( cm::make_unique(this, mf)); + if (this->XcodeBuildSystem >= BuildSystem::Twelve) { + // For this build system variant we generate custom commands as + // shell scripts directly rather than inside Makefiles. + // FIXME: Rename or refactor this option for clarity. + lg->SetLinkScriptShell(true); + } + return lg; } void cmGlobalXCodeGenerator::AddExtraIDETargets() @@ -1692,30 +1725,46 @@ void cmGlobalXCodeGenerator::CreateCustomCommands( cmXCodeObject* preLinkPhase = nullptr; cmXCodeObject* postBuildPhase = nullptr; - std::vector classes; - if (!gtgt->GetConfigCommonSourceFiles(classes)) { - return; - } - // add all the sources - std::vector commands; - auto& visited = this->CommandsVisited[gtgt]; - for (auto sourceFile : classes) { - if (sourceFile->GetCustomCommand() && visited.insert(sourceFile).second) { - commands.push_back(*sourceFile->GetCustomCommand()); + if (this->XcodeBuildSystem >= BuildSystem::Twelve) { + // create prebuild phase + preBuildPhase = + this->CreateRunScriptBuildPhase("CMake PreBuild Rules", prebuild); + // create prelink phase + preLinkPhase = + this->CreateRunScriptBuildPhase("CMake PreLink Rules", prelink); + // create postbuild phase + postBuildPhase = + this->CreateRunScriptBuildPhase("CMake PostBuild Rules", postbuild); + } else { + std::vector classes; + if (!gtgt->GetConfigCommonSourceFiles(classes)) { + return; + } + // add all the sources + std::vector commands; + auto& visited = this->CommandsVisited[gtgt]; + for (auto sourceFile : classes) { + if (sourceFile->GetCustomCommand() && + visited.insert(sourceFile).second) { + commands.push_back(*sourceFile->GetCustomCommand()); + if (this->XcodeBuildSystem >= BuildSystem::Twelve) { + this->CustomCommandRoots[sourceFile].insert(gtgt); + } + } } + // create custom commands phase + legacyCustomCommandsBuildPhase = this->CreateLegacyRunScriptBuildPhase( + "CMake Rules", "cmakeRulesBuildPhase", gtgt, commands); + // create prebuild phase + preBuildPhase = this->CreateLegacyRunScriptBuildPhase( + "CMake PreBuild Rules", "preBuildCommands", gtgt, prebuild); + // create prelink phase + preLinkPhase = this->CreateLegacyRunScriptBuildPhase( + "CMake PreLink Rules", "preLinkCommands", gtgt, prelink); + // create postbuild phase + postBuildPhase = this->CreateLegacyRunScriptBuildPhase( + "CMake PostBuild Rules", "postBuildPhase", gtgt, postbuild); } - // create custom commands phase - legacyCustomCommandsBuildPhase = this->CreateLegacyRunScriptBuildPhase( - "CMake Rules", "cmakeRulesBuildPhase", gtgt, commands); - // create prebuild phase - preBuildPhase = this->CreateLegacyRunScriptBuildPhase( - "CMake PreBuild Rules", "preBuildCommands", gtgt, prebuild); - // create prelink phase - preLinkPhase = this->CreateLegacyRunScriptBuildPhase( - "CMake PreLink Rules", "preLinkCommands", gtgt, prelink); - // create postbuild phase - postBuildPhase = this->CreateLegacyRunScriptBuildPhase( - "CMake PostBuild Rules", "postBuildPhase", gtgt, postbuild); // The order here is the order they will be built in. // The order "headers, resources, sources" mimics a native project generated @@ -1727,6 +1776,9 @@ void cmGlobalXCodeGenerator::CreateCustomCommands( if (legacyCustomCommandsBuildPhase) { buildPhases->AddObject(legacyCustomCommandsBuildPhase); } + if (this->XcodeBuildSystem >= BuildSystem::Twelve) { + this->CreateRunScriptBuildPhases(buildPhases, gtgt); + } if (headerBuildPhase) { buildPhases->AddObject(headerBuildPhase); } @@ -1750,6 +1802,199 @@ void cmGlobalXCodeGenerator::CreateCustomCommands( } } +void cmGlobalXCodeGenerator::CreateRunScriptBuildPhases( + cmXCodeObject* buildPhases, cmGeneratorTarget const* gt) +{ + std::vector sources; + if (!gt->GetConfigCommonSourceFiles(sources)) { + return; + } + auto& visited = this->CommandsVisited[gt]; + for (auto sf : sources) { + this->CreateRunScriptBuildPhases(buildPhases, sf, gt, visited); + } +} + +void cmGlobalXCodeGenerator::CreateRunScriptBuildPhases( + cmXCodeObject* buildPhases, cmSourceFile const* sf, + cmGeneratorTarget const* gt, std::set& visited) +{ + cmCustomCommand const* cc = sf->GetCustomCommand(); + if (cc && visited.insert(sf).second) { + this->CustomCommandRoots[sf].insert(gt); + if (std::vector const* depends = gt->GetSourceDepends(sf)) { + for (cmSourceFile const* di : *depends) { + this->CreateRunScriptBuildPhases(buildPhases, di, gt, visited); + } + } + cmXCodeObject* buildPhase = this->CreateRunScriptBuildPhase(sf, gt, *cc); + buildPhases->AddObject(buildPhase); + } +} + +cmXCodeObject* cmGlobalXCodeGenerator::CreateRunScriptBuildPhase( + cmSourceFile const* sf, cmGeneratorTarget const* gt, + cmCustomCommand const& cc) +{ + std::set allConfigInputs; + std::set allConfigOutputs; + + std::string shellScript = "set -e\n"; + for (std::string const& configName : this->CurrentConfigurationTypes) { + cmCustomCommandGenerator ccg(cc, configName, this->CurrentLocalGenerator); + std::vector realDepends; + realDepends.reserve(ccg.GetDepends().size()); + for (auto const& d : ccg.GetDepends()) { + std::string dep; + if (this->CurrentLocalGenerator->GetRealDependency(d, configName, dep)) { + realDepends.emplace_back(std::move(dep)); + } + } + + allConfigInputs.insert(realDepends.begin(), realDepends.end()); + allConfigOutputs.insert(ccg.GetByproducts().begin(), + ccg.GetByproducts().end()); + allConfigOutputs.insert(ccg.GetOutputs().begin(), ccg.GetOutputs().end()); + + shellScript = + cmStrCat(shellScript, R"(if test "$CONFIGURATION" = ")", configName, + "\"; then :\n", this->ConstructScript(ccg), "fi\n"); + } + + cmXCodeObject* buildPhase = + this->CreateObject(cmXCodeObject::PBXShellScriptBuildPhase); + buildPhase->AddAttribute("buildActionMask", + this->CreateString("2147483647")); + cmXCodeObject* buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); + buildPhase->AddAttribute("files", buildFiles); + { + std::string name; + if (!allConfigOutputs.empty()) { + name = cmStrCat("Generate ", + this->RelativeToBinary(*allConfigOutputs.begin())); + } else { + name = sf->GetLocation().GetName(); + } + buildPhase->AddAttribute("name", this->CreateString(name)); + } + buildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + this->CreateString("0")); + buildPhase->AddAttribute("shellPath", this->CreateString("/bin/sh")); + buildPhase->AddAttribute("shellScript", this->CreateString(shellScript)); + buildPhase->AddAttribute("showEnvVarsInLog", this->CreateString("0")); + + bool symbolic = false; + { + cmXCodeObject* inputPaths = this->CreateObject(cmXCodeObject::OBJECT_LIST); + for (std::string const& i : allConfigInputs) { + inputPaths->AddUniqueObject(this->CreateString(i)); + if (!symbolic) { + if (cmSourceFile* isf = + gt->GetLocalGenerator()->GetMakefile()->GetSource( + i, cmSourceFileLocationKind::Known)) { + symbolic = isf->GetPropertyAsBool("SYMBOLIC"); + } + } + } + buildPhase->AddAttribute("inputPaths", inputPaths); + } + { + cmXCodeObject* outputPaths = + this->CreateObject(cmXCodeObject::OBJECT_LIST); + for (std::string const& o : allConfigOutputs) { + outputPaths->AddUniqueObject(this->CreateString(o)); + if (!symbolic) { + if (cmSourceFile* osf = + gt->GetLocalGenerator()->GetMakefile()->GetSource( + o, cmSourceFileLocationKind::Known)) { + symbolic = osf->GetPropertyAsBool("SYMBOLIC"); + } + } + } + buildPhase->AddAttribute("outputPaths", outputPaths); + } + if (symbolic) { + buildPhase->AddAttribute("alwaysOutOfDate", this->CreateString("1")); + } + + return buildPhase; +} + +cmXCodeObject* cmGlobalXCodeGenerator::CreateRunScriptBuildPhase( + std::string const& name, std::vector const& commands) +{ + if (commands.empty()) { + return nullptr; + } + + std::set allConfigOutputs; + + std::string shellScript = "set -e\n"; + for (std::string const& configName : this->CurrentConfigurationTypes) { + shellScript = cmStrCat(shellScript, R"(if test "$CONFIGURATION" = ")", + configName, "\"; then :\n"); + for (cmCustomCommand const& cc : commands) { + cmCustomCommandGenerator ccg(cc, configName, + this->CurrentLocalGenerator); + shellScript = cmStrCat(shellScript, this->ConstructScript(ccg)); + allConfigOutputs.insert(ccg.GetByproducts().begin(), + ccg.GetByproducts().end()); + } + shellScript = cmStrCat(shellScript, "fi\n"); + } + + cmXCodeObject* buildPhase = + this->CreateObject(cmXCodeObject::PBXShellScriptBuildPhase); + buildPhase->AddAttribute("buildActionMask", + this->CreateString("2147483647")); + cmXCodeObject* buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); + buildPhase->AddAttribute("files", buildFiles); + buildPhase->AddAttribute("name", this->CreateString(name)); + buildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + this->CreateString("0")); + buildPhase->AddAttribute("shellPath", this->CreateString("/bin/sh")); + buildPhase->AddAttribute("shellScript", this->CreateString(shellScript)); + buildPhase->AddAttribute("showEnvVarsInLog", this->CreateString("0")); + { + cmXCodeObject* outputPaths = + this->CreateObject(cmXCodeObject::OBJECT_LIST); + for (std::string const& o : allConfigOutputs) { + outputPaths->AddUniqueObject(this->CreateString(o)); + } + buildPhase->AddAttribute("outputPaths", outputPaths); + } + buildPhase->AddAttribute("alwaysOutOfDate", this->CreateString("1")); + + return buildPhase; +} + +std::string cmGlobalXCodeGenerator::ConstructScript( + cmCustomCommandGenerator const& ccg) +{ + std::string script; + cmLocalGenerator* lg = this->CurrentLocalGenerator; + std::string wd = ccg.GetWorkingDirectory(); + if (wd.empty()) { + wd = lg->GetCurrentBinaryDirectory(); + } + wd = lg->ConvertToOutputFormat(wd, cmOutputConverter::SHELL); + script = cmStrCat(script, " cd ", wd, "\n"); + for (unsigned int c = 0; c < ccg.GetNumberOfCommands(); ++c) { + std::string cmd = ccg.GetCommand(c); + if (cmd.empty()) { + continue; + } + cmSystemTools::ReplaceString(cmd, "/./", "/"); + cmd = lg->ConvertToOutputFormat(cmd, cmOutputConverter::SHELL); + ccg.AppendArguments(c, cmd); + cmSystemTools::ReplaceString(cmd, "$(CONFIGURATION)", "$CONFIGURATION"); + cmSystemTools::ReplaceString(cmd, "$(EFFECTIVE_PLATFORM_NAME)", + "$EFFECTIVE_PLATFORM_NAME"); + script = cmStrCat(script, " ", cmd, '\n'); + } + return script; +} + // This function removes each occurrence of the flag and returns the last one // (i.e., the dominant flag in GCC) std::string cmGlobalXCodeGenerator::ExtractFlag(const char* flag, @@ -3713,6 +3958,29 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( if (!this->CreateXCodeTargets(generator, targets)) { return false; } + for (auto const& ccRoot : this->CustomCommandRoots) { + if (ccRoot.second.size() > 1) { + std::string e = "The custom command "; + std::vector const& outputs = + ccRoot.first->GetCustomCommand()->GetOutputs(); + if (!outputs.empty()) { + e = cmStrCat(e, "generating\n ", outputs[0]); + } else { + e = cmStrCat(e, "driven by\n ", ccRoot.first->GetFullPath()); + } + e = cmStrCat(e, "\nis attached to multiple targets:"); + for (cmGeneratorTarget const* gt : ccRoot.second) { + e = cmStrCat(e, "\n ", gt->GetName()); + } + e = cmStrCat( + e, + "\nbut none of these is a common dependency of the other(s). " + "This is not allowed by the Xcode \"new build system\"."); + generator->IssueMessage(MessageType::FATAL_ERROR, e); + return false; + } + } + this->CustomCommandRoots.clear(); } // loop over all targets and add link and depend info for (auto t : targets) { @@ -4007,9 +4275,16 @@ void cmGlobalXCodeGenerator::OutputXCodeWorkspaceSettings( xout.StartElement("dict"); if (this->XcodeVersion >= 100) { xout.Element("key", "BuildSystemType"); - xout.Element("string", "Original"); - xout.Element("key", "DisableBuildSystemDeprecationWarning"); - xout.Element("true"); + switch (this->XcodeBuildSystem) { + case BuildSystem::One: + xout.Element("string", "Original"); + xout.Element("key", "DisableBuildSystemDeprecationWarning"); + xout.Element("true"); + break; + case BuildSystem::Twelve: + xout.Element("string", "Latest"); + break; + } } if (hasGeneratedSchemes) { xout.Element("key", diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index bbf3ee9..fca9c27 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -15,6 +15,7 @@ #include "cmXCodeObject.h" class cmCustomCommand; +class cmCustomCommandGenerator; class cmGeneratorTarget; class cmGlobalGeneratorFactory; class cmLocalGenerator; @@ -116,6 +117,7 @@ public: enum class BuildSystem { One = 1, + Twelve = 12, }; protected: @@ -233,6 +235,18 @@ private: cmXCodeObject* CreateLegacyRunScriptBuildPhase( const char* name, const char* name2, cmGeneratorTarget* target, const std::vector&); + void CreateRunScriptBuildPhases(cmXCodeObject* buildPhases, + cmGeneratorTarget const* gt); + void CreateRunScriptBuildPhases(cmXCodeObject* buildPhases, + cmSourceFile const* sf, + cmGeneratorTarget const* gt, + std::set& visited); + cmXCodeObject* CreateRunScriptBuildPhase(cmSourceFile const* sf, + cmGeneratorTarget const* gt, + cmCustomCommand const& cc); + cmXCodeObject* CreateRunScriptBuildPhase( + std::string const& name, std::vector const& commands); + std::string ConstructScript(cmCustomCommandGenerator const& ccg); void CreateReRunCMakeFile(cmLocalGenerator* root, std::vector const& gens); @@ -315,4 +329,6 @@ private: std::vector EnabledLangs; std::map> CommandsVisited; + std::map> + CustomCommandRoots; }; diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-stderr.txt index 9ef6b20..5e88e3b 100644 --- a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-stderr.txt +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-stderr.txt @@ -7,4 +7,4 @@ CMake Error at CMakeLists.txt:[0-9]+ \(project\): buildsystem=bad - value is unkonwn. It must be '1'\.$ + value is unkonwn. It must be '1' or '12'\.$ diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12-result.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12-stderr.txt new file mode 100644 index 0000000..cdfae3e --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + Xcode + + toolset specification field + + buildsystem=12 + + is not allowed with Xcode [0-9.]+\.$ diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12.cmake b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake index af59019..5f12d79 100644 --- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake @@ -56,8 +56,19 @@ elseif("${RunCMake_GENERATOR}" STREQUAL "Xcode") run_cmake(BadToolsetHostArchXcode) set(RunCMake_GENERATOR_TOOLSET "buildsystem=bad") run_cmake(BadToolsetXcodeBuildSystem) - set(RunCMake_GENERATOR_TOOLSET "Test Toolset") - run_cmake(TestToolsetXcodeBuildSystemDefault1) + if(XCODE_VERSION VERSION_GREATER_EQUAL 12) + set(RunCMake_GENERATOR_TOOLSET "Test Toolset") + run_cmake(TestToolsetXcodeBuildSystemDefault12) + set(RunCMake_GENERATOR_TOOLSET "Test Toolset,buildsystem=1") + run_cmake(TestToolsetXcodeBuildSystem1) + set(RunCMake_GENERATOR_TOOLSET "Test Toolset,buildsystem=12") + run_cmake(TestToolsetXcodeBuildSystem12) + else() + set(RunCMake_GENERATOR_TOOLSET "Test Toolset") + run_cmake(TestToolsetXcodeBuildSystemDefault1) + set(RunCMake_GENERATOR_TOOLSET "buildsystem=12") + run_cmake(BadToolsetXcodeBuildSystem12) + endif() else() set(RunCMake_GENERATOR_TOOLSET "Bad Toolset") run_cmake(BadToolset) diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-result.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-stderr.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-stderr.txt new file mode 100644 index 0000000..817467b --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TestToolsetXcodeBuildSystem1.cmake:[0-9]+ \(message\): + CMAKE_GENERATOR_TOOLSET is "Test Toolset,buildsystem=1" as expected. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-stdout.txt new file mode 100644 index 0000000..cba95ce --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-stdout.txt @@ -0,0 +1 @@ +CMAKE_XCODE_BUILD_SYSTEM='1' diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1.cmake new file mode 100644 index 0000000..550a6a1 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1.cmake @@ -0,0 +1,8 @@ +message(STATUS "CMAKE_XCODE_BUILD_SYSTEM='${CMAKE_XCODE_BUILD_SYSTEM}'") +if(CMAKE_GENERATOR_TOOLSET STREQUAL "Test Toolset,buildsystem=1") + message(FATAL_ERROR "CMAKE_GENERATOR_TOOLSET is \"Test Toolset,buildsystem=1\" as expected.") +else() + message(FATAL_ERROR + "CMAKE_GENERATOR_TOOLSET is \"${CMAKE_GENERATOR_TOOLSET}\" " + "but should be \"Test Toolset,buildsystem=1\"!") +endif() diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-result.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-stderr.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-stderr.txt new file mode 100644 index 0000000..9352faf --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TestToolsetXcodeBuildSystem12.cmake:[0-9]+ \(message\): + CMAKE_GENERATOR_TOOLSET is "Test Toolset,buildsystem=12" as expected. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-stdout.txt new file mode 100644 index 0000000..df49a31 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-stdout.txt @@ -0,0 +1 @@ +CMAKE_XCODE_BUILD_SYSTEM='12' diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12.cmake new file mode 100644 index 0000000..7e30e43 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12.cmake @@ -0,0 +1,8 @@ +message(STATUS "CMAKE_XCODE_BUILD_SYSTEM='${CMAKE_XCODE_BUILD_SYSTEM}'") +if(CMAKE_GENERATOR_TOOLSET STREQUAL "Test Toolset,buildsystem=12") + message(FATAL_ERROR "CMAKE_GENERATOR_TOOLSET is \"Test Toolset,buildsystem=12\" as expected.") +else() + message(FATAL_ERROR + "CMAKE_GENERATOR_TOOLSET is \"${CMAKE_GENERATOR_TOOLSET}\" " + "but should be \"Test Toolset,buildsystem=12\"!") +endif() diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-result.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-stderr.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-stderr.txt new file mode 100644 index 0000000..1d43537 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TestToolsetXcodeBuildSystemDefault12.cmake:[0-9]+ \(message\): + CMAKE_GENERATOR_TOOLSET is "Test Toolset" as expected. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-stdout.txt new file mode 100644 index 0000000..df49a31 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-stdout.txt @@ -0,0 +1 @@ +CMAKE_XCODE_BUILD_SYSTEM='12' diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12.cmake new file mode 100644 index 0000000..645bb19 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12.cmake @@ -0,0 +1,8 @@ +message(STATUS "CMAKE_XCODE_BUILD_SYSTEM='${CMAKE_XCODE_BUILD_SYSTEM}'") +if(CMAKE_GENERATOR_TOOLSET STREQUAL "Test Toolset") + message(FATAL_ERROR "CMAKE_GENERATOR_TOOLSET is \"Test Toolset\" as expected.") +else() + message(FATAL_ERROR + "CMAKE_GENERATOR_TOOLSET is \"${CMAKE_GENERATOR_TOOLSET}\" " + "but should be \"Test Toolset\"!") +endif() diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 70eaaeb..68de61c 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -10,6 +10,10 @@ run_cmake(XcodeAttributeGenex) run_cmake(XcodeAttributeGenexError) run_cmake(XcodeGenerateTopLevelProjectOnly) +if(XCODE_VERSION VERSION_GREATER_EQUAL 12) + run_cmake(XcodeDuplicateCustomCommand) +endif() + function(XcodeGenerateTopLevelProjectOnlyWithObjectLibrary) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeGenerateTopLevelProjectOnlyWithObjectLibrary-build) run_cmake(XcodeGenerateTopLevelProjectOnlyWithObjectLibrary) diff --git a/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand-result.txt b/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand-stderr.txt b/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand-stderr.txt new file mode 100644 index 0000000..02af783 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand-stderr.txt @@ -0,0 +1,13 @@ +^CMake Error in CMakeLists.txt: + The custom command generating + + [^ +]*/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand-build/out.txt + + is attached to multiple targets: + + drive[0-9] + drive[0-9] + + but none of these is a common dependency of the other\(s\). This is not + allowed by the Xcode "new build system". diff --git a/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand.cmake b/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand.cmake new file mode 100644 index 0000000..3ef1312 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand.cmake @@ -0,0 +1,3 @@ +add_custom_command(OUTPUT out.txt COMMAND false) +add_custom_target(drive1 DEPENDS out.txt) +add_custom_target(drive2 DEPENDS out.txt) -- cgit v0.12 From 1806cdd17c17fc202b4d7c195b1830cfc038a3a2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 15 Sep 2020 11:21:39 -0400 Subject: Tests: Avoid duplicate custom commands for Xcode "new build system" --- Tests/CustomCommand/CMakeLists.txt | 8 ++++++++ Tests/Module/ExternalData/Data5/CMakeLists.txt | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index 53d56bf..c1a7a57 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -514,6 +514,14 @@ add_custom_target(UseConsoleTarget ALL USES_TERMINAL ) +if(CMAKE_XCODE_BUILD_SYSTEM VERSION_GREATER_EQUAL 12) + # Xcode's "new build system" does not support multiple targets + # producing the same custom command output. + add_custom_target(GenPath DEPENDS "${gen_path}") + add_dependencies(NormDepends GenPath) + add_dependencies(UseConsole GenPath) +endif() + # Test COMMAND_EXPAND_LISTS set(cmp_args "1ARG=COMMAND_EXPAND_LISTS" "2ARG=test" "3ARG=outfile" "4ARG=content") diff --git a/Tests/Module/ExternalData/Data5/CMakeLists.txt b/Tests/Module/ExternalData/Data5/CMakeLists.txt index ea67f05..b13240d 100644 --- a/Tests/Module/ExternalData/Data5/CMakeLists.txt +++ b/Tests/Module/ExternalData/Data5/CMakeLists.txt @@ -6,6 +6,13 @@ ExternalData_Add_Test(Data5.A -P ${CMAKE_CURRENT_SOURCE_DIR}/Data5Check.cmake ) ExternalData_Add_Target(Data5.A) + +if(CMAKE_XCODE_BUILD_SYSTEM VERSION_GREATER_EQUAL 12) + # Xcode's "new build system" does not support multiple targets + # producing the same custom command output. + return() +endif() + ExternalData_Add_Test(Data5.B NAME Data5Check.B COMMAND ${CMAKE_COMMAND} -- cgit v0.12 From ff76c51ec32fb690d3e7d2889f13f03dc8b78b87 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 15 Sep 2020 11:20:15 -0400 Subject: Tests: Update RunCMake.file case with workaround for Xcode "new build system" --- Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-RerunCMake.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-RerunCMake.cmake b/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-RerunCMake.cmake index fe87c78..684c196 100644 --- a/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-RerunCMake.cmake +++ b/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-RerunCMake.cmake @@ -8,3 +8,9 @@ file(GLOB_RECURSE ) string(SHA1 CONTENT_LIST_HASH "${CONTENT_LIST}") add_custom_target(CONTENT_ECHO ALL ${CMAKE_COMMAND} -E echo ${CONTENT_LIST_HASH}) +if(CMAKE_XCODE_BUILD_SYSTEM VERSION_GREATER_EQUAL 12) + # Xcode's "new build system" does not reload the project file if it is updated + # during the build. Print the output we expect the build to print just to make + # the test pass. + message(STATUS "CONTENT_LIST_HASH: ${CONTENT_LIST_HASH}") +endif() -- cgit v0.12 From 832a78be2d11568d80156dabfad4e21d5a05650d Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 15 Sep 2020 13:57:26 -0400 Subject: Tests: Update BuildDepends test for Xcode "new build system" Xcode somehow tracks what we're running inside a custom command, so we cannot prevent it from regenerating the `noregen.h` header even though we do not declare any dependencies of it. --- Tests/BuildDepends/Project/CMakeLists.txt | 4 ++++ Tests/BuildDepends/Project/bar.cxx | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt index 83583c9..c438e1d 100644 --- a/Tests/BuildDepends/Project/CMakeLists.txt +++ b/Tests/BuildDepends/Project/CMakeLists.txt @@ -59,6 +59,10 @@ add_executable(bar bar.cxx ${CMAKE_CURRENT_BINARY_DIR}/noregen.h ) +if(CMAKE_XCODE_BUILD_SYSTEM VERSION_GREATER_EQUAL 12) + target_compile_definitions(bar PRIVATE XCODE_NEW_BUILD_SYSTEM) +endif() + #----------------------------------------------------------------------------- if("${CMAKE_GENERATOR}" MATCHES "Make") # Test the IMPLICIT_DEPENDS feature. diff --git a/Tests/BuildDepends/Project/bar.cxx b/Tests/BuildDepends/Project/bar.cxx index ec7aa65..825d661 100644 --- a/Tests/BuildDepends/Project/bar.cxx +++ b/Tests/BuildDepends/Project/bar.cxx @@ -7,8 +7,14 @@ int main(int argc, char** argv) { /* Make sure the noregen header was not regenerated. */ if (strcmp("foo", noregen_string) != 0) { +#ifdef XCODE_NEW_BUILD_SYSTEM + fprintf(stderr, + "Known limitation: noregen.h was regenerated " + "but we cannot stop Xcode from doing this!\n"); +#else printf("FAILED: noregen.h was regenerated!\n"); return 1; +#endif } /* Print out the string that should have been regenerated. */ -- cgit v0.12 From 542884e527f073368c4b2af2f09b72b1be2181c4 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 15 Sep 2020 11:20:58 -0400 Subject: Tests: Update RunCMake.XcodeProject cases for Xcode "new build system" --- Tests/RunCMake/XcodeProject/XcodeDependOnZeroCheck-build-stdout.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Tests/RunCMake/XcodeProject/XcodeDependOnZeroCheck-build-stdout.txt b/Tests/RunCMake/XcodeProject/XcodeDependOnZeroCheck-build-stdout.txt index 92c9a29..402f9d5 100644 --- a/Tests/RunCMake/XcodeProject/XcodeDependOnZeroCheck-build-stdout.txt +++ b/Tests/RunCMake/XcodeProject/XcodeDependOnZeroCheck-build-stdout.txt @@ -1 +1,3 @@ -BUILD AGGREGATE TARGET ZERO_CHECK +BUILD AGGREGATE TARGET ZERO_CHECK|PhaseScriptExecution [^ +]*/ZERO_CHECK.build/Script-[^ +]*in target 'ZERO_CHECK' from project 'XcodeDependOnZeroCheck' -- cgit v0.12 From 1c3d2d09516f93707ce2f62f02e5ce52cd279cb1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 18 Sep 2020 13:35:53 -0400 Subject: Tests: Skip Qt*Autogen.MocSkipSource case for Xcode "new build system" This test case enables AUTOMOC on the same sources in two separate targets. This causes the `moc_*.cpp` generation custom commands to be added to multiple `_autogen` targets, which is not allowed by the Xcode "new build system". Skip the part of the test that triggers this problem for now. Issue: #21205 --- Tests/QtAutogen/MocSkipSource/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Tests/QtAutogen/MocSkipSource/CMakeLists.txt b/Tests/QtAutogen/MocSkipSource/CMakeLists.txt index 454e896..c886736 100644 --- a/Tests/QtAutogen/MocSkipSource/CMakeLists.txt +++ b/Tests/QtAutogen/MocSkipSource/CMakeLists.txt @@ -29,6 +29,13 @@ set_property(SOURCE qItemD.hpp PROPERTY SKIP_AUTOGEN ON) add_executable(skipMocA ${skipMocSources} ${skipMocWrapMoc}) set_property(TARGET skipMocA PROPERTY AUTOMOC ON) target_link_libraries(skipMocA ${QT_LIBRARIES}) + +if(CMAKE_XCODE_BUILD_SYSTEM VERSION_GREATER_EQUAL 12) + # FIXME: Fix AUTOMOC for the Xcode "new build system" to avoid + # duplicating custom commands in multiple _autogen targets. + return() +endif() + # AUTOMOC and AUTOUIC enabled add_executable(skipMocB ${skipMocSources} ${skipMocWrapMoc}) set_property(TARGET skipMocB PROPERTY AUTOMOC ON) -- cgit v0.12 From fe258f638276c879bbdd2ac165ac4caba0efc921 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 15 Sep 2020 14:01:16 -0400 Subject: Tests: Skip RunCMake.XcodeProject device cases for Xcode "new build system" The Xcode "new build system" selects different architectures for device builds than the old build system does. Skip those tests on Xcode 12+ pending further investigation. Issue: #21206 --- Tests/RunCMake/XcodeProject/RunCMakeTest.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 68de61c..34fc26e 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -108,6 +108,11 @@ XcodeRemoveExcessiveISystem() # Isolate device tests from host architecture selection. unset(ENV{CMAKE_OSX_ARCHITECTURES}) +if(XCODE_VERSION VERSION_GREATER_EQUAL 12) + # FIXME: Restore device tests and fix them for the Xcode "new build system" + return() +endif() + # Use a single build tree for a few tests without cleaning. if(NOT XCODE_VERSION VERSION_LESS 5) -- cgit v0.12 From b8ecd4df5f9259f102d82011693eca6282be5ae6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 14 Sep 2020 15:05:33 -0400 Subject: ExternalProject: Use CMP0114 NEW behavior with Xcode "new build system" The ExternalProject module cannot be implemented in the Xcode "new build system" without using CMP0114's NEW behavior. When configuring for that build system, warn if the policy is not set to NEW and use NEW behavior anyway. --- Modules/ExternalProject.cmake | 12 ++++++++++++ Modules/FetchContent/CMakeLists.cmake.in | 1 + Tests/ExternalProject/CMakeLists.txt | 3 +++ Tests/ExternalProjectLocal/CMakeLists.txt | 3 +++ Tests/ExternalProjectUpdate/CMakeLists.txt | 19 ++++++++++++++++--- Tests/RunCMake/CMakeLists.txt | 3 +++ .../ExternalProject/Add_StepDependencies.cmake | 6 +++++- .../Add_StepDependencies_no_target.cmake | 6 +++++- Tests/RunCMake/ExternalProject/CMakeLists.txt | 3 +++ Tests/RunCMake/ExternalProject/RunCMakeTest.cmake | 13 ++++++++++--- .../RunCMake/ExternalProject/Xcode-CMP0114-stderr.txt | 11 +++++++++++ Tests/RunCMake/ExternalProject/Xcode-CMP0114.cmake | 2 ++ 12 files changed, 74 insertions(+), 8 deletions(-) create mode 100644 Tests/RunCMake/ExternalProject/Xcode-CMP0114-stderr.txt create mode 100644 Tests/RunCMake/ExternalProject/Xcode-CMP0114.cmake diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index b795784..8bbaf5a 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -3342,6 +3342,18 @@ function(ExternalProject_Add name) cmake_policy(GET CMP0114 cmp0114 PARENT_SCOPE # undocumented, do not use outside of CMake ) + if(CMAKE_XCODE_BUILD_SYSTEM VERSION_GREATER_EQUAL 12 AND NOT cmp0114 STREQUAL "NEW") + message(AUTHOR_WARNING + "Policy CMP0114 is not set to NEW. " + "In order to support the Xcode \"new build system\", " + "this project must be updated to set policy CMP0114 to NEW." + "\n" + "Since CMake is generating for the Xcode \"new build system\", " + "ExternalProject_Add will use policy CMP0114's NEW behavior anyway, " + "but the generated build system may not match what the project intends." + ) + set(cmp0114 "NEW") + endif() _ep_get_configuration_subdir_suffix(cfgdir) diff --git a/Modules/FetchContent/CMakeLists.cmake.in b/Modules/FetchContent/CMakeLists.cmake.in index 45e4df0..9516418 100644 --- a/Modules/FetchContent/CMakeLists.cmake.in +++ b/Modules/FetchContent/CMakeLists.cmake.in @@ -2,6 +2,7 @@ # file Copyright.txt or https://cmake.org/licensing for details. cmake_minimum_required(VERSION ${CMAKE_VERSION}) +cmake_policy(SET CMP0114 NEW) # We name the project and the target for the ExternalProject_Add() call # to something that will highlight to the user what we are working on if diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index c8850ea..29cdcc9 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -1,5 +1,8 @@ cmake_minimum_required(VERSION 2.8) project(ExternalProjectTest NONE) +if(CMAKE_XCODE_BUILD_SYSTEM VERSION_GREATER_EQUAL 12) + cmake_policy(SET CMP0114 NEW) +endif() include(ExternalProject) diff --git a/Tests/ExternalProjectLocal/CMakeLists.txt b/Tests/ExternalProjectLocal/CMakeLists.txt index 1075a9d..789e4fb 100644 --- a/Tests/ExternalProjectLocal/CMakeLists.txt +++ b/Tests/ExternalProjectLocal/CMakeLists.txt @@ -1,5 +1,8 @@ cmake_minimum_required(VERSION 2.8) project(ExternalProjectLocalTest NONE) +if(CMAKE_XCODE_BUILD_SYSTEM VERSION_GREATER_EQUAL 12) + cmake_policy(SET CMP0114 NEW) +endif() include(ExternalProject) diff --git a/Tests/ExternalProjectUpdate/CMakeLists.txt b/Tests/ExternalProjectUpdate/CMakeLists.txt index 9dddae2..563a6cf 100644 --- a/Tests/ExternalProjectUpdate/CMakeLists.txt +++ b/Tests/ExternalProjectUpdate/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION 2.8) project(ExternalProjectUpdateTest NONE) +if(CMAKE_XCODE_BUILD_SYSTEM VERSION_GREATER_EQUAL 12) + cmake_policy(SET CMP0114 NEW) +endif() +cmake_policy(GET CMP0114 cmp0114) include(ExternalProject) @@ -18,8 +22,16 @@ set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER set(base "${CMAKE_BINARY_DIR}/CMakeExternals") set(binary_base "${base}/Build") set_property(DIRECTORY PROPERTY EP_BASE ${base}) -set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test) -set_property(DIRECTORY PROPERTY EP_INDEPENDENT_STEP_TARGETS update) +if(cmp0114 STREQUAL "NEW") + set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test update) + set(TestUpdateCommand_STEP_TARGETS STEP_TARGETS update) + set(TestUpdateCommand_INDEPENDENT_STEP_TARGETS) +else() + set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test) + set_property(DIRECTORY PROPERTY EP_INDEPENDENT_STEP_TARGETS update) + set(TestUpdateCommand_STEP_TARGETS) + set(TestUpdateCommand_INDEPENDENT_STEP_TARGETS INDEPENDENT_STEP_TARGETS update) +endif() ExternalProject_Add(TestUpdateCommand SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} @@ -28,7 +40,8 @@ ExternalProject_Add(TestUpdateCommand CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" - INDEPENDENT_STEP_TARGETS update + ${TestUpdateCommand_STEP_TARGETS} + ${TestUpdateCommand_INDEPENDENT_STEP_TARGETS} ) add_custom_target(TestUpdateCommandDriver ALL) add_dependencies(TestUpdateCommandDriver TestUpdateCommand-update) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 39455b7..ff0ae62 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -569,6 +569,9 @@ add_RunCMake_test(file-GET_RUNTIME_DEPENDENCIES add_RunCMake_test(CPackCommandLine) add_RunCMake_test(CPackConfig) add_RunCMake_test(CPackInstallProperties) +if(XCODE_VERSION) + set(ExternalProject_ARGS -DXCODE_VERSION=${XCODE_VERSION}) +endif() add_RunCMake_test(ExternalProject) add_RunCMake_test(FetchContent) set(CTestCommandLine_ARGS -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}) diff --git a/Tests/RunCMake/ExternalProject/Add_StepDependencies.cmake b/Tests/RunCMake/ExternalProject/Add_StepDependencies.cmake index 4e43ab3..bfed4fa 100644 --- a/Tests/RunCMake/ExternalProject/Add_StepDependencies.cmake +++ b/Tests/RunCMake/ExternalProject/Add_StepDependencies.cmake @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION ${CMAKE_VERSION}) -cmake_policy(SET CMP0114 OLD) # Test deprecated behavior. +if(CMAKE_XCODE_BUILD_SYSTEM VERSION_GREATER_EQUAL 12) + cmake_policy(SET CMP0114 NEW) +else() + cmake_policy(SET CMP0114 OLD) # Test deprecated behavior. +endif() include(ExternalProject) diff --git a/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target.cmake b/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target.cmake index 7c75007..039dec6 100644 --- a/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target.cmake +++ b/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target.cmake @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION ${CMAKE_VERSION}) -cmake_policy(SET CMP0114 OLD) # Test deprecated behavior. +if(CMAKE_XCODE_BUILD_SYSTEM VERSION_GREATER_EQUAL 12) + cmake_policy(SET CMP0114 NEW) +else() + cmake_policy(SET CMP0114 OLD) # Test deprecated behavior. +endif() include(ExternalProject) diff --git a/Tests/RunCMake/ExternalProject/CMakeLists.txt b/Tests/RunCMake/ExternalProject/CMakeLists.txt index c585733..9cb093a 100644 --- a/Tests/RunCMake/ExternalProject/CMakeLists.txt +++ b/Tests/RunCMake/ExternalProject/CMakeLists.txt @@ -1,3 +1,6 @@ cmake_minimum_required(VERSION ${CMAKE_VERSION}) project(${RunCMake_TEST} NONE) +if(CMAKE_XCODE_BUILD_SYSTEM VERSION_GREATER_EQUAL 12 AND NOT RunCMake_TEST STREQUAL "Xcode-CMP0114") + cmake_policy(SET CMP0114 NEW) +endif() include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake index 1e88e0b..598671f 100644 --- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake @@ -16,8 +16,10 @@ run_cmake(SourceMissing) run_cmake(CMAKE_CACHE_ARGS) run_cmake(CMAKE_CACHE_DEFAULT_ARGS) run_cmake(CMAKE_CACHE_mix) -run_cmake(NO_DEPENDS-CMP0114-WARN) -run_cmake(NO_DEPENDS-CMP0114-OLD) +if(NOT XCODE_VERSION OR XCODE_VERSION VERSION_LESS 12) + run_cmake(NO_DEPENDS-CMP0114-WARN) + run_cmake(NO_DEPENDS-CMP0114-OLD) +endif() run_cmake(NO_DEPENDS-CMP0114-NEW) run_cmake(NO_DEPENDS-CMP0114-NEW-Direct) run_cmake(Add_StepDependencies) @@ -25,6 +27,9 @@ run_cmake(Add_StepDependencies_iface) run_cmake(Add_StepDependencies_iface_step) run_cmake(Add_StepDependencies_no_target) run_cmake(UsesTerminal) +if(XCODE_VERSION AND XCODE_VERSION VERSION_GREATER_EQUAL 12) + run_cmake(Xcode-CMP0114) +endif() macro(check_steps_missing proj) set(steps "${ARGN}") @@ -53,7 +58,9 @@ function(run_steps_CMP0114 val) run_cmake_command(Steps-CMP0114-${val}-build-install ${CMAKE_COMMAND} --build . --target proj1-install) run_cmake_command(Steps-CMP0114-${val}-build-test ${CMAKE_COMMAND} --build . --target proj1-test) endfunction() -run_steps_CMP0114(OLD) +if(NOT XCODE_VERSION OR XCODE_VERSION VERSION_LESS 12) + run_steps_CMP0114(OLD) +endif() run_steps_CMP0114(NEW) # Run both cmake and build steps. We always do a clean before the diff --git a/Tests/RunCMake/ExternalProject/Xcode-CMP0114-stderr.txt b/Tests/RunCMake/ExternalProject/Xcode-CMP0114-stderr.txt new file mode 100644 index 0000000..a616185 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Xcode-CMP0114-stderr.txt @@ -0,0 +1,11 @@ +^CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+ \(message\): + Policy CMP0114 is not set to NEW. In order to support the Xcode "new build + system", this project must be updated to set policy CMP0114 to NEW. + + Since CMake is generating for the Xcode "new build system", + ExternalProject_Add will use policy CMP0114's NEW behavior anyway, but the + generated build system may not match what the project intends. +Call Stack \(most recent call first\): + Xcode-CMP0114.cmake:[0-9]+ \(ExternalProject_Add\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/ExternalProject/Xcode-CMP0114.cmake b/Tests/RunCMake/ExternalProject/Xcode-CMP0114.cmake new file mode 100644 index 0000000..5039daa --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Xcode-CMP0114.cmake @@ -0,0 +1,2 @@ +include(ExternalProject) +ExternalProject_Add(MyProj SOURCE_DIR .) -- cgit v0.12