diff options
author | Brad King <brad.king@kitware.com> | 2017-11-01 12:02:11 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-11-01 12:02:15 (GMT) |
commit | cdc9c110a5bbe82d761f1a6d58b202a41b245de6 (patch) | |
tree | c09f0531a7cb7c19d8f44c5a6a54b426e76da727 | |
parent | 4857aec5d5bdee608d0e4fcf1a921de2a1c1b89c (diff) | |
parent | e4e9ce7cbe9b41dd535d5246153900cb9657c6ba (diff) | |
download | CMake-cdc9c110a5bbe82d761f1a6d58b202a41b245de6.zip CMake-cdc9c110a5bbe82d761f1a6d58b202a41b245de6.tar.gz CMake-cdc9c110a5bbe82d761f1a6d58b202a41b245de6.tar.bz2 |
Merge topic '16780-write-single-xcodeproj'
e4e9ce7c Xcode: Add option to generate only topmost project file
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1395
8 files changed, 37 insertions, 0 deletions
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index b37d473..0170da1 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -188,6 +188,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_TOP_LEVEL_PROJECT_ONLY Variables that Describe the System ================================== diff --git a/Help/release/dev/write-single-xcodeproj.rst b/Help/release/dev/write-single-xcodeproj.rst new file mode 100644 index 0000000..d5e9fef --- /dev/null +++ b/Help/release/dev/write-single-xcodeproj.rst @@ -0,0 +1,8 @@ +write-single-xcodeproj +---------------------- + +* The :generator:`Xcode` generator behavior of generating one project + file per :command:`project()` command could now be controlled with the + :variable:`CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY` variable. + This could be useful to speed up the CMake generation step for + large projects and to work-around a bug in the ``ZERO_CHECK`` logic. diff --git a/Help/variable/CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY.rst b/Help/variable/CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY.rst new file mode 100644 index 0000000..ea3e240 --- /dev/null +++ b/Help/variable/CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY.rst @@ -0,0 +1,9 @@ +CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY +------------------------------------------- + +If enabled, the :generator:`Xcode` generator will generate only a +single Xcode project file for the topmost :command:`project()` command +instead of generating one for every ``project()`` command. + +This could be useful to speed up the CMake generation step for +large projects and to work-around a bug in the ``ZERO_CHECK`` logic. diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 97e461d..a85a700 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -388,6 +388,17 @@ void cmGlobalXCodeGenerator::Generate() std::map<std::string, std::vector<cmLocalGenerator*>>::iterator it; for (it = this->ProjectMap.begin(); it != this->ProjectMap.end(); ++it) { cmLocalGenerator* root = it->second[0]; + + bool generateTopLevelProjectOnly = + root->GetMakefile()->IsOn("CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY"); + + if (generateTopLevelProjectOnly) { + cmStateSnapshot snp = root->GetStateSnapshot(); + if (snp.GetBuildsystemDirectoryParent().IsValid()) { + continue; + } + } + this->SetGenerationRoot(root); // now create the project this->OutputXCodeProject(root, it->second); diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 7d436b6..f730b83 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -8,6 +8,7 @@ run_cmake(XcodeFileType) run_cmake(XcodeAttributeLocation) run_cmake(XcodeAttributeGenex) run_cmake(XcodeAttributeGenexError) +run_cmake(XcodeGenerateTopLevelProjectOnly) run_cmake(XcodeObjectNeedsEscape) run_cmake(XcodeObjectNeedsQuote) run_cmake(XcodeOptimizationFlags) diff --git a/Tests/RunCMake/XcodeProject/XcodeGenerateTopLevelProjectOnly-check.cmake b/Tests/RunCMake/XcodeProject/XcodeGenerateTopLevelProjectOnly-check.cmake new file mode 100644 index 0000000..64654af --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeGenerateTopLevelProjectOnly-check.cmake @@ -0,0 +1,3 @@ +if(EXISTS "${RunCMake_TEST_BINARY_DIR}/subproject/subproject.xcodeproj") + message(SEND_ERROR "Unexpected project file for subproject found.") +endif() diff --git a/Tests/RunCMake/XcodeProject/XcodeGenerateTopLevelProjectOnly.cmake b/Tests/RunCMake/XcodeProject/XcodeGenerateTopLevelProjectOnly.cmake new file mode 100644 index 0000000..7e53c49 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeGenerateTopLevelProjectOnly.cmake @@ -0,0 +1,3 @@ +set(CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY TRUE) +project(XcodeGenerateTopLevelProjectOnly NONE) +add_subdirectory(subproject) diff --git a/Tests/RunCMake/XcodeProject/subproject/CMakeLists.txt b/Tests/RunCMake/XcodeProject/subproject/CMakeLists.txt new file mode 100644 index 0000000..20e12b1 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/subproject/CMakeLists.txt @@ -0,0 +1 @@ +project(subproject) |