From kwrobot at kitware.com Tue May 1 00:05:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 1 May 2018 00:05:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.1-666-g6f0cd64 Message-ID: <20180501040505.8662A10F851@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 6f0cd64f897d57c6e2afe8163345e9bb8dec1fec (commit) from f6c558e3156129967203164fc8450eba58e80739 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6f0cd64f897d57c6e2afe8163345e9bb8dec1fec commit 6f0cd64f897d57c6e2afe8163345e9bb8dec1fec Author: Kitware Robot AuthorDate: Tue May 1 00:01:03 2018 -0400 Commit: Kitware Robot CommitDate: Tue May 1 00:01:03 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 12dfdb6..72ae68b 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180430) +set(CMake_VERSION_PATCH 20180501) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue May 1 11:35:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 1 May 2018 11:35:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.1-670-g4ac4823 Message-ID: <20180501153505.6915A10F26C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 4ac48237a0337a6d36556e0424e44baef38cad9a (commit) via 1155f96dd911d7a46aea2160eaebc3653d93a852 (commit) via 052743556bffee09bd4d3d8631ac6103482cc359 (commit) via b3baa97e80af96eaeb7d0599e2d00071a945f7b8 (commit) from 6f0cd64f897d57c6e2afe8163345e9bb8dec1fec (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4ac48237a0337a6d36556e0424e44baef38cad9a commit 4ac48237a0337a6d36556e0424e44baef38cad9a Merge: 1155f96 b3baa97 Author: Brad King AuthorDate: Tue May 1 15:32:32 2018 +0000 Commit: Kitware Robot CommitDate: Tue May 1 11:32:59 2018 -0400 Merge topic 'source_group-empty-prefix' b3baa97e80 Source_Group: Allow an empty prefix with the TREE syntax. Acked-by: Kitware Robot Merge-request: !2022 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1155f96dd911d7a46aea2160eaebc3653d93a852 commit 1155f96dd911d7a46aea2160eaebc3653d93a852 Merge: 6f0cd64 0527435 Author: Brad King AuthorDate: Tue May 1 15:32:22 2018 +0000 Commit: Kitware Robot CommitDate: Tue May 1 11:32:29 2018 -0400 Merge topic 'doc-wiki-links' 052743556b Modules: Update documented links to CMake community Wiki Acked-by: Kitware Robot Merge-request: !2023 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=052743556bffee09bd4d3d8631ac6103482cc359 commit 052743556bffee09bd4d3d8631ac6103482cc359 Author: Brad King AuthorDate: Mon Apr 30 15:34:50 2018 -0400 Commit: Brad King CommitDate: Mon Apr 30 15:34:50 2018 -0400 Modules: Update documented links to CMake community Wiki The wiki has moved. Update links to reference the new pages. diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 444f632..067e290 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -29,8 +29,8 @@ # Here are some CPackDeb wiki resources that are here for historic reasons and # are no longer maintained but may still prove useful: # -# - https://cmake.org/Wiki/CMake:CPackConfiguration -# - https://cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29 +# - https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/Configuration +# - https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/PackageGenerators#deb-unix-only # # List of CPackDEB specific variables: # @@ -278,7 +278,7 @@ # You may need set :variable:`CMAKE_INSTALL_RPATH` to an appropriate value # if you use this feature, because if you don't :code:`dpkg-shlibdeps` # may fail to find your own shared libs. -# See https://cmake.org/Wiki/CMake_RPATH_handling. +# See https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling # # .. variable:: CPACK_DEBIAN_PACKAGE_DEBUG # diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 87385de..8d8eab3 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -40,8 +40,8 @@ # Here are some CPackRPM wiki resources that are here for historic reasons and # are no longer maintained but may still prove useful: # -# - https://cmake.org/Wiki/CMake:CPackConfiguration -# - https://cmake.org/Wiki/CMake:CPackPackageGenerators#RPM_.28Unix_Only.29 +# - https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/Configuration +# - https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/PackageGenerators#rpm-unix-only # # List of CPackRPM specific variables: # diff --git a/Modules/readme.txt b/Modules/readme.txt index 1e0c13b..a629478 100644 --- a/Modules/readme.txt +++ b/Modules/readme.txt @@ -1,4 +1,4 @@ See the "Find Modules" section of the cmake-developer(7) manual page. For more information about how to contribute modules to CMake, see this page: -https://cmake.org/Wiki/CMake:Module_Maintainers +https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/dev/Module-Maintainers diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 9b9ef60..7190c36 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -252,9 +252,7 @@ class cmMakefile; /** \class cmPolicies * \brief Handles changes in CMake behavior and policies * - * See the cmake wiki section on - * policies - * for an overview of this class's purpose + * See the cmake-policies(7) manual for an overview of this class's purpose. */ class cmPolicies { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b3baa97e80af96eaeb7d0599e2d00071a945f7b8 commit b3baa97e80af96eaeb7d0599e2d00071a945f7b8 Author: Yohann Benedic AuthorDate: Mon Apr 30 14:19:11 2018 +0200 Commit: Yohann Benedic CommitDate: Mon Apr 30 16:44:08 2018 +0200 Source_Group: Allow an empty prefix with the TREE syntax. When calling source_group(TREE PREFIX "" FILES ...) the files located at the root directory were not assigned to the correct source group: they were put in a default group (e.g. "Source Files" in Visual Studio). Fixes: #17608 diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx index 8c9b63c..c3df313 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/Source/cmSourceGroupCommand.cxx @@ -101,9 +101,13 @@ bool addFilesToItsSourceGroups(const std::string& root, tokenizedPath = tokenizePath(sgFilesPath); } - if (tokenizedPath.size() > 1) { + if (!tokenizedPath.empty()) { tokenizedPath.pop_back(); + if (tokenizedPath.empty()) { + tokenizedPath.push_back(""); + } + sg = makefile.GetOrCreateSourceGroup(tokenizedPath); if (!sg) { ----------------------------------------------------------------------- Summary of changes: Modules/CPackDeb.cmake | 6 +++--- Modules/CPackRPM.cmake | 4 ++-- Modules/readme.txt | 2 +- Source/cmPolicies.h | 4 +--- Source/cmSourceGroupCommand.cxx | 6 +++++- 5 files changed, 12 insertions(+), 10 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed May 2 00:05:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 2 May 2018 00:05:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.1-671-ge90fa38 Message-ID: <20180502040504.DBF1210F3C3@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via e90fa38f8ddfd89fb23264ac6f767b9b693111ff (commit) from 4ac48237a0337a6d36556e0424e44baef38cad9a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e90fa38f8ddfd89fb23264ac6f767b9b693111ff commit e90fa38f8ddfd89fb23264ac6f767b9b693111ff Author: Kitware Robot AuthorDate: Wed May 2 00:01:04 2018 -0400 Commit: Kitware Robot CommitDate: Wed May 2 00:01:04 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 72ae68b..f4d53dc 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180501) +set(CMake_VERSION_PATCH 20180502) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed May 2 11:35:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 2 May 2018 11:35:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.1-675-g5e455ac Message-ID: <20180502153506.5CE7110F3B2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 5e455ac120fd596a0ad1a4216c5734bb52ac1b75 (commit) via 0c47ed643046428617161959a5784d3d70cf5a1f (commit) via e13fa223fc870ea95c6a1cfa09b61b527a1c2db5 (commit) via b542e0c74f543954ba26048ce38776269b9ba203 (commit) from e90fa38f8ddfd89fb23264ac6f767b9b693111ff (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5e455ac120fd596a0ad1a4216c5734bb52ac1b75 commit 5e455ac120fd596a0ad1a4216c5734bb52ac1b75 Merge: e90fa38 0c47ed6 Author: Brad King AuthorDate: Wed May 2 15:33:21 2018 +0000 Commit: Kitware Robot CommitDate: Wed May 2 11:33:33 2018 -0400 Merge topic 'code-improvements' 0c47ed6430 cmMakefile: Convert private helpers to file static functions e13fa223fc cmMakefile: Improve ExpandVariablesInString return type b542e0c74f cmCPluginAPI: Remove a few unnecessary c_str() calls Acked-by: Kitware Robot Rejected-by: Marc Chevrier Merge-request: !2018 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0c47ed643046428617161959a5784d3d70cf5a1f commit 0c47ed643046428617161959a5784d3d70cf5a1f Author: Vitaly Stakhovsky AuthorDate: Mon Apr 30 10:50:23 2018 -0400 Commit: Brad King CommitDate: Tue May 1 10:25:49 2018 -0400 cmMakefile: Convert private helpers to file static functions The two-argument forms of `AddDefineFlag` and `RemoveDefineFlag` need no access to `cmMakefile` class members. They are used only within the implementation file. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 53f0a3d..33e76b2 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1130,57 +1130,38 @@ cmTarget* cmMakefile::AddUtilityCommand( return target; } -void cmMakefile::AddDefineFlag(std::string const& flag) -{ - if (flag.empty()) { - return; - } - - // Update the string used for the old DEFINITIONS property. - this->AddDefineFlag(flag, this->DefineFlagsOrig); - - // If this is really a definition, update COMPILE_DEFINITIONS. - if (this->ParseDefineFlag(flag, false)) { - return; - } - - // Add this flag that does not look like a definition. - this->AddDefineFlag(flag, this->DefineFlags); -} - -void cmMakefile::AddDefineFlag(std::string const& flag, std::string& dflags) +static void s_AddDefineFlag(std::string const& flag, std::string& dflags) { // remove any \n\r std::string::size_type initSize = dflags.size(); - dflags += std::string(" ") + flag; + dflags += ' '; + dflags += flag; std::string::iterator flagStart = dflags.begin() + initSize + 1; std::replace(flagStart, dflags.end(), '\n', ' '); std::replace(flagStart, dflags.end(), '\r', ' '); } -void cmMakefile::RemoveDefineFlag(std::string const& flag) +void cmMakefile::AddDefineFlag(std::string const& flag) { - // Check the length of the flag to remove. if (flag.empty()) { return; } - std::string::size_type const len = flag.length(); + // Update the string used for the old DEFINITIONS property. - this->RemoveDefineFlag(flag, len, this->DefineFlagsOrig); + s_AddDefineFlag(flag, this->DefineFlagsOrig); // If this is really a definition, update COMPILE_DEFINITIONS. - if (this->ParseDefineFlag(flag, true)) { + if (this->ParseDefineFlag(flag, false)) { return; } - // Remove this flag that does not look like a definition. - this->RemoveDefineFlag(flag, len, this->DefineFlags); + // Add this flag that does not look like a definition. + s_AddDefineFlag(flag, this->DefineFlags); } -void cmMakefile::RemoveDefineFlag(std::string const& flag, - std::string::size_type len, - std::string& dflags) +static void s_RemoveDefineFlag(std::string const& flag, std::string& dflags) { + std::string::size_type const len = flag.length(); // Remove all instances of the flag that are surrounded by // whitespace or the beginning/end of the string. for (std::string::size_type lpos = dflags.find(flag, 0); @@ -1195,6 +1176,25 @@ void cmMakefile::RemoveDefineFlag(std::string const& flag, } } +void cmMakefile::RemoveDefineFlag(std::string const& flag) +{ + // Check the length of the flag to remove. + if (flag.empty()) { + return; + } + + // Update the string used for the old DEFINITIONS property. + s_RemoveDefineFlag(flag, this->DefineFlagsOrig); + + // If this is really a definition, update COMPILE_DEFINITIONS. + if (this->ParseDefineFlag(flag, true)) { + return; + } + + // Remove this flag that does not look like a definition. + s_RemoveDefineFlag(flag, this->DefineFlags); +} + void cmMakefile::AddCompileDefinition(std::string const& option) { this->AppendProperty("COMPILE_DEFINITIONS", option.c_str()); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 7a688b3..9f32c4f 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -885,9 +885,6 @@ protected: std::string DefineFlags; // Track the value of the computed DEFINITIONS property. - void AddDefineFlag(std::string const& flag, std::string&); - void RemoveDefineFlag(std::string const& flag, std::string::size_type, - std::string&); std::string DefineFlagsOrig; #if defined(CMAKE_BUILD_WITH_CMAKE) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e13fa223fc870ea95c6a1cfa09b61b527a1c2db5 commit e13fa223fc870ea95c6a1cfa09b61b527a1c2db5 Author: Vitaly Stakhovsky AuthorDate: Fri Apr 27 11:28:30 2018 -0400 Commit: Brad King CommitDate: Tue May 1 10:24:31 2018 -0400 cmMakefile: Improve ExpandVariablesInString return type Return `std::string const&` instead of a `const char*` that points into a string anyway. Update call sites accordingly. diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index e6d7f8f..8e7e3ad 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -405,7 +405,8 @@ char CCONV* cmExpandVariablesInString(void* arg, const char* source, { cmMakefile* mf = static_cast(arg); std::string barf = source; - std::string result = mf->ExpandVariablesInString(barf, escapeQuotes, atOnly); + std::string const& result = + mf->ExpandVariablesInString(barf, escapeQuotes, atOnly); return strdup(result.c_str()); } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b6bf08b..53f0a3d 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2412,12 +2412,13 @@ std::vector cmMakefile::GetDefinitions() const return res; } -const char* cmMakefile::ExpandVariablesInString(std::string& source) const +const std::string& cmMakefile::ExpandVariablesInString( + std::string& source) const { return this->ExpandVariablesInString(source, false, false); } -const char* cmMakefile::ExpandVariablesInString( +const std::string& cmMakefile::ExpandVariablesInString( std::string& source, bool escapeQuotes, bool noEscapes, bool atOnly, const char* filename, long line, bool removeEmpty, bool replaceAt) const { @@ -2433,7 +2434,7 @@ const char* cmMakefile::ExpandVariablesInString( this->IssueMessage(cmake::INTERNAL_ERROR, "ExpandVariablesInString @ONLY called " "on something with escapes."); - return source.c_str(); + return source; } // Variables used in the WARN case. @@ -2515,7 +2516,7 @@ const char* cmMakefile::ExpandVariablesInString( this->IssueMessage(cmake::AUTHOR_WARNING, msg); } - return source.c_str(); + return source; } cmake::MessageType cmMakefile::ExpandVariablesInStringOld( diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 16b2047..7a688b3 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -565,12 +565,11 @@ public: * entry in the this->Definitions map. Also \@var\@ is * expanded to match autoconf style expansions. */ - const char* ExpandVariablesInString(std::string& source) const; - const char* ExpandVariablesInString(std::string& source, bool escapeQuotes, - bool noEscapes, bool atOnly = false, - const char* filename = nullptr, - long line = -1, bool removeEmpty = false, - bool replaceAt = false) const; + const std::string& ExpandVariablesInString(std::string& source) const; + const std::string& ExpandVariablesInString( + std::string& source, bool escapeQuotes, bool noEscapes, + bool atOnly = false, const char* filename = nullptr, long line = -1, + bool removeEmpty = false, bool replaceAt = false) const; /** * Remove any remaining variables in the string. Anything with ${var} or https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b542e0c74f543954ba26048ce38776269b9ba203 commit b542e0c74f543954ba26048ce38776269b9ba203 Author: Vitaly Stakhovsky AuthorDate: Mon Apr 30 10:25:34 2018 -0400 Commit: Brad King CommitDate: Tue May 1 10:21:53 2018 -0400 cmCPluginAPI: Remove a few unnecessary c_str() calls diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 1ec76ac..e6d7f8f 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -664,7 +664,7 @@ void CCONV cmSourceFileSetName(void* arg, const char* name, const char* dir, // First try and see whether the listed file can be found // as is without extensions added on. std::string hname = pathname; - if (cmSystemTools::FileExists(hname.c_str())) { + if (cmSystemTools::FileExists(hname)) { sf->SourceName = cmSystemTools::GetFilenamePath(name); if (!sf->SourceName.empty()) { sf->SourceName += "/"; @@ -691,7 +691,7 @@ void CCONV cmSourceFileSetName(void* arg, const char* name, const char* dir, hname = pathname; hname += "."; hname += *ext; - if (cmSystemTools::FileExists(hname.c_str())) { + if (cmSystemTools::FileExists(hname)) { sf->SourceExtension = *ext; sf->FullPath = hname; return; @@ -704,7 +704,7 @@ void CCONV cmSourceFileSetName(void* arg, const char* name, const char* dir, hname = pathname; hname += "."; hname += *ext; - if (cmSystemTools::FileExists(hname.c_str())) { + if (cmSystemTools::FileExists(hname)) { sf->SourceExtension = *ext; sf->FullPath = hname; return; ----------------------------------------------------------------------- Summary of changes: Source/cmCPluginAPI.cxx | 9 ++++--- Source/cmMakefile.cxx | 69 ++++++++++++++++++++++++----------------------- Source/cmMakefile.h | 14 ++++------ 3 files changed, 45 insertions(+), 47 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu May 3 00:05:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 3 May 2018 00:05:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.1-676-g9575952 Message-ID: <20180503040505.2D92010F0A7@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 95759529967b31b5f72b9775806dbb9d68e01612 (commit) from 5e455ac120fd596a0ad1a4216c5734bb52ac1b75 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=95759529967b31b5f72b9775806dbb9d68e01612 commit 95759529967b31b5f72b9775806dbb9d68e01612 Author: Kitware Robot AuthorDate: Thu May 3 00:01:05 2018 -0400 Commit: Kitware Robot CommitDate: Thu May 3 00:01:05 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index f4d53dc..ba26246 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180502) +set(CMake_VERSION_PATCH 20180503) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu May 3 07:55:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 3 May 2018 07:55:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.1-678-g2d7a086 Message-ID: <20180503115505.AE40F10DA44@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 2d7a0862e41e9240c74f8d1ecef400fbf3f96ba8 (commit) via 7a50425caa4860355bafa8d9600026155f2d27d1 (commit) from 95759529967b31b5f72b9775806dbb9d68e01612 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2d7a0862e41e9240c74f8d1ecef400fbf3f96ba8 commit 2d7a0862e41e9240c74f8d1ecef400fbf3f96ba8 Merge: 9575952 7a50425 Author: Brad King AuthorDate: Thu May 3 11:53:45 2018 +0000 Commit: Kitware Robot CommitDate: Thu May 3 07:54:21 2018 -0400 Merge topic 'doc-server-pipe' 7a50425caa Help: Fix and clarify server mode --pipe= option docs Acked-by: Kitware Robot Merge-request: !2026 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7a50425caa4860355bafa8d9600026155f2d27d1 commit 7a50425caa4860355bafa8d9600026155f2d27d1 Author: Israel Blancas AuthorDate: Tue May 1 20:33:57 2018 +0200 Commit: Brad King CommitDate: Wed May 2 13:10:17 2018 -0400 Help: Fix and clarify server mode --pipe= option docs Document the `=` in the option name. Clarify the term "named pipe" as an abstraction of local domain sockets on Unix and named pipes on Windows. diff --git a/Help/manual/cmake-server.7.rst b/Help/manual/cmake-server.7.rst index 0fed0b1..25d364c 100644 --- a/Help/manual/cmake-server.7.rst +++ b/Help/manual/cmake-server.7.rst @@ -49,10 +49,12 @@ Operation Start :manual:`cmake(1)` in the server command mode, supplying the path to the build directory to process:: - cmake -E server (--debug|--pipe ) + cmake -E server (--debug|--pipe=) The server will communicate using stdin/stdout (with the ``--debug`` parameter) -or using a named pipe (with the ``--pipe `` parameter). +or using a named pipe (with the ``--pipe=`` parameter). Note +that "named pipe" refers to a local domain socket on Unix and to a named pipe +on Windows. When connecting to the server (via named pipe or by starting it in ``--debug`` mode), the server will reply with a hello message:: ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-server.7.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu May 3 08:05:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 3 May 2018 08:05:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.1-680-g1e788a9 Message-ID: <20180503120509.AB32A10F0B7@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 1e788a964d198fc3c135afd053afdefc531bf369 (commit) via 6dd11ffbdea74fae55f17515c9d16dce7bd33c30 (commit) from 2d7a0862e41e9240c74f8d1ecef400fbf3f96ba8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1e788a964d198fc3c135afd053afdefc531bf369 commit 1e788a964d198fc3c135afd053afdefc531bf369 Merge: 2d7a086 6dd11ff Author: Brad King AuthorDate: Thu May 3 11:54:21 2018 +0000 Commit: Kitware Robot CommitDate: Thu May 3 07:55:34 2018 -0400 Merge topic 'doc-build-event-order' 6dd11ffbde Help: Clarify add_custom_command build event execution order Acked-by: Kitware Robot Merge-request: !2030 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6dd11ffbdea74fae55f17515c9d16dce7bd33c30 commit 6dd11ffbdea74fae55f17515c9d16dce7bd33c30 Author: Brad King AuthorDate: Wed May 2 13:19:00 2018 -0400 Commit: Brad King CommitDate: Wed May 2 13:19:00 2018 -0400 Help: Clarify add_custom_command build event execution order Fixes: #17949 diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst index e3fb6b6..5f74c54 100644 --- a/Help/command/add_custom_command.rst +++ b/Help/command/add_custom_command.rst @@ -216,10 +216,9 @@ When the command will happen is determined by which of the following is specified: ``PRE_BUILD`` - Run before any other rules are executed within the target. - This is supported only on Visual Studio 9 or later. - For all other generators ``PRE_BUILD`` will be treated as - ``PRE_LINK``. + On :ref:`Visual Studio Generators`, run before any other rules are + executed within the target. + On other generators, run just before ``PRE_LINK`` commands. ``PRE_LINK`` Run after sources have been compiled but before linking the binary or running the librarian or archiver tool of a static library. ----------------------------------------------------------------------- Summary of changes: Help/command/add_custom_command.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu May 3 08:15:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 3 May 2018 08:15:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.1-689-g593c409 Message-ID: <20180503121505.5813610B72E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 593c409a65a05c4c6427b1e5ca2f4fdb51d4e363 (commit) via 7c2866ec6094cc4d423469f8399c1a34d36ed5c3 (commit) via 7e8046e20b766b5363bc91a1bcae4eae2fc9263b (commit) via c02eeb08536e14c773961f9288b83a950cee6b55 (commit) via edcb545a24ed2df83813a89a20bb2beefe0531c1 (commit) via 0212d7c7629bb1a866da4f6c69b780c6d43f26f3 (commit) via 1c22fdf36037e9c65bad38ee36d346fe7691283b (commit) via cbb609072f00ee6aec3fdfb6e54ed2b3a747e840 (commit) via b81280ba1f5ce36f4cc38fc92409a9696efe7966 (commit) from 1e788a964d198fc3c135afd053afdefc531bf369 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=593c409a65a05c4c6427b1e5ca2f4fdb51d4e363 commit 593c409a65a05c4c6427b1e5ca2f4fdb51d4e363 Merge: 7c2866e 1c22fdf Author: Brad King AuthorDate: Thu May 3 12:13:09 2018 +0000 Commit: Kitware Robot CommitDate: Thu May 3 08:13:16 2018 -0400 Merge topic 'ctest-libuv-linux-sparc64' 1c22fdf360 libuv: linux/sparc64: use fcntl to set and clear O_NONBLOCK Acked-by: Kitware Robot Merge-request: !2029 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7c2866ec6094cc4d423469f8399c1a34d36ed5c3 commit 7c2866ec6094cc4d423469f8399c1a34d36ed5c3 Merge: 1e788a9 7e8046e Author: Brad King AuthorDate: Thu May 3 12:11:02 2018 +0000 Commit: Kitware Robot CommitDate: Thu May 3 08:11:20 2018 -0400 Merge topic 'namelink-component' 7e8046e20b Help: add release notes for NAMELINK_COMPONENT c02eeb0853 Help: clarify "undefined behavior" in install(EXPORT) command edcb545a24 install: add test for new NAMELINK_COMPONENT parameter 0212d7c762 install: add NAMELINK_COMPONENT argument cbb609072f Help: clean up install(TARGETS) documentation b81280ba1f Help: add list of command signatures to top of INSTALL page Acked-by: Kitware Robot Acked-by: Alex Turbov Merge-request: !1982 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7e8046e20b766b5363bc91a1bcae4eae2fc9263b commit 7e8046e20b766b5363bc91a1bcae4eae2fc9263b Author: Kyle Edwards AuthorDate: Wed Apr 18 16:52:37 2018 -0400 Commit: Brad King CommitDate: Thu May 3 08:08:42 2018 -0400 Help: add release notes for NAMELINK_COMPONENT diff --git a/Help/release/dev/namelink-component.rst b/Help/release/dev/namelink-component.rst new file mode 100644 index 0000000..aaeb04f --- /dev/null +++ b/Help/release/dev/namelink-component.rst @@ -0,0 +1,7 @@ +namelink-component +------------------ + +* The :command:`install` command learned an optional ``NAMELINK_COMPONENT`` + parameter, which allows you to change the component for a shared library's + namelink. If none is specified, the value of ``COMPONENT`` is used by + default. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c02eeb08536e14c773961f9288b83a950cee6b55 commit c02eeb08536e14c773961f9288b83a950cee6b55 Author: Kyle Edwards AuthorDate: Fri Apr 20 09:04:47 2018 -0400 Commit: Brad King CommitDate: Thu May 3 08:08:42 2018 -0400 Help: clarify "undefined behavior" in install(EXPORT) command The "undefined behavior" that the install(EXPORT) command warned about was simply the possibility of build errors (or other errors) if the referenced targets aren't installed. As long as the referenced targets are installed, this won't be an issue. diff --git a/Help/command/install.rst b/Help/command/install.rst index 63ba210..a81714f 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -456,11 +456,24 @@ generated import file will reference only the matching target configurations. The ``EXPORT_LINK_INTERFACE_LIBRARIES`` keyword, if present, causes the contents of the properties matching ``(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_)?`` to be exported, when -policy :policy:`CMP0022` is ``NEW``. If a ``COMPONENT`` option is -specified that does not match that given to the targets associated with -```` the behavior is undefined. If a library target is -included in the export but a target to which it links is not included -the behavior is unspecified. +policy :policy:`CMP0022` is ``NEW``. + +When a ``COMPONENT`` option is given, the listed ```` implicitly +depends on all components mentioned in the export set. The exported +``.cmake`` file will require each of the exported components to be +present in order for dependent projects to build properly. For example, a +project may define components ``Runtime`` and ``Development``, with shared +libraries going into the ``Runtime`` component and static libraries and +headers going into the ``Development`` component. The export set would also +typically be part of the ``Development`` component, but it would export +targets from both the ``Runtime`` and ``Development`` components. Therefore, +the ``Runtime`` component would need to be installed if the ``Development`` +component was installed, but not vice versa. If the ``Development`` component +was installed without the ``Runtime`` component, dependent projects that try +to link against it would have build errors. Package managers, such as APT and +RPM, typically handle this by listing the ``Runtime`` component as a dependency +of the ``Development`` component in the package metadata, ensuring that the +library is always installed if the headers and CMake export file are present. In addition to cmake language files, the ``EXPORT_ANDROID_MK`` mode maybe used to specify an export to the android ndk build system. This mode https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=edcb545a24ed2df83813a89a20bb2beefe0531c1 commit edcb545a24ed2df83813a89a20bb2beefe0531c1 Author: Kyle Edwards AuthorDate: Wed Apr 18 15:47:48 2018 -0400 Commit: Brad King CommitDate: Thu May 3 08:08:42 2018 -0400 install: add test for new NAMELINK_COMPONENT parameter diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 6557cc4..690c5b4 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -338,7 +338,13 @@ add_RunCMake_test(CheckIPOSupported) add_RunCMake_test(CommandLine -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) add_RunCMake_test(CommandLineTar) -add_RunCMake_test(install) +if(CMAKE_PLATFORM_NO_VERSIONED_SONAME OR (NOT CMAKE_SHARED_LIBRARY_SONAME_FLAG AND NOT CMAKE_SHARED_LIBRARY_SONAME_C_FLAG)) + set(NO_NAMELINK 1) +else() + set(NO_NAMELINK 0) +endif() + +add_RunCMake_test(install -DNO_NAMELINK=${NO_NAMELINK} -DCYGWIN=${CYGWIN}) add_RunCMake_test(CPackCommandLine) add_RunCMake_test(CPackConfig) add_RunCMake_test(CPackInstallProperties) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index 1a60f0c..f004ce9 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -21,6 +21,10 @@ function(run_install_test case) # Check explicit component. set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root-exc) run_cmake_command(${case}-exc ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -DCOMPONENT=exc -P cmake_install.cmake) + set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root-lib) + run_cmake_command(${case}-lib ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -DCOMPONENT=lib -P cmake_install.cmake) + set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root-dev) + run_cmake_command(${case}-dev ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -DCOMPONENT=dev -P cmake_install.cmake) endif() endfunction() @@ -59,6 +63,8 @@ run_cmake(EXPORT-OldIFace) run_cmake(CMP0062-OLD) run_cmake(CMP0062-NEW) run_cmake(CMP0062-WARN) +run_cmake(TARGETS-NAMELINK_COMPONENT-bad-all) +run_cmake(TARGETS-NAMELINK_COMPONENT-bad-exc) if(NOT RunCMake_GENERATOR STREQUAL "Xcode" OR NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]") run_install_test(FILES-TARGET_OBJECTS) @@ -67,3 +73,4 @@ endif() set(run_install_test_components 1) run_install_test(FILES-EXCLUDE_FROM_ALL) run_install_test(TARGETS-EXCLUDE_FROM_ALL) +run_install_test(TARGETS-NAMELINK_COMPONENT) diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-all-check.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-all-check.cmake new file mode 100644 index 0000000..bc9ebd1 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-all-check.cmake @@ -0,0 +1,73 @@ +if(WIN32) + set(_check_files + [[lib]] + [[lib/(lib)?namelink-none\.dll]] + [[lib/(lib)?namelink-same\.dll]] + [[lib/(lib)?namelink-sep\.dll]] + [[lib/(lib)?namelink-skip\.dll]] + [[lib/(lib)?namelink-uns-dev\.dll]] + [[lib/(lib)?namelink-uns\.dll]] + ) +elseif(CYGWIN) + set(_check_files + [[lib]] + [[lib/cygnamelink-none\.dll]] + [[lib/cygnamelink-same-1\.dll]] + [[lib/cygnamelink-sep-1\.dll]] + [[lib/cygnamelink-skip-1\.dll]] + [[lib/cygnamelink-uns-1\.dll]] + [[lib/cygnamelink-uns-dev-1\.dll]] + ) +elseif(APPLE) + set(_check_files + [[lib]] + [[lib/libnamelink-none\.dylib]] + [[lib/libnamelink-only\.dylib]] + [[lib/libnamelink-same\.1\.0\.dylib]] + [[lib/libnamelink-same\.1\.dylib]] + [[lib/libnamelink-same\.dylib]] + [[lib/libnamelink-sep\.1\.0\.dylib]] + [[lib/libnamelink-sep\.1\.dylib]] + [[lib/libnamelink-sep\.dylib]] + [[lib/libnamelink-skip\.1\.0\.dylib]] + [[lib/libnamelink-skip\.1\.dylib]] + [[lib/libnamelink-uns-dev\.1\.0\.dylib]] + [[lib/libnamelink-uns-dev\.1\.dylib]] + [[lib/libnamelink-uns-dev\.dylib]] + [[lib/libnamelink-uns\.1\.0\.dylib]] + [[lib/libnamelink-uns\.1\.dylib]] + [[lib/libnamelink-uns\.dylib]] + ) +elseif(NO_NAMELINK) + set(_check_files + [[lib]] + [[lib/libnamelink-none\.so]] + [[lib/libnamelink-same\.so]] + [[lib/libnamelink-sep\.so]] + [[lib/libnamelink-skip\.so]] + [[lib/libnamelink-uns-dev\.so]] + [[lib/libnamelink-uns\.so]] + ) +else() + set(_check_files + [[lib]] + [[lib/libnamelink-none\.so]] + [[lib/libnamelink-only\.so]] + [[lib/libnamelink-same\.so]] + [[lib/libnamelink-same\.so\.1]] + [[lib/libnamelink-same\.so\.1\.0]] + [[lib/libnamelink-sep\.so]] + [[lib/libnamelink-sep\.so\.1]] + [[lib/libnamelink-sep\.so\.1\.0]] + [[lib/libnamelink-skip\.so\.1]] + [[lib/libnamelink-skip\.so\.1\.0]] + [[lib/libnamelink-uns-dev\.so]] + [[lib/libnamelink-uns-dev\.so\.1]] + [[lib/libnamelink-uns-dev\.so\.1\.0]] + [[lib/libnamelink-uns\.so]] + [[lib/libnamelink-uns\.so\.1]] + [[lib/libnamelink-uns\.so\.1\.0]] + ) +endif() + +check_installed("^${_check_files}$") diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-result.txt b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-stderr.txt b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-stderr.txt new file mode 100644 index 0000000..187a826 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at TARGETS-NAMELINK_COMPONENT-bad-all\.cmake:5 \(install\): + install TARGETS given NAMELINK_COMPONENT option not in LIBRARY group\. The + NAMELINK_COMPONENT option may be specified only following LIBRARY\. +Call Stack \(most recent call first\): + CMakeLists\.txt:3 \(include\)$ diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all.cmake new file mode 100644 index 0000000..701d093 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all.cmake @@ -0,0 +1,9 @@ +enable_language(C) + +add_library(namelink-lib empty.c) + +install(TARGETS namelink-lib + DESTINATION lib + COMPONENT lib + NAMELINK_COMPONENT dev +) diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-result.txt b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-stderr.txt b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-stderr.txt new file mode 100644 index 0000000..d1002ba --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at TARGETS-NAMELINK_COMPONENT-bad-exc\.cmake:5 \(install\): + install TARGETS given NAMELINK_COMPONENT option not in LIBRARY group\. The + NAMELINK_COMPONENT option may be specified only following LIBRARY\. +Call Stack \(most recent call first\): + CMakeLists\.txt:3 \(include\)$ diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc.cmake new file mode 100644 index 0000000..19c12d4 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc.cmake @@ -0,0 +1,10 @@ +enable_language(C) + +add_executable(namelink-exc main.c) + +install(TARGETS namelink-exc + RUNTIME + DESTINATION bin + COMPONENT exc + NAMELINK_COMPONENT dev +) diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-dev-check.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-dev-check.cmake new file mode 100644 index 0000000..5396cdb --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-dev-check.cmake @@ -0,0 +1,11 @@ +if(WIN32 OR CYGWIN OR NO_NAMELINK) + set(_check_files) +else() + set(_check_files + [[lib]] + [[lib/libnamelink-only\.(so|dylib)]] + [[lib/libnamelink-sep\.(so|dylib)]] + [[lib/libnamelink-uns-dev\.(so|dylib)]] + ) +endif() +check_installed("^${_check_files}$") diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-lib-check.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-lib-check.cmake new file mode 100644 index 0000000..3f6be68 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-lib-check.cmake @@ -0,0 +1,50 @@ +if(WIN32) + set(_check_files + [[lib]] + [[lib/(lib)?namelink-none\.dll]] + [[lib/(lib)?namelink-same\.dll]] + [[lib/(lib)?namelink-sep\.dll]] + [[lib/(lib)?namelink-skip\.dll]] + ) +elseif(CYGWIN) + set(_check_files + [[lib]] + [[lib/cygnamelink-none\.dll]] + [[lib/cygnamelink-same-1\.dll]] + [[lib/cygnamelink-sep-1\.dll]] + [[lib/cygnamelink-skip-1\.dll]] + ) +elseif(APPLE) + set(_check_files + [[lib]] + [[lib/libnamelink-none\.dylib]] + [[lib/libnamelink-same\.1\.0\.dylib]] + [[lib/libnamelink-same\.1\.dylib]] + [[lib/libnamelink-same\.dylib]] + [[lib/libnamelink-sep\.1\.0\.dylib]] + [[lib/libnamelink-sep\.1\.dylib]] + [[lib/libnamelink-skip\.1\.0\.dylib]] + [[lib/libnamelink-skip\.1\.dylib]] + ) +elseif(NO_NAMELINK) + set(_check_files + [[lib]] + [[lib/libnamelink-none\.so]] + [[lib/libnamelink-same\.so]] + [[lib/libnamelink-sep\.so]] + [[lib/libnamelink-skip\.so]] + ) +else() + set(_check_files + [[lib]] + [[lib/libnamelink-none\.so]] + [[lib/libnamelink-same\.so]] + [[lib/libnamelink-same\.so\.1]] + [[lib/libnamelink-same\.so\.1\.0]] + [[lib/libnamelink-sep\.so\.1]] + [[lib/libnamelink-sep\.so\.1\.0]] + [[lib/libnamelink-skip\.so\.1]] + [[lib/libnamelink-skip\.so\.1\.0]] + ) +endif() +check_installed("^${_check_files}$") diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-uns-check.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-uns-check.cmake new file mode 100644 index 0000000..0033c88 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-uns-check.cmake @@ -0,0 +1,38 @@ +if(WIN32) + set(_check_files + [[lib]] + [[lib/(lib)?namelink-uns-dev\.dll]] + [[lib/(lib)?namelink-uns\.dll]] + ) +elseif(CYGWIN) + set(_check_files + [[lib]] + [[lib/cygnamelink-uns-1\.dll]] + [[lib/cygnamelink-uns-dev-1\.dll]] + ) +elseif(APPLE) + set(_check_files + [[lib]] + [[lib/libnamelink-uns-dev\.1\.0\.dylib]] + [[lib/libnamelink-uns-dev\.1\.dylib]] + [[lib/libnamelink-uns\.1\.0\.dylib]] + [[lib/libnamelink-uns\.1\.dylib]] + [[lib/libnamelink-uns\.dylib]] + ) +elseif(NO_NAMELINK) + set(_check_files + [[lib]] + [[lib/libnamelink-uns-dev\.so]] + [[lib/libnamelink-uns\.so]] + ) +else() + set(_check_files + [[lib]] + [[lib/libnamelink-uns-dev\.so\.1]] + [[lib/libnamelink-uns-dev\.so\.1\.0]] + [[lib/libnamelink-uns\.so]] + [[lib/libnamelink-uns\.so\.1]] + [[lib/libnamelink-uns\.so\.1\.0]] + ) +endif() +check_installed("^${_check_files}$") diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT.cmake new file mode 100644 index 0000000..0e684e1 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT.cmake @@ -0,0 +1,68 @@ +enable_language(C) + +macro(add_versioned_library NAME) + add_library(${NAME} SHARED obj1.c) + set_target_properties(${NAME} PROPERTIES + VERSION 1.0 + SOVERSION 1 + ) +endmacro() + +add_versioned_library(namelink-sep) +add_versioned_library(namelink-same) +add_versioned_library(namelink-uns) +add_versioned_library(namelink-uns-dev) +add_versioned_library(namelink-only) +add_versioned_library(namelink-skip) +add_library(namelink-none SHARED obj1.c) + +install(TARGETS namelink-sep namelink-none + RUNTIME + DESTINATION lib + COMPONENT lib + LIBRARY + DESTINATION lib + COMPONENT lib + NAMELINK_COMPONENT dev +) +install(TARGETS namelink-same + RUNTIME + DESTINATION lib + COMPONENT lib + LIBRARY + DESTINATION lib + COMPONENT lib +) +install(TARGETS namelink-uns + RUNTIME + DESTINATION lib + LIBRARY + DESTINATION lib +) +install(TARGETS namelink-uns-dev + RUNTIME + DESTINATION lib + LIBRARY + DESTINATION lib + NAMELINK_COMPONENT dev +) +install(TARGETS namelink-only + RUNTIME + DESTINATION lib + COMPONENT lib + LIBRARY + DESTINATION lib + COMPONENT lib + NAMELINK_COMPONENT dev + NAMELINK_ONLY +) +install(TARGETS namelink-skip + RUNTIME + DESTINATION lib + COMPONENT lib + LIBRARY + DESTINATION lib + COMPONENT lib + NAMELINK_COMPONENT dev + NAMELINK_SKIP +) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0212d7c7629bb1a866da4f6c69b780c6d43f26f3 commit 0212d7c7629bb1a866da4f6c69b780c6d43f26f3 Author: Kyle Edwards AuthorDate: Wed Apr 18 14:53:10 2018 -0400 Commit: Brad King CommitDate: Thu May 3 08:08:37 2018 -0400 install: add NAMELINK_COMPONENT argument For shared libraries, this allows you to specify separate components for the shared library and for the namelink. Suggested in https://cmake.org/pipermail/cmake-developers/2014-December/024032.html. diff --git a/Help/command/install.rst b/Help/command/install.rst index 1037edf..63ba210 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -103,6 +103,7 @@ Installing Targets [PERMISSIONS permissions...] [CONFIGURATIONS [Debug|Release|...]] [COMPONENT ] + [NAMELINK_COMPONENT ] [OPTIONAL] [EXCLUDE_FROM_ALL] [NAMELINK_ONLY|NAMELINK_SKIP] ] [...] @@ -167,7 +168,7 @@ just a DLL or just an import library.) In addition to the common options listed above, each target can accept the following additional arguments: -``NAMELINK_ONLY`` +``NAMELINK_COMPONENT`` On some platforms a versioned shared library has a symbolic link such as:: @@ -175,13 +176,51 @@ the following additional arguments: where ``lib.so.1`` is the soname of the library and ``lib.so`` is a "namelink" allowing linkers to find the library when given - ``-l``. The ``NAMELINK_ONLY`` option causes the installation of only - the namelink when a library target is installed. On platforms where - versioned shared libraries do not have namelinks or when a library is not - versioned, the ``NAMELINK_ONLY`` option installs nothing. It is an error to - use this parameter outside of a ``LIBRARY`` block. See the - :prop_tgt:`VERSION` and :prop_tgt:`SOVERSION` target properties for details - on creating versioned shared libraries. + ``-l``. The ``NAMELINK_COMPONENT`` option is similar to the + ``COMPONENT`` option, but it changes the installation component of a shared + library namelink if one is generated. If not specified, this defaults to the + value of ``COMPONENT``. It is an error to use this parameter outside of a + ``LIBRARY`` block. + + Consider the following example: + + .. code-block:: cmake + + install(TARGETS mylib + LIBRARY + DESTINATION lib + COMPONENT Libraries + NAMELINK_COMPONENT Development + PUBLIC_HEADER + DESTINATION include + COMPONENT Development + ) + + In this scenario, if you choose to install only the ``Development`` + component, both the headers and namelink will be installed without the + library. (If you don't also install the ``Libraries`` component, the + namelink will be a dangling symlink, and projects that link to the library + will have build errors.) If you install only the ``Libraries`` component, + only the library will be installed, without the headers and namelink. + + This option is typically used for package managers that have separate + runtime and development packages. For example, on Debian systems, the + library is expected to be in the runtime package, and the headers and + namelink are expected to be in the development package. + + See the :prop_tgt:`VERSION` and :prop_tgt:`SOVERSION` target properties for + details on creating versioned shared libraries. + +``NAMELINK_ONLY`` + This option causes the installation of only the namelink when a library + target is installed. On platforms where versioned shared libraries do not + have namelinks or when a library is not versioned, the ``NAMELINK_ONLY`` + option installs nothing. It is an error to use this parameter outside of a + ``LIBRARY`` block. + + When ``NAMELINK_ONLY`` is given, either ``NAMELINK_COMPONENT`` or + ``COMPONENT`` may be used to specify the installation component of the + namelink, but ``COMPONENT`` should generally be preferred. ``NAMELINK_SKIP`` Similar to ``NAMELINK_ONLY``, but it has the opposite effect: it causes the @@ -192,6 +231,10 @@ the following additional arguments: installs the library. It is an error to use this parameter outside of a ``LIBRARY`` block. + If ``NAMELINK_SKIP`` is specified, ``NAMELINK_COMPONENT`` has no effect. It + is not recommended to use ``NAMELINK_SKIP`` in conjunction with + ``NAMELINK_COMPONENT``. + The ``install(TARGETS)`` command can also accept the following options at the top level: diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index b5291a1..b325b0c 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -33,16 +33,17 @@ class cmExecutionStatus; static cmInstallTargetGenerator* CreateInstallTargetGenerator( cmTarget& target, const cmInstallCommandArguments& args, bool impLib, - bool forceOpt = false) + bool forceOpt = false, bool namelink = false) { cmInstallGenerator::MessageLevel message = cmInstallGenerator::SelectMessageLevel(target.GetMakefile()); target.SetHaveInstallRule(true); + const char* component = namelink ? args.GetNamelinkComponent().c_str() + : args.GetComponent().c_str(); return new cmInstallTargetGenerator( target.GetName(), args.GetDestination().c_str(), impLib, - args.GetPermissions().c_str(), args.GetConfigurations(), - args.GetComponent().c_str(), message, args.GetExcludeFromAll(), - args.GetOptional() || forceOpt); + args.GetPermissions().c_str(), args.GetConfigurations(), component, + message, args.GetExcludeFromAll(), args.GetOptional() || forceOpt); } static cmInstallFilesGenerator* CreateInstallFilesGenerator( @@ -313,6 +314,20 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) "The NAMELINK_SKIP option may be specified only following LIBRARY."); return false; } + if (archiveArgs.HasNamelinkComponent() || + runtimeArgs.HasNamelinkComponent() || + objectArgs.HasNamelinkComponent() || + frameworkArgs.HasNamelinkComponent() || + bundleArgs.HasNamelinkComponent() || + privateHeaderArgs.HasNamelinkComponent() || + publicHeaderArgs.HasNamelinkComponent() || + resourceArgs.HasNamelinkComponent()) { + this->SetError( + "TARGETS given NAMELINK_COMPONENT option not in LIBRARY group. " + "The NAMELINK_COMPONENT option may be specified only following " + "LIBRARY."); + return false; + } if (libraryArgs.GetNamelinkOnly() && libraryArgs.GetNamelinkSkip()) { this->SetError("TARGETS given NAMELINK_ONLY and NAMELINK_SKIP. " "At most one of these two options may be specified."); @@ -377,6 +392,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) // any files of the given type. bool installsArchive = false; bool installsLibrary = false; + bool installsNamelink = false; bool installsRuntime = false; bool installsObject = false; bool installsFramework = false; @@ -391,6 +407,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) cmTarget& target = *ti; cmInstallTargetGenerator* archiveGenerator = nullptr; cmInstallTargetGenerator* libraryGenerator = nullptr; + cmInstallTargetGenerator* namelinkGenerator = nullptr; cmInstallTargetGenerator* runtimeGenerator = nullptr; cmInstallTargetGenerator* objectGenerator = nullptr; cmInstallTargetGenerator* frameworkGenerator = nullptr; @@ -453,9 +470,18 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) } else { // The shared library uses the LIBRARY properties. if (!libraryArgs.GetDestination().empty()) { - libraryGenerator = - CreateInstallTargetGenerator(target, libraryArgs, false); - libraryGenerator->SetNamelinkMode(namelinkMode); + if (namelinkMode != cmInstallTargetGenerator::NamelinkModeOnly) { + libraryGenerator = + CreateInstallTargetGenerator(target, libraryArgs, false); + libraryGenerator->SetNamelinkMode( + cmInstallTargetGenerator::NamelinkModeSkip); + } + if (namelinkMode != cmInstallTargetGenerator::NamelinkModeSkip) { + namelinkGenerator = CreateInstallTargetGenerator( + target, libraryArgs, false, false, true); + namelinkGenerator->SetNamelinkMode( + cmInstallTargetGenerator::NamelinkModeOnly); + } namelinkOnly = (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly); } else { @@ -684,6 +710,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) // Keep track of whether we're installing anything in each category installsArchive = installsArchive || archiveGenerator != nullptr; installsLibrary = installsLibrary || libraryGenerator != nullptr; + installsNamelink = installsNamelink || namelinkGenerator != nullptr; installsRuntime = installsRuntime || runtimeGenerator != nullptr; installsObject = installsObject || objectGenerator != nullptr; installsFramework = installsFramework || frameworkGenerator != nullptr; @@ -696,6 +723,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) this->Makefile->AddInstallGenerator(archiveGenerator); this->Makefile->AddInstallGenerator(libraryGenerator); + this->Makefile->AddInstallGenerator(namelinkGenerator); this->Makefile->AddInstallGenerator(runtimeGenerator); this->Makefile->AddInstallGenerator(objectGenerator); this->Makefile->AddInstallGenerator(frameworkGenerator); @@ -735,6 +763,10 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) this->Makefile->GetGlobalGenerator()->AddInstallComponent( libraryArgs.GetComponent().c_str()); } + if (installsNamelink) { + this->Makefile->GetGlobalGenerator()->AddInstallComponent( + libraryArgs.GetNamelinkComponent().c_str()); + } if (installsRuntime) { this->Makefile->GetGlobalGenerator()->AddInstallComponent( runtimeArgs.GetComponent().c_str()); diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx index 7b79ab5..2d6dc12 100644 --- a/Source/cmInstallCommandArguments.cxx +++ b/Source/cmInstallCommandArguments.cxx @@ -21,6 +21,7 @@ cmInstallCommandArguments::cmInstallCommandArguments( , ArgumentGroup() , Destination(&Parser, "DESTINATION", &ArgumentGroup) , Component(&Parser, "COMPONENT", &ArgumentGroup) + , NamelinkComponent(&Parser, "NAMELINK_COMPONENT", &ArgumentGroup) , ExcludeFromAll(&Parser, "EXCLUDE_FROM_ALL", &ArgumentGroup) , Rename(&Parser, "RENAME", &ArgumentGroup) , Permissions(&Parser, "PERMISSIONS", &ArgumentGroup) @@ -59,6 +60,14 @@ const std::string& cmInstallCommandArguments::GetComponent() const return unspecifiedComponent; } +const std::string& cmInstallCommandArguments::GetNamelinkComponent() const +{ + if (!this->NamelinkComponent.GetString().empty()) { + return this->NamelinkComponent.GetString(); + } + return this->GetComponent(); +} + const std::string& cmInstallCommandArguments::GetRename() const { if (!this->Rename.GetString().empty()) { @@ -125,6 +134,17 @@ bool cmInstallCommandArguments::GetNamelinkSkip() const return false; } +bool cmInstallCommandArguments::HasNamelinkComponent() const +{ + if (!this->NamelinkComponent.GetString().empty()) { + return true; + } + if (this->GenericArguments != nullptr) { + return this->GenericArguments->HasNamelinkComponent(); + } + return false; +} + const std::vector& cmInstallCommandArguments::GetConfigurations() const { diff --git a/Source/cmInstallCommandArguments.h b/Source/cmInstallCommandArguments.h index a576e72..ee6e865 100644 --- a/Source/cmInstallCommandArguments.h +++ b/Source/cmInstallCommandArguments.h @@ -26,6 +26,7 @@ public: const std::string& GetDestination() const; const std::string& GetComponent() const; + const std::string& GetNamelinkComponent() const; bool GetExcludeFromAll() const; const std::string& GetRename() const; const std::string& GetPermissions() const; @@ -33,6 +34,7 @@ public: bool GetOptional() const; bool GetNamelinkOnly() const; bool GetNamelinkSkip() const; + bool HasNamelinkComponent() const; // once HandleDirectoryMode() is also switched to using // cmInstallCommandArguments then these two functions can become non-static @@ -45,6 +47,7 @@ private: cmInstallCommandArguments(); // disabled cmCAString Destination; cmCAString Component; + cmCAString NamelinkComponent; cmCAEnabler ExcludeFromAll; cmCAString Rename; cmCAStringVector Permissions; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1c22fdf36037e9c65bad38ee36d346fe7691283b commit 1c22fdf36037e9c65bad38ee36d346fe7691283b Author: Brad King AuthorDate: Wed May 2 10:59:09 2018 -0400 Commit: Brad King CommitDate: Wed May 2 11:16:19 2018 -0400 libuv: linux/sparc64: use fcntl to set and clear O_NONBLOCK Upstream libuv commits: * node-v0.6.0~28 (linux: use ioctl(FIONBIO) to set O_NONBLOCK, saves a syscall, 2011-10-29) * v1.11.0~11 (unix: use async-signal safe functions between fork and exec, 2016-12-12) left an asymmetry in the way O_NONBLOCK is set and cleared. Normally ioctl/FIONBIO is used for both. However, uv_spawn uses fcntl/O_NONBLOCK to clear O_NONBLOCK between fork and exec. This fails on Linux/sparc64 where setting via ioctl/FIONBIO actually sets two bits (in O_NDELAY) that cause clearing via fcntl/O_NONBLOCK to be silently ignored (though clearing via ioctl/FIONBIO or fcntl/O_NDELAY works). Since CMake commit v3.11.0-rc1~117^2 (CTest: Re-implement test process handling using libuv, 2017-12-10), CTest uses libuv. On Linux/sparc64 child processes have been started with non-blocking output pipes. This can lead to write errors or lost output from children not prepared to deal with `EAGAIN` on stdout or stderr. Fix this for now by switching libuv back to fcntl/O_NONBLOCK to set and clear O_NONBLOCK when compiled on Linux/sparc64. LibUV-Issue: 1830 Fixes: #17941 diff --git a/Utilities/cmlibuv/src/unix/internal.h b/Utilities/cmlibuv/src/unix/internal.h index 9cc87f0..668e576 100644 --- a/Utilities/cmlibuv/src/unix/internal.h +++ b/Utilities/cmlibuv/src/unix/internal.h @@ -184,7 +184,7 @@ struct uv__stream_queued_fds_s { defined(__DragonFly__) || \ defined(__FreeBSD__) || \ defined(__FreeBSD_kernel__) || \ - defined(__linux__) || \ + (defined(__linux__) && !defined(__sparc__)) || \ defined(__OpenBSD__) || \ defined(__NetBSD__) #define uv__cloexec uv__cloexec_ioctl https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cbb609072f00ee6aec3fdfb6e54ed2b3a747e840 commit cbb609072f00ee6aec3fdfb6e54ed2b3a747e840 Author: Kyle Edwards AuthorDate: Thu Apr 19 11:28:30 2018 -0400 Commit: Kyle Edwards CommitDate: Mon Apr 30 09:14:44 2018 -0400 Help: clean up install(TARGETS) documentation The documentation for install(TARGETS) has been rearranged so that the options are presented as a list, for better readability and maintenance. diff --git a/Help/command/install.rst b/Help/command/install.rst index b11b35a..1037edf 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -110,63 +110,102 @@ Installing Targets ) The ``TARGETS`` form specifies rules for installing targets from a -project. There are six kinds of target files that may be installed: -``ARCHIVE``, ``LIBRARY``, ``RUNTIME``, ``OBJECTS``, ``FRAMEWORK``, and -``BUNDLE``. Executables are treated as ``RUNTIME`` targets, except that -those marked with the ``MACOSX_BUNDLE`` property are treated as ``BUNDLE`` -targets on OS X. Static libraries are treated as ``ARCHIVE`` targets, -except that those marked with the ``FRAMEWORK`` property are treated -as ``FRAMEWORK`` targets on OS X. -Module libraries are always treated as ``LIBRARY`` targets. -For non-DLL platforms shared libraries are treated as ``LIBRARY`` -targets, except that those marked with the ``FRAMEWORK`` property are -treated as ``FRAMEWORK`` targets on OS X. For DLL platforms the DLL -part of a shared library is treated as a ``RUNTIME`` target and the -corresponding import library is treated as an ``ARCHIVE`` target. -All Windows-based systems including Cygwin are DLL platforms. Object -libraries are always treated as ``OBJECTS`` targets. -The ``ARCHIVE``, ``LIBRARY``, ``RUNTIME``, ``OBJECTS``, and ``FRAMEWORK`` -arguments change the type of target to which the subsequent properties -apply. If none is given the installation properties apply to all target -types. If only one is given then only targets of that type will be -installed (which can be used to install just a DLL or just an import -library). - -The ``PRIVATE_HEADER``, ``PUBLIC_HEADER``, and ``RESOURCE`` arguments -cause subsequent properties to be applied to installing a ``FRAMEWORK`` -shared library target's associated files on non-Apple platforms. Rules -defined by these arguments are ignored on Apple platforms because the -associated files are installed into the appropriate locations inside -the framework folder. See documentation of the -:prop_tgt:`PRIVATE_HEADER`, :prop_tgt:`PUBLIC_HEADER`, and -:prop_tgt:`RESOURCE` target properties for details. - -Either ``NAMELINK_ONLY`` or ``NAMELINK_SKIP`` may be specified as a -``LIBRARY`` option. On some platforms a versioned shared library -has a symbolic link such as:: - - lib.so -> lib.so.1 - -where ``lib.so.1`` is the soname of the library and ``lib.so`` -is a "namelink" allowing linkers to find the library when given -``-l``. The ``NAMELINK_ONLY`` option causes installation of only the -namelink when a library target is installed. The ``NAMELINK_SKIP`` option -causes installation of library files other than the namelink when a -library target is installed. When neither option is given both -portions are installed. On platforms where versioned shared libraries -do not have namelinks or when a library is not versioned the -``NAMELINK_SKIP`` option installs the library and the ``NAMELINK_ONLY`` -option installs nothing. See the :prop_tgt:`VERSION` and -:prop_tgt:`SOVERSION` target properties for details on creating versioned -shared libraries. - -The ``INCLUDES DESTINATION`` specifies a list of directories -which will be added to the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` -target property of the ```` when exported by the -:command:`install(EXPORT)` command. If a relative path is -specified, it is treated as relative to the ``$``. -This is independent of the rest of the argument groups and does -not actually install anything. +project. There are several kinds of target files that may be installed: + +``ARCHIVE`` + Static libraries are treated as ``ARCHIVE`` targets, except those + marked with the ``FRAMEWORK`` property on OS X (see ``FRAMEWORK`` + below.) For DLL platforms (all Windows-based systems including + Cygwin), the DLL import library is treated as an ``ARCHIVE`` target. + +``LIBRARY`` + Module libraries are always treated as ``LIBRARY`` targets. For non- + DLL platforms shared libraries are treated as ``LIBRARY`` targets, + except those marked with the ``FRAMEWORK`` property on OS X (see + ``FRAMEWORK`` below.) + +``RUNTIME`` + Executables are treated as ``RUNTIME`` objects, except those marked + with the ``MACOSX_BUNDLE`` property on OS X (see ``BUNDLE`` below.) + For DLL platforms (all Windows-based systems including Cygwin), the + DLL part of a shared library is treated as a ``RUNTIME`` target. + +``OBJECTS`` + Object libraries (a simple group of object files) are always treated + as ``OBJECTS`` targets. + +``FRAMEWORK`` + Both static and shared libraries marked with the ``FRAMEWORK`` + property are treated as ``FRAMEWORK`` targets on OS X. + +``BUNDLE`` + Executables marked with the ``MACOSX_BUNDLE`` property are treated as + ``BUNDLE`` targets on OS X. + +``PUBLIC_HEADER`` + Any ``PUBLIC_HEADER`` files associated with a library are installed in + the destination specified by the ``PUBLIC_HEADER`` argument on non-Apple + platforms. Rules defined by this argument are ignored for ``FRAMEWORK`` + libraries on Apple platforms because the associated files are installed + into the appropriate locations inside the framework folder. See + :prop_tgt:`PUBLIC_HEADER` for details. + +``PRIVATE_HEADER`` + Similar to ``PUBLIC_HEADER``, but for ``PRIVATE_HEADER`` files. See + :prop_tgt:`PRIVATE_HEADER` for details. + +``RESOURCE`` + Similar to ``PUBLIC_HEADER`` and ``PRIVATE_HEADER``, but for + ``RESOURCE`` files. See :prop_tgt:`RESOURCE` for details. + +For each of these arguments given, the arguments following them only apply +to the target or file type specified in the argument. If none is given, the +installation properties apply to all target types. If only one is given then +only targets of that type will be installed (which can be used to install +just a DLL or just an import library.) + +In addition to the common options listed above, each target can accept +the following additional arguments: + +``NAMELINK_ONLY`` + On some platforms a versioned shared library has a symbolic link such + as:: + + lib.so -> lib.so.1 + + where ``lib.so.1`` is the soname of the library and ``lib.so`` + is a "namelink" allowing linkers to find the library when given + ``-l``. The ``NAMELINK_ONLY`` option causes the installation of only + the namelink when a library target is installed. On platforms where + versioned shared libraries do not have namelinks or when a library is not + versioned, the ``NAMELINK_ONLY`` option installs nothing. It is an error to + use this parameter outside of a ``LIBRARY`` block. See the + :prop_tgt:`VERSION` and :prop_tgt:`SOVERSION` target properties for details + on creating versioned shared libraries. + +``NAMELINK_SKIP`` + Similar to ``NAMELINK_ONLY``, but it has the opposite effect: it causes the + installation of library files other than the namelink when a library target + is installed. When neither ``NAMELINK_ONLY`` or ``NAMELINK_SKIP`` are given, + both portions are installed. On platforms where versioned shared libraries + do not have symlinks or when a library is not versioned, ``NAMELINK_SKIP`` + installs the library. It is an error to use this parameter outside of a + ``LIBRARY`` block. + +The ``install(TARGETS)`` command can also accept the following options at the +top level: + +``EXPORT`` + This option associates the installed target files with an export called + ````. It must appear before any target options. To actually + install the export file itself, call ``install(EXPORT)``, documented below. + +``INCLUDES DESTINATION`` + This option specifies a list of directories which will be added to the + :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` target property of the + ```` when exported by the :command:`install(EXPORT)` command. If a + relative path is specified, it is treated as relative to the + ``$``. One or more groups of properties may be specified in a single call to the ``TARGETS`` form of this command. A target may be installed more than @@ -188,11 +227,6 @@ the ``mySharedLib`` DLL will be installed to ``/bin`` and ``/some/full/path`` and its import library will be installed to ``/lib/static`` and ``/some/full/path``. -The ``EXPORT`` option associates the installed target files with an -export called ````. It must appear before any ``RUNTIME``, -``LIBRARY``, ``ARCHIVE``, or ``OBJECTS`` options. To actually install the -export file itself, call ``install(EXPORT)``, documented below. - :ref:`Interface Libraries` may be listed among the targets to install. They install no artifacts but will be included in an associated ``EXPORT``. If :ref:`Object Libraries` are listed but given no destination for their https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b81280ba1f5ce36f4cc38fc92409a9696efe7966 commit b81280ba1f5ce36f4cc38fc92409a9696efe7966 Author: Kyle Edwards AuthorDate: Mon Apr 30 09:02:43 2018 -0400 Commit: Kyle Edwards CommitDate: Mon Apr 30 09:14:35 2018 -0400 Help: add list of command signatures to top of INSTALL page diff --git a/Help/command/install.rst b/Help/command/install.rst index d3818d6..b11b35a 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -7,6 +7,14 @@ install Specify rules to run at install time. +This command accepts several signatures: + +* :ref:`install(TARGETS) ` +* :ref:`install(FILES|PROGRAMS) ` +* :ref:`install(DIRECTORY) ` +* :ref:`install(SCRIPT|CODE) ` +* :ref:`install(EXPORT|EXPORT_ANDROID_MK) ` + Introduction ^^^^^^^^^^^^ @@ -81,6 +89,8 @@ Command signatures that install files may print messages during installation. Use the :variable:`CMAKE_INSTALL_MESSAGE` variable to control which messages are printed. +.. _install-targets: + Installing Targets ^^^^^^^^^^^^^^^^^^ @@ -197,6 +207,8 @@ The install destination given to the target install ``DESTINATION`` may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. +.. _install-files: + Installing Files ^^^^^^^^^^^^^^^^ @@ -230,6 +242,8 @@ The install destination given to the files install ``DESTINATION`` may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. +.. _install-directory: + Installing Directories ^^^^^^^^^^^^^^^^^^^^^^ @@ -311,6 +325,8 @@ given to the directory install ``DESTINATION`` may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. +.. _install-script: + Custom Installation Logic ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -332,6 +348,8 @@ example, the code will print a message during installation. +.. _install-export: + Installing Exports ^^^^^^^^^^^^^^^^^^ ----------------------------------------------------------------------- Summary of changes: Help/command/install.rst | 242 ++++++++++++++------ Help/release/dev/namelink-component.rst | 7 + Source/cmInstallCommand.cxx | 46 +++- Source/cmInstallCommandArguments.cxx | 20 ++ Source/cmInstallCommandArguments.h | 3 + Tests/RunCMake/CMakeLists.txt | 8 +- Tests/RunCMake/install/RunCMakeTest.cmake | 7 + .../TARGETS-NAMELINK_COMPONENT-all-check.cmake | 73 ++++++ .../TARGETS-NAMELINK_COMPONENT-bad-all-result.txt} | 0 .../TARGETS-NAMELINK_COMPONENT-bad-all-stderr.txt | 5 + .../TARGETS-NAMELINK_COMPONENT-bad-all.cmake | 9 + .../TARGETS-NAMELINK_COMPONENT-bad-exc-result.txt} | 0 .../TARGETS-NAMELINK_COMPONENT-bad-exc-stderr.txt | 5 + .../TARGETS-NAMELINK_COMPONENT-bad-exc.cmake | 10 + .../TARGETS-NAMELINK_COMPONENT-dev-check.cmake | 11 + .../TARGETS-NAMELINK_COMPONENT-lib-check.cmake | 50 ++++ .../TARGETS-NAMELINK_COMPONENT-uns-check.cmake | 38 +++ .../install/TARGETS-NAMELINK_COMPONENT.cmake | 68 ++++++ Utilities/cmlibuv/src/unix/internal.h | 2 +- 19 files changed, 528 insertions(+), 76 deletions(-) create mode 100644 Help/release/dev/namelink-component.rst create mode 100644 Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-all-check.cmake copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => install/TARGETS-NAMELINK_COMPONENT-bad-all-result.txt} (100%) create mode 100644 Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-stderr.txt create mode 100644 Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all.cmake copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => install/TARGETS-NAMELINK_COMPONENT-bad-exc-result.txt} (100%) create mode 100644 Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-stderr.txt create mode 100644 Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc.cmake create mode 100644 Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-dev-check.cmake create mode 100644 Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-lib-check.cmake create mode 100644 Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-uns-check.cmake create mode 100644 Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Thu May 3 08:25:03 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 3 May 2018 08:25:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.1-691-gf1aedbf Message-ID: <20180503122503.62CD610F1A7@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via f1aedbf99acf21bbe9f2d766be8d159bd397cc89 (commit) via 5089d950c314a1923c05ee6bed43d64fc4f7e5cf (commit) from 593c409a65a05c4c6427b1e5ca2f4fdb51d4e363 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f1aedbf99acf21bbe9f2d766be8d159bd397cc89 commit f1aedbf99acf21bbe9f2d766be8d159bd397cc89 Merge: 593c409 5089d95 Author: Brad King AuthorDate: Thu May 3 08:15:19 2018 -0400 Commit: Brad King CommitDate: Thu May 3 08:15:19 2018 -0400 Merge branch 'release-3.11' ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Thu May 3 08:25:03 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 3 May 2018 08:25:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.11.1-17-g5089d95 Message-ID: <20180503122503.7FDE710F1AA@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via 5089d950c314a1923c05ee6bed43d64fc4f7e5cf (commit) via 1c22fdf36037e9c65bad38ee36d346fe7691283b (commit) from 321442580e5a082ff52dba24237e89b355bc55b6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Utilities/cmlibuv/src/unix/internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu May 3 17:25:07 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 3 May 2018 17:25:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.1-693-g7de29da Message-ID: <20180503212507.72F7B10EA1B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 7de29da7c49da68aee421c646a676422f3b9d563 (commit) via af1c48871cedc29eb0dc773556c606c670df55ee (commit) from f1aedbf99acf21bbe9f2d766be8d159bd397cc89 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7de29da7c49da68aee421c646a676422f3b9d563 commit 7de29da7c49da68aee421c646a676422f3b9d563 Merge: f1aedbf af1c488 Author: Craig Scott AuthorDate: Thu May 3 21:17:33 2018 +0000 Commit: Kitware Robot CommitDate: Thu May 3 17:18:38 2018 -0400 Merge topic 'feature/cpack-default-package-version' af1c48871c CPack: Use project version as default for `CPACK_PACKAGE_VERSION` Acked-by: Kitware Robot Acked-by: Harry Mallon Merge-request: !2020 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=af1c48871cedc29eb0dc773556c606c670df55ee commit af1c48871cedc29eb0dc773556c606c670df55ee Author: Alex Turbov AuthorDate: Sun Apr 29 17:09:40 2018 +0300 Commit: Craig Scott CommitDate: Thu May 3 08:26:03 2018 +1000 CPack: Use project version as default for `CPACK_PACKAGE_VERSION` * Introduce `CMAKE_PROJECT_VERSION` and the corresponsing components: `CMAKE_PROJECT_VERSION_MAJOR`, `CMAKE_PROJECT_VERSION_MINOR`, `CMAKE_PROJECT_VERSION_PATCH` and `CMAKE_PROJECT_VERSION_TWEAK`. * `CPack` module use `CMAKE_PROJECT_VERSION_MAJOR`, `CMAKE_PROJECT_VERSION_MINOR` and `CMAKE_PROJECT_VERSION_PATCH` to initialize corresponsing CPack variables. diff --git a/Help/command/project.rst b/Help/command/project.rst index e46dd69..c1de057 100644 --- a/Help/command/project.rst +++ b/Help/command/project.rst @@ -76,8 +76,9 @@ call exists CMake will implicitly add one to the top that enables the default languages (``C`` and ``CXX``). The name of the project set in the top level ``CMakeLists.txt`` file is available from the :variable:`CMAKE_PROJECT_NAME` variable, its description from -:variable:`CMAKE_PROJECT_DESCRIPTION` and its homepage URL from -:variable:`CMAKE_PROJECT_HOMEPAGE_URL`. +:variable:`CMAKE_PROJECT_DESCRIPTION`, its homepage URL from +:variable:`CMAKE_PROJECT_HOMEPAGE_URL` and its version from +:variable:`CMAKE_PROJECT_VERSION`. .. note:: Call the :command:`cmake_minimum_required` command at the beginning diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 44271c1..7636305 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -69,6 +69,11 @@ Variables that Provide Information /variable/CMAKE_PROJECT_DESCRIPTION /variable/CMAKE_PROJECT_HOMEPAGE_URL /variable/CMAKE_PROJECT_NAME + /variable/CMAKE_PROJECT_VERSION + /variable/CMAKE_PROJECT_VERSION_MAJOR + /variable/CMAKE_PROJECT_VERSION_MINOR + /variable/CMAKE_PROJECT_VERSION_PATCH + /variable/CMAKE_PROJECT_VERSION_TWEAK /variable/CMAKE_RANLIB /variable/CMAKE_ROOT /variable/CMAKE_SCRIPT_MODE_FILE diff --git a/Help/release/dev/cpack-use-project-version.rst b/Help/release/dev/cpack-use-project-version.rst new file mode 100644 index 0000000..b17754a --- /dev/null +++ b/Help/release/dev/cpack-use-project-version.rst @@ -0,0 +1,10 @@ +cpack-use-project-version +------------------------- + +* Introduce :variable:`CMAKE_PROJECT_VERSION` and the corresponding components: + :variable:`CMAKE_PROJECT_VERSION_MAJOR`, :variable:`CMAKE_PROJECT_VERSION_MINOR`, + :variable:`CMAKE_PROJECT_VERSION_PATCH` and :variable:`CMAKE_PROJECT_VERSION_TWEAK`. + +* :module:`CPack` module use :variable:`CMAKE_PROJECT_VERSION_MAJOR`, + :variable:`CMAKE_PROJECT_VERSION_MINOR` and :variable:`CMAKE_PROJECT_VERSION_PATCH` + to initialize corresponding CPack variables. diff --git a/Help/variable/CMAKE_PROJECT_VERSION.rst b/Help/variable/CMAKE_PROJECT_VERSION.rst new file mode 100644 index 0000000..4f8f556 --- /dev/null +++ b/Help/variable/CMAKE_PROJECT_VERSION.rst @@ -0,0 +1,35 @@ +CMAKE_PROJECT_VERSION +--------------------- + +The version of the top level project. + +This variable holds the version of the project as specified in the top +level CMakeLists.txt file by a :command:`project` command. In the event that +the top level CMakeLists.txt contains multiple :command:`project` calls, +the most recently called one from that top level CMakeLists.txt will determine +the value that ``CMAKE_PROJECT_VERSION`` contains. For example, consider +the following top level CMakeLists.txt: + +.. code-block:: cmake + + cmake_minimum_required(VERSION 3.0) + project(First VERSION 1.2.3) + project(Second VERSION 3.4.5) + add_subdirectory(sub) + project(Third VERSION 6.7.8) + +And ``sub/CMakeLists.txt`` with the following contents: + +.. code-block:: cmake + + project(SubProj VERSION 1) + message("CMAKE_PROJECT_VERSION = ${CMAKE_PROJECT_VERSION}") + +The most recently seen :command:`project` command from the top level +CMakeLists.txt would be ``project(Second ...)``, so this will print:: + + CMAKE_PROJECT_VERSION = 3.4.5 + +To obtain the version from the most recent call to :command:`project` in +the current directory scope or above, see the :variable:`PROJECT_VERSION` +variable. diff --git a/Help/variable/CMAKE_PROJECT_VERSION_MAJOR.rst b/Help/variable/CMAKE_PROJECT_VERSION_MAJOR.rst new file mode 100644 index 0000000..f1001ac --- /dev/null +++ b/Help/variable/CMAKE_PROJECT_VERSION_MAJOR.rst @@ -0,0 +1,9 @@ +CMAKE_PROJECT_VERSION_MAJOR +--------------------------- + +The major version of the top level project. + +This variable holds the major version of the project as specified in the top +level CMakeLists.txt file by a :command:`project` command. Please see +:variable:`CMAKE_PROJECT_VERSION` documentation for the behavior when +multiple :command:`project` commands are used in the sources. diff --git a/Help/variable/CMAKE_PROJECT_VERSION_MINOR.rst b/Help/variable/CMAKE_PROJECT_VERSION_MINOR.rst new file mode 100644 index 0000000..13202be --- /dev/null +++ b/Help/variable/CMAKE_PROJECT_VERSION_MINOR.rst @@ -0,0 +1,9 @@ +CMAKE_PROJECT_VERSION_MINOR +--------------------------- + +The minor version of the top level project. + +This variable holds the minor version of the project as specified in the top +level CMakeLists.txt file by a :command:`project` command. Please see +:variable:`CMAKE_PROJECT_VERSION` documentation for the behavior when +multiple :command:`project` commands are used in the sources. diff --git a/Help/variable/CMAKE_PROJECT_VERSION_PATCH.rst b/Help/variable/CMAKE_PROJECT_VERSION_PATCH.rst new file mode 100644 index 0000000..b8570d9 --- /dev/null +++ b/Help/variable/CMAKE_PROJECT_VERSION_PATCH.rst @@ -0,0 +1,9 @@ +CMAKE_PROJECT_VERSION_PATCH +--------------------------- + +The patch version of the top level project. + +This variable holds the patch version of the project as specified in the top +level CMakeLists.txt file by a :command:`project` command. Please see +:variable:`CMAKE_PROJECT_VERSION` documentation for the behavior when +multiple :command:`project` commands are used in the sources. diff --git a/Help/variable/CMAKE_PROJECT_VERSION_TWEAK.rst b/Help/variable/CMAKE_PROJECT_VERSION_TWEAK.rst new file mode 100644 index 0000000..e1ad4be --- /dev/null +++ b/Help/variable/CMAKE_PROJECT_VERSION_TWEAK.rst @@ -0,0 +1,9 @@ +CMAKE_PROJECT_VERSION_TWEAK +--------------------------- + +The tweak version of the top level project. + +This variable holds the tweak version of the project as specified in the top +level CMakeLists.txt file by a :command:`project` command. Please see +:variable:`CMAKE_PROJECT_VERSION` documentation for the behavior when +multiple :command:`project` commands are used in the sources. diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 3ff8be6..9bd13c3 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -80,15 +80,35 @@ # # .. variable:: CPACK_PACKAGE_VERSION_MAJOR # -# Package major Version. Default value is 0. +# Package major version. This variable will always be set, but its default +# value depends on whether or not version details were given to the +# :command:`project` command in the top level CMakeLists.txt file. If version +# details were given, the default value will be +# :variable:`CMAKE_PROJECT_VERSION_MAJOR`. If no version details were given, +# a default version of 0.1.1 will be assumed, leading to +# ``CPACK_PACKAGE_VERSION_MAJOR`` having a default value of 0. # # .. variable:: CPACK_PACKAGE_VERSION_MINOR # -# Package minor Version. Default value is 1. +# Package minor version. The default value is determined based on whether or +# not version details were given to the :command:`project` command in the top +# level CMakeLists.txt file. If version details were given, the default +# value will be :variable:`CMAKE_PROJECT_VERSION_MINOR`, but if no minor +# version component was specified then ``CPACK_PACKAGE_VERSION_MINOR`` will be +# left unset. If no project version was given at all, a default version of +# 0.1.1 will be assumed, leading to ``CPACK_PACKAGE_VERSION_MINOR`` having a +# default value of 1. # # .. variable:: CPACK_PACKAGE_VERSION_PATCH # -# Package patch Version. Default value is 1. +# Package patch version. The default value is determined based on whether or +# not version details were given to the :command:`project` command in the top +# level CMakeLists.txt file. If version details were given, the default +# value will be :variable:`CMAKE_PROJECT_VERSION_PATCH`, but if no patch +# version component was specified then ``CPACK_PACKAGE_VERSION_PATCH`` will be +# left unset. If no project version was given at all, a default version of +# 0.1.1 will be assumed, leading to ``CPACK_PACKAGE_VERSION_PATCH`` having a +# default value of 1. # # .. variable:: CPACK_PACKAGE_DESCRIPTION_FILE # @@ -368,11 +388,28 @@ endfunction() # Set the package name _cpack_set_default(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}") -_cpack_set_default(CPACK_PACKAGE_VERSION_MAJOR "0") -_cpack_set_default(CPACK_PACKAGE_VERSION_MINOR "1") -_cpack_set_default(CPACK_PACKAGE_VERSION_PATCH "1") -_cpack_set_default(CPACK_PACKAGE_VERSION - "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") +if(CMAKE_PROJECT_VERSION_MAJOR) + _cpack_set_default(CPACK_PACKAGE_VERSION_MAJOR "${CMAKE_PROJECT_VERSION_MAJOR}") + if(CMAKE_PROJECT_VERSION_MINOR) + _cpack_set_default(CPACK_PACKAGE_VERSION_MINOR "${CMAKE_PROJECT_VERSION_MINOR}") + if(CMAKE_PROJECT_VERSION_PATCH) + _cpack_set_default(CPACK_PACKAGE_VERSION_PATCH "${CMAKE_PROJECT_VERSION_PATCH}") + _cpack_set_default(CPACK_PACKAGE_VERSION + "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") + else() + _cpack_set_default(CPACK_PACKAGE_VERSION + "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}") + endif() + else() + _cpack_set_default(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}") + endif() +else() + _cpack_set_default(CPACK_PACKAGE_VERSION_MAJOR "0") + _cpack_set_default(CPACK_PACKAGE_VERSION_MINOR "1") + _cpack_set_default(CPACK_PACKAGE_VERSION_PATCH "1") + _cpack_set_default(CPACK_PACKAGE_VERSION + "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") +endif() _cpack_set_default(CPACK_PACKAGE_VENDOR "Humanity") if(CMAKE_PROJECT_DESCRIPTION) _cpack_set_default(CPACK_PACKAGE_DESCRIPTION_SUMMARY diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index 6ddb0b8..a25bd6b 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -249,6 +249,12 @@ bool cmProjectCommand::InitialPass(std::vector const& args, vv = projectName + "_VERSION_TWEAK"; this->Makefile->AddDefinition("PROJECT_VERSION_TWEAK", vb[3]); this->Makefile->AddDefinition(vv, vb[3]); + // Also, try set top level variables + TopLevelCMakeVarCondSet("CMAKE_PROJECT_VERSION", vs.c_str()); + TopLevelCMakeVarCondSet("CMAKE_PROJECT_VERSION_MAJOR", vb[0]); + TopLevelCMakeVarCondSet("CMAKE_PROJECT_VERSION_MINOR", vb[1]); + TopLevelCMakeVarCondSet("CMAKE_PROJECT_VERSION_PATCH", vb[2]); + TopLevelCMakeVarCondSet("CMAKE_PROJECT_VERSION_TWEAK", vb[3]); } else if (cmp0048 != cmPolicies::OLD) { // Set project VERSION variables to empty std::vector vv; @@ -262,6 +268,13 @@ bool cmProjectCommand::InitialPass(std::vector const& args, vv.push_back(projectName + "_VERSION_MINOR"); vv.push_back(projectName + "_VERSION_PATCH"); vv.push_back(projectName + "_VERSION_TWEAK"); + if (this->Makefile->IsRootMakefile()) { + vv.push_back("CMAKE_PROJECT_VERSION"); + vv.push_back("CMAKE_PROJECT_VERSION_MAJOR"); + vv.push_back("CMAKE_PROJECT_VERSION_MINOR"); + vv.push_back("CMAKE_PROJECT_VERSION_PATCH"); + vv.push_back("CMAKE_PROJECT_VERSION_TWEAK"); + } std::string vw; for (std::string const& i : vv) { const char* v = this->Makefile->GetDefinition(i); @@ -286,36 +299,14 @@ bool cmProjectCommand::InitialPass(std::vector const& args, this->Makefile->AddDefinition("PROJECT_DESCRIPTION", description.c_str()); this->Makefile->AddDefinition(projectName + "_DESCRIPTION", description.c_str()); - // Set the CMAKE_PROJECT_DESCRIPTION variable to be the highest-level - // project name in the tree. If there are two project commands - // in the same CMakeLists.txt file, and it is the top level - // CMakeLists.txt file, then go with the last one. - if (!this->Makefile->GetDefinition("CMAKE_PROJECT_DESCRIPTION") || - (this->Makefile->IsRootMakefile())) { - this->Makefile->AddDefinition("CMAKE_PROJECT_DESCRIPTION", - description.c_str()); - this->Makefile->AddCacheDefinition( - "CMAKE_PROJECT_DESCRIPTION", description.c_str(), - "Value Computed by CMake", cmStateEnums::STATIC); - } + TopLevelCMakeVarCondSet("CMAKE_PROJECT_DESCRIPTION", description.c_str()); } if (haveHomepage) { this->Makefile->AddDefinition("PROJECT_HOMEPAGE_URL", homepage.c_str()); this->Makefile->AddDefinition(projectName + "_HOMEPAGE_URL", homepage.c_str()); - // Set the CMAKE_PROJECT_HOMEPAGE_URL variable to be the highest-level - // project name in the tree. If there are two project commands - // in the same CMakeLists.txt file, and it is the top level - // CMakeLists.txt file, then go with the last one. - if (!this->Makefile->GetDefinition("CMAKE_PROJECT_HOMEPAGE_URL") || - (this->Makefile->IsRootMakefile())) { - this->Makefile->AddDefinition("CMAKE_PROJECT_HOMEPAGE_URL", - homepage.c_str()); - this->Makefile->AddCacheDefinition( - "CMAKE_PROJECT_HOMEPAGE_URL", homepage.c_str(), - "Value Computed by CMake", cmStateEnums::STATIC); - } + TopLevelCMakeVarCondSet("CMAKE_PROJECT_HOMEPAGE_URL", homepage.c_str()); } if (languages.empty()) { @@ -338,3 +329,18 @@ bool cmProjectCommand::InitialPass(std::vector const& args, } return true; } + +void cmProjectCommand::TopLevelCMakeVarCondSet(const char* const name, + const char* const value) +{ + // Set the CMAKE_PROJECT_XXX variable to be the highest-level + // project name in the tree. If there are two project commands + // in the same CMakeLists.txt file, and it is the top level + // CMakeLists.txt file, then go with the last one. + if (!this->Makefile->GetDefinition(name) || + (this->Makefile->IsRootMakefile())) { + this->Makefile->AddDefinition(name, value); + this->Makefile->AddCacheDefinition(name, value, "Value Computed by CMake", + cmStateEnums::STATIC); + } +} diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h index 80fa235..365d448 100644 --- a/Source/cmProjectCommand.h +++ b/Source/cmProjectCommand.h @@ -34,6 +34,9 @@ public: */ bool InitialPass(std::vector const& args, cmExecutionStatus& status) override; + +private: + void TopLevelCMakeVarCondSet(const char* name, const char* value); }; #endif diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index b11cf03..ea64646 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -951,6 +951,44 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endif() endif() + if(CTEST_TEST_CPACK) + add_test(CPackUseDefaultVersion ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/CPackUseDefaultVersion" + "${CMake_BINARY_DIR}/Tests/CPackUseDefaultVersion" + ${build_generator_args} + --build-project CPackUseDefaultVersion + --build-two-config + --build-options ${build_options} + ${CPackUseDefaultVersion_BUILD_OPTIONS}) + set_tests_properties(CPackUseDefaultVersion PROPERTIES PASS_REGULAR_EXPRESSION "CPACK_PACKAGE_VERSION=0\\.1\\.1") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackUseDefaultVersion") + + add_test(CPackUseProjectVersion ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/CPackUseProjectVersion" + "${CMake_BINARY_DIR}/Tests/CPackUseProjectVersion" + ${build_generator_args} + --build-project CPackUseProjectVersion + --build-two-config + --build-options ${build_options} + ${CPackUseProjectVersion_BUILD_OPTIONS}) + set_tests_properties(CPackUseProjectVersion PROPERTIES PASS_REGULAR_EXPRESSION "CPACK_PACKAGE_VERSION=1\\.2\\.3") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackUseProjectVersion") + + add_test(CPackUseShortProjectVersion ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/CPackUseShortProjectVersion" + "${CMake_BINARY_DIR}/Tests/CPackUseShortProjectVersion" + ${build_generator_args} + --build-project CPackUseShortProjectVersion + --build-two-config + --build-options ${build_options} + ${CPackUseProjectVersion_BUILD_OPTIONS}) + set_tests_properties(CPackUseShortProjectVersion PROPERTIES PASS_REGULAR_EXPRESSION "CPACK_PACKAGE_VERSION=2") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackUseShortProjectVersion") + endif() + if(CTEST_RUN_CPackComponents) set(CPackComponents_BUILD_OPTIONS) if(APPLE) diff --git a/Tests/CPackUseDefaultVersion/CMakeLists.txt b/Tests/CPackUseDefaultVersion/CMakeLists.txt new file mode 100644 index 0000000..9f21f3a --- /dev/null +++ b/Tests/CPackUseDefaultVersion/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.2) +project(CPackUseProjectVersion NONE) + +include(CPack) + +message("CPACK_PACKAGE_VERSION=${CPACK_PACKAGE_VERSION}") diff --git a/Tests/CPackUseProjectVersion/CMakeLists.txt b/Tests/CPackUseProjectVersion/CMakeLists.txt new file mode 100644 index 0000000..d4770ae --- /dev/null +++ b/Tests/CPackUseProjectVersion/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.2) +project(CPackUseProjectVersion VERSION 1.2.3 LANGUAGES NONE) + +include(CPack) + +message("CPACK_PACKAGE_VERSION=${CPACK_PACKAGE_VERSION}") diff --git a/Tests/CPackUseShortProjectVersion/CMakeLists.txt b/Tests/CPackUseShortProjectVersion/CMakeLists.txt new file mode 100644 index 0000000..855bc64 --- /dev/null +++ b/Tests/CPackUseShortProjectVersion/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.2) +project(CPackUseProjectVersion VERSION 2 LANGUAGES NONE) + +include(CPack) + +message("CPACK_PACKAGE_VERSION=${CPACK_PACKAGE_VERSION}") ----------------------------------------------------------------------- Summary of changes: Help/command/project.rst | 5 +- Help/manual/cmake-variables.7.rst | 5 ++ Help/release/dev/cpack-use-project-version.rst | 10 ++++ ...T_DESCRIPTION.rst => CMAKE_PROJECT_VERSION.rst} | 26 +++++----- Help/variable/CMAKE_PROJECT_VERSION_MAJOR.rst | 9 ++++ Help/variable/CMAKE_PROJECT_VERSION_MINOR.rst | 9 ++++ Help/variable/CMAKE_PROJECT_VERSION_PATCH.rst | 9 ++++ Help/variable/CMAKE_PROJECT_VERSION_TWEAK.rst | 9 ++++ Modules/CPack.cmake | 53 ++++++++++++++++--- Source/cmProjectCommand.cxx | 54 +++++++++++--------- Source/cmProjectCommand.h | 3 ++ Tests/CMakeLists.txt | 38 ++++++++++++++ Tests/CPackUseDefaultVersion/CMakeLists.txt | 6 +++ Tests/CPackUseProjectVersion/CMakeLists.txt | 6 +++ Tests/CPackUseShortProjectVersion/CMakeLists.txt | 6 +++ 15 files changed, 201 insertions(+), 47 deletions(-) create mode 100644 Help/release/dev/cpack-use-project-version.rst copy Help/variable/{CMAKE_PROJECT_DESCRIPTION.rst => CMAKE_PROJECT_VERSION.rst} (51%) create mode 100644 Help/variable/CMAKE_PROJECT_VERSION_MAJOR.rst create mode 100644 Help/variable/CMAKE_PROJECT_VERSION_MINOR.rst create mode 100644 Help/variable/CMAKE_PROJECT_VERSION_PATCH.rst create mode 100644 Help/variable/CMAKE_PROJECT_VERSION_TWEAK.rst create mode 100644 Tests/CPackUseDefaultVersion/CMakeLists.txt create mode 100644 Tests/CPackUseProjectVersion/CMakeLists.txt create mode 100644 Tests/CPackUseShortProjectVersion/CMakeLists.txt hooks/post-receive -- CMake From kwrobot at kitware.com Fri May 4 00:05:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 4 May 2018 00:05:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.1-694-gc89d2f4 Message-ID: <20180504040505.B049D10F058@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via c89d2f4a6ae3e6cb0f87493cac3f5f723bb4f62e (commit) from 7de29da7c49da68aee421c646a676422f3b9d563 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c89d2f4a6ae3e6cb0f87493cac3f5f723bb4f62e commit c89d2f4a6ae3e6cb0f87493cac3f5f723bb4f62e Author: Kitware Robot AuthorDate: Fri May 4 00:01:05 2018 -0400 Commit: Kitware Robot CommitDate: Fri May 4 00:01:05 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ba26246..cf91298 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180503) +set(CMake_VERSION_PATCH 20180504) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri May 4 09:45:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 4 May 2018 09:45:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.1-698-gfc35e81 Message-ID: <20180504134505.48FB0102EBD@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via fc35e817ee243d31c5846d09b0b21f2756a0727b (commit) via efaaa729aa1c4ab2c351e7fb5ed5ea8712957db8 (commit) via 46fa1af5142e72558fcd378e12f7ec7d7ee3c90d (commit) via 4f82199befee194aa924fd4dcdb2f4aad1f7dab6 (commit) from c89d2f4a6ae3e6cb0f87493cac3f5f723bb4f62e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fc35e817ee243d31c5846d09b0b21f2756a0727b commit fc35e817ee243d31c5846d09b0b21f2756a0727b Merge: efaaa72 46fa1af Author: Brad King AuthorDate: Fri May 4 13:35:51 2018 +0000 Commit: Kitware Robot CommitDate: Fri May 4 09:37:14 2018 -0400 Merge topic 'test-CheckSourceTree-in-source' 46fa1af514 Tests: Fix CheckSourceTree for in-source non-dashboard builds Acked-by: Kitware Robot Merge-request: !2025 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=efaaa729aa1c4ab2c351e7fb5ed5ea8712957db8 commit efaaa729aa1c4ab2c351e7fb5ed5ea8712957db8 Merge: c89d2f4 4f82199 Author: Brad King AuthorDate: Fri May 4 13:35:32 2018 +0000 Commit: Kitware Robot CommitDate: Fri May 4 09:36:08 2018 -0400 Merge topic 'genex-complang-not-loaded' 4f82199bef Genex: Allow COMPILE_LANGUAGE to name a language that is not loaded Acked-by: Kitware Robot Merge-request: !2031 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=46fa1af5142e72558fcd378e12f7ec7d7ee3c90d commit 46fa1af5142e72558fcd378e12f7ec7d7ee3c90d Author: Israel Blancas AuthorDate: Tue May 1 20:23:05 2018 +0200 Commit: Brad King CommitDate: Thu May 3 09:35:45 2018 -0400 Tests: Fix CheckSourceTree for in-source non-dashboard builds For in-source builds we must tolerate non-tracked files in the source tree. Previously we only tolerated them for dashboard builds during automated testing, but we should tolerate them for local user builds too. Fixes: #17868 diff --git a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in b/Tests/CMakeTests/CheckSourceTreeTest.cmake.in index 8145db7..4f2aaea 100644 --- a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in +++ b/Tests/CMakeTests/CheckSourceTreeTest.cmake.in @@ -308,13 +308,11 @@ message("======================================================================= if("$ENV{DASHBOARD_TEST_FROM_CTEST}" STREQUAL "") # developers are allowed to have local additions and modifications... - set(is_dashboard 0) message("interactive test run") message("") else() - set(is_dashboard 1) message("dashboard test run") message("") @@ -341,7 +339,7 @@ endif() # Not even developers. # if(nonadditions) - if(in_source_build AND is_dashboard) + if(in_source_build) message(" warning: test results confounded because this is an 'in-source' build - cannot distinguish between non-added files that are in-source build products and https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4f82199befee194aa924fd4dcdb2f4aad1f7dab6 commit 4f82199befee194aa924fd4dcdb2f4aad1f7dab6 Author: Henry Schreiner AuthorDate: Wed May 2 17:51:05 2018 -0400 Commit: Brad King CommitDate: Thu May 3 08:34:39 2018 -0400 Genex: Allow COMPILE_LANGUAGE to name a language that is not loaded Evaluate to false on `$` if language `Lang` is not loaded. This is helpful in exported targets consumed in other projects that may not enable all the same languages. Fixes: #17952 diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 399e894..7b35bce 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1013,16 +1013,7 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode return std::string(); } - std::vector enabledLanguages; cmGlobalGenerator* gg = context->LG->GetGlobalGenerator(); - gg->GetEnabledLanguages(enabledLanguages); - if (!parameters.empty() && - std::find(enabledLanguages.begin(), enabledLanguages.end(), - parameters.front()) == enabledLanguages.end()) { - reportError(context, content->GetOriginalExpression(), - "$ Unknown language."); - return std::string(); - } std::string genName = gg->GetName(); if (genName.find("Makefiles") == std::string::npos && genName.find("Ninja") == std::string::npos && diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt deleted file mode 100644 index 444da45..0000000 --- a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt +++ /dev/null @@ -1,8 +0,0 @@ -CMake Error at COMPILE_LANGUAGE-unknown-lang.cmake:4 \(target_compile_options\): - Error evaluating generator expression: - - \$ - - \$ Unknown language. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake index cec12a3..00dd290 100644 --- a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake @@ -1,4 +1,4 @@ enable_language(C) add_executable(empty empty.c) -target_compile_options(empty PRIVATE $<$:-Wall>) +target_compile_options(empty PRIVATE $<$:$>) ----------------------------------------------------------------------- Summary of changes: Source/cmGeneratorExpressionNode.cxx | 9 --------- Tests/CMakeTests/CheckSourceTreeTest.cmake.in | 4 +--- .../COMPILE_LANGUAGE-unknown-lang-result.txt | 1 - .../COMPILE_LANGUAGE-unknown-lang-stderr.txt | 8 -------- .../GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake | 2 +- 5 files changed, 2 insertions(+), 22 deletions(-) delete mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt delete mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt hooks/post-receive -- CMake From kwrobot at kitware.com Fri May 4 11:05:07 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 4 May 2018 11:05:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.1-700-g5e5ef61 Message-ID: <20180504150507.B030C10EE61@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 5e5ef61ed3b5808dfe1a71623ec12c451d7fe385 (commit) via 828e18bb3eadaff9bbe8b1ddf57b68cf40e0eafb (commit) from fc35e817ee243d31c5846d09b0b21f2756a0727b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5e5ef61ed3b5808dfe1a71623ec12c451d7fe385 commit 5e5ef61ed3b5808dfe1a71623ec12c451d7fe385 Merge: fc35e81 828e18b Author: Brad King AuthorDate: Fri May 4 15:04:43 2018 +0000 Commit: Kitware Robot CommitDate: Fri May 4 11:04:53 2018 -0400 Merge topic 'doc-xref-envvar' 828e18bb3e cmRST: Add support for 'envvar' cmake domain role Acked-by: Kitware Robot Merge-request: !2038 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=828e18bb3eadaff9bbe8b1ddf57b68cf40e0eafb commit 828e18bb3eadaff9bbe8b1ddf57b68cf40e0eafb Author: Brad King AuthorDate: Thu May 3 14:34:32 2018 -0400 Commit: Brad King CommitDate: Fri May 4 07:52:14 2018 -0400 cmRST: Add support for 'envvar' cmake domain role This was accidentally left out of commit 8acf46caf1 (Utilities/Sphinx: Add role and directive for 'envvar' in CMake domain, 2018-04-19). diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index 112be4d..edcbc22 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -34,7 +34,7 @@ cmRST::cmRST(std::ostream& os, std::string const& docroot) , NoteDirective("^.. note::[ \t]*(.*)$") , ModuleRST("^#\\[(=*)\\[\\.rst:$") , CMakeRole("(:cmake)?:(" - "command|generator|variable|module|policy|" + "command|generator|variable|envvar|module|policy|" "prop_cache|prop_dir|prop_gbl|prop_inst|prop_sf|" "prop_test|prop_tgt|" "manual" diff --git a/Tests/CMakeLib/testRST.expect b/Tests/CMakeLib/testRST.expect index fa436cb..4b29762 100644 --- a/Tests/CMakeLib/testRST.expect +++ b/Tests/CMakeLib/testRST.expect @@ -16,6 +16,8 @@ Variable ``_VARIABLE`` with leading placeholder. Variable ``VARIABLE_`` with trailing placeholder. Variable ``_VARIABLE`` with leading placeholder and target. Variable ``VARIABLE_`` with trailing placeholder and target. +Environment variable ``SOME_ENV_VAR``. +Environment variable ``some env var`` with space and target. Generator ``Some Generator`` with space. First TOC entry. diff --git a/Tests/CMakeLib/testRST.rst b/Tests/CMakeLib/testRST.rst index 54952dd..9cd7257 100644 --- a/Tests/CMakeLib/testRST.rst +++ b/Tests/CMakeLib/testRST.rst @@ -23,6 +23,8 @@ Variable :variable:`_VARIABLE` with leading placeholder. Variable :variable:`VARIABLE_` with trailing placeholder. Variable :variable:`_VARIABLE ` with leading placeholder and target. Variable :variable:`VARIABLE_ ` with trailing placeholder and target. +Environment variable :envvar:`SOME_ENV_VAR`. +Environment variable :envvar:`some env var ` with space and target. Generator :generator:`Some Generator` with space. .. |not replaced| replace:: not replaced through toctree ----------------------------------------------------------------------- Summary of changes: Source/cmRST.cxx | 2 +- Tests/CMakeLib/testRST.expect | 2 ++ Tests/CMakeLib/testRST.rst | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri May 4 11:35:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 4 May 2018 11:35:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.1-702-ge628d6c Message-ID: <20180504153505.7C1C510F332@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via e628d6cd066774e4c95ec368fc6ef0be731ff0a5 (commit) via 3f315dc12878232f3f250d6f3c9959bee932941f (commit) from 5e5ef61ed3b5808dfe1a71623ec12c451d7fe385 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e628d6cd066774e4c95ec368fc6ef0be731ff0a5 commit e628d6cd066774e4c95ec368fc6ef0be731ff0a5 Merge: 5e5ef61 3f315dc Author: Brad King AuthorDate: Fri May 4 15:25:39 2018 +0000 Commit: Kitware Robot CommitDate: Fri May 4 11:26:36 2018 -0400 Merge topic 'vs-refactor-xml' 3f315dc128 cmVisualStudio10TargetGenerator: XML refactoring Acked-by: Kitware Robot Merge-request: !2028 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3f315dc12878232f3f250d6f3c9959bee932941f commit 3f315dc12878232f3f250d6f3c9959bee932941f Author: Vitaly Stakhovsky AuthorDate: Wed May 2 11:17:00 2018 -0400 Commit: Brad King CommitDate: Fri May 4 10:46:11 2018 -0400 cmVisualStudio10TargetGenerator: XML refactoring diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 5497469..7a7c647 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -132,16 +132,16 @@ public: // if there are configuration specific flags, then // use the configuration specific tag for PreprocessorDefinitions this->TargetGenerator->WritePlatformConfigTag( - tag, this->GetConfiguration(), indent); + tag, this->GetConfiguration(), indent, content); } else { fout.fill(' '); fout.width(indent * 2); // write an empty string to get the fill level indent to print fout << ""; fout << "<" << tag << ">"; + fout << cmVS10EscapeXML(content); + fout << "\n"; } - fout << cmVS10EscapeXML(content); - fout << "\n"; } private: @@ -276,7 +276,7 @@ std::string cmVisualStudio10TargetGenerator::CalcCondition( void cmVisualStudio10TargetGenerator::WritePlatformConfigTag( const char* tag, const std::string& config, int indentLevel, - const char* attribute) + const std::string& content) { std::ostream& stream = *this->BuildFileStream; stream.fill(' '); @@ -285,14 +285,8 @@ void cmVisualStudio10TargetGenerator::WritePlatformConfigTag( stream << "<" << tag << " Condition=\""; stream << this->CalcCondition(config); stream << "\""; - if (attribute) { - stream << attribute; - } - // close the tag - stream << ">"; - if (attribute) { - stream << "\n"; - } + stream << ">" << cmVS10EscapeXML(content); + stream << "\n"; } std::ostream& cmVisualStudio10TargetGenerator::Elem::WriteString( @@ -386,233 +380,236 @@ void cmVisualStudio10TargetGenerator::Generate() // Write the encoding header into the file char magic[] = { char(0xEF), char(0xBB), char(0xBF) }; this->BuildFileStream->write(magic, 3); + (*this->BuildFileStream) << "GlobalGenerator->Encoding() + "\"?>\n"; + Elem e0(*this->BuildFileStream, 0); + e0.StartElement("Project"); + e0.Attribute("DefaultTargets", "Build"); // get the tools version to use const std::string toolsVer(this->GlobalGenerator->GetToolsVersion()); - std::string project_defaults = "GlobalGenerator->Encoding() + "\"?>\n"; - project_defaults.append("\n"); - this->WriteString(project_defaults.c_str(), 0); + e0.Attribute("ToolsVersion", toolsVer); + e0.Attribute("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"); + e0.SetHasElements(); if (this->NsightTegra) { - this->WriteString("\n", 1); + Elem e1(e0, "PropertyGroup"); + e1.Attribute("Label", "NsightTegraProject"); const unsigned int nsightTegraMajorVersion = this->NsightTegraVersion[0]; const unsigned int nsightTegraMinorVersion = this->NsightTegraVersion[1]; if (nsightTegraMajorVersion >= 2) { - this->WriteString("", 2); if (nsightTegraMajorVersion > 3 || (nsightTegraMajorVersion == 3 && nsightTegraMinorVersion >= 1)) { - (*this->BuildFileStream) << "11"; + e1.Element("NsightTegraProjectRevisionNumber", "11"); } else { // Nsight Tegra 2.0 uses project revision 9. - (*this->BuildFileStream) << "9"; + e1.Element("NsightTegraProjectRevisionNumber", "9"); } - (*this->BuildFileStream) << "\n"; // Tell newer versions to upgrade silently when loading. - this->WriteElem("NsightTegraUpgradeOnceWithoutPrompt", "true", 2); + e1.Element("NsightTegraUpgradeOnceWithoutPrompt", "true"); } else { // Require Nsight Tegra 1.6 for JCompile support. - this->WriteElem("NsightTegraProjectRevisionNumber", "7", 2); + e1.Element("NsightTegraProjectRevisionNumber", "7"); } - this->WriteString("\n", 1); + e1.EndElement(); } if (const char* hostArch = this->GlobalGenerator->GetPlatformToolsetHostArchitecture()) { - this->WriteString("\n", 1); - this->WriteElemEscapeXML("PreferredToolArchitecture", hostArch, 2); - this->WriteString("\n", 1); + Elem e1(e0, "PropertyGroup"); + e1.Element("PreferredToolArchitecture", hostArch); + e1.EndElement(); } if (this->ProjectType != csproj) { - this->WriteProjectConfigurations(); - } - this->WriteString("\n", 1); - this->WriteElem("ProjectGuid", "{" + this->GUID + "}", 2); - - if (this->MSTools && - this->GeneratorTarget->GetType() <= cmStateEnums::GLOBAL_TARGET) { - this->WriteApplicationTypeSettings(); - this->VerifyNecessaryFiles(); + this->WriteProjectConfigurations(e0); } - const char* vsProjectTypes = - this->GeneratorTarget->GetProperty("VS_GLOBAL_PROJECT_TYPES"); - if (vsProjectTypes) { - std::string tagName = "ProjectTypes"; - if (this->ProjectType == csproj) { - tagName = "ProjectTypeGuids"; + { + Elem e1(e0, "PropertyGroup"); + e1.Attribute("Label", "Globals"); + e1.Element("ProjectGuid", "{" + this->GUID + "}"); + + if (this->MSTools && + this->GeneratorTarget->GetType() <= cmStateEnums::GLOBAL_TARGET) { + this->WriteApplicationTypeSettings(e1); + this->VerifyNecessaryFiles(); + } + + const char* vsProjectTypes = + this->GeneratorTarget->GetProperty("VS_GLOBAL_PROJECT_TYPES"); + if (vsProjectTypes) { + std::string tagName = "ProjectTypes"; + if (this->ProjectType == csproj) { + tagName = "ProjectTypeGuids"; + } + e1.Element(tagName.c_str(), vsProjectTypes); } - this->WriteString("", 2); - (*this->BuildFileStream) << "<" << tagName << ">" - << cmVS10EscapeXML(vsProjectTypes) << "\n"; - } - const char* vsProjectName = - this->GeneratorTarget->GetProperty("VS_SCC_PROJECTNAME"); - const char* vsLocalPath = - this->GeneratorTarget->GetProperty("VS_SCC_LOCALPATH"); - const char* vsProvider = - this->GeneratorTarget->GetProperty("VS_SCC_PROVIDER"); + const char* vsProjectName = + this->GeneratorTarget->GetProperty("VS_SCC_PROJECTNAME"); + const char* vsLocalPath = + this->GeneratorTarget->GetProperty("VS_SCC_LOCALPATH"); + const char* vsProvider = + this->GeneratorTarget->GetProperty("VS_SCC_PROVIDER"); - if (vsProjectName && vsLocalPath && vsProvider) { - this->WriteElemEscapeXML("SccProjectName", vsProjectName, 2); - this->WriteElemEscapeXML("SccLocalPath", vsLocalPath, 2); - this->WriteElemEscapeXML("SccProvider", vsProvider, 2); + if (vsProjectName && vsLocalPath && vsProvider) { + e1.Element("SccProjectName", vsProjectName); + e1.Element("SccLocalPath", vsLocalPath); + e1.Element("SccProvider", vsProvider); - const char* vsAuxPath = - this->GeneratorTarget->GetProperty("VS_SCC_AUXPATH"); - if (vsAuxPath) { - this->WriteElemEscapeXML("SccAuxPath", vsAuxPath, 2); + const char* vsAuxPath = + this->GeneratorTarget->GetProperty("VS_SCC_AUXPATH"); + if (vsAuxPath) { + e1.Element("SccAuxPath", vsAuxPath); + } } - } - if (this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT")) { - this->WriteElem("WinMDAssembly", "true", 2); - } + if (this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT")) { + e1.Element("WinMDAssembly", "true"); + } - const char* vsGlobalKeyword = - this->GeneratorTarget->GetProperty("VS_GLOBAL_KEYWORD"); - if (!vsGlobalKeyword) { - this->WriteElem("Keyword", "Win32Proj", 2); - } else { - this->WriteElemEscapeXML("Keyword", vsGlobalKeyword, 2); - } + const char* vsGlobalKeyword = + this->GeneratorTarget->GetProperty("VS_GLOBAL_KEYWORD"); + if (!vsGlobalKeyword) { + e1.Element("Keyword", "Win32Proj"); + } else { + e1.Element("Keyword", vsGlobalKeyword); + } - const char* vsGlobalRootNamespace = - this->GeneratorTarget->GetProperty("VS_GLOBAL_ROOTNAMESPACE"); - if (vsGlobalRootNamespace) { - this->WriteElemEscapeXML("RootNamespace", vsGlobalRootNamespace, 2); - } + const char* vsGlobalRootNamespace = + this->GeneratorTarget->GetProperty("VS_GLOBAL_ROOTNAMESPACE"); + if (vsGlobalRootNamespace) { + e1.Element("RootNamespace", vsGlobalRootNamespace); + } - this->WriteElemEscapeXML("Platform", this->Platform, 2); - const char* projLabel = this->GeneratorTarget->GetProperty("PROJECT_LABEL"); - if (!projLabel) { - projLabel = this->Name.c_str(); - } - this->WriteElemEscapeXML("ProjectName", projLabel, 2); - if (const char* targetFrameworkVersion = this->GeneratorTarget->GetProperty( - "VS_DOTNET_TARGET_FRAMEWORK_VERSION")) { - this->WriteElemEscapeXML("TargetFrameworkVersion", targetFrameworkVersion, - 2); - } + e1.Element("Platform", this->Platform); + const char* projLabel = + this->GeneratorTarget->GetProperty("PROJECT_LABEL"); + if (!projLabel) { + projLabel = this->Name.c_str(); + } + e1.Element("ProjectName", projLabel); + if (const char* targetFrameworkVersion = + this->GeneratorTarget->GetProperty( + "VS_DOTNET_TARGET_FRAMEWORK_VERSION")) { + e1.Element("TargetFrameworkVersion", targetFrameworkVersion); + } - // Disable the project upgrade prompt that is displayed the first time a - // project using an older toolset version is opened in a newer version of - // the IDE (respected by VS 2013 and above). - if (this->GlobalGenerator->GetVersion() >= - cmGlobalVisualStudioGenerator::VS12) { - this->WriteElem("VCProjectUpgraderObjectName", "NoUpgrade", 2); - } + // Disable the project upgrade prompt that is displayed the first time a + // project using an older toolset version is opened in a newer version of + // the IDE (respected by VS 2013 and above). + if (this->GlobalGenerator->GetVersion() >= + cmGlobalVisualStudioGenerator::VS12) { + e1.Element("VCProjectUpgraderObjectName", "NoUpgrade"); + } - std::vector keys = this->GeneratorTarget->GetPropertyKeys(); - for (std::string const& keyIt : keys) { - static const char* prefix = "VS_GLOBAL_"; - if (keyIt.find(prefix) != 0) - continue; - std::string globalKey = keyIt.substr(strlen(prefix)); - // Skip invalid or separately-handled properties. - if (globalKey.empty() || globalKey == "PROJECT_TYPES" || - globalKey == "ROOTNAMESPACE" || globalKey == "KEYWORD") { - continue; + std::vector keys = this->GeneratorTarget->GetPropertyKeys(); + for (std::string const& keyIt : keys) { + static const char* prefix = "VS_GLOBAL_"; + if (keyIt.find(prefix) != 0) + continue; + std::string globalKey = keyIt.substr(strlen(prefix)); + // Skip invalid or separately-handled properties. + if (globalKey.empty() || globalKey == "PROJECT_TYPES" || + globalKey == "ROOTNAMESPACE" || globalKey == "KEYWORD") { + continue; + } + const char* value = this->GeneratorTarget->GetProperty(keyIt); + if (!value) + continue; + e1.Element(globalKey.c_str(), value); } - const char* value = this->GeneratorTarget->GetProperty(keyIt); - if (!value) - continue; - this->WriteString("<", 2); - (*this->BuildFileStream) << globalKey << ">" << cmVS10EscapeXML(value) - << "\n"; - } - if (this->Managed) { - std::string outputType = ""; - switch (this->GeneratorTarget->GetType()) { - case cmStateEnums::OBJECT_LIBRARY: - case cmStateEnums::STATIC_LIBRARY: - case cmStateEnums::SHARED_LIBRARY: - outputType += "Library"; - break; - case cmStateEnums::MODULE_LIBRARY: - outputType += "Module"; - break; - case cmStateEnums::EXECUTABLE: - if (this->GeneratorTarget->Target->GetPropertyAsBool( - "WIN32_EXECUTABLE")) { - outputType += "WinExe"; - } else { - outputType += "Exe"; - } - break; - case cmStateEnums::UTILITY: - case cmStateEnums::GLOBAL_TARGET: - outputType += "Utility"; - break; - case cmStateEnums::UNKNOWN_LIBRARY: - case cmStateEnums::INTERFACE_LIBRARY: - break; + if (this->Managed) { + std::string outputType; + switch (this->GeneratorTarget->GetType()) { + case cmStateEnums::OBJECT_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: + outputType = "Library"; + break; + case cmStateEnums::MODULE_LIBRARY: + outputType = "Module"; + break; + case cmStateEnums::EXECUTABLE: + if (this->GeneratorTarget->Target->GetPropertyAsBool( + "WIN32_EXECUTABLE")) { + outputType = "WinExe"; + } else { + outputType = "Exe"; + } + break; + case cmStateEnums::UTILITY: + case cmStateEnums::GLOBAL_TARGET: + outputType = "Utility"; + break; + case cmStateEnums::UNKNOWN_LIBRARY: + case cmStateEnums::INTERFACE_LIBRARY: + break; + } + e1.Element("OutputType", outputType); + e1.Element("AppDesignerFolder", "Properties"); } - outputType += "\n"; - this->WriteString(outputType.c_str(), 2); - this->WriteElem("AppDesignerFolder", "Properties", 2); - } - this->WriteString("\n", 1); + e1.EndElement(); + } switch (this->ProjectType) { case vcxproj: - this->WriteString("\n", - 1); + Elem(e0, "Import") + .Attribute("Project", VS10_CXX_DEFAULT_PROPS) + .EndElement(); break; case csproj: - this->WriteString("\n", - 1); + Elem(e0, "Import") + .Attribute("Project", VS10_CSharp_DEFAULT_PROPS) + .Attribute("Condition", "Exists('" VS10_CSharp_DEFAULT_PROPS "')") + .EndElement(); break; } - this->WriteProjectConfigurationValues(); + this->WriteProjectConfigurationValues(e0); if (this->ProjectType == vcxproj) { - this->WriteString("\n", 1); - } - this->WriteString("\n", 1); - if (this->GlobalGenerator->IsCudaEnabled()) { - this->WriteString("BuildFileStream) - << cmVS10EscapeAttr( - this->GlobalGenerator->GetPlatformToolsetCudaString()) - << ".props\" />\n"; - } - if (this->GlobalGenerator->IsMasmEnabled()) { - this->WriteString("\n", - 2); - } - if (this->GlobalGenerator->IsNasmEnabled()) { - // Always search in the standard modules location. - std::string propsTemplate = - GetCMakeFilePath("Templates/MSBuild/nasm.props.in"); - - std::string propsLocal; - propsLocal += this->DefaultArtifactDir; - propsLocal += "\\nasm.props"; - ConvertToWindowsSlash(propsLocal); - this->Makefile->ConfigureFile(propsTemplate.c_str(), propsLocal.c_str(), - false, true, true); - std::string import = std::string("\n"; - this->WriteString(import.c_str(), 2); - } - this->WriteString("\n", 1); - this->WriteString("\n", 1); + Elem(e0, "Import").Attribute("Project", VS10_CXX_PROPS).EndElement(); + } + { + Elem e1(e0, "ImportGroup"); + e1.Attribute("Label", "ExtensionSettings"); + e1.SetHasElements(); + + if (this->GlobalGenerator->IsCudaEnabled()) { + Elem(e1, "Import") + .Attribute("Project", "$(VCTargetsPath)\\BuildCustomizations\\CUDA " + + this->GlobalGenerator->GetPlatformToolsetCudaString() + + ".props") + .EndElement(); + } + if (this->GlobalGenerator->IsMasmEnabled()) { + Elem(e1, "Import") + .Attribute("Project", + "$(VCTargetsPath)\\BuildCustomizations\\masm.props") + .EndElement(); + } + if (this->GlobalGenerator->IsNasmEnabled()) { + // Always search in the standard modules location. + std::string propsTemplate = + GetCMakeFilePath("Templates/MSBuild/nasm.props.in"); + + std::string propsLocal; + propsLocal += this->DefaultArtifactDir; + propsLocal += "\\nasm.props"; + ConvertToWindowsSlash(propsLocal); + this->Makefile->ConfigureFile(propsTemplate.c_str(), propsLocal.c_str(), + false, true, true); + Elem(e1, "Import").Attribute("Project", propsLocal).EndElement(); + } + e1.EndElement(); + } { + Elem e1(e0, "ImportGroup"); + e1.Attribute("Label", "PropertySheets"); std::string props; switch (this->ProjectType) { case vcxproj: @@ -627,71 +624,75 @@ void cmVisualStudio10TargetGenerator::Generate() } if (!props.empty()) { ConvertToWindowsSlash(props); - this->WriteString("", 2); - (*this->BuildFileStream) - << "\n"; - } - } - this->WritePlatformExtensions(); - this->WriteString("\n", 1); - this->WriteString("\n", 1); - this->WriteWinRTPackageCertificateKeyFile(); - this->WritePathAndIncrementalLinkOptions(); - this->WriteItemDefinitionGroups(); - this->WriteCustomCommands(); - this->WriteAllSources(); - this->WriteDotNetReferences(); - this->WriteEmbeddedResourceGroup(); - this->WriteXamlFilesGroup(); - this->WriteWinRTReferences(); - this->WriteProjectReferences(); - this->WriteSDKReferences(); + Elem(e1, "Import") + .Attribute("Project", props) + .Attribute("Condition", "exists('" + props + "')") + .Attribute("Label", "LocalAppDataPlatform") + .EndElement(); + } + + this->WritePlatformExtensions(e1); + e1.EndElement(); + } + Elem(e0, "PropertyGroup").Attribute("Label", "UserMacros").EndElement(); + this->WriteWinRTPackageCertificateKeyFile(e0); + this->WritePathAndIncrementalLinkOptions(e0); + this->WriteItemDefinitionGroups(e0); + this->WriteCustomCommands(e0); + this->WriteAllSources(e0); + this->WriteDotNetReferences(e0); + this->WriteEmbeddedResourceGroup(e0); + this->WriteXamlFilesGroup(e0); + this->WriteWinRTReferences(e0); + this->WriteProjectReferences(e0); + this->WriteSDKReferences(e0); switch (this->ProjectType) { case vcxproj: - this->WriteString("\n", 1); + Elem(e0, "Import").Attribute("Project", VS10_CXX_TARGETS).EndElement(); break; case csproj: - this->WriteString("\n", 1); + Elem(e0, "Import") + .Attribute("Project", VS10_CSharp_TARGETS) + .EndElement(); break; } - this->WriteTargetSpecificReferences(); - this->WriteString("\n", 1); - this->WriteTargetsFileReferences(); - if (this->GlobalGenerator->IsCudaEnabled()) { - this->WriteString("BuildFileStream) - << cmVS10EscapeAttr( - this->GlobalGenerator->GetPlatformToolsetCudaString()) - << ".targets\" />\n"; - } - if (this->GlobalGenerator->IsMasmEnabled()) { - this->WriteString("\n", - 2); - } - if (this->GlobalGenerator->IsNasmEnabled()) { - std::string nasmTargets = - GetCMakeFilePath("Templates/MSBuild/nasm.targets"); - std::string import = "\n"; - this->WriteString(import.c_str(), 2); - } - this->WriteString("\n", 1); + this->WriteTargetSpecificReferences(e0); + { + Elem e1(e0, "ImportGroup"); + e1.Attribute("Label", "ExtensionTargets"); + e1.SetHasElements(); + this->WriteTargetsFileReferences(e1); + if (this->GlobalGenerator->IsCudaEnabled()) { + Elem(e1, "Import") + .Attribute("Project", "$(VCTargetsPath)\\BuildCustomizations\\CUDA " + + this->GlobalGenerator->GetPlatformToolsetCudaString() + + ".targets"); + } + if (this->GlobalGenerator->IsMasmEnabled()) { + Elem(e1, "Import") + .Attribute("Project", + "$(VCTargetsPath)\\BuildCustomizations\\masm.targets") + .EndElement(); + } + if (this->GlobalGenerator->IsNasmEnabled()) { + std::string nasmTargets = + GetCMakeFilePath("Templates/MSBuild/nasm.targets"); + Elem(e1, "Import").Attribute("Project", nasmTargets).EndElement(); + } + e1.EndElement(); + } if (this->ProjectType == csproj) { for (std::string const& i : this->Configurations) { - this->WriteString("\n"; - this->WriteEvents(i); - this->WriteString("\n", 1); + Elem e1(e0, "PropertyGroup"); + e1.Attribute("Condition", "'$(Configuration)' == '" + i + "'"); + e1.SetHasElements(); + this->WriteEvents(e1, i); + e1.EndElement(); } // make sure custom commands are executed before build (if necessary) - this->WriteString("\n", 1); + Elem e1(e0, "PropertyGroup"); + e1.SetHasElements(); this->WriteString("\n", 2); for (std::string const& i : this->CSharpCustomCommandNames) { this->WriteString(i.c_str(), 3); @@ -699,14 +700,14 @@ void cmVisualStudio10TargetGenerator::Generate() } this->WriteString("$(BuildDependsOn)\n", 3); this->WriteString("\n", 2); - this->WriteString("\n", 1); + e1.EndElement(); } this->WriteString("", 0); // The groups are stored in a separate file for VS 10 this->WriteGroups(); } -void cmVisualStudio10TargetGenerator::WriteDotNetReferences() +void cmVisualStudio10TargetGenerator::WriteDotNetReferences(Elem& e0) { std::vector references; if (const char* vsDotNetReferences = @@ -730,7 +731,7 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferences() } } if (!references.empty() || !this->DotNetHintReferences.empty()) { - this->WriteString("\n", 1); + Elem e1(e0, "ItemGroup"); for (std::string const& ri : references) { // if the entry from VS_DOTNET_REFERENCES is an existing file, generate // a new hint-reference and name it from the filename @@ -741,35 +742,34 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferences() this->DotNetHintReferences[""].push_back( DotNetHintReference(name, path)); } else { - this->WriteDotNetReference(ri, "", ""); + this->WriteDotNetReference(e1, ri, "", ""); } } for (const auto& h : this->DotNetHintReferences) { // DotNetHintReferences is also populated from AddLibraries(). // The configuration specific hint references are added there. for (const auto& i : h.second) { - this->WriteDotNetReference(i.first, i.second, h.first); + this->WriteDotNetReference(e1, i.first, i.second, h.first); } } - this->WriteString("\n", 1); + e1.EndElement(); } } void cmVisualStudio10TargetGenerator::WriteDotNetReference( - std::string const& ref, std::string const& hint, std::string const& config) + Elem& e1, std::string const& ref, std::string const& hint, + std::string const& config) { - std::string attr = " Include=\"" + cmVS10EscapeAttr(ref) + "\""; + Elem e2(e1, "Reference"); // If 'config' is not empty, the reference is only added for the given // configuration. This is used when referencing imported managed assemblies. // See also cmVisualStudio10TargetGenerator::AddLibraries(). if (!config.empty()) { - this->WritePlatformConfigTag("Reference", config, 2, attr.c_str()); - } else { - this->WriteString("BuildFileStream) << attr << ">\n"; + e2.Attribute("Condition", this->CalcCondition(config)); } - this->WriteElem("CopyLocalSatelliteAssemblies", "true", 3); - this->WriteElem("ReferenceOutputAssembly", "true", 3); + e2.Attribute("Include", ref); + e2.Element("CopyLocalSatelliteAssemblies", "true"); + e2.Element("ReferenceOutputAssembly", "true"); if (!hint.empty()) { const char* privateReference = "True"; if (const char* value = this->GeneratorTarget->GetProperty( @@ -778,15 +778,15 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReference( privateReference = "False"; } } - this->WriteElem("Private", privateReference, 3); - this->WriteElem("HintPath", hint, 3); + e2.Element("Private", privateReference); + e2.Element("HintPath", hint); } - this->WriteDotNetReferenceCustomTags(ref); - this->WriteString("\n", 2); + this->WriteDotNetReferenceCustomTags(e2, ref); + e2.EndElement(); } void cmVisualStudio10TargetGenerator::WriteDotNetReferenceCustomTags( - std::string const& ref) + Elem& e2, std::string const& ref) { static const std::string refpropPrefix = "VS_DOTNET_REFERENCEPROP_"; @@ -805,23 +805,20 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferenceCustomTags( } } for (auto const& tag : tags) { - this->WriteString("<", 3); - (*this->BuildFileStream) << tag.first << ">" << cmVS10EscapeXML(tag.second) - << "\n"; + e2.Element(tag.first.c_str(), tag.second); } } -void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup() +void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup(Elem& e0) { std::vector resxObjs; this->GeneratorTarget->GetResxSources(resxObjs, ""); if (!resxObjs.empty()) { - this->WriteString("\n", 1); + Elem e1(e0, "ItemGroup"); std::string srcDir = this->Makefile->GetCurrentSourceDirectory(); ConvertToWindowsSlash(srcDir); for (cmSourceFile const* oi : resxObjs) { std::string obj = oi->GetFullPath(); - this->WriteString("ProjectType == csproj && this->InSourceBuild) { @@ -835,22 +832,22 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup() useRelativePath = true; } } - (*this->BuildFileStream) << obj << "\">\n"; + Elem e2(e1, "EmbeddedResource"); + e2.Attribute("Include", obj); if (this->ProjectType != csproj) { std::string hFileName = obj.substr(0, obj.find_last_of(".")) + ".h"; - this->WriteElem("DependentUpon", hFileName, 3); + e2.Element("DependentUpon", hFileName); for (std::string const& i : this->Configurations) { - this->WritePlatformConfigTag("LogicalName", i, 3); + std::string s; if (this->GeneratorTarget->GetProperty("VS_GLOBAL_ROOTNAMESPACE") || // Handle variant of VS_GLOBAL_ for RootNamespace. this->GeneratorTarget->GetProperty("VS_GLOBAL_RootNamespace")) { - (*this->BuildFileStream) << "$(RootNamespace)."; + s = "$(RootNamespace)."; } - (*this->BuildFileStream) << "%(Filename)"; - (*this->BuildFileStream) << ".resources"; - (*this->BuildFileStream) << "\n"; + s += "%(Filename).resources"; + this->WritePlatformConfigTag("LogicalName", i, e2.Indent + 1, s); } } else { std::string binDir = this->Makefile->GetCurrentBinaryDirectory(); @@ -867,7 +864,7 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup() link = cmsys::SystemTools::GetFilenameName(obj); } if (!link.empty()) { - this->WriteElem("Link", link, 3); + e2.Element("Link", link); } } // Determine if this is a generated resource from a .Designer.cs file @@ -881,7 +878,7 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup() generator = g; } if (!generator.empty()) { - this->WriteElemEscapeXML("Generator", generator, 3); + e2.Element("Generator", generator); if (designerResource.find(srcDir) == 0) { designerResource = designerResource.substr(srcDir.length() + 1); } else if (designerResource.find(binDir) == 0) { @@ -891,7 +888,7 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup() cmsys::SystemTools::GetFilenameName(designerResource); } ConvertToWindowsSlash(designerResource); - this->WriteElem("LastGenOutput", designerResource, 3); + e2.Element("LastGenOutput", designerResource); } } const cmPropertyMap& props = oi->GetProperties(); @@ -902,28 +899,25 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup() if (!tagName.empty()) { std::string value = props.GetPropertyValue(p.first); if (!value.empty()) { - this->WriteString("<", 3); - (*this->BuildFileStream) << tagName << ">"; - (*this->BuildFileStream) << cmVS10EscapeXML(value); - (*this->BuildFileStream) << "\n"; + e2.Element(tagName.c_str(), value); } } } } } - this->WriteString("\n", 2); + e2.EndElement(); } - this->WriteString("\n", 1); + e1.EndElement(); } } -void cmVisualStudio10TargetGenerator::WriteXamlFilesGroup() +void cmVisualStudio10TargetGenerator::WriteXamlFilesGroup(Elem& e0) { std::vector xamlObjs; this->GeneratorTarget->GetXamlSources(xamlObjs, ""); if (!xamlObjs.empty()) { - Elem e1(*this->BuildFileStream, 1); + Elem e1(e0); e1.StartElement("ItemGroup"); for (cmSourceFile const* oi : xamlObjs) { std::string obj = oi->GetFullPath(); @@ -962,43 +956,45 @@ void cmVisualStudio10TargetGenerator::WriteXamlFilesGroup() } } -void cmVisualStudio10TargetGenerator::WriteTargetSpecificReferences() +void cmVisualStudio10TargetGenerator::WriteTargetSpecificReferences(Elem& e0) { if (this->MSTools) { if (this->GlobalGenerator->TargetsWindowsPhone() && this->GlobalGenerator->GetSystemVersion() == "8.0") { - this->WriteString("\n", - 1); + Elem(e0, "Import") + .Attribute("Project", + "$(MSBuildExtensionsPath)\\Microsoft\\WindowsPhone\\v" + "$(TargetPlatformVersion)\\Microsoft.Cpp.WindowsPhone." + "$(TargetPlatformVersion).targets") + .EndElement(); } } } -void cmVisualStudio10TargetGenerator::WriteTargetsFileReferences() +void cmVisualStudio10TargetGenerator::WriteTargetsFileReferences(Elem& e1) { for (TargetsFileAndConfigs const& tac : this->TargetsFileAndConfigsVec) { - this->WriteString("BuildFileStream) << tac.File << "\" "; - (*this->BuildFileStream) << "Condition=\""; - (*this->BuildFileStream) << "Exists('" << tac.File << "')"; + std::ostringstream oss; + oss << "Exists('" << tac.File << "')"; if (!tac.Configs.empty()) { - (*this->BuildFileStream) << " And ("; + oss << " And ("; for (size_t j = 0; j < tac.Configs.size(); ++j) { if (j > 0) { - (*this->BuildFileStream) << " Or "; + oss << " Or "; } - (*this->BuildFileStream) << "'$(Configuration)'=='" << tac.Configs[j] - << "'"; + oss << "'$(Configuration)'=='" << tac.Configs[j] << "'"; } - (*this->BuildFileStream) << ")"; + oss << ")"; } - (*this->BuildFileStream) << "\" />\n"; + + Elem(e1, "Import") + .Attribute("Project", tac.File) + .Attribute("Condition", oss.str()) + .EndElement(); } } -void cmVisualStudio10TargetGenerator::WriteWinRTReferences() +void cmVisualStudio10TargetGenerator::WriteWinRTReferences(Elem& e0) { std::vector references; if (const char* vsWinRTReferences = @@ -1012,69 +1008,72 @@ void cmVisualStudio10TargetGenerator::WriteWinRTReferences() references.push_back("platform.winmd"); } if (!references.empty()) { - this->WriteString("\n", 1); + Elem e1(e0, "ItemGroup"); for (std::string const& ri : references) { - this->WriteString("BuildFileStream) << cmVS10EscapeAttr(ri) << "\">\n"; - this->WriteElem("IsWinMDFile", "true", 3); - this->WriteString("\n", 2); + Elem e2(e1, "Reference"); + e2.Attribute("Include", ri); + e2.Element("IsWinMDFile", "true"); + e2.EndElement(); } - this->WriteString("\n", 1); + e1.EndElement(); } } // ConfigurationType Application, Utility StaticLibrary DynamicLibrary -void cmVisualStudio10TargetGenerator::WriteProjectConfigurations() +void cmVisualStudio10TargetGenerator::WriteProjectConfigurations(Elem& e0) { - this->WriteString("\n", 1); + Elem e1(e0, "ItemGroup"); + e1.Attribute("Label", "ProjectConfigurations"); for (std::string const& c : this->Configurations) { - this->WriteString("BuildFileStream) << c << "|" << this->Platform << "\">\n"; - this->WriteElem("Configuration", c, 3); - this->WriteElemEscapeXML("Platform", this->Platform, 3); - this->WriteString("\n", 2); + Elem e2(e1, "ProjectConfiguration"); + e2.Attribute("Include", c + "|" + this->Platform); + e2.Element("Configuration", c); + e2.Element("Platform", this->Platform); + e2.EndElement(); } - this->WriteString("\n", 1); + e1.EndElement(); } -void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() +void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues(Elem& e0) { for (std::string const& c : this->Configurations) { - this->WritePlatformConfigTag("PropertyGroup", c, 1, - " Label=\"Configuration\""); + Elem e1(e0); + e1.StartElement("PropertyGroup"); + e1.Attribute("Condition", this->CalcCondition(c)); + e1.Attribute("Label", "Configuration"); if (this->ProjectType != csproj) { - std::string configType = ""; + std::string configType; if (const char* vsConfigurationType = this->GeneratorTarget->GetProperty("VS_CONFIGURATION_TYPE")) { - configType += cmVS10EscapeXML(vsConfigurationType); + configType = cmVS10EscapeXML(vsConfigurationType); } else { switch (this->GeneratorTarget->GetType()) { case cmStateEnums::SHARED_LIBRARY: case cmStateEnums::MODULE_LIBRARY: - configType += "DynamicLibrary"; + configType = "DynamicLibrary"; break; case cmStateEnums::OBJECT_LIBRARY: case cmStateEnums::STATIC_LIBRARY: - configType += "StaticLibrary"; + configType = "StaticLibrary"; break; case cmStateEnums::EXECUTABLE: if (this->NsightTegra && !this->GeneratorTarget->GetPropertyAsBool("ANDROID_GUI")) { // Android executables are .so too. - configType += "DynamicLibrary"; + configType = "DynamicLibrary"; } else { - configType += "Application"; + configType = "Application"; } break; case cmStateEnums::UTILITY: case cmStateEnums::GLOBAL_TARGET: if (this->NsightTegra) { // Tegra-Android platform does not understand "Utility". - configType += "StaticLibrary"; + configType = "StaticLibrary"; } else { - configType += "Utility"; + configType = "Utility"; } break; case cmStateEnums::UNKNOWN_LIBRARY: @@ -1082,26 +1081,25 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() break; } } - configType += "\n"; - this->WriteString(configType.c_str(), 2); + e1.Element("ConfigurationType", configType); } if (this->MSTools) { if (!this->Managed) { - this->WriteMSToolConfigurationValues(c); + this->WriteMSToolConfigurationValues(e1, c); } else { - this->WriteMSToolConfigurationValuesManaged(c); + this->WriteMSToolConfigurationValuesManaged(e1, c); } } else if (this->NsightTegra) { - this->WriteNsightTegraConfigurationValues(c); + this->WriteNsightTegraConfigurationValues(e1, c); } - this->WriteString("\n", 1); + e1.EndElement(); } } void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues( - std::string const& config) + Elem& e1, std::string const& config) { cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator; const char* mfcFlag = this->Makefile->GetDefinition("CMAKE_MFC_FLAG"); @@ -1116,7 +1114,7 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues( useOfMfcValue = "Dynamic"; } } - this->WriteElem("UseOfMfc", useOfMfcValue, 2); + e1.Element("UseOfMfc", useOfMfcValue); } if ((this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY && @@ -1125,46 +1123,46 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues( this->GlobalGenerator->TargetsWindowsPhone() || this->GlobalGenerator->TargetsWindowsStore() || this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) { - this->WriteElem("CharacterSet", "Unicode", 2); + e1.Element("CharacterSet", "Unicode"); } else if (this->GeneratorTarget->GetType() <= cmStateEnums::MODULE_LIBRARY && this->ClOptions[config]->UsingSBCS()) { - this->WriteElem("CharacterSet", "NotSet", 2); + e1.Element("CharacterSet", "NotSet"); } else { - this->WriteElem("CharacterSet", "MultiByte", 2); + e1.Element("CharacterSet", "MultiByte"); } if (const char* toolset = gg->GetPlatformToolset()) { - this->WriteElem("PlatformToolset", toolset, 2); + e1.Element("PlatformToolset", toolset); } if (this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT") || this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) { - this->WriteElem("WindowsAppContainer", "true", 2); + e1.Element("WindowsAppContainer", "true"); } } void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValuesManaged( - std::string const& config) + Elem& e1, std::string const& config) { cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator; Options& o = *(this->ClOptions[config]); if (o.IsDebug()) { - this->WriteElem("DebugSymbols", "true", 2); - this->WriteElem("DefineDebug", "true", 2); + e1.Element("DebugSymbols", "true"); + e1.Element("DefineDebug", "true"); } std::string outDir = this->GeneratorTarget->GetDirectory(config) + "/"; ConvertToWindowsSlash(outDir); - this->WriteElemEscapeXML("OutputPath", outDir, 2); + e1.Element("OutputPath", outDir); if (o.HasFlag("Platform")) { - this->WriteElemEscapeXML("PlatformTarget", o.GetFlag("Platform"), 2); + e1.Element("PlatformTarget", o.GetFlag("Platform")); o.RemoveFlag("Platform"); } if (const char* toolset = gg->GetPlatformToolset()) { - this->WriteElemEscapeXML("PlatformToolset", toolset, 2); + e1.Element("PlatformToolset", toolset); } std::string postfixName = cmSystemTools::UpperCase(config); @@ -1174,55 +1172,49 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValuesManaged( if (const char* postfix = this->GeneratorTarget->GetProperty(postfixName)) { assemblyName += postfix; } - this->WriteElemEscapeXML("AssemblyName", assemblyName, 2); + e1.Element("AssemblyName", assemblyName); if (cmStateEnums::EXECUTABLE == this->GeneratorTarget->GetType()) { - this->WriteElem("StartAction", "Program", 2); - this->WriteString("", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(outDir) - << cmVS10EscapeXML(assemblyName) - << ".exe\n"; + e1.Element("StartAction", "Program"); + e1.Element("StartProgram", outDir + assemblyName + ".exe"); } - o.OutputFlagMap(*this->BuildFileStream, 2); + o.OutputFlagMap(e1.S, e1.Indent + 1); } //---------------------------------------------------------------------------- void cmVisualStudio10TargetGenerator::WriteNsightTegraConfigurationValues( - std::string const&) + Elem& e1, std::string const&) { cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator; const char* toolset = gg->GetPlatformToolset(); - std::string ntv = ""; - ntv += toolset ? toolset : "Default"; - ntv += "\n"; - this->WriteString(ntv.c_str(), 2); + e1.Element("NdkToolchainVersion", toolset ? toolset : "Default"); if (const char* minApi = this->GeneratorTarget->GetProperty("ANDROID_API_MIN")) { - this->WriteElem("AndroidMinAPI", "android-" + cmVS10EscapeXML(minApi), 2); + e1.Element("AndroidMinAPI", "android-" + std::string(minApi)); } if (const char* api = this->GeneratorTarget->GetProperty("ANDROID_API")) { - this->WriteElem("AndroidTargetAPI", "android-" + cmVS10EscapeXML(api), 2); + e1.Element("AndroidTargetAPI", "android-" + std::string(api)); } if (const char* cpuArch = this->GeneratorTarget->GetProperty("ANDROID_ARCH")) { - this->WriteElemEscapeXML("AndroidArch", cpuArch, 2); + e1.Element("AndroidArch", cpuArch); } if (const char* stlType = this->GeneratorTarget->GetProperty("ANDROID_STL_TYPE")) { - this->WriteElemEscapeXML("AndroidStlType", stlType, 2); + e1.Element("AndroidStlType", stlType); } } -void cmVisualStudio10TargetGenerator::WriteCustomCommands() +void cmVisualStudio10TargetGenerator::WriteCustomCommands(Elem& e0) { this->CSharpCustomCommandNames.clear(); std::vector customCommands; this->GeneratorTarget->GetCustomCommands(customCommands, ""); for (cmSourceFile const* si : customCommands) { - this->WriteCustomCommand(si); + this->WriteCustomCommand(e0, si); } // Add CMakeLists.txt file with rule to re-run CMake for user convenience. @@ -1230,13 +1222,13 @@ void cmVisualStudio10TargetGenerator::WriteCustomCommands() this->GeneratorTarget->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) { if (cmSourceFile const* sf = this->LocalGenerator->CreateVCProjBuildRule()) { - this->WriteCustomCommand(sf); + this->WriteCustomCommand(e0, sf); } } } void cmVisualStudio10TargetGenerator::WriteCustomCommand( - cmSourceFile const* sf) + Elem& e0, cmSourceFile const* sf) { if (this->LocalGenerator->GetSourcesVisited(this->GeneratorTarget) .insert(sf) @@ -1244,18 +1236,18 @@ void cmVisualStudio10TargetGenerator::WriteCustomCommand( if (std::vector const* depends = this->GeneratorTarget->GetSourceDepends(sf)) { for (cmSourceFile const* di : *depends) { - this->WriteCustomCommand(di); + this->WriteCustomCommand(e0, di); } } if (cmCustomCommand const* command = sf->GetCustomCommand()) { // C# projects write their within WriteCustomRule() - this->WriteCustomRule(sf, *command); + this->WriteCustomRule(e0, sf, *command); } } } void cmVisualStudio10TargetGenerator::WriteCustomRule( - cmSourceFile const* source, cmCustomCommand const& command) + Elem& e0, cmSourceFile const* source, cmCustomCommand const& command) { std::string sourcePath = source->GetFullPath(); // VS 10 will always rebuild a custom command attached to a .rule @@ -1284,8 +1276,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule( } cmLocalVisualStudio7Generator* lg = this->LocalGenerator; - Elem e1(*this->BuildFileStream, 1); - e1.StartElement("ItemGroup"); + Elem e1(e0, "ItemGroup"); Elem e2(e1); if (this->ProjectType != csproj) { this->WriteSource(e2, "CustomBuild", source); @@ -1328,8 +1319,8 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule( if (this->ProjectType == csproj) { std::string name = "CustomCommand_" + c + "_" + cmSystemTools::ComputeStringMD5(sourcePath); - this->WriteCustomRuleCSharp(c, name, script, inputs.str(), outputs.str(), - comment); + this->WriteCustomRuleCSharp(e0, c, name, script, inputs.str(), + outputs.str(), comment); } else { this->WriteCustomRuleCpp(e2, c, script, inputs.str(), outputs.str(), comment); @@ -1361,24 +1352,20 @@ void cmVisualStudio10TargetGenerator::WriteCustomRuleCpp( } void cmVisualStudio10TargetGenerator::WriteCustomRuleCSharp( - std::string const& config, std::string const& name, + Elem& e0, std::string const& config, std::string const& name, std::string const& script, std::string const& inputs, std::string const& outputs, std::string const& comment) { this->CSharpCustomCommandNames.insert(name); - Elem e1(*this->BuildFileStream, 1); - e1.StartElement("Target"); + Elem e1(e0, "Target"); e1.Attribute("Condition", this->CalcCondition(config)); e1.S << "\n Name=\"" << name << "\""; e1.S << "\n Inputs=\"" << cmVS10EscapeAttr(inputs) << "\""; e1.S << "\n Outputs=\"" << cmVS10EscapeAttr(outputs) << "\""; if (!comment.empty()) { - Elem(e1) - .StartElement("Exec") - .Attribute("Command", "echo " + comment) - .EndElement(); + Elem(e1, "Exec").Attribute("Command", "echo " + comment).EndElement(); } - Elem(e1).StartElement("Exec").Attribute("Command", script).EndElement(); + Elem(e1, "Exec").Attribute("Command", script).EndElement(); e1.EndElement(); } @@ -1442,8 +1429,8 @@ void cmVisualStudio10TargetGenerator::WriteGroups() Elem e0(fout, 0); e0.StartElement("Project"); - e0.Attr("ToolsVersion", toolsVer); - e0.Attr("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"); + e0.Attribute("ToolsVersion", toolsVer); + e0.Attribute("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"); e0.SetHasElements(); for (auto const& ti : this->Tools) { @@ -1459,24 +1446,24 @@ void cmVisualStudio10TargetGenerator::WriteGroups() cmSystemTools::LowerCase(cmSystemTools::GetFilenameName(oi)); if (fileName == "wmappmanifest.xml") { Elem e2(e1, "XML"); - e2.Attr("Include", oi); - Elem(e2).WriteElem("Filter", "Resource Files"); + e2.Attribute("Include", oi); + e2.Element("Filter", "Resource Files"); e2.EndElement(); } else if (cmSystemTools::GetFilenameExtension(fileName) == ".appxmanifest") { Elem e2(e1, "AppxManifest"); - e2.Attr("Include", oi); - Elem(e2).WriteElem("Filter", "Resource Files"); + e2.Attribute("Include", oi); + e2.Element("Filter", "Resource Files"); e2.EndElement(); } else if (cmSystemTools::GetFilenameExtension(fileName) == ".pfx") { Elem e2(e1, "None"); - e2.Attr("Include", oi); - Elem(e2).WriteElem("Filter", "Resource Files"); + e2.Attribute("Include", oi); + e2.Element("Filter", "Resource Files"); e2.EndElement(); } else { Elem e2(e1, "Image"); - e2.Attr("Include", oi); - Elem(e2).WriteElem("Filter", "Resource Files"); + e2.Attribute("Include", oi); + e2.Element("Filter", "Resource Files"); e2.EndElement(); } } @@ -1491,8 +1478,8 @@ void cmVisualStudio10TargetGenerator::WriteGroups() std::string obj = oi->GetFullPath(); ConvertToWindowsSlash(obj); Elem e2(e1, "EmbeddedResource"); - e2.Attr("Include", cmVS10EscapeAttr(obj)); - Elem(e2).WriteElem("Filter", "Resource Files"); + e2.Attribute("Include", obj); + e2.Element("Filter", "Resource Files"); e2.EndElement(); } e1.EndElement(); @@ -1511,8 +1498,8 @@ void cmVisualStudio10TargetGenerator::WriteGroups() std::string guidName = "SG_Filter_" + name; std::string guid = this->GlobalGenerator->GetGUID(guidName); Elem e2(e1, "Filter"); - e2.Attr("Include", name); - Elem(e2).WriteElem("UniqueIdentifier", "{" + guid + "}"); + e2.Attribute("Include", name); + e2.Element("UniqueIdentifier", "{" + guid + "}"); e2.EndElement(); } } @@ -1521,11 +1508,11 @@ void cmVisualStudio10TargetGenerator::WriteGroups() std::string guidName = "SG_Filter_Resource Files"; std::string guid = this->GlobalGenerator->GetGUID(guidName); Elem e2(e1, "Filter"); - e2.Attr("Include", "Resource Files"); - Elem(e2).WriteElem("UniqueIdentifier", "{" + guid + "}"); - Elem(e2).WriteElem("Extensions", - "rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;" - "gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms"); + e2.Attribute("Include", "Resource Files"); + e2.Element("UniqueIdentifier", "{" + guid + "}"); + e2.Element("Extensions", + "rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;" + "gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms"); e2.EndElement(); } @@ -1589,19 +1576,20 @@ void cmVisualStudio10TargetGenerator::WriteGroupSources( std::string path = this->ConvertPath(source, s.RelativePath); ConvertToWindowsSlash(path); Elem e2(e1, name.c_str()); - e2.Attr("Include", cmVS10EscapeAttr(path)); + e2.Attribute("Include", path); if (!filter.empty()) { - Elem(e2).WriteElem("Filter", filter); + e2.Element("Filter", filter); } e2.EndElement(); } e1.EndElement(); } -void cmVisualStudio10TargetGenerator::WriteHeaderSource(cmSourceFile const* sf) +void cmVisualStudio10TargetGenerator::WriteHeaderSource(Elem& e1, + cmSourceFile const* sf) { std::string const& fileName = sf->GetFullPath(); - Elem e2(*this->BuildFileStream, 2); + Elem e2(e1); this->WriteSource(e2, "ClInclude", sf); if (this->IsResxHeader(fileName)) { e2.Element("FileType", "CppForm"); @@ -1612,7 +1600,8 @@ void cmVisualStudio10TargetGenerator::WriteHeaderSource(cmSourceFile const* sf) e2.EndElement(); } -void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) +void cmVisualStudio10TargetGenerator::WriteExtraSource(Elem& e1, + cmSourceFile const* sf) { bool toolHasSettings = false; const char* tool = "None"; @@ -1770,7 +1759,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) } } - Elem e2(*this->BuildFileStream, 2); + Elem e2(e1); this->WriteSource(e2, tool, sf); if (toolHasSettings) { e2.SetHasElements(); @@ -1781,60 +1770,47 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) ge.Parse(deployContent); // Deployment location cannot be set on a configuration basis if (!deployLocation.empty()) { - this->WriteString("", 3); - (*this->BuildFileStream) << deployLocation - << "\\%(FileName)%(Extension)"; - this->WriteString("\n", 0); + e2.Element("Link", deployLocation + "\\%(FileName)%(Extension)"); } for (size_t i = 0; i != this->Configurations.size(); ++i) { if (0 == strcmp(cge->Evaluate(this->LocalGenerator, this->Configurations[i]), "1")) { - this->WriteString("BuildFileStream) << this->Configurations[i] << "|" - << this->Platform << "'\">true"; - this->WriteString("\n", 0); + Elem e3(e2, "DeploymentContent"); + e3.Attribute("Condition", "'$(Configuration)|$(Platform)'=='" + + this->Configurations[i] + "|" + this->Platform + "'"); + e3.Content("true"); } else { - this->WriteString("BuildFileStream) << this->Configurations[i] << "|" - << this->Platform << "'\">true"; - this->WriteString("\n", 0); + Elem e3(e2, "ExcludedFromBuild"); + e3.Attribute("Condition", "'$(Configuration)|$(Platform)'=='" + + this->Configurations[i] + "|" + this->Platform + "'"); + e3.Content("true"); } } } if (!shaderType.empty()) { - this->WriteElemEscapeXML("ShaderType", shaderType, 3); + e2.Element("ShaderType", shaderType); } if (!shaderEntryPoint.empty()) { - this->WriteElemEscapeXML("EntryPointName", shaderEntryPoint, 3); + e2.Element("EntryPointName", shaderEntryPoint); } if (!shaderModel.empty()) { - this->WriteElemEscapeXML("ShaderModel", shaderModel, 3); + e2.Element("ShaderModel", shaderModel); } if (!outputHeaderFile.empty()) { for (size_t i = 0; i != this->Configurations.size(); ++i) { - this->WriteString("BuildFileStream) << this->Configurations[i] << "|" - << this->Platform << "'\">" - << cmVS10EscapeXML(outputHeaderFile); - this->WriteString("\n", 0); + Elem e3(e2, "HeaderFileOutput"); + e3.Attribute("Condition", "'$(Configuration)|$(Platform)'=='" + + this->Configurations[i] + "|" + this->Platform + "'"); + e3.Content(outputHeaderFile); } } if (!variableName.empty()) { for (size_t i = 0; i != this->Configurations.size(); ++i) { - this->WriteString("BuildFileStream) << this->Configurations[i] << "|" - << this->Platform << "'\">" - << cmVS10EscapeXML(variableName); - this->WriteString("\n", 0); + Elem e3(e2, "VariableName"); + e3.Attribute("Condition", "'$(Configuration)|$(Platform)'=='" + + this->Configurations[i] + "|" + this->Platform + "'"); + e3.Content(variableName); } } if (!shaderEnableDebug.empty()) { @@ -1846,11 +1822,10 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) const char* enableDebug = cge->Evaluate(this->LocalGenerator, this->Configurations[i]); if (strlen(enableDebug) > 0) { - Elem el(*this->BuildFileStream, 3); - el.StartElement("EnableDebuggingInformation"); - el.Attribute("Condition", "'$(Configuration)|$(Platform)'=='" + + Elem e3(e2, "EnableDebuggingInformation"); + e3.Attribute("Condition", "'$(Configuration)|$(Platform)'=='" + this->Configurations[i] + "|" + this->Platform + "'"); - el.Content(cmSystemTools::IsOn(enableDebug) ? "true" : "false"); + e3.Content(cmSystemTools::IsOn(enableDebug) ? "true" : "false"); } } } @@ -1863,41 +1838,40 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) const char* disableOptimizations = cge->Evaluate(this->LocalGenerator, this->Configurations[i]); if (strlen(disableOptimizations) > 0) { - Elem el(*this->BuildFileStream, 3); - el.StartElement("DisableOptimizations"); - el.Attribute("Condition", "'$(Configuration)|$(Platform)'=='" + + Elem e3(e2, "DisableOptimizations"); + e3.Attribute("Condition", "'$(Configuration)|$(Platform)'=='" + this->Configurations[i] + "|" + this->Platform + "'"); - el.Content(cmSystemTools::IsOn(disableOptimizations) ? "true" + e3.Content(cmSystemTools::IsOn(disableOptimizations) ? "true" : "false"); } } } if (!shaderObjectFileName.empty()) { - this->WriteElemEscapeXML("ObjectFileOutput", shaderObjectFileName, 3); + e2.Element("ObjectFileOutput", shaderObjectFileName); } if (!shaderAdditionalFlags.empty()) { - this->WriteElemEscapeXML("AdditionalOptions", shaderAdditionalFlags, 3); + e2.Element("AdditionalOptions", shaderAdditionalFlags); } if (!settingsGenerator.empty()) { - this->WriteElemEscapeXML("Generator", settingsGenerator, 3); + e2.Element("Generator", settingsGenerator); } if (!settingsLastGenOutput.empty()) { - this->WriteElemEscapeXML("LastGenOutput", settingsLastGenOutput, 3); + e2.Element("LastGenOutput", settingsLastGenOutput); } if (!sourceLink.empty()) { - this->WriteElemEscapeXML("Link", sourceLink, 3); + e2.Element("Link", sourceLink); } if (!subType.empty()) { - this->WriteElemEscapeXML("SubType", subType, 3); + e2.Element("SubType", subType); } if (!copyToOutDir.empty()) { - this->WriteElemEscapeXML("CopyToOutputDirectory", copyToOutDir, 3); + e2.Element("CopyToOutputDirectory", copyToOutDir); } if (!includeInVsix.empty()) { - this->WriteElemEscapeXML("IncludeInVSIX", includeInVsix, 3); + e2.Element("IncludeInVSIX", includeInVsix); } // write source file specific tags - this->WriteCSharpSourceProperties(sourceFileTags); + this->WriteCSharpSourceProperties(e2, sourceFileTags); } e2.WriteEndTag(tool); } @@ -1946,12 +1920,12 @@ void cmVisualStudio10TargetGenerator::WriteSource(Elem& e2, this->Tools[tool].push_back(toolSource); } -void cmVisualStudio10TargetGenerator::WriteAllSources() +void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0) { if (this->GeneratorTarget->GetType() > cmStateEnums::UTILITY) { return; } - this->WriteString("\n", 1); + Elem e1(e0, "ItemGroup"); std::vector all_configs; for (size_t ci = 0; ci < this->Configurations.size(); ++ci) { @@ -1996,10 +1970,10 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() } break; case cmGeneratorTarget::SourceKindExtra: - this->WriteExtraSource(si.Source); + this->WriteExtraSource(e1, si.Source); break; case cmGeneratorTarget::SourceKindHeader: - this->WriteHeaderSource(si.Source); + this->WriteHeaderSource(e1, si.Source); break; case cmGeneratorTarget::SourceKindIDL: tool = "Midl"; @@ -2046,7 +2020,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() include_configs.begin(), include_configs.end(), std::back_inserter(exclude_configs)); - Elem e2(*this->BuildFileStream, 2); + Elem e2(e1); this->WriteSource(e2, tool, si.Source); if (si.Kind == cmGeneratorTarget::SourceKindObjectSource) { this->OutputSourceSpecificFlags(e2, si.Source); @@ -2059,10 +2033,10 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() } if (this->IsMissingFiles) { - this->WriteMissingFiles(); + this->WriteMissingFiles(e1); } - this->WriteString("\n", 1); + e1.EndElement(); } void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( @@ -2131,9 +2105,9 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( if (!objectName.empty()) { e2.SetHasElements(); if (lang == "CUDA") { - this->WriteElem("CompileOut", "$(IntDir)/" + objectName, 3); + e2.Element("CompileOut", "$(IntDir)/" + objectName); } else { - this->WriteElem("ObjectFileName", "$(IntDir)/" + objectName, 3); + e2.Element("ObjectFileName", "$(IntDir)/" + objectName); } } for (std::string const& config : this->Configurations) { @@ -2220,17 +2194,16 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( clOptions.AddIncludes(includeList); clOptions.SetConfiguration(config); clOptions.PrependInheritedString("AdditionalOptions"); - clOptions.OutputAdditionalIncludeDirectories(*this->BuildFileStream, 3, - lang); - clOptions.OutputFlagMap(*this->BuildFileStream, 3); - clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, 3, lang); + clOptions.OutputAdditionalIncludeDirectories(e2.S, e2.Indent + 1, lang); + clOptions.OutputFlagMap(e2.S, e2.Indent + 1); + clOptions.OutputPreprocessorDefinitions(e2.S, e2.Indent + 1, lang); } } if (this->IsXamlSource(source->GetFullPath())) { e2.SetHasElements(); const std::string& fileName = source->GetFullPath(); std::string xamlFileName = fileName.substr(0, fileName.find_last_of(".")); - this->WriteElem("DependentUpon", xamlFileName, 3); + e2.Element("DependentUpon", xamlFileName); } if (this->ProjectType == csproj) { std::string f = source->GetFullPath(); @@ -2245,8 +2218,7 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( this->GetCSharpSourceProperties(&sf, sourceFileTags); // write source file specific tags if (!sourceFileTags.empty()) { - e2.SetHasElements(); - this->WriteCSharpSourceProperties(sourceFileTags); + this->WriteCSharpSourceProperties(e2, sourceFileTags); } } } @@ -2262,7 +2234,8 @@ void cmVisualStudio10TargetGenerator::WriteExcludeFromBuild( } } -void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions() +void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions( + Elem& e0) { cmStateEnums::TargetType ttype = this->GeneratorTarget->GetType(); if (ttype > cmStateEnums::GLOBAL_TARGET) { @@ -2272,14 +2245,13 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions() return; } - this->WriteString("\n", 1); - this->WriteElem("_ProjectFileVersion", "10.0.20506.1", 2); + Elem e1(e0, "PropertyGroup"); + e1.Element("_ProjectFileVersion", "10.0.20506.1"); for (std::string const& config : this->Configurations) { if (ttype >= cmStateEnums::UTILITY) { - this->WritePlatformConfigTag("IntDir", config, 2); - *this->BuildFileStream - << "$(Platform)\\$(Configuration)\\$(ProjectName)\\" - << "\n"; + this->WritePlatformConfigTag( + "IntDir", config, e1.Indent + 1, + "$(Platform)\\$(Configuration)\\$(ProjectName)\\"); } else { std::string intermediateDir = this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); @@ -2299,81 +2271,68 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions() ConvertToWindowsSlash(intermediateDir); ConvertToWindowsSlash(outDir); - this->WritePlatformConfigTag("OutDir", config, 2); - *this->BuildFileStream << cmVS10EscapeXML(outDir) << "\n"; + this->WritePlatformConfigTag("OutDir", config, e1.Indent + 1, outDir); - this->WritePlatformConfigTag("IntDir", config, 2); - *this->BuildFileStream << cmVS10EscapeXML(intermediateDir) - << "\n"; + this->WritePlatformConfigTag("IntDir", config, e1.Indent + 1, + intermediateDir); if (const char* sdkExecutableDirectories = this->Makefile->GetDefinition( "CMAKE_VS_SDK_EXECUTABLE_DIRECTORIES")) { - this->WritePlatformConfigTag("ExecutablePath", config, 2); - *this->BuildFileStream << cmVS10EscapeXML(sdkExecutableDirectories) - << "\n"; + this->WritePlatformConfigTag("ExecutablePath", config, e1.Indent + 1, + sdkExecutableDirectories); } if (const char* sdkIncludeDirectories = this->Makefile->GetDefinition( "CMAKE_VS_SDK_INCLUDE_DIRECTORIES")) { - this->WritePlatformConfigTag("IncludePath", config, 2); - *this->BuildFileStream << cmVS10EscapeXML(sdkIncludeDirectories) - << "\n"; + this->WritePlatformConfigTag("IncludePath", config, e1.Indent + 1, + sdkIncludeDirectories); } if (const char* sdkReferenceDirectories = this->Makefile->GetDefinition( "CMAKE_VS_SDK_REFERENCE_DIRECTORIES")) { - this->WritePlatformConfigTag("ReferencePath", config, 2); - *this->BuildFileStream << cmVS10EscapeXML(sdkReferenceDirectories) - << "\n"; + this->WritePlatformConfigTag("ReferencePath", config, e1.Indent + 1, + sdkReferenceDirectories); } if (const char* sdkLibraryDirectories = this->Makefile->GetDefinition( "CMAKE_VS_SDK_LIBRARY_DIRECTORIES")) { - this->WritePlatformConfigTag("LibraryPath", config, 2); - *this->BuildFileStream << cmVS10EscapeXML(sdkLibraryDirectories) - << "\n"; + this->WritePlatformConfigTag("LibraryPath", config, e1.Indent + 1, + sdkLibraryDirectories); } if (const char* sdkLibraryWDirectories = this->Makefile->GetDefinition( "CMAKE_VS_SDK_LIBRARY_WINRT_DIRECTORIES")) { - this->WritePlatformConfigTag("LibraryWPath", config, 2); - *this->BuildFileStream << cmVS10EscapeXML(sdkLibraryWDirectories) - << "\n"; + this->WritePlatformConfigTag("LibraryWPath", config, e1.Indent + 1, + sdkLibraryWDirectories); } if (const char* sdkSourceDirectories = this->Makefile->GetDefinition("CMAKE_VS_SDK_SOURCE_DIRECTORIES")) { - this->WritePlatformConfigTag("SourcePath", config, 2); - *this->BuildFileStream << cmVS10EscapeXML(sdkSourceDirectories) - << "\n"; + this->WritePlatformConfigTag("SourcePath", config, e1.Indent + 1, + sdkSourceDirectories); } if (const char* sdkExcludeDirectories = this->Makefile->GetDefinition( "CMAKE_VS_SDK_EXCLUDE_DIRECTORIES")) { - this->WritePlatformConfigTag("ExcludePath", config, 2); - *this->BuildFileStream << cmVS10EscapeXML(sdkExcludeDirectories) - << "\n"; + this->WritePlatformConfigTag("ExcludePath", config, e1.Indent + 1, + sdkExcludeDirectories); } if (const char* workingDir = this->GeneratorTarget->GetProperty( "VS_DEBUGGER_WORKING_DIRECTORY")) { this->WritePlatformConfigTag("LocalDebuggerWorkingDirectory", config, - 2); - *this->BuildFileStream << cmVS10EscapeXML(workingDir) - << "\n"; + e1.Indent + 1, workingDir); } if (const char* debuggerCommand = this->GeneratorTarget->GetProperty("VS_DEBUGGER_COMMAND")) { - this->WritePlatformConfigTag("LocalDebuggerCommand", config, 2); - *this->BuildFileStream << cmVS10EscapeXML(debuggerCommand) - << "\n"; + this->WritePlatformConfigTag("LocalDebuggerCommand", config, + e1.Indent + 1, debuggerCommand); } std::string name = cmSystemTools::GetFilenameWithoutLastExtension(targetNameFull); - this->WritePlatformConfigTag("TargetName", config, 2); - *this->BuildFileStream << cmVS10EscapeXML(name) << "\n"; + this->WritePlatformConfigTag("TargetName", config, e1.Indent + 1, name); std::string ext = cmSystemTools::GetFilenameLastExtension(targetNameFull); @@ -2382,17 +2341,16 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions() // A single "." appears to be treated as an empty extension. ext = "."; } - this->WritePlatformConfigTag("TargetExt", config, 2); - *this->BuildFileStream << cmVS10EscapeXML(ext) << "\n"; + this->WritePlatformConfigTag("TargetExt", config, e1.Indent + 1, ext); - this->OutputLinkIncremental(config); + this->OutputLinkIncremental(e1, config); } } - this->WriteString("\n", 1); + e1.EndElement(); } void cmVisualStudio10TargetGenerator::OutputLinkIncremental( - std::string const& configName) + Elem& e1, std::string const& configName) { if (!this->MSTools) { return; @@ -2409,15 +2367,13 @@ void cmVisualStudio10TargetGenerator::OutputLinkIncremental( Options& linkOptions = *(this->LinkOptions[configName]); const char* incremental = linkOptions.GetFlag("LinkIncremental"); - this->WritePlatformConfigTag("LinkIncremental", configName, 2); - *this->BuildFileStream << (incremental ? incremental : "true") - << "\n"; + this->WritePlatformConfigTag("LinkIncremental", configName, e1.Indent + 1, + (incremental ? incremental : "true")); linkOptions.RemoveFlag("LinkIncremental"); const char* manifest = linkOptions.GetFlag("GenerateManifest"); - this->WritePlatformConfigTag("GenerateManifest", configName, 2); - *this->BuildFileStream << (manifest ? manifest : "true") - << "\n"; + this->WritePlatformConfigTag("GenerateManifest", configName, e1.Indent + 1, + (manifest ? manifest : "true")); linkOptions.RemoveFlag("GenerateManifest"); // Some link options belong here. Use them now and remove them so that @@ -2426,8 +2382,7 @@ void cmVisualStudio10TargetGenerator::OutputLinkIncremental( for (const char** f = flags; *f; ++f) { const char* flag = *f; if (const char* value = linkOptions.GetFlag(flag)) { - this->WritePlatformConfigTag(flag, configName, 2); - *this->BuildFileStream << value << "\n"; + this->WritePlatformConfigTag(flag, configName, e1.Indent + 1, value); linkOptions.RemoveFlag(flag); } } @@ -2650,24 +2605,25 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( } void cmVisualStudio10TargetGenerator::WriteClOptions( - std::string const& configName) + Elem& e1, std::string const& configName) { Options& clOptions = *(this->ClOptions[configName]); if (this->ProjectType == csproj) { return; } - this->WriteString("\n", 2); + Elem e2(e1, "ClCompile"); + e2.SetHasElements(); clOptions.PrependInheritedString("AdditionalOptions"); - clOptions.OutputAdditionalIncludeDirectories(*this->BuildFileStream, 3, + clOptions.OutputAdditionalIncludeDirectories(e2.S, e2.Indent + 1, this->LangForClCompile); - clOptions.OutputFlagMap(*this->BuildFileStream, 3); - clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, 3, + clOptions.OutputFlagMap(e2.S, e2.Indent + 1); + clOptions.OutputPreprocessorDefinitions(e2.S, e2.Indent + 1, this->LangForClCompile); if (this->NsightTegra) { if (const char* processMax = this->GeneratorTarget->GetProperty("ANDROID_PROCESS_MAX")) { - this->WriteElemEscapeXML("ProcessMax", processMax, 3); + e2.Element("ProcessMax", processMax); } } @@ -2675,9 +2631,9 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( cmsys::RegularExpression clangToolset("v[0-9]+_clang_.*"); const char* toolset = this->GlobalGenerator->GetPlatformToolset(); if (toolset && clangToolset.find(toolset)) { - this->WriteElem("ObjectFileName", "$(IntDir)%(filename).obj", 3); + e2.Element("ObjectFileName", "$(IntDir)%(filename).obj"); } else { - this->WriteElem("ObjectFileName", "$(IntDir)", 3); + e2.Element("ObjectFileName", "$(IntDir)"); } // If not in debug mode, write the DebugInformationFormat field @@ -2685,15 +2641,16 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( // goes on its own line because Visual Studio corrects it this // way when saving the project after CMake generates it. if (!clOptions.IsDebug()) { - this->WriteString("\n", 3); - this->WriteString("\n", 3); + Elem e3(e2, "DebugInformationFormat"); + e3.SetHasElements(); + e3.EndElement(); } // Specify the compiler program database file if configured. std::string pdb = this->GeneratorTarget->GetCompilePDBPath(configName); if (!pdb.empty()) { ConvertToWindowsSlash(pdb); - this->WriteElemEscapeXML("ProgramDataBaseFileName", pdb, 3); + e2.Element("ProgramDataBaseFileName", pdb); } // add AdditionalUsingDirectories @@ -2705,11 +2662,11 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( } dirs.append(u); } - this->WriteElemEscapeXML("AdditionalUsingDirectories", dirs, 3); + e2.Element("AdditionalUsingDirectories", dirs); } } - this->WriteString("\n", 2); + e2.EndElement(); } bool cmVisualStudio10TargetGenerator::ComputeRcOptions() @@ -2751,21 +2708,21 @@ bool cmVisualStudio10TargetGenerator::ComputeRcOptions( } void cmVisualStudio10TargetGenerator::WriteRCOptions( - std::string const& configName) + Elem& e1, std::string const& configName) { if (!this->MSTools) { return; } - this->WriteString("\n", 2); + Elem e2(e1, "ResourceCompile"); + e2.SetHasElements(); Options& rcOptions = *(this->RcOptions[configName]); - rcOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, 3, "RC"); - rcOptions.OutputAdditionalIncludeDirectories(*this->BuildFileStream, 3, - "RC"); + rcOptions.OutputPreprocessorDefinitions(e2.S, e2.Indent + 1, "RC"); + rcOptions.OutputAdditionalIncludeDirectories(e2.S, e2.Indent + 1, "RC"); rcOptions.PrependInheritedString("AdditionalOptions"); - rcOptions.OutputFlagMap(*this->BuildFileStream, 3); + rcOptions.OutputFlagMap(e2.S, e2.Indent + 1); - this->WriteString("\n", 2); + e2.EndElement(); } bool cmVisualStudio10TargetGenerator::ComputeCudaOptions() @@ -2900,21 +2857,21 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions( } void cmVisualStudio10TargetGenerator::WriteCudaOptions( - std::string const& configName) + Elem& e1, std::string const& configName) { if (!this->MSTools || !this->GlobalGenerator->IsCudaEnabled()) { return; } - this->WriteString("\n", 2); + Elem e2(e1, "CudaCompile"); + e2.SetHasElements(); Options& cudaOptions = *(this->CudaOptions[configName]); - cudaOptions.OutputAdditionalIncludeDirectories(*this->BuildFileStream, 3, - "CUDA"); - cudaOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, 3, "CUDA"); + cudaOptions.OutputAdditionalIncludeDirectories(e2.S, e2.Indent + 1, "CUDA"); + cudaOptions.OutputPreprocessorDefinitions(e2.S, e2.Indent + 1, "CUDA"); cudaOptions.PrependInheritedString("AdditionalOptions"); - cudaOptions.OutputFlagMap(*this->BuildFileStream, 3); + cudaOptions.OutputFlagMap(e2.S, e2.Indent + 1); - this->WriteString("\n", 2); + e2.EndElement(); } bool cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions() @@ -2969,7 +2926,7 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions( } void cmVisualStudio10TargetGenerator::WriteCudaLinkOptions( - std::string const& configName) + Elem& e1, std::string const& configName) { if (this->GeneratorTarget->GetType() > cmStateEnums::MODULE_LIBRARY) { return; @@ -2979,10 +2936,11 @@ void cmVisualStudio10TargetGenerator::WriteCudaLinkOptions( return; } - this->WriteString("\n", 2); + Elem e2(e1, "CudaLink"); + e2.SetHasElements(); Options& cudaLinkOptions = *(this->CudaLinkOptions[configName]); - cudaLinkOptions.OutputFlagMap(*this->BuildFileStream, 3); - this->WriteString("\n", 2); + cudaLinkOptions.OutputFlagMap(e2.S, e2.Indent + 1); + e2.EndElement(); } bool cmVisualStudio10TargetGenerator::ComputeMasmOptions() @@ -3023,25 +2981,25 @@ bool cmVisualStudio10TargetGenerator::ComputeMasmOptions( } void cmVisualStudio10TargetGenerator::WriteMasmOptions( - std::string const& configName) + Elem& e1, std::string const& configName) { if (!this->MSTools || !this->GlobalGenerator->IsMasmEnabled()) { return; } - this->WriteString("\n", 2); + Elem e2(e1, "MASM"); + e2.SetHasElements(); // Preprocessor definitions and includes are shared with clOptions. Options& clOptions = *(this->ClOptions[configName]); - clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, 3, - "ASM_MASM"); + clOptions.OutputPreprocessorDefinitions(e2.S, e2.Indent + 1, "ASM_MASM"); Options& masmOptions = *(this->MasmOptions[configName]); - masmOptions.OutputAdditionalIncludeDirectories(*this->BuildFileStream, 3, + masmOptions.OutputAdditionalIncludeDirectories(e2.S, e2.Indent + 1, "ASM_MASM"); masmOptions.PrependInheritedString("AdditionalOptions"); - masmOptions.OutputFlagMap(*this->BuildFileStream, 3); + masmOptions.OutputFlagMap(e2.S, e2.Indent + 1); - this->WriteString("\n", 2); + e2.EndElement(); } bool cmVisualStudio10TargetGenerator::ComputeNasmOptions() @@ -3083,33 +3041,32 @@ bool cmVisualStudio10TargetGenerator::ComputeNasmOptions( } void cmVisualStudio10TargetGenerator::WriteNasmOptions( - std::string const& configName) + Elem& e1, std::string const& configName) { if (!this->GlobalGenerator->IsNasmEnabled()) { return; } - this->WriteString("\n", 2); + Elem e2(e1, "NASM"); + e2.SetHasElements(); std::vector includes = this->GetIncludes(configName, "ASM_NASM"); Options& nasmOptions = *(this->NasmOptions[configName]); - nasmOptions.OutputAdditionalIncludeDirectories(*this->BuildFileStream, 3, + nasmOptions.OutputAdditionalIncludeDirectories(e2.S, e2.Indent + 1, "ASM_NASM"); - nasmOptions.OutputFlagMap(*this->BuildFileStream, 3); + nasmOptions.OutputFlagMap(e2.S, e2.Indent + 1); nasmOptions.PrependInheritedString("AdditionalOptions"); - nasmOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, 3, - "ASM_NASM"); + nasmOptions.OutputPreprocessorDefinitions(e2.S, e2.Indent + 1, "ASM_NASM"); // Preprocessor definitions and includes are shared with clOptions. Options& clOptions = *(this->ClOptions[configName]); - clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, 3, - "ASM_NASM"); + clOptions.OutputPreprocessorDefinitions(e2.S, e2.Indent + 1, "ASM_NASM"); - this->WriteString("\n", 2); + e2.EndElement(); } void cmVisualStudio10TargetGenerator::WriteLibOptions( - std::string const& config) + Elem& e1, std::string const& config) { if (this->GeneratorTarget->GetType() != cmStateEnums::STATIC_LIBRARY && this->GeneratorTarget->GetType() != cmStateEnums::OBJECT_LIBRARY) { @@ -3119,15 +3076,16 @@ void cmVisualStudio10TargetGenerator::WriteLibOptions( this->LocalGenerator->GetStaticLibraryFlags( libflags, cmSystemTools::UpperCase(config), this->GeneratorTarget); if (!libflags.empty()) { - this->WriteString("\n", 2); + Elem e2(e1, "Lib"); + e2.SetHasElements(); cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator; cmVS10GeneratorOptions libOptions(this->LocalGenerator, cmVisualStudioGeneratorOptions::Linker, gg->GetLibFlagTable(), this); libOptions.Parse(libflags.c_str()); libOptions.PrependInheritedString("AdditionalOptions"); - libOptions.OutputFlagMap(*this->BuildFileStream, 3); - this->WriteString("\n", 2); + libOptions.OutputFlagMap(e2.S, e2.Indent + 1); + e2.EndElement(); } // We cannot generate metadata for static libraries. WindowsPhone @@ -3135,14 +3093,14 @@ void cmVisualStudio10TargetGenerator::WriteLibOptions( // Link tool options even for static libraries. if (this->GlobalGenerator->TargetsWindowsPhone() || this->GlobalGenerator->TargetsWindowsStore()) { - this->WriteString("\n", 2); - this->WriteElem("GenerateWindowsMetadata", "false", 3); - this->WriteString("\n", 2); + Elem e2(e1, "Link"); + e2.Element("GenerateWindowsMetadata", "false"); + e2.EndElement(); } } void cmVisualStudio10TargetGenerator::WriteManifestOptions( - std::string const& config) + Elem& e1, std::string const& config) { if (this->GeneratorTarget->GetType() != cmStateEnums::EXECUTABLE && this->GeneratorTarget->GetType() != cmStateEnums::SHARED_LIBRARY && @@ -3153,20 +3111,20 @@ void cmVisualStudio10TargetGenerator::WriteManifestOptions( std::vector manifest_srcs; this->GeneratorTarget->GetManifests(manifest_srcs, config); if (!manifest_srcs.empty()) { - this->WriteString("\n", 2); - this->WriteString("", 3); + std::ostringstream oss; for (cmSourceFile const* mi : manifest_srcs) { std::string m = this->ConvertPath(mi->GetFullPath(), false); ConvertToWindowsSlash(m); - (*this->BuildFileStream) << m << ";"; + oss << m << ";"; } - (*this->BuildFileStream) << "\n"; - this->WriteString("\n", 2); + Elem e2(e1, "Manifest"); + e2.Element("AdditionalManifestFiles", oss.str()); + e2.EndElement(); } } void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( - std::string const& configName) + Elem& e1, std::string const& configName) { // Look through the sources for AndroidManifest.xml and use // its location as the root source directory. @@ -3183,32 +3141,30 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( } } + Elem e2(e1, "AntBuild"); // Tell MSBuild to launch Ant. { std::string antBuildPath = rootDir; - this->WriteString("\n", 2); ConvertToWindowsSlash(antBuildPath); - this->WriteElemEscapeXML("AntBuildPath", antBuildPath, 3); + e2.Element("AntBuildPath", antBuildPath); } if (this->GeneratorTarget->GetPropertyAsBool("ANDROID_SKIP_ANT_STEP")) { - this->WriteElem("SkipAntStep", "true", 3); + e2.Element("SkipAntStep", "true"); } if (this->GeneratorTarget->GetPropertyAsBool("ANDROID_PROGUARD")) { - this->WriteElem("EnableProGuard", "true", 3); + e2.Element("EnableProGuard", "true"); } if (const char* proGuardConfigLocation = this->GeneratorTarget->GetProperty("ANDROID_PROGUARD_CONFIG_PATH")) { - this->WriteElemEscapeXML("ProGuardConfigLocation", proGuardConfigLocation, - 3); + e2.Element("ProGuardConfigLocation", proGuardConfigLocation); } if (const char* securePropertiesLocation = this->GeneratorTarget->GetProperty("ANDROID_SECURE_PROPS_PATH")) { - this->WriteElemEscapeXML("SecurePropertiesLocation", - securePropertiesLocation, 3); + e2.Element("SecurePropertiesLocation", securePropertiesLocation); } if (const char* nativeLibDirectoriesExpression = @@ -3218,7 +3174,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( ge.Parse(nativeLibDirectoriesExpression); std::string nativeLibDirs = cge->Evaluate(this->LocalGenerator, configName); - this->WriteElemEscapeXML("NativeLibDirectories", nativeLibDirs, 3); + e2.Element("NativeLibDirectories", nativeLibDirs); } if (const char* nativeLibDependenciesExpression = @@ -3229,12 +3185,12 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( ge.Parse(nativeLibDependenciesExpression); std::string nativeLibDeps = cge->Evaluate(this->LocalGenerator, configName); - this->WriteElemEscapeXML("NativeLibDependencies", nativeLibDeps, 3); + e2.Element("NativeLibDependencies", nativeLibDeps); } if (const char* javaSourceDir = this->GeneratorTarget->GetProperty("ANDROID_JAVA_SOURCE_DIR")) { - this->WriteElemEscapeXML("JavaSourceDir", javaSourceDir, 3); + e2.Element("JavaSourceDir", javaSourceDir); } if (const char* jarDirectoriesExpression = @@ -3244,33 +3200,32 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( ge.Parse(jarDirectoriesExpression); std::string jarDirectories = cge->Evaluate(this->LocalGenerator, configName); - this->WriteElemEscapeXML("JarDirectories", jarDirectories, 3); + e2.Element("JarDirectories", jarDirectories); } if (const char* jarDeps = this->GeneratorTarget->GetProperty("ANDROID_JAR_DEPENDENCIES")) { - this->WriteElemEscapeXML("JarDependencies", jarDeps, 3); + e2.Element("JarDependencies", jarDeps); } if (const char* assetsDirectories = this->GeneratorTarget->GetProperty("ANDROID_ASSETS_DIRECTORIES")) { - this->WriteElemEscapeXML("AssetsDirectories", assetsDirectories, 3); + e2.Element("AssetsDirectories", assetsDirectories); } { std::string manifest_xml = rootDir + "/AndroidManifest.xml"; ConvertToWindowsSlash(manifest_xml); - this->WriteElemEscapeXML("AndroidManifestLocation", manifest_xml, 3); + e2.Element("AndroidManifestLocation", manifest_xml); } if (const char* antAdditionalOptions = this->GeneratorTarget->GetProperty("ANDROID_ANT_ADDITIONAL_OPTIONS")) { - this->WriteString("", 3); - (*this->BuildFileStream) << cmVS10EscapeXML(antAdditionalOptions) - << " %(AdditionalOptions)\n"; + e2.Element("AdditionalOptions", + std::string(antAdditionalOptions) + " %(AdditionalOptions)"); } - this->WriteString("\n", 2); + e2.EndElement(); } bool cmVisualStudio10TargetGenerator::ComputeLinkOptions() @@ -3550,7 +3505,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLibOptions( } void cmVisualStudio10TargetGenerator::WriteLinkOptions( - std::string const& config) + Elem& e1, std::string const& config) { if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY || this->GeneratorTarget->GetType() > cmStateEnums::MODULE_LIBRARY) { @@ -3560,17 +3515,20 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions( return; } Options& linkOptions = *(this->LinkOptions[config]); - this->WriteString("\n", 2); - linkOptions.PrependInheritedString("AdditionalOptions"); - linkOptions.OutputFlagMap(*this->BuildFileStream, 3); + { + Elem e2(e1, "Link"); + e2.SetHasElements(); + linkOptions.PrependInheritedString("AdditionalOptions"); + linkOptions.OutputFlagMap(e2.S, e2.Indent + 1); + e2.EndElement(); + } - this->WriteString("\n", 2); if (!this->GlobalGenerator->NeedLinkLibraryDependencies( this->GeneratorTarget)) { - this->WriteString("\n", 2); - this->WriteElem("LinkLibraryDependencies", "false", 3); - this->WriteString("\n", 2); + Elem e2(e1, "ProjectReference"); + e2.Element("LinkLibraryDependencies", "false"); + e2.EndElement(); } } @@ -3657,7 +3615,7 @@ void cmVisualStudio10TargetGenerator::AddTargetsFileAndConfigPair( } void cmVisualStudio10TargetGenerator::WriteMidlOptions( - std::string const& configName) + Elem& e1, std::string const& configName) { if (!this->MSTools) { return; @@ -3681,65 +3639,66 @@ void cmVisualStudio10TargetGenerator::WriteMidlOptions( // up (for non-directory form, it ends up looking in project binary dir // only). Perhaps there's something to be done to make this more automatic // on the CMake side? - this->WriteString("\n", 2); - this->WriteString("", 3); std::vector const includes = this->GetIncludes(configName, "MIDL"); + std::ostringstream oss; for (std::string const& i : includes) { - *this->BuildFileStream << cmVS10EscapeXML(i) << ";"; - } - this->WriteString("%(AdditionalIncludeDirectories)" - "\n", - 0); - this->WriteElem("OutputDirectory", "$(ProjectDir)/$(IntDir)", 3); - this->WriteElem("HeaderFileName", "%(Filename).h", 3); - this->WriteElem("TypeLibraryName", "%(Filename).tlb", 3); - this->WriteElem("InterfaceIdentifierFileName", "%(Filename)_i.c", 3); - this->WriteElem("ProxyFileName", "%(Filename)_p.c", 3); - this->WriteString("\n", 2); + oss << i << ";"; + } + + Elem e2(e1, "Midl"); + e2.Element("AdditionalIncludeDirectories", + oss.str() + "%(AdditionalIncludeDirectories)"); + e2.Element("OutputDirectory", "$(ProjectDir)/$(IntDir)"); + e2.Element("HeaderFileName", "%(Filename).h"); + e2.Element("TypeLibraryName", "%(Filename).tlb"); + e2.Element("InterfaceIdentifierFileName", "%(Filename)_i.c"); + e2.Element("ProxyFileName", "%(Filename)_p.c"); + e2.EndElement(); } -void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups() +void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups(Elem& e0) { if (this->ProjectType == csproj) { return; } for (const auto& i : this->Configurations) { - this->WritePlatformConfigTag("ItemDefinitionGroup", i, 1); - *this->BuildFileStream << "\n"; + Elem e1(e0, "ItemDefinitionGroup"); + e1.Attribute("Condition", this->CalcCondition(i)); + // output cl compile flags if (this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY) { - this->WriteClOptions(i); + this->WriteClOptions(e1, i); // output rc compile flags - this->WriteRCOptions(i); - this->WriteCudaOptions(i); - this->WriteMasmOptions(i); - this->WriteNasmOptions(i); + this->WriteRCOptions(e1, i); + this->WriteCudaOptions(e1, i); + this->WriteMasmOptions(e1, i); + this->WriteNasmOptions(e1, i); } // output midl flags - this->WriteMidlOptions(i); + this->WriteMidlOptions(e1, i); // write events if (this->ProjectType != csproj) { - this->WriteEvents(i); + this->WriteEvents(e1, i); } // output link flags - this->WriteLinkOptions(i); - this->WriteCudaLinkOptions(i); + this->WriteLinkOptions(e1, i); + this->WriteCudaLinkOptions(e1, i); // output lib flags - this->WriteLibOptions(i); + this->WriteLibOptions(e1, i); // output manifest flags - this->WriteManifestOptions(i); + this->WriteManifestOptions(e1, i); if (this->NsightTegra && this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE && this->GeneratorTarget->GetPropertyAsBool("ANDROID_GUI")) { - this->WriteAntBuildOptions(i); + this->WriteAntBuildOptions(e1, i); } - this->WriteString("\n", 1); + e1.EndElement(); } } void cmVisualStudio10TargetGenerator::WriteEvents( - std::string const& configName) + Elem& e1, std::string const& configName) { bool addedPrelink = false; cmGeneratorTarget::ModuleDefinitionInfo const* mdi = @@ -3750,27 +3709,26 @@ void cmVisualStudio10TargetGenerator::WriteEvents( this->GeneratorTarget->GetPreLinkCommands(); this->GlobalGenerator->AddSymbolExportCommand(this->GeneratorTarget, commands, configName); - this->WriteEvent("PreLinkEvent", commands, configName); + this->WriteEvent(e1, "PreLinkEvent", commands, configName); } if (!addedPrelink) { - this->WriteEvent("PreLinkEvent", + this->WriteEvent(e1, "PreLinkEvent", this->GeneratorTarget->GetPreLinkCommands(), configName); } - this->WriteEvent("PreBuildEvent", + this->WriteEvent(e1, "PreBuildEvent", this->GeneratorTarget->GetPreBuildCommands(), configName); - this->WriteEvent("PostBuildEvent", + this->WriteEvent(e1, "PostBuildEvent", this->GeneratorTarget->GetPostBuildCommands(), configName); } void cmVisualStudio10TargetGenerator::WriteEvent( - const char* name, std::vector const& commands, + Elem& e1, const char* name, std::vector const& commands, std::string const& configName) { if (commands.empty()) { return; } - this->WriteString("<", 2); - (*this->BuildFileStream) << name << ">\n"; + Elem e2(e1, name); cmLocalVisualStudio7Generator* lg = this->LocalGenerator; std::string script; const char* pre = ""; @@ -3782,39 +3740,37 @@ void cmVisualStudio10TargetGenerator::WriteEvent( comment += lg->ConstructComment(ccg); script += pre; pre = "\n"; - script += cmVS10EscapeXML(lg->ConstructScript(ccg)); + script += lg->ConstructScript(ccg); } } comment = cmVS10EscapeComment(comment); if (this->ProjectType != csproj) { - this->WriteElemEscapeXML("Message", comment, 3); - this->WriteString("", 3); + e2.Element("Message", comment); + e2.Element("Command", script); + e2.EndElement(); } else { std::string strippedComment = comment; strippedComment.erase( std::remove(strippedComment.begin(), strippedComment.end(), '\t'), strippedComment.end()); + std::ostringstream oss; if (!comment.empty() && !strippedComment.empty()) { - (*this->BuildFileStream) << "echo " << cmVS10EscapeXML(comment) << "\n"; + oss << "echo " << comment << "\n"; } + oss << script << "\n"; + e2.Content(oss.str()); } - (*this->BuildFileStream) << script; - if (this->ProjectType != csproj) { - (*this->BuildFileStream) << ""; - } - (*this->BuildFileStream) << "\n"; - this->WriteString("BuildFileStream) << name << ">\n"; } -void cmVisualStudio10TargetGenerator::WriteProjectReferences() +void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0) { cmGlobalGenerator::TargetDependSet const& unordered = this->GlobalGenerator->GetTargetDirectDepends(this->GeneratorTarget); typedef cmGlobalVisualStudioGenerator::OrderedTargetDependSet OrderedTargetDependSet; OrderedTargetDependSet depends(unordered, CMAKE_CHECK_BUILD_SYSTEM_TARGET); - this->WriteString("\n", 1); + Elem e1(e0, "ItemGroup"); + e1.SetHasElements(); for (cmTargetDepend const& i : depends) { cmGeneratorTarget const* dt = i; if (dt->GetType() == cmStateEnums::INTERFACE_LIBRARY) { @@ -3825,7 +3781,6 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences() if (this->GlobalGenerator->TargetIsFortranOnly(dt)) { continue; } - this->WriteString("GetLocalGenerator(); std::string name = dt->GetName(); std::string path; @@ -3839,11 +3794,11 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences() path += computeProjectFileExtension(dt, *this->Configurations.begin()); } ConvertToWindowsSlash(path); - (*this->BuildFileStream) << cmVS10EscapeAttr(path) << "\">\n"; - this->WriteElem("Project", - "{" + this->GlobalGenerator->GetGUID(name) + "}", 3); - this->WriteElem("Name", name, 3); - this->WriteDotNetReferenceCustomTags(name); + Elem e2(e1, "ProjectReference"); + e2.Attribute("Include", path); + e2.Element("Project", "{" + this->GlobalGenerator->GetGUID(name) + "}"); + e2.Element("Name", name); + this->WriteDotNetReferenceCustomTags(e2, name); if (this->Managed) { // If the dependency target is not managed (compiled with /clr or // C# target) we cannot reference it and have to set @@ -3860,15 +3815,15 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences() unmanagedStatic = !dt->HasLanguage("CSharp", ""); } if (dt->GetManagedType("") < check || unmanagedStatic) { - this->WriteElem("ReferenceOutputAssembly", "false", 3); + e2.Element("ReferenceOutputAssembly", "false"); } } - this->WriteString("\n", 2); + e2.EndElement(); } - this->WriteString("\n", 1); + e1.EndElement(); } -void cmVisualStudio10TargetGenerator::WritePlatformExtensions() +void cmVisualStudio10TargetGenerator::WritePlatformExtensions(Elem& e1) { // This only applies to Windows 10 apps if (this->GlobalGenerator->TargetsWindowsStore() && @@ -3876,52 +3831,54 @@ void cmVisualStudio10TargetGenerator::WritePlatformExtensions() const char* desktopExtensionsVersion = this->GeneratorTarget->GetProperty("VS_DESKTOP_EXTENSIONS_VERSION"); if (desktopExtensionsVersion) { - this->WriteSinglePlatformExtension("WindowsDesktop", + this->WriteSinglePlatformExtension(e1, "WindowsDesktop", desktopExtensionsVersion); } const char* mobileExtensionsVersion = this->GeneratorTarget->GetProperty("VS_MOBILE_EXTENSIONS_VERSION"); if (mobileExtensionsVersion) { - this->WriteSinglePlatformExtension("WindowsMobile", + this->WriteSinglePlatformExtension(e1, "WindowsMobile", mobileExtensionsVersion); } } } void cmVisualStudio10TargetGenerator::WriteSinglePlatformExtension( - std::string const& extension, std::string const& version) + Elem& e1, std::string const& extension, std::string const& version) { - this->WriteString("\n"; + Elem e2(e1, "Import"); + e2.Attribute( + "Project", "$([Microsoft.Build.Utilities.ToolLocationHelper]" + "::GetPlatformExtensionSDKLocation(`" + + extension + ", Version=" + version + + "`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), null, " + "$(ExtensionSDKDirectoryRoot), null))" + "\\DesignTime\\CommonConfiguration\\Neutral\\" + + extension + ".props"); + e2.Attribute( + "Condition", "exists('$(" + "[Microsoft.Build.Utilities.ToolLocationHelper]" + "::GetPlatformExtensionSDKLocation(`" + + extension + ", Version=" + version + + "`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), null, " + "$(ExtensionSDKDirectoryRoot), null))" + "\\DesignTime\\CommonConfiguration\\Neutral\\" + + extension + ".props')"); + e2.EndElement(); } -void cmVisualStudio10TargetGenerator::WriteSDKReferences() +void cmVisualStudio10TargetGenerator::WriteSDKReferences(Elem& e0) { std::vector sdkReferences; + Elem e1(e0); bool hasWrittenItemGroup = false; if (const char* vsSDKReferences = this->GeneratorTarget->GetProperty("VS_SDK_REFERENCES")) { cmSystemTools::ExpandListArgument(vsSDKReferences, sdkReferences); - this->WriteString("\n", 1); + e1.StartElement("ItemGroup"); hasWrittenItemGroup = true; for (std::string const& ri : sdkReferences) { - this->WriteString("BuildFileStream) << cmVS10EscapeAttr(ri) << "\"/>\n"; + Elem(e1, "SDKReference").Attribute("Include", ri).EndElement(); } } @@ -3938,37 +3895,38 @@ void cmVisualStudio10TargetGenerator::WriteSDKReferences() if (desktopExtensionsVersion || mobileExtensionsVersion || iotExtensionsVersion) { if (!hasWrittenItemGroup) { - this->WriteString("\n", 1); + e1.StartElement("ItemGroup"); hasWrittenItemGroup = true; } if (desktopExtensionsVersion) { - this->WriteSingleSDKReference("WindowsDesktop", + this->WriteSingleSDKReference(e1, "WindowsDesktop", desktopExtensionsVersion); } if (mobileExtensionsVersion) { - this->WriteSingleSDKReference("WindowsMobile", + this->WriteSingleSDKReference(e1, "WindowsMobile", mobileExtensionsVersion); } if (iotExtensionsVersion) { - this->WriteSingleSDKReference("WindowsIoT", iotExtensionsVersion); + this->WriteSingleSDKReference(e1, "WindowsIoT", iotExtensionsVersion); } } } if (hasWrittenItemGroup) { - this->WriteString("\n", 1); + e1.EndElement(); } } void cmVisualStudio10TargetGenerator::WriteSingleSDKReference( - std::string const& extension, std::string const& version) + Elem& e1, std::string const& extension, std::string const& version) { - this->WriteString("BuildFileStream) << extension << ", Version=" << version - << "\" />\n"; + Elem(e1, "SDKReference") + .Attribute("Include", extension + ", Version=" + version) + .EndElement(); } -void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile() +void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile( + Elem& e0) { if ((this->GlobalGenerator->TargetsWindowsStore() || this->GlobalGenerator->TargetsWindowsPhone()) && @@ -3989,13 +3947,12 @@ void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile() std::string artifactDir = this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); ConvertToWindowsSlash(artifactDir); - this->WriteString("\n", 1); - this->WriteElemEscapeXML("AppxPackageArtifactsDir", artifactDir + "\\", - 2); + Elem e1(e0, "PropertyGroup"); + e1.Element("AppxPackageArtifactsDir", artifactDir + "\\"); std::string resourcePriFile = this->DefaultArtifactDir + "/resources.pri"; ConvertToWindowsSlash(resourcePriFile); - this->WriteElem("ProjectPriFullPath", resourcePriFile, 2); + e1.Element("ProjectPriFullPath", resourcePriFile); // If we are missing files and we don't have a certificate and // aren't targeting WP8.0, add a default certificate @@ -4009,20 +3966,20 @@ void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile() this->AddedFiles.push_back(pfxFile); } - this->WriteElem("PackageCertificateKeyFile", pfxFile, 2); + e1.Element("PackageCertificateKeyFile", pfxFile); std::string thumb = cmSystemTools::ComputeCertificateThumbprint(pfxFile); if (!thumb.empty()) { - this->WriteElem("PackageCertificateThumbprint", thumb, 2); + e1.Element("PackageCertificateThumbprint", thumb); } - this->WriteString("\n", 1); + e1.EndElement(); } else if (!pfxFile.empty()) { - this->WriteString("\n", 1); - this->WriteElem("PackageCertificateKeyFile", pfxFile, 2); + Elem e1(e0, "PropertyGroup"); + e1.Element("PackageCertificateKeyFile", pfxFile); std::string thumb = cmSystemTools::ComputeCertificateThumbprint(pfxFile); if (!thumb.empty()) { - this->WriteElem("PackageCertificateThumbprint", thumb, 2); + e1.Element("PackageCertificateThumbprint", thumb); } - this->WriteString("\n", 1); + e1.EndElement(); } } } @@ -4060,7 +4017,7 @@ bool cmVisualStudio10TargetGenerator::IsXamlSource( return it != expectedXamlSources.end(); } -void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings() +void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings(Elem& e1) { cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator; bool isAppContainer = false; @@ -4068,29 +4025,29 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings() bool const isWindowsStore = this->GlobalGenerator->TargetsWindowsStore(); std::string const& v = this->GlobalGenerator->GetSystemVersion(); if (isWindowsPhone || isWindowsStore) { - this->WriteElem("ApplicationType", - (isWindowsPhone ? "Windows Phone" : "Windows Store"), 2); - this->WriteElem("DefaultLanguage", "en-US", 2); + e1.Element("ApplicationType", + (isWindowsPhone ? "Windows Phone" : "Windows Store")); + e1.Element("DefaultLanguage", "en-US"); if (cmHasLiteralPrefix(v, "10.0")) { - this->WriteElemEscapeXML("ApplicationTypeRevision", "10.0", 2); + e1.Element("ApplicationTypeRevision", "10.0"); // Visual Studio 14.0 is necessary for building 10.0 apps - this->WriteElem("MinimumVisualStudioVersion", "14.0", 2); + e1.Element("MinimumVisualStudioVersion", "14.0"); if (this->GeneratorTarget->GetType() < cmStateEnums::UTILITY) { isAppContainer = true; } } else if (v == "8.1") { - this->WriteElemEscapeXML("ApplicationTypeRevision", v, 2); + e1.Element("ApplicationTypeRevision", v); // Visual Studio 12.0 is necessary for building 8.1 apps - this->WriteElem("MinimumVisualStudioVersion", "12.0", 2); + e1.Element("MinimumVisualStudioVersion", "12.0"); if (this->GeneratorTarget->GetType() < cmStateEnums::UTILITY) { isAppContainer = true; } } else if (v == "8.0") { - this->WriteElemEscapeXML("ApplicationTypeRevision", v, 2); + e1.Element("ApplicationTypeRevision", v); // Visual Studio 11.0 is necessary for building 8.0 apps - this->WriteElem("MinimumVisualStudioVersion", "11.0", 2); + e1.Element("MinimumVisualStudioVersion", "11.0"); if (isWindowsStore && this->GeneratorTarget->GetType() < cmStateEnums::UTILITY) { @@ -4098,42 +4055,38 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings() } else if (isWindowsPhone && this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) { - this->WriteElem("XapOutputs", "true", 2); - this->WriteElem("XapFilename", cmVS10EscapeXML(this->Name) + - "_$(Configuration)_$(Platform).xap", - 2); + e1.Element("XapOutputs", "true"); + e1.Element("XapFilename", + this->Name + "_$(Configuration)_$(Platform).xap"); } } } if (isAppContainer) { - this->WriteElem("AppContainerApplication", "true", 2); + e1.Element("AppContainerApplication", "true"); } else if (this->Platform == "ARM64") { - this->WriteElem("WindowsSDKDesktopARM64Support", "true", 2); + e1.Element("WindowsSDKDesktopARM64Support", "true"); } else if (this->Platform == "ARM") { - this->WriteElem("WindowsSDKDesktopARMSupport", "true", 2); + e1.Element("WindowsSDKDesktopARMSupport", "true"); } std::string const& targetPlatformVersion = gg->GetWindowsTargetPlatformVersion(); if (!targetPlatformVersion.empty()) { - this->WriteElemEscapeXML("WindowsTargetPlatformVersion", - targetPlatformVersion, 2); + e1.Element("WindowsTargetPlatformVersion", targetPlatformVersion); } const char* targetPlatformMinVersion = this->GeneratorTarget->GetProperty( "VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION"); if (targetPlatformMinVersion) { - this->WriteElemEscapeXML("WindowsTargetPlatformMinVersion", - targetPlatformMinVersion, 2); + e1.Element("WindowsTargetPlatformMinVersion", targetPlatformMinVersion); } else if (isWindowsStore && cmHasLiteralPrefix(v, "10.0")) { // If the min version is not set, then use the TargetPlatformVersion if (!targetPlatformVersion.empty()) { - this->WriteElemEscapeXML("WindowsTargetPlatformMinVersion", - targetPlatformVersion, 2); + e1.Element("WindowsTargetPlatformMinVersion", targetPlatformVersion); } } // Added IoT Startup Task support if (this->GeneratorTarget->GetPropertyAsBool("VS_IOT_STARTUP_TASK")) { - this->WriteElem("ContainsStartupTask", "true", 2); + e1.Element("ContainsStartupTask", "true"); } } @@ -4181,27 +4134,27 @@ void cmVisualStudio10TargetGenerator::VerifyNecessaryFiles() } } -void cmVisualStudio10TargetGenerator::WriteMissingFiles() +void cmVisualStudio10TargetGenerator::WriteMissingFiles(Elem& e1) { std::string const& v = this->GlobalGenerator->GetSystemVersion(); if (this->GlobalGenerator->TargetsWindowsPhone()) { if (v == "8.0") { - this->WriteMissingFilesWP80(); + this->WriteMissingFilesWP80(e1); } else if (v == "8.1") { - this->WriteMissingFilesWP81(); + this->WriteMissingFilesWP81(e1); } } else if (this->GlobalGenerator->TargetsWindowsStore()) { if (v == "8.0") { - this->WriteMissingFilesWS80(); + this->WriteMissingFilesWS80(e1); } else if (v == "8.1") { - this->WriteMissingFilesWS81(); + this->WriteMissingFilesWS81(e1); } else if (cmHasLiteralPrefix(v, "10.0")) { - this->WriteMissingFilesWS10_0(); + this->WriteMissingFilesWS10_0(e1); } } } -void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80() +void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80(Elem& e1) { std::string templateFolder = cmSystemTools::GetCMakeRoot() + "/Templates/Windows"; @@ -4262,25 +4215,23 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80() std::string sourceFile = this->ConvertPath(manifestFile, false); ConvertToWindowsSlash(sourceFile); - this->WriteString("BuildFileStream) << cmVS10EscapeAttr(sourceFile) << "\">\n"; - this->WriteElem("SubType", "Designer", 3); - this->WriteString("\n", 2); + Elem e2(e1, "Xml"); + e2.Attribute("Include", sourceFile); + e2.Element("SubType", "Designer"); + e2.EndElement(); this->AddedFiles.push_back(sourceFile); std::string smallLogo = this->DefaultArtifactDir + "/SmallLogo.png"; cmSystemTools::CopyAFile(templateFolder + "/SmallLogo.png", smallLogo, false); ConvertToWindowsSlash(smallLogo); - this->WriteString("BuildFileStream) << cmVS10EscapeAttr(smallLogo) << "\" />\n"; + Elem(e1, "Image").Attribute("Include", smallLogo).EndElement(); this->AddedFiles.push_back(smallLogo); std::string logo = this->DefaultArtifactDir + "/Logo.png"; cmSystemTools::CopyAFile(templateFolder + "/Logo.png", logo, false); ConvertToWindowsSlash(logo); - this->WriteString("BuildFileStream) << cmVS10EscapeAttr(logo) << "\" />\n"; + Elem(e1, "Image").Attribute("Include", logo).EndElement(); this->AddedFiles.push_back(logo); std::string applicationIcon = @@ -4288,12 +4239,11 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80() cmSystemTools::CopyAFile(templateFolder + "/ApplicationIcon.png", applicationIcon, false); ConvertToWindowsSlash(applicationIcon); - this->WriteString("BuildFileStream) << cmVS10EscapeAttr(applicationIcon) << "\" />\n"; + Elem(e1, "Image").Attribute("Include", applicationIcon).EndElement(); this->AddedFiles.push_back(applicationIcon); } -void cmVisualStudio10TargetGenerator::WriteMissingFilesWP81() +void cmVisualStudio10TargetGenerator::WriteMissingFilesWP81(Elem& e1) { std::string manifestFile = this->DefaultArtifactDir + "/package.appxManifest"; @@ -4353,10 +4303,10 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP81() "\n"; /* clang-format on */ - this->WriteCommonMissingFiles(manifestFile); + this->WriteCommonMissingFiles(e1, manifestFile); } -void cmVisualStudio10TargetGenerator::WriteMissingFilesWS80() +void cmVisualStudio10TargetGenerator::WriteMissingFilesWS80(Elem& e1) { std::string manifestFile = this->DefaultArtifactDir + "/package.appxManifest"; @@ -4408,10 +4358,10 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS80() "\n"; /* clang-format on */ - this->WriteCommonMissingFiles(manifestFile); + this->WriteCommonMissingFiles(e1, manifestFile); } -void cmVisualStudio10TargetGenerator::WriteMissingFilesWS81() +void cmVisualStudio10TargetGenerator::WriteMissingFilesWS81(Elem& e1) { std::string manifestFile = this->DefaultArtifactDir + "/package.appxManifest"; @@ -4468,10 +4418,10 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS81() "\n"; /* clang-format on */ - this->WriteCommonMissingFiles(manifestFile); + this->WriteCommonMissingFiles(e1, manifestFile); } -void cmVisualStudio10TargetGenerator::WriteMissingFilesWS10_0() +void cmVisualStudio10TargetGenerator::WriteMissingFilesWS10_0(Elem& e1) { std::string manifestFile = this->DefaultArtifactDir + "/package.appxManifest"; @@ -4529,67 +4479,61 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS10_0() "\n"; /* clang-format on */ - this->WriteCommonMissingFiles(manifestFile); + this->WriteCommonMissingFiles(e1, manifestFile); } void cmVisualStudio10TargetGenerator::WriteCommonMissingFiles( - const std::string& manifestFile) + Elem& e1, const std::string& manifestFile) { std::string templateFolder = cmSystemTools::GetCMakeRoot() + "/Templates/Windows"; std::string sourceFile = this->ConvertPath(manifestFile, false); ConvertToWindowsSlash(sourceFile); - this->WriteString("BuildFileStream) << cmVS10EscapeAttr(sourceFile) << "\">\n"; - this->WriteElem("SubType", "Designer", 3); - this->WriteString("\n", 2); + Elem e2(e1, "AppxManifest"); + e2.Attribute("Include", sourceFile); + e2.Element("SubType", "Designer"); + e2.EndElement(); this->AddedFiles.push_back(sourceFile); std::string smallLogo = this->DefaultArtifactDir + "/SmallLogo.png"; cmSystemTools::CopyAFile(templateFolder + "/SmallLogo.png", smallLogo, false); ConvertToWindowsSlash(smallLogo); - this->WriteString("BuildFileStream) << cmVS10EscapeAttr(smallLogo) << "\" />\n"; + Elem(e1, "Image").Attribute("Include", smallLogo).EndElement(); this->AddedFiles.push_back(smallLogo); std::string smallLogo44 = this->DefaultArtifactDir + "/SmallLogo44x44.png"; cmSystemTools::CopyAFile(templateFolder + "/SmallLogo44x44.png", smallLogo44, false); ConvertToWindowsSlash(smallLogo44); - this->WriteString("BuildFileStream) << cmVS10EscapeAttr(smallLogo44) << "\" />\n"; + Elem(e1, "Image").Attribute("Include", smallLogo44).EndElement(); this->AddedFiles.push_back(smallLogo44); std::string logo = this->DefaultArtifactDir + "/Logo.png"; cmSystemTools::CopyAFile(templateFolder + "/Logo.png", logo, false); ConvertToWindowsSlash(logo); - this->WriteString("BuildFileStream) << cmVS10EscapeAttr(logo) << "\" />\n"; + Elem(e1, "Image").Attribute("Include", logo).EndElement(); this->AddedFiles.push_back(logo); std::string storeLogo = this->DefaultArtifactDir + "/StoreLogo.png"; cmSystemTools::CopyAFile(templateFolder + "/StoreLogo.png", storeLogo, false); ConvertToWindowsSlash(storeLogo); - this->WriteString("BuildFileStream) << cmVS10EscapeAttr(storeLogo) << "\" />\n"; + Elem(e1, "Image").Attribute("Include", storeLogo).EndElement(); this->AddedFiles.push_back(storeLogo); std::string splashScreen = this->DefaultArtifactDir + "/SplashScreen.png"; cmSystemTools::CopyAFile(templateFolder + "/SplashScreen.png", splashScreen, false); ConvertToWindowsSlash(splashScreen); - this->WriteString("BuildFileStream) << cmVS10EscapeAttr(splashScreen) << "\" />\n"; + Elem(e1, "Image").Attribute("Include", splashScreen).EndElement(); this->AddedFiles.push_back(splashScreen); // This file has already been added to the build so don't copy it std::string keyFile = this->DefaultArtifactDir + "/Windows_TemporaryKey.pfx"; ConvertToWindowsSlash(keyFile); - this->WriteString("BuildFileStream) << cmVS10EscapeAttr(keyFile) << "\" />\n"; + Elem(e1, "None").Attribute("Include", keyFile).EndElement(); } bool cmVisualStudio10TargetGenerator::ForceOld(const std::string& source) const @@ -4635,13 +4579,11 @@ void cmVisualStudio10TargetGenerator::GetCSharpSourceProperties( } void cmVisualStudio10TargetGenerator::WriteCSharpSourceProperties( - const std::map& tags) + Elem& e2, const std::map& tags) { if (!tags.empty()) { for (const auto& i : tags) { - this->WriteString("<", 3); - (*this->BuildFileStream) << i.first << ">" << cmVS10EscapeXML(i.second) - << "\n"; + e2.Element(i.first.c_str(), i.second); } } } diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index df87df3..f6c5a64 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -35,7 +35,7 @@ public: // used by cmVisualStudioGeneratorOptions std::string CalcCondition(const std::string& config) const; void WritePlatformConfigTag(const char* tag, const std::string& config, - int indentLevel, const char* attribute = 0); + int indentLevel, const std::string& content); private: struct ToolSource @@ -61,93 +61,96 @@ private: void WriteElem(const char* tag, std::string const& val, int indentLevel); void WriteElemEscapeXML(const char* tag, std::string const& val, int indentLevel); - void WriteProjectConfigurations(); - void WriteProjectConfigurationValues(); - void WriteMSToolConfigurationValues(std::string const& config); - void WriteMSToolConfigurationValuesManaged(std::string const& config); - void WriteHeaderSource(cmSourceFile const* sf); - void WriteExtraSource(cmSourceFile const* sf); - void WriteNsightTegraConfigurationValues(std::string const& config); + void WriteProjectConfigurations(Elem& e0); + void WriteProjectConfigurationValues(Elem& e0); + void WriteMSToolConfigurationValues(Elem& e1, std::string const& config); + void WriteMSToolConfigurationValuesManaged(Elem& e1, + std::string const& config); + void WriteHeaderSource(Elem& e1, cmSourceFile const* sf); + void WriteExtraSource(Elem& e1, cmSourceFile const* sf); + void WriteNsightTegraConfigurationValues(Elem& e1, + std::string const& config); void WriteSource(Elem& e2, std::string const& tool, cmSourceFile const* sf); - void WriteExcludeFromBuild(Elem&, + void WriteExcludeFromBuild(Elem& e2, std::vector const& exclude_configs); - void WriteAllSources(); - void WriteDotNetReferences(); - void WriteDotNetReference(std::string const& ref, std::string const& hint, + void WriteAllSources(Elem& e0); + void WriteDotNetReferences(Elem& e0); + void WriteDotNetReference(Elem& e1, std::string const& ref, + std::string const& hint, std::string const& config); - void WriteDotNetReferenceCustomTags(std::string const& ref); - void WriteEmbeddedResourceGroup(); - void WriteWinRTReferences(); - void WriteWinRTPackageCertificateKeyFile(); - void WriteXamlFilesGroup(); - void WritePathAndIncrementalLinkOptions(); - void WriteItemDefinitionGroups(); + void WriteDotNetReferenceCustomTags(Elem& e2, std::string const& ref); + void WriteEmbeddedResourceGroup(Elem& e0); + void WriteWinRTReferences(Elem& e0); + void WriteWinRTPackageCertificateKeyFile(Elem& e0); + void WriteXamlFilesGroup(Elem& e0); + void WritePathAndIncrementalLinkOptions(Elem& e0); + void WriteItemDefinitionGroups(Elem& e0); void VerifyNecessaryFiles(); - void WriteMissingFiles(); - void WriteMissingFilesWP80(); - void WriteMissingFilesWP81(); - void WriteMissingFilesWS80(); - void WriteMissingFilesWS81(); - void WriteMissingFilesWS10_0(); - void WritePlatformExtensions(); - void WriteSinglePlatformExtension(std::string const& extension, + void WriteMissingFiles(Elem& e1); + void WriteMissingFilesWP80(Elem& e1); + void WriteMissingFilesWP81(Elem& e1); + void WriteMissingFilesWS80(Elem& e1); + void WriteMissingFilesWS81(Elem& e1); + void WriteMissingFilesWS10_0(Elem& e1); + void WritePlatformExtensions(Elem& e1); + void WriteSinglePlatformExtension(Elem& e1, std::string const& extension, std::string const& version); - void WriteSDKReferences(); - void WriteSingleSDKReference(std::string const& extension, + void WriteSDKReferences(Elem& e0); + void WriteSingleSDKReference(Elem& e1, std::string const& extension, std::string const& version); - void WriteCommonMissingFiles(const std::string& manifestFile); - void WriteTargetSpecificReferences(); - void WriteTargetsFileReferences(); + void WriteCommonMissingFiles(Elem& e1, const std::string& manifestFile); + void WriteTargetSpecificReferences(Elem& e0); + void WriteTargetsFileReferences(Elem& e1); std::vector GetIncludes(std::string const& config, std::string const& lang) const; bool ComputeClOptions(); bool ComputeClOptions(std::string const& configName); - void WriteClOptions(std::string const& config); + void WriteClOptions(Elem& e1, std::string const& config); bool ComputeRcOptions(); bool ComputeRcOptions(std::string const& config); - void WriteRCOptions(std::string const& config); + void WriteRCOptions(Elem& e1, std::string const& config); bool ComputeCudaOptions(); bool ComputeCudaOptions(std::string const& config); - void WriteCudaOptions(std::string const& config); + void WriteCudaOptions(Elem& e1, std::string const& config); bool ComputeCudaLinkOptions(); bool ComputeCudaLinkOptions(std::string const& config); - void WriteCudaLinkOptions(std::string const& config); + void WriteCudaLinkOptions(Elem& e1, std::string const& config); bool ComputeMasmOptions(); bool ComputeMasmOptions(std::string const& config); - void WriteMasmOptions(std::string const& config); + void WriteMasmOptions(Elem& e1, std::string const& config); bool ComputeNasmOptions(); bool ComputeNasmOptions(std::string const& config); - void WriteNasmOptions(std::string const& config); + void WriteNasmOptions(Elem& e1, std::string const& config); bool ComputeLinkOptions(); bool ComputeLinkOptions(std::string const& config); bool ComputeLibOptions(); bool ComputeLibOptions(std::string const& config); - void WriteLinkOptions(std::string const& config); - void WriteMidlOptions(std::string const& config); - void WriteAntBuildOptions(std::string const& config); - void OutputLinkIncremental(std::string const& configName); - void WriteCustomRule(cmSourceFile const* source, + void WriteLinkOptions(Elem& e1, std::string const& config); + void WriteMidlOptions(Elem& e1, std::string const& config); + void WriteAntBuildOptions(Elem& e1, std::string const& config); + void OutputLinkIncremental(Elem& e1, std::string const& configName); + void WriteCustomRule(Elem& e0, cmSourceFile const* source, cmCustomCommand const& command); void WriteCustomRuleCpp(Elem& e2, std::string const& config, std::string const& script, std::string const& inputs, std::string const& outputs, std::string const& comment); - void WriteCustomRuleCSharp(std::string const& config, + void WriteCustomRuleCSharp(Elem& e0, std::string const& config, std::string const& commandName, std::string const& script, std::string const& inputs, std::string const& outputs, std::string const& comment); - void WriteCustomCommands(); - void WriteCustomCommand(cmSourceFile const* sf); + void WriteCustomCommands(Elem& e0); + void WriteCustomCommand(Elem& e0, cmSourceFile const* sf); void WriteGroups(); - void WriteProjectReferences(); - void WriteApplicationTypeSettings(); + void WriteProjectReferences(Elem& e0); + void WriteApplicationTypeSettings(Elem& e1); void OutputSourceSpecificFlags(Elem&, cmSourceFile const* source); void AddLibraries(const cmComputeLinkInformation& cli, std::vector& libVec, @@ -155,10 +158,10 @@ private: const std::string& config); void AddTargetsFileAndConfigPair(std::string const& targetsFile, std::string const& config); - void WriteLibOptions(std::string const& config); - void WriteManifestOptions(std::string const& config); - void WriteEvents(std::string const& configName); - void WriteEvent(const char* name, + void WriteLibOptions(Elem& e1, std::string const& config); + void WriteManifestOptions(Elem& e1, std::string const& config); + void WriteEvents(Elem& e1, std::string const& configName); + void WriteEvent(Elem& e1, const char* name, std::vector const& commands, std::string const& configName); void WriteGroupSources(Elem& e0, std::string const& name, @@ -175,7 +178,7 @@ private: void GetCSharpSourceProperties(cmSourceFile const* sf, std::map& tags); void WriteCSharpSourceProperties( - const std::map& tags); + Elem& e2, const std::map& tags); void GetCSharpSourceLink(cmSourceFile const* sf, std::string& link); private: ----------------------------------------------------------------------- Summary of changes: Source/cmVisualStudio10TargetGenerator.cxx | 1522 +++++++++++++--------------- Source/cmVisualStudio10TargetGenerator.h | 109 +- 2 files changed, 788 insertions(+), 843 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sat May 5 00:05:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 5 May 2018 00:05:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.1-703-g135825d Message-ID: <20180505040506.0C62210F058@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 135825df209db1375f60c44b14dbceb362e8d5aa (commit) from e628d6cd066774e4c95ec368fc6ef0be731ff0a5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=135825df209db1375f60c44b14dbceb362e8d5aa commit 135825df209db1375f60c44b14dbceb362e8d5aa Author: Kitware Robot AuthorDate: Sat May 5 00:01:06 2018 -0400 Commit: Kitware Robot CommitDate: Sat May 5 00:01:06 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index cf91298..280fe6d 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180504) +set(CMake_VERSION_PATCH 20180505) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sun May 6 00:05:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 6 May 2018 00:05:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.1-704-gc97189f Message-ID: <20180506040504.B9B3810F0A7@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via c97189f9d1f98f357be179d7260e3f91431d72e1 (commit) from 135825df209db1375f60c44b14dbceb362e8d5aa (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c97189f9d1f98f357be179d7260e3f91431d72e1 commit c97189f9d1f98f357be179d7260e3f91431d72e1 Author: Kitware Robot AuthorDate: Sun May 6 00:01:05 2018 -0400 Commit: Kitware Robot CommitDate: Sun May 6 00:01:05 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 280fe6d..c439e9e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180505) +set(CMake_VERSION_PATCH 20180506) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sun May 6 07:15:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 6 May 2018 07:15:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.1-706-gdfc6923 Message-ID: <20180506111506.47EEA10EEF9@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via dfc692342831186053bd385605c8a21239e2e77d (commit) via a01c6e99218540f6e924afd3e855e6db9af76708 (commit) from c97189f9d1f98f357be179d7260e3f91431d72e1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dfc692342831186053bd385605c8a21239e2e77d commit dfc692342831186053bd385605c8a21239e2e77d Merge: c97189f a01c6e9 Author: Craig Scott AuthorDate: Sun May 6 11:14:29 2018 +0000 Commit: Kitware Robot CommitDate: Sun May 6 07:14:54 2018 -0400 Merge topic 'cpack_module_indentation_fix' a01c6e9921 CPack: Fix indentation Acked-by: Kitware Robot Merge-request: !2041 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a01c6e99218540f6e924afd3e855e6db9af76708 commit a01c6e99218540f6e924afd3e855e6db9af76708 Author: Craig Scott AuthorDate: Sat May 5 09:48:25 2018 +1000 Commit: Craig Scott CommitDate: Sat May 5 09:48:25 2018 +1000 CPack: Fix indentation Addresses indentation not matching guidelines, missed in !2020. No functional changes and no changes to docs. diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 720b972..f6d74c5 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -388,26 +388,26 @@ endfunction() # Set the package name _cpack_set_default(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}") if(CMAKE_PROJECT_VERSION_MAJOR) - _cpack_set_default(CPACK_PACKAGE_VERSION_MAJOR "${CMAKE_PROJECT_VERSION_MAJOR}") - if(CMAKE_PROJECT_VERSION_MINOR) - _cpack_set_default(CPACK_PACKAGE_VERSION_MINOR "${CMAKE_PROJECT_VERSION_MINOR}") - if(CMAKE_PROJECT_VERSION_PATCH) - _cpack_set_default(CPACK_PACKAGE_VERSION_PATCH "${CMAKE_PROJECT_VERSION_PATCH}") - _cpack_set_default(CPACK_PACKAGE_VERSION - "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") - else() - _cpack_set_default(CPACK_PACKAGE_VERSION - "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}") - endif() + _cpack_set_default(CPACK_PACKAGE_VERSION_MAJOR "${CMAKE_PROJECT_VERSION_MAJOR}") + if(CMAKE_PROJECT_VERSION_MINOR) + _cpack_set_default(CPACK_PACKAGE_VERSION_MINOR "${CMAKE_PROJECT_VERSION_MINOR}") + if(CMAKE_PROJECT_VERSION_PATCH) + _cpack_set_default(CPACK_PACKAGE_VERSION_PATCH "${CMAKE_PROJECT_VERSION_PATCH}") + _cpack_set_default(CPACK_PACKAGE_VERSION + "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") else() - _cpack_set_default(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}") + _cpack_set_default(CPACK_PACKAGE_VERSION + "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}") endif() + else() + _cpack_set_default(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}") + endif() else() - _cpack_set_default(CPACK_PACKAGE_VERSION_MAJOR "0") - _cpack_set_default(CPACK_PACKAGE_VERSION_MINOR "1") - _cpack_set_default(CPACK_PACKAGE_VERSION_PATCH "1") - _cpack_set_default(CPACK_PACKAGE_VERSION - "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") + _cpack_set_default(CPACK_PACKAGE_VERSION_MAJOR "0") + _cpack_set_default(CPACK_PACKAGE_VERSION_MINOR "1") + _cpack_set_default(CPACK_PACKAGE_VERSION_PATCH "1") + _cpack_set_default(CPACK_PACKAGE_VERSION + "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") endif() _cpack_set_default(CPACK_PACKAGE_VENDOR "Humanity") if(CMAKE_PROJECT_DESCRIPTION) ----------------------------------------------------------------------- Summary of changes: Modules/CPack.cmake | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon May 7 00:05:08 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 7 May 2018 00:05:08 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.1-707-g7489d9c Message-ID: <20180507040508.088CE10F35B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 7489d9cb241f199471499e0952a13ea48fec1f9e (commit) from dfc692342831186053bd385605c8a21239e2e77d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7489d9cb241f199471499e0952a13ea48fec1f9e commit 7489d9cb241f199471499e0952a13ea48fec1f9e Author: Kitware Robot AuthorDate: Mon May 7 00:01:08 2018 -0400 Commit: Kitware Robot CommitDate: Mon May 7 00:01:08 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index c439e9e..cacaaa0 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180506) +set(CMake_VERSION_PATCH 20180507) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon May 7 09:25:11 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 7 May 2018 09:25:11 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.1-709-g42db369 Message-ID: <20180507132511.3B29B10F3F3@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 42db369133d4cfc0e47bb624b2a08e57fee097a5 (commit) via 5cc195f1f4a7630b7ee54dfe9c2761cb5ee2a8e0 (commit) from 7489d9cb241f199471499e0952a13ea48fec1f9e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=42db369133d4cfc0e47bb624b2a08e57fee097a5 commit 42db369133d4cfc0e47bb624b2a08e57fee097a5 Merge: 7489d9c 5cc195f Author: Brad King AuthorDate: Mon May 7 13:18:52 2018 +0000 Commit: Kitware Robot CommitDate: Mon May 7 09:19:07 2018 -0400 Merge topic 'vs-cert' 5cc195f1f4 VS Generator: Only include default certificate if it was actually copied Acked-by: Kitware Robot Merge-request: !2034 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5cc195f1f4a7630b7ee54dfe9c2761cb5ee2a8e0 commit 5cc195f1f4a7630b7ee54dfe9c2761cb5ee2a8e0 Author: Mark Ingram AuthorDate: Fri May 4 11:17:56 2018 +0100 Commit: Mark Ingram CommitDate: Fri May 4 18:10:10 2018 +0100 VS Generator: Only include default certificate if it was actually copied diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 7a7c647..2e8a2eb 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -3964,6 +3964,7 @@ void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile( pfxFile, false); ConvertToWindowsSlash(pfxFile); this->AddedFiles.push_back(pfxFile); + this->AddedDefaultCertificate = true; } e1.Element("PackageCertificateKeyFile", pfxFile); @@ -4530,10 +4531,13 @@ void cmVisualStudio10TargetGenerator::WriteCommonMissingFiles( Elem(e1, "Image").Attribute("Include", splashScreen).EndElement(); this->AddedFiles.push_back(splashScreen); - // This file has already been added to the build so don't copy it - std::string keyFile = this->DefaultArtifactDir + "/Windows_TemporaryKey.pfx"; - ConvertToWindowsSlash(keyFile); - Elem(e1, "None").Attribute("Include", keyFile).EndElement(); + if (this->AddedDefaultCertificate) { + // This file has already been added to the build so don't copy it + std::string keyFile = + this->DefaultArtifactDir + "/Windows_TemporaryKey.pfx"; + ConvertToWindowsSlash(keyFile); + Elem(e1, "None").Attribute("Include", keyFile).EndElement(); + } } bool cmVisualStudio10TargetGenerator::ForceOld(const std::string& source) const diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index f6c5a64..ecf19d7 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -219,6 +219,7 @@ private: bool IsMissingFiles; std::vector AddedFiles; std::string DefaultArtifactDir; + bool AddedDefaultCertificate = false; // managed C++/C# relevant members typedef std::pair DotNetHintReference; typedef std::vector DotNetHintReferenceList; ----------------------------------------------------------------------- Summary of changes: Source/cmVisualStudio10TargetGenerator.cxx | 12 ++++++++---- Source/cmVisualStudio10TargetGenerator.h | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon May 7 10:15:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 7 May 2018 10:15:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.1-716-gdd3e1a7 Message-ID: <20180507141504.CBA77107885@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via dd3e1a737216b7c9bfb6c7569685b36a1bff9cba (commit) via 72814e46dabe120964c9cebc55cc4952bf4837e3 (commit) via 08b4ea639c877dee93d0a23a0fcf2ad41c7a1fcc (commit) via 51c0e1407c1317e8084c72fabebb60fffcaac99d (commit) via 0acd70511946597b30e934369353654cdc18929e (commit) via d5b2745b34cba326a634bee677bb80c79ada52d9 (commit) via 7d918b3cee64961a1ed5e9c5a28f29cf0e48c130 (commit) from 42db369133d4cfc0e47bb624b2a08e57fee097a5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dd3e1a737216b7c9bfb6c7569685b36a1bff9cba commit dd3e1a737216b7c9bfb6c7569685b36a1bff9cba Merge: 42db369 72814e4 Author: Brad King AuthorDate: Mon May 7 14:12:00 2018 +0000 Commit: Kitware Robot CommitDate: Mon May 7 10:12:05 2018 -0400 Merge topic 'doc-command-synopsis' 72814e46da Utilities/Sphinx: Make HTML links in parsed-literal blocks more obvious 08b4ea639c Help: Organize file command docs into sections 51c0e1407c Help: Add Synopsis section to install, list, and string docs 0acd705119 Help: Improve list command signature group name for read operations d5b2745b34 Help: Re-order file command docs 7d918b3cee cmRST: Parse inline links and inline literals Acked-by: Kitware Robot Merge-request: !2039 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=72814e46dabe120964c9cebc55cc4952bf4837e3 commit 72814e46dabe120964c9cebc55cc4952bf4837e3 Author: Brad King AuthorDate: Fri May 4 13:26:32 2018 -0400 Commit: Brad King CommitDate: Mon May 7 10:10:37 2018 -0400 Utilities/Sphinx: Make HTML links in parsed-literal blocks more obvious Hyperlink text color does not stand out when used inside a literal block because such blocks typically get syntax highlighting. Update our CSS style to make the links more distinct. Suggested-by: Kyle Edwards diff --git a/Utilities/Sphinx/static/cmake.css b/Utilities/Sphinx/static/cmake.css index 2a326d4..b082ede 100644 --- a/Utilities/Sphinx/static/cmake.css +++ b/Utilities/Sphinx/static/cmake.css @@ -6,3 +6,13 @@ div.sphinxsidebarwrapper { word-wrap: break-word; } + +/* Make links inside parsed-literal blocks more obvious + by using a background color and increased line spacing + to make them look boxed. */ +.literal-block { + line-height: 1.4; +} +.literal-block a.reference.internal { + background-color: #dfdfdf; +} https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=08b4ea639c877dee93d0a23a0fcf2ad41c7a1fcc commit 08b4ea639c877dee93d0a23a0fcf2ad41c7a1fcc Author: Brad King AuthorDate: Fri May 4 09:12:07 2018 -0400 Commit: Brad King CommitDate: Mon May 7 10:10:37 2018 -0400 Help: Organize file command docs into sections Add a synopsis section at the top summarizing all signatures. Issue: #17948 diff --git a/Help/command/file.rst b/Help/command/file.rst index 518ba9d..d4a6006 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -3,7 +3,44 @@ file File manipulation command. ------------------------------------------------------------------------------- +Synopsis +^^^^^^^^ + +.. parsed-literal:: + + `Reading`_ + file(`READ`_ [...]) + file(`STRINGS`_ [...]) + file(`\ `_ ) + file(`TIMESTAMP`_ [...]) + + `Writing`_ + file({`WRITE`_ | `APPEND`_} ...) + file({`TOUCH`_ | `TOUCH_NOCREATE`_} [...]) + file(`GENERATE`_ OUTPUT [...]) + + `Filesystem`_ + file({`GLOB`_ | `GLOB_RECURSE`_} [...] [...]) + file(`RENAME`_ ) + file({`REMOVE`_ | `REMOVE_RECURSE`_ } [...]) + file(`MAKE_DIRECTORY`_ [...]) + file({`COPY`_ | `INSTALL`_} ... DESTINATION [...]) + + `Path Conversion`_ + file(`RELATIVE_PATH`_ ) + file({`TO_CMAKE_PATH`_ | `TO_NATIVE_PATH`_} ) + + `Transfer`_ + file(`DOWNLOAD`_ [...]) + file(`UPLOAD`_ [...]) + + `Locking`_ + file(`LOCK`_ [...]) + +Reading +^^^^^^^ + +.. _READ: :: @@ -15,7 +52,7 @@ Read content from a file called ```` and store it in a read at most ```` bytes. The ``HEX`` option causes data to be converted to a hexadecimal representation (useful for binary data). ------------------------------------------------------------------------------- +.. _STRINGS: :: @@ -66,7 +103,7 @@ For example, the code stores a list in the variable ``myfile`` in which each item is a line from the input file. ------------------------------------------------------------------------------- +.. _HASH: :: @@ -77,7 +114,7 @@ store it in a ````. The supported ```` algorithm names are those listed by the :ref:`string(\) ` command. ------------------------------------------------------------------------------- +.. _TIMESTAMP: :: @@ -90,7 +127,11 @@ timestamp variable will be set to the empty string (""). See the :command:`string(TIMESTAMP)` command for documentation of the ```` and ``UTC`` options. ------------------------------------------------------------------------------- +Writing +^^^^^^^ + +.. _WRITE: +.. _APPEND: :: @@ -106,7 +147,8 @@ exist will be created. If the file is a build input, use the :command:`configure_file` command to update the file only when its content changes. ------------------------------------------------------------------------------- +.. _TOUCH: +.. _TOUCH_NOCREATE: :: @@ -123,7 +165,7 @@ does not exist it will be silently ignored. With TOUCH and TOUCH_NOCREATE the contents of an existing file will not be modified. ------------------------------------------------------------------------------- +.. _GENERATE: :: @@ -169,7 +211,11 @@ generation phase. The output file will not yet have been written when the ``file(GENERATE)`` command returns, it is written only after processing all of a project's ``CMakeLists.txt`` files. ------------------------------------------------------------------------------- +Filesystem +^^^^^^^^^^ + +.. _GLOB: +.. _GLOB_RECURSE: :: @@ -224,7 +270,7 @@ Examples of recursive globbing include:: /dir/*.py - match all python files in /dir and subdirectories ------------------------------------------------------------------------------- +.. _RENAME: :: @@ -233,7 +279,8 @@ Examples of recursive globbing include:: Move a file or directory within a filesystem from ```` to ````, replacing the destination atomically. ------------------------------------------------------------------------------- +.. _REMOVE: +.. _REMOVE_RECURSE: :: @@ -244,7 +291,7 @@ Remove the given files. The ``REMOVE_RECURSE`` mode will remove the given files and directories, also non-empty directories. No error is emitted if a given file does not exist. ------------------------------------------------------------------------------- +.. _MAKE_DIRECTORY: :: @@ -252,7 +299,8 @@ given file does not exist. Create the given directories and their parents as needed. ------------------------------------------------------------------------------- +.. _COPY: +.. _INSTALL: :: @@ -285,7 +333,10 @@ and ``NO_SOURCE_PERMISSIONS`` is default. Installation scripts generated by the :command:`install` command use this signature (with some undocumented options for internal use). ------------------------------------------------------------------------------- +Path Conversion +^^^^^^^^^^^^^^^ + +.. _RELATIVE_PATH: :: @@ -294,7 +345,8 @@ use this signature (with some undocumented options for internal use). Compute the relative path from a ```` to a ```` and store it in the ````. ------------------------------------------------------------------------------- +.. _TO_CMAKE_PATH: +.. _TO_NATIVE_PATH: :: @@ -312,7 +364,11 @@ path with platform-specific slashes (``\`` on Windows and ``/`` elsewhere). Always use double quotes around the ```` to be sure it is treated as a single argument to this command. ------------------------------------------------------------------------------- +Transfer +^^^^^^^^ + +.. _DOWNLOAD: +.. _UPLOAD: :: @@ -399,7 +455,10 @@ check certificates and/or use ``EXPECTED_HASH`` to verify downloaded content. If neither ``TLS`` option is given CMake will check variables ``CMAKE_TLS_VERIFY`` and ``CMAKE_TLS_CAINFO``, respectively. ------------------------------------------------------------------------------- +Locking +^^^^^^^ + +.. _LOCK: :: https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=51c0e1407c1317e8084c72fabebb60fffcaac99d commit 51c0e1407c1317e8084c72fabebb60fffcaac99d Author: Brad King AuthorDate: Fri May 4 08:18:32 2018 -0400 Commit: Brad King CommitDate: Mon May 7 10:10:37 2018 -0400 Help: Add Synopsis section to install, list, and string docs Summarize the command signatures in one block at the top of the documentation as is typical in Unix command-line tool manuals. Make the mode keywords links to the corresponding full signature and documentation. Issue: #17948 diff --git a/Help/command/install.rst b/Help/command/install.rst index a81714f..6cea996 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -1,19 +1,19 @@ install ------- -.. only:: html - - .. contents:: - Specify rules to run at install time. -This command accepts several signatures: +Synopsis +^^^^^^^^ -* :ref:`install(TARGETS) ` -* :ref:`install(FILES|PROGRAMS) ` -* :ref:`install(DIRECTORY) ` -* :ref:`install(SCRIPT|CODE) ` -* :ref:`install(EXPORT|EXPORT_ANDROID_MK) ` +.. parsed-literal:: + + install(`TARGETS`_ ... [...]) + install({`FILES`_ | `PROGRAMS`_} ... DESTINATION [...]) + install(`DIRECTORY`_ ... DESTINATION [...]) + install(`SCRIPT`_ [...]) + install(`CODE`_ [...]) + install(`EXPORT`_ DESTINATION [...]) Introduction ^^^^^^^^^^^^ @@ -89,11 +89,11 @@ Command signatures that install files may print messages during installation. Use the :variable:`CMAKE_INSTALL_MESSAGE` variable to control which messages are printed. -.. _install-targets: - Installing Targets ^^^^^^^^^^^^^^^^^^ +.. _TARGETS: + :: install(TARGETS targets... [EXPORT ] @@ -284,11 +284,12 @@ The install destination given to the target install ``DESTINATION`` may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. -.. _install-files: - Installing Files ^^^^^^^^^^^^^^^^ +.. _FILES: +.. _PROGRAMS: + :: install( files... DESTINATION @@ -319,11 +320,11 @@ The install destination given to the files install ``DESTINATION`` may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. -.. _install-directory: - Installing Directories ^^^^^^^^^^^^^^^^^^^^^^ +.. _DIRECTORY: + :: install(DIRECTORY dirs... DESTINATION @@ -402,11 +403,12 @@ given to the directory install ``DESTINATION`` may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. -.. _install-script: - Custom Installation Logic ^^^^^^^^^^^^^^^^^^^^^^^^^ +.. _CODE: +.. _SCRIPT: + :: install([[SCRIPT ] [CODE ]] @@ -425,11 +427,11 @@ example, the code will print a message during installation. -.. _install-export: - Installing Exports ^^^^^^^^^^^^^^^^^^ +.. _EXPORT: + :: install(EXPORT DESTINATION diff --git a/Help/command/list.rst b/Help/command/list.rst index 7eb83ad..589e572 100644 --- a/Help/command/list.rst +++ b/Help/command/list.rst @@ -1,11 +1,37 @@ list ---- -.. only:: html +List operations. - .. contents:: +Synopsis +^^^^^^^^ -List operations. +.. parsed-literal:: + + `Reading`_ + list(`LENGTH`_ ) + list(`GET`_ [ ...] ) + list(`JOIN`_ ) + list(`SUBLIST`_ ) + + `Search`_ + list(`FIND`_ ) + + `Modification`_ + list(`APPEND`_ [...]) + list(`FILTER`_ {INCLUDE | EXCLUDE} REGEX ) + list(`INSERT`_ [...]) + list(`REMOVE_ITEM`_ ...) + list(`REMOVE_AT`_ ...) + list(`REMOVE_DUPLICATES`_ ) + list(`TRANSFORM`_ [...]) + + `Ordering`_ + list(`REVERSE`_ ) + list(`SORT`_ ) + +Introduction +^^^^^^^^^^^^ The list subcommands ``APPEND``, ``INSERT``, ``FILTER``, ``REMOVE_AT``, ``REMOVE_ITEM``, ``REMOVE_DUPLICATES``, ``REVERSE`` and ``SORT`` may create @@ -36,8 +62,7 @@ scope. To propagate the results of these operations upwards, use Reading ^^^^^^^ -LENGTH -"""""" +.. _LENGTH: :: @@ -45,8 +70,7 @@ LENGTH Returns the list's length. -GET -""" +.. _GET: :: @@ -54,8 +78,7 @@ GET Returns the list of elements specified by indices from the list. -JOIN -"""" +.. _JOIN: :: @@ -65,8 +88,7 @@ Returns a string joining all list's elements using the glue string. To join multiple strings, which are not part of a list, use ``JOIN`` operator from :command:`string` command. -SUBLIST -""""""" +.. _SUBLIST: :: @@ -80,8 +102,7 @@ the remaining elements of the list starting at ```` will be returned. Search ^^^^^^ -FIND -"""" +.. _FIND: :: @@ -93,8 +114,7 @@ if it wasn't found. Modification ^^^^^^^^^^^^ -APPEND -"""""" +.. _APPEND: :: @@ -102,8 +122,7 @@ APPEND Appends elements to the list. -FILTER -"""""" +.. _FILTER: :: @@ -115,8 +134,7 @@ In ``REGEX`` mode, items will be matched against the given regular expression. For more information on regular expressions see also the :command:`string` command. -INSERT -"""""" +.. _INSERT: :: @@ -124,8 +142,7 @@ INSERT Inserts elements to the list to the specified location. -REMOVE_ITEM -""""""""""" +.. _REMOVE_ITEM: :: @@ -133,8 +150,7 @@ REMOVE_ITEM Removes the given items from the list. -REMOVE_AT -""""""""" +.. _REMOVE_AT: :: @@ -142,8 +158,7 @@ REMOVE_AT Removes items at given indices from the list. -REMOVE_DUPLICATES -""""""""""""""""" +.. _REMOVE_DUPLICATES: :: @@ -151,8 +166,7 @@ REMOVE_DUPLICATES Removes duplicated items in the list. -TRANSFORM -""""""""" +.. _TRANSFORM: :: @@ -224,11 +238,10 @@ expression will be transformed. :: list(TRANSFORM REGEX ...) -Sorting -^^^^^^^ +Ordering +^^^^^^^^ -REVERSE -""""""" +.. _REVERSE: :: @@ -236,8 +249,7 @@ REVERSE Reverses the contents of the list in-place. -SORT -"""" +.. _SORT: :: diff --git a/Help/command/string.rst b/Help/command/string.rst index e84f788..efa923b 100644 --- a/Help/command/string.rst +++ b/Help/command/string.rst @@ -1,17 +1,52 @@ string ------ -.. only:: html - - .. contents:: - String operations. +Synopsis +^^^^^^^^ + +.. parsed-literal:: + + `Search and Replace`_ + string(`FIND`_ [...]) + string(`REPLACE`_ ...) + + `Regular Expressions`_ + string(`REGEX MATCH`_ ...) + string(`REGEX MATCHALL`_ ...) + string(`REGEX REPLACE`_ ...) + + `Manipulation`_ + string(`APPEND`_ [...]) + string(`PREPEND`_ [...]) + string(`CONCAT`_ [...]) + string(`JOIN`_ [...]) + string(`TOLOWER`_ ) + string(`TOUPPER`_ ) + string(`LENGTH`_ ) + string(`SUBSTRING`_ ) + string(`STRIP`_ ) + string(`GENEX_STRIP`_ ) + + `Comparison`_ + string(`COMPARE`_ ) + + `Hashing`_ + string(`\ `_ ) + + `Generation`_ + string(`ASCII`_ ... ) + string(`CONFIGURE`_ [...]) + string(`MAKE_C_IDENTIFIER`_ ) + string(`RANDOM`_ [