From kwrobot at kitware.com Fri May 1 00:01:07 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 1 May 2015 00:01:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.2-989-g59edc03 Message-ID: <20150501040107.78D76AFC0D@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 59edc038d59b5898ee1d8baeab6e10d7f897c31e (commit) from 5e35d4a67f347cd1e4bb66dc225385ce4e8b1f5a (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=59edc038d59b5898ee1d8baeab6e10d7f897c31e commit 59edc038d59b5898ee1d8baeab6e10d7f897c31e Author: Kitware Robot AuthorDate: Fri May 1 00:01:05 2015 -0400 Commit: Kitware Robot CommitDate: Fri May 1 00:01:05 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 592d922..66017ba 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 2) -set(CMake_VERSION_PATCH 20150430) +set(CMake_VERSION_PATCH 20150501) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From steveire at gmail.com Fri May 1 04:04:50 2015 From: steveire at gmail.com (Stephen Kelly) Date: Fri, 1 May 2015 04:04:50 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2391-gbfc051e Message-ID: <20150501080450.440B1AFBE6@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, next has been updated via bfc051e9c4f64b44a145fb277e9877c8d7494441 (commit) via 5cdda25d677ef502a4e716360888fa52a3ca826b (commit) from 0243760567b7e05c08e3dd8852b2e6d9152dd7af (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bfc051e9c4f64b44a145fb277e9877c8d7494441 commit bfc051e9c4f64b44a145fb277e9877c8d7494441 Merge: 0243760 5cdda25 Author: Stephen Kelly AuthorDate: Fri May 1 04:04:49 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri May 1 04:04:49 2015 -0400 Merge topic 'refactor-cmDefinitions-Get' into next 5cdda25d Revert "cmDefinitions: Simplify creation of intermediate scope values." http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5cdda25d677ef502a4e716360888fa52a3ca826b commit 5cdda25d677ef502a4e716360888fa52a3ca826b Author: Stephen Kelly AuthorDate: Fri May 1 09:55:40 2015 +0200 Commit: Stephen Kelly CommitDate: Fri May 1 09:56:43 2015 +0200 Revert "cmDefinitions: Simplify creation of intermediate scope values." This reverts commit c593ae71a3efe7c5fed08d16b0be46b114696e6d. diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 9117d0a..ff530d7 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -21,11 +21,13 @@ const char* cmDefinitions::Get(const std::string& key, std::list::reverse_iterator rbegin = rit; assert(rit != rend); MapType::const_iterator i; + Def def; for ( ; rit != rend; ++rit) { i = rit->Map.find(key); if(i != rit->Map.end()) { + def = i->second; break; } } @@ -34,8 +36,7 @@ const char* cmDefinitions::Get(const std::string& key, // Store the result in intermediate scopes. for (rit = rbegin; rit != last; ++rit) { - i = rit->Map.insert(MapType::value_type( - key, Def(i != rit->Map.end() ? i->second : 0))).first; + i = rit->Map.insert(MapType::value_type(key, def)).first; } return i->second.Exists ? i->second.c_str() : 0; } ----------------------------------------------------------------------- Summary of changes: Source/cmDefinitions.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From steveire at gmail.com Fri May 1 04:05:52 2015 From: steveire at gmail.com (Stephen Kelly) Date: Fri, 1 May 2015 04:05:52 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2395-gc8dc264 Message-ID: <20150501080552.7218EAFC06@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, next has been updated via c8dc2648568e81c418c1a012dc6b2a59e8e260cb (commit) via f76d78db21c68c651ba9cb3017d875cb3ed74f9e (commit) via 468c2c82ca4123ac9cceb095a91969fbedd63afc (commit) via ecc1af22936bbe2a6dcd5b7ee8093b279bd3efc1 (commit) from bfc051e9c4f64b44a145fb277e9877c8d7494441 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c8dc2648568e81c418c1a012dc6b2a59e8e260cb commit c8dc2648568e81c418c1a012dc6b2a59e8e260cb Merge: bfc051e f76d78d Author: Stephen Kelly AuthorDate: Fri May 1 04:05:51 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri May 1 04:05:51 2015 -0400 Merge topic 'refactor-cmDefinitions-Get' into next f76d78db cmDefinitions: Make Get method static. 468c2c82 cmDefinitions: Inline GetInternal method. ecc1af22 cmDefinitions: Remove obsolete NoDef object. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f76d78db21c68c651ba9cb3017d875cb3ed74f9e commit f76d78db21c68c651ba9cb3017d875cb3ed74f9e Author: Stephen Kelly AuthorDate: Fri May 1 01:50:45 2015 +0200 Commit: Stephen Kelly CommitDate: Fri May 1 10:03:40 2015 +0200 cmDefinitions: Make Get method static. diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index cfcc000..ae42b8e 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -31,9 +31,9 @@ class cmDefinitions public: /** Get the value associated with a key; null if none. Store the result locally if it came from a parent. */ - const char* Get(const std::string& key, - std::list::reverse_iterator rit, - std::list::reverse_iterator rend); + static const char* Get(const std::string& key, + std::list::reverse_iterator rit, + std::list::reverse_iterator rend); /** Set (or unset if null) a value associated with a key. */ void Set(const std::string& key, const char* value); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b16d7e6..4ed2419 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -65,8 +65,8 @@ public: const char* GetDefinition(std::string const& name) { - return this->VarStack.back().Get(name, this->VarStack.rbegin(), - this->VarStack.rend()); + return cmDefinitions::Get(name, this->VarStack.rbegin(), + this->VarStack.rend()); } void SetDefinition(std::string const& name, std::string const& value) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=468c2c82ca4123ac9cceb095a91969fbedd63afc commit 468c2c82ca4123ac9cceb095a91969fbedd63afc Author: Stephen Kelly AuthorDate: Fri May 1 01:40:42 2015 +0200 Commit: Stephen Kelly CommitDate: Fri May 1 10:03:40 2015 +0200 cmDefinitions: Inline GetInternal method. diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 6f3a7c5..ff530d7 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -14,8 +14,7 @@ #include //---------------------------------------------------------------------------- -cmDefinitions::Def const& -cmDefinitions::GetInternal(const std::string& key, +const char* cmDefinitions::Get(const std::string& key, std::list::reverse_iterator rit, std::list::reverse_iterator rend) { @@ -39,16 +38,7 @@ cmDefinitions::GetInternal(const std::string& key, { i = rit->Map.insert(MapType::value_type(key, def)).first; } - return i->second; -} - -//---------------------------------------------------------------------------- -const char* cmDefinitions::Get(const std::string& key, - std::list::reverse_iterator rit, - std::list::reverse_iterator rend) -{ - Def const& def = this->GetInternal(key, rit, rend); - return def.Exists? def.c_str() : 0; + return i->second.Exists ? i->second.c_str() : 0; } //---------------------------------------------------------------------------- diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index d618911..cfcc000 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -72,11 +72,6 @@ private: #endif MapType Map; - // Internal query and update methods. - Def const& GetInternal(const std::string& key, - std::list::reverse_iterator rit, - std::list::reverse_iterator rend); - void MakeClosure(std::set& undefined, std::list::const_reverse_iterator rbegin, std::list::const_reverse_iterator rend); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ecc1af22936bbe2a6dcd5b7ee8093b279bd3efc1 commit ecc1af22936bbe2a6dcd5b7ee8093b279bd3efc1 Author: Stephen Kelly AuthorDate: Fri May 1 01:30:49 2015 +0200 Commit: Stephen Kelly CommitDate: Fri May 1 10:03:39 2015 +0200 cmDefinitions: Remove obsolete NoDef object. diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 1d0e108..6f3a7c5 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -14,9 +14,6 @@ #include //---------------------------------------------------------------------------- -cmDefinitions::Def cmDefinitions::NoDef; - -//---------------------------------------------------------------------------- cmDefinitions::Def const& cmDefinitions::GetInternal(const std::string& key, std::list::reverse_iterator rit, @@ -25,7 +22,7 @@ cmDefinitions::GetInternal(const std::string& key, std::list::reverse_iterator rbegin = rit; assert(rit != rend); MapType::const_iterator i; - Def def = this->NoDef; + Def def; for ( ; rit != rend; ++rit) { i = rit->Map.find(key); diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 8b78f2c..d618911 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -63,7 +63,6 @@ private: Def(Def const& d): std_string(d), Exists(d.Exists) {} bool Exists; }; - static Def NoDef; // Local definitions, set or unset. #if defined(CMAKE_BUILD_WITH_CMAKE) ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Fri May 1 08:23:41 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 1 May 2015 08:23:41 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2397-ge6c6584 Message-ID: <20150501122341.C931CAFB46@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, next has been updated via e6c6584e5662e83f7a3e056ae246a1d589085c67 (commit) via bb6663ca0a73872b063477e92272418b7d49e39b (commit) from c8dc2648568e81c418c1a012dc6b2a59e8e260cb (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e6c6584e5662e83f7a3e056ae246a1d589085c67 commit e6c6584e5662e83f7a3e056ae246a1d589085c67 Merge: c8dc264 bb6663c Author: Brad King AuthorDate: Fri May 1 08:23:40 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri May 1 08:23:40 2015 -0400 Merge topic 'mingw32-make-backslash-workaround' into next bb6663ca Makefile: Workaround mingw32-make trailing backslash trouble (#15546) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bb6663ca0a73872b063477e92272418b7d49e39b commit bb6663ca0a73872b063477e92272418b7d49e39b Author: Brad King AuthorDate: Thu Apr 30 15:25:16 2015 -0400 Commit: Brad King CommitDate: Fri May 1 08:23:22 2015 -0400 Makefile: Workaround mingw32-make trailing backslash trouble (#15546) When given the command line tool a\ b c mingw32-make incorrectly passes "a b" and "c" to the tool. When given the command line tool a\ b "c" mingw32-make correctly passes "a\", "b", and "c" to the tool. Since commit v3.1.0-rc1~861^2 (MSVC: Add properties to configure compiler PDB files, 2014-02-24) we pass the compiler pdb option to MS-style compiler tools as "/Fd\" but mingw32-make may consume the backslash as escaping a following space as described above. Workaround this problem by changing the backslash to a forward slash as had been used prior to the above commit. diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 4f2e4a0..c9b9ccc 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -95,6 +95,7 @@ public: * Set to true if the make tool being used is MinGW Make. */ void SetMinGWMake(bool v) {this->MinGWMake = v;} + bool IsMinGWMake() const { return this->MinGWMake; } /** * Set to true if the make tool being used is NMake. diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index ea11c79..b7e4e37 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -23,6 +23,7 @@ #include "cmComputeLinkInformation.h" #include "cmCustomCommandGenerator.h" #include "cmGeneratorExpression.h" +#include "cmAlgorithms.h" #include "cmMakefileExecutableTargetGenerator.h" #include "cmMakefileLibraryTargetGenerator.h" @@ -668,6 +669,15 @@ cmMakefileTargetGenerator this->Convert(targetFullPathCompilePDB, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); + + if (this->LocalGenerator->IsMinGWMake() && + cmHasLiteralSuffix(targetOutPathCompilePDB, "\\")) + { + // mingw32-make incorrectly interprets 'a\ b c' as 'a b' and 'c' + // (but 'a\ b "c"' as 'a\', 'b', and 'c'!). Workaround this by + // avoiding a trailing backslash in the argument. + targetOutPathCompilePDB[targetOutPathCompilePDB.size()-1] = '/'; + } } cmLocalGenerator::RuleVariables vars; vars.RuleLauncher = "RULE_LAUNCH_COMPILE"; ----------------------------------------------------------------------- Summary of changes: Source/cmLocalUnixMakefileGenerator3.h | 1 + Source/cmMakefileTargetGenerator.cxx | 10 ++++++++++ 2 files changed, 11 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Fri May 1 09:31:21 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 1 May 2015 09:31:21 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2399-g603942d Message-ID: <20150501133121.DA953AFD0C@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, next has been updated via 603942d29753c0c44a1bee603e2cd524d4de6934 (commit) via 1bef1f55402d3c230c41d3cc6cfa0520ff17e5aa (commit) from e6c6584e5662e83f7a3e056ae246a1d589085c67 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=603942d29753c0c44a1bee603e2cd524d4de6934 commit 603942d29753c0c44a1bee603e2cd524d4de6934 Merge: e6c6584 1bef1f5 Author: Brad King AuthorDate: Fri May 1 09:31:20 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri May 1 09:31:20 2015 -0400 Merge topic 'interface-link-items' into next 1bef1f55 Revert "Allow INTERFACE libraries to specify link items" http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1bef1f55402d3c230c41d3cc6cfa0520ff17e5aa commit 1bef1f55402d3c230c41d3cc6cfa0520ff17e5aa Author: Brad King AuthorDate: Fri May 1 09:15:59 2015 -0400 Commit: Brad King CommitDate: Fri May 1 09:15:59 2015 -0400 Revert "Allow INTERFACE libraries to specify link items" This reverts commit e4adad1e496cae86b484fb49e22e661f49c1f9a5. The feature will be redesigned in the future. diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst index 079e89e..ae5e58e 100644 --- a/Help/manual/cmake-buildsystem.7.rst +++ b/Help/manual/cmake-buildsystem.7.rst @@ -819,10 +819,9 @@ It may specify usage requirements such as :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES`, :prop_tgt:`INTERFACE_COMPILE_DEFINITIONS`, :prop_tgt:`INTERFACE_COMPILE_OPTIONS`, -:prop_tgt:`INTERFACE_LINK_LIBRARIES`, +:prop_tgt:`INTERFACE_LINK_LIBRARIES`, and :prop_tgt:`INTERFACE_SOURCES`, -:prop_tgt:`INTERFACE_POSITION_INDEPENDENT_CODE`, -and :prop_tgt:`INTERFACE_LINK_ITEMS`. +:prop_tgt:`INTERFACE_POSITION_INDEPENDENT_CODE`. Only the ``INTERFACE`` modes of the :command:`target_include_directories`, :command:`target_compile_definitions`, :command:`target_compile_options`, :command:`target_sources`, and :command:`target_link_libraries` commands diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index bed1c38..02d164b 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -168,7 +168,6 @@ Properties on Targets /prop_tgt/INTERFACE_COMPILE_FEATURES /prop_tgt/INTERFACE_COMPILE_OPTIONS /prop_tgt/INTERFACE_INCLUDE_DIRECTORIES - /prop_tgt/INTERFACE_LINK_ITEMS /prop_tgt/INTERFACE_LINK_LIBRARIES /prop_tgt/INTERFACE_POSITION_INDEPENDENT_CODE /prop_tgt/INTERFACE_SOURCES diff --git a/Help/prop_tgt/INTERFACE_LINK_ITEMS.rst b/Help/prop_tgt/INTERFACE_LINK_ITEMS.rst deleted file mode 100644 index dc10a8f..0000000 --- a/Help/prop_tgt/INTERFACE_LINK_ITEMS.rst +++ /dev/null @@ -1,29 +0,0 @@ -INTERFACE_LINK_ITEMS --------------------- - -Specify link line items for an :ref:`Interface Library `. - -An interface library has no library file so linking to it normally -adds its usage requirements but does not link to an actual library. -The ``INTERFACE_LINK_ITEMS`` property specifies a -:ref:`;-list ` of items to be placed on the -link line in place of the interface library. One may use -:manual:`generator expressions `. -Each item may be: - -* A full path to a library file such as ``/usr/lib/libfoo.so``. -* A plain library name such as ``foo``. -* A link flag. - -See the :command:`target_link_libraries` command for details on -how each type of item is treated, but note that the -``INTERFACE_LINK_ITEMS`` property does not recognize the keyword -arguments of that command. Furthermore, items specified in this -property are *not* treated as library target names even if they -happen to name one. Items may *not* contain ``::`` because CMake -assumes such names refer to :ref:`Alias Targets` or -:ref:`Imported Targets` whether they are defined or not. - -The ``INTERFACE_LINK_ITEMS`` property is allowed only on -:ref:`Interface Libraries` and is rejected on targets of other -types. diff --git a/Help/release/dev/interface-link-items.rst b/Help/release/dev/interface-link-items.rst deleted file mode 100644 index 6b84918..0000000 --- a/Help/release/dev/interface-link-items.rst +++ /dev/null @@ -1,6 +0,0 @@ -interface-link-items --------------------- - -* :ref:`Interface Libraries` learned a new :prop_tgt:`INTERFACE_LINK_ITEMS` - target property to specify link line items since interface libraries do - not have their own library files. diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 8cda169..6ecf0dc 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -659,16 +659,6 @@ void cmComputeLinkInformation::AddItem(std::string const& item, // of COMPATIBLE_INTERFACE_ enforcement. The generators will ignore // this for the actual link line. this->Items.push_back(Item(std::string(), true, tgt)); - - // Also add items the interface specifies to be used in its place. - std::vector ifaceLinkItems; - tgt->GetInterfaceLinkItems(ifaceLinkItems, config); - for (std::vector::iterator i = ifaceLinkItems.begin(), - e = ifaceLinkItems.end(); i != e; ++i) - { - this->AddItem(*i, 0); - this->CheckInterfaceLinkItem(tgt, *i); - } } else { @@ -1576,24 +1566,6 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item, } //---------------------------------------------------------------------------- -void cmComputeLinkInformation::CheckInterfaceLinkItem(cmTarget const* target, - std::string const& item) -{ - if (item.find("::") == item.npos) - { - return; - } - std::ostringstream e; - e << - "INTERFACE library \"" << target->GetName() << "\" has an invalid " - "INTERFACE_LINK_ITEMS entry \"" << item << "\". " - "Entries may not contain \"::\"." - ; - this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(), - target->GetBacktrace()); -} - -//---------------------------------------------------------------------------- bool cmComputeLinkInformation::FinishLinkerSearchDirectories() { // Support broken projects if necessary. diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index e847cf3..8847141 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -147,7 +147,6 @@ private: bool CheckSharedLibNoSOName(std::string const& item); void AddSharedLibNoSOName(std::string const& item); void HandleBadFullItem(std::string const& item, std::string const& file); - void CheckInterfaceLinkItem(cmTarget const* target, std::string const& item); // Framework info. void ComputeFrameworkInfo(); diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index 8ae3fb5..b1203dd 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -92,9 +92,6 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) this->PopulateInterfaceProperty("INTERFACE_COMPILE_FEATURES", te, cmGeneratorExpression::BuildInterface, properties, missingTargets); - this->PopulateInterfaceProperty("INTERFACE_LINK_ITEMS", te, - cmGeneratorExpression::BuildInterface, - properties, missingTargets); this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE", te, properties); const bool newCMP0022Behavior = diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index d137d91..6d639c9 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -125,7 +125,6 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) bool require2_8_12 = false; bool require3_0_0 = false; bool require3_1_0 = false; - bool require3_3_0 = false; bool requiresConfigFiles = false; // Create all the imported targets. for(std::vector::const_iterator @@ -167,10 +166,6 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) te, cmGeneratorExpression::InstallInterface, properties, missingTargets); - this->PopulateInterfaceProperty("INTERFACE_LINK_ITEMS", - te, - cmGeneratorExpression::InstallInterface, - properties, missingTargets); const bool newCMP0022Behavior = te->GetPolicyStatusCMP0022() != cmPolicies::WARN @@ -195,10 +190,6 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) // can consume them. require3_1_0 = true; } - if(te->GetProperty("INTERFACE_LINK_ITEMS")) - { - require3_3_0 = true; - } this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE", te, properties); @@ -207,11 +198,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) this->GenerateInterfaceProperties(te, os, properties); } - if (require3_3_0) - { - this->GenerateRequiredCMakeVersion(os, DEVEL_CMAKE_VERSION(3,3)); - } - else if (require3_1_0) + if (require3_1_0) { this->GenerateRequiredCMakeVersion(os, "3.1.0"); } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 060ec33..f69e9ae 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1762,14 +1762,6 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) << this->Name << "\")\n"; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); } - else if(prop == "INTERFACE_LINK_ITEMS" && - this->GetType() != cmTarget::INTERFACE_LIBRARY) - { - std::ostringstream e; - e << "INTERFACE_LINK_ITEMS property may be set only on " - << "INTERFACE library targets.\n"; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); - } else if (prop == "LINK_LIBRARIES") { this->Internal->LinkImplementationPropertyEntries.clear(); @@ -1857,14 +1849,6 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, << this->Name << "\")\n"; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); } - else if(prop == "INTERFACE_LINK_ITEMS" && - this->GetType() != cmTarget::INTERFACE_LIBRARY) - { - std::ostringstream e; - e << "INTERFACE_LINK_ITEMS property may be set only on " - << "INTERFACE library targets.\n"; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); - } else if (prop == "LINK_LIBRARIES") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); @@ -2516,28 +2500,6 @@ void cmTarget::GetCompileFeatures(std::vector &result, } //---------------------------------------------------------------------------- -void cmTarget::GetInterfaceLinkItems(std::vector &items, - std::string const& config) const -{ - const char *prop = this->GetProperty("INTERFACE_LINK_ITEMS"); - if (!prop) - { - return; - } - cmGeneratorExpression ge; - cmGeneratorExpressionDAGChecker dagChecker( - this->GetName(), - "INTERFACE_LINK_ITEMS", 0, 0); - cmSystemTools::ExpandListArgument(ge.Parse(prop) - ->Evaluate(this->Makefile, - config, - false, - this, - &dagChecker), - items); -} - -//---------------------------------------------------------------------------- void cmTarget::MaybeInvalidatePropertyCache(const std::string& prop) { // Wipe out maps caching information affected by this property. diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 882372b..a032414 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -587,9 +587,6 @@ public: void GetCompileFeatures(std::vector &features, const std::string& config) const; - void GetInterfaceLinkItems(std::vector &items, - std::string const& config) const; - bool IsNullImpliedByLinkLibraries(const std::string &p) const; bool IsLinkInterfaceDependentBoolProperty(const std::string &p, const std::string& config) const; diff --git a/Tests/ExportImport/Export/Interface/CMakeLists.txt b/Tests/ExportImport/Export/Interface/CMakeLists.txt index 2e6fcfc..00a5375 100644 --- a/Tests/ExportImport/Export/Interface/CMakeLists.txt +++ b/Tests/ExportImport/Export/Interface/CMakeLists.txt @@ -1,9 +1,3 @@ -add_library(item STATIC item.cpp) -add_library(item_iface INTERFACE) -set_property(TARGET item_iface PROPERTY INTERFACE_LINK_ITEMS - $> -) -add_dependencies(item_iface item) add_library(headeronly INTERFACE) set_property(TARGET headeronly PROPERTY INTERFACE_INCLUDE_DIRECTORIES @@ -27,7 +21,7 @@ set_property(TARGET sharedlib PROPERTY INTERFACE_INCLUDE_DIRECTORIES set_property(TARGET sharedlib PROPERTY INTERFACE_COMPILE_DEFINITIONS "SHAREDLIB_DEFINE") add_library(sharediface INTERFACE) -target_link_libraries(sharediface INTERFACE sharedlib item_iface) +target_link_libraries(sharediface INTERFACE sharedlib) add_library(use_auto_type INTERFACE) target_compile_features(use_auto_type INTERFACE cxx_auto_type) @@ -46,11 +40,9 @@ install(FILES ) install(TARGETS headeronly sharediface use_auto_type use_c_restrict source_target - item_iface EXPORT expInterface ) install(TARGETS sharedlib - item EXPORT expInterface RUNTIME DESTINATION bin LIBRARY DESTINATION lib NAMELINK_SKIP diff --git a/Tests/ExportImport/Export/Interface/item.cpp b/Tests/ExportImport/Export/Interface/item.cpp deleted file mode 100644 index be612c9..0000000 --- a/Tests/ExportImport/Export/Interface/item.cpp +++ /dev/null @@ -1 +0,0 @@ -int item() { return 0; } diff --git a/Tests/ExportImport/Import/Interface/interfacetest.cpp b/Tests/ExportImport/Import/Interface/interfacetest.cpp index f9d2bd9..786458d 100644 --- a/Tests/ExportImport/Import/Interface/interfacetest.cpp +++ b/Tests/ExportImport/Import/Interface/interfacetest.cpp @@ -13,12 +13,8 @@ #error Expected DEFINE_IFACE_DEFINE #endif -extern int item(); - int main(int,char**) { SharedLibObject slo; - return slo.foo() - + item() - ; + return slo.foo(); } diff --git a/Tests/InterfaceLibrary/CMakeLists.txt b/Tests/InterfaceLibrary/CMakeLists.txt index 6fa0016..ee81419 100644 --- a/Tests/InterfaceLibrary/CMakeLists.txt +++ b/Tests/InterfaceLibrary/CMakeLists.txt @@ -25,22 +25,8 @@ target_sources(iface_objlib INTERFACE $) add_library(intermediate INTERFACE) target_link_libraries(intermediate INTERFACE iface_objlib) -add_library(item STATIC item.cpp) -add_library(item_iface INTERFACE) -set_property(TARGET item_iface PROPERTY INTERFACE_LINK_ITEMS $) -add_dependencies(item_iface item) -add_library(item_fake STATIC item_fake.cpp) - add_executable(InterfaceLibrary definetestexe.cpp) -target_link_libraries(InterfaceLibrary - iface_nodepends - headeriface - subiface - intermediate - - item_iface - item_fake # ensure that 'item' is ordered in place of item_iface - ) +target_link_libraries(InterfaceLibrary iface_nodepends headeriface subiface intermediate) add_subdirectory(libsdir) diff --git a/Tests/InterfaceLibrary/definetestexe.cpp b/Tests/InterfaceLibrary/definetestexe.cpp index e6b7f58..9044076 100644 --- a/Tests/InterfaceLibrary/definetestexe.cpp +++ b/Tests/InterfaceLibrary/definetestexe.cpp @@ -17,9 +17,8 @@ extern int obj(); extern int sub(); -extern int item(); int main(int,char**) { - return obj() + sub() + item(); + return obj() + sub(); } diff --git a/Tests/InterfaceLibrary/item.cpp b/Tests/InterfaceLibrary/item.cpp deleted file mode 100644 index be612c9..0000000 --- a/Tests/InterfaceLibrary/item.cpp +++ /dev/null @@ -1 +0,0 @@ -int item() { return 0; } diff --git a/Tests/InterfaceLibrary/item_fake.cpp b/Tests/InterfaceLibrary/item_fake.cpp deleted file mode 100644 index 3944710..0000000 --- a/Tests/InterfaceLibrary/item_fake.cpp +++ /dev/null @@ -1,2 +0,0 @@ -extern int item_undefined(); -int item() { return item_undefined(); } diff --git a/Tests/RunCMake/interface_library/INTERFACE_LINK_ITEMS-invalid_item-result.txt b/Tests/RunCMake/interface_library/INTERFACE_LINK_ITEMS-invalid_item-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/interface_library/INTERFACE_LINK_ITEMS-invalid_item-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/interface_library/INTERFACE_LINK_ITEMS-invalid_item-stderr.txt b/Tests/RunCMake/interface_library/INTERFACE_LINK_ITEMS-invalid_item-stderr.txt deleted file mode 100644 index d2c0a30..0000000 --- a/Tests/RunCMake/interface_library/INTERFACE_LINK_ITEMS-invalid_item-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -^(CMake Error at INTERFACE_LINK_ITEMS-invalid_item.cmake:[0-9]+ \(add_library\): - INTERFACE library "SomeIFace" has an invalid INTERFACE_LINK_ITEMS entry - "bad::item". Entries may not contain "::". -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -*)+$ diff --git a/Tests/RunCMake/interface_library/INTERFACE_LINK_ITEMS-invalid_item.cmake b/Tests/RunCMake/interface_library/INTERFACE_LINK_ITEMS-invalid_item.cmake deleted file mode 100644 index e81a3c9..0000000 --- a/Tests/RunCMake/interface_library/INTERFACE_LINK_ITEMS-invalid_item.cmake +++ /dev/null @@ -1,6 +0,0 @@ -enable_language(C) - -add_library(SomeIFace INTERFACE) -set_property(TARGET SomeIFace APPEND PROPERTY INTERFACE_LINK_ITEMS bad::item) -add_executable(main main.c) -target_link_libraries(main SomeIFace) diff --git a/Tests/RunCMake/interface_library/INTERFACE_LINK_ITEMS-non-iface-result.txt b/Tests/RunCMake/interface_library/INTERFACE_LINK_ITEMS-non-iface-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/interface_library/INTERFACE_LINK_ITEMS-non-iface-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/interface_library/INTERFACE_LINK_ITEMS-non-iface-stderr.txt b/Tests/RunCMake/interface_library/INTERFACE_LINK_ITEMS-non-iface-stderr.txt deleted file mode 100644 index 9609b94..0000000 --- a/Tests/RunCMake/interface_library/INTERFACE_LINK_ITEMS-non-iface-stderr.txt +++ /dev/null @@ -1,11 +0,0 @@ -^CMake Error at INTERFACE_LINK_ITEMS-non-iface.cmake:[0-9]+ \(set_property\): - INTERFACE_LINK_ITEMS property may be set only on INTERFACE library targets. - -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -+ -CMake Error at INTERFACE_LINK_ITEMS-non-iface.cmake:[0-9]+ \(set_property\): - INTERFACE_LINK_ITEMS property may be set only on INTERFACE library targets. - -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/interface_library/INTERFACE_LINK_ITEMS-non-iface.cmake b/Tests/RunCMake/interface_library/INTERFACE_LINK_ITEMS-non-iface.cmake deleted file mode 100644 index 49b1e53..0000000 --- a/Tests/RunCMake/interface_library/INTERFACE_LINK_ITEMS-non-iface.cmake +++ /dev/null @@ -1,3 +0,0 @@ -add_custom_target(MyTarget) -set_property(TARGET MyTarget PROPERTY INTERFACE_LINK_ITEMS item1) -set_property(TARGET MyTarget APPEND PROPERTY INTERFACE_LINK_ITEMS item2) diff --git a/Tests/RunCMake/interface_library/RunCMakeTest.cmake b/Tests/RunCMake/interface_library/RunCMakeTest.cmake index 2679ceb..201daa7 100644 --- a/Tests/RunCMake/interface_library/RunCMakeTest.cmake +++ b/Tests/RunCMake/interface_library/RunCMakeTest.cmake @@ -8,5 +8,3 @@ run_cmake(invalid_signature) run_cmake(global-interface) run_cmake(genex_link) run_cmake(add_custom_command-TARGET) -run_cmake(INTERFACE_LINK_ITEMS-non-iface) -run_cmake(INTERFACE_LINK_ITEMS-invalid_item) diff --git a/Tests/RunCMake/interface_library/main.c b/Tests/RunCMake/interface_library/main.c deleted file mode 100644 index 78f2de1..0000000 --- a/Tests/RunCMake/interface_library/main.c +++ /dev/null @@ -1 +0,0 @@ -int main(void) { return 0; } ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-buildsystem.7.rst | 5 ++- Help/manual/cmake-properties.7.rst | 1 - Help/prop_tgt/INTERFACE_LINK_ITEMS.rst | 29 --------------- Help/release/dev/interface-link-items.rst | 6 ---- Source/cmComputeLinkInformation.cxx | 28 --------------- Source/cmComputeLinkInformation.h | 1 - Source/cmExportBuildFileGenerator.cxx | 3 -- Source/cmExportInstallFileGenerator.cxx | 15 +------- Source/cmTarget.cxx | 38 -------------------- Source/cmTarget.h | 3 -- Tests/ExportImport/Export/Interface/CMakeLists.txt | 10 +----- Tests/ExportImport/Export/Interface/item.cpp | 1 - .../Import/Interface/interfacetest.cpp | 6 +--- Tests/InterfaceLibrary/CMakeLists.txt | 16 +-------- Tests/InterfaceLibrary/definetestexe.cpp | 3 +- Tests/InterfaceLibrary/item.cpp | 1 - Tests/InterfaceLibrary/item_fake.cpp | 2 -- .../INTERFACE_LINK_ITEMS-invalid_item-result.txt | 1 - .../INTERFACE_LINK_ITEMS-invalid_item-stderr.txt | 6 ---- .../INTERFACE_LINK_ITEMS-invalid_item.cmake | 6 ---- .../INTERFACE_LINK_ITEMS-non-iface-result.txt | 1 - .../INTERFACE_LINK_ITEMS-non-iface-stderr.txt | 11 ------ .../INTERFACE_LINK_ITEMS-non-iface.cmake | 3 -- .../RunCMake/interface_library/RunCMakeTest.cmake | 2 -- Tests/RunCMake/interface_library/main.c | 1 - 25 files changed, 7 insertions(+), 192 deletions(-) delete mode 100644 Help/prop_tgt/INTERFACE_LINK_ITEMS.rst delete mode 100644 Help/release/dev/interface-link-items.rst delete mode 100644 Tests/ExportImport/Export/Interface/item.cpp delete mode 100644 Tests/InterfaceLibrary/item.cpp delete mode 100644 Tests/InterfaceLibrary/item_fake.cpp delete mode 100644 Tests/RunCMake/interface_library/INTERFACE_LINK_ITEMS-invalid_item-result.txt delete mode 100644 Tests/RunCMake/interface_library/INTERFACE_LINK_ITEMS-invalid_item-stderr.txt delete mode 100644 Tests/RunCMake/interface_library/INTERFACE_LINK_ITEMS-invalid_item.cmake delete mode 100644 Tests/RunCMake/interface_library/INTERFACE_LINK_ITEMS-non-iface-result.txt delete mode 100644 Tests/RunCMake/interface_library/INTERFACE_LINK_ITEMS-non-iface-stderr.txt delete mode 100644 Tests/RunCMake/interface_library/INTERFACE_LINK_ITEMS-non-iface.cmake delete mode 100644 Tests/RunCMake/interface_library/main.c hooks/post-receive -- CMake From brad.king at kitware.com Fri May 1 11:55:30 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 1 May 2015 11:55:30 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2401-g99af85f Message-ID: <20150501155530.D355EAFB8C@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, next has been updated via 99af85fc89359e5b2a79e2484d5249b6c3a85af6 (commit) via 8cc064e37d44d239f16e1de8390713be1968a363 (commit) from 603942d29753c0c44a1bee603e2cd524d4de6934 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=99af85fc89359e5b2a79e2484d5249b6c3a85af6 commit 99af85fc89359e5b2a79e2484d5249b6c3a85af6 Merge: 603942d 8cc064e Author: Brad King AuthorDate: Fri May 1 11:55:30 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri May 1 11:55:30 2015 -0400 Merge topic 'refactor-cmDefinitions-Get' into next 8cc064e3 cmDefinitions: Re-introduce recursion that seems faster http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8cc064e37d44d239f16e1de8390713be1968a363 commit 8cc064e37d44d239f16e1de8390713be1968a363 Author: Brad King AuthorDate: Fri May 1 11:37:38 2015 -0400 Commit: Brad King CommitDate: Fri May 1 11:53:44 2015 -0400 cmDefinitions: Re-introduce recursion that seems faster diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index ff530d7..c42d060 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -14,31 +14,37 @@ #include //---------------------------------------------------------------------------- +cmDefinitions::Def cmDefinitions::NoDef; + +//---------------------------------------------------------------------------- const char* cmDefinitions::Get(const std::string& key, - std::list::reverse_iterator rit, + std::list::reverse_iterator rbegin, std::list::reverse_iterator rend) { - std::list::reverse_iterator rbegin = rit; - assert(rit != rend); - MapType::const_iterator i; - Def def; - for ( ; rit != rend; ++rit) + Def const& def = cmDefinitions::GetInternal(key, rbegin, rend); + return def.Exists? def.c_str() : 0; +} + +//---------------------------------------------------------------------------- +cmDefinitions::Def const& cmDefinitions::GetInternal( + const std::string& key, + std::list::reverse_iterator rbegin, + std::list::reverse_iterator rend) +{ + assert(rbegin != rend); + MapType::const_iterator i = rbegin->Map.find(key); + if (i != rbegin->Map.end()) { - i = rit->Map.find(key); - if(i != rit->Map.end()) - { - def = i->second; - break; - } + return i->second; } - - std::list::reverse_iterator last = rit; - // Store the result in intermediate scopes. - for (rit = rbegin; rit != last; ++rit) + std::list::reverse_iterator rit = rbegin; + ++rit; + if (rit == rend) { - i = rit->Map.insert(MapType::value_type(key, def)).first; + return cmDefinitions::NoDef; } - return i->second.Exists ? i->second.c_str() : 0; + Def const& def = cmDefinitions::GetInternal(key, rit, rend); + return rbegin->Map.insert(MapType::value_type(key, def)).first->second; } //---------------------------------------------------------------------------- diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index ae42b8e..b244793 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -32,7 +32,7 @@ public: /** Get the value associated with a key; null if none. Store the result locally if it came from a parent. */ static const char* Get(const std::string& key, - std::list::reverse_iterator rit, + std::list::reverse_iterator rbegin, std::list::reverse_iterator rend); /** Set (or unset if null) a value associated with a key. */ @@ -63,6 +63,7 @@ private: Def(Def const& d): std_string(d), Exists(d.Exists) {} bool Exists; }; + static Def NoDef; // Local definitions, set or unset. #if defined(CMAKE_BUILD_WITH_CMAKE) @@ -72,6 +73,9 @@ private: #endif MapType Map; + static Def const& GetInternal(const std::string& key, + std::list::reverse_iterator rbegin, + std::list::reverse_iterator rend); void MakeClosure(std::set& undefined, std::list::const_reverse_iterator rbegin, std::list::const_reverse_iterator rend); ----------------------------------------------------------------------- Summary of changes: Source/cmDefinitions.cxx | 42 ++++++++++++++++++++++++------------------ Source/cmDefinitions.h | 6 +++++- 2 files changed, 29 insertions(+), 19 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri May 1 13:16:11 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 1 May 2015 13:16:11 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.2-991-gc1081a4 Message-ID: <20150501171611.43FB6AEA29@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 c1081a45d52598e6000341595d138048d5b79fc2 (commit) via faede40b46dee698d091e80b8c4658a70a1eb326 (commit) from 59edc038d59b5898ee1d8baeab6e10d7f897c31e (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c1081a45d52598e6000341595d138048d5b79fc2 commit c1081a45d52598e6000341595d138048d5b79fc2 Merge: 59edc03 faede40 Author: Brad King AuthorDate: Fri May 1 13:16:09 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri May 1 13:16:09 2015 -0400 Merge topic 'cmComputeLinkInformation-minor-cleanup' faede40b cmComputeLinkInformation: Reduce 'if' nesting in AddItem ----------------------------------------------------------------------- Summary of changes: Source/cmComputeLinkInformation.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri May 1 13:16:13 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 1 May 2015 13:16:13 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.2-993-ga588d1e Message-ID: <20150501171613.904EAAEAAE@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 a588d1ee99a2996e0b42b9d7c43e41e3d54b31c8 (commit) via 27343e3b68e0aa0c923f1ad666575ed40efed211 (commit) from c1081a45d52598e6000341595d138048d5b79fc2 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a588d1ee99a2996e0b42b9d7c43e41e3d54b31c8 commit a588d1ee99a2996e0b42b9d7c43e41e3d54b31c8 Merge: c1081a4 27343e3 Author: Brad King AuthorDate: Fri May 1 13:16:12 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri May 1 13:16:12 2015 -0400 Merge topic 'fix-cmState-try_compile-languages' 27343e3b cmGlobalGenerator: Finish storing enabled languages in cmState ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalGenerator.cxx | 4 +++- Source/cmGlobalGenerator.h | 1 - Source/cmState.cxx | 5 +++++ Source/cmState.h | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri May 1 13:16:15 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 1 May 2015 13:16:15 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.2-996-g5d6a7a1 Message-ID: <20150501171615.8D355AEA8B@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 5d6a7a1164188a0c28e3f5a37d0e33e952e0c8e4 (commit) via dd107b30d26b2cdaa5b1766f733428f3c4c7cd42 (commit) via 6064b9072c480845b2ba61291e467b42cb500fe6 (commit) from a588d1ee99a2996e0b42b9d7c43e41e3d54b31c8 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5d6a7a1164188a0c28e3f5a37d0e33e952e0c8e4 commit 5d6a7a1164188a0c28e3f5a37d0e33e952e0c8e4 Merge: a588d1e dd107b3 Author: Brad King AuthorDate: Fri May 1 13:16:14 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri May 1 13:16:14 2015 -0400 Merge topic 'sphinx-options' dd107b30 Add option to pass custom flags to sphinx-build (#15545) 6064b907 bootstrap: Fix SPHINX_{MAN,HTML,QTHELP} cache entry type ----------------------------------------------------------------------- Summary of changes: Utilities/Sphinx/CMakeLists.txt | 4 ++++ bootstrap | 14 +++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri May 1 13:16:17 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 1 May 2015 13:16:17 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.2-999-g5146404 Message-ID: <20150501171617.C8F52AEB75@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 514640411a928c55509343017799df4a10a75d6d (commit) via e8ae46e5e228cc3008e64766e6c8da48b1835545 (commit) via 30a021cc224d420725bd7e88277cc3cca7c67ae4 (commit) from 5d6a7a1164188a0c28e3f5a37d0e33e952e0c8e4 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=514640411a928c55509343017799df4a10a75d6d commit 514640411a928c55509343017799df4a10a75d6d Merge: 5d6a7a1 e8ae46e Author: Brad King AuthorDate: Fri May 1 13:16:16 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri May 1 13:16:16 2015 -0400 Merge topic 'refactor-RaiseScope' e8ae46e5 cmMakefile: Implement RaiseScope without relying on Parent. 30a021cc cmMakefile: Implement RaiseScope in terms of local Get method. ----------------------------------------------------------------------- Summary of changes: Source/cmMakefile.cxx | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri May 1 13:16:39 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 1 May 2015 13:16:39 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2407-g6600cd5 Message-ID: <20150501171639.921ABAEAE5@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, next has been updated via 6600cd57f3a6035169ff132a6ab725b606168657 (commit) via 514640411a928c55509343017799df4a10a75d6d (commit) via 5d6a7a1164188a0c28e3f5a37d0e33e952e0c8e4 (commit) via a588d1ee99a2996e0b42b9d7c43e41e3d54b31c8 (commit) via c1081a45d52598e6000341595d138048d5b79fc2 (commit) via 59edc038d59b5898ee1d8baeab6e10d7f897c31e (commit) from 99af85fc89359e5b2a79e2484d5249b6c3a85af6 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6600cd57f3a6035169ff132a6ab725b606168657 commit 6600cd57f3a6035169ff132a6ab725b606168657 Merge: 99af85f 5146404 Author: Brad King AuthorDate: Fri May 1 13:16:33 2015 -0400 Commit: Brad King CommitDate: Fri May 1 13:16:33 2015 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From steveire at gmail.com Fri May 1 13:48:14 2015 From: steveire at gmail.com (Stephen Kelly) Date: Fri, 1 May 2015 13:48:14 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2409-gf90f8e3 Message-ID: <20150501174814.DE1BAAEDE0@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, next has been updated via f90f8e3476dc20851df186508314a681558ecf04 (commit) via e4a3b3e6230a000e30b9daa94f5141ff56154178 (commit) from 6600cd57f3a6035169ff132a6ab725b606168657 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f90f8e3476dc20851df186508314a681558ecf04 commit f90f8e3476dc20851df186508314a681558ecf04 Merge: 6600cd5 e4a3b3e Author: Stephen Kelly AuthorDate: Fri May 1 13:48:14 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri May 1 13:48:14 2015 -0400 Merge topic 'refactor-cmDefinitions-Get' into next e4a3b3e6 Reorder methods to reduce diff noise. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e4a3b3e6230a000e30b9daa94f5141ff56154178 commit e4a3b3e6230a000e30b9daa94f5141ff56154178 Author: Stephen Kelly AuthorDate: Fri May 1 19:47:27 2015 +0200 Commit: Stephen Kelly CommitDate: Fri May 1 19:47:27 2015 +0200 Reorder methods to reduce diff noise. diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index c42d060..f54bc4d 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -17,15 +17,6 @@ cmDefinitions::Def cmDefinitions::NoDef; //---------------------------------------------------------------------------- -const char* cmDefinitions::Get(const std::string& key, - std::list::reverse_iterator rbegin, - std::list::reverse_iterator rend) -{ - Def const& def = cmDefinitions::GetInternal(key, rbegin, rend); - return def.Exists? def.c_str() : 0; -} - -//---------------------------------------------------------------------------- cmDefinitions::Def const& cmDefinitions::GetInternal( const std::string& key, std::list::reverse_iterator rbegin, @@ -48,6 +39,15 @@ cmDefinitions::Def const& cmDefinitions::GetInternal( } //---------------------------------------------------------------------------- +const char* cmDefinitions::Get(const std::string& key, + std::list::reverse_iterator rbegin, + std::list::reverse_iterator rend) +{ + Def const& def = cmDefinitions::GetInternal(key, rbegin, rend); + return def.Exists? def.c_str() : 0; +} + +//---------------------------------------------------------------------------- void cmDefinitions::Set(const std::string& key, const char* value) { Def def(value); ----------------------------------------------------------------------- Summary of changes: Source/cmDefinitions.cxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) hooks/post-receive -- CMake From steveire at gmail.com Fri May 1 13:48:31 2015 From: steveire at gmail.com (Stephen Kelly) Date: Fri, 1 May 2015 13:48:31 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2415-g6c49c29 Message-ID: <20150501174831.ABBF0AEE03@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, next has been updated via 6c49c290da32c1ff7f66ad84ca723ca0bcfe6217 (commit) via 6c7dad41d9f5e9b6ab6bdd6ddee837aa5509e19e (commit) via a7ce0c7bc03efcfff6bf9fecc52663409262d73d (commit) via 7a5039fa6c0d84d1f4062211afcf0318db77f325 (commit) via 191573f7922aea3c1abdba325f5e65e4ba03d7c8 (commit) via 8b1745a1c5ed992e632bd4865c0f6a34b136041d (commit) from f90f8e3476dc20851df186508314a681558ecf04 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6c49c290da32c1ff7f66ad84ca723ca0bcfe6217 commit 6c49c290da32c1ff7f66ad84ca723ca0bcfe6217 Merge: f90f8e3 6c7dad4 Author: Stephen Kelly AuthorDate: Fri May 1 13:48:30 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri May 1 13:48:30 2015 -0400 Merge topic 'refactor-cmDefinitions-Get' into next 6c7dad41 cmDefinitions: Make Get method static. a7ce0c7b cmDefinitions: Make GetInternal method static. 7a5039fa cmDefinitions: Use static member without this->. 191573f7 cmDefinitions: Remove Parent pointer. 8b1745a1 cmDefinitions: Accept varStack iterators in Get API. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6c7dad41d9f5e9b6ab6bdd6ddee837aa5509e19e commit 6c7dad41d9f5e9b6ab6bdd6ddee837aa5509e19e Author: Stephen Kelly AuthorDate: Fri May 1 01:50:45 2015 +0200 Commit: Stephen Kelly CommitDate: Fri May 1 19:45:05 2015 +0200 cmDefinitions: Make Get method static. diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 77edbd0..b244793 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -31,9 +31,9 @@ class cmDefinitions public: /** Get the value associated with a key; null if none. Store the result locally if it came from a parent. */ - const char* Get(const std::string& key, - std::list::reverse_iterator rbegin, - std::list::reverse_iterator rend); + static const char* Get(const std::string& key, + std::list::reverse_iterator rbegin, + std::list::reverse_iterator rend); /** Set (or unset if null) a value associated with a key. */ void Set(const std::string& key, const char* value); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b16d7e6..4ed2419 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -65,8 +65,8 @@ public: const char* GetDefinition(std::string const& name) { - return this->VarStack.back().Get(name, this->VarStack.rbegin(), - this->VarStack.rend()); + return cmDefinitions::Get(name, this->VarStack.rbegin(), + this->VarStack.rend()); } void SetDefinition(std::string const& name, std::string const& value) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a7ce0c7bc03efcfff6bf9fecc52663409262d73d commit a7ce0c7bc03efcfff6bf9fecc52663409262d73d Author: Stephen Kelly AuthorDate: Fri May 1 01:13:38 2015 +0200 Commit: Stephen Kelly CommitDate: Fri May 1 19:44:35 2015 +0200 cmDefinitions: Make GetInternal method static. For some reason, using recursion here is faster to configure ParaView than using a loop. Probably some compiler optimization is inhibited by using a loop. Co-Author: Brad King diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index a429b6d..f54bc4d 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -22,20 +22,20 @@ cmDefinitions::Def const& cmDefinitions::GetInternal( std::list::reverse_iterator rbegin, std::list::reverse_iterator rend) { - assert(&*rbegin == this); - MapType::const_iterator i = this->Map.find(key); - if(i != this->Map.end()) + assert(rbegin != rend); + MapType::const_iterator i = rbegin->Map.find(key); + if (i != rbegin->Map.end()) { return i->second; } - ++rbegin; - if(rbegin == rend) + std::list::reverse_iterator rit = rbegin; + ++rit; + if (rit == rend) { return cmDefinitions::NoDef; } - // Query the parent scope and store the result locally. - Def def = rbegin->GetInternal(key, rbegin, rend); - return this->Map.insert(MapType::value_type(key, def)).first->second; + Def const& def = cmDefinitions::GetInternal(key, rit, rend); + return rbegin->Map.insert(MapType::value_type(key, def)).first->second; } //---------------------------------------------------------------------------- @@ -43,7 +43,7 @@ const char* cmDefinitions::Get(const std::string& key, std::list::reverse_iterator rbegin, std::list::reverse_iterator rend) { - Def const& def = this->GetInternal(key, rbegin, rend); + Def const& def = cmDefinitions::GetInternal(key, rbegin, rend); return def.Exists? def.c_str() : 0; } diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 33f468b..77edbd0 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -73,11 +73,9 @@ private: #endif MapType Map; - // Internal query and update methods. - Def const& GetInternal(const std::string& key, - std::list::reverse_iterator rbegin, - std::list::reverse_iterator rend); - + static Def const& GetInternal(const std::string& key, + std::list::reverse_iterator rbegin, + std::list::reverse_iterator rend); void MakeClosure(std::set& undefined, std::list::const_reverse_iterator rbegin, std::list::const_reverse_iterator rend); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7a5039fa6c0d84d1f4062211afcf0318db77f325 commit 7a5039fa6c0d84d1f4062211afcf0318db77f325 Author: Stephen Kelly AuthorDate: Fri May 1 19:35:47 2015 +0200 Commit: Stephen Kelly CommitDate: Fri May 1 19:36:03 2015 +0200 cmDefinitions: Use static member without this->. diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 6e26656..a429b6d 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -31,7 +31,7 @@ cmDefinitions::Def const& cmDefinitions::GetInternal( ++rbegin; if(rbegin == rend) { - return this->NoDef; + return cmDefinitions::NoDef; } // Query the parent scope and store the result locally. Def def = rbegin->GetInternal(key, rbegin, rend); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=191573f7922aea3c1abdba325f5e65e4ba03d7c8 commit 191573f7922aea3c1abdba325f5e65e4ba03d7c8 Author: Stephen Kelly AuthorDate: Sun Apr 26 16:19:11 2015 +0200 Commit: Stephen Kelly CommitDate: Fri May 1 19:34:59 2015 +0200 cmDefinitions: Remove Parent pointer. All structural knowledge of the stack of scopes is now external. diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 94d27c2..6e26656 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -17,12 +17,6 @@ cmDefinitions::Def cmDefinitions::NoDef; //---------------------------------------------------------------------------- -cmDefinitions::cmDefinitions(cmDefinitions* parent) - : Up(parent) -{ -} - -//---------------------------------------------------------------------------- cmDefinitions::Def const& cmDefinitions::GetInternal( const std::string& key, std::list::reverse_iterator rbegin, diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 2bcfcb0..33f468b 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -29,12 +29,6 @@ class cmDefinitions { public: - /** Construct with the given parent scope. */ - cmDefinitions(cmDefinitions* parent = 0); - - /** Returns the parent scope, if any. */ - cmDefinitions* GetParent() const { return this->Up; } - /** Get the value associated with a key; null if none. Store the result locally if it came from a parent. */ const char* Get(const std::string& key, @@ -71,9 +65,6 @@ private: }; static Def NoDef; - // Parent scope, if any. - cmDefinitions* Up; - // Local definitions, set or unset. #if defined(CMAKE_BUILD_WITH_CMAKE) typedef cmsys::hash_map MapType; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ae7e564..b16d7e6 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -53,12 +53,7 @@ public: void PushDefinitions() { - cmDefinitions* parent = 0; - if (!this->VarStack.empty()) - { - parent = &this->VarStack.back(); - } - this->VarStack.push_back(cmDefinitions(parent)); + this->VarStack.push_back(cmDefinitions()); } void InitializeDefinitions(cmMakefile* parent) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8b1745a1c5ed992e632bd4865c0f6a34b136041d commit 8b1745a1c5ed992e632bd4865c0f6a34b136041d Author: Stephen Kelly AuthorDate: Thu Apr 30 00:19:55 2015 +0200 Commit: Stephen Kelly CommitDate: Fri May 1 19:34:59 2015 +0200 cmDefinitions: Accept varStack iterators in Get API. diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 61328be..94d27c2 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmDefinitions.h" +#include + //---------------------------------------------------------------------------- cmDefinitions::Def cmDefinitions::NoDef; @@ -21,28 +23,33 @@ cmDefinitions::cmDefinitions(cmDefinitions* parent) } //---------------------------------------------------------------------------- -cmDefinitions::Def const& -cmDefinitions::GetInternal(const std::string& key) +cmDefinitions::Def const& cmDefinitions::GetInternal( + const std::string& key, + std::list::reverse_iterator rbegin, + std::list::reverse_iterator rend) { + assert(&*rbegin == this); MapType::const_iterator i = this->Map.find(key); if(i != this->Map.end()) { return i->second; } - cmDefinitions* up = this->Up; - if(!up) + ++rbegin; + if(rbegin == rend) { return this->NoDef; } // Query the parent scope and store the result locally. - Def def = up->GetInternal(key); + Def def = rbegin->GetInternal(key, rbegin, rend); return this->Map.insert(MapType::value_type(key, def)).first->second; } //---------------------------------------------------------------------------- -const char* cmDefinitions::Get(const std::string& key) +const char* cmDefinitions::Get(const std::string& key, + std::list::reverse_iterator rbegin, + std::list::reverse_iterator rend) { - Def const& def = this->GetInternal(key); + Def const& def = this->GetInternal(key, rbegin, rend); return def.Exists? def.c_str() : 0; } diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 4c7f11f..2bcfcb0 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -37,7 +37,9 @@ public: /** Get the value associated with a key; null if none. Store the result locally if it came from a parent. */ - const char* Get(const std::string& key); + const char* Get(const std::string& key, + std::list::reverse_iterator rbegin, + std::list::reverse_iterator rend); /** Set (or unset if null) a value associated with a key. */ void Set(const std::string& key, const char* value); @@ -81,7 +83,9 @@ private: MapType Map; // Internal query and update methods. - Def const& GetInternal(const std::string& key); + Def const& GetInternal(const std::string& key, + std::list::reverse_iterator rbegin, + std::list::reverse_iterator rend); void MakeClosure(std::set& undefined, std::list::const_reverse_iterator rbegin, diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 5686b1b..ae7e564 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -70,7 +70,8 @@ public: const char* GetDefinition(std::string const& name) { - return this->VarStack.back().Get(name); + return this->VarStack.back().Get(name, this->VarStack.rbegin(), + this->VarStack.rend()); } void SetDefinition(std::string const& name, std::string const& value) ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Sat May 2 00:01:08 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 2 May 2015 00:01:08 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.2-1000-g22a707e Message-ID: <20150502040108.19E2DAFB57@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 22a707e861adb1c771d2c12aacdbaf1b8d3b86ec (commit) from 514640411a928c55509343017799df4a10a75d6d (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=22a707e861adb1c771d2c12aacdbaf1b8d3b86ec commit 22a707e861adb1c771d2c12aacdbaf1b8d3b86ec Author: Kitware Robot AuthorDate: Sat May 2 00:01:06 2015 -0400 Commit: Kitware Robot CommitDate: Sat May 2 00:01:06 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 66017ba..e2b4f1e 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 2) -set(CMake_VERSION_PATCH 20150501) +set(CMake_VERSION_PATCH 20150502) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From domen.vrankar at gmail.com Sat May 2 16:17:49 2015 From: domen.vrankar at gmail.com (Domen Vrankar) Date: Sat, 2 May 2015 16:17:49 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2418-g656579f Message-ID: <20150502201749.87044AE567@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, next has been updated via 656579f48975716f16aff00772be4d2ef96a9741 (commit) via 04f4284837abbcb346ae619dff1b2da3975ea875 (commit) via 22a707e861adb1c771d2c12aacdbaf1b8d3b86ec (commit) from 6c49c290da32c1ff7f66ad84ca723ca0bcfe6217 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=656579f48975716f16aff00772be4d2ef96a9741 commit 656579f48975716f16aff00772be4d2ef96a9741 Merge: 6c49c29 04f4284 Author: Domen Vrankar AuthorDate: Sat May 2 16:17:48 2015 -0400 Commit: CMake Topic Stage CommitDate: Sat May 2 16:17:48 2015 -0400 Merge topic 'cpack-deb-component-auto-discovery' into next 04f42848 CPack/DEB component dependency auto-discovery 22a707e8 CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=04f4284837abbcb346ae619dff1b2da3975ea875 commit 04f4284837abbcb346ae619dff1b2da3975ea875 Author: Raffi Enficiaud AuthorDate: Sat May 2 22:14:57 2015 +0200 Commit: Domen Vrankar CommitDate: Sat May 2 22:14:57 2015 +0200 CPack/DEB component dependency auto-discovery Dependency auto-discovery can now be set per component diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 24452a6..69bb302 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -103,16 +103,23 @@ # characters such as <>. # # .. variable:: CPACK_DEBIAN_PACKAGE_SHLIBDEPS -# -# * Mandatory : NO -# * Default : OFF +# CPACK_DEBIAN__PACKAGE_SHLIBDEPS # # May be set to ON in order to use dpkg-shlibdeps to generate # better package dependency list. -# You may need set CMAKE_INSTALL_RPATH toi appropriate value -# if you use this feature, because if you don't dpkg-shlibdeps -# may fail to find your own shared libs. -# See http://www.cmake.org/Wiki/CMake_RPATH_handling. +# +# * Mandatory : NO +# * Default : +# +# - :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS` if set or +# - OFF +# +# .. note:: +# +# 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 http://www.cmake.org/Wiki/CMake_RPATH_handling. # # .. variable:: CPACK_DEBIAN_PACKAGE_DEBUG # @@ -245,6 +252,21 @@ function(cpack_deb_prepare_package_vars) set(CPACK_DEBIAN_FAKEROOT_EXECUTABLE ${FAKEROOT_EXECUTABLE}) endif() + # per component automatic discover: some of the component might not have + # binaries. + if(CPACK_DEB_PACKAGE_COMPONENT) + string(TOUPPER "${CPACK_DEB_PACKAGE_COMPONENT}" _local_component_name) + set(_component_shlibdeps_var "CPACK_DEBIAN_${_local_component_name}_PACKAGE_SHLIBDEPS") + + # if set, overrides the global configuration + if(DEFINED ${_component_shlibdeps_var}) + set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS "${${_component_shlibdeps_var}}") + if(CPACK_DEBIAN_PACKAGE_DEBUG) + message("CPackDeb Debug: component '${CPACK_DEB_PACKAGE_COMPONENT}' dpkg-shlibdeps set to ${CPACK_DEBIAN_PACKAGE_SHLIBDEPS}") + endif() + endif() + endif() + if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS) # dpkg-shlibdeps is a Debian utility for generating dependency list find_program(SHLIBDEPS_EXECUTABLE dpkg-shlibdeps) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 07545ae..35326a5 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1010,7 +1010,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(DEB_TEST_NAMES "CPackComponentsDEB") set(DEB_CONFIGURATIONS_TO_TEST "components-lintian-dpkgdeb-checks" "components-description1" - "components-description2") + "components-description2" + "components-shlibdeps1") set(CPackGen "DEB") set(CPackRun_CPackGen "-DCPackGen=${CPackGen}") diff --git a/Tests/CPackComponentsDEB/MyLibCPackConfig-components-shlibdeps1.cmake.in b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-shlibdeps1.cmake.in new file mode 100644 index 0000000..cfe6df5 --- /dev/null +++ b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-shlibdeps1.cmake.in @@ -0,0 +1,24 @@ +# +# Activate component packaging +# + +if(CPACK_GENERATOR MATCHES "DEB") + set(CPACK_DEB_COMPONENT_INSTALL "ON") +endif() + +# +# Choose grouping way +# +#set(CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE) +#set(CPACK_COMPONENTS_GROUPING) +set(CPACK_COMPONENTS_IGNORE_GROUPS 1) +#set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1) + +# we set shlibdeps to on +set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) +# except for the component "headers" that do not contain any binary. +# the packaging will just fail if this does not work +set(CPACK_DEBIAN_HEADERS_PACKAGE_SHLIBDEPS OFF) + +# Also libraries contains only a static library. +set(CPACK_DEBIAN_LIBRARIES_PACKAGE_SHLIBDEPS OFF) diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-shlibdeps1.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-shlibdeps1.cmake new file mode 100644 index 0000000..4aff0eb --- /dev/null +++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-shlibdeps1.cmake @@ -0,0 +1,74 @@ +if(NOT CPackComponentsDEB_SOURCE_DIR) + message(FATAL_ERROR "CPackComponentsDEB_SOURCE_DIR not set") +endif() + +include(${CPackComponentsDEB_SOURCE_DIR}/RunCPackVerifyResult.cmake) + + + +# requirements + +# debian now produces lower case names +set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/MyLib-*.deb") +set(expected_count 3) + + +set(actual_output) +run_cpack(actual_output + CPack_output + CPack_error + EXPECTED_FILE_MASK "${expected_file_mask}" + CONFIG_ARGS ${config_args} + CONFIG_VERBOSE ${config_verbose}) + +message(STATUS "expected_count='${expected_count}'") +message(STATUS "expected_file_mask='${expected_file_mask}'") +message(STATUS "actual_output_files='${actual_output}'") + +if(NOT actual_output) + message(FATAL_ERROR "error: expected_files do not exist: CPackComponentsDEB test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error}") +endif() + +list(LENGTH actual_output actual_count) +message(STATUS "actual_count='${actual_count}'") +if(NOT actual_count EQUAL expected_count) + message(FATAL_ERROR "error: expected_count=${expected_count} does not match actual_count=${actual_count}: CPackComponents test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error})") +endif() + + +# dpkg-deb checks for the summary of the packages +if(DPKGDEB_EXECUTABLE) + set(dpkgdeb_output_errors_all) + foreach(_f IN LISTS actual_output) + + # extracts the metadata from the package + run_dpkgdeb(dpkg_output + FILENAME ${_f} + ) + + dpkgdeb_return_specific_metaentry(dpkg_package_name + DPKGDEB_OUTPUT "${dpkg_output}" + METAENTRY "Package:") + + message(STATUS "package='${dpkg_package_name}'") + + if("${dpkg_package_name}" STREQUAL "mylib-applications") + # pass + elseif("${dpkg_package_name}" STREQUAL "mylib-headers") + # pass + elseif("${dpkg_package_name}" STREQUAL "mylib-libraries") + # pass + else() + set(dpkgdeb_output_errors_all ${dpkgdeb_output_errors_all} + "dpkg-deb: ${_f}: component name not found: ${dpkg_package_name}\n") + endif() + + endforeach() + + + if(NOT "${dpkgdeb_output_errors_all}" STREQUAL "") + message(FATAL_ERROR "dpkg-deb checks failed:\n${dpkgdeb_output_errors_all}") + endif() +else() + message("dpkg-deb executable not found - skipping dpkg-deb test") +endif() ----------------------------------------------------------------------- Summary of changes: Modules/CPackDeb.cmake | 36 ++++++++++++++++---- Source/CMakeVersion.cmake | 2 +- Tests/CMakeLists.txt | 3 +- ...MyLibCPackConfig-components-shlibdeps1.cmake.in | 24 +++++++++++++ ...nCPackVerifyResult-components-shlibdeps1.cmake} | 35 +++++++------------ 5 files changed, 68 insertions(+), 32 deletions(-) create mode 100644 Tests/CPackComponentsDEB/MyLibCPackConfig-components-shlibdeps1.cmake.in copy Tests/CPackComponentsDEB/{RunCPackVerifyResult-components-description2.cmake => RunCPackVerifyResult-components-shlibdeps1.cmake} (58%) hooks/post-receive -- CMake From kwrobot at kitware.com Sun May 3 00:01:10 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 3 May 2015 00:01:10 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.2-1001-g6cd6d50 Message-ID: <20150503040110.C1E37AFB80@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 6cd6d50871ce28d0c72336a6aca01814487df5e1 (commit) from 22a707e861adb1c771d2c12aacdbaf1b8d3b86ec (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6cd6d50871ce28d0c72336a6aca01814487df5e1 commit 6cd6d50871ce28d0c72336a6aca01814487df5e1 Author: Kitware Robot AuthorDate: Sun May 3 00:01:08 2015 -0400 Commit: Kitware Robot CommitDate: Sun May 3 00:01:08 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e2b4f1e..001e670 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 2) -set(CMake_VERSION_PATCH 20150502) +set(CMake_VERSION_PATCH 20150503) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From steveire at gmail.com Sun May 3 04:45:58 2015 From: steveire at gmail.com (Stephen Kelly) Date: Sun, 3 May 2015 04:45:58 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2443-g2950a55 Message-ID: <20150503084558.A98A2AE3D8@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, next has been updated via 2950a5542fc22c205e3b7aafe4ad28a1961c2611 (commit) via 0e53f739be3692a60e8a47d589d3979c50d7c904 (commit) via eb861a41fdcfe9f518a949c44c982c4bb6d3b81e (commit) via 8988d8ee8bf936074e6d94cac643dfd704e86fbd (commit) via 2334325421903c977c1e8842223629c02269145f (commit) via 275a0404be55bfdda06346b72d9d30348b5c15bd (commit) via ab89036c52258f75637adf3f4650a5fbf38f8033 (commit) via dec28e70dd37e89b6db1daa082ff9be601c3b36b (commit) via 82a80e5d9e6e4004e6786b38bba550382dfd3f63 (commit) via 68bc1d79aa57bcd83c8b722a0d6ed45ada711aa9 (commit) via 92b31f19c1aac58d4e0a33d37f9b3bc3918d7099 (commit) via a140aa6907b22dd17dbfc66102bbb6a089e4cf9a (commit) via 8de7d84c36b2519867dca9ca48d1c97512e9a07a (commit) via b46cb9fe32aee6dde2cefda5c1ec77a8aad6f29a (commit) via 9273eadea728a0b63fe6acbcc634f5e71083dfaa (commit) via 8c58c7b825f1e1463f2246b8c273ddc9bd680603 (commit) via 51662a178929cd6802008b282840077b1f87e61c (commit) via 76e5bd042ced3dab01e5d2c88a2199f09ca806ae (commit) via ecd17c8fb7fcc2baba6d6a76467dd3bf1048412a (commit) via 953d1b00af3059b24c4dadf8c4717cb0d2260e36 (commit) via 2c10494ab3194e792ad69825cbb55d6644270dd0 (commit) via 48f9fd39ad1637815cd89c2a2f2a17e43c0d7f78 (commit) via fd0aa7434b010c496e09d8013b192b7df453979a (commit) via a3291fe8ecb95c891a34c1844557cbfa2bb89e2d (commit) via a6fb6db49d9fc5558fd79296fbc233f90a3063e4 (commit) from 656579f48975716f16aff00772be4d2ef96a9741 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2950a5542fc22c205e3b7aafe4ad28a1961c2611 commit 2950a5542fc22c205e3b7aafe4ad28a1961c2611 Merge: 656579f 0e53f73 Author: Stephen Kelly AuthorDate: Sun May 3 04:45:55 2015 -0400 Commit: CMake Topic Stage CommitDate: Sun May 3 04:45:55 2015 -0400 Merge topic 'refactor-cmPolicies' into next 0e53f739 cmPolicies: Implement PolicyMap in terms of bitset. eb861a41 cmPolicies: Implement abstraction for PolicyMap. 8988d8ee Port to static cmPolicies API. 23343254 cmPolicies: Make all API static. 275a0404 cmPolicies: Remove unused DefinePolicy method. ab89036c cmPolicies: Remove unused cmPolicy class. dec28e70 cmPolicies: Loop over all policies using enum constants. 82a80e5d cmPolicies: Trivialize GetPolicyStatus method. 68bc1d79 cmPolicies: Use more-direct ID access. 92b31f19 cmPolicies: Implement in terms of public API. a140aa69 cmPolicies: Make private method file-static. 8de7d84c cmPolicies: Implement short description access with XMacros. b46cb9fe cmPolicies: Implement version check with XMacro. 9273eade cmPolicies: Implement id to version with XMacro. 8c58c7b8 cmPolicies: Implement id to string conversion with XMacro. 51662a17 cmPolicies: Introduce XMacro table for policy data. ... http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0e53f739be3692a60e8a47d589d3979c50d7c904 commit 0e53f739be3692a60e8a47d589d3979c50d7c904 Author: Stephen Kelly AuthorDate: Sun May 3 10:12:34 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 10:40:54 2015 +0200 cmPolicies: Implement PolicyMap in terms of bitset. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index f593149..73f6e0e 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -331,21 +331,42 @@ cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id) cmPolicies::PolicyStatus cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) const { - return this->find(id)->second; + PolicyStatus status = cmPolicies::WARN; + + if (this->OLD[id]) + { + status = cmPolicies::OLD; + } + else if (this->NEW[id]) + { + status = cmPolicies::NEW; + } + else if (this->REQUIRED_ALWAYS[id]) + { + status = cmPolicies::REQUIRED_ALWAYS; + } + else if (this->REQUIRED_IF_USED[id]) + { + status = cmPolicies::REQUIRED_IF_USED; + } + return status; } void cmPolicies::PolicyMap::Set(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status) { - (*this)[id] = status; + this->OLD[id] = (status == cmPolicies::OLD); + this->NEW[id] = (status == cmPolicies::NEW); + this->REQUIRED_ALWAYS[id] = (status == cmPolicies::REQUIRED_ALWAYS); + this->REQUIRED_IF_USED[id] = (status == cmPolicies::REQUIRED_IF_USED); } bool cmPolicies::PolicyMap::IsDefined(cmPolicies::PolicyID id) const { - return this->find(id) != this->end(); + return this->OLD[id] || this->NEW[id]; } bool cmPolicies::PolicyMap::IsEmpty() const { - return this->empty(); + return this->OLD.none() && this->NEW.none(); } diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 46b725a..6bc92fb 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -14,6 +14,8 @@ #include "cmCustomCommand.h" +#include + class cmMakefile; class cmPolicy; @@ -268,12 +270,18 @@ public: static std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id); /** Represent a set of policy values. */ - struct PolicyMap : private std::map + struct PolicyMap { PolicyStatus Get(PolicyID id) const; void Set(PolicyID id, PolicyStatus status); bool IsDefined(PolicyID id) const; bool IsEmpty() const; + + private: + std::bitset OLD; + std::bitset NEW; + std::bitset REQUIRED_IF_USED; + std::bitset REQUIRED_ALWAYS; }; }; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=eb861a41fdcfe9f518a949c44c982c4bb6d3b81e commit eb861a41fdcfe9f518a949c44c982c4bb6d3b81e Author: Stephen Kelly AuthorDate: Sun May 3 10:12:28 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 10:40:45 2015 +0200 cmPolicies: Implement abstraction for PolicyMap. Hide the detail that it is a std::map. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 29d891c..3befbdd 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -569,7 +569,7 @@ cmMakefile::IncludeScope::~IncludeScope() // one we pushed above. If the entry is empty, then the included // script did not set any policies that might affect the includer so // we do not need to enforce the policy. - if(this->CheckCMP0011 && this->Makefile->PolicyStack.back().empty()) + if(this->CheckCMP0011 && this->Makefile->PolicyStack.back().IsEmpty()) { this->CheckCMP0011 = false; } @@ -4772,10 +4772,9 @@ cmMakefile::GetPolicyStatusInternal(cmPolicies::PolicyID id) const for(PolicyStackType::const_reverse_iterator psi = this->PolicyStack.rbegin(); psi != this->PolicyStack.rend(); ++psi) { - PolicyStackEntry::const_iterator pse = psi->find(id); - if(pse != psi->end()) + if(psi->IsDefined(id)) { - return pse->second; + return psi->Get(id); } } @@ -4840,7 +4839,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, for(PolicyStackType::reverse_iterator psi = this->PolicyStack.rbegin(); previous_was_weak && psi != this->PolicyStack.rend(); ++psi) { - (*psi)[id] = status; + psi->Set(id, status); previous_was_weak = psi->Weak; } @@ -4960,7 +4959,7 @@ void cmMakefile::RecordPolicies(cmPolicies::PolicyMap& pm) for(PolicyID pid = cmPolicies::CMP0000; pid != cmPolicies::CMPCOUNT; pid = PolicyID(pid+1)) { - pm[pid] = this->GetPolicyStatus(pid); + pm.Set(pid, this->GetPolicyStatus(pid)); } } diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index b0dfa36..f593149 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -327,3 +327,25 @@ cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id) << "Run cmake --help-policy " << pid << " for more information."; return e.str(); } + +cmPolicies::PolicyStatus +cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) const +{ + return this->find(id)->second; +} + +void cmPolicies::PolicyMap::Set(cmPolicies::PolicyID id, + cmPolicies::PolicyStatus status) +{ + (*this)[id] = status; +} + +bool cmPolicies::PolicyMap::IsDefined(cmPolicies::PolicyID id) const +{ + return this->find(id) != this->end(); +} + +bool cmPolicies::PolicyMap::IsEmpty() const +{ + return this->empty(); +} diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index fee7dd9..46b725a 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -268,7 +268,13 @@ public: static std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id); /** Represent a set of policy values. */ - typedef std::map PolicyMap; + struct PolicyMap : private std::map + { + PolicyStatus Get(PolicyID id) const; + void Set(PolicyID id, PolicyStatus status); + bool IsDefined(PolicyID id) const; + bool IsEmpty() const; + }; }; #endif http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8988d8ee8bf936074e6d94cac643dfd704e86fbd commit 8988d8ee8bf936074e6d94cac643dfd704e86fbd Author: Stephen Kelly AuthorDate: Sun May 3 10:12:10 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 10:40:37 2015 +0200 Port to static cmPolicies API. diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index ba9e663..fe516ea 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -380,8 +380,7 @@ bool cmAddCustomCommandCommand switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0050)) { case cmPolicies::WARN: - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0050)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0050) << "\n"; break; case cmPolicies::OLD: issueMessage = false; diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index c246aee..42bd71c 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -194,8 +194,7 @@ bool cmAddCustomTargetCommand switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0037)) { case cmPolicies::WARN: - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0037)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0037) << "\n"; issueMessage = true; case cmPolicies::OLD: break; diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx index 74dc8eb..d15fc1e 100644 --- a/Source/cmAddExecutableCommand.cxx +++ b/Source/cmAddExecutableCommand.cxx @@ -84,8 +84,7 @@ bool cmAddExecutableCommand switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0037)) { case cmPolicies::WARN: - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0037)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0037) << "\n"; issueMessage = true; case cmPolicies::OLD: break; diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index 74e1a93..a844cf1 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -222,8 +222,7 @@ bool cmAddLibraryCommand case cmPolicies::WARN: if(type != cmTarget::INTERFACE_LIBRARY) { - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0037)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0037) << "\n"; issueMessage = true; } case cmPolicies::OLD: diff --git a/Source/cmBreakCommand.cxx b/Source/cmBreakCommand.cxx index 34245b3..fc0c3f5 100644 --- a/Source/cmBreakCommand.cxx +++ b/Source/cmBreakCommand.cxx @@ -23,8 +23,7 @@ bool cmBreakCommand::InitialPass(std::vector const &args, switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0055)) { case cmPolicies::WARN: - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0055)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0055) << "\n"; break; case cmPolicies::OLD: issueMessage = false; @@ -58,8 +57,7 @@ bool cmBreakCommand::InitialPass(std::vector const &args, switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0055)) { case cmPolicies::WARN: - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0055)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0055) << "\n"; break; case cmPolicies::OLD: issueMessage = false; diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx index 9662fbf..3c878bf 100644 --- a/Source/cmCMakePolicyCommand.cxx +++ b/Source/cmCMakePolicyCommand.cxx @@ -111,7 +111,7 @@ bool cmCMakePolicyCommand::HandleGetMode(std::vector const& args) // Lookup the policy number. cmPolicies::PolicyID pid; - if(!this->Makefile->GetPolicies()->GetPolicyID(id.c_str(), pid)) + if(!cmPolicies::GetPolicyID(id.c_str(), pid)) { std::ostringstream e; e << "GET given policy \"" << id << "\" which is not known to this " @@ -141,7 +141,7 @@ bool cmCMakePolicyCommand::HandleGetMode(std::vector const& args) // The policy is required to be set before anything needs it. { std::ostringstream e; - e << this->Makefile->GetPolicies()->GetRequiredPolicyError(pid) + e << cmPolicies::GetRequiredPolicyError(pid) << "\n" << "The call to cmake_policy(GET " << id << " ...) at which this " << "error appears requests the policy, and this version of CMake " diff --git a/Source/cmCommand.h b/Source/cmCommand.h index 6689243..0548c6b 100644 --- a/Source/cmCommand.h +++ b/Source/cmCommand.h @@ -180,7 +180,7 @@ public: { case cmPolicies::WARN: this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, - this->Makefile->GetPolicies()->GetPolicyWarning(pol)); + cmPolicies::GetPolicyWarning(pol)); case cmPolicies::OLD: return false; case cmPolicies::REQUIRED_IF_USED: diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 6ecf0dc..3c90ae2 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -556,8 +556,7 @@ bool cmComputeLinkInformation::Compute() if (!this->CMP0060WarnItems.empty()) { std::ostringstream w; - w << (this->Makefile->GetCMakeInstance()->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0060)) << "\n" + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0060) << "\n" "Some library files are in directories implicitly searched by " "the linker when invoked for " << this->LinkLanguage << ":\n" " " << cmJoin(this->CMP0060WarnItems, "\n ") << "\n" @@ -1534,8 +1533,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item, { this->CMakeInstance->GetState()->SetGlobalProperty(wid, "1"); std::ostringstream w; - w << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0008)) << "\n" + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0008) << "\n" << "Target \"" << this->Target->GetName() << "\" links to item\n" << " " << item << "\n" << "which is a full-path but not a valid library file name."; @@ -1553,8 +1551,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item, case cmPolicies::REQUIRED_ALWAYS: { std::ostringstream e; - e << (this->Makefile->GetPolicies()-> - GetRequiredPolicyError(cmPolicies::CMP0008)) << "\n" + e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0008) << "\n" << "Target \"" << this->Target->GetName() << "\" links to item\n" << " " << item << "\n" << "which is a full-path but not a valid library file name."; @@ -1600,8 +1597,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories() case cmPolicies::REQUIRED_ALWAYS: { std::ostringstream e; - e << (this->Makefile->GetPolicies()-> - GetRequiredPolicyError(cmPolicies::CMP0003)) << "\n"; + e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0003) << "\n"; this->PrintLinkPolicyDiagnosis(e); this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(), this->Target->GetBacktrace()); diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 11056cd..c7be221 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -361,15 +361,13 @@ void cmComputeTargetDepends::AddTargetDepend( if(!dependee && !linking && (depender->GetType() != cmTarget::GLOBAL_TARGET)) { - cmMakefile *makefile = depender->GetMakefile(); cmake::MessageType messageType = cmake::AUTHOR_WARNING; bool issueMessage = false; std::ostringstream e; switch(depender->GetPolicyStatusCMP0046()) { case cmPolicies::WARN: - e << (makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0046)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0046) << "\n"; issueMessage = true; case cmPolicies::OLD: break; diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index 1f9b9d4..73aface 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -118,8 +118,7 @@ const char* cmConditionEvaluator::GetDefinitionIfUnquoted( if(!hasBeenReported) { std::ostringstream e; - e << (this->Makefile.GetPolicies()->GetPolicyWarning( - cmPolicies::CMP0054)) << "\n"; + e << (cmPolicies::GetPolicyWarning(cmPolicies::CMP0054)) << "\n"; e << "Quoted variables like \"" << argument.GetValue() << "\" will no longer be dereferenced " "when the policy is set to NEW. " @@ -168,8 +167,7 @@ bool cmConditionEvaluator::IsKeyword(std::string const& keyword, if(!hasBeenReported) { std::ostringstream e; - e << (this->Makefile.GetPolicies()->GetPolicyWarning( - cmPolicies::CMP0054)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0054) << "\n"; e << "Quoted keywords like \"" << argument.GetValue() << "\" will no longer be interpreted as keywords " "when the policy is set to NEW. " @@ -280,10 +278,9 @@ bool cmConditionEvaluator::GetBooleanValueWithAutoDereference( { case cmPolicies::WARN: { - cmPolicies* policies = this->Makefile.GetPolicies(); errorString = "An argument named \"" + newArg.GetValue() + "\" appears in a conditional statement. " - + policies->GetPolicyWarning(cmPolicies::CMP0012); + + cmPolicies::GetPolicyWarning(cmPolicies::CMP0012); status = cmake::AUTHOR_WARNING; } case cmPolicies::OLD: @@ -291,10 +288,9 @@ bool cmConditionEvaluator::GetBooleanValueWithAutoDereference( case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: { - cmPolicies* policies = this->Makefile.GetPolicies(); errorString = "An argument named \"" + newArg.GetValue() + "\" appears in a conditional statement. " - + policies->GetRequiredPolicyError(cmPolicies::CMP0012); + + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0012); status = cmake::FATAL_ERROR; } case cmPolicies::NEW: @@ -493,8 +489,7 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList &newArgs, { cmPolicies::PolicyID pid; this->HandlePredicate( - this->Makefile.GetPolicies()->GetPolicyID( - argP1->c_str(), pid), + cmPolicies::GetPolicyID(argP1->c_str(), pid), reducible, arg, newArgs, argP1, argP2); } // does a target exist @@ -702,8 +697,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList &newArgs, else if(this->Policy57Status == cmPolicies::WARN) { std::ostringstream e; - e << (this->Makefile.GetPolicies()->GetPolicyWarning( - cmPolicies::CMP0057)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0057) << "\n"; e << "IN_LIST will be interpreted as an operator " "when the policy is set to NEW. " "Since the policy is not set the OLD behavior will be used."; diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 56a884c..1109aca 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -334,8 +334,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) "CMAKE_POLICY_WARNING_CMP0056")) { std::ostringstream w; - w << (this->Makefile->GetCMakeInstance()->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0056)) << "\n" + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0056) << "\n" "For compatibility with older versions of CMake, try_compile " "is not honoring caller link flags (e.g. CMAKE_EXE_LINKER_FLAGS) " "in the test project." @@ -349,8 +348,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) case cmPolicies::REQUIRED_ALWAYS: this->Makefile->IssueMessage( cmake::FATAL_ERROR, - this->Makefile->GetCMakeInstance()->GetPolicies() - ->GetRequiredPolicyError(cmPolicies::CMP0056) + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0056) ); case cmPolicies::NEW: // NEW behavior is to pass linker flags. diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index b4fad98..a51fb2a 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -257,8 +257,7 @@ static bool checkInterfaceDirs(const std::string &prepro, { case cmPolicies::WARN: messageType = cmake::WARNING; - e << target->GetMakefile()->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0041) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0041) << "\n"; break; case cmPolicies::OLD: continue; @@ -306,8 +305,7 @@ static bool checkInterfaceDirs(const std::string &prepro, case cmPolicies::WARN: { std::ostringstream s; - s << target->GetMakefile()->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0052) << "\n"; + s << cmPolicies::GetPolicyWarning(cmPolicies::CMP0052) << "\n"; s << "Directory:\n \"" << *li << "\"\nin " "INTERFACE_INCLUDE_DIRECTORIES of target \"" << target->GetName() << "\" is a subdirectory of the install " diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 14f397c..f695393 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -1056,16 +1056,14 @@ bool cmFileCommand::HandleGlobCommand(std::vector const& args, if(g.GetFollowedSymlinkCount() != 0) { this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, - this->Makefile->GetPolicies()-> - GetPolicyWarning(cmPolicies::CMP0009)); + cmPolicies::GetPolicyWarning(cmPolicies::CMP0009)); } break; case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: this->SetError("policy CMP0009 error"); this->Makefile->IssueMessage(cmake::FATAL_ERROR, - this->Makefile->GetPolicies()-> - GetRequiredPolicyError(cmPolicies::CMP0009)); + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0009)); return false; } } diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 2654851..7cfef02 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -395,8 +395,7 @@ struct CompilerIdNode : public cmGeneratorExpressionNode case cmPolicies::WARN: { std::ostringstream e; - e << context->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0044); + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0044); context->Makefile->GetCMakeInstance() ->IssueMessage(cmake::AUTHOR_WARNING, e.str(), context->Backtrace); @@ -1495,8 +1494,7 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode { case cmPolicies::WARN: mf->IssueMessage(cmake::AUTHOR_WARNING, - mf->GetPolicies()-> - GetPolicyWarning(policyForString(policy))); + cmPolicies::GetPolicyWarning(policyForString(policy))); case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::OLD: diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx index eed19f4..315e851 100644 --- a/Source/cmGetTargetPropertyCommand.cxx +++ b/Source/cmGetTargetPropertyCommand.cxx @@ -56,8 +56,7 @@ bool cmGetTargetPropertyCommand { case cmPolicies::WARN: issueMessage = true; - e << this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0045) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0045) << "\n"; case cmPolicies::OLD: break; case cmPolicies::REQUIRED_IF_USED: diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index cf3a037..1c90537 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -826,7 +826,6 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, if(strcmp(compilerId, "AppleClang") == 0) { - cmPolicies* policies = this->CMakeInstance->GetPolicies(); switch(mf->GetPolicyStatus(cmPolicies::CMP0025)) { case cmPolicies::WARN: @@ -834,7 +833,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0025")) { std::ostringstream w; - w << policies->GetPolicyWarning(cmPolicies::CMP0025) << "\n" + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0025) << "\n" "Converting " << lang << " compiler id \"AppleClang\" to \"Clang\" for compatibility." ; @@ -848,7 +847,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, case cmPolicies::REQUIRED_ALWAYS: mf->IssueMessage( cmake::FATAL_ERROR, - policies->GetRequiredPolicyError(cmPolicies::CMP0025) + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0025) ); case cmPolicies::NEW: // NEW behavior is to keep AppleClang. @@ -858,7 +857,6 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, if(strcmp(compilerId, "QCC") == 0) { - cmPolicies* policies = this->CMakeInstance->GetPolicies(); switch(mf->GetPolicyStatus(cmPolicies::CMP0047)) { case cmPolicies::WARN: @@ -866,7 +864,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0047")) { std::ostringstream w; - w << policies->GetPolicyWarning(cmPolicies::CMP0047) << "\n" + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0047) << "\n" "Converting " << lang << " compiler id \"QCC\" to \"GNU\" for compatibility." ; @@ -888,7 +886,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, case cmPolicies::REQUIRED_ALWAYS: mf->IssueMessage( cmake::FATAL_ERROR, - policies->GetRequiredPolicyError(cmPolicies::CMP0047) + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0047) ); case cmPolicies::NEW: // NEW behavior is to keep QCC. @@ -1327,9 +1325,7 @@ void cmGlobalGenerator::Generate() if(!this->CMP0042WarnTargets.empty()) { std::ostringstream w; - w << - (this->GetCMakeInstance()->GetPolicies()-> - GetPolicyWarning(cmPolicies::CMP0042)) << "\n"; + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0042) << "\n"; w << "MACOSX_RPATH is not specified for" " the following targets:\n"; for(std::set::iterator diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 074c4d1..678d60b 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1103,9 +1103,7 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) if (!warnExplicitDepends.empty()) { std::ostringstream w; - w << - (this->GetCMakeInstance()->GetPolicies()-> - GetPolicyWarning(cmPolicies::CMP0058)) << "\n" + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0058) << "\n" "This project specifies custom command DEPENDS on files " "in the build tree that are not specified as the OUTPUT or " "BYPRODUCTS of any add_custom_command or add_custom_target:\n" diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index 71dabaf..ce04d3e 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -104,8 +104,7 @@ bool cmIncludeCommand switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0024)) { case cmPolicies::WARN: - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0024)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0024) << "\n"; modal = "should"; case cmPolicies::OLD: break; diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index fac9641..f1e0eb8 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -1404,7 +1404,7 @@ bool cmInstallCommand::CheckCMP0006(bool& failure) { this->Makefile->IssueMessage( cmake::AUTHOR_WARNING, - this->Makefile->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0006) + cmPolicies::GetPolicyWarning(cmPolicies::CMP0006) ); } case cmPolicies::OLD: @@ -1418,8 +1418,7 @@ bool cmInstallCommand::CheckCMP0006(bool& failure) failure = true; this->Makefile->IssueMessage( cmake::FATAL_ERROR, - this->Makefile->GetPolicies() - ->GetRequiredPolicyError(cmPolicies::CMP0006) + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0006) ); break; } diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx index a21f517..f486bf7 100644 --- a/Source/cmLinkDirectoriesCommand.cxx +++ b/Source/cmLinkDirectoriesCommand.cxx @@ -40,18 +40,17 @@ void cmLinkDirectoriesCommand::AddLinkDir(std::string const& dir) e << "This command specifies the relative path\n" << " " << unixPath << "\n" << "as a link directory.\n"; - cmPolicies* policies = this->Makefile->GetPolicies(); switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0015)) { case cmPolicies::WARN: - e << policies->GetPolicyWarning(cmPolicies::CMP0015); + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0015); this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str()); case cmPolicies::OLD: // OLD behavior does not convert break; case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: - e << policies->GetRequiredPolicyError(cmPolicies::CMP0015); + e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0015); this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); case cmPolicies::NEW: // NEW behavior converts diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index d18269d..f96b4a8 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -121,8 +121,7 @@ bool cmListCommand::GetList(std::vector& list, // empty values list.clear(); cmSystemTools::ExpandListArgument(listString, list); - std::string warn = this->Makefile->GetPolicies()-> - GetPolicyWarning(cmPolicies::CMP0007); + std::string warn = cmPolicies::GetPolicyWarning(cmPolicies::CMP0007); warn += " List has value = ["; warn += listString; warn += "]."; @@ -143,8 +142,7 @@ bool cmListCommand::GetList(std::vector& list, case cmPolicies::REQUIRED_ALWAYS: this->Makefile->IssueMessage( cmake::FATAL_ERROR, - this->Makefile->GetPolicies() - ->GetRequiredPolicyError(cmPolicies::CMP0007) + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0007) ); return false; } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 6b705e8..88c88cd 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -209,7 +209,7 @@ void cmLocalGenerator::ReadInputFile() << "to work accidentally and is being allowed for " << "compatibility." << "\n" - << mf->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0014); + << cmPolicies::GetPolicyWarning(cmPolicies::CMP0014); mf->IssueMessage(cmake::AUTHOR_WARNING, e.str()); case cmPolicies::OLD: // OLD behavior does not warn. @@ -217,7 +217,7 @@ void cmLocalGenerator::ReadInputFile() case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: e << "\n" - << mf->GetPolicies()->GetRequiredPolicyError(cmPolicies::CMP0014); + << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0014); case cmPolicies::NEW: // NEW behavior prints the error. mf->IssueMessage(cmake::FATAL_ERROR, e.str()); @@ -2458,8 +2458,7 @@ bool cmLocalGenerator::GetShouldUseOldFlags(bool shared, "shared libraries and will use the " << flagsVar << " variable " "instead. This may cause errors if the original content of " << flagsVar << " was removed.\n" - << this->Makefile->GetPolicies()->GetPolicyWarning( - cmPolicies::CMP0018); + << cmPolicies::GetPolicyWarning(cmPolicies::CMP0018); this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str()); // fall through to OLD behaviour diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 5686b1b..29d891c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -591,14 +591,13 @@ void cmMakefile::IncludeScope::EnforceCMP0011() { // We check the setting of this policy again because the included // script might actually set this policy for its includer. - cmPolicies* policies = this->Makefile->GetPolicies(); switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0011)) { case cmPolicies::WARN: // Warn because the user did not set this policy. { std::ostringstream w; - w << policies->GetPolicyWarning(cmPolicies::CMP0011) << "\n" + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0011) << "\n" << "The included script\n " << this->File << "\n" << "affects policy settings. " << "CMake is implying the NO_POLICY_SCOPE option for compatibility, " @@ -610,7 +609,7 @@ void cmMakefile::IncludeScope::EnforceCMP0011() case cmPolicies::REQUIRED_ALWAYS: { std::ostringstream e; - e << policies->GetRequiredPolicyError(cmPolicies::CMP0011) << "\n" + e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0011) << "\n" << "The included script\n " << this->File << "\n" << "affects policy settings, so it requires this policy to be set."; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); @@ -879,8 +878,7 @@ cmMakefile::AddCustomCommandToTarget(const std::string& target, switch(this->GetPolicyStatus(cmPolicies::CMP0040)) { case cmPolicies::WARN: - e << (this->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0040)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0040) << "\n"; issueMessage = true; case cmPolicies::OLD: break; @@ -1438,7 +1436,7 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove) case cmPolicies::WARN: this->IssueMessage( cmake::AUTHOR_WARNING, - this->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0005) + cmPolicies::GetPolicyWarning(cmPolicies::CMP0005) ); case cmPolicies::OLD: // OLD behavior is to not escape the value. We should not @@ -1448,7 +1446,7 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove) case cmPolicies::REQUIRED_ALWAYS: this->IssueMessage( cmake::FATAL_ERROR, - this->GetPolicies()->GetRequiredPolicyError(cmPolicies::CMP0005) + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0005) ); return false; case cmPolicies::NEW: @@ -2335,7 +2333,7 @@ void cmMakefile::ExpandVariablesCMP0019() if(!w.str().empty()) { std::ostringstream m; - m << this->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0019) + m << cmPolicies::GetPolicyWarning(cmPolicies::CMP0019) << "\n" << "The following variable evaluations were encountered:\n" << w.str(); @@ -2593,7 +2591,7 @@ const char *cmMakefile::ExpandVariablesInString(std::string& source, else if(compareResults && (newResult != source || newError != mtype)) { std::string msg = - this->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0053); + cmPolicies::GetPolicyWarning(cmPolicies::CMP0053); msg += "\n"; std::string msg_input = original; @@ -2745,9 +2743,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringOld( switch(this->GetPolicyStatus(cmPolicies::CMP0010)) { case cmPolicies::WARN: - error << "\n" - << (this->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0010)); + error << "\n" << cmPolicies::GetPolicyWarning(cmPolicies::CMP0010); case cmPolicies::OLD: // OLD behavior is to just warn and continue. mtype = cmake::AUTHOR_WARNING; @@ -2755,8 +2751,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringOld( case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: error << "\n" - << (this->GetPolicies() - ->GetRequiredPolicyError(cmPolicies::CMP0010)); + << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0010); case cmPolicies::NEW: // NEW behavior is to report the error. break; @@ -3820,7 +3815,7 @@ std::string cmMakefile::GetModulesFile(const char* filename) const << moduleInCMakeModulePath << " (found via CMAKE_MODULE_PATH) which shadows " << moduleInCMakeRoot << ". This may cause errors later on .\n" - << this->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0017); + << cmPolicies::GetPolicyWarning(cmPolicies::CMP0017); this->IssueMessage(cmake::AUTHOR_WARNING, e.str()); // break; // fall through to OLD behaviour @@ -4188,7 +4183,7 @@ const char *cmMakefile::GetProperty(const std::string& prop, switch(this->GetPolicyStatus(cmPolicies::CMP0059)) { case cmPolicies::WARN: - this->IssueMessage(cmake::AUTHOR_WARNING, this->GetPolicies()-> + this->IssueMessage(cmake::AUTHOR_WARNING, cmPolicies:: GetPolicyWarning(cmPolicies::CMP0059)); case cmPolicies::OLD: output += this->DefineFlagsOrig; @@ -4558,14 +4553,14 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg, switch (this->GetPolicyStatus(cmPolicies::CMP0002)) { case cmPolicies::WARN: - this->IssueMessage(cmake::AUTHOR_WARNING, this->GetPolicies()-> + this->IssueMessage(cmake::AUTHOR_WARNING, cmPolicies:: GetPolicyWarning(cmPolicies::CMP0002)); case cmPolicies::OLD: return true; case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: this->IssueMessage(cmake::FATAL_ERROR, - this->GetPolicies()->GetRequiredPolicyError(cmPolicies::CMP0002) + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0002) ); return true; case cmPolicies::NEW: @@ -4637,7 +4632,7 @@ bool cmMakefile::EnforceUniqueDir(const std::string& srcPath, { case cmPolicies::WARN: // Print the warning. - e << this->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0013) + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0013) << "\n" << "The binary directory\n" << " " << binPath << "\n" @@ -4654,7 +4649,7 @@ bool cmMakefile::EnforceUniqueDir(const std::string& srcPath, return true; case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: - e << this->GetPolicies()->GetRequiredPolicyError(cmPolicies::CMP0013) + e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0013) << "\n"; case cmPolicies::NEW: // NEW behavior prints the error. @@ -4757,7 +4752,7 @@ cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id) const { return cur; } - cmPolicies::PolicyStatus def = this->GetPolicies()->GetPolicyStatus(id); + cmPolicies::PolicyStatus def = cmPolicies::GetPolicyStatus(id); if(def == cmPolicies::REQUIRED_ALWAYS || def == cmPolicies::REQUIRED_IF_USED) { @@ -4792,7 +4787,7 @@ cmMakefile::GetPolicyStatusInternal(cmPolicies::PolicyID id) const } // The policy is not set. Use the default for this CMake version. - return this->GetPolicies()->GetPolicyStatus(id); + return cmPolicies::GetPolicyStatus(id); } //---------------------------------------------------------------------------- @@ -4815,7 +4810,7 @@ bool cmMakefile::SetPolicy(const char *id, cmPolicies::PolicyStatus status) { cmPolicies::PolicyID pid; - if (!this->GetPolicies()->GetPolicyID(id, /* out */ pid)) + if (!cmPolicies::GetPolicyID(id, /* out */ pid)) { std::ostringstream e; e << "Policy \"" << id << "\" is not known to this version of CMake."; @@ -4831,11 +4826,11 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, { // A REQUIRED_ALWAYS policy may be set only to NEW. if(status != cmPolicies::NEW && - this->GetPolicies()->GetPolicyStatus(id) == + cmPolicies::GetPolicyStatus(id) == cmPolicies::REQUIRED_ALWAYS) { std::string msg = - this->GetPolicies()->GetRequiredAlwaysPolicyError(id); + cmPolicies::GetRequiredAlwaysPolicyError(id); this->IssueMessage(cmake::FATAL_ERROR, msg); return false; } @@ -4937,18 +4932,7 @@ void cmMakefile::PopPolicyBarrier(bool reportError) //---------------------------------------------------------------------------- bool cmMakefile::SetPolicyVersion(const char *version) { - return this->GetCMakeInstance()->GetPolicies()-> - ApplyPolicyVersion(this,version); -} - -//---------------------------------------------------------------------------- -cmPolicies *cmMakefile::GetPolicies() const -{ - if (!this->GetCMakeInstance()) - { - return 0; - } - return this->GetCMakeInstance()->GetPolicies(); + return cmPolicies::ApplyPolicyVersion(this,version); } //---------------------------------------------------------------------------- diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index afacc1b..a9029a0 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -216,8 +216,7 @@ bool cmProjectCommand if(!vw.empty()) { std::ostringstream w; - w << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0048)) + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0048) << "\nThe following variable(s) would be set to empty:" << vw; this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index f69e9ae..8d1367e 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -974,8 +974,7 @@ std::string cmTarget::ProcessSourceItemCMP0049(const std::string& s) switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0049)) { case cmPolicies::WARN: - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0049)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0049) << "\n"; break; case cmPolicies::OLD: noMessage = true; @@ -2008,8 +2007,7 @@ static void processIncludeDirectories(cmTarget const* tgt, switch(tgt->GetPolicyStatusCMP0027()) { case cmPolicies::WARN: - e << (mf->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0027)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0027) << "\n"; case cmPolicies::OLD: messageType = cmake::AUTHOR_WARNING; break; @@ -2049,8 +2047,7 @@ static void processIncludeDirectories(cmTarget const* tgt, { case cmPolicies::WARN: { - e << (mf->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0021)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0021) << "\n"; messageType = cmake::AUTHOR_WARNING; } break; @@ -2398,8 +2395,7 @@ void cmTarget::GetCompileDefinitions(std::vector &list, case cmPolicies::WARN: { std::ostringstream e; - e << this->Makefile->GetCMakeInstance()->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0043); + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0043); this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str()); } @@ -2874,8 +2870,7 @@ bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const switch (context->GetPolicyStatus(cmPolicies::CMP0026)) { case cmPolicies::WARN: - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0026)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0026) << "\n"; modal = "should"; case cmPolicies::OLD: break; @@ -3138,8 +3133,7 @@ const char *cmTarget::GetProperty(const std::string& prop, switch(context->GetPolicyStatus(cmPolicies::CMP0051)) { case cmPolicies::WARN: - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0051)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0051) << "\n"; noMessage = false; case cmPolicies::OLD: break; @@ -3236,8 +3230,7 @@ public: { case cmPolicies::WARN: { - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0028)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0028) << "\n"; messageType = cmake::AUTHOR_WARNING; } break; @@ -5993,9 +5986,7 @@ cmTargetInternals::ComputeLinkInterfaceLibraries( && strcmp(newExplicitLibraries, explicitLibraries) != 0) { std::ostringstream w; - w << - (thisTarget->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0022)) << "\n" + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0022) << "\n" "Target \"" << thisTarget->GetName() << "\" has an " "INTERFACE_LINK_LIBRARIES property which differs from its " << linkIfaceProp << " properties." @@ -6064,9 +6055,7 @@ cmTargetInternals::ComputeLinkInterfaceLibraries( { newLibraries = "(empty)"; } std::ostringstream w; - w << - (thisTarget->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0022)) << "\n" + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0022) << "\n" "Target \"" << thisTarget->GetName() << "\" has an " "INTERFACE_LINK_LIBRARIES property. " "This should be preferred as the source of the link interface " @@ -6323,8 +6312,7 @@ cmTargetInternals::ComputeLinkImplementationLibraries( { case cmPolicies::WARN: { - e << (thisTarget->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0038)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0038) << "\n"; messageType = cmake::AUTHOR_WARNING; } break; @@ -6461,8 +6449,7 @@ std::string cmTarget::CheckCMP0004(std::string const& item) const case cmPolicies::WARN: { std::ostringstream w; - w << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0004)) << "\n" + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0004) << "\n" << "Target \"" << this->GetName() << "\" links to item \"" << item << "\" which has leading or trailing whitespace."; cm->IssueMessage(cmake::AUTHOR_WARNING, w.str(), @@ -6483,8 +6470,7 @@ std::string cmTarget::CheckCMP0004(std::string const& item) const case cmPolicies::REQUIRED_ALWAYS: { std::ostringstream e; - e << (this->Makefile->GetPolicies() - ->GetRequiredPolicyError(cmPolicies::CMP0004)) << "\n" + e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0004) << "\n" << "Target \"" << this->GetName() << "\" links to item \"" << item << "\" which has leading or trailing whitespace."; cm->IssueMessage(cmake::FATAL_ERROR, e.str(), this->GetBacktrace()); diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 9be7d46..df37d66 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -58,16 +58,14 @@ bool cmTargetLinkLibrariesCommand e << "\n" << "CMake does not support this but it used to work accidentally " << "and is being allowed for compatibility." - << "\n" << this->Makefile->GetPolicies()-> - GetPolicyWarning(cmPolicies::CMP0016); + << "\n" << cmPolicies::GetPolicyWarning(cmPolicies::CMP0016); break; case cmPolicies::OLD: // OLD behavior does not warn. t = cmake::MESSAGE; break; case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: - e << "\n" << this->Makefile->GetPolicies()-> - GetRequiredPolicyError(cmPolicies::CMP0016); + e << "\n" << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0016); break; case cmPolicies::NEW: // NEW behavior prints the error. break; @@ -108,8 +106,7 @@ bool cmTargetLinkLibrariesCommand switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0039)) { case cmPolicies::WARN: - e << this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0039) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0039) << "\n"; modal = "should"; case cmPolicies::OLD: break; @@ -379,8 +376,7 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0023)) { case cmPolicies::WARN: - e << this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0023) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0023) << "\n"; modal = "should"; case cmPolicies::OLD: break; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2334325421903c977c1e8842223629c02269145f commit 2334325421903c977c1e8842223629c02269145f Author: Stephen Kelly AuthorDate: Sun May 3 10:11:05 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 10:40:34 2015 +0200 cmPolicies: Make all API static. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 73e561c..b0dfa36 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -228,7 +228,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, { if (isPolicyNewerThan(pid, majorVer, minorVer, patchVer)) { - if(this->GetPolicyStatus(pid) == cmPolicies::REQUIRED_ALWAYS) + if(cmPolicies::GetPolicyStatus(pid) == cmPolicies::REQUIRED_ALWAYS) { ancientPolicies.push_back(pid); } diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 1e2849d..fee7dd9 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -250,22 +250,22 @@ public: }; ///! convert a string policy ID into a number - bool GetPolicyID(const char *id, /* out */ cmPolicies::PolicyID &pid); + static bool GetPolicyID(const char *id, /* out */ cmPolicies::PolicyID &pid); ///! Get the default status for a policy - cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id); + static cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id); ///! Set a policy level for this listfile - bool ApplyPolicyVersion(cmMakefile *mf, const char *version); + static bool ApplyPolicyVersion(cmMakefile *mf, const char *version); ///! return a warning string for a given policy - std::string GetPolicyWarning(cmPolicies::PolicyID id); + static std::string GetPolicyWarning(cmPolicies::PolicyID id); ///! return an error string for when a required policy is unspecified - std::string GetRequiredPolicyError(cmPolicies::PolicyID id); + static std::string GetRequiredPolicyError(cmPolicies::PolicyID id); ///! return an error string for when a required policy is unspecified - std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id); + static std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id); /** Represent a set of policy values. */ typedef std::map PolicyMap; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=275a0404be55bfdda06346b72d9d30348b5c15bd commit 275a0404be55bfdda06346b72d9d30348b5c15bd Author: Stephen Kelly AuthorDate: Sun May 3 10:11:01 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 10:39:08 2015 +0200 cmPolicies: Remove unused DefinePolicy method. Policies are no longer defined at runtime. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 2376ec5..73e561c 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -106,16 +106,6 @@ const char* idToShortDescription(cmPolicies::PolicyID id) return 0; } -void cmPolicies::DefinePolicy(cmPolicies::PolicyID, - const char *, - const char *, - unsigned int, - unsigned int, - unsigned int, - cmPolicies::PolicyStatus) -{ -} - //---------------------------------------------------------------------------- static void DiagnoseAncientPolicies( std::vector const& ancient, diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 50ffe81..1e2849d 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -255,15 +255,6 @@ public: ///! Get the default status for a policy cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id); - ///! Define a Policy for CMake - void DefinePolicy(cmPolicies::PolicyID id, - const char *stringID, - const char *shortDescription, - unsigned int majorVersionIntroduced, - unsigned int minorVersionIntroduced, - unsigned int patchVersionIntroduced, - cmPolicies::PolicyStatus status); - ///! Set a policy level for this listfile bool ApplyPolicyVersion(cmMakefile *mf, const char *version); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ab89036c52258f75637adf3f4650a5fbf38f8033 commit ab89036c52258f75637adf3f4650a5fbf38f8033 Author: Stephen Kelly AuthorDate: Sun May 3 10:10:42 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 10:38:35 2015 +0200 cmPolicies: Remove unused cmPolicy class. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 3ded35c..2376ec5 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -106,337 +106,7 @@ const char* idToShortDescription(cmPolicies::PolicyID id) return 0; } -class cmPolicy -{ -public: - cmPolicy(cmPolicies::PolicyID iD) - { - this->ID = iD; - } - - cmPolicies::PolicyID ID; -}; - -cmPolicies::cmPolicies() -{ - // define all the policies - this->DefinePolicy( - CMP0000, "CMP0000", - "A minimum required CMake version must be specified.", - 2,6,0, cmPolicies::WARN - ); - - this->DefinePolicy( - CMP0001, "CMP0001", - "CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.", - 2,6,0, cmPolicies::WARN - ); - - this->DefinePolicy( - CMP0002, "CMP0002", - "Logical target names must be globally unique.", - 2,6,0, cmPolicies::WARN - ); - - this->DefinePolicy( - CMP0003, "CMP0003", - "Libraries linked via full path no longer produce linker search paths.", - 2,6,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0004, "CMP0004", - "Libraries linked may not have leading or trailing whitespace.", - 2,6,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0005, "CMP0005", - "Preprocessor definition values are now escaped automatically.", - 2,6,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0006, "CMP0006", - "Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.", - 2,6,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0007, "CMP0007", - "list command no longer ignores empty elements.", - 2,6,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0008, "CMP0008", - "Libraries linked by full-path must have a valid library file name.", - 2,6,1, cmPolicies::WARN); - - this->DefinePolicy( - CMP0009, "CMP0009", - "FILE GLOB_RECURSE calls should not follow symlinks by default.", - 2,6,2, cmPolicies::WARN); - - this->DefinePolicy( - CMP0010, "CMP0010", - "Bad variable reference syntax is an error.", - 2,6,3, cmPolicies::WARN); - - this->DefinePolicy( - CMP0011, "CMP0011", - "Included scripts do automatic cmake_policy PUSH and POP.", - 2,6,3, cmPolicies::WARN); - - this->DefinePolicy( - CMP0012, "CMP0012", - "if() recognizes numbers and boolean constants.", - 2,8,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0013, "CMP0013", - "Duplicate binary directories are not allowed.", - 2,8,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0014, "CMP0014", - "Input directories must have CMakeLists.txt.", - 2,8,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0015, "CMP0015", - "link_directories() treats paths relative to the source dir.", - 2,8,1, cmPolicies::WARN); - - this->DefinePolicy( - CMP0016, "CMP0016", - "target_link_libraries() reports error if its only argument " - "is not a target.", - 2,8,3, cmPolicies::WARN); - - this->DefinePolicy( - CMP0017, "CMP0017", - "Prefer files from the CMake module directory when including from there.", - 2,8,4, cmPolicies::WARN); - - this->DefinePolicy( - CMP0018, "CMP0018", - "Ignore CMAKE_SHARED_LIBRARY__FLAGS variable.", - 2,8,9, cmPolicies::WARN); - - this->DefinePolicy( - CMP0019, "CMP0019", - "Do not re-expand variables in include and link information.", - 2,8,11, cmPolicies::WARN); - - this->DefinePolicy( - CMP0020, "CMP0020", - "Automatically link Qt executables to qtmain target on Windows.", - 2,8,11, cmPolicies::WARN); - - this->DefinePolicy( - CMP0021, "CMP0021", - "Fatal error on relative paths in INCLUDE_DIRECTORIES target property.", - 2,8,12, cmPolicies::WARN); - - this->DefinePolicy( - CMP0022, "CMP0022", - "INTERFACE_LINK_LIBRARIES defines the link interface.", - 2,8,12, cmPolicies::WARN); - - this->DefinePolicy( - CMP0023, "CMP0023", - "Plain and keyword target_link_libraries signatures cannot be mixed.", - 2,8,12, cmPolicies::WARN); - - this->DefinePolicy( - CMP0024, "CMP0024", - "Disallow include export result.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0025, "CMP0025", - "Compiler id for Apple Clang is now AppleClang.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0026, "CMP0026", - "Disallow use of the LOCATION target property.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0027, "CMP0027", - "Conditionally linked imported targets with missing include directories.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0028, "CMP0028", - "Double colon in target name means ALIAS or IMPORTED target.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0029, "CMP0029", - "The subdir_depends command should not be called.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0030, "CMP0030", - "The use_mangled_mesa command should not be called.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0031, "CMP0031", - "The load_command command should not be called.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0032, "CMP0032", - "The output_required_files command should not be called.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0033, "CMP0033", - "The export_library_dependencies command should not be called.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0034, "CMP0034", - "The utility_source command should not be called.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0035, "CMP0035", - "The variable_requires command should not be called.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0036, "CMP0036", - "The build_name command should not be called.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0037, "CMP0037", - "Target names should not be reserved and should match a validity pattern.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0038, "CMP0038", - "Targets may not link directly to themselves.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0039, "CMP0039", - "Utility targets may not have link dependencies.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0040, "CMP0040", - "The target in the TARGET signature of add_custom_command() must exist.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0041, "CMP0041", - "Error on relative include with generator expression.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0042, "CMP0042", - "MACOSX_RPATH is enabled by default.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0043, "CMP0043", - "Ignore COMPILE_DEFINITIONS_ properties.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0044, "CMP0044", - "Case sensitive _COMPILER_ID generator expressions.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0045, "CMP0045", - "Error on non-existent target in get_target_property.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0046, "CMP0046", - "Error on non-existent dependency in add_dependencies.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0047, "CMP0047", - "Use QCC compiler id for the qcc drivers on QNX.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0048, "CMP0048", - "project() command manages VERSION variables.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0049, "CMP0049", - "Do not expand variables in target source entries.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0050, "CMP0050", - "Disallow add_custom_command SOURCE signatures.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0051, "CMP0051", - "List TARGET_OBJECTS in SOURCES target property.", - 3,1,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0052, "CMP0052", - "Reject source and build dirs in installed " - "INTERFACE_INCLUDE_DIRECTORIES.", - 3,1,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0053, "CMP0053", - "Simplify variable reference and escape sequence evaluation.", - 3,1,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0054, "CMP0054", - "Only interpret if() arguments as variables or keywords when unquoted.", - 3,1,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0055, "CMP0055", - "Strict checking for break() command.", - 3,2,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0056, "CMP0056", - "Honor link flags in try_compile() source-file signature.", - 3,2,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0058, "CMP0058", - "Ninja requires custom command byproducts to be explicit.", - 3,3,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0059, "CMP0059", - "Do no treat DEFINITIONS as a built-in directory property.", - 3,3,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0060, "CMP0060", - "Link libraries by full path even in implicit directories.", - 3,3,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0057, "CMP0057", - "Support new IN_LIST if() operator.", - 3,3,0, cmPolicies::WARN); -} - -cmPolicies::~cmPolicies() -{ - cmDeleteAll(this->Policies); -} - -void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, +void cmPolicies::DefinePolicy(cmPolicies::PolicyID, const char *, const char *, unsigned int, @@ -444,7 +114,6 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, unsigned int, cmPolicies::PolicyStatus) { - this->Policies[iD] = new cmPolicy(iD); } //---------------------------------------------------------------------------- diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 2b96939..50ffe81 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -223,9 +223,6 @@ class cmPolicy; class cmPolicies { public: - cmPolicies(); - ~cmPolicies(); - /// Status of a policy enum PolicyStatus { OLD, ///< Use old behavior @@ -281,10 +278,6 @@ public: /** Represent a set of policy values. */ typedef std::map PolicyMap; - - private: - // might have to make these internal for VS6 not sure yet - std::map Policies; }; #endif http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dec28e70dd37e89b6db1daa082ff9be601c3b36b commit dec28e70dd37e89b6db1daa082ff9be601c3b36b Author: Stephen Kelly AuthorDate: Sun May 3 10:10:42 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 10:36:36 2015 +0200 cmPolicies: Loop over all policies using enum constants. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 7a11d79..3ded35c 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -564,20 +564,20 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, // now loop over all the policies and set them as appropriate std::vector ancientPolicies; - for(std::map::iterator i - = this->Policies.begin(); i != this->Policies.end(); ++i) + for(PolicyID pid = cmPolicies::CMP0000; + pid != cmPolicies::CMPCOUNT; pid = PolicyID(pid+1)) { - if (isPolicyNewerThan(i->first, majorVer, minorVer, patchVer)) + if (isPolicyNewerThan(pid, majorVer, minorVer, patchVer)) { - if(this->GetPolicyStatus(i->first) == cmPolicies::REQUIRED_ALWAYS) + if(this->GetPolicyStatus(pid) == cmPolicies::REQUIRED_ALWAYS) { - ancientPolicies.push_back(i->first); + ancientPolicies.push_back(pid); } else { cmPolicies::PolicyStatus status = cmPolicies::WARN; - if(!GetPolicyDefault(mf, idToString(i->first), &status) || - !mf->SetPolicy(i->first, status)) + if(!GetPolicyDefault(mf, idToString(pid), &status) || + !mf->SetPolicy(pid, status)) { return false; } @@ -585,7 +585,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, } else { - if (!mf->SetPolicy(i->first, cmPolicies::NEW)) + if (!mf->SetPolicy(pid, cmPolicies::NEW)) { return false; } http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=82a80e5d9e6e4004e6786b38bba550382dfd3f63 commit 82a80e5d9e6e4004e6786b38bba550382dfd3f63 Author: Stephen Kelly AuthorDate: Sun May 3 10:10:38 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 10:36:33 2015 +0200 cmPolicies: Trivialize GetPolicyStatus method. It would be possible to implement this with an XMacro and switch statement, but every codepath currently would still return WARN. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index f341fdd..7a11d79 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -109,15 +109,12 @@ const char* idToShortDescription(cmPolicies::PolicyID id) class cmPolicy { public: - cmPolicy(cmPolicies::PolicyID iD, - cmPolicies::PolicyStatus status) + cmPolicy(cmPolicies::PolicyID iD) { this->ID = iD; - this->Status = status; } cmPolicies::PolicyID ID; - cmPolicies::PolicyStatus Status; }; cmPolicies::cmPolicies() @@ -445,10 +442,9 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, unsigned int, unsigned int, unsigned int, - cmPolicies::PolicyStatus status) + cmPolicies::PolicyStatus) { - this->Policies[iD] = new cmPolicy(iD, - status); + this->Policies[iD] = new cmPolicy(iD); } //---------------------------------------------------------------------------- @@ -649,18 +645,9 @@ std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id) ///! Get the default status for a policy cmPolicies::PolicyStatus -cmPolicies::GetPolicyStatus(cmPolicies::PolicyID id) +cmPolicies::GetPolicyStatus(cmPolicies::PolicyID) { - // if the policy is not know then what? - std::map::iterator pos = - this->Policies.find(id); - if (pos == this->Policies.end()) - { - // TODO is this right? - return cmPolicies::WARN; - } - - return pos->second->Status; + return cmPolicies::WARN; } //---------------------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=68bc1d79aa57bcd83c8b722a0d6ed45ada711aa9 commit 68bc1d79aa57bcd83c8b722a0d6ed45ada711aa9 Author: Stephen Kelly AuthorDate: Sun May 3 10:27:36 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 10:36:30 2015 +0200 cmPolicies: Use more-direct ID access. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index a2aa104..f341fdd 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -581,7 +581,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, { cmPolicies::PolicyStatus status = cmPolicies::WARN; if(!GetPolicyDefault(mf, idToString(i->first), &status) || - !mf->SetPolicy(i->second->ID, status)) + !mf->SetPolicy(i->first, status)) { return false; } @@ -589,7 +589,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, } else { - if (!mf->SetPolicy(i->second->ID, cmPolicies::NEW)) + if (!mf->SetPolicy(i->first, cmPolicies::NEW)) { return false; } http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=92b31f19c1aac58d4e0a33d37f9b3bc3918d7099 commit 92b31f19c1aac58d4e0a33d37f9b3bc3918d7099 Author: Stephen Kelly AuthorDate: Sun May 3 10:25:14 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 10:36:28 2015 +0200 cmPolicies: Implement in terms of public API. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index a2c7ad5..a2aa104 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -573,7 +573,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, { if (isPolicyNewerThan(i->first, majorVer, minorVer, patchVer)) { - if(i->second->Status == cmPolicies::REQUIRED_ALWAYS) + if(this->GetPolicyStatus(i->first) == cmPolicies::REQUIRED_ALWAYS) { ancientPolicies.push_back(i->first); } http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a140aa6907b22dd17dbfc66102bbb6a089e4cf9a commit a140aa6907b22dd17dbfc66102bbb6a089e4cf9a Author: Stephen Kelly AuthorDate: Sun May 3 10:10:35 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 10:36:20 2015 +0200 cmPolicies: Make private method file-static. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 4b9f558..a2c7ad5 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -452,6 +452,31 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, } //---------------------------------------------------------------------------- +static void DiagnoseAncientPolicies( + std::vector const& ancient, + unsigned int majorVer, + unsigned int minorVer, + unsigned int patchVer, + cmMakefile* mf) +{ + std::ostringstream e; + e << "The project requests behavior compatible with CMake version \"" + << majorVer << "." << minorVer << "." << patchVer + << "\", which requires the OLD behavior for some policies:\n"; + for(std::vector::const_iterator + i = ancient.begin(); i != ancient.end(); ++i) + { + e << " " << idToString(*i) << ": " << idToShortDescription(*i) << "\n"; + } + e << "However, this version of CMake no longer supports the OLD " + << "behavior for these policies. " + << "Please either update your CMakeLists.txt files to conform to " + << "the new behavior or use an older version of CMake that still " + << "supports the old behavior."; + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); +} + +//---------------------------------------------------------------------------- static bool GetPolicyDefault(cmMakefile* mf, std::string const& policy, cmPolicies::PolicyStatus* defaultSetting) { @@ -574,8 +599,8 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, // Make sure the project does not use any ancient policies. if(!ancientPolicies.empty()) { - this->DiagnoseAncientPolicies(ancientPolicies, - majorVer, minorVer, patchVer, mf); + DiagnoseAncientPolicies(ancientPolicies, + majorVer, minorVer, patchVer, mf); cmSystemTools::SetFatalErrorOccured(); return false; } @@ -656,28 +681,3 @@ cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id) << "Run cmake --help-policy " << pid << " for more information."; return e.str(); } - -//---------------------------------------------------------------------------- -void -cmPolicies::DiagnoseAncientPolicies(std::vector const& ancient, - unsigned int majorVer, - unsigned int minorVer, - unsigned int patchVer, - cmMakefile* mf) -{ - std::ostringstream e; - e << "The project requests behavior compatible with CMake version \"" - << majorVer << "." << minorVer << "." << patchVer - << "\", which requires the OLD behavior for some policies:\n"; - for(std::vector::const_iterator - i = ancient.begin(); i != ancient.end(); ++i) - { - e << " " << idToString(*i) << ": " << idToShortDescription(*i) << "\n"; - } - e << "However, this version of CMake no longer supports the OLD " - << "behavior for these policies. " - << "Please either update your CMakeLists.txt files to conform to " - << "the new behavior or use an older version of CMake that still " - << "supports the old behavior."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); -} diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index df04fdf..2b96939 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -285,10 +285,6 @@ public: private: // might have to make these internal for VS6 not sure yet std::map Policies; - - void DiagnoseAncientPolicies(std::vector const& ancient, - unsigned int majorVer, unsigned int minorVer, - unsigned int patchVer, cmMakefile* mf); }; #endif http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8de7d84c36b2519867dca9ca48d1c97512e9a07a commit 8de7d84c36b2519867dca9ca48d1c97512e9a07a Author: Stephen Kelly AuthorDate: Sun May 3 10:10:31 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 10:35:35 2015 +0200 cmPolicies: Implement short description access with XMacros. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 77935ab..4b9f558 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -34,6 +34,10 @@ static bool stringToId(const char* input, cmPolicies::PolicyID& pid) #define CM_FOR_EACH_POLICY_ID_VERSION(POLICY) \ CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID_VERSION) +#define CM_SELECT_ID_DOC(F, A1, A2, A3, A4, A5, A6) F(A1, A2) +#define CM_FOR_EACH_POLICY_ID_DOC(POLICY) \ + CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID_DOC) + static const char* idToString(cmPolicies::PolicyID id) { switch(id) @@ -87,20 +91,32 @@ static bool isPolicyNewerThan(cmPolicies::PolicyID id, return false; } +const char* idToShortDescription(cmPolicies::PolicyID id) +{ + switch(id) + { +#define POLICY_CASE(ID, SHORT_DESCRIPTION) \ + case cmPolicies::ID: \ + return SHORT_DESCRIPTION; + CM_FOR_EACH_POLICY_ID_DOC(POLICY_CASE) +#undef POLICY_CASE + case cmPolicies::CMPCOUNT: + return 0; + } + return 0; +} + class cmPolicy { public: cmPolicy(cmPolicies::PolicyID iD, - const char *shortDescription, cmPolicies::PolicyStatus status) { this->ID = iD; - this->ShortDescription = shortDescription; this->Status = status; } cmPolicies::PolicyID ID; - std::string ShortDescription; cmPolicies::PolicyStatus Status; }; @@ -425,14 +441,13 @@ cmPolicies::~cmPolicies() void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, const char *, - const char *shortDescription, + const char *, unsigned int, unsigned int, unsigned int, cmPolicies::PolicyStatus status) { this->Policies[iD] = new cmPolicy(iD, - shortDescription, status); } @@ -576,13 +591,10 @@ bool cmPolicies::GetPolicyID(const char *id, cmPolicies::PolicyID &pid) ///! return a warning string for a given policy std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id) { - std::map::iterator pos = - this->Policies.find(id); - std::ostringstream msg; msg << "Policy " << idToString(id) << " is not set: " - "" << pos->second->ShortDescription << " " + "" << idToShortDescription(id) << " " "Run \"cmake --help-policy " << idToString(id) << "\" for " "policy details. " "Use the cmake_policy command to set the policy " @@ -594,13 +606,10 @@ std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id) ///! return an error string for when a required policy is unspecified std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id) { - std::map::iterator pos = - this->Policies.find(id); - std::ostringstream error; error << "Policy " << idToString(id) << " is not set to NEW: " - "" << pos->second->ShortDescription << " " + "" << idToShortDescription(id) << " " "Run \"cmake --help-policy " << idToString(id) << "\" for " "policy details. " "CMake now requires this policy to be set to NEW by the project. " @@ -663,8 +672,7 @@ cmPolicies::DiagnoseAncientPolicies(std::vector const& ancient, for(std::vector::const_iterator i = ancient.begin(); i != ancient.end(); ++i) { - cmPolicy const* policy = this->Policies[*i]; - e << " " << idToString(*i) << ": " << policy->ShortDescription << "\n"; + e << " " << idToString(*i) << ": " << idToShortDescription(*i) << "\n"; } e << "However, this version of CMake no longer supports the OLD " << "behavior for these policies. " http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b46cb9fe32aee6dde2cefda5c1ec77a8aad6f29a commit b46cb9fe32aee6dde2cefda5c1ec77a8aad6f29a Author: Stephen Kelly AuthorDate: Sun May 3 10:10:27 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 10:32:32 2015 +0200 cmPolicies: Implement version check with XMacro. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index f6589ae..77935ab 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -64,41 +64,43 @@ static const char* idToVersion(cmPolicies::PolicyID id) return 0; } +static bool isPolicyNewerThan(cmPolicies::PolicyID id, + unsigned int majorV, + unsigned int minorV, + unsigned int patchV) +{ + switch(id) + { +#define POLICY_CASE(ID, V_MAJOR, V_MINOR, V_PATCH) \ + case cmPolicies::ID: \ + return (majorV < V_MAJOR || \ + (majorV == V_MAJOR && \ + minorV + 1 < V_MINOR + 1) || \ + (majorV == V_MAJOR && \ + minorV == V_MINOR && \ + patchV + 1 < V_PATCH + 1)); + CM_FOR_EACH_POLICY_ID_VERSION(POLICY_CASE) +#undef POLICY_CASE + case cmPolicies::CMPCOUNT: + return false; + } + return false; +} + class cmPolicy { public: cmPolicy(cmPolicies::PolicyID iD, const char *shortDescription, - unsigned int majorVersionIntroduced, - unsigned int minorVersionIntroduced, - unsigned int patchVersionIntroduced, cmPolicies::PolicyStatus status) { this->ID = iD; this->ShortDescription = shortDescription; - this->MajorVersionIntroduced = majorVersionIntroduced; - this->MinorVersionIntroduced = minorVersionIntroduced; - this->PatchVersionIntroduced = patchVersionIntroduced; this->Status = status; } - bool IsPolicyNewerThan(unsigned int majorV, - unsigned int minorV, - unsigned int patchV) - { - return (majorV < this->MajorVersionIntroduced || - (majorV == this->MajorVersionIntroduced && - minorV < this->MinorVersionIntroduced) || - (majorV == this->MajorVersionIntroduced && - minorV == this->MinorVersionIntroduced && - patchV < this->PatchVersionIntroduced)); - } - cmPolicies::PolicyID ID; std::string ShortDescription; - unsigned int MajorVersionIntroduced; - unsigned int MinorVersionIntroduced; - unsigned int PatchVersionIntroduced; cmPolicies::PolicyStatus Status; }; @@ -424,16 +426,13 @@ cmPolicies::~cmPolicies() void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, const char *, const char *shortDescription, - unsigned int majorVersionIntroduced, - unsigned int minorVersionIntroduced, - unsigned int patchVersionIntroduced, + unsigned int, + unsigned int, + unsigned int, cmPolicies::PolicyStatus status) { this->Policies[iD] = new cmPolicy(iD, shortDescription, - majorVersionIntroduced, - minorVersionIntroduced, - patchVersionIntroduced, status); } @@ -532,7 +531,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, for(std::map::iterator i = this->Policies.begin(); i != this->Policies.end(); ++i) { - if (i->second->IsPolicyNewerThan(majorVer,minorVer,patchVer)) + if (isPolicyNewerThan(i->first, majorVer, minorVer, patchVer)) { if(i->second->Status == cmPolicies::REQUIRED_ALWAYS) { http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9273eadea728a0b63fe6acbcc634f5e71083dfaa commit 9273eadea728a0b63fe6acbcc634f5e71083dfaa Author: Stephen Kelly AuthorDate: Sun May 3 10:10:20 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 10:32:32 2015 +0200 cmPolicies: Implement id to version with XMacro. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 74bb438..f6589ae 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -30,6 +30,10 @@ static bool stringToId(const char* input, cmPolicies::PolicyID& pid) return false; } +#define CM_SELECT_ID_VERSION(F, A1, A2, A3, A4, A5, A6) F(A1, A3, A4, A5) +#define CM_FOR_EACH_POLICY_ID_VERSION(POLICY) \ + CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID_VERSION) + static const char* idToString(cmPolicies::PolicyID id) { switch(id) @@ -45,6 +49,21 @@ static const char* idToString(cmPolicies::PolicyID id) return 0; } +static const char* idToVersion(cmPolicies::PolicyID id) +{ + switch(id) + { +#define POLICY_CASE(ID, V_MAJOR, V_MINOR, V_PATCH) \ + case cmPolicies::ID: \ + return #V_MAJOR "." #V_MINOR "." #V_PATCH; + CM_FOR_EACH_POLICY_ID_VERSION(POLICY_CASE) +#undef POLICY_CASE + case cmPolicies::CMPCOUNT: + return 0; + } + return 0; +} + class cmPolicy { public: @@ -63,17 +82,6 @@ public: this->Status = status; } - std::string GetVersionString() - { - std::ostringstream v; - v << this->MajorVersionIntroduced << "." << this->MinorVersionIntroduced; - if(this->PatchVersionIntroduced > 0) - { - v << "." << this->PatchVersionIntroduced; - } - return v.str(); - } - bool IsPolicyNewerThan(unsigned int majorV, unsigned int minorV, unsigned int patchV) @@ -600,7 +608,7 @@ std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id) "The policy may be set explicitly using the code\n" " cmake_policy(SET " << idToString(id) << " NEW)\n" "or by upgrading all policies with the code\n" - " cmake_policy(VERSION " << pos->second->GetVersionString() << + " cmake_policy(VERSION " << idToVersion(id) << ") # or later\n" "Run \"cmake --help-command cmake_policy\" for more information."; return error.str(); @@ -631,7 +639,7 @@ cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id) e << "Policy " << pid << " may not be set to OLD behavior because this " << "version of CMake no longer supports it. " << "The policy was introduced in " - << "CMake version " << this->Policies[id]->GetVersionString() + << "CMake version " << idToVersion(id) << ", and use of NEW behavior is now required." << "\n" << "Please either update your CMakeLists.txt files to conform to " http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8c58c7b825f1e1463f2246b8c273ddc9bd680603 commit 8c58c7b825f1e1463f2246b8c273ddc9bd680603 Author: Stephen Kelly AuthorDate: Sun May 3 10:10:15 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 10:32:32 2015 +0200 cmPolicies: Implement id to string conversion with XMacro. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 51aea7b..74bb438 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -30,11 +30,25 @@ static bool stringToId(const char* input, cmPolicies::PolicyID& pid) return false; } +static const char* idToString(cmPolicies::PolicyID id) +{ + switch(id) + { +#define POLICY_CASE(ID) \ + case cmPolicies::ID: \ + return #ID; + CM_FOR_EACH_POLICY_ID(POLICY_CASE) +#undef POLICY_CASE + case cmPolicies::CMPCOUNT: + return 0; + } + return 0; +} + class cmPolicy { public: cmPolicy(cmPolicies::PolicyID iD, - const char *idString, const char *shortDescription, unsigned int majorVersionIntroduced, unsigned int minorVersionIntroduced, @@ -42,7 +56,6 @@ public: cmPolicies::PolicyStatus status) { this->ID = iD; - this->IDString = idString; this->ShortDescription = shortDescription; this->MajorVersionIntroduced = majorVersionIntroduced; this->MinorVersionIntroduced = minorVersionIntroduced; @@ -74,7 +87,6 @@ public: } cmPolicies::PolicyID ID; - std::string IDString; std::string ShortDescription; unsigned int MajorVersionIntroduced; unsigned int MinorVersionIntroduced; @@ -402,14 +414,14 @@ cmPolicies::~cmPolicies() } void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, - const char *idString, + const char *, const char *shortDescription, unsigned int majorVersionIntroduced, unsigned int minorVersionIntroduced, unsigned int patchVersionIntroduced, cmPolicies::PolicyStatus status) { - this->Policies[iD] = new cmPolicy(iD, idString, + this->Policies[iD] = new cmPolicy(iD, shortDescription, majorVersionIntroduced, minorVersionIntroduced, @@ -521,7 +533,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, else { cmPolicies::PolicyStatus status = cmPolicies::WARN; - if(!GetPolicyDefault(mf, i->second->IDString, &status) || + if(!GetPolicyDefault(mf, idToString(i->first), &status) || !mf->SetPolicy(i->second->ID, status)) { return false; @@ -554,18 +566,6 @@ bool cmPolicies::GetPolicyID(const char *id, cmPolicies::PolicyID &pid) return stringToId(id, pid); } -std::string cmPolicies::GetPolicyIDString(cmPolicies::PolicyID pid) -{ - std::map::iterator pos = - this->Policies.find(pid); - if (pos == this->Policies.end()) - { - return ""; - } - return pos->second->IDString; -} - - ///! return a warning string for a given policy std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id) { @@ -574,9 +574,9 @@ std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id) std::ostringstream msg; msg << - "Policy " << pos->second->IDString << " is not set: " + "Policy " << idToString(id) << " is not set: " "" << pos->second->ShortDescription << " " - "Run \"cmake --help-policy " << pos->second->IDString << "\" for " + "Run \"cmake --help-policy " << idToString(id) << "\" for " "policy details. " "Use the cmake_policy command to set the policy " "and suppress this warning."; @@ -592,13 +592,13 @@ std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id) std::ostringstream error; error << - "Policy " << pos->second->IDString << " is not set to NEW: " + "Policy " << idToString(id) << " is not set to NEW: " "" << pos->second->ShortDescription << " " - "Run \"cmake --help-policy " << pos->second->IDString << "\" for " + "Run \"cmake --help-policy " << idToString(id) << "\" for " "policy details. " "CMake now requires this policy to be set to NEW by the project. " "The policy may be set explicitly using the code\n" - " cmake_policy(SET " << pos->second->IDString << " NEW)\n" + " cmake_policy(SET " << idToString(id) << " NEW)\n" "or by upgrading all policies with the code\n" " cmake_policy(VERSION " << pos->second->GetVersionString() << ") # or later\n" @@ -626,7 +626,7 @@ cmPolicies::GetPolicyStatus(cmPolicies::PolicyID id) std::string cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id) { - std::string pid = this->GetPolicyIDString(id); + std::string pid = idToString(id); std::ostringstream e; e << "Policy " << pid << " may not be set to OLD behavior because this " << "version of CMake no longer supports it. " @@ -657,7 +657,7 @@ cmPolicies::DiagnoseAncientPolicies(std::vector const& ancient, i = ancient.begin(); i != ancient.end(); ++i) { cmPolicy const* policy = this->Policies[*i]; - e << " " << policy->IDString << ": " << policy->ShortDescription << "\n"; + e << " " << idToString(*i) << ": " << policy->ShortDescription << "\n"; } e << "However, this version of CMake no longer supports the OLD " << "behavior for these policies. " diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index e9881ac..df04fdf 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -254,7 +254,6 @@ public: ///! convert a string policy ID into a number bool GetPolicyID(const char *id, /* out */ cmPolicies::PolicyID &pid); - std::string GetPolicyIDString(cmPolicies::PolicyID pid); ///! Get the default status for a policy cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=51662a178929cd6802008b282840077b1f87e61c commit 51662a178929cd6802008b282840077b1f87e61c Author: Stephen Kelly AuthorDate: Sun May 3 10:10:06 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 10:32:31 2015 +0200 cmPolicies: Introduce XMacro table for policy data. Use it to populate the policy enum. diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index a3654f1..e9881ac 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -17,6 +17,202 @@ class cmMakefile; class cmPolicy; +#define CM_FOR_EACH_POLICY_TABLE(POLICY, SELECT) \ + SELECT(POLICY, CMP0000, \ + "A minimum required CMake version must be specified.", \ + 2, 6, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0001, \ + "CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.", \ + 2, 6, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0002, \ + "Logical target names must be globally unique.", \ + 2, 6, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0003, \ + "Libraries linked via full path no longer produce linker search paths.", \ + 2, 6, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0004, \ + "Libraries linked may not have leading or trailing whitespace.", \ + 2, 6, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0005, \ + "Preprocessor definition values are now escaped automatically.", \ + 2, 6, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0006, \ + "Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.", \ + 2, 6, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0007, \ + "list command no longer ignores empty elements.", \ + 2, 6, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0008, \ + "Libraries linked by full-path must have a valid library file name.", \ + 2, 6, 1, cmPolicies::WARN) \ + SELECT(POLICY, CMP0009, \ + "FILE GLOB_RECURSE calls should not follow symlinks by default.", \ + 2, 6, 2, cmPolicies::WARN) \ + SELECT(POLICY, CMP0010, \ + "Bad variable reference syntax is an error.", \ + 2, 6, 3, cmPolicies::WARN) \ + SELECT(POLICY, CMP0011, \ + "Included scripts do automatic cmake_policy PUSH and POP.", \ + 2, 6, 3, cmPolicies::WARN) \ + SELECT(POLICY, CMP0012, \ + "if() recognizes numbers and boolean constants.", \ + 2, 8, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0013, \ + "Duplicate binary directories are not allowed.", \ + 2, 8, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0014, \ + "Input directories must have CMakeLists.txt.", \ + 2, 8, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0015, \ + "link_directories() treats paths relative to the source dir.", \ + 2, 8, 1, cmPolicies::WARN) \ + SELECT(POLICY, CMP0016, \ + "target_link_libraries() reports error if its only argument " \ + "is not a target.", \ + 2, 8, 3, cmPolicies::WARN) \ + SELECT(POLICY, CMP0017, \ + "Prefer files from the CMake module directory when including from " \ + "there.", \ + 2, 8, 4, cmPolicies::WARN) \ + SELECT(POLICY, CMP0018, \ + "Ignore CMAKE_SHARED_LIBRARY__FLAGS variable.", \ + 2, 8, 9, cmPolicies::WARN) \ + SELECT(POLICY, CMP0019, \ + "Do not re-expand variables in include and link information.", \ + 2, 8, 11, cmPolicies::WARN) \ + SELECT(POLICY, CMP0020, \ + "Automatically link Qt executables to qtmain target on Windows.", \ + 2, 8, 11, cmPolicies::WARN) \ + SELECT(POLICY, CMP0021, \ + "Fatal error on relative paths in INCLUDE_DIRECTORIES target property.", \ + 2, 8, 12, cmPolicies::WARN) \ + SELECT(POLICY, CMP0022, \ + "INTERFACE_LINK_LIBRARIES defines the link interface.", \ + 2, 8, 12, cmPolicies::WARN) \ + SELECT(POLICY, CMP0023, \ + "Plain and keyword target_link_libraries signatures cannot be mixed.", \ + 2, 8, 12, cmPolicies::WARN) \ + SELECT(POLICY, CMP0024, \ + "Disallow include export result.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0025, \ + "Compiler id for Apple Clang is now AppleClang.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0026, \ + "Disallow use of the LOCATION target property.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0027, \ + "Conditionally linked imported targets with missing include " \ + "directories.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0028, \ + "Double colon in target name means ALIAS or IMPORTED target.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0029, \ + "The subdir_depends command should not be called.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0030, \ + "The use_mangled_mesa command should not be called.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0031, \ + "The load_command command should not be called.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0032, \ + "The output_required_files command should not be called.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0033, \ + "The export_library_dependencies command should not be called.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0034, \ + "The utility_source command should not be called.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0035, \ + "The variable_requires command should not be called.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0036, \ + "The build_name command should not be called.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0037, \ + "Target names should not be reserved and should match a validity " \ + "pattern.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0038, \ + "Targets may not link directly to themselves.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0039, \ + "Utility targets may not have link dependencies.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0040, \ + "The target in the TARGET signature of add_custom_command() must " \ + "exist.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0041, \ + "Error on relative include with generator expression.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0042, \ + "MACOSX_RPATH is enabled by default.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0043, \ + "Ignore COMPILE_DEFINITIONS_ properties.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0044, \ + "Case sensitive _COMPILER_ID generator expressions.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0045, \ + "Error on non-existent target in get_target_property.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0046, \ + "Error on non-existent dependency in add_dependencies.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0047, \ + "Use QCC compiler id for the qcc drivers on QNX.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0048, \ + "project() command manages VERSION variables.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0049, \ + "Do not expand variables in target source entries.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0050, \ + "Disallow add_custom_command SOURCE signatures.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0051, \ + "List TARGET_OBJECTS in SOURCES target property.", \ + 3, 1, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0052, \ + "Reject source and build dirs in installed " \ + "INTERFACE_INCLUDE_DIRECTORIES.", \ + 3, 1, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0053, \ + "Simplify variable reference and escape sequence evaluation.", \ + 3, 1, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0054, \ + "Only interpret if() arguments as variables or keywords when unquoted.", \ + 3, 1, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0055, \ + "Strict checking for break() command.", \ + 3, 2, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0056, \ + "Honor link flags in try_compile() source-file signature.", \ + 3, 2, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0057, \ + "Support new IN_LIST if() operator.", \ + 3, 3, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0058, \ + "Ninja requires custom command byproducts to be explicit.", \ + 3, 3, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0059, \ + "Do no treat DEFINITIONS as a built-in directory property.", \ + 3, 3, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0060, \ + "Link libraries by full path even in implicit directories.", \ + 3, 3, 0, cmPolicies::WARN) + +#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) +#define CM_FOR_EACH_POLICY_ID(POLICY) \ + CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID) + + /** \class cmPolicies * \brief Handles changes in CMake behavior and policies * @@ -44,78 +240,9 @@ public: /// Policy identifiers enum PolicyID { - CMP0000, ///< Policy version specification - CMP0001, ///< Ignore old compatibility variable - CMP0002, ///< Target names must be unique - CMP0003, ///< Linking does not include extra -L paths - CMP0004, ///< Libraries linked may not have leading or trailing whitespace - CMP0005, ///< Definition value escaping - CMP0006, ///< BUNDLE install rules needed for MACOSX_BUNDLE targets - CMP0007, ///< list command handling of empty elements - CMP0008, ///< Full-path libraries must be a valid library file name - CMP0009, ///< GLOB_RECURSE should not follow symlinks by default - CMP0010, ///< Bad variable reference syntax is an error - CMP0011, ///< Strong policy scope for include and find_package - CMP0012, ///< Recognize numbers and boolean constants in if() - CMP0013, ///< Duplicate binary directories not allowed - CMP0014, ///< Input directories must have CMakeLists.txt - CMP0015, ///< link_directories() treats paths relative to source dir - /// target_link_libraries() fails if only argument is not a target - CMP0016, - CMP0017, ///< Prefer files in CMAKE_ROOT when including from CMAKE_ROOT - CMP0018, ///< Ignore language flags for shared libs, and adhere to - /// POSITION_INDEPENDENT_CODE property and *_COMPILE_OPTIONS_PI{E,C} - /// instead. - CMP0019, ///< No variable re-expansion in include and link info - CMP0020, ///< Automatically link Qt executables to qtmain target - CMP0021, ///< Fatal error on relative paths in INCLUDE_DIRECTORIES - /// target property - CMP0022, ///< INTERFACE_LINK_LIBRARIES defines the link interface - CMP0023, ///< Disallow mixing keyword and plain tll signatures - CMP0024, ///< Disallow including export() result. - CMP0025, ///< Compiler id for Apple Clang is now AppleClang - CMP0026, ///< Disallow use of the LOCATION target property. - CMP0027, ///< Conditionally linked imported targets with missing include - /// directories. - CMP0028, ///< Double colon in target name means ALIAS or IMPORTED target. - CMP0029, ///< Disallow command: subdir_depends - CMP0030, ///< Disallow command: use_mangled_mesa - CMP0031, ///< Disallow command: load_command - CMP0032, ///< Disallow command: output_required_files - CMP0033, ///< Disallow command: export_library_dependencies - CMP0034, ///< Disallow command: utility_source - CMP0035, ///< Disallow command: variable_requires - CMP0036, ///< Disallow command: build_name - CMP0037, ///< Target names should not be reserved and - /// should match a validity pattern. - CMP0038, ///< Targets may not link directly to themselves - CMP0039, ///< Utility targets may not have link dependencies - CMP0040, ///< The target in the TARGET signature of - /// add_custom_command() must exist. - CMP0041, ///< Error on relative include with generator expression - CMP0042, ///< Enable MACOSX_RPATH by default - CMP0043, ///< Ignore COMPILE_DEFINITIONS_ properties - CMP0044, ///< Case sensitive _COMPILER_ID generator expressions - CMP0045, ///< Error on non-existent target in get_target_property - CMP0046, ///< Error on non-existent dependency in add_dependencies - CMP0047, ///< Use QCC compiler id for the qcc drivers on QNX. - CMP0048, ///< project() command manages VERSION variables - CMP0049, ///< Do not expand variables in target source entries - CMP0050, ///< Disallow add_custom_command SOURCE signatures - CMP0051, ///< List TARGET_OBJECTS in SOURCES target property - CMP0052, ///< Reject source and build dirs in installed - /// INTERFACE_INCLUDE_DIRECTORIES - - CMP0053, ///< Simplify variable reference and escape sequence evaluation - CMP0054, ///< Only interpret if() arguments as variables - /// or keywords when unquoted. - CMP0055, ///< Strict checking for break() command. - CMP0056, ///< Honor link flags in try_compile() source-file signature. - CMP0057, ///< Support new IN_LIST if() operator. - CMP0058, ///< Ninja requires custom command byproducts to be explicit - CMP0059, ///< Do not treat ``DEFINITIONS`` as a built-in directory - /// property. - CMP0060, ///< Link libraries by full path even in implicit directories. +#define POLICY_ENUM(POLICY_ID) POLICY_ID, + CM_FOR_EACH_POLICY_ID(POLICY_ENUM) +#undef POLICY_ENUM /** \brief Always the last entry. * http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=76e5bd042ced3dab01e5d2c88a2199f09ca806ae commit 76e5bd042ced3dab01e5d2c88a2199f09ca806ae Author: Stephen Kelly AuthorDate: Sun May 3 10:09:57 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 10:32:31 2015 +0200 cmPolicies: Implement more-compact IsPolicyNewerThan. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 372a079..51aea7b 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -65,23 +65,12 @@ public: unsigned int minorV, unsigned int patchV) { - if (majorV < this->MajorVersionIntroduced) - { - return true; - } - if (majorV > this->MajorVersionIntroduced) - { - return false; - } - if (minorV < this->MinorVersionIntroduced) - { - return true; - } - if (minorV > this->MinorVersionIntroduced) - { - return false; - } - return (patchV < this->PatchVersionIntroduced); + return (majorV < this->MajorVersionIntroduced || + (majorV == this->MajorVersionIntroduced && + minorV < this->MinorVersionIntroduced) || + (majorV == this->MajorVersionIntroduced && + minorV == this->MinorVersionIntroduced && + patchV < this->PatchVersionIntroduced)); } cmPolicies::PolicyID ID; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ecd17c8fb7fcc2baba6d6a76467dd3bf1048412a commit ecd17c8fb7fcc2baba6d6a76467dd3bf1048412a Author: Stephen Kelly AuthorDate: Sun May 3 10:09:29 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 10:32:19 2015 +0200 cmPolicies: Parse string for id conversion. Remove now-unused PolicyStringMap. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 3f9c6f0..372a079 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -9,6 +9,27 @@ #include #include +static bool stringToId(const char* input, cmPolicies::PolicyID& pid) +{ + assert(input); + if (strlen(input) != 7) + { + return false; + } + if (cmHasLiteralPrefix(input, "CMP0000")) + { + pid = cmPolicies::CMP0000; + return true; + } + long id = strtol(input + 3, (char **)0, 10); + if (id != 0) + { + pid = cmPolicies::PolicyID(id); + return true; + } + return false; +} + class cmPolicy { public: @@ -405,7 +426,6 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, minorVersionIntroduced, patchVersionIntroduced, status); - this->PolicyStringMap[idString] = iD; } //---------------------------------------------------------------------------- @@ -542,18 +562,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, bool cmPolicies::GetPolicyID(const char *id, cmPolicies::PolicyID &pid) { - if (!id || strlen(id) < 1) - { - return false; - } - std::map::iterator pos = - this->PolicyStringMap.find(id); - if (pos == this->PolicyStringMap.end()) - { - return false; - } - pid = pos->second; - return true; + return stringToId(id, pid); } std::string cmPolicies::GetPolicyIDString(cmPolicies::PolicyID pid) diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 9de0298..a3654f1 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -159,7 +159,6 @@ public: private: // might have to make these internal for VS6 not sure yet std::map Policies; - std::map PolicyStringMap; void DiagnoseAncientPolicies(std::vector const& ancient, unsigned int majorVer, unsigned int minorVer, http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=953d1b00af3059b24c4dadf8c4717cb0d2260e36 commit 953d1b00af3059b24c4dadf8c4717cb0d2260e36 Author: Stephen Kelly AuthorDate: Sun May 3 10:09:10 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 10:09:10 2015 +0200 cmPolicies: Make private method file-static. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 4b6ea5c..3f9c6f0 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -409,6 +409,36 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, } //---------------------------------------------------------------------------- +static bool GetPolicyDefault(cmMakefile* mf, std::string const& policy, + cmPolicies::PolicyStatus* defaultSetting) +{ + std::string defaultVar = "CMAKE_POLICY_DEFAULT_" + policy; + std::string defaultValue = mf->GetSafeDefinition(defaultVar); + if(defaultValue == "NEW") + { + *defaultSetting = cmPolicies::NEW; + } + else if(defaultValue == "OLD") + { + *defaultSetting = cmPolicies::OLD; + } + else if(defaultValue == "") + { + *defaultSetting = cmPolicies::WARN; + } + else + { + std::ostringstream e; + e << defaultVar << " has value \"" << defaultValue + << "\" but must be \"OLD\", \"NEW\", or \"\" (empty)."; + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + return false; + } + + return true; +} + +//---------------------------------------------------------------------------- bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, const char *version) { @@ -482,7 +512,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, else { cmPolicies::PolicyStatus status = cmPolicies::WARN; - if(!this->GetPolicyDefault(mf, i->second->IDString, &status) || + if(!GetPolicyDefault(mf, i->second->IDString, &status) || !mf->SetPolicy(i->second->ID, status)) { return false; @@ -510,36 +540,6 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, return true; } -//---------------------------------------------------------------------------- -bool cmPolicies::GetPolicyDefault(cmMakefile* mf, std::string const& policy, - cmPolicies::PolicyStatus* defaultSetting) -{ - std::string defaultVar = "CMAKE_POLICY_DEFAULT_" + policy; - std::string defaultValue = mf->GetSafeDefinition(defaultVar); - if(defaultValue == "NEW") - { - *defaultSetting = cmPolicies::NEW; - } - else if(defaultValue == "OLD") - { - *defaultSetting = cmPolicies::OLD; - } - else if(defaultValue == "") - { - *defaultSetting = cmPolicies::WARN; - } - else - { - std::ostringstream e; - e << defaultVar << " has value \"" << defaultValue - << "\" but must be \"OLD\", \"NEW\", or \"\" (empty)."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); - return false; - } - - return true; -} - bool cmPolicies::GetPolicyID(const char *id, cmPolicies::PolicyID &pid) { if (!id || strlen(id) < 1) diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index ba8a120..9de0298 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -164,10 +164,6 @@ public: void DiagnoseAncientPolicies(std::vector const& ancient, unsigned int majorVer, unsigned int minorVer, unsigned int patchVer, cmMakefile* mf); - - bool GetPolicyDefault(cmMakefile* mf, std::string const& policy, - cmPolicies::PolicyStatus* defaultStatus); - }; #endif http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2c10494ab3194e792ad69825cbb55d6644270dd0 commit 2c10494ab3194e792ad69825cbb55d6644270dd0 Author: Stephen Kelly AuthorDate: Sun May 3 10:08:50 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 10:08:50 2015 +0200 cmPolicies: Remove runtime check for programming errors. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 0f1c27e..4b6ea5c 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -20,12 +20,6 @@ public: unsigned int patchVersionIntroduced, cmPolicies::PolicyStatus status) { - if (!idString || !shortDescription) - { - cmSystemTools::Error("Attempt to define a policy without " - "all parameters being specified!"); - return; - } this->ID = iD; this->IDString = idString; this->ShortDescription = shortDescription; @@ -405,14 +399,6 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, unsigned int patchVersionIntroduced, cmPolicies::PolicyStatus status) { - // a policy must be unique and can only be defined once - if (this->Policies.find(iD) != this->Policies.end()) - { - cmSystemTools::Error("Attempt to redefine a CMake policy for policy " - "ID ", this->GetPolicyIDString(iD).c_str()); - return; - } - this->Policies[iD] = new cmPolicy(iD, idString, shortDescription, majorVersionIntroduced, @@ -587,12 +573,6 @@ std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id) { std::map::iterator pos = this->Policies.find(id); - if (pos == this->Policies.end()) - { - cmSystemTools::Error( - "Request for warning text for undefined policy!"); - return "Request for warning text for undefined policy!"; - } std::ostringstream msg; msg << @@ -611,12 +591,6 @@ std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id) { std::map::iterator pos = this->Policies.find(id); - if (pos == this->Policies.end()) - { - cmSystemTools::Error( - "Request for error text for undefined policy!"); - return "Request for error text for undefined policy!"; - } std::ostringstream error; error << http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=48f9fd39ad1637815cd89c2a2f2a17e43c0d7f78 commit 48f9fd39ad1637815cd89c2a2f2a17e43c0d7f78 Author: Stephen Kelly AuthorDate: Sun May 3 10:08:35 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 10:08:35 2015 +0200 cmPolicies: Remove unused forward declaration. diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index dbad805..ba8a120 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -14,7 +14,6 @@ #include "cmCustomCommand.h" -class cmake; class cmMakefile; class cmPolicy; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fd0aa7434b010c496e09d8013b192b7df453979a commit fd0aa7434b010c496e09d8013b192b7df453979a Author: Stephen Kelly AuthorDate: Sun May 3 10:08:04 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 10:08:04 2015 +0200 cmPolicies: Remove unused static data. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 5424876..0f1c27e 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -9,10 +9,6 @@ #include #include -const char* cmPolicies::PolicyStatusNames[] = { - "OLD", "WARN", "NEW", "REQUIRED_IF_USED", "REQUIRED_ALWAYS" -}; - class cmPolicy { public: diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 557880e..dbad805 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -41,7 +41,6 @@ public: REQUIRED_IF_USED, REQUIRED_ALWAYS ///< Issue an error unless user sets policy status to NEW. }; - static const char* PolicyStatusNames[]; /// Policy identifiers enum PolicyID http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a3291fe8ecb95c891a34c1844557cbfa2bb89e2d commit a3291fe8ecb95c891a34c1844557cbfa2bb89e2d Author: Stephen Kelly AuthorDate: Sun May 3 10:07:58 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 10:07:58 2015 +0200 cmPolicies: Remove unused header. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 76990f0..5424876 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -1,7 +1,6 @@ #include "cmPolicies.h" #include "cmake.h" #include "cmMakefile.h" -#include "cmSourceFile.h" #include "cmVersion.h" #include "cmVersionMacros.h" #include "cmAlgorithms.h" http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a6fb6db49d9fc5558fd79296fbc233f90a3063e4 commit a6fb6db49d9fc5558fd79296fbc233f90a3063e4 Author: Stephen Kelly AuthorDate: Sun May 3 10:07:48 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 10:07:48 2015 +0200 cmPolicies: Fix values for policies 57-60. diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index ca82264..557880e 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -113,11 +113,11 @@ public: /// or keywords when unquoted. CMP0055, ///< Strict checking for break() command. CMP0056, ///< Honor link flags in try_compile() source-file signature. + CMP0057, ///< Support new IN_LIST if() operator. CMP0058, ///< Ninja requires custom command byproducts to be explicit CMP0059, ///< Do not treat ``DEFINITIONS`` as a built-in directory /// property. CMP0060, ///< Link libraries by full path even in implicit directories. - CMP0057, ///< Support new IN_LIST if() operator. /** \brief Always the last entry. * ----------------------------------------------------------------------- Summary of changes: Source/cmAddCustomCommandCommand.cxx | 3 +- Source/cmAddCustomTargetCommand.cxx | 3 +- Source/cmAddExecutableCommand.cxx | 3 +- Source/cmAddLibraryCommand.cxx | 3 +- Source/cmBreakCommand.cxx | 6 +- Source/cmCMakePolicyCommand.cxx | 4 +- Source/cmCommand.h | 2 +- Source/cmComputeLinkInformation.cxx | 12 +- Source/cmComputeTargetDepends.cxx | 4 +- Source/cmConditionEvaluator.cxx | 18 +- Source/cmCoreTryCompile.cxx | 6 +- Source/cmExportFileGenerator.cxx | 6 +- Source/cmFileCommand.cxx | 6 +- Source/cmGeneratorExpressionNode.cxx | 6 +- Source/cmGetTargetPropertyCommand.cxx | 3 +- Source/cmGlobalGenerator.cxx | 14 +- Source/cmGlobalNinjaGenerator.cxx | 4 +- Source/cmIncludeCommand.cxx | 3 +- Source/cmInstallCommand.cxx | 5 +- Source/cmLinkDirectoriesCommand.cxx | 5 +- Source/cmListCommand.cxx | 6 +- Source/cmLocalGenerator.cxx | 7 +- Source/cmMakefile.cxx | 69 ++- Source/cmPolicies.cxx | 717 +++++++++---------------------- Source/cmPolicies.h | 323 +++++++++----- Source/cmProjectCommand.cxx | 3 +- Source/cmTarget.cxx | 38 +- Source/cmTargetLinkLibrariesCommand.cxx | 12 +- 28 files changed, 500 insertions(+), 791 deletions(-) hooks/post-receive -- CMake From steveire at gmail.com Sun May 3 06:00:24 2015 From: steveire at gmail.com (Stephen Kelly) Date: Sun, 3 May 2015 06:00:24 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2451-gd571efa Message-ID: <20150503100024.EA9BDAFABA@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, next has been updated via d571efa8c321120f030e5f957bf784443feb75ec (commit) via a0836ed97804952ace98d2c1d0d46e968a532a3c (commit) via cbf143bb76604f576275d96a1e1e4c701680ff29 (commit) via 040491fc586d34fe467907eefc85b1524c7cea1e (commit) via 0bb6dbe0c62f027af394f680f644041cfad7321f (commit) via e1bdf5f5b2b15908b9f1c0486da45167933456f3 (commit) via efcca9353f9af919625727a68b2f9c77995aed7f (commit) via 6cd6d50871ce28d0c72336a6aca01814487df5e1 (commit) from 2950a5542fc22c205e3b7aafe4ad28a1961c2611 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d571efa8c321120f030e5f957bf784443feb75ec commit d571efa8c321120f030e5f957bf784443feb75ec Merge: 2950a55 a0836ed Author: Stephen Kelly AuthorDate: Sun May 3 06:00:22 2015 -0400 Commit: CMake Topic Stage CommitDate: Sun May 3 06:00:22 2015 -0400 Merge topic 'add-cmMakefile-GetGlobalGenerator' into next a0836ed9 Port to cmMakefile::GetGlobalGenerator. cbf143bb cmComputeTargetDepends: Use simpler global generator access. 040491fc cmComputeLinkDepends: Remove unused local generator. 0bb6dbe0 cmMakefile: Extract an accessor for the global generator. e1bdf5f5 cmMakefile: Use GetCMakeInstance. efcca935 cmMakefile: Simplify GetCMakeInstance implementation. 6cd6d508 CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a0836ed97804952ace98d2c1d0d46e968a532a3c commit a0836ed97804952ace98d2c1d0d46e968a532a3c Author: Stephen Kelly AuthorDate: Sun May 3 11:10:30 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 11:42:00 2015 +0200 Port to cmMakefile::GetGlobalGenerator. diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx index cdca792..988e9a7 100644 --- a/Source/cmBuildCommand.cxx +++ b/Source/cmBuildCommand.cxx @@ -105,9 +105,8 @@ bool cmBuildCommand "Ignoring PROJECT_NAME option because it has no effect."); } - std::string makecommand = this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->GenerateCMakeBuildCommand(target, configuration, - "", true); + std::string makecommand = this->Makefile->GetGlobalGenerator() + ->GenerateCMakeBuildCommand(target, configuration, "", true); this->Makefile->AddDefinition(variable, makecommand.c_str()); @@ -135,9 +134,8 @@ bool cmBuildCommand configType = cfg; } - std::string makecommand = this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->GenerateCMakeBuildCommand("", configType, - "", true); + std::string makecommand = this->Makefile->GetGlobalGenerator() + ->GenerateCMakeBuildCommand("", configType, "", true); if(cacheValue) { diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 6ecf0dc..1d88480 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -247,7 +247,7 @@ cmComputeLinkInformation this->Target = target; this->Makefile = this->Target->GetMakefile(); this->LocalGenerator = this->Makefile->GetLocalGenerator(); - this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator(); + this->GlobalGenerator = this->Makefile->GetGlobalGenerator(); this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance(); // Check whether to recognize OpenBSD-style library versioned names. diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index b1203dd..bf18deb 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -274,7 +274,7 @@ cmExportBuildFileGenerator ::FindNamespaces(cmMakefile* mf, const std::string& name) { std::vector namespaces; - cmGlobalGenerator* gg = mf->GetLocalGenerator()->GetGlobalGenerator(); + cmGlobalGenerator* gg = mf->GetGlobalGenerator(); std::map& exportSets = gg->GetBuildExportSets(); diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index 06541c0..43d26f9 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -119,8 +119,7 @@ bool cmExportCommand std::vector targets; - cmGlobalGenerator *gg = this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator(); + cmGlobalGenerator *gg = this->Makefile->GetGlobalGenerator(); if(args[0] == "EXPORT") { diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 6d639c9..89c6ca2 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -479,7 +479,7 @@ cmExportInstallFileGenerator ::FindNamespaces(cmMakefile* mf, const std::string& name) { std::vector namespaces; - cmGlobalGenerator* gg = mf->GetLocalGenerator()->GetGlobalGenerator(); + cmGlobalGenerator* gg = mf->GetGlobalGenerator(); const cmExportSetMap& exportSets = gg->GetExportSets(); for(cmExportSetMap::const_iterator expIt = exportSets.begin(); diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 14f397c..12da1fb 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -3568,8 +3568,7 @@ void cmFileCommand::AddEvaluationFile(const std::string &inputName, cmsys::auto_ptr conditionCge = conditionGe.Parse(condition); - this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->AddEvaluationFile(inputName, + this->Makefile->GetGlobalGenerator()->AddEvaluationFile(inputName, outputCge, this->Makefile, conditionCge, @@ -3772,8 +3771,8 @@ bool cmFileCommand::HandleLockCommand( fclose(file); // Actual lock/unlock - cmFileLockPool& lockPool = this->Makefile->GetLocalGenerator()-> - GetGlobalGenerator()->GetFileLockPool(); + cmFileLockPool& lockPool = this->Makefile->GetGlobalGenerator() + ->GetFileLockPool(); cmFileLockResult fileLockResult(cmFileLockResult::MakeOk()); if (release) diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 507d011..0a66732 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -212,7 +212,7 @@ struct cmFindLibraryHelper cmFindLibraryHelper::cmFindLibraryHelper(cmMakefile* mf): Makefile(mf) { - this->GG = this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + this->GG = this->Makefile->GetGlobalGenerator(); // Collect the list of library name prefixes/suffixes to try. const char* prefixes_list = diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index fa00283..c726995 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -103,8 +103,7 @@ void cmGeneratorExpressionEvaluationFile::CreateOutputFile( std::string const& config) { std::vector enabledLanguages; - cmGlobalGenerator *gg - = this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + cmGlobalGenerator *gg = this->Makefile->GetGlobalGenerator(); gg->GetEnabledLanguages(enabledLanguages); for(std::vector::const_iterator le = enabledLanguages.begin(); @@ -168,8 +167,7 @@ void cmGeneratorExpressionEvaluationFile::Generate() } std::vector enabledLanguages; - cmGlobalGenerator *gg - = this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + cmGlobalGenerator *gg = this->Makefile->GetGlobalGenerator(); gg->GetEnabledLanguages(enabledLanguages); for(std::vector::const_iterator le = enabledLanguages.begin(); diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 2654851..6c41c3b 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -768,8 +768,7 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode } std::vector enabledLanguages; - cmGlobalGenerator* gg - = context->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + cmGlobalGenerator* gg = context->Makefile->GetGlobalGenerator(); gg->GetEnabledLanguages(enabledLanguages); if (!parameters.empty() && std::find(enabledLanguages.begin(), enabledLanguages.end(), diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 1a4f9c4..e2b8c45 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -132,8 +132,7 @@ struct TagVisitor TagVisitor(cmTarget *target, DataType& data) : Data(data), Target(target), - GlobalGenerator(target->GetMakefile() - ->GetLocalGenerator()->GetGlobalGenerator()), + GlobalGenerator(target->GetMakefile()->GetGlobalGenerator()), Header(CM_HEADER_REGEX), IsObjLib(target->GetType() == cmTarget::OBJECT_LIBRARY) { @@ -226,7 +225,7 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t), { this->Makefile = this->Target->GetMakefile(); this->LocalGenerator = this->Makefile->GetLocalGenerator(); - this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator(); + this->GlobalGenerator = this->Makefile->GetGlobalGenerator(); } //---------------------------------------------------------------------------- @@ -648,8 +647,7 @@ cmTargetTraceDependencies { // Convenience. this->Makefile = this->Target->GetMakefile(); - this->GlobalGenerator = - this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + this->GlobalGenerator = this->Makefile->GetGlobalGenerator(); this->CurrentEntry = 0; // Queue all the source files already specified for the target. @@ -1025,8 +1023,7 @@ void cmGeneratorTarget::GenerateTargetManifest( return; } cmMakefile* mf = this->Target->GetMakefile(); - cmLocalGenerator* lg = mf->GetLocalGenerator(); - cmGlobalGenerator* gg = lg->GetGlobalGenerator(); + cmGlobalGenerator* gg = mf->GetGlobalGenerator(); // Get the names. std::string name; diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index b035750..76803c1 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -47,8 +47,7 @@ bool cmGetCMakePropertyCommand else if ( args[1] == "COMPONENTS" ) { const std::set* components - = this->Makefile->GetLocalGenerator()->GetGlobalGenerator() - ->GetInstallComponents(); + = this->Makefile->GetGlobalGenerator()->GetInstallComponents(); output = cmJoin(*components, ";"); } else diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx index 881b2ae..4fe3318 100644 --- a/Source/cmGetDirectoryPropertyCommand.cxx +++ b/Source/cmGetDirectoryPropertyCommand.cxx @@ -53,7 +53,7 @@ bool cmGetDirectoryPropertyCommand // lookup the makefile from the directory name cmLocalGenerator *lg = - this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> + this->Makefile->GetGlobalGenerator()-> FindLocalGenerator(sd); if (!lg) { diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 00dbdd3..250bd35 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -265,8 +265,7 @@ bool cmGetPropertyCommand::HandleDirectoryMode() // Lookup the generator. if(cmLocalGenerator* lg = - (this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->FindLocalGenerator(dir))) + (this->Makefile->GetGlobalGenerator()->FindLocalGenerator(dir))) { // Use the makefile for the directory found. mf = lg->GetMakefile(); diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index 71dabaf..372af63 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -93,8 +93,7 @@ bool cmIncludeCommand cmSystemTools::CollapseFullPath(fname, this->Makefile->GetCurrentSourceDirectory()); - cmGlobalGenerator *gg = this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator(); + cmGlobalGenerator *gg = this->Makefile->GetGlobalGenerator(); if (gg->IsExportedTargetsFile(fname_abs)) { const char *modal = 0; diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index fac9641..aba00bd 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -62,8 +62,7 @@ bool cmInstallCommand::InitialPass(std::vector const& args, } // Enable the install target. - this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->EnableInstallTarget(); + this->Makefile->GetGlobalGenerator()->EnableInstallTarget(); this->DefaultComponentName = this->Makefile->GetSafeDefinition( "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"); @@ -198,7 +197,7 @@ bool cmInstallCommand::HandleScriptMode(std::vector const& args) } //Tell the global generator about any installation component names specified. - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(component.c_str()); return true; @@ -774,7 +773,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) te->HeaderGenerator = publicHeaderGenerator; te->LibraryGenerator = libraryGenerator; te->RuntimeGenerator = runtimeGenerator; - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->GetExportSets()[exports.GetString()]->AddTargetExport(te); te->InterfaceIncludeDirectories = @@ -786,43 +785,42 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) // specified if (installsArchive) { - this->Makefile->GetLocalGenerator()-> - GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(archiveArgs.GetComponent().c_str()); } if (installsLibrary) { - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(libraryArgs.GetComponent().c_str()); } if (installsRuntime) { - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(runtimeArgs.GetComponent().c_str()); } if (installsFramework) { - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(frameworkArgs.GetComponent().c_str()); } if (installsBundle) { - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(bundleArgs.GetComponent().c_str()); } if (installsPrivateHeader) { - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(privateHeaderArgs.GetComponent().c_str()); } if (installsPublicHeader) { - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(publicHeaderArgs.GetComponent().c_str()); } if (installsResource) { - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(resourceArgs.GetComponent().c_str()); } @@ -890,7 +888,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector const& args) CreateInstallFilesGenerator(this->Makefile, absFiles, ica, programs)); //Tell the global generator about any installation component names specified. - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(ica.GetComponent().c_str()); return true; @@ -1235,7 +1233,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector const& args) // Tell the global generator about any installation component names // specified. - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(component.c_str()); return true; @@ -1322,8 +1320,8 @@ bool cmInstallCommand::HandleExportMode(std::vector const& args) } } - cmExportSet *exportSet = this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->GetExportSets()[exp.GetString()]; + cmExportSet *exportSet = this->Makefile->GetGlobalGenerator() + ->GetExportSets()[exp.GetString()]; if (exportOld.IsEnabled()) { for(std::vector::const_iterator diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx index 1fe435c..508c373 100644 --- a/Source/cmInstallFilesCommand.cxx +++ b/Source/cmInstallFilesCommand.cxx @@ -24,8 +24,7 @@ bool cmInstallFilesCommand } // Enable the install target. - this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->EnableInstallTarget(); + this->Makefile->GetGlobalGenerator()->EnableInstallTarget(); this->Destination = args[0]; @@ -48,7 +47,7 @@ bool cmInstallFilesCommand args.begin() + 1, args.end()); } - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(this->Makefile->GetSafeDefinition( "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME")); diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx index 4899b95..be8096c 100644 --- a/Source/cmInstallProgramsCommand.cxx +++ b/Source/cmInstallProgramsCommand.cxx @@ -22,14 +22,13 @@ bool cmInstallProgramsCommand } // Enable the install target. - this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->EnableInstallTarget(); + this->Makefile->GetGlobalGenerator()->EnableInstallTarget(); this->Destination = args[0]; this->FinalArgs.insert(this->FinalArgs.end(), args.begin() + 1, args.end()); - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(this->Makefile->GetSafeDefinition( "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME")); diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 11125d3..082a78c 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -728,8 +728,7 @@ cmInstallTargetGenerator i != oldRuntimeDirs.end(); ++i) { std::string runpath = - mf->GetLocalGenerator()-> - GetGlobalGenerator()->ExpandCFGIntDir(*i, config); + mf->GetGlobalGenerator()->ExpandCFGIntDir(*i, config); if(runpaths.find(runpath) == runpaths.end()) { @@ -745,8 +744,7 @@ cmInstallTargetGenerator i != newRuntimeDirs.end(); ++i) { std::string runpath = - mf->GetLocalGenerator()-> - GetGlobalGenerator()->ExpandCFGIntDir(*i, config); + mf->GetGlobalGenerator()->ExpandCFGIntDir(*i, config); if(runpaths.find(runpath) == runpaths.end()) { diff --git a/Source/cmInstallTargetsCommand.cxx b/Source/cmInstallTargetsCommand.cxx index b738844..7e7b848 100644 --- a/Source/cmInstallTargetsCommand.cxx +++ b/Source/cmInstallTargetsCommand.cxx @@ -22,8 +22,7 @@ bool cmInstallTargetsCommand } // Enable the install target. - this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->EnableInstallTarget(); + this->Makefile->GetGlobalGenerator()->EnableInstallTarget(); cmTargets &tgts = this->Makefile->GetTargets(); std::vector::const_iterator s = args.begin(); @@ -57,7 +56,7 @@ bool cmInstallTargetsCommand } } - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(this->Makefile->GetSafeDefinition( "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME")); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 699c0ef..b7b4f79 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1014,7 +1014,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector& outputs, // Generate a rule file if the main dependency is not available. if(!file) { - cmGlobalGenerator* gg = this->LocalGenerator->GetGlobalGenerator(); + cmGlobalGenerator* gg = this->GetGlobalGenerator(); // Construct a rule file associated with the first output produced. std::string outName = gg->GenerateRuleFile(outputs[0]); @@ -1420,8 +1420,7 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove) // VS6 IDE does not support definition values with spaces in // combination with '"', '$', or ';'. - if((this->LocalGenerator->GetGlobalGenerator()->GetName() == - "Visual Studio 6") && + if((this->GetGlobalGenerator()->GetName() == "Visual Studio 6") && (def.find(" ") != def.npos && def.find_first_of("\"$;") != def.npos)) { return false; @@ -1505,8 +1504,7 @@ void cmMakefile::AddLinkLibraryForTarget(const std::string& target, cmTargets::iterator i = this->Targets.find(target); if ( i != this->Targets.end()) { - cmTarget* tgt = - this->GetCMakeInstance()->GetGlobalGenerator()->FindTarget(lib); + cmTarget* tgt = this->GetGlobalGenerator()->FindTarget(lib); if(tgt) { // if it is not a static or shared library then you can not link to it @@ -1698,10 +1696,9 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, } // create a new local generator and set its parent - cmLocalGenerator *lg2 = - this->LocalGenerator->GetGlobalGenerator() + cmLocalGenerator *lg2 = this->GetGlobalGenerator() ->CreateLocalGenerator(this->LocalGenerator); - this->LocalGenerator->GetGlobalGenerator()->AddLocalGenerator(lg2); + this->GetGlobalGenerator()->AddLocalGenerator(lg2); // set the subdirs start dirs lg2->GetMakefile()->SetCurrentSourceDirectory(srcPath); @@ -2017,7 +2014,7 @@ void cmMakefile::AddGlobalLinkInformation(const std::string& name, void cmMakefile::AddAlias(const std::string& lname, cmTarget *tgt) { this->AliasTargets[lname] = tgt; - this->LocalGenerator->GetGlobalGenerator()->AddAlias(lname, tgt); + this->GetGlobalGenerator()->AddAlias(lname, tgt); } cmTarget* cmMakefile::AddLibrary(const std::string& lname, @@ -2074,7 +2071,7 @@ cmMakefile::AddNewTarget(cmTarget::TargetType type, const std::string& name) cmTarget& target = it->second; target.SetType(type, name); target.SetMakefile(this); - this->LocalGenerator->GetGlobalGenerator()->AddTarget(&it->second); + this->GetGlobalGenerator()->AddTarget(&it->second); return &it->second; } @@ -2218,7 +2215,7 @@ void cmMakefile::AddSourceGroup(const std::vector& name, } // build the whole source group path const char* fullname = sg->GetFullName(); - cmGlobalGenerator* gg = this->LocalGenerator->GetGlobalGenerator(); + cmGlobalGenerator* gg = this->GetGlobalGenerator(); if(strlen(fullname)) { std::string guidName = "SG_Filter_"; @@ -3175,7 +3172,7 @@ std::string cmMakefile::GetConfigurations(std::vector& configs, bool single) const { - if(this->LocalGenerator->GetGlobalGenerator()->IsMultiConfig()) + if(this->GetGlobalGenerator()->IsMultiConfig()) { if(const char* configTypes = this->GetDefinition("CMAKE_CONFIGURATION_TYPES")) @@ -3546,10 +3543,8 @@ void cmMakefile::EnableLanguage(std::vector const & lang, bool optional) { this->AddDefinition("CMAKE_CFG_INTDIR", - this->LocalGenerator->GetGlobalGenerator() - ->GetCMakeCFGIntDir()); - this->LocalGenerator->GetGlobalGenerator()->EnableLanguage(lang, this, - optional); + this->GetGlobalGenerator()->GetCMakeCFGIntDir()); + this->GetGlobalGenerator()->EnableLanguage(lang, this, optional); } int cmMakefile::TryCompile(const std::string& srcdir, @@ -3579,7 +3574,7 @@ int cmMakefile::TryCompile(const std::string& srcdir, cmake cm; cm.SetIsInTryCompile(true); cmGlobalGenerator *gg = cm.CreateGlobalGenerator - (this->LocalGenerator->GetGlobalGenerator()->GetName()); + (this->GetGlobalGenerator()->GetName()); if (!gg) { cmSystemTools::Error( @@ -3640,8 +3635,7 @@ int cmMakefile::TryCompile(const std::string& srcdir, cm.SetCacheArgs(*cmakeArgs); } // to save time we pass the EnableLanguage info directly - gg->EnableLanguagesFromGenerator - (this->LocalGenerator->GetGlobalGenerator(), this); + gg->EnableLanguagesFromGenerator(this->GetGlobalGenerator(), this); if(this->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS")) { cm.AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", @@ -3673,13 +3667,12 @@ int cmMakefile::TryCompile(const std::string& srcdir, } // finally call the generator to actually build the resulting project - int ret = - this->LocalGenerator->GetGlobalGenerator()->TryCompile(srcdir,bindir, - projectName, - targetName, - fast, - output, - this); + int ret = this->GetGlobalGenerator()->TryCompile(srcdir,bindir, + projectName, + targetName, + fast, + output, + this); cmSystemTools::ChangeDirectory(cwd); this->Internal->IsSourceFileTryCompile = false; @@ -4402,16 +4395,14 @@ void cmMakefile::PushScope() this->PushLoopBlockBarrier(); #if defined(CMAKE_BUILD_WITH_CMAKE) - this->GetLocalGenerator()->GetGlobalGenerator()-> - GetFileLockPool().PushFunctionScope(); + this->GetGlobalGenerator()->GetFileLockPool().PushFunctionScope(); #endif } void cmMakefile::PopScope() { #if defined(CMAKE_BUILD_WITH_CMAKE) - this->GetLocalGenerator()->GetGlobalGenerator()-> - GetFileLockPool().PopFunctionScope(); + this->GetGlobalGenerator()->GetFileLockPool().PopFunctionScope(); #endif this->PopLoopBlockBarrier(); @@ -4474,7 +4465,7 @@ cmMakefile::AddImportedTarget(const std::string& name, this->ImportedTargets[name] = target.get(); if(global) { - this->LocalGenerator->GetGlobalGenerator()->AddTarget(target.get()); + this->GetGlobalGenerator()->AddTarget(target.get()); } // Transfer ownership to this cmMakefile object. @@ -4502,8 +4493,7 @@ cmTarget* cmMakefile::FindTargetToUse(const std::string& name, } // Look for a target built in this project. - return this->LocalGenerator->GetGlobalGenerator()->FindTarget(name, - excludeAliases); + return this->GetGlobalGenerator()->FindTarget(name, excludeAliases); } //---------------------------------------------------------------------------- @@ -4511,8 +4501,7 @@ bool cmMakefile::IsAlias(const std::string& name) const { if (this->AliasTargets.find(name) != this->AliasTargets.end()) return true; - return this->GetLocalGenerator()->GetGlobalGenerator()->IsAlias( - name); + return this->GetGlobalGenerator()->IsAlias(name); } //---------------------------------------------------------------------------- @@ -4521,7 +4510,7 @@ cmMakefile::FindGeneratorTargetToUse(const std::string& name) const { if (cmTarget *t = this->FindTargetToUse(name)) { - return this->LocalGenerator->GetGlobalGenerator()->GetGeneratorTarget(t); + return this->GetGlobalGenerator()->GetGeneratorTarget(t); } return 0; } @@ -4626,7 +4615,7 @@ bool cmMakefile::EnforceUniqueDir(const std::string& srcPath, const std::string& binPath) const { // Make sure the binary directory is unique. - cmGlobalGenerator* gg = this->LocalGenerator->GetGlobalGenerator(); + cmGlobalGenerator* gg = this->GetGlobalGenerator(); if(gg->BinaryDirectoryIsNew(binPath)) { return true; diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 91b2b27..457de11 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -396,7 +396,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) std::vector rcc_output; bool const isNinja = - makefile->GetLocalGenerator()->GetGlobalGenerator()->GetName() == "Ninja"; + makefile->GetGlobalGenerator()->GetName() == "Ninja"; if(isNinja #if defined(_WIN32) && !defined(__CYGWIN__) || usePRE_BUILD @@ -524,9 +524,8 @@ static void GetCompileDefinitionsAndDirectories(cmTarget const* target, cmMakefile* makefile = target->GetMakefile(); cmLocalGenerator* localGen = makefile->GetLocalGenerator(); std::vector includeDirs; - cmGeneratorTarget *gtgt = target->GetMakefile()->GetLocalGenerator() - ->GetGlobalGenerator() - ->GetGeneratorTarget(target); + cmGeneratorTarget *gtgt = localGen->GetGlobalGenerator() + ->GetGeneratorTarget(target); // Get the include dirs for this target, without stripping the implicit // include dirs off, see http://public.kitware.com/Bug/view.php?id=13667 localGen->GetIncludeDirectories(includeDirs, gtgt, "CXX", config, false); diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index 35262b6..31e460f 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -207,8 +207,7 @@ bool cmSetPropertyCommand::HandleDirectoryMode() // Lookup the generator. if(cmLocalGenerator* lg = - (this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->FindLocalGenerator(dir))) + this->Makefile->GetGlobalGenerator()->FindLocalGenerator(dir)) { // Use the makefile for the directory found. mf = lg->GetMakefile(); diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index cdd04ed..724ab39 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -282,7 +282,7 @@ void cmSourceFile::CheckLanguage(std::string const& ext) { // Try to identify the source file language from the extension. cmMakefile const* mf = this->Location.GetMakefile(); - cmGlobalGenerator* gg = mf->GetLocalGenerator()->GetGlobalGenerator(); + cmGlobalGenerator* gg = mf->GetGlobalGenerator(); std::string l = gg->GetLanguageFromExtension(ext.c_str()); if(!l.empty()) { diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx index a0eba5e..4a87cc2 100644 --- a/Source/cmSourceFileLocation.cxx +++ b/Source/cmSourceFileLocation.cxx @@ -120,8 +120,7 @@ void cmSourceFileLocation::UpdateExtension(const std::string& name) if(!ext.empty()) { ext = ext.substr(1); } // The global generator checks extensions of enabled languages. - cmGlobalGenerator* gg = - this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator(); cmMakefile const* mf = this->Makefile; const std::vector& srcExts = mf->GetSourceExtensions(); const std::vector& hdrExts = mf->GetHeaderExtensions(); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index f69e9ae..ff1fa8a 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -511,7 +511,7 @@ void cmTarget::FinishConfigure() #if defined(_WIN32) && !defined(__CYGWIN__) // Do old-style link dependency analysis only for CM_USE_OLD_VS6. - if(this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->IsForVS6()) + if(this->Makefile->GetGlobalGenerator()->IsForVS6()) { this->AnalyzeLibDependenciesForVS6(*this->Makefile); } @@ -847,8 +847,7 @@ cmTarget::GetConfigCommonSourceFiles(std::vector& files) const std::ostringstream e; e << "Target \"" << this->Name << "\" has source files which vary by " "configuration. This is not supported by the \"" - << this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->GetName() + << this->Makefile->GetGlobalGenerator()->GetName() << "\" generator.\n" "Config \"" << firstConfig << "\":\n" " " << firstConfigFiles << "\n" @@ -1188,7 +1187,7 @@ void cmTarget::ClearDependencyInformation( cmMakefile& mf, //---------------------------------------------------------------------------- bool cmTarget::NameResolvesToFramework(const std::string& libname) const { - return this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> + return this->Makefile->GetGlobalGenerator()-> NameResolvesToFramework(libname); } @@ -3329,7 +3328,7 @@ public: cmTargetSelectLinker(cmTarget const* target): Preference(0), Target(target) { this->Makefile = this->Target->GetMakefile(); - this->GG = this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + this->GG = this->Makefile->GetGlobalGenerator(); } void Consider(const std::string& lang) { @@ -3764,7 +3763,7 @@ bool cmTarget::MacOSXRpathInstallNameDirDefault() const if(cmp0042 == cmPolicies::WARN) { - this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> + this->Makefile->GetGlobalGenerator()-> AddCMP0042WarnTarget(this->GetName()); } @@ -4551,7 +4550,7 @@ bool cmTarget::ComputeOutputDir(const std::string& config, "CMAKE_XCODE_EFFECTIVE_PLATFORMS"); std::string suffix = usesDefaultOutputDir && platforms ? "$(EFFECTIVE_PLATFORM_NAME)" : ""; - this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> + this->Makefile->GetGlobalGenerator()-> AppendDirectoryForConfig("/", conf, suffix, out); } @@ -4613,7 +4612,7 @@ bool cmTarget::ComputePDBOutputDir(const std::string& kind, // The generator may add the configuration's subdirectory. if(!conf.empty()) { - this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> + this->Makefile->GetGlobalGenerator()-> AppendDirectoryForConfig("/", conf, "", out); } return true; @@ -5276,8 +5275,7 @@ void cmTarget::GetLanguages(std::set& languages, } else { - cmGeneratorTarget* gt = this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator() + cmGeneratorTarget* gt = this->Makefile->GetGlobalGenerator() ->GetGeneratorTarget(this); gt->GetExternalObjects(externalObjects, config); for(std::vector::const_iterator http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cbf143bb76604f576275d96a1e1e4c701680ff29 commit cbf143bb76604f576275d96a1e1e4c701680ff29 Author: Stephen Kelly AuthorDate: Sun May 3 11:33:08 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 11:41:59 2015 +0200 cmComputeTargetDepends: Use simpler global generator access. diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 11056cd..d26984c 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -216,9 +216,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // deal with config-specific dependencies. { std::set emitted; - cmGeneratorTarget* gt = depender->GetMakefile()->GetLocalGenerator() - ->GetGlobalGenerator() - ->GetGeneratorTarget(depender); + cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(depender); std::vector configs; depender->GetMakefile()->GetConfigurations(configs); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=040491fc586d34fe467907eefc85b1524c7cea1e commit 040491fc586d34fe467907eefc85b1524c7cea1e Author: Stephen Kelly AuthorDate: Sun May 3 11:31:46 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 11:41:59 2015 +0200 cmComputeLinkDepends: Remove unused local generator. diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 6005d5f..abd9877 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -13,7 +13,6 @@ #include "cmComputeComponentGraph.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmTarget.h" #include "cmake.h" @@ -179,8 +178,7 @@ cmComputeLinkDepends // Store context information. this->Target = target; this->Makefile = this->Target->GetMakefile(); - this->LocalGenerator = this->Makefile->GetLocalGenerator(); - this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator(); + this->GlobalGenerator = this->Makefile->GetGlobalGenerator(); this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance(); // The configuration being linked. diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index a931726..09b9d70 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -21,7 +21,6 @@ class cmComputeComponentGraph; class cmGlobalGenerator; -class cmLocalGenerator; class cmMakefile; class cmTarget; class cmake; @@ -60,7 +59,6 @@ private: // Context information. cmTarget const* Target; cmMakefile* Makefile; - cmLocalGenerator* LocalGenerator; cmGlobalGenerator const* GlobalGenerator; cmake* CMakeInstance; bool DebugMode; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0bb6dbe0c62f027af394f680f644041cfad7321f commit 0bb6dbe0c62f027af394f680f644041cfad7321f Author: Stephen Kelly AuthorDate: Sun May 3 11:08:21 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 11:41:59 2015 +0200 cmMakefile: Extract an accessor for the global generator. Both for convenience, and because cmMakefile should not be the way to get access to the local generator, so that should go away in the future. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index cee5bd0..699c0ef 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3693,7 +3693,12 @@ bool cmMakefile::GetIsSourceFileTryCompile() const cmake *cmMakefile::GetCMakeInstance() const { - return this->LocalGenerator->GetGlobalGenerator()->GetCMakeInstance(); + return this->GetGlobalGenerator()->GetCMakeInstance(); +} + +cmGlobalGenerator* cmMakefile::GetGlobalGenerator() const +{ + return this->LocalGenerator->GetGlobalGenerator(); } #ifdef CMAKE_BUILD_WITH_CMAKE diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 8968e81..ad098ef 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -712,6 +712,7 @@ public: * Get the instance */ cmake *GetCMakeInstance() const; + cmGlobalGenerator* GetGlobalGenerator() const; /** * Get all the source files this makefile knows about http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e1bdf5f5b2b15908b9f1c0486da45167933456f3 commit e1bdf5f5b2b15908b9f1c0486da45167933456f3 Author: Stephen Kelly AuthorDate: Sun May 3 11:41:29 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 11:41:59 2015 +0200 cmMakefile: Use GetCMakeInstance. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 925554b..cee5bd0 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3727,8 +3727,7 @@ cmState *cmMakefile::GetState() const void cmMakefile::DisplayStatus(const char* message, float s) const { - cmake* cm = this->GetLocalGenerator()->GetGlobalGenerator() - ->GetCMakeInstance(); + cmake* cm = this->GetCMakeInstance(); if (cm->GetWorkingMode() == cmake::FIND_PACKAGE_MODE) { // don't output any STATUS message in FIND_PACKAGE_MODE, since they will @@ -4570,8 +4569,7 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg, // The conflict is with a non-imported target. // Allow this if the user has requested support. - cmake* cm = - this->LocalGenerator->GetGlobalGenerator()->GetCMakeInstance(); + cmake* cm = this->GetCMakeInstance(); if(isCustom && existing->GetType() == cmTarget::UTILITY && this != existing->GetMakefile() && cm->GetState() http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=efcca9353f9af919625727a68b2f9c77995aed7f commit efcca9353f9af919625727a68b2f9c77995aed7f Author: Stephen Kelly AuthorDate: Sun May 3 11:05:27 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 11:05:27 2015 +0200 cmMakefile: Simplify GetCMakeInstance implementation. No callers handle the possibility that it can return null, and that is no longer possible anyway. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 5686b1b..925554b 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3693,11 +3693,7 @@ bool cmMakefile::GetIsSourceFileTryCompile() const cmake *cmMakefile::GetCMakeInstance() const { - if ( this->LocalGenerator && this->LocalGenerator->GetGlobalGenerator() ) - { - return this->LocalGenerator->GetGlobalGenerator()->GetCMakeInstance(); - } - return 0; + return this->LocalGenerator->GetGlobalGenerator()->GetCMakeInstance(); } #ifdef CMAKE_BUILD_WITH_CMAKE ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- Source/cmBuildCommand.cxx | 10 ++- Source/cmComputeLinkDepends.cxx | 4 +- Source/cmComputeLinkDepends.h | 2 - Source/cmComputeLinkInformation.cxx | 2 +- Source/cmComputeTargetDepends.cxx | 4 +- Source/cmExportBuildFileGenerator.cxx | 2 +- Source/cmExportCommand.cxx | 3 +- Source/cmExportInstallFileGenerator.cxx | 2 +- Source/cmFileCommand.cxx | 7 +-- Source/cmFindLibraryCommand.cxx | 2 +- Source/cmGeneratorExpressionEvaluationFile.cxx | 6 +- Source/cmGeneratorExpressionNode.cxx | 3 +- Source/cmGeneratorTarget.cxx | 11 ++-- Source/cmGetCMakePropertyCommand.cxx | 3 +- Source/cmGetDirectoryPropertyCommand.cxx | 2 +- Source/cmGetPropertyCommand.cxx | 3 +- Source/cmIncludeCommand.cxx | 3 +- Source/cmInstallCommand.cxx | 32 +++++----- Source/cmInstallFilesCommand.cxx | 5 +- Source/cmInstallProgramsCommand.cxx | 5 +- Source/cmInstallTargetGenerator.cxx | 6 +- Source/cmInstallTargetsCommand.cxx | 5 +- Source/cmMakefile.cxx | 80 ++++++++++-------------- Source/cmMakefile.h | 1 + Source/cmQtAutoGenerators.cxx | 7 +-- Source/cmSetPropertyCommand.cxx | 3 +- Source/cmSourceFile.cxx | 2 +- Source/cmSourceFileLocation.cxx | 3 +- Source/cmTarget.cxx | 18 +++--- 30 files changed, 98 insertions(+), 140 deletions(-) hooks/post-receive -- CMake From steveire at gmail.com Sun May 3 14:35:36 2015 From: steveire at gmail.com (Stephen Kelly) Date: Sun, 3 May 2015 14:35:36 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2453-gf1c2f3d Message-ID: <20150503183536.5584CAF640@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, next has been updated via f1c2f3da46a095710fe02c6dbd27329a10920cd4 (commit) via c0b9a24927d0b18f0e741b7b64f18b9c7c568c1c (commit) from d571efa8c321120f030e5f957bf784443feb75ec (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f1c2f3da46a095710fe02c6dbd27329a10920cd4 commit f1c2f3da46a095710fe02c6dbd27329a10920cd4 Merge: d571efa c0b9a24 Author: Stephen Kelly AuthorDate: Sun May 3 14:35:35 2015 -0400 Commit: CMake Topic Stage CommitDate: Sun May 3 14:35:35 2015 -0400 Merge topic 'refactor-cmPolicies' into next c0b9a249 fixup! cmPolicies: Implement PolicyMap in terms of bitset. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c0b9a24927d0b18f0e741b7b64f18b9c7c568c1c commit c0b9a24927d0b18f0e741b7b64f18b9c7c568c1c Author: Stephen Kelly AuthorDate: Sun May 3 20:35:04 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 20:35:04 2015 +0200 fixup! cmPolicies: Implement PolicyMap in terms of bitset. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 73f6e0e..31ab4dc 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -328,6 +328,11 @@ cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id) return e.str(); } +cmPolicies::PolicyMap::PolicyMap() +{ + this->UNDEFINED.set(); +} + cmPolicies::PolicyStatus cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) const { @@ -355,6 +360,7 @@ cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) const void cmPolicies::PolicyMap::Set(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status) { + this->UNDEFINED.reset(id); this->OLD[id] = (status == cmPolicies::OLD); this->NEW[id] = (status == cmPolicies::NEW); this->REQUIRED_ALWAYS[id] = (status == cmPolicies::REQUIRED_ALWAYS); @@ -363,10 +369,10 @@ void cmPolicies::PolicyMap::Set(cmPolicies::PolicyID id, bool cmPolicies::PolicyMap::IsDefined(cmPolicies::PolicyID id) const { - return this->OLD[id] || this->NEW[id]; + return !this->UNDEFINED[id]; } bool cmPolicies::PolicyMap::IsEmpty() const { - return this->OLD.none() && this->NEW.none(); + return !this->UNDEFINED.none(); } diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 6bc92fb..63376dd 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -272,12 +272,14 @@ public: /** Represent a set of policy values. */ struct PolicyMap { + PolicyMap(); PolicyStatus Get(PolicyID id) const; void Set(PolicyID id, PolicyStatus status); bool IsDefined(PolicyID id) const; bool IsEmpty() const; private: + std::bitset UNDEFINED; std::bitset OLD; std::bitset NEW; std::bitset REQUIRED_IF_USED; ----------------------------------------------------------------------- Summary of changes: Source/cmPolicies.cxx | 10 ++++++++-- Source/cmPolicies.h | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From steveire at gmail.com Sun May 3 14:35:54 2015 From: steveire at gmail.com (Stephen Kelly) Date: Sun, 3 May 2015 14:35:54 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2455-ga9884e4 Message-ID: <20150503183554.37529AF68C@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, next has been updated via a9884e44e9f074b0747bbad4ed926b94f8ffb3d5 (commit) via bdac4ea191295ca63b6f845ab71df210fb141d4e (commit) from f1c2f3da46a095710fe02c6dbd27329a10920cd4 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a9884e44e9f074b0747bbad4ed926b94f8ffb3d5 commit a9884e44e9f074b0747bbad4ed926b94f8ffb3d5 Merge: f1c2f3d bdac4ea Author: Stephen Kelly AuthorDate: Sun May 3 14:35:53 2015 -0400 Commit: CMake Topic Stage CommitDate: Sun May 3 14:35:53 2015 -0400 Merge topic 'refactor-cmPolicies' into next bdac4ea1 cmPolicies: Implement PolicyMap in terms of bitset. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bdac4ea191295ca63b6f845ab71df210fb141d4e commit bdac4ea191295ca63b6f845ab71df210fb141d4e Author: Stephen Kelly AuthorDate: Sun May 3 10:12:34 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 20:35:41 2015 +0200 cmPolicies: Implement PolicyMap in terms of bitset. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index f593149..31ab4dc 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -328,24 +328,51 @@ cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id) return e.str(); } +cmPolicies::PolicyMap::PolicyMap() +{ + this->UNDEFINED.set(); +} + cmPolicies::PolicyStatus cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) const { - return this->find(id)->second; + PolicyStatus status = cmPolicies::WARN; + + if (this->OLD[id]) + { + status = cmPolicies::OLD; + } + else if (this->NEW[id]) + { + status = cmPolicies::NEW; + } + else if (this->REQUIRED_ALWAYS[id]) + { + status = cmPolicies::REQUIRED_ALWAYS; + } + else if (this->REQUIRED_IF_USED[id]) + { + status = cmPolicies::REQUIRED_IF_USED; + } + return status; } void cmPolicies::PolicyMap::Set(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status) { - (*this)[id] = status; + this->UNDEFINED.reset(id); + this->OLD[id] = (status == cmPolicies::OLD); + this->NEW[id] = (status == cmPolicies::NEW); + this->REQUIRED_ALWAYS[id] = (status == cmPolicies::REQUIRED_ALWAYS); + this->REQUIRED_IF_USED[id] = (status == cmPolicies::REQUIRED_IF_USED); } bool cmPolicies::PolicyMap::IsDefined(cmPolicies::PolicyID id) const { - return this->find(id) != this->end(); + return !this->UNDEFINED[id]; } bool cmPolicies::PolicyMap::IsEmpty() const { - return this->empty(); + return !this->UNDEFINED.none(); } diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 46b725a..63376dd 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -14,6 +14,8 @@ #include "cmCustomCommand.h" +#include + class cmMakefile; class cmPolicy; @@ -268,12 +270,20 @@ public: static std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id); /** Represent a set of policy values. */ - struct PolicyMap : private std::map + struct PolicyMap { + PolicyMap(); PolicyStatus Get(PolicyID id) const; void Set(PolicyID id, PolicyStatus status); bool IsDefined(PolicyID id) const; bool IsEmpty() const; + + private: + std::bitset UNDEFINED; + std::bitset OLD; + std::bitset NEW; + std::bitset REQUIRED_IF_USED; + std::bitset REQUIRED_ALWAYS; }; }; ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From steveire at gmail.com Sun May 3 14:39:25 2015 From: steveire at gmail.com (Stephen Kelly) Date: Sun, 3 May 2015 14:39:25 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2457-g7629a8c Message-ID: <20150503183925.DF1EAAAD36@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, next has been updated via 7629a8ccab28ee6d6a60e5fb8c89d1e2eb8fc024 (commit) via 83dc483e4e35b528a5ece7a336399a994bd3f67e (commit) from a9884e44e9f074b0747bbad4ed926b94f8ffb3d5 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7629a8ccab28ee6d6a60e5fb8c89d1e2eb8fc024 commit 7629a8ccab28ee6d6a60e5fb8c89d1e2eb8fc024 Merge: a9884e4 83dc483 Author: Stephen Kelly AuthorDate: Sun May 3 14:39:22 2015 -0400 Commit: CMake Topic Stage CommitDate: Sun May 3 14:39:22 2015 -0400 Merge topic 'truncate-snapshots' into next 83dc483e cmState: Truncate snapshot data in Initialize. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=83dc483e4e35b528a5ece7a336399a994bd3f67e commit 83dc483e4e35b528a5ece7a336399a994bd3f67e Author: Stephen Kelly AuthorDate: Sun May 3 20:36:26 2015 +0200 Commit: Stephen Kelly CommitDate: Sun May 3 20:36:29 2015 +0200 cmState: Truncate snapshot data in Initialize. When Configure is executed multiple times with the same cmake instance (either using CTest --two-config or a interactive gui), the location and structural data was preserved though it would not be used again. Fix that by clearing the data in a method called early in the configure step. diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 24cbc4a..67a2274 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -22,7 +22,6 @@ cmState::cmState(cmake* cm) : CMakeInstance(cm), IsInTryCompile(false) { - this->CreateSnapshot(Snapshot()); this->Initialize(); } @@ -194,8 +193,12 @@ void cmState::RemoveCacheEntryProperty(std::string const& key, void cmState::Initialize() { this->GlobalProperties.clear(); - this->PropertyDefinitions.clear(); + this->Locations.clear(); + this->OutputLocations.clear(); + this->ParentPositions.clear(); + + this->CreateSnapshot(Snapshot()); this->DefineProperty ("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY, "", "", true); ----------------------------------------------------------------------- Summary of changes: Source/cmState.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From domen.vrankar at gmail.com Sun May 3 17:51:50 2015 From: domen.vrankar at gmail.com (Domen Vrankar) Date: Sun, 3 May 2015 17:51:50 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2459-gebcfc6f Message-ID: <20150503215150.B71A1AF89C@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, next has been updated via ebcfc6f5e941872f18addf2d7d8f8e9f825a8f15 (commit) via 94f5fc39185102389f719d703906f08c1015c2f7 (commit) from 7629a8ccab28ee6d6a60e5fb8c89d1e2eb8fc024 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ebcfc6f5e941872f18addf2d7d8f8e9f825a8f15 commit ebcfc6f5e941872f18addf2d7d8f8e9f825a8f15 Merge: 7629a8c 94f5fc3 Author: Domen Vrankar AuthorDate: Sun May 3 17:51:50 2015 -0400 Commit: CMake Topic Stage CommitDate: Sun May 3 17:51:50 2015 -0400 Merge topic 'cpack-deb-component-auto-discovery' into next 94f5fc39 fixup! CPack/DEB component dependency auto-discovery http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=94f5fc39185102389f719d703906f08c1015c2f7 commit 94f5fc39185102389f719d703906f08c1015c2f7 Author: Domen Vrankar AuthorDate: Sun May 3 23:49:14 2015 +0200 Commit: Domen Vrankar CommitDate: Sun May 3 23:49:14 2015 +0200 fixup! CPack/DEB component dependency auto-discovery Attempt at fixing dependency auto detection for older versions of dpkg-shlibdeps diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 69bb302..7fce49b 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -271,18 +271,20 @@ function(cpack_deb_prepare_package_vars) # dpkg-shlibdeps is a Debian utility for generating dependency list find_program(SHLIBDEPS_EXECUTABLE dpkg-shlibdeps) - # Check version of the dpkg-shlibdeps tool using CPackRPM method if(SHLIBDEPS_EXECUTABLE) + # Check version of the dpkg-shlibdeps tool using CPackRPM method execute_process(COMMAND env LC_ALL=C ${SHLIBDEPS_EXECUTABLE} --version OUTPUT_VARIABLE _TMP_VERSION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) string(REGEX MATCH "dpkg-shlibdeps version ([0-9]+\\.[0-9]+\\.[0-9]+)" SHLIBDEPS_EXECUTABLE_VERSION - ${_TMP_VERSION}) + "${_TMP_VERSION}") set(SHLIBDEPS_EXECUTABLE_VERSION "${CMAKE_MATCH_1}") + if(CPACK_DEBIAN_PACKAGE_DEBUG) - message( "CPackDeb Debug: dpkg-shlibdeps version is <${SHLIBDEPS_EXECUTABLE_VERSION}>") + message("CPackDeb Debug: dpkg-shlibdeps --version output is '${_TMP_VERSION}'") + message("CPackDeb Debug: dpkg-shlibdeps version is <${SHLIBDEPS_EXECUTABLE_VERSION}>") endif() # Generating binary list - Get type of all install files @@ -292,14 +294,14 @@ function(cpack_deb_prepare_package_vars) OUTPUT_VARIABLE CPACK_DEB_INSTALL_FILES) # Convert to CMake list - string(REPLACE "\n" ";" CPACK_DEB_INSTALL_FILES ${CPACK_DEB_INSTALL_FILES}) + string(REPLACE "\n" ";" CPACK_DEB_INSTALL_FILES "${CPACK_DEB_INSTALL_FILES}") # Only dynamically linked ELF files are included # Extract only file name infront of ":" - foreach ( _FILE ${CPACK_DEB_INSTALL_FILES}) - if ( ${_FILE} MATCHES "ELF.*dynamically linked") - string(REGEX MATCH "(^.*):" _FILE_NAME ${_FILE}) - list(APPEND CPACK_DEB_BINARY_FILES ${CMAKE_MATCH_1}) + foreach( _FILE ${CPACK_DEB_INSTALL_FILES}) + if( ${_FILE} MATCHES "ELF.*dynamically linked") + string(REGEX MATCH "(^.*):" _FILE_NAME "${_FILE}") + list(APPEND CPACK_DEB_BINARY_FILES "${CMAKE_MATCH_1}") endif() endforeach() @@ -311,10 +313,16 @@ function(cpack_deb_prepare_package_vars) file(MAKE_DIRECTORY ${CPACK_TEMPORARY_DIRECTORY}/debian) file(WRITE ${CPACK_TEMPORARY_DIRECTORY}/debian/control "") + # only set ignore-missing-info flag for dpkg-shlibdeps that have --version option + # (those are newer and also have --ignore-missing-info flag) + if(SHLIBDEPS_EXECUTABLE_VERSION) + set(IGNORE_MISSING_INFO_FLAG "--ignore-missing-info") + endif() + # Execute dpkg-shlibdeps # --ignore-missing-info : allow dpkg-shlibdeps to run even if some libs do not belong to a package # -O : print to STDOUT - execute_process(COMMAND ${SHLIBDEPS_EXECUTABLE} --ignore-missing-info -O ${CPACK_DEB_BINARY_FILES} + execute_process(COMMAND ${SHLIBDEPS_EXECUTABLE} ${IGNORE_MISSING_INFO_FLAG} -O ${CPACK_DEB_BINARY_FILES} WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" OUTPUT_VARIABLE SHLIBDEPS_OUTPUT RESULT_VARIABLE SHLIBDEPS_RESULT @@ -324,12 +332,12 @@ function(cpack_deb_prepare_package_vars) # dpkg-shlibdeps will throw some warnings if some input files are not binary message( "CPackDeb Debug: dpkg-shlibdeps warnings \n${SHLIBDEPS_ERROR}") endif() - if (NOT SHLIBDEPS_RESULT EQUAL 0) + if(NOT SHLIBDEPS_RESULT EQUAL 0) message (FATAL_ERROR "CPackDeb: dpkg-shlibdeps: ${SHLIBDEPS_ERROR}") - endif () + endif() #Get rid of prefix generated by dpkg-shlibdeps - string (REGEX REPLACE "^.*Depends=" "" CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS ${SHLIBDEPS_OUTPUT}) + string(REGEX REPLACE "^.*Depends=" "" CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS "${SHLIBDEPS_OUTPUT}") if(CPACK_DEBIAN_PACKAGE_DEBUG) message( "CPackDeb Debug: Found dependency: ${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}") @@ -340,19 +348,19 @@ function(cpack_deb_prepare_package_vars) file(REMOVE_RECURSE "${CPACK_TEMPORARY_DIRECTORY}/debian") # Append user depend if set - if (CPACK_DEBIAN_PACKAGE_DEPENDS) - set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}, ${CPACK_DEBIAN_PACKAGE_DEPENDS}") - else () - set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}") - endif () + if(CPACK_DEBIAN_PACKAGE_DEPENDS) + set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}, ${CPACK_DEBIAN_PACKAGE_DEPENDS}") + else() + set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}") + endif() - else () + else() if(CPACK_DEBIAN_PACKAGE_DEBUG) message( "CPackDeb Debug: Using only user-provided depends because dpkg-shlibdeps is not found.") endif() endif() - else () + else() if(CPACK_DEBIAN_PACKAGE_DEBUG) message( "CPackDeb Debug: Using only user-provided depends") endif() ----------------------------------------------------------------------- Summary of changes: Modules/CPackDeb.cmake | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon May 4 00:01:08 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 4 May 2015 00:01:08 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.2-1002-ge0222dd Message-ID: <20150504040108.3C57EAFBB6@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 e0222dda1490dcfdf85a18ea5a22ec2313ea4d53 (commit) from 6cd6d50871ce28d0c72336a6aca01814487df5e1 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e0222dda1490dcfdf85a18ea5a22ec2313ea4d53 commit e0222dda1490dcfdf85a18ea5a22ec2313ea4d53 Author: Kitware Robot AuthorDate: Mon May 4 00:01:06 2015 -0400 Commit: Kitware Robot CommitDate: Mon May 4 00:01:06 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 001e670..4a8cdb0 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 2) -set(CMake_VERSION_PATCH 20150503) +set(CMake_VERSION_PATCH 20150504) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon May 4 10:37:01 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 4 May 2015 10:37:01 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2462-ge514024 Message-ID: <20150504143701.C32DDAFF64@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, next has been updated via e51402472cb8f61aea30abb4adbf121c273057da (commit) via 42142d4fd2455f3c792283ba9c261c3756a10d8a (commit) via f39f0c0aec3ecae02a89d47be6bbb85632ca57f3 (commit) from ebcfc6f5e941872f18addf2d7d8f8e9f825a8f15 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e51402472cb8f61aea30abb4adbf121c273057da commit e51402472cb8f61aea30abb4adbf121c273057da Merge: ebcfc6f 42142d4 Author: Brad King AuthorDate: Mon May 4 10:37:00 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon May 4 10:37:00 2015 -0400 Merge topic 'refactor-cmMakefile-constructor' into next 42142d4f cmMakefile: Inline Intialize method in constructor f39f0c0a cmMakefile: Initialize SuppressWatches member before use http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=42142d4fd2455f3c792283ba9c261c3756a10d8a commit 42142d4fd2455f3c792283ba9c261c3756a10d8a Author: Brad King AuthorDate: Mon May 4 10:18:50 2015 -0400 Commit: Brad King CommitDate: Mon May 4 10:22:01 2015 -0400 cmMakefile: Inline Intialize method in constructor Since commit 80909041 (cmMakefile: Disable copy constructor, 2015-04-18) the only call to cmMakefile::Initialize is in one constructor. Inline it and drop the separate method. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 1f406d3..d7bb5d9 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -121,12 +121,6 @@ cmMakefile::cmMakefile(cmLocalGenerator* localGenerator) this->AddDefaultDefinitions(); - this->Initialize(); -} - -//---------------------------------------------------------------------------- -void cmMakefile::Initialize() -{ this->cmDefineRegex.compile("#cmakedefine[ \t]+([A-Za-z_0-9]*)"); this->cmDefine01Regex.compile("#cmakedefine01[ \t]+([A-Za-z_0-9]*)"); this->cmAtVarRegex.compile("(@[A-Za-z_0-9/.+-]+@)"); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 8968e81..f18f114 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -918,7 +918,6 @@ protected: private: cmMakefile(const cmMakefile& mf); cmMakefile& operator=(const cmMakefile& mf); - void Initialize(); cmState::Snapshot StateSnapshot; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f39f0c0aec3ecae02a89d47be6bbb85632ca57f3 commit f39f0c0aec3ecae02a89d47be6bbb85632ca57f3 Author: Brad King AuthorDate: Mon May 4 10:16:34 2015 -0400 Commit: Brad King CommitDate: Mon May 4 10:22:01 2015 -0400 cmMakefile: Initialize SuppressWatches member before use In commit 86f3cd0f (cmMakefile: Require the localGenerator in the constructor, 2015-04-27) we added use of GetDefinition to the Initialize method. Set SuppressWatches before calling this method since GetDefinition checks it. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 0935383..1f406d3 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -83,6 +83,9 @@ cmMakefile::cmMakefile(cmLocalGenerator* localGenerator) this->WarnUnused = false; this->CheckSystemVars = false; + this->GeneratingBuildSystem = false; + this->SuppressWatches = false; + // Setup the default include file regular expression (match everything). this->IncludeFileRegularExpression = "^.*$"; // Setup the default include complaint regular expression (match nothing). @@ -117,10 +120,8 @@ cmMakefile::cmMakefile(cmLocalGenerator* localGenerator) this->LocalGenerator = localGenerator; this->AddDefaultDefinitions(); - this->Initialize(); - this->GeneratingBuildSystem = false; - this->SuppressWatches = false; + this->Initialize(); } //---------------------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/cmMakefile.cxx | 11 +++-------- Source/cmMakefile.h | 1 - 2 files changed, 3 insertions(+), 9 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon May 4 10:59:53 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 4 May 2015 10:59:53 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2464-g5430811 Message-ID: <20150504145953.72BA3AFE4F@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, next has been updated via 5430811f5a70a70a786bc764d53d792fa012c167 (commit) via 7389b399d077f48dbd79d26ecff8d492bfaf82c4 (commit) from e51402472cb8f61aea30abb4adbf121c273057da (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5430811f5a70a70a786bc764d53d792fa012c167 commit 5430811f5a70a70a786bc764d53d792fa012c167 Merge: e514024 7389b39 Author: Brad King AuthorDate: Mon May 4 10:59:51 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon May 4 10:59:51 2015 -0400 Merge topic 'cpack-deb-component-auto-discovery' into next 7389b399 Help: Add notes for topic 'cpack-deb-component-auto-discovery' http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7389b399d077f48dbd79d26ecff8d492bfaf82c4 commit 7389b399d077f48dbd79d26ecff8d492bfaf82c4 Author: Brad King AuthorDate: Mon May 4 10:58:59 2015 -0400 Commit: Brad King CommitDate: Mon May 4 10:58:59 2015 -0400 Help: Add notes for topic 'cpack-deb-component-auto-discovery' diff --git a/Help/release/dev/cpack-deb-component-auto-discovery.rst b/Help/release/dev/cpack-deb-component-auto-discovery.rst new file mode 100644 index 0000000..cc74db2 --- /dev/null +++ b/Help/release/dev/cpack-deb-component-auto-discovery.rst @@ -0,0 +1,6 @@ +cpack-deb-component-auto-discovery +---------------------------------- + +* The :module:`CPackDeb` module learned a new + :variable:`CPACK_DEBIAN__PACKAGE_SHLIBDEPS` + variable to specify per-component use of ``dpkg-shlibdeps``. ----------------------------------------------------------------------- Summary of changes: Help/release/dev/cpack-deb-component-auto-discovery.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/cpack-deb-component-auto-discovery.rst hooks/post-receive -- CMake From brad.king at kitware.com Mon May 4 11:02:20 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 4 May 2015 11:02:20 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.2-1004-g8403c8d Message-ID: <20150504150220.4E17AAFEC4@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 8403c8da2c54affb0ab185aaaf302c7fa7ade914 (commit) via bb6663ca0a73872b063477e92272418b7d49e39b (commit) from e0222dda1490dcfdf85a18ea5a22ec2313ea4d53 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8403c8da2c54affb0ab185aaaf302c7fa7ade914 commit 8403c8da2c54affb0ab185aaaf302c7fa7ade914 Merge: e0222dd bb6663c Author: Brad King AuthorDate: Mon May 4 11:02:18 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon May 4 11:02:18 2015 -0400 Merge topic 'mingw32-make-backslash-workaround' bb6663ca Makefile: Workaround mingw32-make trailing backslash trouble (#15546) ----------------------------------------------------------------------- Summary of changes: Source/cmLocalUnixMakefileGenerator3.h | 1 + Source/cmMakefileTargetGenerator.cxx | 10 ++++++++++ 2 files changed, 11 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Mon May 4 11:02:22 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 4 May 2015 11:02:22 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.2-1010-g1ef88dc Message-ID: <20150504150222.98EDFAFEC7@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 1ef88dcd46da72e489204141d66509f484738e1b (commit) via 6c7dad41d9f5e9b6ab6bdd6ddee837aa5509e19e (commit) via a7ce0c7bc03efcfff6bf9fecc52663409262d73d (commit) via 7a5039fa6c0d84d1f4062211afcf0318db77f325 (commit) via 191573f7922aea3c1abdba325f5e65e4ba03d7c8 (commit) via 8b1745a1c5ed992e632bd4865c0f6a34b136041d (commit) from 8403c8da2c54affb0ab185aaaf302c7fa7ade914 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1ef88dcd46da72e489204141d66509f484738e1b commit 1ef88dcd46da72e489204141d66509f484738e1b Merge: 8403c8d 6c7dad4 Author: Brad King AuthorDate: Mon May 4 11:02:21 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon May 4 11:02:21 2015 -0400 Merge topic 'refactor-cmDefinitions-Get' 6c7dad41 cmDefinitions: Make Get method static. a7ce0c7b cmDefinitions: Make GetInternal method static. 7a5039fa cmDefinitions: Use static member without this->. 191573f7 cmDefinitions: Remove Parent pointer. 8b1745a1 cmDefinitions: Accept varStack iterators in Get API. ----------------------------------------------------------------------- Summary of changes: Source/cmDefinitions.cxx | 37 +++++++++++++++++++------------------ Source/cmDefinitions.h | 19 ++++++------------- Source/cmMakefile.cxx | 10 +++------- 3 files changed, 28 insertions(+), 38 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon May 4 11:02:24 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 4 May 2015 11:02:24 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.2-1017-g0d167b3 Message-ID: <20150504150224.868C3AFECA@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 0d167b3e609bf7addc51567f92c9cf5b0b898381 (commit) via a0836ed97804952ace98d2c1d0d46e968a532a3c (commit) via cbf143bb76604f576275d96a1e1e4c701680ff29 (commit) via 040491fc586d34fe467907eefc85b1524c7cea1e (commit) via 0bb6dbe0c62f027af394f680f644041cfad7321f (commit) via e1bdf5f5b2b15908b9f1c0486da45167933456f3 (commit) via efcca9353f9af919625727a68b2f9c77995aed7f (commit) from 1ef88dcd46da72e489204141d66509f484738e1b (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0d167b3e609bf7addc51567f92c9cf5b0b898381 commit 0d167b3e609bf7addc51567f92c9cf5b0b898381 Merge: 1ef88dc a0836ed Author: Brad King AuthorDate: Mon May 4 11:02:23 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon May 4 11:02:23 2015 -0400 Merge topic 'add-cmMakefile-GetGlobalGenerator' a0836ed9 Port to cmMakefile::GetGlobalGenerator. cbf143bb cmComputeTargetDepends: Use simpler global generator access. 040491fc cmComputeLinkDepends: Remove unused local generator. 0bb6dbe0 cmMakefile: Extract an accessor for the global generator. e1bdf5f5 cmMakefile: Use GetCMakeInstance. efcca935 cmMakefile: Simplify GetCMakeInstance implementation. ----------------------------------------------------------------------- Summary of changes: Source/cmBuildCommand.cxx | 10 ++- Source/cmComputeLinkDepends.cxx | 4 +- Source/cmComputeLinkDepends.h | 2 - Source/cmComputeLinkInformation.cxx | 2 +- Source/cmComputeTargetDepends.cxx | 4 +- Source/cmExportBuildFileGenerator.cxx | 2 +- Source/cmExportCommand.cxx | 3 +- Source/cmExportInstallFileGenerator.cxx | 2 +- Source/cmFileCommand.cxx | 7 +-- Source/cmFindLibraryCommand.cxx | 2 +- Source/cmGeneratorExpressionEvaluationFile.cxx | 6 +- Source/cmGeneratorExpressionNode.cxx | 3 +- Source/cmGeneratorTarget.cxx | 11 ++-- Source/cmGetCMakePropertyCommand.cxx | 3 +- Source/cmGetDirectoryPropertyCommand.cxx | 2 +- Source/cmGetPropertyCommand.cxx | 3 +- Source/cmIncludeCommand.cxx | 3 +- Source/cmInstallCommand.cxx | 32 +++++----- Source/cmInstallFilesCommand.cxx | 5 +- Source/cmInstallProgramsCommand.cxx | 5 +- Source/cmInstallTargetGenerator.cxx | 6 +- Source/cmInstallTargetsCommand.cxx | 5 +- Source/cmMakefile.cxx | 80 ++++++++++-------------- Source/cmMakefile.h | 1 + Source/cmQtAutoGenerators.cxx | 7 +-- Source/cmSetPropertyCommand.cxx | 3 +- Source/cmSourceFile.cxx | 2 +- Source/cmSourceFileLocation.cxx | 3 +- Source/cmTarget.cxx | 18 +++--- 29 files changed, 97 insertions(+), 139 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon May 4 11:02:26 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 4 May 2015 11:02:26 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.2-1019-gd3b36a9 Message-ID: <20150504150226.6A699AFECC@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 d3b36a90b661543f937daffafdf386c91a9592f5 (commit) via 83dc483e4e35b528a5ece7a336399a994bd3f67e (commit) from 0d167b3e609bf7addc51567f92c9cf5b0b898381 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d3b36a90b661543f937daffafdf386c91a9592f5 commit d3b36a90b661543f937daffafdf386c91a9592f5 Merge: 0d167b3 83dc483 Author: Brad King AuthorDate: Mon May 4 11:02:25 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon May 4 11:02:25 2015 -0400 Merge topic 'truncate-snapshots' 83dc483e cmState: Truncate snapshot data in Initialize. ----------------------------------------------------------------------- Summary of changes: Source/cmState.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon May 4 11:02:40 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 4 May 2015 11:02:40 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2470-g22e216c Message-ID: <20150504150240.F2D15AFECB@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, next has been updated via 22e216cda398b3c9a50288020472e6370c241b19 (commit) via d3b36a90b661543f937daffafdf386c91a9592f5 (commit) via 0d167b3e609bf7addc51567f92c9cf5b0b898381 (commit) via 1ef88dcd46da72e489204141d66509f484738e1b (commit) via 8403c8da2c54affb0ab185aaaf302c7fa7ade914 (commit) via e0222dda1490dcfdf85a18ea5a22ec2313ea4d53 (commit) from 5430811f5a70a70a786bc764d53d792fa012c167 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=22e216cda398b3c9a50288020472e6370c241b19 commit 22e216cda398b3c9a50288020472e6370c241b19 Merge: 5430811 d3b36a9 Author: Brad King AuthorDate: Mon May 4 11:02:34 2015 -0400 Commit: Brad King CommitDate: Mon May 4 11:02:34 2015 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon May 4 11:07:37 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 4 May 2015 11:07:37 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2472-g0790bd6 Message-ID: <20150504150737.C7B48AFFA0@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, next has been updated via 0790bd649365b79f185970978d560da74ebdb1c4 (commit) via f47342701c1ae23c6895602490786caacc43d2c6 (commit) from 22e216cda398b3c9a50288020472e6370c241b19 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0790bd649365b79f185970978d560da74ebdb1c4 commit 0790bd649365b79f185970978d560da74ebdb1c4 Merge: 22e216c f473427 Author: Brad King AuthorDate: Mon May 4 11:07:37 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon May 4 11:07:37 2015 -0400 Merge topic 'hp-gnu-asm' into next f4734270 HP-UX: Add GNU compiler information for ASM language http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f47342701c1ae23c6895602490786caacc43d2c6 commit f47342701c1ae23c6895602490786caacc43d2c6 Author: Brad King AuthorDate: Mon May 4 11:06:16 2015 -0400 Commit: Brad King CommitDate: Mon May 4 11:06:16 2015 -0400 HP-UX: Add GNU compiler information for ASM language Suggested-by: Gerhard Grimm diff --git a/Modules/Platform/HP-UX-GNU-ASM.cmake b/Modules/Platform/HP-UX-GNU-ASM.cmake new file mode 100644 index 0000000..613b859 --- /dev/null +++ b/Modules/Platform/HP-UX-GNU-ASM.cmake @@ -0,0 +1,2 @@ +include(Platform/HP-UX-GNU) +__hpux_compiler_gnu(ASM) ----------------------------------------------------------------------- Summary of changes: Modules/Platform/{HP-UX-GNU-C.cmake => HP-UX-GNU-ASM.cmake} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) copy Modules/Platform/{HP-UX-GNU-C.cmake => HP-UX-GNU-ASM.cmake} (52%) hooks/post-receive -- CMake From brad.king at kitware.com Mon May 4 11:29:34 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 4 May 2015 11:29:34 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2474-gcab41d4 Message-ID: <20150504152934.735CFAEFF9@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, next has been updated via cab41d4b45334f527c33f0c5daa3ee49a5afb67b (commit) via 0f927b440adbe3ecca1b8987ed8c5e442a324ff0 (commit) from 0790bd649365b79f185970978d560da74ebdb1c4 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cab41d4b45334f527c33f0c5daa3ee49a5afb67b commit cab41d4b45334f527c33f0c5daa3ee49a5afb67b Merge: 0790bd6 0f927b4 Author: Brad King AuthorDate: Mon May 4 11:29:33 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon May 4 11:29:33 2015 -0400 Merge topic 'FindGTest-fix-test-space-parsing' into next 0f927b44 FindGTest: Fix parsing of test macro calls with spaces (#15553) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0f927b440adbe3ecca1b8987ed8c5e442a324ff0 commit 0f927b440adbe3ecca1b8987ed8c5e442a324ff0 Author: Brad King AuthorDate: Mon May 4 11:23:30 2015 -0400 Commit: Brad King CommitDate: Mon May 4 11:28:50 2015 -0400 FindGTest: Fix parsing of test macro calls with spaces (#15553) Tolerate spaces before the open paren and after the test name before the comma. diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake index e6b5b0a..fccf877 100644 --- a/Modules/FindGTest.cmake +++ b/Modules/FindGTest.cmake @@ -115,11 +115,11 @@ function(GTEST_ADD_TESTS executable extra_args) # obtain sources used for building that executable get_property(ARGN TARGET ${executable} PROPERTY SOURCES) endif() - set(gtest_case_name_regex ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*") + set(gtest_case_name_regex ".*\\( *([A-Za-z_0-9]+) *, *([A-Za-z_0-9]+) *\\).*") set(gtest_test_type_regex "(TYPED_TEST|TEST_?[FP]?)") foreach(source ${ARGN}) file(READ "${source}" contents) - string(REGEX MATCHALL "${gtest_test_type_regex}\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents}) + string(REGEX MATCHALL "${gtest_test_type_regex} *\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents}) foreach(hit ${found_tests}) string(REGEX MATCH "${gtest_test_type_regex}" test_type ${hit}) ----------------------------------------------------------------------- Summary of changes: Modules/FindGTest.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon May 4 12:36:34 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 4 May 2015 12:36:34 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2476-ga7850c5 Message-ID: <20150504163634.A650BAFB22@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, next has been updated via a7850c5498db008be536da8cddb72724743f9011 (commit) via 9b2778d412351db9c8c7f667335cbdf51b555124 (commit) from cab41d4b45334f527c33f0c5daa3ee49a5afb67b (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a7850c5498db008be536da8cddb72724743f9011 commit a7850c5498db008be536da8cddb72724743f9011 Merge: cab41d4 9b2778d Author: Brad King AuthorDate: Mon May 4 12:36:33 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon May 4 12:36:33 2015 -0400 Merge topic 'InstallRequiredSystemLibraries-vs2015' into next 9b2778d4 InstallRequiredSystemLibraries: Update for VS 2015 (#15552) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9b2778d412351db9c8c7f667335cbdf51b555124 commit 9b2778d412351db9c8c7f667335cbdf51b555124 Author: Brad King AuthorDate: Mon May 4 11:57:42 2015 -0400 Commit: Brad King CommitDate: Mon May 4 12:36:12 2015 -0400 InstallRequiredSystemLibraries: Update for VS 2015 (#15552) The part of the MS C Runtime library that applications need to distribute has been renamed from "msvcr*.dll" to "vcruntime*.dll" starting with VS 2015. See the Visual C++ Team Blog: Introducing the Universal CRT http://blogs.msdn.com/b/vcblog/archive/2015/03/03/introducing-the-universal-crt.aspx diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index 5afb517..d8ede1c 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -172,8 +172,12 @@ if(MSVC) if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) set(__install__libs "${MSVC${v}_CRT_DIR}/msvcp${v}0.dll" - "${MSVC${v}_CRT_DIR}/msvcr${v}0.dll" ) + if(NOT v VERSION_LESS 14) + list(APPEND __install__libs "${MSVC${v}_CRT_DIR}/vcruntime${v}0.dll") + else() + list(APPEND __install__libs "${MSVC${v}_CRT_DIR}/msvcr${v}0.dll") + endif() else() set(__install__libs) endif() @@ -183,8 +187,12 @@ if(MSVC) "${MSVC${v}_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.DebugCRT") set(__install__libs ${__install__libs} "${MSVC${v}_CRT_DIR}/msvcp${v}0d.dll" - "${MSVC${v}_CRT_DIR}/msvcr${v}0d.dll" ) + if(NOT v VERSION_LESS 14) + list(APPEND __install__libs "${MSVC${v}_CRT_DIR}/vcruntime${v}0d.dll") + else() + list(APPEND __install__libs "${MSVC${v}_CRT_DIR}/msvcr${v}0d.dll") + endif() endif() endmacro() ----------------------------------------------------------------------- Summary of changes: Modules/InstallRequiredSystemLibraries.cmake | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From steveire at gmail.com Mon May 4 16:32:05 2015 From: steveire at gmail.com (Stephen Kelly) Date: Mon, 4 May 2015 16:32:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2478-gae9e9fc Message-ID: <20150504203205.A3DAAAF29B@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, next has been updated via ae9e9fcf50eb6a3731f0edda1c1ee7ea3b719cfd (commit) via 9945469c38ee662f6106861f3cb6d37c78b40ccc (commit) from a7850c5498db008be536da8cddb72724743f9011 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ae9e9fcf50eb6a3731f0edda1c1ee7ea3b719cfd commit ae9e9fcf50eb6a3731f0edda1c1ee7ea3b719cfd Merge: a7850c5 9945469 Author: Stephen Kelly AuthorDate: Mon May 4 16:32:05 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon May 4 16:32:05 2015 -0400 Merge topic 'refactor-cmPolicies' into next 9945469c fixup! cmPolicies: Parse string for id conversion. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9945469c38ee662f6106861f3cb6d37c78b40ccc commit 9945469c38ee662f6106861f3cb6d37c78b40ccc Author: Stephen Kelly AuthorDate: Mon May 4 22:27:43 2015 +0200 Commit: Stephen Kelly CommitDate: Mon May 4 22:29:06 2015 +0200 fixup! cmPolicies: Parse string for id conversion. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 31ab4dc..f8d61db 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -16,18 +16,33 @@ static bool stringToId(const char* input, cmPolicies::PolicyID& pid) { return false; } - if (cmHasLiteralPrefix(input, "CMP0000")) + if (!cmHasLiteralPrefix(input, "CMP")) + { + return false; + } + if (cmHasLiteralSuffix(input, "0000")) { pid = cmPolicies::CMP0000; return true; } - long id = strtol(input + 3, (char **)0, 10); - if (id != 0) + for (int i = 3; i < 7; ++i) { - pid = cmPolicies::PolicyID(id); - return true; + if (!isdigit(*(input + i))) + { + return false; + } } - return false; + long id; + if (!cmSystemTools::StringToLong(input + 3, &id)) + { + return false; + } + if (id >= cmPolicies::CMPCOUNT) + { + return false; + } + pid = cmPolicies::PolicyID(id); + return true; } #define CM_SELECT_ID_VERSION(F, A1, A2, A3, A4, A5, A6) F(A1, A3, A4, A5) ----------------------------------------------------------------------- Summary of changes: Source/cmPolicies.cxx | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) hooks/post-receive -- CMake From steveire at gmail.com Mon May 4 16:32:52 2015 From: steveire at gmail.com (Stephen Kelly) Date: Mon, 4 May 2015 16:32:52 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2497-gdcd76bd Message-ID: <20150504203252.D6651AF31A@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, next has been updated via dcd76bd58f7876804bd15d96275f9874257e8277 (commit) via 013ada80eac9cb119a6288ee58724a8c9915a35c (commit) via be6664c208c65e01dc175ae4d27e7fc18c28c97e (commit) via de211686122166e7485a98fd027bd1d32fda40b0 (commit) via 13981f20688279b4e10faca67b7020946c9ef733 (commit) via 23e2bcc8dba21b532ebbde20518f8a9f2d312103 (commit) via 5641ba4fcaba322e6f189e33eaccc4621d6ba99d (commit) via 3de54497030b7d8f40f219c0fdfe991e2a9041be (commit) via 387aff200c94073560a961cd2971ab6826347d4d (commit) via dbf680d670e399cc3b042721a1179fba0429073b (commit) via 8c204133e5b7dc278de64c66a6ce0be8ec4ab6f4 (commit) via e3a8c0291e6ae364365bfe48f12c6a5f4ec0e76f (commit) via cb765af0499d1ad51b7e4d3ff45f1e40d6ca843b (commit) via 5df267fa1dc5f8389f571eb6841e51b8fe333b2c (commit) via 2235cfebeeb3447a1c62d7a0207e899c9f7c9240 (commit) via 05d8438860cac1c1ec2d1bcc325b8bc05c0cfcdc (commit) via 6eaade8a827e2e120640f3fc2eb9999e2bca5992 (commit) via fdca04db6850273157e3c50de476e0b9298e9948 (commit) via a7ff97275159d094f55df481728a682c357bc438 (commit) from ae9e9fcf50eb6a3731f0edda1c1ee7ea3b719cfd (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dcd76bd58f7876804bd15d96275f9874257e8277 commit dcd76bd58f7876804bd15d96275f9874257e8277 Merge: ae9e9fc 013ada8 Author: Stephen Kelly AuthorDate: Mon May 4 16:32:50 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon May 4 16:32:50 2015 -0400 Merge topic 'refactor-cmPolicies' into next 013ada80 cmPolicies: Implement PolicyMap in terms of bitset. be6664c2 cmPolicies: Implement abstraction for PolicyMap. de211686 Port to static cmPolicies API. 13981f20 cmPolicies: Make all API static. 23e2bcc8 cmPolicies: Remove unused DefinePolicy method. 5641ba4f cmPolicies: Remove unused cmPolicy class. 3de54497 cmPolicies: Loop over all policies using enum constants. 387aff20 cmPolicies: Trivialize GetPolicyStatus method. dbf680d6 cmPolicies: Use more-direct ID access. 8c204133 cmPolicies: Implement in terms of public API. e3a8c029 cmPolicies: Make private method file-static. cb765af0 cmPolicies: Implement short description access with XMacros. 5df267fa cmPolicies: Implement version check with XMacro. 2235cfeb cmPolicies: Implement id to version with XMacro. 05d84388 cmPolicies: Implement id to string conversion with XMacro. 6eaade8a cmPolicies: Introduce XMacro table for policy data. ... http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=013ada80eac9cb119a6288ee58724a8c9915a35c commit 013ada80eac9cb119a6288ee58724a8c9915a35c Author: Stephen Kelly AuthorDate: Sun May 3 10:12:34 2015 +0200 Commit: Stephen Kelly CommitDate: Mon May 4 22:32:21 2015 +0200 cmPolicies: Implement PolicyMap in terms of bitset. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 8996943..f8d61db 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -343,24 +343,51 @@ cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id) return e.str(); } +cmPolicies::PolicyMap::PolicyMap() +{ + this->UNDEFINED.set(); +} + cmPolicies::PolicyStatus cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) const { - return this->find(id)->second; + PolicyStatus status = cmPolicies::WARN; + + if (this->OLD[id]) + { + status = cmPolicies::OLD; + } + else if (this->NEW[id]) + { + status = cmPolicies::NEW; + } + else if (this->REQUIRED_ALWAYS[id]) + { + status = cmPolicies::REQUIRED_ALWAYS; + } + else if (this->REQUIRED_IF_USED[id]) + { + status = cmPolicies::REQUIRED_IF_USED; + } + return status; } void cmPolicies::PolicyMap::Set(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status) { - (*this)[id] = status; + this->UNDEFINED.reset(id); + this->OLD[id] = (status == cmPolicies::OLD); + this->NEW[id] = (status == cmPolicies::NEW); + this->REQUIRED_ALWAYS[id] = (status == cmPolicies::REQUIRED_ALWAYS); + this->REQUIRED_IF_USED[id] = (status == cmPolicies::REQUIRED_IF_USED); } bool cmPolicies::PolicyMap::IsDefined(cmPolicies::PolicyID id) const { - return this->find(id) != this->end(); + return !this->UNDEFINED[id]; } bool cmPolicies::PolicyMap::IsEmpty() const { - return this->empty(); + return !this->UNDEFINED.none(); } diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 46b725a..63376dd 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -14,6 +14,8 @@ #include "cmCustomCommand.h" +#include + class cmMakefile; class cmPolicy; @@ -268,12 +270,20 @@ public: static std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id); /** Represent a set of policy values. */ - struct PolicyMap : private std::map + struct PolicyMap { + PolicyMap(); PolicyStatus Get(PolicyID id) const; void Set(PolicyID id, PolicyStatus status); bool IsDefined(PolicyID id) const; bool IsEmpty() const; + + private: + std::bitset UNDEFINED; + std::bitset OLD; + std::bitset NEW; + std::bitset REQUIRED_IF_USED; + std::bitset REQUIRED_ALWAYS; }; }; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=be6664c208c65e01dc175ae4d27e7fc18c28c97e commit be6664c208c65e01dc175ae4d27e7fc18c28c97e Author: Stephen Kelly AuthorDate: Sun May 3 10:12:28 2015 +0200 Commit: Stephen Kelly CommitDate: Mon May 4 22:32:21 2015 +0200 cmPolicies: Implement abstraction for PolicyMap. Hide the detail that it is a std::map. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 29d891c..3befbdd 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -569,7 +569,7 @@ cmMakefile::IncludeScope::~IncludeScope() // one we pushed above. If the entry is empty, then the included // script did not set any policies that might affect the includer so // we do not need to enforce the policy. - if(this->CheckCMP0011 && this->Makefile->PolicyStack.back().empty()) + if(this->CheckCMP0011 && this->Makefile->PolicyStack.back().IsEmpty()) { this->CheckCMP0011 = false; } @@ -4772,10 +4772,9 @@ cmMakefile::GetPolicyStatusInternal(cmPolicies::PolicyID id) const for(PolicyStackType::const_reverse_iterator psi = this->PolicyStack.rbegin(); psi != this->PolicyStack.rend(); ++psi) { - PolicyStackEntry::const_iterator pse = psi->find(id); - if(pse != psi->end()) + if(psi->IsDefined(id)) { - return pse->second; + return psi->Get(id); } } @@ -4840,7 +4839,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, for(PolicyStackType::reverse_iterator psi = this->PolicyStack.rbegin(); previous_was_weak && psi != this->PolicyStack.rend(); ++psi) { - (*psi)[id] = status; + psi->Set(id, status); previous_was_weak = psi->Weak; } @@ -4960,7 +4959,7 @@ void cmMakefile::RecordPolicies(cmPolicies::PolicyMap& pm) for(PolicyID pid = cmPolicies::CMP0000; pid != cmPolicies::CMPCOUNT; pid = PolicyID(pid+1)) { - pm[pid] = this->GetPolicyStatus(pid); + pm.Set(pid, this->GetPolicyStatus(pid)); } } diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index c95520f..8996943 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -342,3 +342,25 @@ cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id) << "Run cmake --help-policy " << pid << " for more information."; return e.str(); } + +cmPolicies::PolicyStatus +cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) const +{ + return this->find(id)->second; +} + +void cmPolicies::PolicyMap::Set(cmPolicies::PolicyID id, + cmPolicies::PolicyStatus status) +{ + (*this)[id] = status; +} + +bool cmPolicies::PolicyMap::IsDefined(cmPolicies::PolicyID id) const +{ + return this->find(id) != this->end(); +} + +bool cmPolicies::PolicyMap::IsEmpty() const +{ + return this->empty(); +} diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index fee7dd9..46b725a 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -268,7 +268,13 @@ public: static std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id); /** Represent a set of policy values. */ - typedef std::map PolicyMap; + struct PolicyMap : private std::map + { + PolicyStatus Get(PolicyID id) const; + void Set(PolicyID id, PolicyStatus status); + bool IsDefined(PolicyID id) const; + bool IsEmpty() const; + }; }; #endif http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=de211686122166e7485a98fd027bd1d32fda40b0 commit de211686122166e7485a98fd027bd1d32fda40b0 Author: Stephen Kelly AuthorDate: Sun May 3 10:12:10 2015 +0200 Commit: Stephen Kelly CommitDate: Mon May 4 22:32:20 2015 +0200 Port to static cmPolicies API. diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index ba9e663..fe516ea 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -380,8 +380,7 @@ bool cmAddCustomCommandCommand switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0050)) { case cmPolicies::WARN: - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0050)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0050) << "\n"; break; case cmPolicies::OLD: issueMessage = false; diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index c246aee..42bd71c 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -194,8 +194,7 @@ bool cmAddCustomTargetCommand switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0037)) { case cmPolicies::WARN: - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0037)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0037) << "\n"; issueMessage = true; case cmPolicies::OLD: break; diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx index 74dc8eb..d15fc1e 100644 --- a/Source/cmAddExecutableCommand.cxx +++ b/Source/cmAddExecutableCommand.cxx @@ -84,8 +84,7 @@ bool cmAddExecutableCommand switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0037)) { case cmPolicies::WARN: - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0037)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0037) << "\n"; issueMessage = true; case cmPolicies::OLD: break; diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index 74e1a93..a844cf1 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -222,8 +222,7 @@ bool cmAddLibraryCommand case cmPolicies::WARN: if(type != cmTarget::INTERFACE_LIBRARY) { - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0037)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0037) << "\n"; issueMessage = true; } case cmPolicies::OLD: diff --git a/Source/cmBreakCommand.cxx b/Source/cmBreakCommand.cxx index 34245b3..fc0c3f5 100644 --- a/Source/cmBreakCommand.cxx +++ b/Source/cmBreakCommand.cxx @@ -23,8 +23,7 @@ bool cmBreakCommand::InitialPass(std::vector const &args, switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0055)) { case cmPolicies::WARN: - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0055)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0055) << "\n"; break; case cmPolicies::OLD: issueMessage = false; @@ -58,8 +57,7 @@ bool cmBreakCommand::InitialPass(std::vector const &args, switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0055)) { case cmPolicies::WARN: - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0055)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0055) << "\n"; break; case cmPolicies::OLD: issueMessage = false; diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx index 9662fbf..3c878bf 100644 --- a/Source/cmCMakePolicyCommand.cxx +++ b/Source/cmCMakePolicyCommand.cxx @@ -111,7 +111,7 @@ bool cmCMakePolicyCommand::HandleGetMode(std::vector const& args) // Lookup the policy number. cmPolicies::PolicyID pid; - if(!this->Makefile->GetPolicies()->GetPolicyID(id.c_str(), pid)) + if(!cmPolicies::GetPolicyID(id.c_str(), pid)) { std::ostringstream e; e << "GET given policy \"" << id << "\" which is not known to this " @@ -141,7 +141,7 @@ bool cmCMakePolicyCommand::HandleGetMode(std::vector const& args) // The policy is required to be set before anything needs it. { std::ostringstream e; - e << this->Makefile->GetPolicies()->GetRequiredPolicyError(pid) + e << cmPolicies::GetRequiredPolicyError(pid) << "\n" << "The call to cmake_policy(GET " << id << " ...) at which this " << "error appears requests the policy, and this version of CMake " diff --git a/Source/cmCommand.h b/Source/cmCommand.h index 6689243..0548c6b 100644 --- a/Source/cmCommand.h +++ b/Source/cmCommand.h @@ -180,7 +180,7 @@ public: { case cmPolicies::WARN: this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, - this->Makefile->GetPolicies()->GetPolicyWarning(pol)); + cmPolicies::GetPolicyWarning(pol)); case cmPolicies::OLD: return false; case cmPolicies::REQUIRED_IF_USED: diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 6ecf0dc..3c90ae2 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -556,8 +556,7 @@ bool cmComputeLinkInformation::Compute() if (!this->CMP0060WarnItems.empty()) { std::ostringstream w; - w << (this->Makefile->GetCMakeInstance()->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0060)) << "\n" + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0060) << "\n" "Some library files are in directories implicitly searched by " "the linker when invoked for " << this->LinkLanguage << ":\n" " " << cmJoin(this->CMP0060WarnItems, "\n ") << "\n" @@ -1534,8 +1533,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item, { this->CMakeInstance->GetState()->SetGlobalProperty(wid, "1"); std::ostringstream w; - w << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0008)) << "\n" + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0008) << "\n" << "Target \"" << this->Target->GetName() << "\" links to item\n" << " " << item << "\n" << "which is a full-path but not a valid library file name."; @@ -1553,8 +1551,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item, case cmPolicies::REQUIRED_ALWAYS: { std::ostringstream e; - e << (this->Makefile->GetPolicies()-> - GetRequiredPolicyError(cmPolicies::CMP0008)) << "\n" + e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0008) << "\n" << "Target \"" << this->Target->GetName() << "\" links to item\n" << " " << item << "\n" << "which is a full-path but not a valid library file name."; @@ -1600,8 +1597,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories() case cmPolicies::REQUIRED_ALWAYS: { std::ostringstream e; - e << (this->Makefile->GetPolicies()-> - GetRequiredPolicyError(cmPolicies::CMP0003)) << "\n"; + e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0003) << "\n"; this->PrintLinkPolicyDiagnosis(e); this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(), this->Target->GetBacktrace()); diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 11056cd..c7be221 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -361,15 +361,13 @@ void cmComputeTargetDepends::AddTargetDepend( if(!dependee && !linking && (depender->GetType() != cmTarget::GLOBAL_TARGET)) { - cmMakefile *makefile = depender->GetMakefile(); cmake::MessageType messageType = cmake::AUTHOR_WARNING; bool issueMessage = false; std::ostringstream e; switch(depender->GetPolicyStatusCMP0046()) { case cmPolicies::WARN: - e << (makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0046)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0046) << "\n"; issueMessage = true; case cmPolicies::OLD: break; diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index 1f9b9d4..73aface 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -118,8 +118,7 @@ const char* cmConditionEvaluator::GetDefinitionIfUnquoted( if(!hasBeenReported) { std::ostringstream e; - e << (this->Makefile.GetPolicies()->GetPolicyWarning( - cmPolicies::CMP0054)) << "\n"; + e << (cmPolicies::GetPolicyWarning(cmPolicies::CMP0054)) << "\n"; e << "Quoted variables like \"" << argument.GetValue() << "\" will no longer be dereferenced " "when the policy is set to NEW. " @@ -168,8 +167,7 @@ bool cmConditionEvaluator::IsKeyword(std::string const& keyword, if(!hasBeenReported) { std::ostringstream e; - e << (this->Makefile.GetPolicies()->GetPolicyWarning( - cmPolicies::CMP0054)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0054) << "\n"; e << "Quoted keywords like \"" << argument.GetValue() << "\" will no longer be interpreted as keywords " "when the policy is set to NEW. " @@ -280,10 +278,9 @@ bool cmConditionEvaluator::GetBooleanValueWithAutoDereference( { case cmPolicies::WARN: { - cmPolicies* policies = this->Makefile.GetPolicies(); errorString = "An argument named \"" + newArg.GetValue() + "\" appears in a conditional statement. " - + policies->GetPolicyWarning(cmPolicies::CMP0012); + + cmPolicies::GetPolicyWarning(cmPolicies::CMP0012); status = cmake::AUTHOR_WARNING; } case cmPolicies::OLD: @@ -291,10 +288,9 @@ bool cmConditionEvaluator::GetBooleanValueWithAutoDereference( case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: { - cmPolicies* policies = this->Makefile.GetPolicies(); errorString = "An argument named \"" + newArg.GetValue() + "\" appears in a conditional statement. " - + policies->GetRequiredPolicyError(cmPolicies::CMP0012); + + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0012); status = cmake::FATAL_ERROR; } case cmPolicies::NEW: @@ -493,8 +489,7 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList &newArgs, { cmPolicies::PolicyID pid; this->HandlePredicate( - this->Makefile.GetPolicies()->GetPolicyID( - argP1->c_str(), pid), + cmPolicies::GetPolicyID(argP1->c_str(), pid), reducible, arg, newArgs, argP1, argP2); } // does a target exist @@ -702,8 +697,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList &newArgs, else if(this->Policy57Status == cmPolicies::WARN) { std::ostringstream e; - e << (this->Makefile.GetPolicies()->GetPolicyWarning( - cmPolicies::CMP0057)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0057) << "\n"; e << "IN_LIST will be interpreted as an operator " "when the policy is set to NEW. " "Since the policy is not set the OLD behavior will be used."; diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 56a884c..1109aca 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -334,8 +334,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) "CMAKE_POLICY_WARNING_CMP0056")) { std::ostringstream w; - w << (this->Makefile->GetCMakeInstance()->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0056)) << "\n" + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0056) << "\n" "For compatibility with older versions of CMake, try_compile " "is not honoring caller link flags (e.g. CMAKE_EXE_LINKER_FLAGS) " "in the test project." @@ -349,8 +348,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) case cmPolicies::REQUIRED_ALWAYS: this->Makefile->IssueMessage( cmake::FATAL_ERROR, - this->Makefile->GetCMakeInstance()->GetPolicies() - ->GetRequiredPolicyError(cmPolicies::CMP0056) + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0056) ); case cmPolicies::NEW: // NEW behavior is to pass linker flags. diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index b4fad98..a51fb2a 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -257,8 +257,7 @@ static bool checkInterfaceDirs(const std::string &prepro, { case cmPolicies::WARN: messageType = cmake::WARNING; - e << target->GetMakefile()->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0041) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0041) << "\n"; break; case cmPolicies::OLD: continue; @@ -306,8 +305,7 @@ static bool checkInterfaceDirs(const std::string &prepro, case cmPolicies::WARN: { std::ostringstream s; - s << target->GetMakefile()->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0052) << "\n"; + s << cmPolicies::GetPolicyWarning(cmPolicies::CMP0052) << "\n"; s << "Directory:\n \"" << *li << "\"\nin " "INTERFACE_INCLUDE_DIRECTORIES of target \"" << target->GetName() << "\" is a subdirectory of the install " diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 14f397c..f695393 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -1056,16 +1056,14 @@ bool cmFileCommand::HandleGlobCommand(std::vector const& args, if(g.GetFollowedSymlinkCount() != 0) { this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, - this->Makefile->GetPolicies()-> - GetPolicyWarning(cmPolicies::CMP0009)); + cmPolicies::GetPolicyWarning(cmPolicies::CMP0009)); } break; case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: this->SetError("policy CMP0009 error"); this->Makefile->IssueMessage(cmake::FATAL_ERROR, - this->Makefile->GetPolicies()-> - GetRequiredPolicyError(cmPolicies::CMP0009)); + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0009)); return false; } } diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 2654851..7cfef02 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -395,8 +395,7 @@ struct CompilerIdNode : public cmGeneratorExpressionNode case cmPolicies::WARN: { std::ostringstream e; - e << context->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0044); + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0044); context->Makefile->GetCMakeInstance() ->IssueMessage(cmake::AUTHOR_WARNING, e.str(), context->Backtrace); @@ -1495,8 +1494,7 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode { case cmPolicies::WARN: mf->IssueMessage(cmake::AUTHOR_WARNING, - mf->GetPolicies()-> - GetPolicyWarning(policyForString(policy))); + cmPolicies::GetPolicyWarning(policyForString(policy))); case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::OLD: diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx index eed19f4..315e851 100644 --- a/Source/cmGetTargetPropertyCommand.cxx +++ b/Source/cmGetTargetPropertyCommand.cxx @@ -56,8 +56,7 @@ bool cmGetTargetPropertyCommand { case cmPolicies::WARN: issueMessage = true; - e << this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0045) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0045) << "\n"; case cmPolicies::OLD: break; case cmPolicies::REQUIRED_IF_USED: diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index cf3a037..1c90537 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -826,7 +826,6 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, if(strcmp(compilerId, "AppleClang") == 0) { - cmPolicies* policies = this->CMakeInstance->GetPolicies(); switch(mf->GetPolicyStatus(cmPolicies::CMP0025)) { case cmPolicies::WARN: @@ -834,7 +833,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0025")) { std::ostringstream w; - w << policies->GetPolicyWarning(cmPolicies::CMP0025) << "\n" + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0025) << "\n" "Converting " << lang << " compiler id \"AppleClang\" to \"Clang\" for compatibility." ; @@ -848,7 +847,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, case cmPolicies::REQUIRED_ALWAYS: mf->IssueMessage( cmake::FATAL_ERROR, - policies->GetRequiredPolicyError(cmPolicies::CMP0025) + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0025) ); case cmPolicies::NEW: // NEW behavior is to keep AppleClang. @@ -858,7 +857,6 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, if(strcmp(compilerId, "QCC") == 0) { - cmPolicies* policies = this->CMakeInstance->GetPolicies(); switch(mf->GetPolicyStatus(cmPolicies::CMP0047)) { case cmPolicies::WARN: @@ -866,7 +864,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0047")) { std::ostringstream w; - w << policies->GetPolicyWarning(cmPolicies::CMP0047) << "\n" + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0047) << "\n" "Converting " << lang << " compiler id \"QCC\" to \"GNU\" for compatibility." ; @@ -888,7 +886,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, case cmPolicies::REQUIRED_ALWAYS: mf->IssueMessage( cmake::FATAL_ERROR, - policies->GetRequiredPolicyError(cmPolicies::CMP0047) + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0047) ); case cmPolicies::NEW: // NEW behavior is to keep QCC. @@ -1327,9 +1325,7 @@ void cmGlobalGenerator::Generate() if(!this->CMP0042WarnTargets.empty()) { std::ostringstream w; - w << - (this->GetCMakeInstance()->GetPolicies()-> - GetPolicyWarning(cmPolicies::CMP0042)) << "\n"; + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0042) << "\n"; w << "MACOSX_RPATH is not specified for" " the following targets:\n"; for(std::set::iterator diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 074c4d1..678d60b 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1103,9 +1103,7 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) if (!warnExplicitDepends.empty()) { std::ostringstream w; - w << - (this->GetCMakeInstance()->GetPolicies()-> - GetPolicyWarning(cmPolicies::CMP0058)) << "\n" + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0058) << "\n" "This project specifies custom command DEPENDS on files " "in the build tree that are not specified as the OUTPUT or " "BYPRODUCTS of any add_custom_command or add_custom_target:\n" diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index 71dabaf..ce04d3e 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -104,8 +104,7 @@ bool cmIncludeCommand switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0024)) { case cmPolicies::WARN: - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0024)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0024) << "\n"; modal = "should"; case cmPolicies::OLD: break; diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index fac9641..f1e0eb8 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -1404,7 +1404,7 @@ bool cmInstallCommand::CheckCMP0006(bool& failure) { this->Makefile->IssueMessage( cmake::AUTHOR_WARNING, - this->Makefile->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0006) + cmPolicies::GetPolicyWarning(cmPolicies::CMP0006) ); } case cmPolicies::OLD: @@ -1418,8 +1418,7 @@ bool cmInstallCommand::CheckCMP0006(bool& failure) failure = true; this->Makefile->IssueMessage( cmake::FATAL_ERROR, - this->Makefile->GetPolicies() - ->GetRequiredPolicyError(cmPolicies::CMP0006) + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0006) ); break; } diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx index a21f517..f486bf7 100644 --- a/Source/cmLinkDirectoriesCommand.cxx +++ b/Source/cmLinkDirectoriesCommand.cxx @@ -40,18 +40,17 @@ void cmLinkDirectoriesCommand::AddLinkDir(std::string const& dir) e << "This command specifies the relative path\n" << " " << unixPath << "\n" << "as a link directory.\n"; - cmPolicies* policies = this->Makefile->GetPolicies(); switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0015)) { case cmPolicies::WARN: - e << policies->GetPolicyWarning(cmPolicies::CMP0015); + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0015); this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str()); case cmPolicies::OLD: // OLD behavior does not convert break; case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: - e << policies->GetRequiredPolicyError(cmPolicies::CMP0015); + e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0015); this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); case cmPolicies::NEW: // NEW behavior converts diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index d18269d..f96b4a8 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -121,8 +121,7 @@ bool cmListCommand::GetList(std::vector& list, // empty values list.clear(); cmSystemTools::ExpandListArgument(listString, list); - std::string warn = this->Makefile->GetPolicies()-> - GetPolicyWarning(cmPolicies::CMP0007); + std::string warn = cmPolicies::GetPolicyWarning(cmPolicies::CMP0007); warn += " List has value = ["; warn += listString; warn += "]."; @@ -143,8 +142,7 @@ bool cmListCommand::GetList(std::vector& list, case cmPolicies::REQUIRED_ALWAYS: this->Makefile->IssueMessage( cmake::FATAL_ERROR, - this->Makefile->GetPolicies() - ->GetRequiredPolicyError(cmPolicies::CMP0007) + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0007) ); return false; } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 6b705e8..88c88cd 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -209,7 +209,7 @@ void cmLocalGenerator::ReadInputFile() << "to work accidentally and is being allowed for " << "compatibility." << "\n" - << mf->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0014); + << cmPolicies::GetPolicyWarning(cmPolicies::CMP0014); mf->IssueMessage(cmake::AUTHOR_WARNING, e.str()); case cmPolicies::OLD: // OLD behavior does not warn. @@ -217,7 +217,7 @@ void cmLocalGenerator::ReadInputFile() case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: e << "\n" - << mf->GetPolicies()->GetRequiredPolicyError(cmPolicies::CMP0014); + << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0014); case cmPolicies::NEW: // NEW behavior prints the error. mf->IssueMessage(cmake::FATAL_ERROR, e.str()); @@ -2458,8 +2458,7 @@ bool cmLocalGenerator::GetShouldUseOldFlags(bool shared, "shared libraries and will use the " << flagsVar << " variable " "instead. This may cause errors if the original content of " << flagsVar << " was removed.\n" - << this->Makefile->GetPolicies()->GetPolicyWarning( - cmPolicies::CMP0018); + << cmPolicies::GetPolicyWarning(cmPolicies::CMP0018); this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str()); // fall through to OLD behaviour diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 5686b1b..29d891c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -591,14 +591,13 @@ void cmMakefile::IncludeScope::EnforceCMP0011() { // We check the setting of this policy again because the included // script might actually set this policy for its includer. - cmPolicies* policies = this->Makefile->GetPolicies(); switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0011)) { case cmPolicies::WARN: // Warn because the user did not set this policy. { std::ostringstream w; - w << policies->GetPolicyWarning(cmPolicies::CMP0011) << "\n" + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0011) << "\n" << "The included script\n " << this->File << "\n" << "affects policy settings. " << "CMake is implying the NO_POLICY_SCOPE option for compatibility, " @@ -610,7 +609,7 @@ void cmMakefile::IncludeScope::EnforceCMP0011() case cmPolicies::REQUIRED_ALWAYS: { std::ostringstream e; - e << policies->GetRequiredPolicyError(cmPolicies::CMP0011) << "\n" + e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0011) << "\n" << "The included script\n " << this->File << "\n" << "affects policy settings, so it requires this policy to be set."; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); @@ -879,8 +878,7 @@ cmMakefile::AddCustomCommandToTarget(const std::string& target, switch(this->GetPolicyStatus(cmPolicies::CMP0040)) { case cmPolicies::WARN: - e << (this->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0040)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0040) << "\n"; issueMessage = true; case cmPolicies::OLD: break; @@ -1438,7 +1436,7 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove) case cmPolicies::WARN: this->IssueMessage( cmake::AUTHOR_WARNING, - this->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0005) + cmPolicies::GetPolicyWarning(cmPolicies::CMP0005) ); case cmPolicies::OLD: // OLD behavior is to not escape the value. We should not @@ -1448,7 +1446,7 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove) case cmPolicies::REQUIRED_ALWAYS: this->IssueMessage( cmake::FATAL_ERROR, - this->GetPolicies()->GetRequiredPolicyError(cmPolicies::CMP0005) + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0005) ); return false; case cmPolicies::NEW: @@ -2335,7 +2333,7 @@ void cmMakefile::ExpandVariablesCMP0019() if(!w.str().empty()) { std::ostringstream m; - m << this->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0019) + m << cmPolicies::GetPolicyWarning(cmPolicies::CMP0019) << "\n" << "The following variable evaluations were encountered:\n" << w.str(); @@ -2593,7 +2591,7 @@ const char *cmMakefile::ExpandVariablesInString(std::string& source, else if(compareResults && (newResult != source || newError != mtype)) { std::string msg = - this->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0053); + cmPolicies::GetPolicyWarning(cmPolicies::CMP0053); msg += "\n"; std::string msg_input = original; @@ -2745,9 +2743,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringOld( switch(this->GetPolicyStatus(cmPolicies::CMP0010)) { case cmPolicies::WARN: - error << "\n" - << (this->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0010)); + error << "\n" << cmPolicies::GetPolicyWarning(cmPolicies::CMP0010); case cmPolicies::OLD: // OLD behavior is to just warn and continue. mtype = cmake::AUTHOR_WARNING; @@ -2755,8 +2751,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringOld( case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: error << "\n" - << (this->GetPolicies() - ->GetRequiredPolicyError(cmPolicies::CMP0010)); + << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0010); case cmPolicies::NEW: // NEW behavior is to report the error. break; @@ -3820,7 +3815,7 @@ std::string cmMakefile::GetModulesFile(const char* filename) const << moduleInCMakeModulePath << " (found via CMAKE_MODULE_PATH) which shadows " << moduleInCMakeRoot << ". This may cause errors later on .\n" - << this->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0017); + << cmPolicies::GetPolicyWarning(cmPolicies::CMP0017); this->IssueMessage(cmake::AUTHOR_WARNING, e.str()); // break; // fall through to OLD behaviour @@ -4188,7 +4183,7 @@ const char *cmMakefile::GetProperty(const std::string& prop, switch(this->GetPolicyStatus(cmPolicies::CMP0059)) { case cmPolicies::WARN: - this->IssueMessage(cmake::AUTHOR_WARNING, this->GetPolicies()-> + this->IssueMessage(cmake::AUTHOR_WARNING, cmPolicies:: GetPolicyWarning(cmPolicies::CMP0059)); case cmPolicies::OLD: output += this->DefineFlagsOrig; @@ -4558,14 +4553,14 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg, switch (this->GetPolicyStatus(cmPolicies::CMP0002)) { case cmPolicies::WARN: - this->IssueMessage(cmake::AUTHOR_WARNING, this->GetPolicies()-> + this->IssueMessage(cmake::AUTHOR_WARNING, cmPolicies:: GetPolicyWarning(cmPolicies::CMP0002)); case cmPolicies::OLD: return true; case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: this->IssueMessage(cmake::FATAL_ERROR, - this->GetPolicies()->GetRequiredPolicyError(cmPolicies::CMP0002) + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0002) ); return true; case cmPolicies::NEW: @@ -4637,7 +4632,7 @@ bool cmMakefile::EnforceUniqueDir(const std::string& srcPath, { case cmPolicies::WARN: // Print the warning. - e << this->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0013) + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0013) << "\n" << "The binary directory\n" << " " << binPath << "\n" @@ -4654,7 +4649,7 @@ bool cmMakefile::EnforceUniqueDir(const std::string& srcPath, return true; case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: - e << this->GetPolicies()->GetRequiredPolicyError(cmPolicies::CMP0013) + e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0013) << "\n"; case cmPolicies::NEW: // NEW behavior prints the error. @@ -4757,7 +4752,7 @@ cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id) const { return cur; } - cmPolicies::PolicyStatus def = this->GetPolicies()->GetPolicyStatus(id); + cmPolicies::PolicyStatus def = cmPolicies::GetPolicyStatus(id); if(def == cmPolicies::REQUIRED_ALWAYS || def == cmPolicies::REQUIRED_IF_USED) { @@ -4792,7 +4787,7 @@ cmMakefile::GetPolicyStatusInternal(cmPolicies::PolicyID id) const } // The policy is not set. Use the default for this CMake version. - return this->GetPolicies()->GetPolicyStatus(id); + return cmPolicies::GetPolicyStatus(id); } //---------------------------------------------------------------------------- @@ -4815,7 +4810,7 @@ bool cmMakefile::SetPolicy(const char *id, cmPolicies::PolicyStatus status) { cmPolicies::PolicyID pid; - if (!this->GetPolicies()->GetPolicyID(id, /* out */ pid)) + if (!cmPolicies::GetPolicyID(id, /* out */ pid)) { std::ostringstream e; e << "Policy \"" << id << "\" is not known to this version of CMake."; @@ -4831,11 +4826,11 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, { // A REQUIRED_ALWAYS policy may be set only to NEW. if(status != cmPolicies::NEW && - this->GetPolicies()->GetPolicyStatus(id) == + cmPolicies::GetPolicyStatus(id) == cmPolicies::REQUIRED_ALWAYS) { std::string msg = - this->GetPolicies()->GetRequiredAlwaysPolicyError(id); + cmPolicies::GetRequiredAlwaysPolicyError(id); this->IssueMessage(cmake::FATAL_ERROR, msg); return false; } @@ -4937,18 +4932,7 @@ void cmMakefile::PopPolicyBarrier(bool reportError) //---------------------------------------------------------------------------- bool cmMakefile::SetPolicyVersion(const char *version) { - return this->GetCMakeInstance()->GetPolicies()-> - ApplyPolicyVersion(this,version); -} - -//---------------------------------------------------------------------------- -cmPolicies *cmMakefile::GetPolicies() const -{ - if (!this->GetCMakeInstance()) - { - return 0; - } - return this->GetCMakeInstance()->GetPolicies(); + return cmPolicies::ApplyPolicyVersion(this,version); } //---------------------------------------------------------------------------- diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index afacc1b..a9029a0 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -216,8 +216,7 @@ bool cmProjectCommand if(!vw.empty()) { std::ostringstream w; - w << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0048)) + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0048) << "\nThe following variable(s) would be set to empty:" << vw; this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index f69e9ae..8d1367e 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -974,8 +974,7 @@ std::string cmTarget::ProcessSourceItemCMP0049(const std::string& s) switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0049)) { case cmPolicies::WARN: - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0049)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0049) << "\n"; break; case cmPolicies::OLD: noMessage = true; @@ -2008,8 +2007,7 @@ static void processIncludeDirectories(cmTarget const* tgt, switch(tgt->GetPolicyStatusCMP0027()) { case cmPolicies::WARN: - e << (mf->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0027)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0027) << "\n"; case cmPolicies::OLD: messageType = cmake::AUTHOR_WARNING; break; @@ -2049,8 +2047,7 @@ static void processIncludeDirectories(cmTarget const* tgt, { case cmPolicies::WARN: { - e << (mf->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0021)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0021) << "\n"; messageType = cmake::AUTHOR_WARNING; } break; @@ -2398,8 +2395,7 @@ void cmTarget::GetCompileDefinitions(std::vector &list, case cmPolicies::WARN: { std::ostringstream e; - e << this->Makefile->GetCMakeInstance()->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0043); + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0043); this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str()); } @@ -2874,8 +2870,7 @@ bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const switch (context->GetPolicyStatus(cmPolicies::CMP0026)) { case cmPolicies::WARN: - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0026)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0026) << "\n"; modal = "should"; case cmPolicies::OLD: break; @@ -3138,8 +3133,7 @@ const char *cmTarget::GetProperty(const std::string& prop, switch(context->GetPolicyStatus(cmPolicies::CMP0051)) { case cmPolicies::WARN: - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0051)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0051) << "\n"; noMessage = false; case cmPolicies::OLD: break; @@ -3236,8 +3230,7 @@ public: { case cmPolicies::WARN: { - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0028)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0028) << "\n"; messageType = cmake::AUTHOR_WARNING; } break; @@ -5993,9 +5986,7 @@ cmTargetInternals::ComputeLinkInterfaceLibraries( && strcmp(newExplicitLibraries, explicitLibraries) != 0) { std::ostringstream w; - w << - (thisTarget->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0022)) << "\n" + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0022) << "\n" "Target \"" << thisTarget->GetName() << "\" has an " "INTERFACE_LINK_LIBRARIES property which differs from its " << linkIfaceProp << " properties." @@ -6064,9 +6055,7 @@ cmTargetInternals::ComputeLinkInterfaceLibraries( { newLibraries = "(empty)"; } std::ostringstream w; - w << - (thisTarget->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0022)) << "\n" + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0022) << "\n" "Target \"" << thisTarget->GetName() << "\" has an " "INTERFACE_LINK_LIBRARIES property. " "This should be preferred as the source of the link interface " @@ -6323,8 +6312,7 @@ cmTargetInternals::ComputeLinkImplementationLibraries( { case cmPolicies::WARN: { - e << (thisTarget->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0038)) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0038) << "\n"; messageType = cmake::AUTHOR_WARNING; } break; @@ -6461,8 +6449,7 @@ std::string cmTarget::CheckCMP0004(std::string const& item) const case cmPolicies::WARN: { std::ostringstream w; - w << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0004)) << "\n" + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0004) << "\n" << "Target \"" << this->GetName() << "\" links to item \"" << item << "\" which has leading or trailing whitespace."; cm->IssueMessage(cmake::AUTHOR_WARNING, w.str(), @@ -6483,8 +6470,7 @@ std::string cmTarget::CheckCMP0004(std::string const& item) const case cmPolicies::REQUIRED_ALWAYS: { std::ostringstream e; - e << (this->Makefile->GetPolicies() - ->GetRequiredPolicyError(cmPolicies::CMP0004)) << "\n" + e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0004) << "\n" << "Target \"" << this->GetName() << "\" links to item \"" << item << "\" which has leading or trailing whitespace."; cm->IssueMessage(cmake::FATAL_ERROR, e.str(), this->GetBacktrace()); diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 9be7d46..df37d66 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -58,16 +58,14 @@ bool cmTargetLinkLibrariesCommand e << "\n" << "CMake does not support this but it used to work accidentally " << "and is being allowed for compatibility." - << "\n" << this->Makefile->GetPolicies()-> - GetPolicyWarning(cmPolicies::CMP0016); + << "\n" << cmPolicies::GetPolicyWarning(cmPolicies::CMP0016); break; case cmPolicies::OLD: // OLD behavior does not warn. t = cmake::MESSAGE; break; case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: - e << "\n" << this->Makefile->GetPolicies()-> - GetRequiredPolicyError(cmPolicies::CMP0016); + e << "\n" << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0016); break; case cmPolicies::NEW: // NEW behavior prints the error. break; @@ -108,8 +106,7 @@ bool cmTargetLinkLibrariesCommand switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0039)) { case cmPolicies::WARN: - e << this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0039) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0039) << "\n"; modal = "should"; case cmPolicies::OLD: break; @@ -379,8 +376,7 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0023)) { case cmPolicies::WARN: - e << this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0023) << "\n"; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0023) << "\n"; modal = "should"; case cmPolicies::OLD: break; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=13981f20688279b4e10faca67b7020946c9ef733 commit 13981f20688279b4e10faca67b7020946c9ef733 Author: Stephen Kelly AuthorDate: Sun May 3 10:11:05 2015 +0200 Commit: Stephen Kelly CommitDate: Mon May 4 22:32:20 2015 +0200 cmPolicies: Make all API static. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 51bcde3..c95520f 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -243,7 +243,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, { if (isPolicyNewerThan(pid, majorVer, minorVer, patchVer)) { - if(this->GetPolicyStatus(pid) == cmPolicies::REQUIRED_ALWAYS) + if(cmPolicies::GetPolicyStatus(pid) == cmPolicies::REQUIRED_ALWAYS) { ancientPolicies.push_back(pid); } diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 1e2849d..fee7dd9 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -250,22 +250,22 @@ public: }; ///! convert a string policy ID into a number - bool GetPolicyID(const char *id, /* out */ cmPolicies::PolicyID &pid); + static bool GetPolicyID(const char *id, /* out */ cmPolicies::PolicyID &pid); ///! Get the default status for a policy - cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id); + static cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id); ///! Set a policy level for this listfile - bool ApplyPolicyVersion(cmMakefile *mf, const char *version); + static bool ApplyPolicyVersion(cmMakefile *mf, const char *version); ///! return a warning string for a given policy - std::string GetPolicyWarning(cmPolicies::PolicyID id); + static std::string GetPolicyWarning(cmPolicies::PolicyID id); ///! return an error string for when a required policy is unspecified - std::string GetRequiredPolicyError(cmPolicies::PolicyID id); + static std::string GetRequiredPolicyError(cmPolicies::PolicyID id); ///! return an error string for when a required policy is unspecified - std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id); + static std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id); /** Represent a set of policy values. */ typedef std::map PolicyMap; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=23e2bcc8dba21b532ebbde20518f8a9f2d312103 commit 23e2bcc8dba21b532ebbde20518f8a9f2d312103 Author: Stephen Kelly AuthorDate: Sun May 3 10:11:01 2015 +0200 Commit: Stephen Kelly CommitDate: Mon May 4 22:32:20 2015 +0200 cmPolicies: Remove unused DefinePolicy method. Policies are no longer defined at runtime. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 5d023ee..51bcde3 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -121,16 +121,6 @@ const char* idToShortDescription(cmPolicies::PolicyID id) return 0; } -void cmPolicies::DefinePolicy(cmPolicies::PolicyID, - const char *, - const char *, - unsigned int, - unsigned int, - unsigned int, - cmPolicies::PolicyStatus) -{ -} - //---------------------------------------------------------------------------- static void DiagnoseAncientPolicies( std::vector const& ancient, diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 50ffe81..1e2849d 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -255,15 +255,6 @@ public: ///! Get the default status for a policy cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id); - ///! Define a Policy for CMake - void DefinePolicy(cmPolicies::PolicyID id, - const char *stringID, - const char *shortDescription, - unsigned int majorVersionIntroduced, - unsigned int minorVersionIntroduced, - unsigned int patchVersionIntroduced, - cmPolicies::PolicyStatus status); - ///! Set a policy level for this listfile bool ApplyPolicyVersion(cmMakefile *mf, const char *version); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5641ba4fcaba322e6f189e33eaccc4621d6ba99d commit 5641ba4fcaba322e6f189e33eaccc4621d6ba99d Author: Stephen Kelly AuthorDate: Sun May 3 10:10:42 2015 +0200 Commit: Stephen Kelly CommitDate: Mon May 4 22:32:20 2015 +0200 cmPolicies: Remove unused cmPolicy class. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 12f945a..5d023ee 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -121,337 +121,7 @@ const char* idToShortDescription(cmPolicies::PolicyID id) return 0; } -class cmPolicy -{ -public: - cmPolicy(cmPolicies::PolicyID iD) - { - this->ID = iD; - } - - cmPolicies::PolicyID ID; -}; - -cmPolicies::cmPolicies() -{ - // define all the policies - this->DefinePolicy( - CMP0000, "CMP0000", - "A minimum required CMake version must be specified.", - 2,6,0, cmPolicies::WARN - ); - - this->DefinePolicy( - CMP0001, "CMP0001", - "CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.", - 2,6,0, cmPolicies::WARN - ); - - this->DefinePolicy( - CMP0002, "CMP0002", - "Logical target names must be globally unique.", - 2,6,0, cmPolicies::WARN - ); - - this->DefinePolicy( - CMP0003, "CMP0003", - "Libraries linked via full path no longer produce linker search paths.", - 2,6,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0004, "CMP0004", - "Libraries linked may not have leading or trailing whitespace.", - 2,6,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0005, "CMP0005", - "Preprocessor definition values are now escaped automatically.", - 2,6,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0006, "CMP0006", - "Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.", - 2,6,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0007, "CMP0007", - "list command no longer ignores empty elements.", - 2,6,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0008, "CMP0008", - "Libraries linked by full-path must have a valid library file name.", - 2,6,1, cmPolicies::WARN); - - this->DefinePolicy( - CMP0009, "CMP0009", - "FILE GLOB_RECURSE calls should not follow symlinks by default.", - 2,6,2, cmPolicies::WARN); - - this->DefinePolicy( - CMP0010, "CMP0010", - "Bad variable reference syntax is an error.", - 2,6,3, cmPolicies::WARN); - - this->DefinePolicy( - CMP0011, "CMP0011", - "Included scripts do automatic cmake_policy PUSH and POP.", - 2,6,3, cmPolicies::WARN); - - this->DefinePolicy( - CMP0012, "CMP0012", - "if() recognizes numbers and boolean constants.", - 2,8,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0013, "CMP0013", - "Duplicate binary directories are not allowed.", - 2,8,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0014, "CMP0014", - "Input directories must have CMakeLists.txt.", - 2,8,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0015, "CMP0015", - "link_directories() treats paths relative to the source dir.", - 2,8,1, cmPolicies::WARN); - - this->DefinePolicy( - CMP0016, "CMP0016", - "target_link_libraries() reports error if its only argument " - "is not a target.", - 2,8,3, cmPolicies::WARN); - - this->DefinePolicy( - CMP0017, "CMP0017", - "Prefer files from the CMake module directory when including from there.", - 2,8,4, cmPolicies::WARN); - - this->DefinePolicy( - CMP0018, "CMP0018", - "Ignore CMAKE_SHARED_LIBRARY__FLAGS variable.", - 2,8,9, cmPolicies::WARN); - - this->DefinePolicy( - CMP0019, "CMP0019", - "Do not re-expand variables in include and link information.", - 2,8,11, cmPolicies::WARN); - - this->DefinePolicy( - CMP0020, "CMP0020", - "Automatically link Qt executables to qtmain target on Windows.", - 2,8,11, cmPolicies::WARN); - - this->DefinePolicy( - CMP0021, "CMP0021", - "Fatal error on relative paths in INCLUDE_DIRECTORIES target property.", - 2,8,12, cmPolicies::WARN); - - this->DefinePolicy( - CMP0022, "CMP0022", - "INTERFACE_LINK_LIBRARIES defines the link interface.", - 2,8,12, cmPolicies::WARN); - - this->DefinePolicy( - CMP0023, "CMP0023", - "Plain and keyword target_link_libraries signatures cannot be mixed.", - 2,8,12, cmPolicies::WARN); - - this->DefinePolicy( - CMP0024, "CMP0024", - "Disallow include export result.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0025, "CMP0025", - "Compiler id for Apple Clang is now AppleClang.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0026, "CMP0026", - "Disallow use of the LOCATION target property.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0027, "CMP0027", - "Conditionally linked imported targets with missing include directories.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0028, "CMP0028", - "Double colon in target name means ALIAS or IMPORTED target.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0029, "CMP0029", - "The subdir_depends command should not be called.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0030, "CMP0030", - "The use_mangled_mesa command should not be called.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0031, "CMP0031", - "The load_command command should not be called.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0032, "CMP0032", - "The output_required_files command should not be called.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0033, "CMP0033", - "The export_library_dependencies command should not be called.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0034, "CMP0034", - "The utility_source command should not be called.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0035, "CMP0035", - "The variable_requires command should not be called.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0036, "CMP0036", - "The build_name command should not be called.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0037, "CMP0037", - "Target names should not be reserved and should match a validity pattern.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0038, "CMP0038", - "Targets may not link directly to themselves.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0039, "CMP0039", - "Utility targets may not have link dependencies.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0040, "CMP0040", - "The target in the TARGET signature of add_custom_command() must exist.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0041, "CMP0041", - "Error on relative include with generator expression.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0042, "CMP0042", - "MACOSX_RPATH is enabled by default.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0043, "CMP0043", - "Ignore COMPILE_DEFINITIONS_ properties.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0044, "CMP0044", - "Case sensitive _COMPILER_ID generator expressions.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0045, "CMP0045", - "Error on non-existent target in get_target_property.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0046, "CMP0046", - "Error on non-existent dependency in add_dependencies.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0047, "CMP0047", - "Use QCC compiler id for the qcc drivers on QNX.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0048, "CMP0048", - "project() command manages VERSION variables.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0049, "CMP0049", - "Do not expand variables in target source entries.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0050, "CMP0050", - "Disallow add_custom_command SOURCE signatures.", - 3,0,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0051, "CMP0051", - "List TARGET_OBJECTS in SOURCES target property.", - 3,1,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0052, "CMP0052", - "Reject source and build dirs in installed " - "INTERFACE_INCLUDE_DIRECTORIES.", - 3,1,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0053, "CMP0053", - "Simplify variable reference and escape sequence evaluation.", - 3,1,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0054, "CMP0054", - "Only interpret if() arguments as variables or keywords when unquoted.", - 3,1,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0055, "CMP0055", - "Strict checking for break() command.", - 3,2,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0056, "CMP0056", - "Honor link flags in try_compile() source-file signature.", - 3,2,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0058, "CMP0058", - "Ninja requires custom command byproducts to be explicit.", - 3,3,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0059, "CMP0059", - "Do no treat DEFINITIONS as a built-in directory property.", - 3,3,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0060, "CMP0060", - "Link libraries by full path even in implicit directories.", - 3,3,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0057, "CMP0057", - "Support new IN_LIST if() operator.", - 3,3,0, cmPolicies::WARN); -} - -cmPolicies::~cmPolicies() -{ - cmDeleteAll(this->Policies); -} - -void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, +void cmPolicies::DefinePolicy(cmPolicies::PolicyID, const char *, const char *, unsigned int, @@ -459,7 +129,6 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, unsigned int, cmPolicies::PolicyStatus) { - this->Policies[iD] = new cmPolicy(iD); } //---------------------------------------------------------------------------- diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 2b96939..50ffe81 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -223,9 +223,6 @@ class cmPolicy; class cmPolicies { public: - cmPolicies(); - ~cmPolicies(); - /// Status of a policy enum PolicyStatus { OLD, ///< Use old behavior @@ -281,10 +278,6 @@ public: /** Represent a set of policy values. */ typedef std::map PolicyMap; - - private: - // might have to make these internal for VS6 not sure yet - std::map Policies; }; #endif http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3de54497030b7d8f40f219c0fdfe991e2a9041be commit 3de54497030b7d8f40f219c0fdfe991e2a9041be Author: Stephen Kelly AuthorDate: Sun May 3 10:10:42 2015 +0200 Commit: Stephen Kelly CommitDate: Mon May 4 22:32:19 2015 +0200 cmPolicies: Loop over all policies using enum constants. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 75d12d4..12f945a 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -579,20 +579,20 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, // now loop over all the policies and set them as appropriate std::vector ancientPolicies; - for(std::map::iterator i - = this->Policies.begin(); i != this->Policies.end(); ++i) + for(PolicyID pid = cmPolicies::CMP0000; + pid != cmPolicies::CMPCOUNT; pid = PolicyID(pid+1)) { - if (isPolicyNewerThan(i->first, majorVer, minorVer, patchVer)) + if (isPolicyNewerThan(pid, majorVer, minorVer, patchVer)) { - if(this->GetPolicyStatus(i->first) == cmPolicies::REQUIRED_ALWAYS) + if(this->GetPolicyStatus(pid) == cmPolicies::REQUIRED_ALWAYS) { - ancientPolicies.push_back(i->first); + ancientPolicies.push_back(pid); } else { cmPolicies::PolicyStatus status = cmPolicies::WARN; - if(!GetPolicyDefault(mf, idToString(i->first), &status) || - !mf->SetPolicy(i->first, status)) + if(!GetPolicyDefault(mf, idToString(pid), &status) || + !mf->SetPolicy(pid, status)) { return false; } @@ -600,7 +600,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, } else { - if (!mf->SetPolicy(i->first, cmPolicies::NEW)) + if (!mf->SetPolicy(pid, cmPolicies::NEW)) { return false; } http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=387aff200c94073560a961cd2971ab6826347d4d commit 387aff200c94073560a961cd2971ab6826347d4d Author: Stephen Kelly AuthorDate: Sun May 3 10:10:38 2015 +0200 Commit: Stephen Kelly CommitDate: Mon May 4 22:32:19 2015 +0200 cmPolicies: Trivialize GetPolicyStatus method. It would be possible to implement this with an XMacro and switch statement, but every codepath currently would still return WARN. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 10f85ac..75d12d4 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -124,15 +124,12 @@ const char* idToShortDescription(cmPolicies::PolicyID id) class cmPolicy { public: - cmPolicy(cmPolicies::PolicyID iD, - cmPolicies::PolicyStatus status) + cmPolicy(cmPolicies::PolicyID iD) { this->ID = iD; - this->Status = status; } cmPolicies::PolicyID ID; - cmPolicies::PolicyStatus Status; }; cmPolicies::cmPolicies() @@ -460,10 +457,9 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, unsigned int, unsigned int, unsigned int, - cmPolicies::PolicyStatus status) + cmPolicies::PolicyStatus) { - this->Policies[iD] = new cmPolicy(iD, - status); + this->Policies[iD] = new cmPolicy(iD); } //---------------------------------------------------------------------------- @@ -664,18 +660,9 @@ std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id) ///! Get the default status for a policy cmPolicies::PolicyStatus -cmPolicies::GetPolicyStatus(cmPolicies::PolicyID id) +cmPolicies::GetPolicyStatus(cmPolicies::PolicyID) { - // if the policy is not know then what? - std::map::iterator pos = - this->Policies.find(id); - if (pos == this->Policies.end()) - { - // TODO is this right? - return cmPolicies::WARN; - } - - return pos->second->Status; + return cmPolicies::WARN; } //---------------------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dbf680d670e399cc3b042721a1179fba0429073b commit dbf680d670e399cc3b042721a1179fba0429073b Author: Stephen Kelly AuthorDate: Sun May 3 10:27:36 2015 +0200 Commit: Stephen Kelly CommitDate: Mon May 4 22:32:19 2015 +0200 cmPolicies: Use more-direct ID access. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 2d7c710..10f85ac 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -596,7 +596,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, { cmPolicies::PolicyStatus status = cmPolicies::WARN; if(!GetPolicyDefault(mf, idToString(i->first), &status) || - !mf->SetPolicy(i->second->ID, status)) + !mf->SetPolicy(i->first, status)) { return false; } @@ -604,7 +604,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, } else { - if (!mf->SetPolicy(i->second->ID, cmPolicies::NEW)) + if (!mf->SetPolicy(i->first, cmPolicies::NEW)) { return false; } http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8c204133e5b7dc278de64c66a6ce0be8ec4ab6f4 commit 8c204133e5b7dc278de64c66a6ce0be8ec4ab6f4 Author: Stephen Kelly AuthorDate: Sun May 3 10:25:14 2015 +0200 Commit: Stephen Kelly CommitDate: Mon May 4 22:32:19 2015 +0200 cmPolicies: Implement in terms of public API. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index acb591b..2d7c710 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -588,7 +588,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, { if (isPolicyNewerThan(i->first, majorVer, minorVer, patchVer)) { - if(i->second->Status == cmPolicies::REQUIRED_ALWAYS) + if(this->GetPolicyStatus(i->first) == cmPolicies::REQUIRED_ALWAYS) { ancientPolicies.push_back(i->first); } http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e3a8c0291e6ae364365bfe48f12c6a5f4ec0e76f commit e3a8c0291e6ae364365bfe48f12c6a5f4ec0e76f Author: Stephen Kelly AuthorDate: Sun May 3 10:10:35 2015 +0200 Commit: Stephen Kelly CommitDate: Mon May 4 22:32:19 2015 +0200 cmPolicies: Make private method file-static. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index c1a2d2f..acb591b 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -467,6 +467,31 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, } //---------------------------------------------------------------------------- +static void DiagnoseAncientPolicies( + std::vector const& ancient, + unsigned int majorVer, + unsigned int minorVer, + unsigned int patchVer, + cmMakefile* mf) +{ + std::ostringstream e; + e << "The project requests behavior compatible with CMake version \"" + << majorVer << "." << minorVer << "." << patchVer + << "\", which requires the OLD behavior for some policies:\n"; + for(std::vector::const_iterator + i = ancient.begin(); i != ancient.end(); ++i) + { + e << " " << idToString(*i) << ": " << idToShortDescription(*i) << "\n"; + } + e << "However, this version of CMake no longer supports the OLD " + << "behavior for these policies. " + << "Please either update your CMakeLists.txt files to conform to " + << "the new behavior or use an older version of CMake that still " + << "supports the old behavior."; + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); +} + +//---------------------------------------------------------------------------- static bool GetPolicyDefault(cmMakefile* mf, std::string const& policy, cmPolicies::PolicyStatus* defaultSetting) { @@ -589,8 +614,8 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, // Make sure the project does not use any ancient policies. if(!ancientPolicies.empty()) { - this->DiagnoseAncientPolicies(ancientPolicies, - majorVer, minorVer, patchVer, mf); + DiagnoseAncientPolicies(ancientPolicies, + majorVer, minorVer, patchVer, mf); cmSystemTools::SetFatalErrorOccured(); return false; } @@ -671,28 +696,3 @@ cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id) << "Run cmake --help-policy " << pid << " for more information."; return e.str(); } - -//---------------------------------------------------------------------------- -void -cmPolicies::DiagnoseAncientPolicies(std::vector const& ancient, - unsigned int majorVer, - unsigned int minorVer, - unsigned int patchVer, - cmMakefile* mf) -{ - std::ostringstream e; - e << "The project requests behavior compatible with CMake version \"" - << majorVer << "." << minorVer << "." << patchVer - << "\", which requires the OLD behavior for some policies:\n"; - for(std::vector::const_iterator - i = ancient.begin(); i != ancient.end(); ++i) - { - e << " " << idToString(*i) << ": " << idToShortDescription(*i) << "\n"; - } - e << "However, this version of CMake no longer supports the OLD " - << "behavior for these policies. " - << "Please either update your CMakeLists.txt files to conform to " - << "the new behavior or use an older version of CMake that still " - << "supports the old behavior."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); -} diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index df04fdf..2b96939 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -285,10 +285,6 @@ public: private: // might have to make these internal for VS6 not sure yet std::map Policies; - - void DiagnoseAncientPolicies(std::vector const& ancient, - unsigned int majorVer, unsigned int minorVer, - unsigned int patchVer, cmMakefile* mf); }; #endif http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cb765af0499d1ad51b7e4d3ff45f1e40d6ca843b commit cb765af0499d1ad51b7e4d3ff45f1e40d6ca843b Author: Stephen Kelly AuthorDate: Sun May 3 10:10:31 2015 +0200 Commit: Stephen Kelly CommitDate: Mon May 4 22:32:18 2015 +0200 cmPolicies: Implement short description access with XMacros. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 5e58f23..c1a2d2f 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -49,6 +49,10 @@ static bool stringToId(const char* input, cmPolicies::PolicyID& pid) #define CM_FOR_EACH_POLICY_ID_VERSION(POLICY) \ CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID_VERSION) +#define CM_SELECT_ID_DOC(F, A1, A2, A3, A4, A5, A6) F(A1, A2) +#define CM_FOR_EACH_POLICY_ID_DOC(POLICY) \ + CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID_DOC) + static const char* idToString(cmPolicies::PolicyID id) { switch(id) @@ -102,20 +106,32 @@ static bool isPolicyNewerThan(cmPolicies::PolicyID id, return false; } +const char* idToShortDescription(cmPolicies::PolicyID id) +{ + switch(id) + { +#define POLICY_CASE(ID, SHORT_DESCRIPTION) \ + case cmPolicies::ID: \ + return SHORT_DESCRIPTION; + CM_FOR_EACH_POLICY_ID_DOC(POLICY_CASE) +#undef POLICY_CASE + case cmPolicies::CMPCOUNT: + return 0; + } + return 0; +} + class cmPolicy { public: cmPolicy(cmPolicies::PolicyID iD, - const char *shortDescription, cmPolicies::PolicyStatus status) { this->ID = iD; - this->ShortDescription = shortDescription; this->Status = status; } cmPolicies::PolicyID ID; - std::string ShortDescription; cmPolicies::PolicyStatus Status; }; @@ -440,14 +456,13 @@ cmPolicies::~cmPolicies() void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, const char *, - const char *shortDescription, + const char *, unsigned int, unsigned int, unsigned int, cmPolicies::PolicyStatus status) { this->Policies[iD] = new cmPolicy(iD, - shortDescription, status); } @@ -591,13 +606,10 @@ bool cmPolicies::GetPolicyID(const char *id, cmPolicies::PolicyID &pid) ///! return a warning string for a given policy std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id) { - std::map::iterator pos = - this->Policies.find(id); - std::ostringstream msg; msg << "Policy " << idToString(id) << " is not set: " - "" << pos->second->ShortDescription << " " + "" << idToShortDescription(id) << " " "Run \"cmake --help-policy " << idToString(id) << "\" for " "policy details. " "Use the cmake_policy command to set the policy " @@ -609,13 +621,10 @@ std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id) ///! return an error string for when a required policy is unspecified std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id) { - std::map::iterator pos = - this->Policies.find(id); - std::ostringstream error; error << "Policy " << idToString(id) << " is not set to NEW: " - "" << pos->second->ShortDescription << " " + "" << idToShortDescription(id) << " " "Run \"cmake --help-policy " << idToString(id) << "\" for " "policy details. " "CMake now requires this policy to be set to NEW by the project. " @@ -678,8 +687,7 @@ cmPolicies::DiagnoseAncientPolicies(std::vector const& ancient, for(std::vector::const_iterator i = ancient.begin(); i != ancient.end(); ++i) { - cmPolicy const* policy = this->Policies[*i]; - e << " " << idToString(*i) << ": " << policy->ShortDescription << "\n"; + e << " " << idToString(*i) << ": " << idToShortDescription(*i) << "\n"; } e << "However, this version of CMake no longer supports the OLD " << "behavior for these policies. " http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5df267fa1dc5f8389f571eb6841e51b8fe333b2c commit 5df267fa1dc5f8389f571eb6841e51b8fe333b2c Author: Stephen Kelly AuthorDate: Sun May 3 10:10:27 2015 +0200 Commit: Stephen Kelly CommitDate: Mon May 4 22:32:18 2015 +0200 cmPolicies: Implement version check with XMacro. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index bd43cc3..5e58f23 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -79,41 +79,43 @@ static const char* idToVersion(cmPolicies::PolicyID id) return 0; } +static bool isPolicyNewerThan(cmPolicies::PolicyID id, + unsigned int majorV, + unsigned int minorV, + unsigned int patchV) +{ + switch(id) + { +#define POLICY_CASE(ID, V_MAJOR, V_MINOR, V_PATCH) \ + case cmPolicies::ID: \ + return (majorV < V_MAJOR || \ + (majorV == V_MAJOR && \ + minorV + 1 < V_MINOR + 1) || \ + (majorV == V_MAJOR && \ + minorV == V_MINOR && \ + patchV + 1 < V_PATCH + 1)); + CM_FOR_EACH_POLICY_ID_VERSION(POLICY_CASE) +#undef POLICY_CASE + case cmPolicies::CMPCOUNT: + return false; + } + return false; +} + class cmPolicy { public: cmPolicy(cmPolicies::PolicyID iD, const char *shortDescription, - unsigned int majorVersionIntroduced, - unsigned int minorVersionIntroduced, - unsigned int patchVersionIntroduced, cmPolicies::PolicyStatus status) { this->ID = iD; this->ShortDescription = shortDescription; - this->MajorVersionIntroduced = majorVersionIntroduced; - this->MinorVersionIntroduced = minorVersionIntroduced; - this->PatchVersionIntroduced = patchVersionIntroduced; this->Status = status; } - bool IsPolicyNewerThan(unsigned int majorV, - unsigned int minorV, - unsigned int patchV) - { - return (majorV < this->MajorVersionIntroduced || - (majorV == this->MajorVersionIntroduced && - minorV < this->MinorVersionIntroduced) || - (majorV == this->MajorVersionIntroduced && - minorV == this->MinorVersionIntroduced && - patchV < this->PatchVersionIntroduced)); - } - cmPolicies::PolicyID ID; std::string ShortDescription; - unsigned int MajorVersionIntroduced; - unsigned int MinorVersionIntroduced; - unsigned int PatchVersionIntroduced; cmPolicies::PolicyStatus Status; }; @@ -439,16 +441,13 @@ cmPolicies::~cmPolicies() void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, const char *, const char *shortDescription, - unsigned int majorVersionIntroduced, - unsigned int minorVersionIntroduced, - unsigned int patchVersionIntroduced, + unsigned int, + unsigned int, + unsigned int, cmPolicies::PolicyStatus status) { this->Policies[iD] = new cmPolicy(iD, shortDescription, - majorVersionIntroduced, - minorVersionIntroduced, - patchVersionIntroduced, status); } @@ -547,7 +546,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, for(std::map::iterator i = this->Policies.begin(); i != this->Policies.end(); ++i) { - if (i->second->IsPolicyNewerThan(majorVer,minorVer,patchVer)) + if (isPolicyNewerThan(i->first, majorVer, minorVer, patchVer)) { if(i->second->Status == cmPolicies::REQUIRED_ALWAYS) { http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2235cfebeeb3447a1c62d7a0207e899c9f7c9240 commit 2235cfebeeb3447a1c62d7a0207e899c9f7c9240 Author: Stephen Kelly AuthorDate: Sun May 3 10:10:20 2015 +0200 Commit: Stephen Kelly CommitDate: Mon May 4 22:32:18 2015 +0200 cmPolicies: Implement id to version with XMacro. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index d75ea23..bd43cc3 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -45,6 +45,10 @@ static bool stringToId(const char* input, cmPolicies::PolicyID& pid) return true; } +#define CM_SELECT_ID_VERSION(F, A1, A2, A3, A4, A5, A6) F(A1, A3, A4, A5) +#define CM_FOR_EACH_POLICY_ID_VERSION(POLICY) \ + CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID_VERSION) + static const char* idToString(cmPolicies::PolicyID id) { switch(id) @@ -60,6 +64,21 @@ static const char* idToString(cmPolicies::PolicyID id) return 0; } +static const char* idToVersion(cmPolicies::PolicyID id) +{ + switch(id) + { +#define POLICY_CASE(ID, V_MAJOR, V_MINOR, V_PATCH) \ + case cmPolicies::ID: \ + return #V_MAJOR "." #V_MINOR "." #V_PATCH; + CM_FOR_EACH_POLICY_ID_VERSION(POLICY_CASE) +#undef POLICY_CASE + case cmPolicies::CMPCOUNT: + return 0; + } + return 0; +} + class cmPolicy { public: @@ -78,17 +97,6 @@ public: this->Status = status; } - std::string GetVersionString() - { - std::ostringstream v; - v << this->MajorVersionIntroduced << "." << this->MinorVersionIntroduced; - if(this->PatchVersionIntroduced > 0) - { - v << "." << this->PatchVersionIntroduced; - } - return v.str(); - } - bool IsPolicyNewerThan(unsigned int majorV, unsigned int minorV, unsigned int patchV) @@ -615,7 +623,7 @@ std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id) "The policy may be set explicitly using the code\n" " cmake_policy(SET " << idToString(id) << " NEW)\n" "or by upgrading all policies with the code\n" - " cmake_policy(VERSION " << pos->second->GetVersionString() << + " cmake_policy(VERSION " << idToVersion(id) << ") # or later\n" "Run \"cmake --help-command cmake_policy\" for more information."; return error.str(); @@ -646,7 +654,7 @@ cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id) e << "Policy " << pid << " may not be set to OLD behavior because this " << "version of CMake no longer supports it. " << "The policy was introduced in " - << "CMake version " << this->Policies[id]->GetVersionString() + << "CMake version " << idToVersion(id) << ", and use of NEW behavior is now required." << "\n" << "Please either update your CMakeLists.txt files to conform to " http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=05d8438860cac1c1ec2d1bcc325b8bc05c0cfcdc commit 05d8438860cac1c1ec2d1bcc325b8bc05c0cfcdc Author: Stephen Kelly AuthorDate: Sun May 3 10:10:15 2015 +0200 Commit: Stephen Kelly CommitDate: Mon May 4 22:32:18 2015 +0200 cmPolicies: Implement id to string conversion with XMacro. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 9250620..d75ea23 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -45,11 +45,25 @@ static bool stringToId(const char* input, cmPolicies::PolicyID& pid) return true; } +static const char* idToString(cmPolicies::PolicyID id) +{ + switch(id) + { +#define POLICY_CASE(ID) \ + case cmPolicies::ID: \ + return #ID; + CM_FOR_EACH_POLICY_ID(POLICY_CASE) +#undef POLICY_CASE + case cmPolicies::CMPCOUNT: + return 0; + } + return 0; +} + class cmPolicy { public: cmPolicy(cmPolicies::PolicyID iD, - const char *idString, const char *shortDescription, unsigned int majorVersionIntroduced, unsigned int minorVersionIntroduced, @@ -57,7 +71,6 @@ public: cmPolicies::PolicyStatus status) { this->ID = iD; - this->IDString = idString; this->ShortDescription = shortDescription; this->MajorVersionIntroduced = majorVersionIntroduced; this->MinorVersionIntroduced = minorVersionIntroduced; @@ -89,7 +102,6 @@ public: } cmPolicies::PolicyID ID; - std::string IDString; std::string ShortDescription; unsigned int MajorVersionIntroduced; unsigned int MinorVersionIntroduced; @@ -417,14 +429,14 @@ cmPolicies::~cmPolicies() } void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, - const char *idString, + const char *, const char *shortDescription, unsigned int majorVersionIntroduced, unsigned int minorVersionIntroduced, unsigned int patchVersionIntroduced, cmPolicies::PolicyStatus status) { - this->Policies[iD] = new cmPolicy(iD, idString, + this->Policies[iD] = new cmPolicy(iD, shortDescription, majorVersionIntroduced, minorVersionIntroduced, @@ -536,7 +548,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, else { cmPolicies::PolicyStatus status = cmPolicies::WARN; - if(!GetPolicyDefault(mf, i->second->IDString, &status) || + if(!GetPolicyDefault(mf, idToString(i->first), &status) || !mf->SetPolicy(i->second->ID, status)) { return false; @@ -569,18 +581,6 @@ bool cmPolicies::GetPolicyID(const char *id, cmPolicies::PolicyID &pid) return stringToId(id, pid); } -std::string cmPolicies::GetPolicyIDString(cmPolicies::PolicyID pid) -{ - std::map::iterator pos = - this->Policies.find(pid); - if (pos == this->Policies.end()) - { - return ""; - } - return pos->second->IDString; -} - - ///! return a warning string for a given policy std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id) { @@ -589,9 +589,9 @@ std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id) std::ostringstream msg; msg << - "Policy " << pos->second->IDString << " is not set: " + "Policy " << idToString(id) << " is not set: " "" << pos->second->ShortDescription << " " - "Run \"cmake --help-policy " << pos->second->IDString << "\" for " + "Run \"cmake --help-policy " << idToString(id) << "\" for " "policy details. " "Use the cmake_policy command to set the policy " "and suppress this warning."; @@ -607,13 +607,13 @@ std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id) std::ostringstream error; error << - "Policy " << pos->second->IDString << " is not set to NEW: " + "Policy " << idToString(id) << " is not set to NEW: " "" << pos->second->ShortDescription << " " - "Run \"cmake --help-policy " << pos->second->IDString << "\" for " + "Run \"cmake --help-policy " << idToString(id) << "\" for " "policy details. " "CMake now requires this policy to be set to NEW by the project. " "The policy may be set explicitly using the code\n" - " cmake_policy(SET " << pos->second->IDString << " NEW)\n" + " cmake_policy(SET " << idToString(id) << " NEW)\n" "or by upgrading all policies with the code\n" " cmake_policy(VERSION " << pos->second->GetVersionString() << ") # or later\n" @@ -641,7 +641,7 @@ cmPolicies::GetPolicyStatus(cmPolicies::PolicyID id) std::string cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id) { - std::string pid = this->GetPolicyIDString(id); + std::string pid = idToString(id); std::ostringstream e; e << "Policy " << pid << " may not be set to OLD behavior because this " << "version of CMake no longer supports it. " @@ -672,7 +672,7 @@ cmPolicies::DiagnoseAncientPolicies(std::vector const& ancient, i = ancient.begin(); i != ancient.end(); ++i) { cmPolicy const* policy = this->Policies[*i]; - e << " " << policy->IDString << ": " << policy->ShortDescription << "\n"; + e << " " << idToString(*i) << ": " << policy->ShortDescription << "\n"; } e << "However, this version of CMake no longer supports the OLD " << "behavior for these policies. " diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index e9881ac..df04fdf 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -254,7 +254,6 @@ public: ///! convert a string policy ID into a number bool GetPolicyID(const char *id, /* out */ cmPolicies::PolicyID &pid); - std::string GetPolicyIDString(cmPolicies::PolicyID pid); ///! Get the default status for a policy cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6eaade8a827e2e120640f3fc2eb9999e2bca5992 commit 6eaade8a827e2e120640f3fc2eb9999e2bca5992 Author: Stephen Kelly AuthorDate: Sun May 3 10:10:06 2015 +0200 Commit: Stephen Kelly CommitDate: Mon May 4 22:32:18 2015 +0200 cmPolicies: Introduce XMacro table for policy data. Use it to populate the policy enum. diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index a3654f1..e9881ac 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -17,6 +17,202 @@ class cmMakefile; class cmPolicy; +#define CM_FOR_EACH_POLICY_TABLE(POLICY, SELECT) \ + SELECT(POLICY, CMP0000, \ + "A minimum required CMake version must be specified.", \ + 2, 6, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0001, \ + "CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.", \ + 2, 6, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0002, \ + "Logical target names must be globally unique.", \ + 2, 6, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0003, \ + "Libraries linked via full path no longer produce linker search paths.", \ + 2, 6, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0004, \ + "Libraries linked may not have leading or trailing whitespace.", \ + 2, 6, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0005, \ + "Preprocessor definition values are now escaped automatically.", \ + 2, 6, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0006, \ + "Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.", \ + 2, 6, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0007, \ + "list command no longer ignores empty elements.", \ + 2, 6, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0008, \ + "Libraries linked by full-path must have a valid library file name.", \ + 2, 6, 1, cmPolicies::WARN) \ + SELECT(POLICY, CMP0009, \ + "FILE GLOB_RECURSE calls should not follow symlinks by default.", \ + 2, 6, 2, cmPolicies::WARN) \ + SELECT(POLICY, CMP0010, \ + "Bad variable reference syntax is an error.", \ + 2, 6, 3, cmPolicies::WARN) \ + SELECT(POLICY, CMP0011, \ + "Included scripts do automatic cmake_policy PUSH and POP.", \ + 2, 6, 3, cmPolicies::WARN) \ + SELECT(POLICY, CMP0012, \ + "if() recognizes numbers and boolean constants.", \ + 2, 8, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0013, \ + "Duplicate binary directories are not allowed.", \ + 2, 8, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0014, \ + "Input directories must have CMakeLists.txt.", \ + 2, 8, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0015, \ + "link_directories() treats paths relative to the source dir.", \ + 2, 8, 1, cmPolicies::WARN) \ + SELECT(POLICY, CMP0016, \ + "target_link_libraries() reports error if its only argument " \ + "is not a target.", \ + 2, 8, 3, cmPolicies::WARN) \ + SELECT(POLICY, CMP0017, \ + "Prefer files from the CMake module directory when including from " \ + "there.", \ + 2, 8, 4, cmPolicies::WARN) \ + SELECT(POLICY, CMP0018, \ + "Ignore CMAKE_SHARED_LIBRARY__FLAGS variable.", \ + 2, 8, 9, cmPolicies::WARN) \ + SELECT(POLICY, CMP0019, \ + "Do not re-expand variables in include and link information.", \ + 2, 8, 11, cmPolicies::WARN) \ + SELECT(POLICY, CMP0020, \ + "Automatically link Qt executables to qtmain target on Windows.", \ + 2, 8, 11, cmPolicies::WARN) \ + SELECT(POLICY, CMP0021, \ + "Fatal error on relative paths in INCLUDE_DIRECTORIES target property.", \ + 2, 8, 12, cmPolicies::WARN) \ + SELECT(POLICY, CMP0022, \ + "INTERFACE_LINK_LIBRARIES defines the link interface.", \ + 2, 8, 12, cmPolicies::WARN) \ + SELECT(POLICY, CMP0023, \ + "Plain and keyword target_link_libraries signatures cannot be mixed.", \ + 2, 8, 12, cmPolicies::WARN) \ + SELECT(POLICY, CMP0024, \ + "Disallow include export result.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0025, \ + "Compiler id for Apple Clang is now AppleClang.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0026, \ + "Disallow use of the LOCATION target property.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0027, \ + "Conditionally linked imported targets with missing include " \ + "directories.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0028, \ + "Double colon in target name means ALIAS or IMPORTED target.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0029, \ + "The subdir_depends command should not be called.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0030, \ + "The use_mangled_mesa command should not be called.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0031, \ + "The load_command command should not be called.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0032, \ + "The output_required_files command should not be called.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0033, \ + "The export_library_dependencies command should not be called.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0034, \ + "The utility_source command should not be called.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0035, \ + "The variable_requires command should not be called.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0036, \ + "The build_name command should not be called.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0037, \ + "Target names should not be reserved and should match a validity " \ + "pattern.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0038, \ + "Targets may not link directly to themselves.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0039, \ + "Utility targets may not have link dependencies.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0040, \ + "The target in the TARGET signature of add_custom_command() must " \ + "exist.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0041, \ + "Error on relative include with generator expression.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0042, \ + "MACOSX_RPATH is enabled by default.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0043, \ + "Ignore COMPILE_DEFINITIONS_ properties.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0044, \ + "Case sensitive _COMPILER_ID generator expressions.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0045, \ + "Error on non-existent target in get_target_property.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0046, \ + "Error on non-existent dependency in add_dependencies.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0047, \ + "Use QCC compiler id for the qcc drivers on QNX.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0048, \ + "project() command manages VERSION variables.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0049, \ + "Do not expand variables in target source entries.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0050, \ + "Disallow add_custom_command SOURCE signatures.", \ + 3, 0, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0051, \ + "List TARGET_OBJECTS in SOURCES target property.", \ + 3, 1, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0052, \ + "Reject source and build dirs in installed " \ + "INTERFACE_INCLUDE_DIRECTORIES.", \ + 3, 1, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0053, \ + "Simplify variable reference and escape sequence evaluation.", \ + 3, 1, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0054, \ + "Only interpret if() arguments as variables or keywords when unquoted.", \ + 3, 1, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0055, \ + "Strict checking for break() command.", \ + 3, 2, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0056, \ + "Honor link flags in try_compile() source-file signature.", \ + 3, 2, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0057, \ + "Support new IN_LIST if() operator.", \ + 3, 3, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0058, \ + "Ninja requires custom command byproducts to be explicit.", \ + 3, 3, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0059, \ + "Do no treat DEFINITIONS as a built-in directory property.", \ + 3, 3, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0060, \ + "Link libraries by full path even in implicit directories.", \ + 3, 3, 0, cmPolicies::WARN) + +#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) +#define CM_FOR_EACH_POLICY_ID(POLICY) \ + CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID) + + /** \class cmPolicies * \brief Handles changes in CMake behavior and policies * @@ -44,78 +240,9 @@ public: /// Policy identifiers enum PolicyID { - CMP0000, ///< Policy version specification - CMP0001, ///< Ignore old compatibility variable - CMP0002, ///< Target names must be unique - CMP0003, ///< Linking does not include extra -L paths - CMP0004, ///< Libraries linked may not have leading or trailing whitespace - CMP0005, ///< Definition value escaping - CMP0006, ///< BUNDLE install rules needed for MACOSX_BUNDLE targets - CMP0007, ///< list command handling of empty elements - CMP0008, ///< Full-path libraries must be a valid library file name - CMP0009, ///< GLOB_RECURSE should not follow symlinks by default - CMP0010, ///< Bad variable reference syntax is an error - CMP0011, ///< Strong policy scope for include and find_package - CMP0012, ///< Recognize numbers and boolean constants in if() - CMP0013, ///< Duplicate binary directories not allowed - CMP0014, ///< Input directories must have CMakeLists.txt - CMP0015, ///< link_directories() treats paths relative to source dir - /// target_link_libraries() fails if only argument is not a target - CMP0016, - CMP0017, ///< Prefer files in CMAKE_ROOT when including from CMAKE_ROOT - CMP0018, ///< Ignore language flags for shared libs, and adhere to - /// POSITION_INDEPENDENT_CODE property and *_COMPILE_OPTIONS_PI{E,C} - /// instead. - CMP0019, ///< No variable re-expansion in include and link info - CMP0020, ///< Automatically link Qt executables to qtmain target - CMP0021, ///< Fatal error on relative paths in INCLUDE_DIRECTORIES - /// target property - CMP0022, ///< INTERFACE_LINK_LIBRARIES defines the link interface - CMP0023, ///< Disallow mixing keyword and plain tll signatures - CMP0024, ///< Disallow including export() result. - CMP0025, ///< Compiler id for Apple Clang is now AppleClang - CMP0026, ///< Disallow use of the LOCATION target property. - CMP0027, ///< Conditionally linked imported targets with missing include - /// directories. - CMP0028, ///< Double colon in target name means ALIAS or IMPORTED target. - CMP0029, ///< Disallow command: subdir_depends - CMP0030, ///< Disallow command: use_mangled_mesa - CMP0031, ///< Disallow command: load_command - CMP0032, ///< Disallow command: output_required_files - CMP0033, ///< Disallow command: export_library_dependencies - CMP0034, ///< Disallow command: utility_source - CMP0035, ///< Disallow command: variable_requires - CMP0036, ///< Disallow command: build_name - CMP0037, ///< Target names should not be reserved and - /// should match a validity pattern. - CMP0038, ///< Targets may not link directly to themselves - CMP0039, ///< Utility targets may not have link dependencies - CMP0040, ///< The target in the TARGET signature of - /// add_custom_command() must exist. - CMP0041, ///< Error on relative include with generator expression - CMP0042, ///< Enable MACOSX_RPATH by default - CMP0043, ///< Ignore COMPILE_DEFINITIONS_ properties - CMP0044, ///< Case sensitive _COMPILER_ID generator expressions - CMP0045, ///< Error on non-existent target in get_target_property - CMP0046, ///< Error on non-existent dependency in add_dependencies - CMP0047, ///< Use QCC compiler id for the qcc drivers on QNX. - CMP0048, ///< project() command manages VERSION variables - CMP0049, ///< Do not expand variables in target source entries - CMP0050, ///< Disallow add_custom_command SOURCE signatures - CMP0051, ///< List TARGET_OBJECTS in SOURCES target property - CMP0052, ///< Reject source and build dirs in installed - /// INTERFACE_INCLUDE_DIRECTORIES - - CMP0053, ///< Simplify variable reference and escape sequence evaluation - CMP0054, ///< Only interpret if() arguments as variables - /// or keywords when unquoted. - CMP0055, ///< Strict checking for break() command. - CMP0056, ///< Honor link flags in try_compile() source-file signature. - CMP0057, ///< Support new IN_LIST if() operator. - CMP0058, ///< Ninja requires custom command byproducts to be explicit - CMP0059, ///< Do not treat ``DEFINITIONS`` as a built-in directory - /// property. - CMP0060, ///< Link libraries by full path even in implicit directories. +#define POLICY_ENUM(POLICY_ID) POLICY_ID, + CM_FOR_EACH_POLICY_ID(POLICY_ENUM) +#undef POLICY_ENUM /** \brief Always the last entry. * http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fdca04db6850273157e3c50de476e0b9298e9948 commit fdca04db6850273157e3c50de476e0b9298e9948 Author: Stephen Kelly AuthorDate: Sun May 3 10:09:57 2015 +0200 Commit: Stephen Kelly CommitDate: Mon May 4 22:32:17 2015 +0200 cmPolicies: Implement more-compact IsPolicyNewerThan. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 6a15965..9250620 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -80,23 +80,12 @@ public: unsigned int minorV, unsigned int patchV) { - if (majorV < this->MajorVersionIntroduced) - { - return true; - } - if (majorV > this->MajorVersionIntroduced) - { - return false; - } - if (minorV < this->MinorVersionIntroduced) - { - return true; - } - if (minorV > this->MinorVersionIntroduced) - { - return false; - } - return (patchV < this->PatchVersionIntroduced); + return (majorV < this->MajorVersionIntroduced || + (majorV == this->MajorVersionIntroduced && + minorV < this->MinorVersionIntroduced) || + (majorV == this->MajorVersionIntroduced && + minorV == this->MinorVersionIntroduced && + patchV < this->PatchVersionIntroduced)); } cmPolicies::PolicyID ID; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a7ff97275159d094f55df481728a682c357bc438 commit a7ff97275159d094f55df481728a682c357bc438 Author: Stephen Kelly AuthorDate: Sun May 3 10:09:29 2015 +0200 Commit: Stephen Kelly CommitDate: Mon May 4 22:32:17 2015 +0200 cmPolicies: Parse string for id conversion. Remove now-unused PolicyStringMap. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 3f9c6f0..6a15965 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -9,6 +9,42 @@ #include #include +static bool stringToId(const char* input, cmPolicies::PolicyID& pid) +{ + assert(input); + if (strlen(input) != 7) + { + return false; + } + if (!cmHasLiteralPrefix(input, "CMP")) + { + return false; + } + if (cmHasLiteralSuffix(input, "0000")) + { + pid = cmPolicies::CMP0000; + return true; + } + for (int i = 3; i < 7; ++i) + { + if (!isdigit(*(input + i))) + { + return false; + } + } + long id; + if (!cmSystemTools::StringToLong(input + 3, &id)) + { + return false; + } + if (id >= cmPolicies::CMPCOUNT) + { + return false; + } + pid = cmPolicies::PolicyID(id); + return true; +} + class cmPolicy { public: @@ -405,7 +441,6 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, minorVersionIntroduced, patchVersionIntroduced, status); - this->PolicyStringMap[idString] = iD; } //---------------------------------------------------------------------------- @@ -542,18 +577,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, bool cmPolicies::GetPolicyID(const char *id, cmPolicies::PolicyID &pid) { - if (!id || strlen(id) < 1) - { - return false; - } - std::map::iterator pos = - this->PolicyStringMap.find(id); - if (pos == this->PolicyStringMap.end()) - { - return false; - } - pid = pos->second; - return true; + return stringToId(id, pid); } std::string cmPolicies::GetPolicyIDString(cmPolicies::PolicyID pid) diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 9de0298..a3654f1 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -159,7 +159,6 @@ public: private: // might have to make these internal for VS6 not sure yet std::map Policies; - std::map PolicyStringMap; void DiagnoseAncientPolicies(std::vector const& ancient, unsigned int majorVer, unsigned int minorVer, ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From domen.vrankar at gmail.com Mon May 4 17:49:12 2015 From: domen.vrankar at gmail.com (Domen Vrankar) Date: Mon, 4 May 2015 17:49:12 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2500-ga4a12f9 Message-ID: <20150504214912.17C60AF860@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, next has been updated via a4a12f9c4675d2e9145d0311331c06097b4c824b (commit) via 0bed81bf54997edd23a06b26da55657fe5d4e612 (commit) via 9ae1c52d935111a7f3ff3acf6ab82fed87ed24b0 (commit) from dcd76bd58f7876804bd15d96275f9874257e8277 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a4a12f9c4675d2e9145d0311331c06097b4c824b commit a4a12f9c4675d2e9145d0311331c06097b4c824b Merge: dcd76bd 0bed81b Author: Domen Vrankar AuthorDate: Mon May 4 17:49:11 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon May 4 17:49:11 2015 -0400 Merge topic 'cpack-deb-component-auto-discovery' into next 0bed81bf fixup! CPack/DEB component dependency auto-discovery 9ae1c52d fixup! CPack/DEB component dependency auto-discovery http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0bed81bf54997edd23a06b26da55657fe5d4e612 commit 0bed81bf54997edd23a06b26da55657fe5d4e612 Author: Domen Vrankar AuthorDate: Mon May 4 23:34:35 2015 +0200 Commit: Domen Vrankar CommitDate: Mon May 4 23:48:18 2015 +0200 fixup! CPack/DEB component dependency auto-discovery find command on Mac OS doesn't accept same flags as on Linux so we should use cmake file(GLOB_RECURSE) instead diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 7fce49b..ad3aa0f 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -252,6 +252,8 @@ function(cpack_deb_prepare_package_vars) set(CPACK_DEBIAN_FAKEROOT_EXECUTABLE ${FAKEROOT_EXECUTABLE}) endif() + set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_PATH}") + # per component automatic discover: some of the component might not have # binaries. if(CPACK_DEB_PACKAGE_COMPONENT) @@ -288,13 +290,21 @@ function(cpack_deb_prepare_package_vars) endif() # Generating binary list - Get type of all install files - execute_process(COMMAND find -type f - COMMAND xargs file - WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" - OUTPUT_VARIABLE CPACK_DEB_INSTALL_FILES) - - # Convert to CMake list - string(REPLACE "\n" ";" CPACK_DEB_INSTALL_FILES "${CPACK_DEB_INSTALL_FILES}") + cmake_policy(PUSH) + # Tell file(GLOB_RECURSE) not to follow directory symlinks + # even if the project does not set this policy to NEW. + cmake_policy(SET CMP0009 NEW) + file(GLOB_RECURSE FILE_PATHS_ LIST_DIRECTORIES false RELATIVE "${WDIR}" "${WDIR}/*") + cmake_policy(POP) + + # get file info so that we can determine if file is executable or not + unset(CPACK_DEB_INSTALL_FILES) + foreach(FILE_ IN LISTS FILE_PATHS_) + execute_process(COMMAND file "./${FILE_}" + WORKING_DIRECTORY "${WDIR}" + OUTPUT_VARIABLE INSTALL_FILE_) + list(APPEND CPACK_DEB_INSTALL_FILES "${INSTALL_FILE_}") + endforeach() # Only dynamically linked ELF files are included # Extract only file name infront of ":" @@ -333,7 +343,7 @@ function(cpack_deb_prepare_package_vars) message( "CPackDeb Debug: dpkg-shlibdeps warnings \n${SHLIBDEPS_ERROR}") endif() if(NOT SHLIBDEPS_RESULT EQUAL 0) - message (FATAL_ERROR "CPackDeb: dpkg-shlibdeps: ${SHLIBDEPS_ERROR}") + message (FATAL_ERROR "CPackDeb: dpkg-shlibdeps: '${SHLIBDEPS_ERROR}'; executed command: '${SHLIBDEPS_EXECUTABLE} ${IGNORE_MISSING_INFO_FLAG} -O ${CPACK_DEB_BINARY_FILES}'") endif() #Get rid of prefix generated by dpkg-shlibdeps @@ -482,8 +492,6 @@ function(cpack_deb_prepare_package_vars) set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "") endif() - set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_PATH}") - # Print out some debug information if we were asked for that if(CPACK_DEBIAN_PACKAGE_DEBUG) message("CPackDeb:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}") http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9ae1c52d935111a7f3ff3acf6ab82fed87ed24b0 commit 9ae1c52d935111a7f3ff3acf6ab82fed87ed24b0 Author: Domen Vrankar AuthorDate: Mon May 4 23:31:29 2015 +0200 Commit: Domen Vrankar CommitDate: Mon May 4 23:48:18 2015 +0200 fixup! CPack/DEB component dependency auto-discovery Test did not execute dpkg-deb test section even if executable existed diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-shlibdeps1.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-shlibdeps1.cmake index 4aff0eb..79d8f0d 100644 --- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-shlibdeps1.cmake +++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-shlibdeps1.cmake @@ -37,6 +37,7 @@ endif() # dpkg-deb checks for the summary of the packages +find_program(DPKGDEB_EXECUTABLE dpkg-deb) if(DPKGDEB_EXECUTABLE) set(dpkgdeb_output_errors_all) foreach(_f IN LISTS actual_output) ----------------------------------------------------------------------- Summary of changes: Modules/CPackDeb.cmake | 28 +++++++++++++------- ...unCPackVerifyResult-components-shlibdeps1.cmake | 1 + 2 files changed, 19 insertions(+), 10 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue May 5 00:01:07 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 5 May 2015 00:01:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.2-1020-g9e3181a Message-ID: <20150505040107.67BCCAFA15@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 9e3181a1128e7d4f830f56da397f0aaa04cb558d (commit) from d3b36a90b661543f937daffafdf386c91a9592f5 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9e3181a1128e7d4f830f56da397f0aaa04cb558d commit 9e3181a1128e7d4f830f56da397f0aaa04cb558d Author: Kitware Robot AuthorDate: Tue May 5 00:01:05 2015 -0400 Commit: Kitware Robot CommitDate: Tue May 5 00:01:05 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4a8cdb0..8a73f00 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 2) -set(CMake_VERSION_PATCH 20150504) +set(CMake_VERSION_PATCH 20150505) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From domen.vrankar at gmail.com Tue May 5 01:41:27 2015 From: domen.vrankar at gmail.com (Domen Vrankar) Date: Tue, 5 May 2015 01:41:27 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2502-g935bc37 Message-ID: <20150505054127.98065A9DC4@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, next has been updated via 935bc37896af130b31b064df495171411a9d3f0a (commit) via f94263a8301ac06e154996c849d3090e3c123b39 (commit) from a4a12f9c4675d2e9145d0311331c06097b4c824b (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=935bc37896af130b31b064df495171411a9d3f0a commit 935bc37896af130b31b064df495171411a9d3f0a Merge: a4a12f9 f94263a Author: Domen Vrankar AuthorDate: Tue May 5 01:41:26 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue May 5 01:41:26 2015 -0400 Merge topic 'cpack-deb-component-auto-discovery' into next f94263a8 fixup! CPack/DEB component dependency auto-discovery http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f94263a8301ac06e154996c849d3090e3c123b39 commit f94263a8301ac06e154996c849d3090e3c123b39 Author: Domen Vrankar AuthorDate: Tue May 5 07:40:22 2015 +0200 Commit: Domen Vrankar CommitDate: Tue May 5 07:40:22 2015 +0200 fixup! CPack/DEB component dependency auto-discovery dpkg-shlibdeps errors should print out additional info about input parameters diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index ad3aa0f..609d2ec 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -308,7 +308,7 @@ function(cpack_deb_prepare_package_vars) # Only dynamically linked ELF files are included # Extract only file name infront of ":" - foreach( _FILE ${CPACK_DEB_INSTALL_FILES}) + foreach(_FILE ${CPACK_DEB_INSTALL_FILES}) if( ${_FILE} MATCHES "ELF.*dynamically linked") string(REGEX MATCH "(^.*):" _FILE_NAME "${_FILE}") list(APPEND CPACK_DEB_BINARY_FILES "${CMAKE_MATCH_1}") @@ -343,7 +343,11 @@ function(cpack_deb_prepare_package_vars) message( "CPackDeb Debug: dpkg-shlibdeps warnings \n${SHLIBDEPS_ERROR}") endif() if(NOT SHLIBDEPS_RESULT EQUAL 0) - message (FATAL_ERROR "CPackDeb: dpkg-shlibdeps: '${SHLIBDEPS_ERROR}'; executed command: '${SHLIBDEPS_EXECUTABLE} ${IGNORE_MISSING_INFO_FLAG} -O ${CPACK_DEB_BINARY_FILES}'") + message (FATAL_ERROR "CPackDeb: dpkg-shlibdeps: '${SHLIBDEPS_ERROR}';\n" + "executed command: '${SHLIBDEPS_EXECUTABLE} ${IGNORE_MISSING_INFO_FLAG} -O ${CPACK_DEB_BINARY_FILES}';\n" + "found files: '${INSTALL_FILE_}';\n" + "files info: '${CPACK_DEB_INSTALL_FILES}';\n" + "binary files: '${CPACK_DEB_BINARY_FILES}'") endif() #Get rid of prefix generated by dpkg-shlibdeps ----------------------------------------------------------------------- Summary of changes: Modules/CPackDeb.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From domen.vrankar at gmail.com Tue May 5 01:48:51 2015 From: domen.vrankar at gmail.com (Domen Vrankar) Date: Tue, 5 May 2015 01:48:51 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2505-g9fa1bcb Message-ID: <20150505054851.70CCFAF854@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, next has been updated via 9fa1bcba9125efa0a379f16d1019c2dde1c2282f (commit) via 1a2a73a5181fd519559e140da24fcd2d9b33fdca (commit) via 9e3181a1128e7d4f830f56da397f0aaa04cb558d (commit) from 935bc37896af130b31b064df495171411a9d3f0a (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9fa1bcba9125efa0a379f16d1019c2dde1c2282f commit 9fa1bcba9125efa0a379f16d1019c2dde1c2282f Merge: 935bc37 1a2a73a Author: Domen Vrankar AuthorDate: Tue May 5 01:48:50 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue May 5 01:48:50 2015 -0400 Merge topic 'cpack-rpm-debug-log-fix' into next 1a2a73a5 CPack/RPM fix output in debug log 9e3181a1 CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1a2a73a5181fd519559e140da24fcd2d9b33fdca commit 1a2a73a5181fd519559e140da24fcd2d9b33fdca Author: Thomas Orozco AuthorDate: Tue May 5 07:47:10 2015 +0200 Commit: Domen Vrankar CommitDate: Tue May 5 07:47:10 2015 +0200 CPack/RPM fix output in debug log output RPMBUILDOUT when intended diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index fdba90e..e672e72 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -1686,7 +1686,7 @@ mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err") message("CPackRPM:Debug: *** ${RPMBUILDERR} ***") message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out") - message("CPackRPM:Debug: *** ${RPMBUILDERR} ***") + message("CPackRPM:Debug: *** ${RPMBUILDOUT} ***") endif() else() if(ALIEN_EXECUTABLE) ----------------------------------------------------------------------- Summary of changes: Modules/CPackRPM.cmake | 2 +- Source/CMakeVersion.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue May 5 09:20:45 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 5 May 2015 09:20:45 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2510-g801b520 Message-ID: <20150505132045.DFB13AEE02@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, next has been updated via 801b5203b36a6bdfea0fefc1ee58b77337a79b21 (commit) via a874700fc2da9331140e93df4088c6a1021d3cc3 (commit) via 71f38d060bb729e1ac6cfe8db412c0ef96b68cc7 (commit) via f6749f727451ef3e35c20e80e712f0bda38348f9 (commit) via 0c34ac2f0159645f6a2cd0f57a45ffae36b4352d (commit) from 9fa1bcba9125efa0a379f16d1019c2dde1c2282f (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=801b5203b36a6bdfea0fefc1ee58b77337a79b21 commit 801b5203b36a6bdfea0fefc1ee58b77337a79b21 Merge: 9fa1bcb a874700 Author: Brad King AuthorDate: Tue May 5 09:20:44 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue May 5 09:20:44 2015 -0400 Merge topic 'update-kwsys' into next a874700f Merge branch 'upstream-kwsys' into update-kwsys 71f38d06 KWSys 2015-05-05 (8c8b2273) f6749f72 Merge branch 'upstream-kwsys' into update-kwsys 0c34ac2f KWSys 2015-05-04 (c2387a4b) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a874700fc2da9331140e93df4088c6a1021d3cc3 commit a874700fc2da9331140e93df4088c6a1021d3cc3 Merge: f6749f7 71f38d0 Author: Brad King AuthorDate: Tue May 5 09:13:24 2015 -0400 Commit: Brad King CommitDate: Tue May 5 09:13:24 2015 -0400 Merge branch 'upstream-kwsys' into update-kwsys http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=71f38d060bb729e1ac6cfe8db412c0ef96b68cc7 commit 71f38d060bb729e1ac6cfe8db412c0ef96b68cc7 Author: KWSys Robot AuthorDate: Tue May 5 09:05:29 2015 -0400 Commit: Brad King CommitDate: Tue May 5 09:13:21 2015 -0400 KWSys 2015-05-05 (8c8b2273) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ 8c8b2273 | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' c2387a4b..8c8b2273 Brad King (1): 8c8b2273 Process: Refactor child pipe creation diff --git a/ProcessUNIX.c b/ProcessUNIX.c index 1be6d02..68722c2 100644 --- a/ProcessUNIX.c +++ b/ProcessUNIX.c @@ -157,7 +157,7 @@ static void kwsysProcessCleanupDescriptor(int* pfd); static void kwsysProcessClosePipes(kwsysProcess* cp); static int kwsysProcessSetNonBlocking(int fd); static int kwsysProcessCreate(kwsysProcess* cp, int prIndex, - kwsysProcessCreateInformation* si, int* readEnd); + kwsysProcessCreateInformation* si); static void kwsysProcessDestroy(kwsysProcess* cp); static int kwsysProcessSetupOutputPipeFile(int* p, const char* name); static int kwsysProcessSetupOutputPipeNative(int* p, int des[2]); @@ -203,6 +203,10 @@ struct kwsysProcess_s the signal pipe. */ int PipeReadEnds[KWSYSPE_PIPE_COUNT]; + /* Descriptors for the child's ends of the pipes. + Used temporarily during process creation. */ + int PipeChildStd[3]; + /* Write descriptor for child termination signal pipe. */ int SignalPipe; @@ -717,7 +721,6 @@ const char* kwsysProcess_GetExceptionString(kwsysProcess* cp) void kwsysProcess_Execute(kwsysProcess* cp) { int i; - kwsysProcessCreateInformation si = {-1, -1, -1, {-1, -1}}; /* Do not execute a second copy simultaneously. */ if(!cp || cp->State == kwsysProcess_State_Executing) @@ -785,7 +788,50 @@ void kwsysProcess_Execute(kwsysProcess* cp) } } - /* Setup the stderr pipe to be shared by all processes. */ + /* Setup the stdin pipe for the first process. */ + if(cp->PipeFileSTDIN) + { + /* Open a file for the child's stdin to read. */ + cp->PipeChildStd[0] = open(cp->PipeFileSTDIN, O_RDONLY); + if(cp->PipeChildStd[0] < 0) + { + kwsysProcessCleanup(cp, 1); + return; + } + + /* Set close-on-exec flag on the pipe's end. */ + if(fcntl(cp->PipeChildStd[0], F_SETFD, FD_CLOEXEC) < 0) + { + kwsysProcessCleanup(cp, 1); + return; + } + } + else if(cp->PipeSharedSTDIN) + { + cp->PipeChildStd[0] = 0; + } + else if(cp->PipeNativeSTDIN[0] >= 0) + { + cp->PipeChildStd[0] = cp->PipeNativeSTDIN[0]; + + /* Set close-on-exec flag on the pipe's ends. The read end will + be dup2-ed into the stdin descriptor after the fork but before + the exec. */ + if((fcntl(cp->PipeNativeSTDIN[0], F_SETFD, FD_CLOEXEC) < 0) || + (fcntl(cp->PipeNativeSTDIN[1], F_SETFD, FD_CLOEXEC) < 0)) + { + kwsysProcessCleanup(cp, 1); + return; + } + } + else + { + cp->PipeChildStd[0] = -1; + } + + /* Create the output pipe for the last process. + We always create this so the pipe can be passed to select even if + it will report closed immediately. */ { /* Create the pipe. */ int p[2]; @@ -796,15 +842,14 @@ void kwsysProcess_Execute(kwsysProcess* cp) } /* Store the pipe. */ - cp->PipeReadEnds[KWSYSPE_PIPE_STDERR] = p[0]; - si.StdErr = p[1]; + cp->PipeReadEnds[KWSYSPE_PIPE_STDOUT] = p[0]; + cp->PipeChildStd[1] = p[1]; /* Set close-on-exec flag on the pipe's ends. */ if((fcntl(p[0], F_SETFD, FD_CLOEXEC) < 0) || (fcntl(p[1], F_SETFD, FD_CLOEXEC) < 0)) { kwsysProcessCleanup(cp, 1); - kwsysProcessCleanupDescriptor(&si.StdErr); return; } @@ -813,41 +858,93 @@ void kwsysProcess_Execute(kwsysProcess* cp) if(!kwsysProcessSetNonBlocking(p[0])) { kwsysProcessCleanup(cp, 1); - kwsysProcessCleanupDescriptor(&si.StdErr); return; } } - /* Replace the stderr pipe with a file if requested. In this case - the select call will report that stderr is closed immediately. */ - if(cp->PipeFileSTDERR) + if (cp->PipeFileSTDOUT) { - if(!kwsysProcessSetupOutputPipeFile(&si.StdErr, cp->PipeFileSTDERR)) + /* Use a file for stdout. */ + if(!kwsysProcessSetupOutputPipeFile(&cp->PipeChildStd[1], + cp->PipeFileSTDOUT)) { kwsysProcessCleanup(cp, 1); - kwsysProcessCleanupDescriptor(&si.StdErr); return; } } + else if (cp->PipeSharedSTDOUT) + { + /* Use the parent stdout. */ + kwsysProcessCleanupDescriptor(&cp->PipeChildStd[1]); + cp->PipeChildStd[1] = 1; + } + else if (cp->PipeNativeSTDOUT[1] >= 0) + { + /* Use the given descriptor for stdout. */ + if(!kwsysProcessSetupOutputPipeNative(&cp->PipeChildStd[1], + cp->PipeNativeSTDOUT)) + { + kwsysProcessCleanup(cp, 1); + return; + } + } + + /* Create stderr pipe to be shared by all processes in the pipeline. + We always create this so the pipe can be passed to select even if + it will report closed immediately. */ + { + /* Create the pipe. */ + int p[2]; + if(pipe(p KWSYSPE_VMS_NONBLOCK) < 0) + { + kwsysProcessCleanup(cp, 1); + return; + } + + /* Store the pipe. */ + cp->PipeReadEnds[KWSYSPE_PIPE_STDERR] = p[0]; + cp->PipeChildStd[2] = p[1]; - /* Replace the stderr pipe with the parent's if requested. In this - case the select call will report that stderr is closed - immediately. */ - if(cp->PipeSharedSTDERR) + /* Set close-on-exec flag on the pipe's ends. */ + if((fcntl(p[0], F_SETFD, FD_CLOEXEC) < 0) || + (fcntl(p[1], F_SETFD, FD_CLOEXEC) < 0)) { - kwsysProcessCleanupDescriptor(&si.StdErr); - si.StdErr = 2; + kwsysProcessCleanup(cp, 1); + return; } - /* Replace the stderr pipe with the native pipe provided if any. In - this case the select call will report that stderr is closed - immediately. */ - if(cp->PipeNativeSTDERR[1] >= 0) + /* Set to non-blocking in case select lies, or for the polling + implementation. */ + if(!kwsysProcessSetNonBlocking(p[0])) { - if(!kwsysProcessSetupOutputPipeNative(&si.StdErr, cp->PipeNativeSTDERR)) + kwsysProcessCleanup(cp, 1); + return; + } + } + + if (cp->PipeFileSTDERR) + { + /* Use a file for stderr. */ + if(!kwsysProcessSetupOutputPipeFile(&cp->PipeChildStd[2], + cp->PipeFileSTDERR)) + { + kwsysProcessCleanup(cp, 1); + return; + } + } + else if (cp->PipeSharedSTDERR) + { + /* Use the parent stderr. */ + kwsysProcessCleanupDescriptor(&cp->PipeChildStd[2]); + cp->PipeChildStd[2] = 2; + } + else if (cp->PipeNativeSTDERR[1] >= 0) + { + /* Use the given handle for stderr. */ + if(!kwsysProcessSetupOutputPipeNative(&cp->PipeChildStd[2], + cp->PipeNativeSTDERR)) { kwsysProcessCleanup(cp, 1); - kwsysProcessCleanupDescriptor(&si.StdErr); return; } } @@ -859,54 +956,85 @@ void kwsysProcess_Execute(kwsysProcess* cp) /* Create the pipeline of processes. */ { - int readEnd = -1; - int failed = 0; + kwsysProcessCreateInformation si = {-1, -1, -1, {-1, -1}}; + int nextStdIn = cp->PipeChildStd[0]; for(i=0; i < cp->NumberOfCommands; ++i) { - if(!kwsysProcessCreate(cp, i, &si, &readEnd)) + /* Setup the process's pipes. */ + si.StdIn = nextStdIn; + if (i == cp->NumberOfCommands-1) { - failed = 1; + nextStdIn = -1; + si.StdOut = cp->PipeChildStd[1]; } - - /* Set the output pipe of the last process to be non-blocking in - case select lies, or for the polling implementation. */ - if(i == (cp->NumberOfCommands-1) && !kwsysProcessSetNonBlocking(readEnd)) - { - failed = 1; - } - - if(failed) + else { - kwsysProcessCleanup(cp, 1); - - /* Release resources that may have been allocated for this - process before an error occurred. */ - kwsysProcessCleanupDescriptor(&readEnd); - if(si.StdIn != 0) + /* Create a pipe to sit between the children. */ + int p[2] = {-1,-1}; + if(pipe(p KWSYSPE_VMS_NONBLOCK) < 0) { - kwsysProcessCleanupDescriptor(&si.StdIn); - } - if(si.StdOut != 1) - { - kwsysProcessCleanupDescriptor(&si.StdOut); + if (nextStdIn != cp->PipeChildStd[0]) + { + kwsysProcessCleanupDescriptor(&nextStdIn); + } + kwsysProcessCleanup(cp, 1); + return; } - if(si.StdErr != 2) + + /* Set close-on-exec flag on the pipe's ends. */ + if((fcntl(p[0], F_SETFD, FD_CLOEXEC) < 0) || + (fcntl(p[1], F_SETFD, FD_CLOEXEC) < 0)) { - kwsysProcessCleanupDescriptor(&si.StdErr); + close(p[0]); + close(p[1]); + if (nextStdIn != cp->PipeChildStd[0]) + { + kwsysProcessCleanupDescriptor(&nextStdIn); + } + kwsysProcessCleanup(cp, 1); + return; } + nextStdIn = p[0]; + si.StdOut = p[1]; + } + si.StdErr = cp->PipeChildStd[2]; + + { + int res = kwsysProcessCreate(cp, i, &si); + + /* Close our copies of pipes used between children. */ + if (si.StdIn != cp->PipeChildStd[0]) + { + kwsysProcessCleanupDescriptor(&si.StdIn); + } + if (si.StdOut != cp->PipeChildStd[1]) + { + kwsysProcessCleanupDescriptor(&si.StdOut); + } + if (si.StdErr != cp->PipeChildStd[2]) + { + kwsysProcessCleanupDescriptor(&si.StdErr); + } + + if(!res) + { kwsysProcessCleanupDescriptor(&si.ErrorPipe[0]); kwsysProcessCleanupDescriptor(&si.ErrorPipe[1]); + if (nextStdIn != cp->PipeChildStd[0]) + { + kwsysProcessCleanupDescriptor(&nextStdIn); + } + kwsysProcessCleanup(cp, 1); return; } } - /* Save a handle to the output pipe for the last process. */ - cp->PipeReadEnds[KWSYSPE_PIPE_STDOUT] = readEnd; + } } - /* The parent process does not need the output pipe write ends. */ - if(si.StdErr != 2) + /* The parent process does not need the child's pipe ends. */ + for (i=0; i < 3; ++i) { - kwsysProcessCleanupDescriptor(&si.StdErr); + kwsysProcessCleanupDescriptor(&cp->PipeChildStd[i]); } /* Restore the working directory. */ @@ -1414,6 +1542,10 @@ static int kwsysProcessInitialize(kwsysProcess* cp) { cp->PipeReadEnds[i] = -1; } + for(i=0; i < 3; ++i) + { + cp->PipeChildStd[i] = -1; + } cp->SignalPipe = -1; cp->SelectError = 0; cp->StartTime.tv_sec = -1; @@ -1548,13 +1680,17 @@ static void kwsysProcessCleanup(kwsysProcess* cp, int error) { kwsysProcessCleanupDescriptor(&cp->PipeReadEnds[i]); } + for(i=0; i < 3; ++i) + { + kwsysProcessCleanupDescriptor(&cp->PipeChildStd[i]); + } } /*--------------------------------------------------------------------------*/ /* Close the given file descriptor if it is open. Reset its value to -1. */ static void kwsysProcessCleanupDescriptor(int* pfd) { - if(pfd && *pfd >= 0) + if(pfd && *pfd > 2) { /* Keep trying to close until it is not interrupted by a * signal. */ @@ -1615,100 +1751,8 @@ int decc$set_child_standard_streams(int fd1, int fd2, int fd3); /*--------------------------------------------------------------------------*/ static int kwsysProcessCreate(kwsysProcess* cp, int prIndex, - kwsysProcessCreateInformation* si, int* readEnd) + kwsysProcessCreateInformation* si) { - /* Setup the process's stdin. */ - if(prIndex > 0) - { - si->StdIn = *readEnd; - *readEnd = 0; - } - else if(cp->PipeFileSTDIN) - { - /* Open a file for the child's stdin to read. */ - si->StdIn = open(cp->PipeFileSTDIN, O_RDONLY); - if(si->StdIn < 0) - { - return 0; - } - - /* Set close-on-exec flag on the pipe's end. */ - if(fcntl(si->StdIn, F_SETFD, FD_CLOEXEC) < 0) - { - return 0; - } - } - else if(cp->PipeSharedSTDIN) - { - si->StdIn = 0; - } - else if(cp->PipeNativeSTDIN[0] >= 0) - { - si->StdIn = cp->PipeNativeSTDIN[0]; - - /* Set close-on-exec flag on the pipe's ends. The read end will - be dup2-ed into the stdin descriptor after the fork but before - the exec. */ - if((fcntl(cp->PipeNativeSTDIN[0], F_SETFD, FD_CLOEXEC) < 0) || - (fcntl(cp->PipeNativeSTDIN[1], F_SETFD, FD_CLOEXEC) < 0)) - { - return 0; - } - } - else - { - si->StdIn = -1; - } - - /* Setup the process's stdout. */ - { - /* Create the pipe. */ - int p[2]; - if(pipe(p KWSYSPE_VMS_NONBLOCK) < 0) - { - return 0; - } - *readEnd = p[0]; - si->StdOut = p[1]; - - /* Set close-on-exec flag on the pipe's ends. */ - if((fcntl(p[0], F_SETFD, FD_CLOEXEC) < 0) || - (fcntl(p[1], F_SETFD, FD_CLOEXEC) < 0)) - { - return 0; - } - } - - /* Replace the stdout pipe with a file if requested. In this case - the select call will report that stdout is closed immediately. */ - if(prIndex == cp->NumberOfCommands-1 && cp->PipeFileSTDOUT) - { - if(!kwsysProcessSetupOutputPipeFile(&si->StdOut, cp->PipeFileSTDOUT)) - { - return 0; - } - } - - /* Replace the stdout pipe with the parent's if requested. In this - case the select call will report that stderr is closed - immediately. */ - if(prIndex == cp->NumberOfCommands-1 && cp->PipeSharedSTDOUT) - { - kwsysProcessCleanupDescriptor(&si->StdOut); - si->StdOut = 1; - } - - /* Replace the stdout pipe with the native pipe provided if any. In - this case the select call will report that stdout is closed - immediately. */ - if(prIndex == cp->NumberOfCommands-1 && cp->PipeNativeSTDOUT[1] >= 0) - { - if(!kwsysProcessSetupOutputPipeNative(&si->StdOut, cp->PipeNativeSTDOUT)) - { - return 0; - } - } - /* Create the error reporting pipe. */ if(pipe(si->ErrorPipe) < 0) { @@ -1819,19 +1863,6 @@ static int kwsysProcessCreate(kwsysProcess* cp, int prIndex, } } - /* Successfully created this child process. */ - if(prIndex > 0 || si->StdIn > 0) - { - /* The parent process does not need the input pipe read end. */ - kwsysProcessCleanupDescriptor(&si->StdIn); - } - - /* The parent process does not need the output pipe write ends. */ - if(si->StdOut != 1) - { - kwsysProcessCleanupDescriptor(&si->StdOut); - } - return 1; } diff --git a/ProcessWin32.c b/ProcessWin32.c index c2965ea..da1bc15 100644 --- a/ProcessWin32.c +++ b/ProcessWin32.c @@ -94,6 +94,11 @@ typedef struct kwsysProcessCreateInformation_s { /* Windows child startup control data. */ STARTUPINFOW StartupInfo; + + /* Original handles before making inherited duplicates. */ + HANDLE hStdInput; + HANDLE hStdOutput; + HANDLE hStdError; } kwsysProcessCreateInformation; @@ -107,15 +112,12 @@ static void kwsysProcessPipeThreadWakePipe(kwsysProcess* cp, kwsysProcessPipeData* td); static int kwsysProcessInitialize(kwsysProcess* cp); static int kwsysProcessCreate(kwsysProcess* cp, int index, - kwsysProcessCreateInformation* si, - PHANDLE readEnd); + kwsysProcessCreateInformation* si); static void kwsysProcessDestroy(kwsysProcess* cp, int event); static int kwsysProcessSetupOutputPipeFile(PHANDLE handle, const char* name); -static int kwsysProcessSetupSharedPipe(DWORD nStdHandle, PHANDLE handle); -static int kwsysProcessSetupPipeNative(PHANDLE handle, HANDLE p[2], - int isWrite); +static void kwsysProcessSetupSharedPipe(DWORD nStdHandle, PHANDLE handle); +static void kwsysProcessSetupPipeNative(HANDLE native, PHANDLE handle); static void kwsysProcessCleanupHandle(PHANDLE h); -static void kwsysProcessCleanupHandleSafe(PHANDLE h, DWORD nStdHandle); static void kwsysProcessCleanup(kwsysProcess* cp, int error); static void kwsysProcessCleanErrorMessage(kwsysProcess* cp); static int kwsysProcessComputeCommandLength(kwsysProcess* cp, @@ -306,6 +308,10 @@ struct kwsysProcess_s /* Real working directory of our own process. */ DWORD RealWorkingDirectoryLength; wchar_t* RealWorkingDirectory; + + /* Own handles for the child's ends of the pipes in the parent process. + Used temporarily during process creation. */ + HANDLE PipeChildStd[3]; }; /*--------------------------------------------------------------------------*/ @@ -446,6 +452,10 @@ kwsysProcess* kwsysProcess_New(void) return 0; } } + for(i=0; i < 3; ++i) + { + cp->PipeChildStd[i] = INVALID_HANDLE_VALUE; + } return cp; } @@ -875,9 +885,6 @@ void kwsysProcess_Execute(kwsysProcess* cp) { int i; - /* Child startup control data. */ - kwsysProcessCreateInformation si; - /* Do not execute a second time. */ if(!cp || cp->State == kwsysProcess_State_Executing) { @@ -914,117 +921,211 @@ void kwsysProcess_Execute(kwsysProcess* cp) SetCurrentDirectoryW(cp->WorkingDirectory); } - /* Initialize startup info data. */ - ZeroMemory(&si, sizeof(si)); - si.StartupInfo.cb = sizeof(si.StartupInfo); - - /* Decide whether a child window should be shown. */ - si.StartupInfo.dwFlags |= STARTF_USESHOWWINDOW; - si.StartupInfo.wShowWindow = - (unsigned short)(cp->HideWindow?SW_HIDE:SW_SHOWDEFAULT); - - /* Connect the child's output pipes to the threads. */ - si.StartupInfo.dwFlags |= STARTF_USESTDHANDLES; - /* Create stderr pipe to be shared by all processes in the pipeline. - Neither end is directly inherited. */ - if(!CreatePipe(&cp->Pipe[KWSYSPE_PIPE_STDERR].Read, - &cp->Pipe[KWSYSPE_PIPE_STDERR].Write, 0, 0)) + /* Setup the stdin pipe for the first process. */ + if(cp->PipeFileSTDIN) { - kwsysProcessCleanup(cp, 1); - return; + /* Create a handle to read a file for stdin. */ + wchar_t* wstdin = kwsysEncoding_DupToWide(cp->PipeFileSTDIN); + cp->PipeChildStd[0] = + CreateFileW(wstdin, GENERIC_READ|GENERIC_WRITE, + FILE_SHARE_READ|FILE_SHARE_WRITE, + 0, OPEN_EXISTING, 0, 0); + free(wstdin); + if(cp->PipeChildStd[0] == INVALID_HANDLE_VALUE) + { + kwsysProcessCleanup(cp, 1); + return; + } + } + else if(cp->PipeSharedSTDIN) + { + /* Share this process's stdin with the child. */ + kwsysProcessSetupSharedPipe(STD_INPUT_HANDLE, &cp->PipeChildStd[0]); + } + else if(cp->PipeNativeSTDIN[0]) + { + /* Use the provided native pipe. */ + kwsysProcessSetupPipeNative(cp->PipeNativeSTDIN[0], &cp->PipeChildStd[0]); + } + else + { + /* Explicitly give the child no stdin. */ + cp->PipeChildStd[0] = INVALID_HANDLE_VALUE; } - /* Create an inherited duplicate of the write end, but do not - close the non-inherited version. We need to keep it open - to use in waking up the pipe threads. */ - if(!DuplicateHandle(GetCurrentProcess(), cp->Pipe[KWSYSPE_PIPE_STDERR].Write, - GetCurrentProcess(), &si.StartupInfo.hStdError, - 0, TRUE, DUPLICATE_SAME_ACCESS)) + /* Create the output pipe for the last process. + We always create this so the pipe thread can run even if we + do not end up giving the write end to the child below. */ + if(!CreatePipe(&cp->Pipe[KWSYSPE_PIPE_STDOUT].Read, + &cp->Pipe[KWSYSPE_PIPE_STDOUT].Write, 0, 0)) { kwsysProcessCleanup(cp, 1); - kwsysProcessCleanupHandle(&si.StartupInfo.hStdError); return; } - /* Replace the stderr pipe with a file if requested. In this case - the pipe thread will still run but never report data. */ - if(cp->PipeFileSTDERR) + if(cp->PipeFileSTDOUT) { - if(!kwsysProcessSetupOutputPipeFile(&si.StartupInfo.hStdError, - cp->PipeFileSTDERR)) + /* Use a file for stdout. */ + if(!kwsysProcessSetupOutputPipeFile(&cp->PipeChildStd[1], + cp->PipeFileSTDOUT)) { kwsysProcessCleanup(cp, 1); - kwsysProcessCleanupHandle(&si.StartupInfo.hStdError); return; } } - - /* Replace the stderr pipe with the parent process's if requested. - In this case the pipe thread will still run but never report - data. */ - if(cp->PipeSharedSTDERR) + else if(cp->PipeSharedSTDOUT) + { + /* Use the parent stdout. */ + kwsysProcessSetupSharedPipe(STD_OUTPUT_HANDLE, &cp->PipeChildStd[1]); + } + else if(cp->PipeNativeSTDOUT[1]) + { + /* Use the given handle for stdout. */ + kwsysProcessSetupPipeNative(cp->PipeNativeSTDOUT[1], &cp->PipeChildStd[1]); + } + else { - if(!kwsysProcessSetupSharedPipe(STD_ERROR_HANDLE, - &si.StartupInfo.hStdError)) + /* Use our pipe for stdout. Duplicate the handle since our waker + thread will use the original. Do not make it inherited yet. */ + if(!DuplicateHandle(GetCurrentProcess(), + cp->Pipe[KWSYSPE_PIPE_STDOUT].Write, + GetCurrentProcess(), &cp->PipeChildStd[1], + 0, FALSE, DUPLICATE_SAME_ACCESS)) { kwsysProcessCleanup(cp, 1); - kwsysProcessCleanupHandleSafe(&si.StartupInfo.hStdError, - STD_ERROR_HANDLE); return; } } - /* Replace the stderr pipe with the native pipe provided if any. In - this case the pipe thread will still run but never report - data. */ - if(cp->PipeNativeSTDERR[1]) + /* Create stderr pipe to be shared by all processes in the pipeline. + We always create this so the pipe thread can run even if we do not + end up giving the write end to the child below. */ + if(!CreatePipe(&cp->Pipe[KWSYSPE_PIPE_STDERR].Read, + &cp->Pipe[KWSYSPE_PIPE_STDERR].Write, 0, 0)) + { + kwsysProcessCleanup(cp, 1); + return; + } + + if(cp->PipeFileSTDERR) + { + /* Use a file for stderr. */ + if(!kwsysProcessSetupOutputPipeFile(&cp->PipeChildStd[2], + cp->PipeFileSTDERR)) + { + kwsysProcessCleanup(cp, 1); + return; + } + } + else if(cp->PipeSharedSTDERR) + { + /* Use the parent stderr. */ + kwsysProcessSetupSharedPipe(STD_ERROR_HANDLE, &cp->PipeChildStd[2]); + } + else if(cp->PipeNativeSTDERR[1]) + { + /* Use the given handle for stderr. */ + kwsysProcessSetupPipeNative(cp->PipeNativeSTDERR[1], &cp->PipeChildStd[2]); + } + else { - if(!kwsysProcessSetupPipeNative(&si.StartupInfo.hStdError, - cp->PipeNativeSTDERR, 1)) + /* Use our pipe for stderr. Duplicate the handle since our waker + thread will use the original. Do not make it inherited yet. */ + if(!DuplicateHandle(GetCurrentProcess(), + cp->Pipe[KWSYSPE_PIPE_STDERR].Write, + GetCurrentProcess(), &cp->PipeChildStd[2], + 0, FALSE, DUPLICATE_SAME_ACCESS)) { kwsysProcessCleanup(cp, 1); - kwsysProcessCleanupHandleSafe(&si.StartupInfo.hStdError, - STD_ERROR_HANDLE); return; } } /* Create the pipeline of processes. */ { - HANDLE readEnd = 0; + /* Child startup control data. */ + kwsysProcessCreateInformation si; + HANDLE nextStdInput = cp->PipeChildStd[0]; + + /* Initialize startup info data. */ + ZeroMemory(&si, sizeof(si)); + si.StartupInfo.cb = sizeof(si.StartupInfo); + + /* Decide whether a child window should be shown. */ + si.StartupInfo.dwFlags |= STARTF_USESHOWWINDOW; + si.StartupInfo.wShowWindow = + (unsigned short)(cp->HideWindow?SW_HIDE:SW_SHOWDEFAULT); + + /* Connect the child's output pipes to the threads. */ + si.StartupInfo.dwFlags |= STARTF_USESTDHANDLES; + for(i=0; i < cp->NumberOfCommands; ++i) { - if(kwsysProcessCreate(cp, i, &si, &readEnd)) + /* Setup the process's pipes. */ + si.hStdInput = nextStdInput; + if (i == cp->NumberOfCommands-1) + { + /* The last child gets the overall stdout. */ + nextStdInput = INVALID_HANDLE_VALUE; + si.hStdOutput = cp->PipeChildStd[1]; + } + else + { + /* Create a pipe to sit between the children. */ + HANDLE p[2] = {INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE}; + if (!CreatePipe(&p[0], &p[1], 0, 0)) + { + if (nextStdInput != cp->PipeChildStd[0]) + { + kwsysProcessCleanupHandle(&nextStdInput); + } + kwsysProcessCleanup(cp, 1); + return; + } + nextStdInput = p[0]; + si.hStdOutput = p[1]; + } + si.hStdError = cp->PipeChildStd[2]; + + { + int res = kwsysProcessCreate(cp, i, &si); + + /* Close our copies of pipes used between children. */ + if (si.hStdInput != cp->PipeChildStd[0]) + { + kwsysProcessCleanupHandle(&si.hStdInput); + } + if (si.hStdOutput != cp->PipeChildStd[1]) + { + kwsysProcessCleanupHandle(&si.hStdOutput); + } + if (si.hStdError != cp->PipeChildStd[2]) + { + kwsysProcessCleanupHandle(&si.hStdError); + } + if (res) { cp->ProcessEvents[i+1] = cp->ProcessInformation[i].hProcess; } else { + if (nextStdInput != cp->PipeChildStd[0]) + { + kwsysProcessCleanupHandle(&nextStdInput); + } kwsysProcessCleanup(cp, 1); - - /* Release resources that may have been allocated for this - process before an error occurred. */ - kwsysProcessCleanupHandle(&readEnd); - kwsysProcessCleanupHandleSafe(&si.StartupInfo.hStdInput, - STD_INPUT_HANDLE); - kwsysProcessCleanupHandleSafe(&si.StartupInfo.hStdOutput, - STD_OUTPUT_HANDLE); - kwsysProcessCleanupHandleSafe(&si.StartupInfo.hStdError, - STD_ERROR_HANDLE); return; } } - - /* Save a handle to the output pipe for the last process. */ - cp->Pipe[KWSYSPE_PIPE_STDOUT].Read = readEnd; + } } - /* Close the inherited handles to the stderr pipe shared by all - processes in the pipeline. The stdout and stdin pipes are not - shared among all children and are therefore closed by - kwsysProcessCreate after each child is created. */ - kwsysProcessCleanupHandleSafe(&si.StartupInfo.hStdError, STD_ERROR_HANDLE); + /* The parent process does not need the child's pipe ends. */ + for (i=0; i < 3; ++i) + { + kwsysProcessCleanupHandle(&cp->PipeChildStd[i]); + } /* Restore the working directory. */ if(cp->RealWorkingDirectory) @@ -1543,162 +1644,90 @@ int kwsysProcessInitialize(kwsysProcess* cp) } } } + { + int i; + for (i=0; i < 3; ++i) + { + cp->PipeChildStd[i] = INVALID_HANDLE_VALUE; + } + } return 1; } /*--------------------------------------------------------------------------*/ -int kwsysProcessCreate(kwsysProcess* cp, int index, - kwsysProcessCreateInformation* si, - PHANDLE readEnd) +static int kwsysProcessCreateChildHandle(PHANDLE out, HANDLE in, int isStdIn) { - /* Setup the process's stdin. */ - if(*readEnd) - { - /* Create an inherited duplicate of the read end from the output - pipe of the previous process. This also closes the - non-inherited version. */ - if(!DuplicateHandle(GetCurrentProcess(), *readEnd, - GetCurrentProcess(), readEnd, - 0, TRUE, (DUPLICATE_CLOSE_SOURCE | - DUPLICATE_SAME_ACCESS))) - { - return 0; - } - si->StartupInfo.hStdInput = *readEnd; + DWORD flags; - /* This function is done with this handle. */ - *readEnd = 0; - } - else if(cp->PipeFileSTDIN) - { - /* Create a handle to read a file for stdin. */ - wchar_t* wstdin = kwsysEncoding_DupToWide(cp->PipeFileSTDIN); - HANDLE fin = CreateFileW(wstdin, GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, - 0, OPEN_EXISTING, 0, 0); - free(wstdin); - if(fin == INVALID_HANDLE_VALUE) - { - return 0; - } - /* Create an inherited duplicate of the handle. This also closes - the non-inherited version. */ - if(!DuplicateHandle(GetCurrentProcess(), fin, - GetCurrentProcess(), &fin, - 0, TRUE, (DUPLICATE_CLOSE_SOURCE | - DUPLICATE_SAME_ACCESS))) - { - return 0; - } - si->StartupInfo.hStdInput = fin; - } - else if(cp->PipeSharedSTDIN) - { - /* Share this process's stdin with the child. */ - if(!kwsysProcessSetupSharedPipe(STD_INPUT_HANDLE, - &si->StartupInfo.hStdInput)) - { - return 0; - } - } - else if(cp->PipeNativeSTDIN[0]) + /* Check whether the handle is valid for this process. */ + if (in != INVALID_HANDLE_VALUE && GetHandleInformation(in, &flags)) { - /* Use the provided native pipe. */ - if(!kwsysProcessSetupPipeNative(&si->StartupInfo.hStdInput, - cp->PipeNativeSTDIN, 0)) + /* Use the handle as-is if it is already inherited. */ + if (flags & HANDLE_FLAG_INHERIT) { - return 0; + *out = in; + return 1; } + + /* Create an inherited copy of this handle. */ + return DuplicateHandle(GetCurrentProcess(), in, + GetCurrentProcess(), out, + 0, TRUE, DUPLICATE_SAME_ACCESS); } else { - /* Explicitly give the child no stdin. */ - si->StartupInfo.hStdInput = INVALID_HANDLE_VALUE; + /* The given handle is not valid for this process. Some child + processes may break if they do not have a valid standard handle, + so open NUL to give to the child. */ + SECURITY_ATTRIBUTES sa; + ZeroMemory(&sa, sizeof(sa)); + sa.nLength = (DWORD)sizeof(sa); + sa.bInheritHandle = 1; + *out = CreateFileW(L"NUL", + (isStdIn ? GENERIC_READ : + (GENERIC_WRITE | FILE_READ_ATTRIBUTES)), + FILE_SHARE_READ|FILE_SHARE_WRITE, + &sa, OPEN_EXISTING, 0, 0); + return *out != INVALID_HANDLE_VALUE; } - /* Setup the process's stdout. */ - { - DWORD maybeClose = DUPLICATE_CLOSE_SOURCE; - HANDLE writeEnd; +} - /* Create the output pipe for this process. Neither end is directly - inherited. */ - if(!CreatePipe(readEnd, &writeEnd, 0, 0)) - { - return 0; - } +/*--------------------------------------------------------------------------*/ +int kwsysProcessCreate(kwsysProcess* cp, int index, + kwsysProcessCreateInformation* si) +{ + int res = - /* Create an inherited duplicate of the write end. Close the - non-inherited version unless this is the last process. Save the - non-inherited write end of the last process. */ - if(index == cp->NumberOfCommands-1) - { - cp->Pipe[KWSYSPE_PIPE_STDOUT].Write = writeEnd; - maybeClose = 0; - } - if(!DuplicateHandle(GetCurrentProcess(), writeEnd, - GetCurrentProcess(), &writeEnd, - 0, TRUE, (maybeClose | DUPLICATE_SAME_ACCESS))) - { - return 0; - } - si->StartupInfo.hStdOutput = writeEnd; - } + /* Create inherited copies the handles. */ + kwsysProcessCreateChildHandle(&si->StartupInfo.hStdInput, + si->hStdInput, 1) && + kwsysProcessCreateChildHandle(&si->StartupInfo.hStdOutput, + si->hStdOutput, 0) && + kwsysProcessCreateChildHandle(&si->StartupInfo.hStdError, + si->hStdError, 0) && - /* Replace the stdout pipe with a file if requested. In this case - the pipe thread will still run but never report data. */ - if(index == cp->NumberOfCommands-1 && cp->PipeFileSTDOUT) - { - if(!kwsysProcessSetupOutputPipeFile(&si->StartupInfo.hStdOutput, - cp->PipeFileSTDOUT)) - { - return 0; - } - } + /* Create the child in a suspended state so we can wait until all + children have been created before running any one. */ + CreateProcessW(0, cp->Commands[index], 0, 0, TRUE, CREATE_SUSPENDED, 0, + 0, &si->StartupInfo, &cp->ProcessInformation[index]); - /* Replace the stdout pipe of the last child with the parent - process's if requested. In this case the pipe thread will still - run but never report data. */ - if(index == cp->NumberOfCommands-1 && cp->PipeSharedSTDOUT) + /* Close the inherited copies of the handles. */ + if (si->StartupInfo.hStdInput != si->hStdInput) { - if(!kwsysProcessSetupSharedPipe(STD_OUTPUT_HANDLE, - &si->StartupInfo.hStdOutput)) - { - return 0; - } + kwsysProcessCleanupHandle(&si->StartupInfo.hStdInput); } - - /* Replace the stdout pipe with the native pipe provided if any. In - this case the pipe thread will still run but never report - data. */ - if(index == cp->NumberOfCommands-1 && cp->PipeNativeSTDOUT[1]) + if (si->StartupInfo.hStdOutput != si->hStdOutput) { - if(!kwsysProcessSetupPipeNative(&si->StartupInfo.hStdOutput, - cp->PipeNativeSTDOUT, 1)) - { - return 0; - } + kwsysProcessCleanupHandle(&si->StartupInfo.hStdOutput); } - - /* Create the child in a suspended state so we can wait until all - children have been created before running any one. */ - if(!CreateProcessW(0, cp->Commands[index], 0, 0, TRUE, CREATE_SUSPENDED, 0, - 0, &si->StartupInfo, &cp->ProcessInformation[index])) + if (si->StartupInfo.hStdError != si->hStdError) { - return 0; + kwsysProcessCleanupHandle(&si->StartupInfo.hStdError); } - /* Successfully created this child process. Close the current - process's copies of the inherited stdout and stdin handles. The - stderr handle is shared among all children and is closed by - kwsysProcess_Execute after all children have been created. */ - kwsysProcessCleanupHandleSafe(&si->StartupInfo.hStdInput, - STD_INPUT_HANDLE); - kwsysProcessCleanupHandleSafe(&si->StartupInfo.hStdOutput, - STD_OUTPUT_HANDLE); - - return 1; + return res; } /*--------------------------------------------------------------------------*/ @@ -1763,7 +1792,7 @@ int kwsysProcessSetupOutputPipeFile(PHANDLE phandle, const char* name) return 1; } - /* Close the existing inherited handle. */ + /* Close the existing handle. */ kwsysProcessCleanupHandle(phandle); /* Create a handle to write a file for the pipe. */ @@ -1776,103 +1805,27 @@ int kwsysProcessSetupOutputPipeFile(PHANDLE phandle, const char* name) return 0; } - /* Create an inherited duplicate of the handle. This also closes - the non-inherited version. */ - if(!DuplicateHandle(GetCurrentProcess(), fout, - GetCurrentProcess(), &fout, - 0, TRUE, (DUPLICATE_CLOSE_SOURCE | - DUPLICATE_SAME_ACCESS))) - { - return 0; - } - /* Assign the replacement handle. */ *phandle = fout; return 1; } /*--------------------------------------------------------------------------*/ -int kwsysProcessSetupSharedPipe(DWORD nStdHandle, PHANDLE handle) +void kwsysProcessSetupSharedPipe(DWORD nStdHandle, PHANDLE handle) { - /* Check whether the handle to be shared is already inherited. */ - DWORD flags; - int inherited = 0; - if(GetHandleInformation(GetStdHandle(nStdHandle), &flags) && - (flags & HANDLE_FLAG_INHERIT)) - { - inherited = 1; - } - - /* Cleanup the previous handle. */ + /* Close the existing handle. */ kwsysProcessCleanupHandle(handle); - - /* If the standard handle is not inherited then duplicate it to - create an inherited copy. Do not close the original handle when - duplicating! */ - if(inherited) - { - *handle = GetStdHandle(nStdHandle); - return 1; - } - else if(DuplicateHandle(GetCurrentProcess(), GetStdHandle(nStdHandle), - GetCurrentProcess(), handle, - 0, TRUE, DUPLICATE_SAME_ACCESS)) - { - return 1; - } - else - { - /* The given standard handle is not valid for this process. Some - child processes may break if they do not have a valid standard - pipe, so give the child an empty pipe. For the stdin pipe we - want to close the write end and give the read end to the child. - For stdout and stderr we want to close the read end and give - the write end to the child. */ - int child_end = (nStdHandle == STD_INPUT_HANDLE)? 0:1; - int parent_end = (nStdHandle == STD_INPUT_HANDLE)? 1:0; - HANDLE emptyPipe[2]; - if(!CreatePipe(&emptyPipe[0], &emptyPipe[1], 0, 0)) - { - return 0; - } - - /* Close the non-inherited end so the pipe will be broken - immediately. */ - CloseHandle(emptyPipe[parent_end]); - - /* Create an inherited duplicate of the handle. This also - closes the non-inherited version. */ - if(!DuplicateHandle(GetCurrentProcess(), emptyPipe[child_end], - GetCurrentProcess(), &emptyPipe[child_end], - 0, TRUE, (DUPLICATE_CLOSE_SOURCE | - DUPLICATE_SAME_ACCESS))) - { - return 0; - } - - /* Give the inherited handle to the child. */ - *handle = emptyPipe[child_end]; - return 1; - } + /* Store the new standard handle. */ + *handle = GetStdHandle(nStdHandle); } /*--------------------------------------------------------------------------*/ -int kwsysProcessSetupPipeNative(PHANDLE handle, HANDLE p[2], int isWrite) +void kwsysProcessSetupPipeNative(HANDLE native, PHANDLE handle) { - /* Close the existing inherited handle. */ + /* Close the existing handle. */ kwsysProcessCleanupHandle(handle); - - /* Create an inherited duplicate of the handle. This also closes - the non-inherited version. */ - if(!DuplicateHandle(GetCurrentProcess(), p[isWrite? 1:0], - GetCurrentProcess(), handle, - 0, TRUE, (DUPLICATE_CLOSE_SOURCE | - DUPLICATE_SAME_ACCESS))) - { - return 0; - } - - return 1; + /* Store the new given handle. */ + *handle = native; } /*--------------------------------------------------------------------------*/ @@ -1880,23 +1833,13 @@ int kwsysProcessSetupPipeNative(PHANDLE handle, HANDLE p[2], int isWrite) /* Close the given handle if it is open. Reset its value to 0. */ void kwsysProcessCleanupHandle(PHANDLE h) { - if(h && *h) + if(h && *h && *h != INVALID_HANDLE_VALUE && + *h != GetStdHandle(STD_INPUT_HANDLE) && + *h != GetStdHandle(STD_OUTPUT_HANDLE) && + *h != GetStdHandle(STD_ERROR_HANDLE)) { CloseHandle(*h); - *h = 0; - } -} - -/*--------------------------------------------------------------------------*/ - -/* Close the given handle if it is open and not a standard handle. - Reset its value to 0. */ -void kwsysProcessCleanupHandleSafe(PHANDLE h, DWORD nStdHandle) -{ - if(h && *h && (*h != GetStdHandle(nStdHandle))) - { - CloseHandle(*h); - *h = 0; + *h = INVALID_HANDLE_VALUE; } } @@ -1986,6 +1929,10 @@ void kwsysProcessCleanup(kwsysProcess* cp, int error) kwsysProcessCleanupHandle(&cp->Pipe[i].Read); cp->Pipe[i].Closed = 0; } + for(i=0; i < 3; ++i) + { + kwsysProcessCleanupHandle(&cp->PipeChildStd[i]); + } } /*--------------------------------------------------------------------------*/ http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f6749f727451ef3e35c20e80e712f0bda38348f9 commit f6749f727451ef3e35c20e80e712f0bda38348f9 Merge: 9e3181a 0c34ac2 Author: Brad King AuthorDate: Tue May 5 09:12:21 2015 -0400 Commit: Brad King CommitDate: Tue May 5 09:12:21 2015 -0400 Merge branch 'upstream-kwsys' into update-kwsys diff --cc Source/kwsys/.gitattributes index 0000000,248786e..248786e mode 000000,100644..100644 --- a/Source/kwsys/.gitattributes +++ b/Source/kwsys/.gitattributes http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0c34ac2f0159645f6a2cd0f57a45ffae36b4352d commit 0c34ac2f0159645f6a2cd0f57a45ffae36b4352d Author: KWSys Robot AuthorDate: Mon May 4 10:27:45 2015 -0400 Commit: Brad King CommitDate: Tue May 5 09:12:18 2015 -0400 KWSys 2015-05-04 (c2387a4b) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ c2387a4b | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' 69bccf2e..c2387a4b Brad King (3): 1ea01a46 Tell Git to export '.gitattributes' 4f39791b Glob: Add explicit assignment operator to Message member c2387a4b DynamicLoader: Fix CloseLibrary for failed OpenLibrary on HP-UX diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..248786e --- /dev/null +++ b/.gitattributes @@ -0,0 +1,16 @@ +.git* export-ignore +.gitattributes -export-ignore + +/GitSetup export-ignore +/SetupForDevelopment.sh export-ignore eol=lf + +/CONTRIBUTING.rst conflict-marker-size=78 + +*.c whitespace=tab-in-indent,no-lf-at-eof +*.h whitespace=tab-in-indent,no-lf-at-eof +*.h.in whitespace=tab-in-indent,no-lf-at-eof +*.cxx whitespace=tab-in-indent,no-lf-at-eof +*.hxx whitespace=tab-in-indent,no-lf-at-eof +*.hxx.in whitespace=tab-in-indent,no-lf-at-eof +*.txt whitespace=tab-in-indent,no-lf-at-eof +*.cmake whitespace=tab-in-indent,no-lf-at-eof diff --git a/DynamicLoader.cxx b/DynamicLoader.cxx index 66c7d57..a776f97 100644 --- a/DynamicLoader.cxx +++ b/DynamicLoader.cxx @@ -48,6 +48,10 @@ DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& //---------------------------------------------------------------------------- int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib) { + if (!lib) + { + return 0; + } return !shl_unload(lib); } diff --git a/Glob.hxx.in b/Glob.hxx.in index 39b7ce7..5239ccd 100644 --- a/Glob.hxx.in +++ b/Glob.hxx.in @@ -59,6 +59,12 @@ public: type(msg.type), content(msg.content) {} + Message& operator=(Message const& msg) + { + this->type = msg.type; + this->content = msg.content; + return *this; + } }; typedef kwsys_stl::vector GlobMessages; ----------------------------------------------------------------------- Summary of changes: Source/kwsys/.gitattributes | 16 ++ Source/kwsys/DynamicLoader.cxx | 4 + Source/kwsys/Glob.hxx.in | 6 + Source/kwsys/ProcessUNIX.c | 355 +++++++++++++------------ Source/kwsys/ProcessWin32.c | 559 ++++++++++++++++++---------------------- 5 files changed, 472 insertions(+), 468 deletions(-) create mode 100644 Source/kwsys/.gitattributes hooks/post-receive -- CMake From brad.king at kitware.com Tue May 5 09:35:22 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 5 May 2015 09:35:22 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.2-1022-g01c67f5 Message-ID: <20150505133522.5F088AFDBC@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 01c67f524e143a7f4287da4176dd94cec9d0ea71 (commit) via 0f927b440adbe3ecca1b8987ed8c5e442a324ff0 (commit) from 9e3181a1128e7d4f830f56da397f0aaa04cb558d (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=01c67f524e143a7f4287da4176dd94cec9d0ea71 commit 01c67f524e143a7f4287da4176dd94cec9d0ea71 Merge: 9e3181a 0f927b4 Author: Brad King AuthorDate: Tue May 5 09:35:20 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue May 5 09:35:20 2015 -0400 Merge topic 'FindGTest-fix-test-space-parsing' 0f927b44 FindGTest: Fix parsing of test macro calls with spaces (#15553) ----------------------------------------------------------------------- Summary of changes: Modules/FindGTest.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue May 5 09:35:24 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 5 May 2015 09:35:24 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.2-1025-g82a55ff Message-ID: <20150505133524.AB12CAFDC3@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 82a55ff9163879beacc41e3462e54a2cb72f9f2c (commit) via 42142d4fd2455f3c792283ba9c261c3756a10d8a (commit) via f39f0c0aec3ecae02a89d47be6bbb85632ca57f3 (commit) from 01c67f524e143a7f4287da4176dd94cec9d0ea71 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=82a55ff9163879beacc41e3462e54a2cb72f9f2c commit 82a55ff9163879beacc41e3462e54a2cb72f9f2c Merge: 01c67f5 42142d4 Author: Brad King AuthorDate: Tue May 5 09:35:23 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue May 5 09:35:23 2015 -0400 Merge topic 'refactor-cmMakefile-constructor' 42142d4f cmMakefile: Inline Intialize method in constructor f39f0c0a cmMakefile: Initialize SuppressWatches member before use ----------------------------------------------------------------------- Summary of changes: Source/cmMakefile.cxx | 11 +++-------- Source/cmMakefile.h | 1 - 2 files changed, 3 insertions(+), 9 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue May 5 09:35:27 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 5 May 2015 09:35:27 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.2-1027-g2d02986 Message-ID: <20150505133527.2D36AAFDC8@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 2d02986b7ce16ec50f3757b2873f84077f4c5541 (commit) via 9b2778d412351db9c8c7f667335cbdf51b555124 (commit) from 82a55ff9163879beacc41e3462e54a2cb72f9f2c (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2d02986b7ce16ec50f3757b2873f84077f4c5541 commit 2d02986b7ce16ec50f3757b2873f84077f4c5541 Merge: 82a55ff 9b2778d Author: Brad King AuthorDate: Tue May 5 09:35:25 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue May 5 09:35:25 2015 -0400 Merge topic 'InstallRequiredSystemLibraries-vs2015' 9b2778d4 InstallRequiredSystemLibraries: Update for VS 2015 (#15552) ----------------------------------------------------------------------- Summary of changes: Modules/InstallRequiredSystemLibraries.cmake | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue May 5 09:35:29 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 5 May 2015 09:35:29 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.2-1029-gb492a17 Message-ID: <20150505133529.512D9AFDCB@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 b492a17611b4df84cbba4b71bed95da5a2e0ca13 (commit) via f47342701c1ae23c6895602490786caacc43d2c6 (commit) from 2d02986b7ce16ec50f3757b2873f84077f4c5541 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b492a17611b4df84cbba4b71bed95da5a2e0ca13 commit b492a17611b4df84cbba4b71bed95da5a2e0ca13 Merge: 2d02986 f473427 Author: Brad King AuthorDate: Tue May 5 09:35:28 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue May 5 09:35:28 2015 -0400 Merge topic 'hp-gnu-asm' f4734270 HP-UX: Add GNU compiler information for ASM language ----------------------------------------------------------------------- Summary of changes: Modules/Platform/{HP-UX-GNU-C.cmake => HP-UX-GNU-ASM.cmake} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) copy Modules/Platform/{HP-UX-GNU-C.cmake => HP-UX-GNU-ASM.cmake} (52%) hooks/post-receive -- CMake From brad.king at kitware.com Tue May 5 09:35:32 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 5 May 2015 09:35:32 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.2-1054-g2c5a1bf Message-ID: <20150505133532.095F2AFDC3@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 2c5a1bff237f240faf9a45860b0007a44e2d6205 (commit) via 013ada80eac9cb119a6288ee58724a8c9915a35c (commit) via be6664c208c65e01dc175ae4d27e7fc18c28c97e (commit) via de211686122166e7485a98fd027bd1d32fda40b0 (commit) via 13981f20688279b4e10faca67b7020946c9ef733 (commit) via 23e2bcc8dba21b532ebbde20518f8a9f2d312103 (commit) via 5641ba4fcaba322e6f189e33eaccc4621d6ba99d (commit) via 3de54497030b7d8f40f219c0fdfe991e2a9041be (commit) via 387aff200c94073560a961cd2971ab6826347d4d (commit) via dbf680d670e399cc3b042721a1179fba0429073b (commit) via 8c204133e5b7dc278de64c66a6ce0be8ec4ab6f4 (commit) via e3a8c0291e6ae364365bfe48f12c6a5f4ec0e76f (commit) via cb765af0499d1ad51b7e4d3ff45f1e40d6ca843b (commit) via 5df267fa1dc5f8389f571eb6841e51b8fe333b2c (commit) via 2235cfebeeb3447a1c62d7a0207e899c9f7c9240 (commit) via 05d8438860cac1c1ec2d1bcc325b8bc05c0cfcdc (commit) via 6eaade8a827e2e120640f3fc2eb9999e2bca5992 (commit) via fdca04db6850273157e3c50de476e0b9298e9948 (commit) via a7ff97275159d094f55df481728a682c357bc438 (commit) via 953d1b00af3059b24c4dadf8c4717cb0d2260e36 (commit) via 2c10494ab3194e792ad69825cbb55d6644270dd0 (commit) via 48f9fd39ad1637815cd89c2a2f2a17e43c0d7f78 (commit) via fd0aa7434b010c496e09d8013b192b7df453979a (commit) via a3291fe8ecb95c891a34c1844557cbfa2bb89e2d (commit) via a6fb6db49d9fc5558fd79296fbc233f90a3063e4 (commit) from b492a17611b4df84cbba4b71bed95da5a2e0ca13 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2c5a1bff237f240faf9a45860b0007a44e2d6205 commit 2c5a1bff237f240faf9a45860b0007a44e2d6205 Merge: b492a17 013ada8 Author: Brad King AuthorDate: Tue May 5 09:35:30 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue May 5 09:35:30 2015 -0400 Merge topic 'refactor-cmPolicies' 013ada80 cmPolicies: Implement PolicyMap in terms of bitset. be6664c2 cmPolicies: Implement abstraction for PolicyMap. de211686 Port to static cmPolicies API. 13981f20 cmPolicies: Make all API static. 23e2bcc8 cmPolicies: Remove unused DefinePolicy method. 5641ba4f cmPolicies: Remove unused cmPolicy class. 3de54497 cmPolicies: Loop over all policies using enum constants. 387aff20 cmPolicies: Trivialize GetPolicyStatus method. dbf680d6 cmPolicies: Use more-direct ID access. 8c204133 cmPolicies: Implement in terms of public API. e3a8c029 cmPolicies: Make private method file-static. cb765af0 cmPolicies: Implement short description access with XMacros. 5df267fa cmPolicies: Implement version check with XMacro. 2235cfeb cmPolicies: Implement id to version with XMacro. 05d84388 cmPolicies: Implement id to string conversion with XMacro. 6eaade8a cmPolicies: Introduce XMacro table for policy data. ... ----------------------------------------------------------------------- Summary of changes: Source/cmAddCustomCommandCommand.cxx | 3 +- Source/cmAddCustomTargetCommand.cxx | 3 +- Source/cmAddExecutableCommand.cxx | 3 +- Source/cmAddLibraryCommand.cxx | 3 +- Source/cmBreakCommand.cxx | 6 +- Source/cmCMakePolicyCommand.cxx | 4 +- Source/cmCommand.h | 2 +- Source/cmComputeLinkInformation.cxx | 12 +- Source/cmComputeTargetDepends.cxx | 4 +- Source/cmConditionEvaluator.cxx | 18 +- Source/cmCoreTryCompile.cxx | 6 +- Source/cmExportFileGenerator.cxx | 6 +- Source/cmFileCommand.cxx | 6 +- Source/cmGeneratorExpressionNode.cxx | 6 +- Source/cmGetTargetPropertyCommand.cxx | 3 +- Source/cmGlobalGenerator.cxx | 14 +- Source/cmGlobalNinjaGenerator.cxx | 4 +- Source/cmIncludeCommand.cxx | 3 +- Source/cmInstallCommand.cxx | 5 +- Source/cmLinkDirectoriesCommand.cxx | 5 +- Source/cmListCommand.cxx | 6 +- Source/cmLocalGenerator.cxx | 7 +- Source/cmMakefile.cxx | 69 ++- Source/cmPolicies.cxx | 734 +++++++++---------------------- Source/cmPolicies.h | 325 +++++++++----- Source/cmProjectCommand.cxx | 3 +- Source/cmTarget.cxx | 38 +- Source/cmTargetLinkLibrariesCommand.cxx | 12 +- 28 files changed, 521 insertions(+), 789 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue May 5 09:35:53 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 5 May 2015 09:35:53 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2516-g0bc7cc3 Message-ID: <20150505133553.6C712AFDCE@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, next has been updated via 0bc7cc3f85d0db4708e413cc4575da5c36d3d1f5 (commit) via 2c5a1bff237f240faf9a45860b0007a44e2d6205 (commit) via b492a17611b4df84cbba4b71bed95da5a2e0ca13 (commit) via 2d02986b7ce16ec50f3757b2873f84077f4c5541 (commit) via 82a55ff9163879beacc41e3462e54a2cb72f9f2c (commit) via 01c67f524e143a7f4287da4176dd94cec9d0ea71 (commit) from 801b5203b36a6bdfea0fefc1ee58b77337a79b21 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0bc7cc3f85d0db4708e413cc4575da5c36d3d1f5 commit 0bc7cc3f85d0db4708e413cc4575da5c36d3d1f5 Merge: 801b520 2c5a1bf Author: Brad King AuthorDate: Tue May 5 09:35:41 2015 -0400 Commit: Brad King CommitDate: Tue May 5 09:35:41 2015 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From steveire at gmail.com Tue May 5 14:49:47 2015 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 5 May 2015 14:49:47 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2519-ge4a206e Message-ID: <20150505184947.338C9AE5A6@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, next has been updated via e4a206edc199492f5dc7401675ba13bd74091c87 (commit) via f4155cb904acf9b99a89712155cb8cd95b67e11e (commit) via f638d9f80e6bff0d40faaea7b7f8130109c9ce00 (commit) from 0bc7cc3f85d0db4708e413cc4575da5c36d3d1f5 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e4a206edc199492f5dc7401675ba13bd74091c87 commit e4a206edc199492f5dc7401675ba13bd74091c87 Merge: 0bc7cc3 f4155cb Author: Stephen Kelly AuthorDate: Tue May 5 14:49:44 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue May 5 14:49:44 2015 -0400 Merge topic 'improve-policies-documentation' into next f4155cb9 Help: Extract Policy doc subtitles from cmPolicies.h f638d9f8 Help: List the titles and since-version of policies in toctree. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f4155cb904acf9b99a89712155cb8cd95b67e11e commit f4155cb904acf9b99a89712155cb8cd95b67e11e Author: Stephen Kelly AuthorDate: Tue May 5 18:45:15 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 20:49:06 2015 +0200 Help: Extract Policy doc subtitles from cmPolicies.h Add a new cmake-policy directive and use it in each policy document. Add API to cmPolicies to access it, and teach cmRST to process the new directive. Extend the data table in cmPolicies to include an optional RST formatted string. The documentation used in the cmake-policies toctree must be unformatted so limited duplication (in one file, instead of spread among multiple files) seems to be the correct approach. Extend the create-policy-list.py script to extract the RST formatted text, and use it if present. diff --git a/Help/policy/CMP0000.rst b/Help/policy/CMP0000.rst index 9fbf842..e3c00e8a 100644 --- a/Help/policy/CMP0000.rst +++ b/Help/policy/CMP0000.rst @@ -1,7 +1,7 @@ CMP0000 ------- -A minimum required CMake version must be specified. +.. cmake-policy:: CMP0000 CMake requires that projects specify the version of CMake to which they have been written. This policy has been put in place so users diff --git a/Help/policy/CMP0001.rst b/Help/policy/CMP0001.rst index 344f1e2..34d2f7d 100644 --- a/Help/policy/CMP0001.rst +++ b/Help/policy/CMP0001.rst @@ -1,7 +1,7 @@ CMP0001 ------- -CMAKE_BACKWARDS_COMPATIBILITY should no longer be used. +.. cmake-policy:: CMP0001 The OLD behavior is to check CMAKE_BACKWARDS_COMPATIBILITY and present it to the user. The NEW behavior is to ignore diff --git a/Help/policy/CMP0002.rst b/Help/policy/CMP0002.rst index 2c15bd4..105d1ee 100644 --- a/Help/policy/CMP0002.rst +++ b/Help/policy/CMP0002.rst @@ -1,7 +1,7 @@ CMP0002 ------- -Logical target names must be globally unique. +.. cmake-policy:: CMP0002 Targets names created with add_executable, add_library, or add_custom_target are logical build target names. Logical target diff --git a/Help/policy/CMP0003.rst b/Help/policy/CMP0003.rst index 27b83f8..7c5007f 100644 --- a/Help/policy/CMP0003.rst +++ b/Help/policy/CMP0003.rst @@ -1,7 +1,7 @@ CMP0003 ------- -Libraries linked via full path no longer produce linker search paths. +.. cmake-policy:: CMP0003 This policy affects how libraries whose full paths are NOT known are found at link time, but was created due to a change in how CMake deals diff --git a/Help/policy/CMP0004.rst b/Help/policy/CMP0004.rst index 80045f5..b06e214 100644 --- a/Help/policy/CMP0004.rst +++ b/Help/policy/CMP0004.rst @@ -1,7 +1,7 @@ CMP0004 ------- -Libraries linked may not have leading or trailing whitespace. +.. cmake-policy:: CMP0004 CMake versions 2.4 and below silently removed leading and trailing whitespace from libraries linked with code like diff --git a/Help/policy/CMP0005.rst b/Help/policy/CMP0005.rst index c11a9e6..b86f550 100644 --- a/Help/policy/CMP0005.rst +++ b/Help/policy/CMP0005.rst @@ -1,7 +1,7 @@ CMP0005 ------- -Preprocessor definition values are now escaped automatically. +.. cmake-policy:: CMP0005 This policy determines whether or not CMake should generate escaped preprocessor definition values added via add_definitions. CMake diff --git a/Help/policy/CMP0006.rst b/Help/policy/CMP0006.rst index 8d1e5bd..abce5c5 100644 --- a/Help/policy/CMP0006.rst +++ b/Help/policy/CMP0006.rst @@ -1,7 +1,7 @@ CMP0006 ------- -Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION. +.. cmake-policy:: CMP0006 This policy determines whether the install(TARGETS) command must be given a BUNDLE DESTINATION when asked to install a target with the diff --git a/Help/policy/CMP0007.rst b/Help/policy/CMP0007.rst index f0d8c16..7cbc47d 100644 --- a/Help/policy/CMP0007.rst +++ b/Help/policy/CMP0007.rst @@ -1,7 +1,7 @@ CMP0007 ------- -list command no longer ignores empty elements. +.. cmake-policy:: CMP0007 This policy determines whether the list command will ignore empty elements in the list. CMake 2.4 and below list commands ignored all diff --git a/Help/policy/CMP0008.rst b/Help/policy/CMP0008.rst index b118ece..a02493e 100644 --- a/Help/policy/CMP0008.rst +++ b/Help/policy/CMP0008.rst @@ -1,7 +1,7 @@ CMP0008 ------- -Libraries linked by full-path must have a valid library file name. +.. cmake-policy:: CMP0008 In CMake 2.4 and below it is possible to write code like diff --git a/Help/policy/CMP0009.rst b/Help/policy/CMP0009.rst index 481af1a..f0a209e 100644 --- a/Help/policy/CMP0009.rst +++ b/Help/policy/CMP0009.rst @@ -1,7 +1,7 @@ CMP0009 ------- -FILE GLOB_RECURSE calls should not follow symlinks by default. +.. cmake-policy:: CMP0009 In CMake 2.6.1 and below, FILE GLOB_RECURSE calls would follow through symlinks, sometimes coming up with unexpectedly large result sets diff --git a/Help/policy/CMP0010.rst b/Help/policy/CMP0010.rst index 9d2eb76..1cf549b 100644 --- a/Help/policy/CMP0010.rst +++ b/Help/policy/CMP0010.rst @@ -1,7 +1,7 @@ CMP0010 ------- -Bad variable reference syntax is an error. +.. cmake-policy:: CMP0010 In CMake 2.6.2 and below, incorrect variable reference syntax such as a missing close-brace ("${FOO") was reported but did not stop diff --git a/Help/policy/CMP0011.rst b/Help/policy/CMP0011.rst index 0f41fff..1ca4ff1 100644 --- a/Help/policy/CMP0011.rst +++ b/Help/policy/CMP0011.rst @@ -1,7 +1,7 @@ CMP0011 ------- -Included scripts do automatic cmake_policy PUSH and POP. +.. cmake-policy:: CMP0011 In CMake 2.6.2 and below, CMake Policy settings in scripts loaded by the include() and find_package() commands would affect the includer. diff --git a/Help/policy/CMP0012.rst b/Help/policy/CMP0012.rst index 7a749bf..63d1a52 100644 --- a/Help/policy/CMP0012.rst +++ b/Help/policy/CMP0012.rst @@ -1,7 +1,7 @@ CMP0012 ------- -if() recognizes numbers and boolean constants. +.. cmake-policy:: CMP0012 In CMake versions 2.6.4 and lower the if() command implicitly dereferenced arguments corresponding to variables, even those named diff --git a/Help/policy/CMP0013.rst b/Help/policy/CMP0013.rst index e99997b..a6ec06a 100644 --- a/Help/policy/CMP0013.rst +++ b/Help/policy/CMP0013.rst @@ -1,7 +1,7 @@ CMP0013 ------- -Duplicate binary directories are not allowed. +.. cmake-policy:: CMP0013 CMake 2.6.3 and below silently permitted add_subdirectory() calls to create the same binary directory multiple times. During build system diff --git a/Help/policy/CMP0014.rst b/Help/policy/CMP0014.rst index 37178d1..8c34caa 100644 --- a/Help/policy/CMP0014.rst +++ b/Help/policy/CMP0014.rst @@ -1,7 +1,7 @@ CMP0014 ------- -Input directories must have CMakeLists.txt. +.. cmake-policy:: CMP0014 CMake versions before 2.8 silently ignored missing CMakeLists.txt files in directories referenced by add_subdirectory() or subdirs(), diff --git a/Help/policy/CMP0015.rst b/Help/policy/CMP0015.rst index 1b54979..5067e03 100644 --- a/Help/policy/CMP0015.rst +++ b/Help/policy/CMP0015.rst @@ -1,7 +1,7 @@ CMP0015 ------- -link_directories() treats paths relative to the source dir. +.. cmake-policy:: CMP0015 In CMake 2.8.0 and lower the link_directories() command passed relative paths unchanged to the linker. In CMake 2.8.1 and above the diff --git a/Help/policy/CMP0016.rst b/Help/policy/CMP0016.rst index 743b1a9..c818da3 100644 --- a/Help/policy/CMP0016.rst +++ b/Help/policy/CMP0016.rst @@ -1,7 +1,7 @@ CMP0016 ------- -target_link_libraries() reports error if its only argument is not a target. +.. cmake-policy:: CMP0016 In CMake 2.8.2 and lower the target_link_libraries() command silently ignored if it was called with only one argument, and this argument diff --git a/Help/policy/CMP0017.rst b/Help/policy/CMP0017.rst index f74e6f0..01b7d93 100644 --- a/Help/policy/CMP0017.rst +++ b/Help/policy/CMP0017.rst @@ -1,7 +1,7 @@ CMP0017 ------- -Prefer files from the CMake module directory when including from there. +.. cmake-policy:: CMP0017 Starting with CMake 2.8.4, if a cmake-module shipped with CMake (i.e. located in the CMake module directory) calls include() or diff --git a/Help/policy/CMP0018.rst b/Help/policy/CMP0018.rst index 0f68267..1ebea5e 100644 --- a/Help/policy/CMP0018.rst +++ b/Help/policy/CMP0018.rst @@ -1,7 +1,7 @@ CMP0018 ------- -Ignore CMAKE_SHARED_LIBRARY__FLAGS variable. +.. cmake-policy:: CMP0018 CMake 2.8.8 and lower compiled sources in SHARED and MODULE libraries using the value of the undocumented CMAKE_SHARED_LIBRARY__FLAGS diff --git a/Help/policy/CMP0019.rst b/Help/policy/CMP0019.rst index 2b37fa1..114c5fc 100644 --- a/Help/policy/CMP0019.rst +++ b/Help/policy/CMP0019.rst @@ -1,7 +1,7 @@ CMP0019 ------- -Do not re-expand variables in include and link information. +.. cmake-policy:: CMP0019 CMake 2.8.10 and lower re-evaluated values given to the include_directories, link_directories, and link_libraries commands to diff --git a/Help/policy/CMP0020.rst b/Help/policy/CMP0020.rst index 6767d08..4e4476c 100644 --- a/Help/policy/CMP0020.rst +++ b/Help/policy/CMP0020.rst @@ -1,7 +1,7 @@ CMP0020 ------- -Automatically link Qt executables to qtmain target on Windows. +.. cmake-policy:: CMP0020 CMake 2.8.10 and lower required users of Qt to always specify a link dependency to the qtmain.lib static library manually on Windows. diff --git a/Help/policy/CMP0021.rst b/Help/policy/CMP0021.rst index 3f5bd03..18f2b40 100644 --- a/Help/policy/CMP0021.rst +++ b/Help/policy/CMP0021.rst @@ -1,7 +1,7 @@ CMP0021 ------- -Fatal error on relative paths in INCLUDE_DIRECTORIES target property. +.. cmake-policy:: CMP0021 CMake 2.8.10.2 and lower allowed the INCLUDE_DIRECTORIES target property to contain relative paths. The base path for such relative diff --git a/Help/policy/CMP0022.rst b/Help/policy/CMP0022.rst index 22c7c4f..b8d6ecb 100644 --- a/Help/policy/CMP0022.rst +++ b/Help/policy/CMP0022.rst @@ -1,7 +1,7 @@ CMP0022 ------- -INTERFACE_LINK_LIBRARIES defines the link interface. +.. cmake-policy:: CMP0022 CMake 2.8.11 constructed the 'link interface' of a target from properties matching ``(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_)?``. diff --git a/Help/policy/CMP0023.rst b/Help/policy/CMP0023.rst index 962b624..5063787 100644 --- a/Help/policy/CMP0023.rst +++ b/Help/policy/CMP0023.rst @@ -1,7 +1,7 @@ CMP0023 ------- -Plain and keyword target_link_libraries signatures cannot be mixed. +.. cmake-policy:: CMP0023 CMake 2.8.12 introduced the target_link_libraries signature using the PUBLIC, PRIVATE, and INTERFACE keywords to generalize the LINK_PUBLIC diff --git a/Help/policy/CMP0024.rst b/Help/policy/CMP0024.rst index ee53d5f..b4c4c92 100644 --- a/Help/policy/CMP0024.rst +++ b/Help/policy/CMP0024.rst @@ -1,7 +1,7 @@ CMP0024 ------- -Disallow include export result. +.. cmake-policy:: CMP0024 CMake 2.8.12 and lower allowed use of the include() command with the result of the export() command. This relies on the assumption that diff --git a/Help/policy/CMP0025.rst b/Help/policy/CMP0025.rst index 8d19edf..bfc4687 100644 --- a/Help/policy/CMP0025.rst +++ b/Help/policy/CMP0025.rst @@ -1,7 +1,7 @@ CMP0025 ------- -Compiler id for Apple Clang is now ``AppleClang``. +.. cmake-policy:: CMP0025 CMake 3.0 and above recognize that Apple Clang is a different compiler than upstream Clang and that they have different version numbers. diff --git a/Help/policy/CMP0026.rst b/Help/policy/CMP0026.rst index 4889249..5b42a1e 100644 --- a/Help/policy/CMP0026.rst +++ b/Help/policy/CMP0026.rst @@ -1,7 +1,7 @@ CMP0026 ------- -Disallow use of the LOCATION property for build targets. +.. cmake-policy:: CMP0026 CMake 2.8.12 and lower allowed reading the LOCATION target property (and configuration-specific variants) to diff --git a/Help/policy/CMP0027.rst b/Help/policy/CMP0027.rst index bedaffe..f2af8ac 100644 --- a/Help/policy/CMP0027.rst +++ b/Help/policy/CMP0027.rst @@ -1,7 +1,7 @@ CMP0027 ------- -Conditionally linked imported targets with missing include directories. +.. cmake-policy:: CMP0027 CMake 2.8.11 introduced introduced the concept of INTERFACE_INCLUDE_DIRECTORIES, and a check at cmake time that the diff --git a/Help/policy/CMP0028.rst b/Help/policy/CMP0028.rst index 24889ec..db58231 100644 --- a/Help/policy/CMP0028.rst +++ b/Help/policy/CMP0028.rst @@ -1,7 +1,7 @@ CMP0028 ------- -Double colon in target name means ALIAS or IMPORTED target. +.. cmake-policy:: CMP0028 CMake 2.8.12 and lower allowed the use of targets and files with double colons in target_link_libraries, with some buildsystem generators. diff --git a/Help/policy/CMP0029.rst b/Help/policy/CMP0029.rst index 8f58a12..70a8909 100644 --- a/Help/policy/CMP0029.rst +++ b/Help/policy/CMP0029.rst @@ -1,7 +1,7 @@ CMP0029 ------- -The :command:`subdir_depends` command should not be called. +.. cmake-policy:: CMP0029 The implementation of this command has been empty since December 2001 but was kept in CMake for compatibility for a long time. diff --git a/Help/policy/CMP0030.rst b/Help/policy/CMP0030.rst index 9e31b38..98bc070 100644 --- a/Help/policy/CMP0030.rst +++ b/Help/policy/CMP0030.rst @@ -1,7 +1,7 @@ CMP0030 ------- -The :command:`use_mangled_mesa` command should not be called. +.. cmake-policy:: CMP0030 This command was created in September 2001 to support VTK before modern CMake language and custom command capabilities. VTK has diff --git a/Help/policy/CMP0031.rst b/Help/policy/CMP0031.rst index 6b89558..857eb16 100644 --- a/Help/policy/CMP0031.rst +++ b/Help/policy/CMP0031.rst @@ -1,7 +1,7 @@ CMP0031 ------- -The :command:`load_command` command should not be called. +.. cmake-policy:: CMP0031 This command was added in August 2002 to allow projects to add arbitrary commands implemented in C or C++. However, it does diff --git a/Help/policy/CMP0032.rst b/Help/policy/CMP0032.rst index f394a06..e4e59d5 100644 --- a/Help/policy/CMP0032.rst +++ b/Help/policy/CMP0032.rst @@ -1,7 +1,7 @@ CMP0032 ------- -The :command:`output_required_files` command should not be called. +.. cmake-policy:: CMP0032 This command was added in June 2001 to expose the then-current CMake implicit dependency scanner. CMake's real implicit dependency scanner diff --git a/Help/policy/CMP0033.rst b/Help/policy/CMP0033.rst index b420065..7709d81 100644 --- a/Help/policy/CMP0033.rst +++ b/Help/policy/CMP0033.rst @@ -1,7 +1,7 @@ CMP0033 ------- -The :command:`export_library_dependencies` command should not be called. +.. cmake-policy:: CMP0033 This command was added in January 2003 to export ``_LIB_DEPENDS`` internal CMake cache entries to a file for installation with a project. diff --git a/Help/policy/CMP0034.rst b/Help/policy/CMP0034.rst index 2133997..3755d08 100644 --- a/Help/policy/CMP0034.rst +++ b/Help/policy/CMP0034.rst @@ -1,7 +1,7 @@ CMP0034 ------- -The :command:`utility_source` command should not be called. +.. cmake-policy:: CMP0034 This command was introduced in March 2001 to help build executables used to generate other files. This approach has long been replaced by diff --git a/Help/policy/CMP0035.rst b/Help/policy/CMP0035.rst index 7335b22..75b8189 100644 --- a/Help/policy/CMP0035.rst +++ b/Help/policy/CMP0035.rst @@ -1,7 +1,7 @@ CMP0035 ------- -The :command:`variable_requires` command should not be called. +.. cmake-policy:: CMP0035 This command was introduced in November 2001 to perform some conditional logic. It has long been replaced by the :command:`if` command. diff --git a/Help/policy/CMP0036.rst b/Help/policy/CMP0036.rst index 817f156..be13726 100644 --- a/Help/policy/CMP0036.rst +++ b/Help/policy/CMP0036.rst @@ -1,7 +1,7 @@ CMP0036 ------- -The :command:`build_name` command should not be called. +.. cmake-policy:: CMP0036 This command was added in May 2001 to compute a name for the current operating system and compiler combination. The command has long been diff --git a/Help/policy/CMP0037.rst b/Help/policy/CMP0037.rst index 4d485bf..3107e50 100644 --- a/Help/policy/CMP0037.rst +++ b/Help/policy/CMP0037.rst @@ -1,7 +1,7 @@ CMP0037 ------- -Target names should not be reserved and should match a validity pattern. +.. cmake-policy:: CMP0037 CMake 2.8.12 and lower allowed creating targets using :command:`add_library`, :command:`add_executable` and :command:`add_custom_target` with unrestricted diff --git a/Help/policy/CMP0038.rst b/Help/policy/CMP0038.rst index df5af6a..b094db3 100644 --- a/Help/policy/CMP0038.rst +++ b/Help/policy/CMP0038.rst @@ -1,7 +1,7 @@ CMP0038 ------- -Targets may not link directly to themselves. +.. cmake-policy:: CMP0038 CMake 2.8.12 and lower allowed a build target to link to itself directly with a :command:`target_link_libraries` call. This is an indicator of a bug in diff --git a/Help/policy/CMP0039.rst b/Help/policy/CMP0039.rst index 58ccc41..4477d2a 100644 --- a/Help/policy/CMP0039.rst +++ b/Help/policy/CMP0039.rst @@ -1,7 +1,7 @@ CMP0039 ------- -Utility targets may not have link dependencies. +.. cmake-policy:: CMP0039 CMake 2.8.12 and lower allowed using utility targets in the left hand side position of the :command:`target_link_libraries` command. This is an indicator diff --git a/Help/policy/CMP0040.rst b/Help/policy/CMP0040.rst index 77a3c81..7e72ee2 100644 --- a/Help/policy/CMP0040.rst +++ b/Help/policy/CMP0040.rst @@ -1,7 +1,7 @@ CMP0040 ------- -The target in the TARGET signature of add_custom_command() must exist. +.. cmake-policy:: CMP0040 CMake 2.8.12 and lower silently ignored a custom command created with the TARGET signature of :command:`add_custom_command` diff --git a/Help/policy/CMP0041.rst b/Help/policy/CMP0041.rst index 5a47de0..975626d 100644 --- a/Help/policy/CMP0041.rst +++ b/Help/policy/CMP0041.rst @@ -1,7 +1,7 @@ CMP0041 ------- -Error on relative include with generator expression. +.. cmake-policy:: CMP0041 Diagnostics in CMake 2.8.12 and lower silently ignored an entry in the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of a target if it contained a generator diff --git a/Help/policy/CMP0042.rst b/Help/policy/CMP0042.rst index fce870c..c385e57 100644 --- a/Help/policy/CMP0042.rst +++ b/Help/policy/CMP0042.rst @@ -1,7 +1,7 @@ CMP0042 ------- -:prop_tgt:`MACOSX_RPATH` is enabled by default. +.. cmake-policy:: CMP0042 CMake 2.8.12 and newer has support for using ``@rpath`` in a target's install name. This was enabled by setting the target property diff --git a/Help/policy/CMP0043.rst b/Help/policy/CMP0043.rst index 629e502..93fd911 100644 --- a/Help/policy/CMP0043.rst +++ b/Help/policy/CMP0043.rst @@ -1,7 +1,7 @@ CMP0043 ------- -Ignore COMPILE_DEFINITIONS_ properties +.. cmake-policy:: CMP0043 CMake 2.8.12 and lower allowed setting the :prop_tgt:`COMPILE_DEFINITIONS_` target property and diff --git a/Help/policy/CMP0044.rst b/Help/policy/CMP0044.rst index 4a3e215..a980c90 100644 --- a/Help/policy/CMP0044.rst +++ b/Help/policy/CMP0044.rst @@ -1,7 +1,7 @@ CMP0044 ------- -Case sensitive ``_COMPILER_ID`` generator expressions +.. cmake-policy:: CMP0044 CMake 2.8.12 introduced the ``_COMPILER_ID`` :manual:`generator expressions ` to allow diff --git a/Help/policy/CMP0045.rst b/Help/policy/CMP0045.rst index 58c422f..a7eac7b 100644 --- a/Help/policy/CMP0045.rst +++ b/Help/policy/CMP0045.rst @@ -1,7 +1,7 @@ CMP0045 ------- -Error on non-existent target in get_target_property. +.. cmake-policy:: CMP0045 In CMake 2.8.12 and lower, the :command:`get_target_property` command accepted a non-existent target argument without issuing any error or warning. The diff --git a/Help/policy/CMP0046.rst b/Help/policy/CMP0046.rst index 1a3bc65..e03b632 100644 --- a/Help/policy/CMP0046.rst +++ b/Help/policy/CMP0046.rst @@ -1,7 +1,7 @@ CMP0046 ------- -Error on non-existent dependency in add_dependencies. +.. cmake-policy:: CMP0046 CMake 2.8.12 and lower silently ignored non-existent dependencies listed in the :command:`add_dependencies` command. diff --git a/Help/policy/CMP0047.rst b/Help/policy/CMP0047.rst index 26ae439..86e6a89 100644 --- a/Help/policy/CMP0047.rst +++ b/Help/policy/CMP0047.rst @@ -1,7 +1,7 @@ CMP0047 ------- -Use ``QCC`` compiler id for the qcc drivers on QNX. +.. cmake-policy:: CMP0047 CMake 3.0 and above recognize that the QNX qcc compiler driver is different from the GNU compiler. diff --git a/Help/policy/CMP0048.rst b/Help/policy/CMP0048.rst index a54205e..25e23bd 100644 --- a/Help/policy/CMP0048.rst +++ b/Help/policy/CMP0048.rst @@ -1,7 +1,7 @@ CMP0048 ------- -The :command:`project` command manages VERSION variables. +.. cmake-policy:: CMP0048 CMake version 3.0 introduced the ``VERSION`` option of the :command:`project` command to specify a project version as well as the name. In order to keep diff --git a/Help/policy/CMP0049.rst b/Help/policy/CMP0049.rst index 5c8d4a8..b95d811 100644 --- a/Help/policy/CMP0049.rst +++ b/Help/policy/CMP0049.rst @@ -1,7 +1,7 @@ CMP0049 ------- -Do not expand variables in target source entries. +.. cmake-policy:: CMP0049 CMake 2.8.12 and lower performed and extra layer of variable expansion when evaluating source file names: diff --git a/Help/policy/CMP0050.rst b/Help/policy/CMP0050.rst index 76ae0aa..e4c6735 100644 --- a/Help/policy/CMP0050.rst +++ b/Help/policy/CMP0050.rst @@ -1,7 +1,7 @@ CMP0050 ------- -Disallow add_custom_command SOURCE signatures. +.. cmake-policy:: CMP0050 CMake 2.8.12 and lower allowed a signature for :command:`add_custom_command` which specified an input to a command. This was undocumented behavior. diff --git a/Help/policy/CMP0051.rst b/Help/policy/CMP0051.rst index 1b56cb0..19e1b37 100644 --- a/Help/policy/CMP0051.rst +++ b/Help/policy/CMP0051.rst @@ -1,7 +1,7 @@ CMP0051 ------- -List TARGET_OBJECTS in SOURCES target property. +.. cmake-policy:: CMP0051 CMake 3.0 and lower did not include the ``TARGET_OBJECTS`` :manual:`generator expression ` when diff --git a/Help/policy/CMP0052.rst b/Help/policy/CMP0052.rst index 48cfc9c..5a86f8a 100644 --- a/Help/policy/CMP0052.rst +++ b/Help/policy/CMP0052.rst @@ -1,7 +1,7 @@ CMP0052 ------- -Reject source and build dirs in installed INTERFACE_INCLUDE_DIRECTORIES. +.. cmake-policy:: CMP0052 CMake 3.0 and lower allowed subdirectories of the source directory or build directory to be in the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of diff --git a/Help/policy/CMP0053.rst b/Help/policy/CMP0053.rst index bb0ff8b..5d1bb34 100644 --- a/Help/policy/CMP0053.rst +++ b/Help/policy/CMP0053.rst @@ -1,7 +1,7 @@ CMP0053 ------- -Simplify variable reference and escape sequence evaluation. +.. cmake-policy:: CMP0053 CMake 3.1 introduced a much faster implementation of evaluation of the :ref:`Variable References` and :ref:`Escape Sequences` documented in the diff --git a/Help/policy/CMP0054.rst b/Help/policy/CMP0054.rst index 3754fda..6e72b1c 100644 --- a/Help/policy/CMP0054.rst +++ b/Help/policy/CMP0054.rst @@ -1,7 +1,7 @@ CMP0054 ------- -Only interpret :command:`if` arguments as variables or keywords when unquoted. +.. cmake-policy:: CMP0054 CMake 3.1 and above no longer implicitly dereference variables or interpret keywords in an :command:`if` command argument when diff --git a/Help/policy/CMP0055.rst b/Help/policy/CMP0055.rst index fe7ab6f..a64f85b 100644 --- a/Help/policy/CMP0055.rst +++ b/Help/policy/CMP0055.rst @@ -1,7 +1,7 @@ CMP0055 ------- -Strict checking for the :command:`break` command. +.. cmake-policy:: CMP0055 CMake 3.1 and lower allowed calls to the :command:`break` command outside of a loop context and also ignored any given arguments. diff --git a/Help/policy/CMP0056.rst b/Help/policy/CMP0056.rst index 3c75ff4..3fa0889 100644 --- a/Help/policy/CMP0056.rst +++ b/Help/policy/CMP0056.rst @@ -1,7 +1,7 @@ CMP0056 ------- -Honor link flags in :command:`try_compile` source-file signature. +.. cmake-policy:: CMP0056 The :command:`try_compile` command source-file signature generates a ``CMakeLists.txt`` file to build the source file into an executable. diff --git a/Help/policy/CMP0057.rst b/Help/policy/CMP0057.rst index 1298a16..ef18ac4 100644 --- a/Help/policy/CMP0057.rst +++ b/Help/policy/CMP0057.rst @@ -1,7 +1,7 @@ CMP0057 ------- -Support new :command:`if` IN_LIST operator. +.. cmake-policy:: CMP0057 CMake 3.3 adds support for the new IN_LIST operator. diff --git a/Help/policy/CMP0058.rst b/Help/policy/CMP0058.rst index 0f20383..1d0c0a9 100644 --- a/Help/policy/CMP0058.rst +++ b/Help/policy/CMP0058.rst @@ -1,7 +1,7 @@ CMP0058 ------- -Ninja requires custom command byproducts to be explicit. +.. cmake-policy:: CMP0058 When an intermediate file generated during the build is consumed by an expensive operation or a large tree of dependents, one may diff --git a/Help/policy/CMP0059.rst b/Help/policy/CMP0059.rst index e40f450..cc717a5 100644 --- a/Help/policy/CMP0059.rst +++ b/Help/policy/CMP0059.rst @@ -1,7 +1,7 @@ CMP0059 ------- -Don't treat ``DEFINITIONS`` as a built-in directory property. +.. cmake-policy:: CMP0059 CMake 3.3 and above no longer make a list of definitions available through the :prop_dir:`DEFINITIONS` directory property. The diff --git a/Help/policy/CMP0060.rst b/Help/policy/CMP0060.rst index cc37b1b..b249f84 100644 --- a/Help/policy/CMP0060.rst +++ b/Help/policy/CMP0060.rst @@ -1,7 +1,7 @@ CMP0060 ------- -Link libraries by full path even in implicit directories. +.. cmake-policy:: CMP0060 Policy :policy:`CMP0003` was introduced with the intention of always linking library files by full path when a full path is given to the diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index f8d61db..599c174 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -45,14 +45,18 @@ static bool stringToId(const char* input, cmPolicies::PolicyID& pid) return true; } -#define CM_SELECT_ID_VERSION(F, A1, A2, A3, A4, A5, A6) F(A1, A3, A4, A5) +#define CM_SELECT_ID_VERSION(F, A1, A2, A3, A4, A5, A6, A7) F(A1, A4, A5, A6) #define CM_FOR_EACH_POLICY_ID_VERSION(POLICY) \ CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID_VERSION) -#define CM_SELECT_ID_DOC(F, A1, A2, A3, A4, A5, A6) F(A1, A2) +#define CM_SELECT_ID_DOC(F, A1, A2, A3, A4, A5, A6, A7) F(A1, A2) #define CM_FOR_EACH_POLICY_ID_DOC(POLICY) \ CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID_DOC) +#define CM_SELECT_ID_RST(F, A1, A2, A3, A4, A5, A6, A7) F(A1, A3) +#define CM_FOR_EACH_POLICY_ID_RST(POLICY) \ + CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID_RST) + static const char* idToString(cmPolicies::PolicyID id) { switch(id) @@ -343,6 +347,21 @@ cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id) return e.str(); } +std::string cmPolicies::GetPolicyDocTitle(cmPolicies::PolicyID id) +{ + switch(id) + { +#define POLICY_CASE(ID, DOC_TITLE) \ + case cmPolicies::ID: \ + return DOC_TITLE; + CM_FOR_EACH_POLICY_ID_RST(POLICY_CASE) +#undef POLICY_CASE + case cmPolicies::CMPCOUNT: + return 0; + } + return 0; +} + cmPolicies::PolicyMap::PolicyMap() { this->UNDEFINED.set(); diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 63376dd..226b43d 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -21,196 +21,260 @@ class cmPolicy; #define CM_FOR_EACH_POLICY_TABLE(POLICY, SELECT) \ SELECT(POLICY, CMP0000, \ - "A minimum required CMake version must be specified.", \ + "A minimum required CMake version must be specified.", 0, \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0001, \ "CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.", \ + ":variable:`CMAKE_BACKWARDS_COMPATIBILITY` should no longer be used.", \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0002, \ - "Logical target names must be globally unique.", \ + "Logical target names must be globally unique.", 0, \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0003, \ "Libraries linked via full path no longer produce linker search paths.", \ + 0, \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0004, \ - "Libraries linked may not have leading or trailing whitespace.", \ + "Libraries linked may not have leading or trailing whitespace.", 0, \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0005, \ - "Preprocessor definition values are now escaped automatically.", \ + "Preprocessor definition values are now escaped automatically.", 0, \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0006, \ "Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.", \ + "Installing :prop_tgt:`MACOSX_BUNDLE` targets requires a " \ + ":command:`BUNDLE DESTINATION `.", \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0007, \ "list command no longer ignores empty elements.", \ + ":command:`list()` command no longer ignores empty elements.", \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0008, \ - "Libraries linked by full-path must have a valid library file name.", \ + "Libraries linked by full-path must have a valid library file name.", 0, \ 2, 6, 1, cmPolicies::WARN) \ SELECT(POLICY, CMP0009, \ "FILE GLOB_RECURSE calls should not follow symlinks by default.", \ + ":command:`file(GLOB_RECURSE)` calls should not follow symlinks by " \ + "default.", \ 2, 6, 2, cmPolicies::WARN) \ SELECT(POLICY, CMP0010, \ - "Bad variable reference syntax is an error.", \ + "Bad variable reference syntax is an error.", 0, \ 2, 6, 3, cmPolicies::WARN) \ SELECT(POLICY, CMP0011, \ "Included scripts do automatic cmake_policy PUSH and POP.", \ + ":command:`Included ` scripts do automatic " \ + ":command:`cmake_policy` ``PUSH`` and ``POP``.", \ 2, 6, 3, cmPolicies::WARN) \ SELECT(POLICY, CMP0012, \ "if() recognizes numbers and boolean constants.", \ + ":command:`if()` recognizes numbers and boolean constants.", \ 2, 8, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0013, \ - "Duplicate binary directories are not allowed.", \ + "Duplicate binary directories are not allowed.", 0, \ 2, 8, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0014, \ - "Input directories must have CMakeLists.txt.", \ + "Input directories must have CMakeLists.txt.", 0, \ 2, 8, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0015, \ "link_directories() treats paths relative to the source dir.", \ + ":command:`link_directories()` treats paths relative to the " \ + ":variable:`CMAKE_CURRENT_SOURCE_DIR`.", \ 2, 8, 1, cmPolicies::WARN) \ SELECT(POLICY, CMP0016, \ "target_link_libraries() reports error if its only argument " \ "is not a target.", \ + ":command:`target_link_libraries()` reports error if its only argument " \ + "is not a target.", \ 2, 8, 3, cmPolicies::WARN) \ SELECT(POLICY, CMP0017, \ "Prefer files from the CMake module directory when including from " \ - "there.", \ + "there.", 0, \ 2, 8, 4, cmPolicies::WARN) \ SELECT(POLICY, CMP0018, \ - "Ignore CMAKE_SHARED_LIBRARY__FLAGS variable.", \ + "Ignore CMAKE_SHARED_LIBRARY__FLAGS variable.", 0, \ 2, 8, 9, cmPolicies::WARN) \ SELECT(POLICY, CMP0019, \ - "Do not re-expand variables in include and link information.", \ + "Do not re-expand variables in include and link information.", 0, \ 2, 8, 11, cmPolicies::WARN) \ SELECT(POLICY, CMP0020, \ "Automatically link Qt executables to qtmain target on Windows.", \ + "Automatically link :manual:`Qt executables ` to qtmain " \ + "target on Windows.", \ 2, 8, 11, cmPolicies::WARN) \ SELECT(POLICY, CMP0021, \ "Fatal error on relative paths in INCLUDE_DIRECTORIES target property.", \ + "Fatal error on relative paths in :prop_tgt:`INCLUDE_DIRECTORIES` " \ + "target property.", \ 2, 8, 12, cmPolicies::WARN) \ SELECT(POLICY, CMP0022, \ "INTERFACE_LINK_LIBRARIES defines the link interface.", \ + ":prop_tgt:`INTERFACE_LINK_LIBRARIES` defines the link interface.", \ 2, 8, 12, cmPolicies::WARN) \ SELECT(POLICY, CMP0023, \ "Plain and keyword target_link_libraries signatures cannot be mixed.", \ + "Plain and keyword :command:`target_link_libraries()` signatures cannot " \ + "be mixed.", \ 2, 8, 12, cmPolicies::WARN) \ SELECT(POLICY, CMP0024, \ - "Disallow include export result.", \ + "Disallow include() of export() result.", \ + "Disallow :command:`include()` of :command:`export()` result.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0025, \ "Compiler id for Apple Clang is now AppleClang.", \ + ":variable:`Compiler id _COMPILER_ID>` for Apple Clang is " \ + "now ``AppleClang``.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0026, \ "Disallow use of the LOCATION target property.", \ + "Disallow use of the :prop_tgt:`LOCATION` target property.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0027, \ - "Conditionally linked imported targets with missing include " \ + "Conditionally linked IMPORTED targets with missing include " \ + "directories.", \ + "Conditionally linked :prop_tgt:`IMPORTED` targets with missing include " \ "directories.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0028, \ "Double colon in target name means ALIAS or IMPORTED target.", \ + "Double colon in target name means :ref:`ALIAS ` or " \ + ":ref:`IMPORTED ` target.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0029, \ "The subdir_depends command should not be called.", \ + "The :command:`subdir_depends()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0030, \ "The use_mangled_mesa command should not be called.", \ + "The :command:`use_mangled_mesa()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0031, \ "The load_command command should not be called.", \ + "The :command:`load_command()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0032, \ "The output_required_files command should not be called.", \ + "The :command:`output_required_files()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0033, \ "The export_library_dependencies command should not be called.", \ + "The :command:`export_library_dependencies()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0034, \ "The utility_source command should not be called.", \ + "The :command:`utility_source()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0035, \ "The variable_requires command should not be called.", \ + "The :command:`variable_requires()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0036, \ "The build_name command should not be called.", \ + "The :command:`build_name()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0037, \ "Target names should not be reserved and should match a validity " \ "pattern.", \ + "Target :prop_tgt:`names ` should not be reserved and should " \ + "match a validity pattern.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0038, \ - "Targets may not link directly to themselves.", \ + "Targets may not link directly to themselves.", 0, \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0039, \ - "Utility targets may not have link dependencies.", \ + "Utility targets may not have link dependencies.", 0, \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0040, \ "The target in the TARGET signature of add_custom_command() must " \ "exist.", \ + "The target in the ``TARGET`` signature of " \ + ":command:`add_custom_command()` must exist.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0041, \ "Error on relative include with generator expression.", \ + "Error on relative include with " \ + ":manual:`generator expression `.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0042, \ "MACOSX_RPATH is enabled by default.", \ + ":prop_tgt:`MACOSX_RPATH` is enabled by default.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0043, \ "Ignore COMPILE_DEFINITIONS_ properties.", \ + "Ignore ``COMPILE_DEFINITIONS_`` properties.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0044, \ "Case sensitive _COMPILER_ID generator expressions.", \ + "Case sensitive ``_COMPILER_ID`` " \ + ":manual:`generator expression `", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0045, \ "Error on non-existent target in get_target_property.", \ + "Error on non-existent target in :command:`get_target_property()`.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0046, \ "Error on non-existent dependency in add_dependencies.", \ + "Error on non-existent dependency in :command:`add_dependencies()`.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0047, \ "Use QCC compiler id for the qcc drivers on QNX.", \ + "Use ``QCC`` :variable:`compiler id _COMPILER_ID>` for " \ + "the qcc drivers on QNX.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0048, \ "project() command manages VERSION variables.", \ + ":command:`project()` command manages ``VERSION`` variables.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0049, \ - "Do not expand variables in target source entries.", \ + "Do not expand variables in target source entries.", 0, \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0050, \ "Disallow add_custom_command SOURCE signatures.", \ + "Disallow :command:`add_custom_command(SOURCE)` signatures.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0051, \ "List TARGET_OBJECTS in SOURCES target property.", \ + "List :manual:`TARGET_OBJECTS ` " \ + "in :prop_tgt:`SOURCES` target property.", \ 3, 1, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0052, \ "Reject source and build dirs in installed " \ "INTERFACE_INCLUDE_DIRECTORIES.", \ + "Reject source and build dirs in installed " \ + ":prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES`.", \ 3, 1, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0053, \ - "Simplify variable reference and escape sequence evaluation.", \ + "Simplify variable reference and escape sequence evaluation.", 0, \ 3, 1, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0054, \ "Only interpret if() arguments as variables or keywords when unquoted.", \ + "Only interpret :command:`if()` arguments as variables or keywords " \ + "when unquoted.", \ 3, 1, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0055, \ "Strict checking for break() command.", \ + "Strict checking for :command:`break()` command.", \ 3, 2, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0056, \ "Honor link flags in try_compile() source-file signature.", \ + "Honor link flags in :command:`try_compile()` source-file signature.", \ 3, 2, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0057, \ "Support new IN_LIST if() operator.", \ + "Support new ``IN_LIST`` :command:`if()` operator.", \ 3, 3, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0058, \ - "Ninja requires custom command byproducts to be explicit.", \ + "Ninja requires custom command byproducts to be explicit.", 0, \ 3, 3, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0059, \ - "Do no treat DEFINITIONS as a built-in directory property.", \ + "Do not treat DEFINITIONS as a built-in directory property.", \ + "Do not treat :prop_dir:`DEFINITIONS` as a built-in directory " \ + "property.", \ 3, 3, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0060, \ - "Link libraries by full path even in implicit directories.", \ + "Link libraries by full path even in implicit directories.", 0, \ 3, 3, 0, cmPolicies::WARN) -#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) +#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6, A7) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID) @@ -269,6 +333,8 @@ public: ///! return an error string for when a required policy is unspecified static std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id); + static std::string GetPolicyDocTitle(cmPolicies::PolicyID id); + /** Represent a set of policy values. */ struct PolicyMap { diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index cb61ed9..74ceaaa 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -14,6 +14,7 @@ #include "cmSystemTools.h" #include "cmAlgorithms.h" #include "cmVersion.h" +#include "cmPolicies.h" #include #include @@ -30,6 +31,7 @@ cmRST::cmRST(std::ostream& os, std::string const& docroot): "command|variable" ")::[ \t]+([^ \t\n]+)$"), CMakeModuleDirective("^.. cmake-module::[ \t]+([^ \t\n]+)$"), + CMakePolicyDirective("^.. cmake-policy::[ \t]+(.+)$"), ParsedLiteralDirective("^.. parsed-literal::[ \t]*(.*)$"), CodeBlockDirective("^.. code-block::[ \t]*(.*)$"), ReplaceDirective("^.. (\\|[^|]+\\|) replace::[ \t]*(.*)$"), @@ -195,6 +197,26 @@ void cmRST::ProcessLine(std::string const& line) this->NormalLine(line); } } + else if(this->CMakePolicyDirective.find(line)) + { + std::string policy = this->CMakePolicyDirective.match(1); + if(policy.empty()) + { + this->NormalLine(line); + } + else + { + cmPolicies pols; + + cmPolicies::PolicyID id; + bool b = pols.GetPolicyID(policy.c_str(), id); + if (!b) + { + this->NormalLine(line); + } + this->OutputLine(pols.GetPolicyDocTitle(id) + "\n", true); + } + } else if(this->ParsedLiteralDirective.find(line)) { // Record the literal lines to output after whole block. diff --git a/Source/cmRST.h b/Source/cmRST.h index b9b2366..52c9f2e 100644 --- a/Source/cmRST.h +++ b/Source/cmRST.h @@ -79,6 +79,7 @@ private: DirectiveType Directive; cmsys::RegularExpression CMakeDirective; cmsys::RegularExpression CMakeModuleDirective; + cmsys::RegularExpression CMakePolicyDirective; cmsys::RegularExpression ParsedLiteralDirective; cmsys::RegularExpression CodeBlockDirective; cmsys::RegularExpression ReplaceDirective; diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py index fe60033..26094b2 100644 --- a/Utilities/Sphinx/cmake.py +++ b/Utilities/Sphinx/cmake.py @@ -150,6 +150,21 @@ class CMakePolicyList(Directive): self.state_machine.insert_input(include_lines, "") return [] +class CMakePolicy(Directive): + required_arguments = 1 + def run(self): + + env = self.state.document.settings.env + with open("PolicyList.json", "r") as f: + policies = json.load(f) + + for policy in policies: + if policy["id"] == self.arguments[0]: + include_lines = statemachine.string2lines(policy["rst"]) + self.state_machine.insert_input(include_lines, "") + break + return [] + class _cmake_index_entry: def __init__(self, desc): self.desc = desc @@ -411,6 +426,7 @@ class CMakeDomain(Domain): def setup(app): app.add_directive('cmake-module', CMakeModule) + app.add_directive('cmake-policy', CMakePolicy) app.add_directive('cmake-policy-list', CMakePolicyList) app.add_transform(CMakeTransform) app.add_transform(CMakeXRefTransform) diff --git a/Utilities/Sphinx/create-policy-list.py b/Utilities/Sphinx/create-policy-list.py index d825c66..6b0f10e 100755 --- a/Utilities/Sphinx/create-policy-list.py +++ b/Utilities/Sphinx/create-policy-list.py @@ -7,6 +7,10 @@ def collectString(s): result = "" idx = s.find('"') + nullptr = s.find('0') + if (nullptr < idx): + return (None, None) + oldIdx = idx + 1 i = 0 while idx != -1: @@ -41,13 +45,19 @@ with open(sys.argv[2]) as policyHeader: policyId, content = content.split(",", 1) docString, docLength = collectString(content) content = content[docLength:] + rstString, rstLength = collectString(content) + if (rstString is None): + rstString = docString + else: + content = content[rstLength:] versionMajor, versionMinor, versionPatch, content = content.split(",", 3) versionMajor = cleanString(versionMajor) versionMinor = cleanString(versionMinor) versionPatch = cleanString(versionPatch) version = versionMajor + "." + versionMinor + "." + versionPatch - policies.append({"id": policyId, "doc": docString, "version": version}) + policies.append({"id": policyId, "doc": docString, + "rst": rstString, "version": version}) start = content.find("SELECT(POLICY, ") http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f638d9f80e6bff0d40faaea7b7f8130109c9ce00 commit f638d9f80e6bff0d40faaea7b7f8130109c9ce00 Author: Stephen Kelly AuthorDate: Tue May 5 20:49:02 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 20:49:02 2015 +0200 Help: List the titles and since-version of policies in toctree. As far as I can tell, there is no convenient way to do the parsing from the directive itself, so generate an intermediate file at build time which is parsed by the directive. html entities may not appear in link text in a toctree, so strip those out. diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index aff696d..a2aedd4 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -54,67 +54,4 @@ functions. All Policies ============ -.. toctree:: - :maxdepth: 1 - - /policy/CMP0000 - /policy/CMP0001 - /policy/CMP0002 - /policy/CMP0003 - /policy/CMP0004 - /policy/CMP0005 - /policy/CMP0006 - /policy/CMP0007 - /policy/CMP0008 - /policy/CMP0009 - /policy/CMP0010 - /policy/CMP0011 - /policy/CMP0012 - /policy/CMP0013 - /policy/CMP0014 - /policy/CMP0015 - /policy/CMP0016 - /policy/CMP0017 - /policy/CMP0018 - /policy/CMP0019 - /policy/CMP0020 - /policy/CMP0021 - /policy/CMP0022 - /policy/CMP0023 - /policy/CMP0024 - /policy/CMP0025 - /policy/CMP0026 - /policy/CMP0027 - /policy/CMP0028 - /policy/CMP0029 - /policy/CMP0030 - /policy/CMP0031 - /policy/CMP0032 - /policy/CMP0033 - /policy/CMP0034 - /policy/CMP0035 - /policy/CMP0036 - /policy/CMP0037 - /policy/CMP0038 - /policy/CMP0039 - /policy/CMP0040 - /policy/CMP0041 - /policy/CMP0042 - /policy/CMP0043 - /policy/CMP0044 - /policy/CMP0045 - /policy/CMP0046 - /policy/CMP0047 - /policy/CMP0048 - /policy/CMP0049 - /policy/CMP0050 - /policy/CMP0051 - /policy/CMP0052 - /policy/CMP0053 - /policy/CMP0054 - /policy/CMP0055 - /policy/CMP0056 - /policy/CMP0057 - /policy/CMP0058 - /policy/CMP0059 - /policy/CMP0060 +.. cmake-policy-list:: diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt index a755ca1..036b8e7 100644 --- a/Utilities/Sphinx/CMakeLists.txt +++ b/Utilities/Sphinx/CMakeLists.txt @@ -71,9 +71,22 @@ endif() if(SPHINX_TEXT) list(APPEND doc_formats text) endif() -if(SPHINX_QTHELP) + +if (doc_formats) find_package(PythonInterp REQUIRED) + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/PolicyList.json" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/create-policy-list.py" + COMMAND "${PYTHON_EXECUTABLE}" + "${CMAKE_CURRENT_SOURCE_DIR}/create-policy-list.py" + "${CMAKE_CURRENT_BINARY_DIR}" + "${CMake_SOURCE_DIR}/Source/cmPolicies.h" + ) +endif() + +if(SPHINX_QTHELP) + find_program(QCOLLECTIONGENERATOR_EXECUTABLE NAMES qcollectiongenerator DOC "qcollectiongenerator tool" @@ -122,7 +135,7 @@ foreach(format ${doc_formats}) ${CMAKE_CURRENT_BINARY_DIR}/${format} > ${doc_format_log} # log stdout, pass stderr ${${format}_extra_commands} - DEPENDS ${doc_format_last} + DEPENDS ${doc_format_last} "${CMAKE_CURRENT_BINARY_DIR}/PolicyList.json" COMMENT "sphinx-build ${format}: see Utilities/Sphinx/${doc_format_log}" VERBATIM ) diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py index 5c0406d..fe60033 100644 --- a/Utilities/Sphinx/cmake.py +++ b/Utilities/Sphinx/cmake.py @@ -11,6 +11,8 @@ #============================================================================= import os import re +import json +from docutils import statemachine # Monkey patch for pygments reporting an error when generator expressions are # used. @@ -126,6 +128,28 @@ class CMakeModule(Directive): self.state_machine.insert_input(lines, path) return [] +class CMakePolicyList(Directive): + def run(self): + + env = self.state.document.settings.env + with open("PolicyList.json", "r") as f: + policies = json.load(f) + + policiesTocList = """ +.. toctree:: + :maxdepth: 1 + +""" + for policy in policies: + policiesTocList += " " + policy["id"] + \ + " (since " + policy["version"] + ") - " + \ + policy["doc"].replace("<", "").replace(">", "") + \ + "\n" + + include_lines = statemachine.string2lines(policiesTocList) + self.state_machine.insert_input(include_lines, "") + return [] + class _cmake_index_entry: def __init__(self, desc): self.desc = desc @@ -387,6 +411,7 @@ class CMakeDomain(Domain): def setup(app): app.add_directive('cmake-module', CMakeModule) + app.add_directive('cmake-policy-list', CMakePolicyList) app.add_transform(CMakeTransform) app.add_transform(CMakeXRefTransform) app.add_domain(CMakeDomain) diff --git a/Utilities/Sphinx/create-policy-list.py b/Utilities/Sphinx/create-policy-list.py new file mode 100755 index 0000000..d825c66 --- /dev/null +++ b/Utilities/Sphinx/create-policy-list.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python + +import os, sys, json + +def collectString(s): + s = s.strip() + + result = "" + idx = s.find('"') + oldIdx = idx + 1 + i = 0 + while idx != -1: + i = i + 1 + if (i > 10): + break + idx = s.find('"', oldIdx) + result += s[oldIdx:idx] + oldIdx = idx + 1 + nextQuote = s.find('"', oldIdx) + nextComma = s.find(',', oldIdx) + if nextQuote == -1 or (nextComma < nextQuote): + break + oldIdx = nextQuote + 1 + idx = oldIdx + return result, oldIdx + 2 + +def cleanString(s): + return s.replace("\\", "").strip() + +with open(sys.argv[2]) as policyHeader: + content = policyHeader.read() + + start = content.find("CM_FOR_EACH_POLICY_TABLE") + 18 + content = content[start:] + start = content.find("SELECT(POLICY, ") + + policies = [] + + while start != -1: + content = content[start + 15:] + policyId, content = content.split(",", 1) + docString, docLength = collectString(content) + content = content[docLength:] + versionMajor, versionMinor, versionPatch, content = content.split(",", 3) + versionMajor = cleanString(versionMajor) + versionMinor = cleanString(versionMinor) + versionPatch = cleanString(versionPatch) + version = versionMajor + "." + versionMinor + "." + versionPatch + + policies.append({"id": policyId, "doc": docString, "version": version}) + + start = content.find("SELECT(POLICY, ") + + with open(os.path.join(sys.argv[1], "PolicyList.json"), "w") as policiesList: + + policiesList.write(json.dumps(policies)) ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-policies.7.rst | 65 +------------------ Help/policy/CMP0000.rst | 2 +- Help/policy/CMP0001.rst | 2 +- Help/policy/CMP0002.rst | 2 +- Help/policy/CMP0003.rst | 2 +- Help/policy/CMP0004.rst | 2 +- Help/policy/CMP0005.rst | 2 +- Help/policy/CMP0006.rst | 2 +- Help/policy/CMP0007.rst | 2 +- Help/policy/CMP0008.rst | 2 +- Help/policy/CMP0009.rst | 2 +- Help/policy/CMP0010.rst | 2 +- Help/policy/CMP0011.rst | 2 +- Help/policy/CMP0012.rst | 2 +- Help/policy/CMP0013.rst | 2 +- Help/policy/CMP0014.rst | 2 +- Help/policy/CMP0015.rst | 2 +- Help/policy/CMP0016.rst | 2 +- Help/policy/CMP0017.rst | 2 +- Help/policy/CMP0018.rst | 2 +- Help/policy/CMP0019.rst | 2 +- Help/policy/CMP0020.rst | 2 +- Help/policy/CMP0021.rst | 2 +- Help/policy/CMP0022.rst | 2 +- Help/policy/CMP0023.rst | 2 +- Help/policy/CMP0024.rst | 2 +- Help/policy/CMP0025.rst | 2 +- Help/policy/CMP0026.rst | 2 +- Help/policy/CMP0027.rst | 2 +- Help/policy/CMP0028.rst | 2 +- Help/policy/CMP0029.rst | 2 +- Help/policy/CMP0030.rst | 2 +- Help/policy/CMP0031.rst | 2 +- Help/policy/CMP0032.rst | 2 +- Help/policy/CMP0033.rst | 2 +- Help/policy/CMP0034.rst | 2 +- Help/policy/CMP0035.rst | 2 +- Help/policy/CMP0036.rst | 2 +- Help/policy/CMP0037.rst | 2 +- Help/policy/CMP0038.rst | 2 +- Help/policy/CMP0039.rst | 2 +- Help/policy/CMP0040.rst | 2 +- Help/policy/CMP0041.rst | 2 +- Help/policy/CMP0042.rst | 2 +- Help/policy/CMP0043.rst | 2 +- Help/policy/CMP0044.rst | 2 +- Help/policy/CMP0045.rst | 2 +- Help/policy/CMP0046.rst | 2 +- Help/policy/CMP0047.rst | 2 +- Help/policy/CMP0048.rst | 2 +- Help/policy/CMP0049.rst | 2 +- Help/policy/CMP0050.rst | 2 +- Help/policy/CMP0051.rst | 2 +- Help/policy/CMP0052.rst | 2 +- Help/policy/CMP0053.rst | 2 +- Help/policy/CMP0054.rst | 2 +- Help/policy/CMP0055.rst | 2 +- Help/policy/CMP0056.rst | 2 +- Help/policy/CMP0057.rst | 2 +- Help/policy/CMP0058.rst | 2 +- Help/policy/CMP0059.rst | 2 +- Help/policy/CMP0060.rst | 2 +- Source/cmPolicies.cxx | 23 ++++++- Source/cmPolicies.h | 108 +++++++++++++++++++++++++------- Source/cmRST.cxx | 22 +++++++ Source/cmRST.h | 1 + Utilities/Sphinx/CMakeLists.txt | 17 ++++- Utilities/Sphinx/cmake.py | 41 ++++++++++++ Utilities/Sphinx/create-policy-list.py | 66 +++++++++++++++++++ 69 files changed, 315 insertions(+), 150 deletions(-) create mode 100755 Utilities/Sphinx/create-policy-list.py hooks/post-receive -- CMake From steveire at gmail.com Tue May 5 15:17:38 2015 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 5 May 2015 15:17:38 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2521-gc531a84 Message-ID: <20150505191738.DD2A1AEA4C@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, next has been updated via c531a8465108aa25d5f5f991c610aad0a844dad6 (commit) via 23a13fdd62a259587f4098b2cf3a2917812c610c (commit) from e4a206edc199492f5dc7401675ba13bd74091c87 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c531a8465108aa25d5f5f991c610aad0a844dad6 commit c531a8465108aa25d5f5f991c610aad0a844dad6 Merge: e4a206e 23a13fd Author: Stephen Kelly AuthorDate: Tue May 5 15:17:37 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue May 5 15:17:37 2015 -0400 Merge topic 'improve-policies-documentation' into next 23a13fdd Help: Extract Policy doc subtitles from cmPolicies.h http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=23a13fdd62a259587f4098b2cf3a2917812c610c commit 23a13fdd62a259587f4098b2cf3a2917812c610c Author: Stephen Kelly AuthorDate: Tue May 5 18:45:15 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 21:16:55 2015 +0200 Help: Extract Policy doc subtitles from cmPolicies.h Add a new cmake-policy directive and use it in each policy document. Add API to cmPolicies to access it, and teach cmRST to process the new directive. Extend the data table in cmPolicies to include an optional RST formatted string. The documentation used in the cmake-policies toctree must be unformatted so limited duplication (in one file, instead of spread among multiple files) seems to be the correct approach. Extend the create-policy-list.py script to extract the RST formatted text, and use it if present. diff --git a/Help/policy/CMP0000.rst b/Help/policy/CMP0000.rst index 9fbf842..e3c00e8a 100644 --- a/Help/policy/CMP0000.rst +++ b/Help/policy/CMP0000.rst @@ -1,7 +1,7 @@ CMP0000 ------- -A minimum required CMake version must be specified. +.. cmake-policy:: CMP0000 CMake requires that projects specify the version of CMake to which they have been written. This policy has been put in place so users diff --git a/Help/policy/CMP0001.rst b/Help/policy/CMP0001.rst index 344f1e2..34d2f7d 100644 --- a/Help/policy/CMP0001.rst +++ b/Help/policy/CMP0001.rst @@ -1,7 +1,7 @@ CMP0001 ------- -CMAKE_BACKWARDS_COMPATIBILITY should no longer be used. +.. cmake-policy:: CMP0001 The OLD behavior is to check CMAKE_BACKWARDS_COMPATIBILITY and present it to the user. The NEW behavior is to ignore diff --git a/Help/policy/CMP0002.rst b/Help/policy/CMP0002.rst index 2c15bd4..105d1ee 100644 --- a/Help/policy/CMP0002.rst +++ b/Help/policy/CMP0002.rst @@ -1,7 +1,7 @@ CMP0002 ------- -Logical target names must be globally unique. +.. cmake-policy:: CMP0002 Targets names created with add_executable, add_library, or add_custom_target are logical build target names. Logical target diff --git a/Help/policy/CMP0003.rst b/Help/policy/CMP0003.rst index 27b83f8..7c5007f 100644 --- a/Help/policy/CMP0003.rst +++ b/Help/policy/CMP0003.rst @@ -1,7 +1,7 @@ CMP0003 ------- -Libraries linked via full path no longer produce linker search paths. +.. cmake-policy:: CMP0003 This policy affects how libraries whose full paths are NOT known are found at link time, but was created due to a change in how CMake deals diff --git a/Help/policy/CMP0004.rst b/Help/policy/CMP0004.rst index 80045f5..b06e214 100644 --- a/Help/policy/CMP0004.rst +++ b/Help/policy/CMP0004.rst @@ -1,7 +1,7 @@ CMP0004 ------- -Libraries linked may not have leading or trailing whitespace. +.. cmake-policy:: CMP0004 CMake versions 2.4 and below silently removed leading and trailing whitespace from libraries linked with code like diff --git a/Help/policy/CMP0005.rst b/Help/policy/CMP0005.rst index c11a9e6..b86f550 100644 --- a/Help/policy/CMP0005.rst +++ b/Help/policy/CMP0005.rst @@ -1,7 +1,7 @@ CMP0005 ------- -Preprocessor definition values are now escaped automatically. +.. cmake-policy:: CMP0005 This policy determines whether or not CMake should generate escaped preprocessor definition values added via add_definitions. CMake diff --git a/Help/policy/CMP0006.rst b/Help/policy/CMP0006.rst index 8d1e5bd..abce5c5 100644 --- a/Help/policy/CMP0006.rst +++ b/Help/policy/CMP0006.rst @@ -1,7 +1,7 @@ CMP0006 ------- -Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION. +.. cmake-policy:: CMP0006 This policy determines whether the install(TARGETS) command must be given a BUNDLE DESTINATION when asked to install a target with the diff --git a/Help/policy/CMP0007.rst b/Help/policy/CMP0007.rst index f0d8c16..7cbc47d 100644 --- a/Help/policy/CMP0007.rst +++ b/Help/policy/CMP0007.rst @@ -1,7 +1,7 @@ CMP0007 ------- -list command no longer ignores empty elements. +.. cmake-policy:: CMP0007 This policy determines whether the list command will ignore empty elements in the list. CMake 2.4 and below list commands ignored all diff --git a/Help/policy/CMP0008.rst b/Help/policy/CMP0008.rst index b118ece..a02493e 100644 --- a/Help/policy/CMP0008.rst +++ b/Help/policy/CMP0008.rst @@ -1,7 +1,7 @@ CMP0008 ------- -Libraries linked by full-path must have a valid library file name. +.. cmake-policy:: CMP0008 In CMake 2.4 and below it is possible to write code like diff --git a/Help/policy/CMP0009.rst b/Help/policy/CMP0009.rst index 481af1a..f0a209e 100644 --- a/Help/policy/CMP0009.rst +++ b/Help/policy/CMP0009.rst @@ -1,7 +1,7 @@ CMP0009 ------- -FILE GLOB_RECURSE calls should not follow symlinks by default. +.. cmake-policy:: CMP0009 In CMake 2.6.1 and below, FILE GLOB_RECURSE calls would follow through symlinks, sometimes coming up with unexpectedly large result sets diff --git a/Help/policy/CMP0010.rst b/Help/policy/CMP0010.rst index 9d2eb76..1cf549b 100644 --- a/Help/policy/CMP0010.rst +++ b/Help/policy/CMP0010.rst @@ -1,7 +1,7 @@ CMP0010 ------- -Bad variable reference syntax is an error. +.. cmake-policy:: CMP0010 In CMake 2.6.2 and below, incorrect variable reference syntax such as a missing close-brace ("${FOO") was reported but did not stop diff --git a/Help/policy/CMP0011.rst b/Help/policy/CMP0011.rst index 0f41fff..1ca4ff1 100644 --- a/Help/policy/CMP0011.rst +++ b/Help/policy/CMP0011.rst @@ -1,7 +1,7 @@ CMP0011 ------- -Included scripts do automatic cmake_policy PUSH and POP. +.. cmake-policy:: CMP0011 In CMake 2.6.2 and below, CMake Policy settings in scripts loaded by the include() and find_package() commands would affect the includer. diff --git a/Help/policy/CMP0012.rst b/Help/policy/CMP0012.rst index 7a749bf..63d1a52 100644 --- a/Help/policy/CMP0012.rst +++ b/Help/policy/CMP0012.rst @@ -1,7 +1,7 @@ CMP0012 ------- -if() recognizes numbers and boolean constants. +.. cmake-policy:: CMP0012 In CMake versions 2.6.4 and lower the if() command implicitly dereferenced arguments corresponding to variables, even those named diff --git a/Help/policy/CMP0013.rst b/Help/policy/CMP0013.rst index e99997b..a6ec06a 100644 --- a/Help/policy/CMP0013.rst +++ b/Help/policy/CMP0013.rst @@ -1,7 +1,7 @@ CMP0013 ------- -Duplicate binary directories are not allowed. +.. cmake-policy:: CMP0013 CMake 2.6.3 and below silently permitted add_subdirectory() calls to create the same binary directory multiple times. During build system diff --git a/Help/policy/CMP0014.rst b/Help/policy/CMP0014.rst index 37178d1..8c34caa 100644 --- a/Help/policy/CMP0014.rst +++ b/Help/policy/CMP0014.rst @@ -1,7 +1,7 @@ CMP0014 ------- -Input directories must have CMakeLists.txt. +.. cmake-policy:: CMP0014 CMake versions before 2.8 silently ignored missing CMakeLists.txt files in directories referenced by add_subdirectory() or subdirs(), diff --git a/Help/policy/CMP0015.rst b/Help/policy/CMP0015.rst index 1b54979..5067e03 100644 --- a/Help/policy/CMP0015.rst +++ b/Help/policy/CMP0015.rst @@ -1,7 +1,7 @@ CMP0015 ------- -link_directories() treats paths relative to the source dir. +.. cmake-policy:: CMP0015 In CMake 2.8.0 and lower the link_directories() command passed relative paths unchanged to the linker. In CMake 2.8.1 and above the diff --git a/Help/policy/CMP0016.rst b/Help/policy/CMP0016.rst index 743b1a9..c818da3 100644 --- a/Help/policy/CMP0016.rst +++ b/Help/policy/CMP0016.rst @@ -1,7 +1,7 @@ CMP0016 ------- -target_link_libraries() reports error if its only argument is not a target. +.. cmake-policy:: CMP0016 In CMake 2.8.2 and lower the target_link_libraries() command silently ignored if it was called with only one argument, and this argument diff --git a/Help/policy/CMP0017.rst b/Help/policy/CMP0017.rst index f74e6f0..01b7d93 100644 --- a/Help/policy/CMP0017.rst +++ b/Help/policy/CMP0017.rst @@ -1,7 +1,7 @@ CMP0017 ------- -Prefer files from the CMake module directory when including from there. +.. cmake-policy:: CMP0017 Starting with CMake 2.8.4, if a cmake-module shipped with CMake (i.e. located in the CMake module directory) calls include() or diff --git a/Help/policy/CMP0018.rst b/Help/policy/CMP0018.rst index 0f68267..1ebea5e 100644 --- a/Help/policy/CMP0018.rst +++ b/Help/policy/CMP0018.rst @@ -1,7 +1,7 @@ CMP0018 ------- -Ignore CMAKE_SHARED_LIBRARY__FLAGS variable. +.. cmake-policy:: CMP0018 CMake 2.8.8 and lower compiled sources in SHARED and MODULE libraries using the value of the undocumented CMAKE_SHARED_LIBRARY__FLAGS diff --git a/Help/policy/CMP0019.rst b/Help/policy/CMP0019.rst index 2b37fa1..114c5fc 100644 --- a/Help/policy/CMP0019.rst +++ b/Help/policy/CMP0019.rst @@ -1,7 +1,7 @@ CMP0019 ------- -Do not re-expand variables in include and link information. +.. cmake-policy:: CMP0019 CMake 2.8.10 and lower re-evaluated values given to the include_directories, link_directories, and link_libraries commands to diff --git a/Help/policy/CMP0020.rst b/Help/policy/CMP0020.rst index 6767d08..4e4476c 100644 --- a/Help/policy/CMP0020.rst +++ b/Help/policy/CMP0020.rst @@ -1,7 +1,7 @@ CMP0020 ------- -Automatically link Qt executables to qtmain target on Windows. +.. cmake-policy:: CMP0020 CMake 2.8.10 and lower required users of Qt to always specify a link dependency to the qtmain.lib static library manually on Windows. diff --git a/Help/policy/CMP0021.rst b/Help/policy/CMP0021.rst index 3f5bd03..18f2b40 100644 --- a/Help/policy/CMP0021.rst +++ b/Help/policy/CMP0021.rst @@ -1,7 +1,7 @@ CMP0021 ------- -Fatal error on relative paths in INCLUDE_DIRECTORIES target property. +.. cmake-policy:: CMP0021 CMake 2.8.10.2 and lower allowed the INCLUDE_DIRECTORIES target property to contain relative paths. The base path for such relative diff --git a/Help/policy/CMP0022.rst b/Help/policy/CMP0022.rst index 22c7c4f..b8d6ecb 100644 --- a/Help/policy/CMP0022.rst +++ b/Help/policy/CMP0022.rst @@ -1,7 +1,7 @@ CMP0022 ------- -INTERFACE_LINK_LIBRARIES defines the link interface. +.. cmake-policy:: CMP0022 CMake 2.8.11 constructed the 'link interface' of a target from properties matching ``(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_)?``. diff --git a/Help/policy/CMP0023.rst b/Help/policy/CMP0023.rst index 962b624..5063787 100644 --- a/Help/policy/CMP0023.rst +++ b/Help/policy/CMP0023.rst @@ -1,7 +1,7 @@ CMP0023 ------- -Plain and keyword target_link_libraries signatures cannot be mixed. +.. cmake-policy:: CMP0023 CMake 2.8.12 introduced the target_link_libraries signature using the PUBLIC, PRIVATE, and INTERFACE keywords to generalize the LINK_PUBLIC diff --git a/Help/policy/CMP0024.rst b/Help/policy/CMP0024.rst index ee53d5f..b4c4c92 100644 --- a/Help/policy/CMP0024.rst +++ b/Help/policy/CMP0024.rst @@ -1,7 +1,7 @@ CMP0024 ------- -Disallow include export result. +.. cmake-policy:: CMP0024 CMake 2.8.12 and lower allowed use of the include() command with the result of the export() command. This relies on the assumption that diff --git a/Help/policy/CMP0025.rst b/Help/policy/CMP0025.rst index 8d19edf..bfc4687 100644 --- a/Help/policy/CMP0025.rst +++ b/Help/policy/CMP0025.rst @@ -1,7 +1,7 @@ CMP0025 ------- -Compiler id for Apple Clang is now ``AppleClang``. +.. cmake-policy:: CMP0025 CMake 3.0 and above recognize that Apple Clang is a different compiler than upstream Clang and that they have different version numbers. diff --git a/Help/policy/CMP0026.rst b/Help/policy/CMP0026.rst index 4889249..5b42a1e 100644 --- a/Help/policy/CMP0026.rst +++ b/Help/policy/CMP0026.rst @@ -1,7 +1,7 @@ CMP0026 ------- -Disallow use of the LOCATION property for build targets. +.. cmake-policy:: CMP0026 CMake 2.8.12 and lower allowed reading the LOCATION target property (and configuration-specific variants) to diff --git a/Help/policy/CMP0027.rst b/Help/policy/CMP0027.rst index bedaffe..f2af8ac 100644 --- a/Help/policy/CMP0027.rst +++ b/Help/policy/CMP0027.rst @@ -1,7 +1,7 @@ CMP0027 ------- -Conditionally linked imported targets with missing include directories. +.. cmake-policy:: CMP0027 CMake 2.8.11 introduced introduced the concept of INTERFACE_INCLUDE_DIRECTORIES, and a check at cmake time that the diff --git a/Help/policy/CMP0028.rst b/Help/policy/CMP0028.rst index 24889ec..db58231 100644 --- a/Help/policy/CMP0028.rst +++ b/Help/policy/CMP0028.rst @@ -1,7 +1,7 @@ CMP0028 ------- -Double colon in target name means ALIAS or IMPORTED target. +.. cmake-policy:: CMP0028 CMake 2.8.12 and lower allowed the use of targets and files with double colons in target_link_libraries, with some buildsystem generators. diff --git a/Help/policy/CMP0029.rst b/Help/policy/CMP0029.rst index 8f58a12..70a8909 100644 --- a/Help/policy/CMP0029.rst +++ b/Help/policy/CMP0029.rst @@ -1,7 +1,7 @@ CMP0029 ------- -The :command:`subdir_depends` command should not be called. +.. cmake-policy:: CMP0029 The implementation of this command has been empty since December 2001 but was kept in CMake for compatibility for a long time. diff --git a/Help/policy/CMP0030.rst b/Help/policy/CMP0030.rst index 9e31b38..98bc070 100644 --- a/Help/policy/CMP0030.rst +++ b/Help/policy/CMP0030.rst @@ -1,7 +1,7 @@ CMP0030 ------- -The :command:`use_mangled_mesa` command should not be called. +.. cmake-policy:: CMP0030 This command was created in September 2001 to support VTK before modern CMake language and custom command capabilities. VTK has diff --git a/Help/policy/CMP0031.rst b/Help/policy/CMP0031.rst index 6b89558..857eb16 100644 --- a/Help/policy/CMP0031.rst +++ b/Help/policy/CMP0031.rst @@ -1,7 +1,7 @@ CMP0031 ------- -The :command:`load_command` command should not be called. +.. cmake-policy:: CMP0031 This command was added in August 2002 to allow projects to add arbitrary commands implemented in C or C++. However, it does diff --git a/Help/policy/CMP0032.rst b/Help/policy/CMP0032.rst index f394a06..e4e59d5 100644 --- a/Help/policy/CMP0032.rst +++ b/Help/policy/CMP0032.rst @@ -1,7 +1,7 @@ CMP0032 ------- -The :command:`output_required_files` command should not be called. +.. cmake-policy:: CMP0032 This command was added in June 2001 to expose the then-current CMake implicit dependency scanner. CMake's real implicit dependency scanner diff --git a/Help/policy/CMP0033.rst b/Help/policy/CMP0033.rst index b420065..7709d81 100644 --- a/Help/policy/CMP0033.rst +++ b/Help/policy/CMP0033.rst @@ -1,7 +1,7 @@ CMP0033 ------- -The :command:`export_library_dependencies` command should not be called. +.. cmake-policy:: CMP0033 This command was added in January 2003 to export ``_LIB_DEPENDS`` internal CMake cache entries to a file for installation with a project. diff --git a/Help/policy/CMP0034.rst b/Help/policy/CMP0034.rst index 2133997..3755d08 100644 --- a/Help/policy/CMP0034.rst +++ b/Help/policy/CMP0034.rst @@ -1,7 +1,7 @@ CMP0034 ------- -The :command:`utility_source` command should not be called. +.. cmake-policy:: CMP0034 This command was introduced in March 2001 to help build executables used to generate other files. This approach has long been replaced by diff --git a/Help/policy/CMP0035.rst b/Help/policy/CMP0035.rst index 7335b22..75b8189 100644 --- a/Help/policy/CMP0035.rst +++ b/Help/policy/CMP0035.rst @@ -1,7 +1,7 @@ CMP0035 ------- -The :command:`variable_requires` command should not be called. +.. cmake-policy:: CMP0035 This command was introduced in November 2001 to perform some conditional logic. It has long been replaced by the :command:`if` command. diff --git a/Help/policy/CMP0036.rst b/Help/policy/CMP0036.rst index 817f156..be13726 100644 --- a/Help/policy/CMP0036.rst +++ b/Help/policy/CMP0036.rst @@ -1,7 +1,7 @@ CMP0036 ------- -The :command:`build_name` command should not be called. +.. cmake-policy:: CMP0036 This command was added in May 2001 to compute a name for the current operating system and compiler combination. The command has long been diff --git a/Help/policy/CMP0037.rst b/Help/policy/CMP0037.rst index 4d485bf..3107e50 100644 --- a/Help/policy/CMP0037.rst +++ b/Help/policy/CMP0037.rst @@ -1,7 +1,7 @@ CMP0037 ------- -Target names should not be reserved and should match a validity pattern. +.. cmake-policy:: CMP0037 CMake 2.8.12 and lower allowed creating targets using :command:`add_library`, :command:`add_executable` and :command:`add_custom_target` with unrestricted diff --git a/Help/policy/CMP0038.rst b/Help/policy/CMP0038.rst index df5af6a..b094db3 100644 --- a/Help/policy/CMP0038.rst +++ b/Help/policy/CMP0038.rst @@ -1,7 +1,7 @@ CMP0038 ------- -Targets may not link directly to themselves. +.. cmake-policy:: CMP0038 CMake 2.8.12 and lower allowed a build target to link to itself directly with a :command:`target_link_libraries` call. This is an indicator of a bug in diff --git a/Help/policy/CMP0039.rst b/Help/policy/CMP0039.rst index 58ccc41..4477d2a 100644 --- a/Help/policy/CMP0039.rst +++ b/Help/policy/CMP0039.rst @@ -1,7 +1,7 @@ CMP0039 ------- -Utility targets may not have link dependencies. +.. cmake-policy:: CMP0039 CMake 2.8.12 and lower allowed using utility targets in the left hand side position of the :command:`target_link_libraries` command. This is an indicator diff --git a/Help/policy/CMP0040.rst b/Help/policy/CMP0040.rst index 77a3c81..7e72ee2 100644 --- a/Help/policy/CMP0040.rst +++ b/Help/policy/CMP0040.rst @@ -1,7 +1,7 @@ CMP0040 ------- -The target in the TARGET signature of add_custom_command() must exist. +.. cmake-policy:: CMP0040 CMake 2.8.12 and lower silently ignored a custom command created with the TARGET signature of :command:`add_custom_command` diff --git a/Help/policy/CMP0041.rst b/Help/policy/CMP0041.rst index 5a47de0..975626d 100644 --- a/Help/policy/CMP0041.rst +++ b/Help/policy/CMP0041.rst @@ -1,7 +1,7 @@ CMP0041 ------- -Error on relative include with generator expression. +.. cmake-policy:: CMP0041 Diagnostics in CMake 2.8.12 and lower silently ignored an entry in the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of a target if it contained a generator diff --git a/Help/policy/CMP0042.rst b/Help/policy/CMP0042.rst index fce870c..c385e57 100644 --- a/Help/policy/CMP0042.rst +++ b/Help/policy/CMP0042.rst @@ -1,7 +1,7 @@ CMP0042 ------- -:prop_tgt:`MACOSX_RPATH` is enabled by default. +.. cmake-policy:: CMP0042 CMake 2.8.12 and newer has support for using ``@rpath`` in a target's install name. This was enabled by setting the target property diff --git a/Help/policy/CMP0043.rst b/Help/policy/CMP0043.rst index 629e502..93fd911 100644 --- a/Help/policy/CMP0043.rst +++ b/Help/policy/CMP0043.rst @@ -1,7 +1,7 @@ CMP0043 ------- -Ignore COMPILE_DEFINITIONS_ properties +.. cmake-policy:: CMP0043 CMake 2.8.12 and lower allowed setting the :prop_tgt:`COMPILE_DEFINITIONS_` target property and diff --git a/Help/policy/CMP0044.rst b/Help/policy/CMP0044.rst index 4a3e215..a980c90 100644 --- a/Help/policy/CMP0044.rst +++ b/Help/policy/CMP0044.rst @@ -1,7 +1,7 @@ CMP0044 ------- -Case sensitive ``_COMPILER_ID`` generator expressions +.. cmake-policy:: CMP0044 CMake 2.8.12 introduced the ``_COMPILER_ID`` :manual:`generator expressions ` to allow diff --git a/Help/policy/CMP0045.rst b/Help/policy/CMP0045.rst index 58c422f..a7eac7b 100644 --- a/Help/policy/CMP0045.rst +++ b/Help/policy/CMP0045.rst @@ -1,7 +1,7 @@ CMP0045 ------- -Error on non-existent target in get_target_property. +.. cmake-policy:: CMP0045 In CMake 2.8.12 and lower, the :command:`get_target_property` command accepted a non-existent target argument without issuing any error or warning. The diff --git a/Help/policy/CMP0046.rst b/Help/policy/CMP0046.rst index 1a3bc65..e03b632 100644 --- a/Help/policy/CMP0046.rst +++ b/Help/policy/CMP0046.rst @@ -1,7 +1,7 @@ CMP0046 ------- -Error on non-existent dependency in add_dependencies. +.. cmake-policy:: CMP0046 CMake 2.8.12 and lower silently ignored non-existent dependencies listed in the :command:`add_dependencies` command. diff --git a/Help/policy/CMP0047.rst b/Help/policy/CMP0047.rst index 26ae439..86e6a89 100644 --- a/Help/policy/CMP0047.rst +++ b/Help/policy/CMP0047.rst @@ -1,7 +1,7 @@ CMP0047 ------- -Use ``QCC`` compiler id for the qcc drivers on QNX. +.. cmake-policy:: CMP0047 CMake 3.0 and above recognize that the QNX qcc compiler driver is different from the GNU compiler. diff --git a/Help/policy/CMP0048.rst b/Help/policy/CMP0048.rst index a54205e..25e23bd 100644 --- a/Help/policy/CMP0048.rst +++ b/Help/policy/CMP0048.rst @@ -1,7 +1,7 @@ CMP0048 ------- -The :command:`project` command manages VERSION variables. +.. cmake-policy:: CMP0048 CMake version 3.0 introduced the ``VERSION`` option of the :command:`project` command to specify a project version as well as the name. In order to keep diff --git a/Help/policy/CMP0049.rst b/Help/policy/CMP0049.rst index 5c8d4a8..b95d811 100644 --- a/Help/policy/CMP0049.rst +++ b/Help/policy/CMP0049.rst @@ -1,7 +1,7 @@ CMP0049 ------- -Do not expand variables in target source entries. +.. cmake-policy:: CMP0049 CMake 2.8.12 and lower performed and extra layer of variable expansion when evaluating source file names: diff --git a/Help/policy/CMP0050.rst b/Help/policy/CMP0050.rst index 76ae0aa..e4c6735 100644 --- a/Help/policy/CMP0050.rst +++ b/Help/policy/CMP0050.rst @@ -1,7 +1,7 @@ CMP0050 ------- -Disallow add_custom_command SOURCE signatures. +.. cmake-policy:: CMP0050 CMake 2.8.12 and lower allowed a signature for :command:`add_custom_command` which specified an input to a command. This was undocumented behavior. diff --git a/Help/policy/CMP0051.rst b/Help/policy/CMP0051.rst index 1b56cb0..19e1b37 100644 --- a/Help/policy/CMP0051.rst +++ b/Help/policy/CMP0051.rst @@ -1,7 +1,7 @@ CMP0051 ------- -List TARGET_OBJECTS in SOURCES target property. +.. cmake-policy:: CMP0051 CMake 3.0 and lower did not include the ``TARGET_OBJECTS`` :manual:`generator expression ` when diff --git a/Help/policy/CMP0052.rst b/Help/policy/CMP0052.rst index 48cfc9c..5a86f8a 100644 --- a/Help/policy/CMP0052.rst +++ b/Help/policy/CMP0052.rst @@ -1,7 +1,7 @@ CMP0052 ------- -Reject source and build dirs in installed INTERFACE_INCLUDE_DIRECTORIES. +.. cmake-policy:: CMP0052 CMake 3.0 and lower allowed subdirectories of the source directory or build directory to be in the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of diff --git a/Help/policy/CMP0053.rst b/Help/policy/CMP0053.rst index bb0ff8b..5d1bb34 100644 --- a/Help/policy/CMP0053.rst +++ b/Help/policy/CMP0053.rst @@ -1,7 +1,7 @@ CMP0053 ------- -Simplify variable reference and escape sequence evaluation. +.. cmake-policy:: CMP0053 CMake 3.1 introduced a much faster implementation of evaluation of the :ref:`Variable References` and :ref:`Escape Sequences` documented in the diff --git a/Help/policy/CMP0054.rst b/Help/policy/CMP0054.rst index 3754fda..6e72b1c 100644 --- a/Help/policy/CMP0054.rst +++ b/Help/policy/CMP0054.rst @@ -1,7 +1,7 @@ CMP0054 ------- -Only interpret :command:`if` arguments as variables or keywords when unquoted. +.. cmake-policy:: CMP0054 CMake 3.1 and above no longer implicitly dereference variables or interpret keywords in an :command:`if` command argument when diff --git a/Help/policy/CMP0055.rst b/Help/policy/CMP0055.rst index fe7ab6f..a64f85b 100644 --- a/Help/policy/CMP0055.rst +++ b/Help/policy/CMP0055.rst @@ -1,7 +1,7 @@ CMP0055 ------- -Strict checking for the :command:`break` command. +.. cmake-policy:: CMP0055 CMake 3.1 and lower allowed calls to the :command:`break` command outside of a loop context and also ignored any given arguments. diff --git a/Help/policy/CMP0056.rst b/Help/policy/CMP0056.rst index 3c75ff4..3fa0889 100644 --- a/Help/policy/CMP0056.rst +++ b/Help/policy/CMP0056.rst @@ -1,7 +1,7 @@ CMP0056 ------- -Honor link flags in :command:`try_compile` source-file signature. +.. cmake-policy:: CMP0056 The :command:`try_compile` command source-file signature generates a ``CMakeLists.txt`` file to build the source file into an executable. diff --git a/Help/policy/CMP0057.rst b/Help/policy/CMP0057.rst index 1298a16..ef18ac4 100644 --- a/Help/policy/CMP0057.rst +++ b/Help/policy/CMP0057.rst @@ -1,7 +1,7 @@ CMP0057 ------- -Support new :command:`if` IN_LIST operator. +.. cmake-policy:: CMP0057 CMake 3.3 adds support for the new IN_LIST operator. diff --git a/Help/policy/CMP0058.rst b/Help/policy/CMP0058.rst index 0f20383..1d0c0a9 100644 --- a/Help/policy/CMP0058.rst +++ b/Help/policy/CMP0058.rst @@ -1,7 +1,7 @@ CMP0058 ------- -Ninja requires custom command byproducts to be explicit. +.. cmake-policy:: CMP0058 When an intermediate file generated during the build is consumed by an expensive operation or a large tree of dependents, one may diff --git a/Help/policy/CMP0059.rst b/Help/policy/CMP0059.rst index e40f450..cc717a5 100644 --- a/Help/policy/CMP0059.rst +++ b/Help/policy/CMP0059.rst @@ -1,7 +1,7 @@ CMP0059 ------- -Don't treat ``DEFINITIONS`` as a built-in directory property. +.. cmake-policy:: CMP0059 CMake 3.3 and above no longer make a list of definitions available through the :prop_dir:`DEFINITIONS` directory property. The diff --git a/Help/policy/CMP0060.rst b/Help/policy/CMP0060.rst index cc37b1b..b249f84 100644 --- a/Help/policy/CMP0060.rst +++ b/Help/policy/CMP0060.rst @@ -1,7 +1,7 @@ CMP0060 ------- -Link libraries by full path even in implicit directories. +.. cmake-policy:: CMP0060 Policy :policy:`CMP0003` was introduced with the intention of always linking library files by full path when a full path is given to the diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index f8d61db..599c174 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -45,14 +45,18 @@ static bool stringToId(const char* input, cmPolicies::PolicyID& pid) return true; } -#define CM_SELECT_ID_VERSION(F, A1, A2, A3, A4, A5, A6) F(A1, A3, A4, A5) +#define CM_SELECT_ID_VERSION(F, A1, A2, A3, A4, A5, A6, A7) F(A1, A4, A5, A6) #define CM_FOR_EACH_POLICY_ID_VERSION(POLICY) \ CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID_VERSION) -#define CM_SELECT_ID_DOC(F, A1, A2, A3, A4, A5, A6) F(A1, A2) +#define CM_SELECT_ID_DOC(F, A1, A2, A3, A4, A5, A6, A7) F(A1, A2) #define CM_FOR_EACH_POLICY_ID_DOC(POLICY) \ CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID_DOC) +#define CM_SELECT_ID_RST(F, A1, A2, A3, A4, A5, A6, A7) F(A1, A3) +#define CM_FOR_EACH_POLICY_ID_RST(POLICY) \ + CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID_RST) + static const char* idToString(cmPolicies::PolicyID id) { switch(id) @@ -343,6 +347,21 @@ cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id) return e.str(); } +std::string cmPolicies::GetPolicyDocTitle(cmPolicies::PolicyID id) +{ + switch(id) + { +#define POLICY_CASE(ID, DOC_TITLE) \ + case cmPolicies::ID: \ + return DOC_TITLE; + CM_FOR_EACH_POLICY_ID_RST(POLICY_CASE) +#undef POLICY_CASE + case cmPolicies::CMPCOUNT: + return 0; + } + return 0; +} + cmPolicies::PolicyMap::PolicyMap() { this->UNDEFINED.set(); diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 63376dd..226b43d 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -21,196 +21,260 @@ class cmPolicy; #define CM_FOR_EACH_POLICY_TABLE(POLICY, SELECT) \ SELECT(POLICY, CMP0000, \ - "A minimum required CMake version must be specified.", \ + "A minimum required CMake version must be specified.", 0, \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0001, \ "CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.", \ + ":variable:`CMAKE_BACKWARDS_COMPATIBILITY` should no longer be used.", \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0002, \ - "Logical target names must be globally unique.", \ + "Logical target names must be globally unique.", 0, \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0003, \ "Libraries linked via full path no longer produce linker search paths.", \ + 0, \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0004, \ - "Libraries linked may not have leading or trailing whitespace.", \ + "Libraries linked may not have leading or trailing whitespace.", 0, \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0005, \ - "Preprocessor definition values are now escaped automatically.", \ + "Preprocessor definition values are now escaped automatically.", 0, \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0006, \ "Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.", \ + "Installing :prop_tgt:`MACOSX_BUNDLE` targets requires a " \ + ":command:`BUNDLE DESTINATION `.", \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0007, \ "list command no longer ignores empty elements.", \ + ":command:`list()` command no longer ignores empty elements.", \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0008, \ - "Libraries linked by full-path must have a valid library file name.", \ + "Libraries linked by full-path must have a valid library file name.", 0, \ 2, 6, 1, cmPolicies::WARN) \ SELECT(POLICY, CMP0009, \ "FILE GLOB_RECURSE calls should not follow symlinks by default.", \ + ":command:`file(GLOB_RECURSE)` calls should not follow symlinks by " \ + "default.", \ 2, 6, 2, cmPolicies::WARN) \ SELECT(POLICY, CMP0010, \ - "Bad variable reference syntax is an error.", \ + "Bad variable reference syntax is an error.", 0, \ 2, 6, 3, cmPolicies::WARN) \ SELECT(POLICY, CMP0011, \ "Included scripts do automatic cmake_policy PUSH and POP.", \ + ":command:`Included ` scripts do automatic " \ + ":command:`cmake_policy` ``PUSH`` and ``POP``.", \ 2, 6, 3, cmPolicies::WARN) \ SELECT(POLICY, CMP0012, \ "if() recognizes numbers and boolean constants.", \ + ":command:`if()` recognizes numbers and boolean constants.", \ 2, 8, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0013, \ - "Duplicate binary directories are not allowed.", \ + "Duplicate binary directories are not allowed.", 0, \ 2, 8, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0014, \ - "Input directories must have CMakeLists.txt.", \ + "Input directories must have CMakeLists.txt.", 0, \ 2, 8, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0015, \ "link_directories() treats paths relative to the source dir.", \ + ":command:`link_directories()` treats paths relative to the " \ + ":variable:`CMAKE_CURRENT_SOURCE_DIR`.", \ 2, 8, 1, cmPolicies::WARN) \ SELECT(POLICY, CMP0016, \ "target_link_libraries() reports error if its only argument " \ "is not a target.", \ + ":command:`target_link_libraries()` reports error if its only argument " \ + "is not a target.", \ 2, 8, 3, cmPolicies::WARN) \ SELECT(POLICY, CMP0017, \ "Prefer files from the CMake module directory when including from " \ - "there.", \ + "there.", 0, \ 2, 8, 4, cmPolicies::WARN) \ SELECT(POLICY, CMP0018, \ - "Ignore CMAKE_SHARED_LIBRARY__FLAGS variable.", \ + "Ignore CMAKE_SHARED_LIBRARY__FLAGS variable.", 0, \ 2, 8, 9, cmPolicies::WARN) \ SELECT(POLICY, CMP0019, \ - "Do not re-expand variables in include and link information.", \ + "Do not re-expand variables in include and link information.", 0, \ 2, 8, 11, cmPolicies::WARN) \ SELECT(POLICY, CMP0020, \ "Automatically link Qt executables to qtmain target on Windows.", \ + "Automatically link :manual:`Qt executables ` to qtmain " \ + "target on Windows.", \ 2, 8, 11, cmPolicies::WARN) \ SELECT(POLICY, CMP0021, \ "Fatal error on relative paths in INCLUDE_DIRECTORIES target property.", \ + "Fatal error on relative paths in :prop_tgt:`INCLUDE_DIRECTORIES` " \ + "target property.", \ 2, 8, 12, cmPolicies::WARN) \ SELECT(POLICY, CMP0022, \ "INTERFACE_LINK_LIBRARIES defines the link interface.", \ + ":prop_tgt:`INTERFACE_LINK_LIBRARIES` defines the link interface.", \ 2, 8, 12, cmPolicies::WARN) \ SELECT(POLICY, CMP0023, \ "Plain and keyword target_link_libraries signatures cannot be mixed.", \ + "Plain and keyword :command:`target_link_libraries()` signatures cannot " \ + "be mixed.", \ 2, 8, 12, cmPolicies::WARN) \ SELECT(POLICY, CMP0024, \ - "Disallow include export result.", \ + "Disallow include() of export() result.", \ + "Disallow :command:`include()` of :command:`export()` result.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0025, \ "Compiler id for Apple Clang is now AppleClang.", \ + ":variable:`Compiler id _COMPILER_ID>` for Apple Clang is " \ + "now ``AppleClang``.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0026, \ "Disallow use of the LOCATION target property.", \ + "Disallow use of the :prop_tgt:`LOCATION` target property.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0027, \ - "Conditionally linked imported targets with missing include " \ + "Conditionally linked IMPORTED targets with missing include " \ + "directories.", \ + "Conditionally linked :prop_tgt:`IMPORTED` targets with missing include " \ "directories.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0028, \ "Double colon in target name means ALIAS or IMPORTED target.", \ + "Double colon in target name means :ref:`ALIAS ` or " \ + ":ref:`IMPORTED ` target.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0029, \ "The subdir_depends command should not be called.", \ + "The :command:`subdir_depends()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0030, \ "The use_mangled_mesa command should not be called.", \ + "The :command:`use_mangled_mesa()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0031, \ "The load_command command should not be called.", \ + "The :command:`load_command()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0032, \ "The output_required_files command should not be called.", \ + "The :command:`output_required_files()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0033, \ "The export_library_dependencies command should not be called.", \ + "The :command:`export_library_dependencies()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0034, \ "The utility_source command should not be called.", \ + "The :command:`utility_source()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0035, \ "The variable_requires command should not be called.", \ + "The :command:`variable_requires()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0036, \ "The build_name command should not be called.", \ + "The :command:`build_name()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0037, \ "Target names should not be reserved and should match a validity " \ "pattern.", \ + "Target :prop_tgt:`names ` should not be reserved and should " \ + "match a validity pattern.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0038, \ - "Targets may not link directly to themselves.", \ + "Targets may not link directly to themselves.", 0, \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0039, \ - "Utility targets may not have link dependencies.", \ + "Utility targets may not have link dependencies.", 0, \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0040, \ "The target in the TARGET signature of add_custom_command() must " \ "exist.", \ + "The target in the ``TARGET`` signature of " \ + ":command:`add_custom_command()` must exist.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0041, \ "Error on relative include with generator expression.", \ + "Error on relative include with " \ + ":manual:`generator expression `.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0042, \ "MACOSX_RPATH is enabled by default.", \ + ":prop_tgt:`MACOSX_RPATH` is enabled by default.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0043, \ "Ignore COMPILE_DEFINITIONS_ properties.", \ + "Ignore ``COMPILE_DEFINITIONS_`` properties.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0044, \ "Case sensitive _COMPILER_ID generator expressions.", \ + "Case sensitive ``_COMPILER_ID`` " \ + ":manual:`generator expression `", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0045, \ "Error on non-existent target in get_target_property.", \ + "Error on non-existent target in :command:`get_target_property()`.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0046, \ "Error on non-existent dependency in add_dependencies.", \ + "Error on non-existent dependency in :command:`add_dependencies()`.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0047, \ "Use QCC compiler id for the qcc drivers on QNX.", \ + "Use ``QCC`` :variable:`compiler id _COMPILER_ID>` for " \ + "the qcc drivers on QNX.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0048, \ "project() command manages VERSION variables.", \ + ":command:`project()` command manages ``VERSION`` variables.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0049, \ - "Do not expand variables in target source entries.", \ + "Do not expand variables in target source entries.", 0, \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0050, \ "Disallow add_custom_command SOURCE signatures.", \ + "Disallow :command:`add_custom_command(SOURCE)` signatures.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0051, \ "List TARGET_OBJECTS in SOURCES target property.", \ + "List :manual:`TARGET_OBJECTS ` " \ + "in :prop_tgt:`SOURCES` target property.", \ 3, 1, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0052, \ "Reject source and build dirs in installed " \ "INTERFACE_INCLUDE_DIRECTORIES.", \ + "Reject source and build dirs in installed " \ + ":prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES`.", \ 3, 1, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0053, \ - "Simplify variable reference and escape sequence evaluation.", \ + "Simplify variable reference and escape sequence evaluation.", 0, \ 3, 1, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0054, \ "Only interpret if() arguments as variables or keywords when unquoted.", \ + "Only interpret :command:`if()` arguments as variables or keywords " \ + "when unquoted.", \ 3, 1, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0055, \ "Strict checking for break() command.", \ + "Strict checking for :command:`break()` command.", \ 3, 2, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0056, \ "Honor link flags in try_compile() source-file signature.", \ + "Honor link flags in :command:`try_compile()` source-file signature.", \ 3, 2, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0057, \ "Support new IN_LIST if() operator.", \ + "Support new ``IN_LIST`` :command:`if()` operator.", \ 3, 3, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0058, \ - "Ninja requires custom command byproducts to be explicit.", \ + "Ninja requires custom command byproducts to be explicit.", 0, \ 3, 3, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0059, \ - "Do no treat DEFINITIONS as a built-in directory property.", \ + "Do not treat DEFINITIONS as a built-in directory property.", \ + "Do not treat :prop_dir:`DEFINITIONS` as a built-in directory " \ + "property.", \ 3, 3, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0060, \ - "Link libraries by full path even in implicit directories.", \ + "Link libraries by full path even in implicit directories.", 0, \ 3, 3, 0, cmPolicies::WARN) -#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) +#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6, A7) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID) @@ -269,6 +333,8 @@ public: ///! return an error string for when a required policy is unspecified static std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id); + static std::string GetPolicyDocTitle(cmPolicies::PolicyID id); + /** Represent a set of policy values. */ struct PolicyMap { diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index cb61ed9..74ceaaa 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -14,6 +14,7 @@ #include "cmSystemTools.h" #include "cmAlgorithms.h" #include "cmVersion.h" +#include "cmPolicies.h" #include #include @@ -30,6 +31,7 @@ cmRST::cmRST(std::ostream& os, std::string const& docroot): "command|variable" ")::[ \t]+([^ \t\n]+)$"), CMakeModuleDirective("^.. cmake-module::[ \t]+([^ \t\n]+)$"), + CMakePolicyDirective("^.. cmake-policy::[ \t]+(.+)$"), ParsedLiteralDirective("^.. parsed-literal::[ \t]*(.*)$"), CodeBlockDirective("^.. code-block::[ \t]*(.*)$"), ReplaceDirective("^.. (\\|[^|]+\\|) replace::[ \t]*(.*)$"), @@ -195,6 +197,26 @@ void cmRST::ProcessLine(std::string const& line) this->NormalLine(line); } } + else if(this->CMakePolicyDirective.find(line)) + { + std::string policy = this->CMakePolicyDirective.match(1); + if(policy.empty()) + { + this->NormalLine(line); + } + else + { + cmPolicies pols; + + cmPolicies::PolicyID id; + bool b = pols.GetPolicyID(policy.c_str(), id); + if (!b) + { + this->NormalLine(line); + } + this->OutputLine(pols.GetPolicyDocTitle(id) + "\n", true); + } + } else if(this->ParsedLiteralDirective.find(line)) { // Record the literal lines to output after whole block. diff --git a/Source/cmRST.h b/Source/cmRST.h index b9b2366..52c9f2e 100644 --- a/Source/cmRST.h +++ b/Source/cmRST.h @@ -79,6 +79,7 @@ private: DirectiveType Directive; cmsys::RegularExpression CMakeDirective; cmsys::RegularExpression CMakeModuleDirective; + cmsys::RegularExpression CMakePolicyDirective; cmsys::RegularExpression ParsedLiteralDirective; cmsys::RegularExpression CodeBlockDirective; cmsys::RegularExpression ReplaceDirective; diff --git a/Tests/RunCMake/CMP0027/CMP0027-WARN-stderr.txt b/Tests/RunCMake/CMP0027/CMP0027-WARN-stderr.txt index 9bcec3c..984d9c1 100644 --- a/Tests/RunCMake/CMP0027/CMP0027-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0027/CMP0027-WARN-stderr.txt @@ -1,5 +1,5 @@ CMake Warning \(dev\) in CMakeLists.txt: - Policy CMP0027 is not set: Conditionally linked imported targets with + Policy CMP0027 is not set: Conditionally linked IMPORTED targets with missing include directories. Run "cmake --help-policy CMP0027" for policy details. Use the cmake_policy command to set the policy and suppress this warning. diff --git a/Tests/RunCMake/CMP0059/CMP0059-WARN-stderr.txt b/Tests/RunCMake/CMP0059/CMP0059-WARN-stderr.txt index 4e04d15..06c7be3 100644 --- a/Tests/RunCMake/CMP0059/CMP0059-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0059/CMP0059-WARN-stderr.txt @@ -1,5 +1,5 @@ CMake Warning \(dev\) at CMP0059-WARN.cmake:6 \(get_property\): - Policy CMP0059 is not set: Do no treat DEFINITIONS as a built-in directory + Policy CMP0059 is not set: Do not treat DEFINITIONS as a built-in directory property. Run "cmake --help-policy CMP0059" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Call Stack \(most recent call first\): @@ -8,7 +8,7 @@ This warning is for project developers. Use -Wno-dev to suppress it. DEFS: -DSOME_DEF CMake Warning \(dev\) at CMP0059-WARN.cmake:14 \(get_property\): - Policy CMP0059 is not set: Do no treat DEFINITIONS as a built-in directory + Policy CMP0059 is not set: Do not treat DEFINITIONS as a built-in directory property. Run "cmake --help-policy CMP0059" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/include/CMP0024-WARN-stderr.txt b/Tests/RunCMake/include/CMP0024-WARN-stderr.txt index 9c79007..ae57674 100644 --- a/Tests/RunCMake/include/CMP0024-WARN-stderr.txt +++ b/Tests/RunCMake/include/CMP0024-WARN-stderr.txt @@ -1,7 +1,7 @@ CMake Warning \(dev\) at subdir2/CMakeLists.txt:2 \(include\): - Policy CMP0024 is not set: Disallow include export result. Run "cmake - --help-policy CMP0024" for policy details. Use the cmake_policy command to - set the policy and suppress this warning. + Policy CMP0024 is not set: Disallow include\(\) of export\(\) result. Run + "cmake --help-policy CMP0024" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. The file diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py index fe60033..26094b2 100644 --- a/Utilities/Sphinx/cmake.py +++ b/Utilities/Sphinx/cmake.py @@ -150,6 +150,21 @@ class CMakePolicyList(Directive): self.state_machine.insert_input(include_lines, "") return [] +class CMakePolicy(Directive): + required_arguments = 1 + def run(self): + + env = self.state.document.settings.env + with open("PolicyList.json", "r") as f: + policies = json.load(f) + + for policy in policies: + if policy["id"] == self.arguments[0]: + include_lines = statemachine.string2lines(policy["rst"]) + self.state_machine.insert_input(include_lines, "") + break + return [] + class _cmake_index_entry: def __init__(self, desc): self.desc = desc @@ -411,6 +426,7 @@ class CMakeDomain(Domain): def setup(app): app.add_directive('cmake-module', CMakeModule) + app.add_directive('cmake-policy', CMakePolicy) app.add_directive('cmake-policy-list', CMakePolicyList) app.add_transform(CMakeTransform) app.add_transform(CMakeXRefTransform) diff --git a/Utilities/Sphinx/create-policy-list.py b/Utilities/Sphinx/create-policy-list.py index d825c66..6b0f10e 100755 --- a/Utilities/Sphinx/create-policy-list.py +++ b/Utilities/Sphinx/create-policy-list.py @@ -7,6 +7,10 @@ def collectString(s): result = "" idx = s.find('"') + nullptr = s.find('0') + if (nullptr < idx): + return (None, None) + oldIdx = idx + 1 i = 0 while idx != -1: @@ -41,13 +45,19 @@ with open(sys.argv[2]) as policyHeader: policyId, content = content.split(",", 1) docString, docLength = collectString(content) content = content[docLength:] + rstString, rstLength = collectString(content) + if (rstString is None): + rstString = docString + else: + content = content[rstLength:] versionMajor, versionMinor, versionPatch, content = content.split(",", 3) versionMajor = cleanString(versionMajor) versionMinor = cleanString(versionMinor) versionPatch = cleanString(versionPatch) version = versionMajor + "." + versionMinor + "." + versionPatch - policies.append({"id": policyId, "doc": docString, "version": version}) + policies.append({"id": policyId, "doc": docString, + "rst": rstString, "version": version}) start = content.find("SELECT(POLICY, ") ----------------------------------------------------------------------- Summary of changes: Tests/RunCMake/CMP0027/CMP0027-WARN-stderr.txt | 2 +- Tests/RunCMake/CMP0059/CMP0059-WARN-stderr.txt | 4 ++-- Tests/RunCMake/include/CMP0024-WARN-stderr.txt | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) hooks/post-receive -- CMake From steveire at gmail.com Tue May 5 15:51:18 2015 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 5 May 2015 15:51:18 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2535-g057f51a Message-ID: <20150505195118.81DEBAE797@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, next has been updated via 057f51af9a2dbdd015f6c69bbfe72c7a1353730a (commit) via 364469ce9338c1720475425f64d8328e94607880 (commit) via 091bf33f737f7fc8115eb4c3f066df41dbcebb44 (commit) via 0626c4790d8cf7ad9dc6734c7969cf843f35c458 (commit) via 377f6fe90606d8e62f5d9a004a2b3f9cad2f2cf2 (commit) via 062e4b756a2c5eec51b24b1e64ee09f1085f3420 (commit) via 5df60ddaa5828dd92a07174ba95df3fcee4d30f6 (commit) via 8db3073b3c8b7060b7496f17c2a07ec9cd76e28e (commit) via ec833cedc31f2693e6f48ac71e5fda36c5cb890e (commit) via d4bbbbcffc7592c990fe2c64c13eed4550fe48fa (commit) via 0c801c6963f051c32e0586266539f155a70bd5e3 (commit) via 5acbe27cf51ba34d34322bd19ac0f32b7ef193d6 (commit) via ee05c3c80b3cd59f7aeb64aad492587a631d6447 (commit) via f9d2545cf0853fe05e2351d80c3b580cf8b3df77 (commit) from c531a8465108aa25d5f5f991c610aad0a844dad6 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=057f51af9a2dbdd015f6c69bbfe72c7a1353730a commit 057f51af9a2dbdd015f6c69bbfe72c7a1353730a Merge: c531a84 364469c Author: Stephen Kelly AuthorDate: Tue May 5 15:51:16 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue May 5 15:51:16 2015 -0400 Merge topic 'refactor-cmLocalGenerator' into next 364469ce cmState: Store computed relative paths to to current directories. 091bf33f cmState::Snapshot: Store components for current directories. 0626c479 cmState: Compute and store directory components. 377f6fe9 cmGlobalGenerator: Move some flags from cmLocalGenerator. 062e4b75 cmLocalGenerator: Port loops to cmState::Snapshot. 5df60dda cmState: Add an accessor for Parent snapshot and a validity check. 8db3073b cmLocalGenerator: Convert two recursive methods to loops. ec833ced cmLocalGenerator: Get project directories from the cmState. d4bbbbcf cmLocalGenerator: Initialize state before creating cmMakefile. 0c801c69 cmLocalGenerator: Require a global generator in the constructor. 5acbe27c Don't use a cmLocalGenerator instance to call static methods. ee05c3c8 cmLocalGenerator: Remove EscapeForShellOldStyle to only caller. f9d2545c cmLocalGenerator: Remove unused members. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=364469ce9338c1720475425f64d8328e94607880 commit 364469ce9338c1720475425f64d8328e94607880 Author: Stephen Kelly AuthorDate: Mon May 4 23:30:29 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 21:50:43 2015 +0200 cmState: Store computed relative paths to to current directories. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index f64cb2d..a5f603f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -66,7 +66,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, this->UseRelativePaths = false; this->Configured = false; this->EmitUniversalBinaryFlags = true; - this->RelativePathsConfigured = false; this->BackwardsCompatibility = 0; this->BackwardsCompatibilityFinal = false; } @@ -2812,97 +2811,6 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote, } //---------------------------------------------------------------------------- -std::string cmLocalGenerator::FindRelativePathTopSource() -{ - cmState::Snapshot snapshot = this->StateSnapshot; - std::vector snapshots; - snapshots.push_back(snapshot); - while (true) - { - snapshot = snapshot.GetParent(); - if (snapshot.IsValid()) - { - snapshots.push_back(snapshot); - } - else - { - break; - } - } - - std::string result = snapshots.front().GetCurrentSourceDirectory(); - - for (std::vector::const_iterator it = - snapshots.begin() + 1; it != snapshots.end(); ++it) - { - std::string currentSource = it->GetCurrentSourceDirectory(); - if(cmSystemTools::IsSubDirectory(result, currentSource)) - { - result = currentSource; - } - } - - return result; -} - -//---------------------------------------------------------------------------- -std::string cmLocalGenerator::FindRelativePathTopBinary() -{ - cmState::Snapshot snapshot = this->StateSnapshot; - std::vector snapshots; - snapshots.push_back(snapshot); - while (true) - { - snapshot = snapshot.GetParent(); - if (snapshot.IsValid()) - { - snapshots.push_back(snapshot); - } - else - { - break; - } - } - - std::string result = snapshots.front().GetCurrentBinaryDirectory(); - - for (std::vector::const_iterator it = - snapshots.begin() + 1; it != snapshots.end(); ++it) - { - std::string currentBinary = it->GetCurrentBinaryDirectory(); - if(cmSystemTools::IsSubDirectory(result, currentBinary)) - { - result = currentBinary; - } - } - - return result; -} - -//---------------------------------------------------------------------------- -void cmLocalGenerator::ConfigureRelativePaths() -{ - // Relative path conversion inside the source tree is not used to - // construct relative paths passed to build tools so it is safe to - // even when the source is a network path. - std::string source = this->FindRelativePathTopSource(); - this->RelativePathTopSource = source; - - // The current working directory on Windows cannot be a network - // path. Therefore relative paths cannot work when the binary tree - // is a network path. - std::string binary = this->FindRelativePathTopBinary(); - if(binary.size() < 2 || binary.substr(0, 2) != "//") - { - this->RelativePathTopBinary = binary; - } - else - { - this->RelativePathTopBinary = ""; - } -} - -//---------------------------------------------------------------------------- static bool cmLocalGeneratorNotAbove(const char* a, const char* b) { return (cmSystemTools::ComparePath(a, b) || @@ -2927,26 +2835,19 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector& local, return in_remote; } - // Make sure relative path conversion is configured. - if(!this->RelativePathsConfigured) - { - this->ConfigureRelativePaths(); - this->RelativePathsConfigured = true; - } - if(!force) { // Skip conversion if the path and local are not both in the source // or both in the binary tree. std::string local_path = cmSystemTools::JoinPath(local); if(!((cmLocalGeneratorNotAbove(local_path.c_str(), - this->RelativePathTopBinary.c_str()) && + this->StateSnapshot.GetRelativePathTopBinary()) && cmLocalGeneratorNotAbove(in_remote.c_str(), - this->RelativePathTopBinary.c_str())) || + this->StateSnapshot.GetRelativePathTopBinary())) || (cmLocalGeneratorNotAbove(local_path.c_str(), - this->RelativePathTopSource.c_str()) && + this->StateSnapshot.GetRelativePathTopSource()) && cmLocalGeneratorNotAbove(in_remote.c_str(), - this->RelativePathTopSource.c_str())))) + this->StateSnapshot.GetRelativePathTopSource())))) { return in_remote; } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index bf447e5..c0da4f6 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -435,10 +435,6 @@ protected: std::string const& dir_max); void ComputeObjectMaxPath(); - void ConfigureRelativePaths(); - std::string FindRelativePathTopSource(); - std::string FindRelativePathTopBinary(); - virtual std::string ConvertToLinkReference(std::string const& lib, OutputFormat format = SHELL); @@ -468,15 +464,6 @@ protected: // committed. std::string TargetImplib; - // The top-most directories for relative path conversion. Both the - // source and destination location of a relative path conversion - // must be underneath one of these directories (both under source or - // both under binary) in order for the relative path to be evaluated - // safely by the build tools. - std::string RelativePathTopSource; - std::string RelativePathTopBinary; - bool RelativePathsConfigured; - cmIML_INT_uint64_t BackwardsCompatibility; bool BackwardsCompatibilityFinal; private: diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index f11c79e..54bff7f 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -545,9 +545,11 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() // Setup relative path conversion tops. infoFileStream << "# Relative path conversion top directories.\n" - << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" << this->RelativePathTopSource + << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" + << this->StateSnapshot.GetRelativePathTopSource() << "\")\n" - << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \"" << this->RelativePathTopBinary + << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \"" + << this->StateSnapshot.GetRelativePathTopBinary() << "\")\n" << "\n"; @@ -1613,16 +1615,15 @@ cmLocalUnixMakefileGenerator3 } // Setup relative path top directories. - this->RelativePathsConfigured = true; if(const char* relativePathTopSource = mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_SOURCE")) { - this->RelativePathTopSource = relativePathTopSource; + this->StateSnapshot.SetRelativePathTopSource(relativePathTopSource); } if(const char* relativePathTopBinary = mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_BINARY")) { - this->RelativePathTopBinary = relativePathTopBinary; + this->StateSnapshot.SetRelativePathTopBinary(relativePathTopBinary); } } else diff --git a/Source/cmState.cxx b/Source/cmState.cxx index dacf799..04a59fc 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -494,6 +494,86 @@ std::vector const& cmState::GetBinaryDirectoryComponents() const return this->BinaryDirectoryComponents; } +void cmState::Snapshot::ComputeRelativePathTopSource() +{ + // Relative path conversion inside the source tree is not used to + // construct relative paths passed to build tools so it is safe to use + // even when the source is a network path. + + cmState::Snapshot snapshot = *this; + std::vector snapshots; + snapshots.push_back(snapshot); + while (true) + { + snapshot = snapshot.GetParent(); + if (snapshot.IsValid()) + { + snapshots.push_back(snapshot); + } + else + { + break; + } + } + + std::string result = snapshots.front().GetCurrentSourceDirectory(); + + for (std::vector::const_iterator it = + snapshots.begin() + 1; it != snapshots.end(); ++it) + { + std::string currentSource = it->GetCurrentSourceDirectory(); + if(cmSystemTools::IsSubDirectory(result, currentSource)) + { + result = currentSource; + } + } + this->State->RelativePathTopSource[this->Position] = result; +} + +void cmState::Snapshot::ComputeRelativePathTopBinary() +{ + cmState::Snapshot snapshot = *this; + std::vector snapshots; + snapshots.push_back(snapshot); + while (true) + { + snapshot = snapshot.GetParent(); + if (snapshot.IsValid()) + { + snapshots.push_back(snapshot); + } + else + { + break; + } + } + + std::string result = + snapshots.front().GetCurrentBinaryDirectory(); + + for (std::vector::const_iterator it = + snapshots.begin() + 1; it != snapshots.end(); ++it) + { + std::string currentBinary = it->GetCurrentBinaryDirectory(); + if(cmSystemTools::IsSubDirectory(result, currentBinary)) + { + result = currentBinary; + } + } + + // The current working directory on Windows cannot be a network + // path. Therefore relative paths cannot work when the binary tree + // is a network path. + if(result.size() < 2 || result.substr(0, 2) != "//") + { + this->State->RelativePathTopBinary[this->Position] = result; + } + else + { + this->State->RelativePathTopBinary[this->Position] = ""; + } +} + cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) { PositionType pos = this->ParentPositions.size(); @@ -504,6 +584,8 @@ cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) this->CurrentSourceDirectoryComponents.size() + 1); this->CurrentBinaryDirectoryComponents.resize( this->CurrentBinaryDirectoryComponents.size() + 1); + this->RelativePathTopSource.resize(this->RelativePathTopSource.size() + 1); + this->RelativePathTopBinary.resize(this->RelativePathTopBinary.size() + 1); return cmState::Snapshot(this, pos); } @@ -531,6 +613,7 @@ void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir) cmSystemTools::SplitPath( this->State->Locations[this->Position], this->State->CurrentSourceDirectoryComponents[this->Position]); + this->ComputeRelativePathTopSource(); } const char* cmState::Snapshot::GetCurrentBinaryDirectory() const @@ -551,6 +634,7 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) cmSystemTools::SplitPath( this->State->OutputLocations[this->Position], this->State->CurrentBinaryDirectoryComponents[this->Position]); + this->ComputeRelativePathTopBinary(); } std::vector const& @@ -565,6 +649,26 @@ cmState::Snapshot::GetCurrentBinaryDirectoryComponents() return this->State->CurrentBinaryDirectoryComponents[this->Position]; } +const char* cmState::Snapshot::GetRelativePathTopSource() const +{ + return this->State->RelativePathTopSource[this->Position].c_str(); +} + +const char* cmState::Snapshot::GetRelativePathTopBinary() const +{ + return this->State->RelativePathTopBinary[this->Position].c_str(); +} + +void cmState::Snapshot::SetRelativePathTopSource(const char* dir) +{ + this->State->RelativePathTopSource[this->Position] = dir; +} + +void cmState::Snapshot::SetRelativePathTopBinary(const char* dir) +{ + this->State->RelativePathTopBinary[this->Position] = dir; +} + bool cmState::Snapshot::IsValid() const { return this->State; diff --git a/Source/cmState.h b/Source/cmState.h index 81f2d48..23d3f0d 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -39,10 +39,19 @@ public: std::vector const& GetCurrentSourceDirectoryComponents(); std::vector const& GetCurrentBinaryDirectoryComponents(); + const char* GetRelativePathTopSource() const; + const char* GetRelativePathTopBinary() const; + void SetRelativePathTopSource(const char* dir); + void SetRelativePathTopBinary(const char* dir); + bool IsValid() const; Snapshot GetParent() const; private: + void ComputeRelativePathTopSource(); + void ComputeRelativePathTopBinary(); + + private: friend class cmState; cmState* State; cmState::PositionType Position; @@ -139,11 +148,18 @@ private: std::vector OutputLocations; std::vector ParentPositions; - std::vector SourceDirectoryComponents; - std::vector BinaryDirectoryComponents; std::vector > CurrentSourceDirectoryComponents; std::vector > CurrentBinaryDirectoryComponents; + // The top-most directories for relative path conversion. Both the + // source and destination location of a relative path conversion + // must be underneath one of these directories (both under source or + // both under binary) in order for the relative path to be evaluated + // safely by the build tools. + std::vector RelativePathTopSource; + std::vector RelativePathTopBinary; + std::vector SourceDirectoryComponents; + std::vector BinaryDirectoryComponents; std::string SourceDirectory; std::string BinaryDirectory; bool IsInTryCompile; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=091bf33f737f7fc8115eb4c3f066df41dbcebb44 commit 091bf33f737f7fc8115eb4c3f066df41dbcebb44 Author: Stephen Kelly AuthorDate: Mon May 4 23:08:19 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 21:50:43 2015 +0200 cmState::Snapshot: Store components for current directories. Remove this responsibility from cmLocalGenerator. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 0a955bb..f64cb2d 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -67,7 +67,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, this->Configured = false; this->EmitUniversalBinaryFlags = true; this->RelativePathsConfigured = false; - this->PathConversionsSetup = false; this->BackwardsCompatibility = 0; this->BackwardsCompatibilityFinal = false; } @@ -229,22 +228,6 @@ void cmLocalGenerator::ReadInputFile() } } -void cmLocalGenerator::SetupPathConversions() -{ - // Setup the current output directory components for use by - // Convert - std::string outdir; - - outdir = cmSystemTools::CollapseFullPath( - this->StateSnapshot.GetCurrentSourceDirectory()); - cmSystemTools::SplitPath(outdir, this->StartDirectoryComponents); - - outdir = cmSystemTools::CollapseFullPath - (this->StateSnapshot.GetCurrentBinaryDirectory()); - cmSystemTools::SplitPath(outdir, - this->StartOutputDirectoryComponents); -} - void cmLocalGenerator::ConfigureFinalPass() { this->Makefile->ConfigureFinalPass(); @@ -2731,13 +2714,6 @@ std::string cmLocalGenerator::Convert(const std::string& source, OutputFormat output, bool optional) { - // Make sure the relative path conversion components are set. - if(!this->PathConversionsSetup) - { - this->SetupPathConversions(); - this->PathConversionsSetup = true; - } - // Convert the path to a relative path. std::string result = source; @@ -2752,20 +2728,18 @@ std::string cmLocalGenerator::Convert(const std::string& source, break; case START: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = this->ConvertToRelativePath(this->StartDirectoryComponents, - result); + result = this->ConvertToRelativePath( + this->StateSnapshot.GetCurrentSourceDirectoryComponents(), result); break; case HOME_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = - this->ConvertToRelativePath( - this->GetState()->GetBinaryDirectoryComponents(), result); + result = this->ConvertToRelativePath( + this->GetState()->GetBinaryDirectoryComponents(), result); break; case START_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = - this->ConvertToRelativePath(this->StartOutputDirectoryComponents, - result); + result = this->ConvertToRelativePath( + this->StateSnapshot.GetCurrentBinaryDirectoryComponents(), result); break; case FULL: result = cmSystemTools::CollapseFullPath(result); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 5cdf161..bf447e5 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -438,7 +438,6 @@ protected: void ConfigureRelativePaths(); std::string FindRelativePathTopSource(); std::string FindRelativePathTopBinary(); - void SetupPathConversions(); virtual std::string ConvertToLinkReference(std::string const& lib, OutputFormat format = SHELL); @@ -453,8 +452,6 @@ protected: cmMakefile *Makefile; cmState::Snapshot StateSnapshot; cmGlobalGenerator *GlobalGenerator; - std::vector StartDirectoryComponents; - std::vector StartOutputDirectoryComponents; cmLocalGenerator* Parent; std::vector Children; std::map UniqueObjectNamesMap; @@ -479,7 +476,6 @@ protected: std::string RelativePathTopSource; std::string RelativePathTopBinary; bool RelativePathsConfigured; - bool PathConversionsSetup; cmIML_INT_uint64_t BackwardsCompatibility; bool BackwardsCompatibilityFinal; diff --git a/Source/cmState.cxx b/Source/cmState.cxx index c5b12d9..dacf799 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -500,6 +500,10 @@ cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) this->ParentPositions.push_back(originSnapshot.Position); this->Locations.resize(this->Locations.size() + 1); this->OutputLocations.resize(this->OutputLocations.size() + 1); + this->CurrentSourceDirectoryComponents.resize( + this->CurrentSourceDirectoryComponents.size() + 1); + this->CurrentBinaryDirectoryComponents.resize( + this->CurrentBinaryDirectoryComponents.size() + 1); return cmState::Snapshot(this, pos); } @@ -523,6 +527,10 @@ void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir) this->State->Locations[this->Position]); this->State->Locations[this->Position] = cmSystemTools::CollapseFullPath(this->State->Locations[this->Position]); + + cmSystemTools::SplitPath( + this->State->Locations[this->Position], + this->State->CurrentSourceDirectoryComponents[this->Position]); } const char* cmState::Snapshot::GetCurrentBinaryDirectory() const @@ -539,6 +547,22 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) this->State->OutputLocations[this->Position] = cmSystemTools::CollapseFullPath( this->State->OutputLocations[this->Position]); + + cmSystemTools::SplitPath( + this->State->OutputLocations[this->Position], + this->State->CurrentBinaryDirectoryComponents[this->Position]); +} + +std::vector const& +cmState::Snapshot::GetCurrentSourceDirectoryComponents() +{ + return this->State->CurrentSourceDirectoryComponents[this->Position]; +} + +std::vector const& +cmState::Snapshot::GetCurrentBinaryDirectoryComponents() +{ + return this->State->CurrentBinaryDirectoryComponents[this->Position]; } bool cmState::Snapshot::IsValid() const diff --git a/Source/cmState.h b/Source/cmState.h index c58a461..81f2d48 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -36,6 +36,9 @@ public: const char* GetCurrentBinaryDirectory() const; void SetCurrentBinaryDirectory(std::string const& dir); + std::vector const& GetCurrentSourceDirectoryComponents(); + std::vector const& GetCurrentBinaryDirectoryComponents(); + bool IsValid() const; Snapshot GetParent() const; @@ -138,6 +141,8 @@ private: std::vector SourceDirectoryComponents; std::vector BinaryDirectoryComponents; + std::vector > CurrentSourceDirectoryComponents; + std::vector > CurrentBinaryDirectoryComponents; std::string SourceDirectory; std::string BinaryDirectory; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0626c4790d8cf7ad9dc6734c7969cf843f35c458 commit 0626c4790d8cf7ad9dc6734c7969cf843f35c458 Author: Stephen Kelly AuthorDate: Mon May 4 23:01:29 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 21:50:43 2015 +0200 cmState: Compute and store directory components. There is no need to duplicate these in all cmLocalGenerators. Rename the symbols according to current conventions. Add explicit calls to Set{Source,Binary}Directory with empty strings in order to trigger the population of the components containers with the current working directory in cmLocalGenerator. Having directories set to empty is a special case in CMake, which is relied on for the `if(CMAKE_BINARY_DIR)` condition at the end of CMakeDetermineSystem.cmake. diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 2207873..d08b5de 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -198,6 +198,8 @@ int main (int argc, char const* const* argv) "Read CPack config file: " << cpackConfigFile << std::endl); cmake cminst; + cminst.SetHomeDirectory(""); + cminst.SetHomeOutputDirectory(""); cminst.GetState()->RemoveUnscriptableCommands(); cmGlobalGenerator cmgg; cmgg.SetCMakeInstance(&cminst); diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 0a34be8..322855a 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -336,6 +336,8 @@ void cmCTestScriptHandler::CreateCMake() delete this->LocalGenerator; } this->CMake = new cmake; + this->CMake->SetHomeDirectory(""); + this->CMake->SetHomeOutputDirectory(""); this->CMake->AddCMakePaths(); this->GlobalGenerator = new cmGlobalGenerator; this->GlobalGenerator->SetCMakeInstance(this->CMake); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index bd6af8c..0a955bb 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -234,19 +234,12 @@ void cmLocalGenerator::SetupPathConversions() // Setup the current output directory components for use by // Convert std::string outdir; - outdir = - cmSystemTools::CollapseFullPath(this->GetState()->GetSourceDirectory()); - cmSystemTools::SplitPath(outdir, this->HomeDirectoryComponents); + outdir = cmSystemTools::CollapseFullPath( this->StateSnapshot.GetCurrentSourceDirectory()); cmSystemTools::SplitPath(outdir, this->StartDirectoryComponents); outdir = cmSystemTools::CollapseFullPath - (this->GetState()->GetBinaryDirectory()); - cmSystemTools::SplitPath(outdir, - this->HomeOutputDirectoryComponents); - - outdir = cmSystemTools::CollapseFullPath (this->StateSnapshot.GetCurrentBinaryDirectory()); cmSystemTools::SplitPath(outdir, this->StartOutputDirectoryComponents); @@ -2754,8 +2747,8 @@ std::string cmLocalGenerator::Convert(const std::string& source, { case HOME: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = this->ConvertToRelativePath(this->HomeDirectoryComponents, - result); + result = this->ConvertToRelativePath( + this->GetState()->GetSourceDirectoryComponents(), result); break; case START: //result = cmSystemTools::CollapseFullPath(result.c_str()); @@ -2765,8 +2758,8 @@ std::string cmLocalGenerator::Convert(const std::string& source, case HOME_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); result = - this->ConvertToRelativePath(this->HomeOutputDirectoryComponents, - result); + this->ConvertToRelativePath( + this->GetState()->GetBinaryDirectoryComponents(), result); break; case START_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 47c0877..5cdf161 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -453,9 +453,7 @@ protected: cmMakefile *Makefile; cmState::Snapshot StateSnapshot; cmGlobalGenerator *GlobalGenerator; - std::vector HomeDirectoryComponents; std::vector StartDirectoryComponents; - std::vector HomeOutputDirectoryComponents; std::vector StartOutputDirectoryComponents; cmLocalGenerator* Parent; std::vector Children; diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 3cca3a7..c5b12d9 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -458,6 +458,10 @@ void cmState::SetSourceDirectory(std::string const& sourceDirectory) { this->SourceDirectory = sourceDirectory; cmSystemTools::ConvertToUnixSlashes(this->SourceDirectory); + + cmSystemTools::SplitPath( + cmSystemTools::CollapseFullPath(this->SourceDirectory), + this->SourceDirectoryComponents); } const char* cmState::GetSourceDirectory() const @@ -465,10 +469,19 @@ const char* cmState::GetSourceDirectory() const return this->SourceDirectory.c_str(); } +std::vector const& cmState::GetSourceDirectoryComponents() const +{ + return this->SourceDirectoryComponents; +} + void cmState::SetBinaryDirectory(std::string const& binaryDirectory) { this->BinaryDirectory = binaryDirectory; cmSystemTools::ConvertToUnixSlashes(this->BinaryDirectory); + + cmSystemTools::SplitPath( + cmSystemTools::CollapseFullPath(this->BinaryDirectory), + this->BinaryDirectoryComponents); } const char* cmState::GetBinaryDirectory() const @@ -476,6 +489,11 @@ const char* cmState::GetBinaryDirectory() const return this->BinaryDirectory.c_str(); } +std::vector const& cmState::GetBinaryDirectoryComponents() const +{ + return this->BinaryDirectoryComponents; +} + cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) { PositionType pos = this->ParentPositions.size(); diff --git a/Source/cmState.h b/Source/cmState.h index ed58c64..c58a461 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -123,6 +123,9 @@ public: const char* GetBinaryDirectory() const; void SetBinaryDirectory(std::string const& binaryDirectory); + std::vector const& GetSourceDirectoryComponents() const; + std::vector const& GetBinaryDirectoryComponents() const; + private: std::map PropertyDefinitions; std::vector EnabledLanguages; @@ -132,6 +135,10 @@ private: std::vector Locations; std::vector OutputLocations; std::vector ParentPositions; + + std::vector SourceDirectoryComponents; + std::vector BinaryDirectoryComponents; + std::string SourceDirectory; std::string BinaryDirectory; bool IsInTryCompile; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5c5c428..2f9789d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2580,6 +2580,9 @@ int cmake::Build(const std::string& dir, const std::vector& nativeOptions, bool clean) { + + this->SetHomeDirectory(""); + this->SetHomeOutputDirectory(""); if(!cmSystemTools::FileIsDirectory(dir)) { std::cerr << "Error: " << dir << " is not a directory\n"; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=377f6fe90606d8e62f5d9a004a2b3f9cad2f2cf2 commit 377f6fe90606d8e62f5d9a004a2b3f9cad2f2cf2 Author: Stephen Kelly AuthorDate: Mon May 4 22:40:11 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 21:50:43 2015 +0200 cmGlobalGenerator: Move some flags from cmLocalGenerator. These flags are global, and so they belong here instead of being set on each local generator. diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx index 0220799..d191056 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.cxx +++ b/Source/cmGlobalBorlandMakefileGenerator.cxx @@ -21,6 +21,7 @@ cmGlobalBorlandMakefileGenerator::cmGlobalBorlandMakefileGenerator() this->ForceUnixPaths = false; this->ToolSupportsColor = true; this->UseLinkScript = false; + this->WindowsShell = true; } @@ -43,7 +44,6 @@ cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator( cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3(this, parent); lg->SetIncludeDirective("!include"); - lg->SetWindowsShell(true); lg->SetDefineWindowsNULL(true); lg->SetMakefileVariableSize(32); lg->SetPassMakeflags(true); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 7117402..fe73e8c 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -71,6 +71,13 @@ cmGlobalGenerator::cmGlobalGenerator() this->ExtraGenerator = 0; this->CurrentLocalGenerator = 0; this->TryCompileOuterMakefile = 0; + + this->WindowsShell = false; + this->WindowsVSIDE = false; + this->WatcomWMake = false; + this->MinGWMake = false; + this->NMake = false; + this->MSYSShell = false; } cmGlobalGenerator::~cmGlobalGenerator() diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 7107198..3b321f2 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -354,6 +354,13 @@ public: cmFileLockPool& GetFileLockPool() { return FileLockPool; } #endif + bool WindowsShell; + bool WindowsVSIDE; + bool WatcomWMake; + bool MinGWMake; + bool NMake; + bool MSYSShell; + protected: virtual void Generate(); diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx index 1caa730..f1f7984 100644 --- a/Source/cmGlobalJOMMakefileGenerator.cxx +++ b/Source/cmGlobalJOMMakefileGenerator.cxx @@ -19,6 +19,7 @@ cmGlobalJOMMakefileGenerator::cmGlobalJOMMakefileGenerator() this->ForceUnixPaths = false; this->ToolSupportsColor = true; this->UseLinkScript = false; + this->WindowsShell = true; } void cmGlobalJOMMakefileGenerator @@ -51,7 +52,6 @@ cmGlobalJOMMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3(this, parent); lg->SetDefineWindowsNULL(true); - lg->SetWindowsShell(true); lg->SetMakeSilentFlag("/nologo"); lg->SetIgnoreLibPrefix(true); lg->SetPassMakeflags(true); diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx index 319eeaf..9f9e888 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.cxx +++ b/Source/cmGlobalMSYSMakefileGenerator.cxx @@ -21,6 +21,7 @@ cmGlobalMSYSMakefileGenerator::cmGlobalMSYSMakefileGenerator() this->ForceUnixPaths = true; this->ToolSupportsColor = true; this->UseLinkScript = false; + this->SetMSYSShell = true; } std::string @@ -98,8 +99,6 @@ cmGlobalMSYSMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) { cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3(this, parent); - lg->SetWindowsShell(false); - lg->SetMSYSShell(true); lg->SetIgnoreLibPrefix(true); lg->SetPassMakeflags(false); lg->SetUnixCD(true); diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx index c4511e5..ba0790d 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.cxx +++ b/Source/cmGlobalMinGWMakefileGenerator.cxx @@ -19,6 +19,8 @@ cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator() this->ForceUnixPaths = true; this->ToolSupportsColor = true; this->UseLinkScript = true; + this->WindowsShell = true; + this->MinGWMake = true; } void cmGlobalMinGWMakefileGenerator @@ -36,11 +38,9 @@ cmGlobalMinGWMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) { cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3(this, parent); - lg->SetWindowsShell(true); lg->SetIgnoreLibPrefix(true); lg->SetPassMakeflags(false); lg->SetUnixCD(true); - lg->SetMinGWMake(true); return lg; } diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx index 2732e22..98d7fb4 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.cxx +++ b/Source/cmGlobalNMakeMakefileGenerator.cxx @@ -19,6 +19,8 @@ cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator() this->ForceUnixPaths = false; this->ToolSupportsColor = true; this->UseLinkScript = false; + this->WindowsShell = true; + this->NMake = true; } void cmGlobalNMakeMakefileGenerator @@ -51,11 +53,9 @@ cmGlobalNMakeMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3(this, parent); lg->SetDefineWindowsNULL(true); - lg->SetWindowsShell(true); lg->SetMakeSilentFlag("/nologo"); lg->SetIgnoreLibPrefix(true); lg->SetPassMakeflags(true); - lg->SetNMake(true); lg->SetUnixCD(false); return lg; } diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index dde9ca4..7a26cc0 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -487,6 +487,9 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator() , ComputingUnknownDependencies(false) , PolicyCMP0058(cmPolicies::WARN) { +#ifdef _WIN32 + this->WindowsShell = true; +#endif // // Ninja is not ported to non-Unix OS yet. // this->ForceUnixPaths = true; this->FindMakeProgramFile = "CMakeNinjaFindMake.cmake"; diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 60d545b..b74ba6f 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -23,6 +23,8 @@ //---------------------------------------------------------------------------- cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator() { + this->WindowsShell = true; + this->WindowsVSIDE = true; } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx index 49c516f..181178f 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.cxx +++ b/Source/cmGlobalWatcomWMakeGenerator.cxx @@ -22,6 +22,10 @@ cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator() this->ToolSupportsColor = true; this->NeedSymbolicMark = true; this->EmptyRuleHackCommand = "@cd ."; +#ifdef _WIN32 + this->WindowsShell = true; +#endif + this->WatcomWMake = true; } void cmGlobalWatcomWMakeGenerator @@ -47,10 +51,6 @@ cmGlobalWatcomWMakeGenerator::CreateLocalGenerator(cmLocalGenerator* parent) cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3(this, parent); lg->SetDefineWindowsNULL(true); -#ifdef _WIN32 - lg->SetWindowsShell(true); -#endif - lg->SetWatcomWMake(true); lg->SetMakeSilentFlag("-h"); lg->SetIgnoreLibPrefix(true); lg->SetPassMakeflags(false); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 5ef0a3b..bd6af8c 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -61,12 +61,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, } this->Makefile = new cmMakefile(this); - this->WindowsShell = false; - this->WindowsVSIDE = false; - this->WatcomWMake = false; - this->MinGWMake = false; - this->NMake = false; - this->MSYSShell = false; this->LinkScriptShell = false; this->IgnoreLibPrefix = false; this->UseRelativePaths = false; @@ -1254,7 +1248,7 @@ cmLocalGenerator::ConvertToOutputForExistingCommon(const std::string& remote, // If this is a windows shell, the result has a space, and the path // already exists, we can use a short-path to reference it without a // space. - if(this->WindowsShell && result.find(' ') != result.npos && + if(this->GlobalGenerator->WindowsShell && result.find(' ') != result.npos && cmSystemTools::FileExists(remote.c_str())) { std::string tmp; @@ -2626,7 +2620,7 @@ void cmLocalGenerator::JoinDefines(const std::set& defines, { // Append the definition with proper escaping. std::string def = dflag; - if(this->WatcomWMake) + if(this->GlobalGenerator->WatcomWMake) { // The Watcom compiler does its own command line parsing instead // of using the windows shell rules. Definitions are one of @@ -2805,7 +2799,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source, // For the MSYS shell convert drive letters to posix paths, so // that c:/some/path becomes /c/some/path. This is needed to // avoid problems with the shell path translation. - if(this->MSYSShell && !this->LinkScriptShell) + if(this->GlobalGenerator->MSYSShell && !this->LinkScriptShell) { if(result.size() > 2 && result[1] == ':') { @@ -2813,7 +2807,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source, result[0] = '/'; } } - if(this->WindowsShell) + if(this->GlobalGenerator->WindowsShell) { std::replace(result.begin(), result.end(), '/', '\\'); } @@ -3324,6 +3318,26 @@ void cmLocalGenerator::ComputeObjectFilenames( } +bool cmLocalGenerator::IsWindowsShell() const +{ + return this->GlobalGenerator->WindowsShell; +} + +bool cmLocalGenerator::IsWatcomWMake() const +{ + return this->GlobalGenerator->WatcomWMake; +} + +bool cmLocalGenerator::IsMinGWMake() const +{ + return this->GlobalGenerator->MinGWMake; +} + +bool cmLocalGenerator::IsNMake() const +{ + return this->GlobalGenerator->NMake; +} + //---------------------------------------------------------------------------- std::string cmLocalGenerator @@ -3467,7 +3481,7 @@ std::string cmLocalGenerator::EscapeForShell(const std::string& str, // Compute the flags for the target shell environment. int flags = 0; - if(this->WindowsVSIDE) + if(this->GlobalGenerator->WindowsVSIDE) { flags |= cmsysSystem_Shell_Flag_VSIDE; } @@ -3487,27 +3501,27 @@ std::string cmLocalGenerator::EscapeForShell(const std::string& str, { flags |= cmsysSystem_Shell_Flag_WatcomQuote; } - if(this->WatcomWMake) + if(this->GlobalGenerator->WatcomWMake) { flags |= cmsysSystem_Shell_Flag_WatcomWMake; } - if(this->MinGWMake) + if(this->GlobalGenerator->MinGWMake) { flags |= cmsysSystem_Shell_Flag_MinGWMake; } - if(this->NMake) + if(this->GlobalGenerator->NMake) { flags |= cmsysSystem_Shell_Flag_NMake; } // Compute the buffer size needed. - int size = (this->WindowsShell ? + int size = (this->GlobalGenerator->WindowsShell ? cmsysSystem_Shell_GetArgumentSizeForWindows(str.c_str(), flags) : cmsysSystem_Shell_GetArgumentSizeForUnix(str.c_str(), flags)); // Compute the shell argument itself. std::vector arg(size); - if(this->WindowsShell) + if(this->GlobalGenerator->WindowsShell) { cmsysSystem_Shell_GetArgumentForWindows(str.c_str(), &arg[0], flags); } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 100d27b..47c0877 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -383,6 +383,11 @@ public: std::map& mapping, cmGeneratorTarget const* gt = 0); + bool IsWindowsShell() const; + bool IsWatcomWMake() const; + bool IsMinGWMake() const; + bool IsNMake() const; + protected: ///! put all the libraries for a target on into the given stream virtual void OutputLinkLibraries(std::string& linkLibraries, @@ -457,17 +462,13 @@ protected: std::map UniqueObjectNamesMap; std::string::size_type ObjectPathMax; std::set ObjectMaxPathViolations; - bool WindowsShell; - bool WindowsVSIDE; - bool WatcomWMake; - bool MinGWMake; - bool NMake; - bool MSYSShell; + bool LinkScriptShell; bool UseRelativePaths; bool IgnoreLibPrefix; bool Configured; bool EmitUniversalBinaryFlags; + // Hack for ExpandRuleVariable until object-oriented version is // committed. std::string TargetImplib; diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index ac10f09..ded4c25 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -28,9 +28,6 @@ cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg, , ConfigName("") , HomeRelativeOutputPath("") { -#ifdef _WIN32 - this->WindowsShell = true; -#endif this->TargetImplib = "$TARGET_IMPLIB"; } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index a2a3725..f11c79e 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -83,7 +83,6 @@ cmLocalUnixMakefileGenerator3:: cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmLocalGenerator* parent) : cmLocalGenerator(gg, parent) { - this->WindowsShell = false; this->IncludeDirective = "include"; this->MakefileVariableSize = 0; this->IgnoreLibPrefix = false; @@ -679,7 +678,7 @@ cmLocalUnixMakefileGenerator3 // Write the list of commands. os << cmWrap("\t", commands, "", "\n") << "\n"; - if(symbolic && !this->WatcomWMake) + if(symbolic && !this->IsWatcomWMake()) { os << ".PHONY : " << cmMakeSafe(tgt) << "\n"; } @@ -696,7 +695,7 @@ std::string cmLocalUnixMakefileGenerator3 ::ConvertShellCommand(std::string const& cmd, RelativeRoot root) { - if(this->WatcomWMake && + if(this->IsWatcomWMake() && cmSystemTools::FileIsFullPath(cmd.c_str()) && cmd.find_first_of("( )") != cmd.npos) { @@ -730,7 +729,7 @@ cmLocalUnixMakefileGenerator3 << "NULL=nul\n" << "!ENDIF\n"; } - if(this->WindowsShell) + if(this->IsWindowsShell()) { makefileStream << "SHELL = cmd.exe\n" @@ -798,7 +797,8 @@ cmLocalUnixMakefileGenerator3 makefileStream, "Disable implicit rules so canonical targets will work.", ".SUFFIXES", no_depends, no_commands, false); - if(!this->NMake && !this->WatcomWMake && !this->BorlandMakeCurlyHack) + if(!this->IsNMake() + && !this->IsWatcomWMake() && !this->BorlandMakeCurlyHack) { // turn off RCS and SCCS automatic stuff from gmake makefileStream @@ -810,7 +810,7 @@ cmLocalUnixMakefileGenerator3 depends.push_back(".hpux_make_needs_suffix_list"); this->WriteMakeRule(makefileStream, 0, ".SUFFIXES", depends, no_commands, false); - if(this->WatcomWMake) + if(this->IsWatcomWMake()) { // Switch on WMake feature, if an error or interrupt occurs during // makefile processing, the current target being made may be deleted @@ -828,7 +828,7 @@ cmLocalUnixMakefileGenerator3 << "VERBOSE = 1\n" << "\n"; } - if(this->WatcomWMake) + if(this->IsWatcomWMake()) { makefileStream << "!ifndef VERBOSE\n" @@ -962,7 +962,7 @@ cmLocalUnixMakefileGenerator3 void cmLocalUnixMakefileGenerator3::AppendFlags(std::string& flags, const std::string& newFlags) { - if(this->WatcomWMake && !newFlags.empty()) + if(this->IsWatcomWMake() && !newFlags.empty()) { std::string newf = newFlags; if(newf.find("\\\"") != newf.npos) @@ -1112,7 +1112,7 @@ cmLocalUnixMakefileGenerator3 // bool useCall = false; - if (this->WindowsShell) + if (this->IsWindowsShell()) { std::string suffix; if (cmd.size() > 4) @@ -1179,7 +1179,7 @@ cmLocalUnixMakefileGenerator3 { cmd = "call " + cmd; } - else if (this->NMake && cmd[0]=='"') + else if (this->IsNMake() && cmd[0]=='"') { cmd = "echo >nul && " + cmd; } @@ -2344,7 +2344,7 @@ void cmLocalUnixMakefileGenerator3 // used by NMake and Borland make does not support "cd /d" so this // feature simply cannot work with them (Borland make does not even // support changing the drive letter with just "d:"). - const char* cd_cmd = this->MinGWMake? "cd /d " : "cd "; + const char* cd_cmd = this->IsMinGWMake() ? "cd /d " : "cd "; if(!this->UnixCD) { diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 4e48ad7..7b436a5 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -81,36 +81,6 @@ public: std::string &GetMakeSilentFlag() { return this->MakeSilentFlag; } /** - * Set to true if the shell being used is the windows shell. - * This controls if statements in the makefile and the SHELL variable. - * The default is false. - */ - void SetWindowsShell(bool v) {this->WindowsShell = v;} - - /** - * Set to true if the make tool being used is Watcom WMake. - */ - void SetWatcomWMake(bool v) {this->WatcomWMake = v;} - - /** - * Set to true if the make tool being used is MinGW Make. - */ - void SetMinGWMake(bool v) {this->MinGWMake = v;} - bool IsMinGWMake() const { return this->MinGWMake; } - - /** - * Set to true if the make tool being used is NMake. - */ - void SetNMake(bool v) {this->NMake = v;} - - /** - * Set to true if the shell being used is the MSYS shell. - * This controls if statements in the makefile and the SHELL variable. - * The default is false. - */ - void SetMSYSShell(bool v) {this->MSYSShell = v;} - - /** * If set to true, then NULL is set to nil for non Windows_NT. * This uses make syntax used by nmake and borland. * The default is false. diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index f95d09b..4a596d5 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -23,8 +23,6 @@ cmLocalVisualStudioGenerator cmLocalGenerator* parent) : cmLocalGenerator(gg, parent) { - this->WindowsShell = true; - this->WindowsVSIDE = true; this->Version = v; } http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=062e4b756a2c5eec51b24b1e64ee09f1085f3420 commit 062e4b756a2c5eec51b24b1e64ee09f1085f3420 Author: Stephen Kelly AuthorDate: Mon May 4 22:40:07 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 21:50:43 2015 +0200 cmLocalGenerator: Port loops to cmState::Snapshot. Make this code less dependent on being part of cmLocalGenerator, where it doesn't really belong. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 1099f0f..5ef0a3b 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2853,15 +2853,15 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote, //---------------------------------------------------------------------------- std::string cmLocalGenerator::FindRelativePathTopSource() { - cmLocalGenerator* gen = this; - std::vector gens; - gens.push_back(gen); + cmState::Snapshot snapshot = this->StateSnapshot; + std::vector snapshots; + snapshots.push_back(snapshot); while (true) { - gen = gen->GetParent(); - if (gen) + snapshot = snapshot.GetParent(); + if (snapshot.IsValid()) { - gens.push_back(gen); + snapshots.push_back(snapshot); } else { @@ -2869,13 +2869,12 @@ std::string cmLocalGenerator::FindRelativePathTopSource() } } - std::string result = gens.front()->StateSnapshot.GetCurrentSourceDirectory(); + std::string result = snapshots.front().GetCurrentSourceDirectory(); - for (std::vector::const_iterator it = gens.begin() + 1; - it != gens.end(); ++it) + for (std::vector::const_iterator it = + snapshots.begin() + 1; it != snapshots.end(); ++it) { - std::string currentSource = - (*it)->StateSnapshot.GetCurrentSourceDirectory(); + std::string currentSource = it->GetCurrentSourceDirectory(); if(cmSystemTools::IsSubDirectory(result, currentSource)) { result = currentSource; @@ -2888,15 +2887,15 @@ std::string cmLocalGenerator::FindRelativePathTopSource() //---------------------------------------------------------------------------- std::string cmLocalGenerator::FindRelativePathTopBinary() { - cmLocalGenerator* gen = this; - std::vector gens; - gens.push_back(gen); + cmState::Snapshot snapshot = this->StateSnapshot; + std::vector snapshots; + snapshots.push_back(snapshot); while (true) { - gen = gen->GetParent(); - if (gen) + snapshot = snapshot.GetParent(); + if (snapshot.IsValid()) { - gens.push_back(gen); + snapshots.push_back(snapshot); } else { @@ -2904,13 +2903,12 @@ std::string cmLocalGenerator::FindRelativePathTopBinary() } } - std::string result = gens.front()->StateSnapshot.GetCurrentBinaryDirectory(); + std::string result = snapshots.front().GetCurrentBinaryDirectory(); - for (std::vector::const_iterator it = gens.begin() + 1; - it != gens.end(); ++it) + for (std::vector::const_iterator it = + snapshots.begin() + 1; it != snapshots.end(); ++it) { - std::string currentBinary = - (*it)->StateSnapshot.GetCurrentBinaryDirectory(); + std::string currentBinary = it->GetCurrentBinaryDirectory(); if(cmSystemTools::IsSubDirectory(result, currentBinary)) { result = currentBinary; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5df60ddaa5828dd92a07174ba95df3fcee4d30f6 commit 5df60ddaa5828dd92a07174ba95df3fcee4d30f6 Author: Stephen Kelly AuthorDate: Mon May 4 22:38:37 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 21:50:42 2015 +0200 cmState: Add an accessor for Parent snapshot and a validity check. diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 67a2274..3cca3a7 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -522,3 +522,24 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) cmSystemTools::CollapseFullPath( this->State->OutputLocations[this->Position]); } + +bool cmState::Snapshot::IsValid() const +{ + return this->State; +} + +cmState::Snapshot cmState::Snapshot::GetParent() const +{ + Snapshot snapshot; + if (!this->State) + { + return snapshot; + } + PositionType parentPos = this->State->ParentPositions[this->Position]; + if (parentPos > 0) + { + snapshot = Snapshot(this->State, parentPos); + } + + return snapshot; +} diff --git a/Source/cmState.h b/Source/cmState.h index d10fae3..ed58c64 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -36,6 +36,9 @@ public: const char* GetCurrentBinaryDirectory() const; void SetCurrentBinaryDirectory(std::string const& dir); + bool IsValid() const; + Snapshot GetParent() const; + private: friend class cmState; cmState* State; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8db3073b3c8b7060b7496f17c2a07ec9cd76e28e commit 8db3073b3c8b7060b7496f17c2a07ec9cd76e28e Author: Stephen Kelly AuthorDate: Mon May 4 22:38:52 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 21:50:42 2015 +0200 cmLocalGenerator: Convert two recursive methods to loops. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index f3ad60a..1099f0f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2853,41 +2853,71 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote, //---------------------------------------------------------------------------- std::string cmLocalGenerator::FindRelativePathTopSource() { - // Relative path conversion within a single tree managed by CMake is - // safe. We can use our parent relative path top if and only if - // this is a subdirectory of that top. - if(cmLocalGenerator* parent = this->GetParent()) + cmLocalGenerator* gen = this; + std::vector gens; + gens.push_back(gen); + while (true) { - std::string parentTop = parent->FindRelativePathTopSource(); - if(cmSystemTools::IsSubDirectory( - this->StateSnapshot.GetCurrentSourceDirectory(), parentTop)) + gen = gen->GetParent(); + if (gen) { - return parentTop; + gens.push_back(gen); + } + else + { + break; + } + } + + std::string result = gens.front()->StateSnapshot.GetCurrentSourceDirectory(); + + for (std::vector::const_iterator it = gens.begin() + 1; + it != gens.end(); ++it) + { + std::string currentSource = + (*it)->StateSnapshot.GetCurrentSourceDirectory(); + if(cmSystemTools::IsSubDirectory(result, currentSource)) + { + result = currentSource; } } - // Otherwise this directory itself is the new top. - return this->StateSnapshot.GetCurrentSourceDirectory(); + return result; } //---------------------------------------------------------------------------- std::string cmLocalGenerator::FindRelativePathTopBinary() { - // Relative path conversion within a single tree managed by CMake is - // safe. We can use our parent relative path top if and only if - // this is a subdirectory of that top. - if(cmLocalGenerator* parent = this->GetParent()) + cmLocalGenerator* gen = this; + std::vector gens; + gens.push_back(gen); + while (true) { - std::string parentTop = parent->FindRelativePathTopBinary(); - if(cmSystemTools::IsSubDirectory( - this->StateSnapshot.GetCurrentBinaryDirectory(), parentTop)) + gen = gen->GetParent(); + if (gen) { - return parentTop; + gens.push_back(gen); + } + else + { + break; + } + } + + std::string result = gens.front()->StateSnapshot.GetCurrentBinaryDirectory(); + + for (std::vector::const_iterator it = gens.begin() + 1; + it != gens.end(); ++it) + { + std::string currentBinary = + (*it)->StateSnapshot.GetCurrentBinaryDirectory(); + if(cmSystemTools::IsSubDirectory(result, currentBinary)) + { + result = currentBinary; } } - // Otherwise this directory itself is the new top. - return this->StateSnapshot.GetCurrentBinaryDirectory(); + return result; } //---------------------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ec833cedc31f2693e6f48ac71e5fda36c5cb890e commit ec833cedc31f2693e6f48ac71e5fda36c5cb890e Author: Stephen Kelly AuthorDate: Sun May 3 17:19:16 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 21:50:42 2015 +0200 cmLocalGenerator: Get project directories from the cmState. Make this class and cmMakefile less interdependent. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index c099a4d..f3ad60a 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -115,7 +115,7 @@ void cmLocalGenerator::Configure() static_cast(clg); // make sure the CMakeFiles dir is there - std::string filesDir = this->Makefile->GetCurrentBinaryDirectory(); + std::string filesDir = this->StateSnapshot.GetCurrentBinaryDirectory(); filesDir += cmake::GetCMakeFilesDirectory(); cmSystemTools::MakeDirectory(filesDir.c_str()); @@ -191,7 +191,7 @@ void cmLocalGenerator::ComputeObjectMaxPath() void cmLocalGenerator::ReadInputFile() { // Look for the CMakeLists.txt file. - std::string currentStart = this->Makefile->GetCurrentSourceDirectory(); + std::string currentStart = this->StateSnapshot.GetCurrentSourceDirectory(); currentStart += "/CMakeLists.txt"; if(cmSystemTools::FileExists(currentStart.c_str(), true)) { @@ -208,7 +208,7 @@ void cmLocalGenerator::ReadInputFile() cmMakefile* mf = this->Parent->GetMakefile(); std::ostringstream e; e << "The source directory\n" - << " " << this->Makefile->GetCurrentSourceDirectory() << "\n" + << " " << this->StateSnapshot.GetCurrentSourceDirectory() << "\n" << "does not contain a CMakeLists.txt file."; switch (mf->GetPolicyStatus(cmPolicies::CMP0014)) { @@ -241,20 +241,19 @@ void cmLocalGenerator::SetupPathConversions() // Convert std::string outdir; outdir = - cmSystemTools::CollapseFullPath(this->Makefile->GetHomeDirectory()); + cmSystemTools::CollapseFullPath(this->GetState()->GetSourceDirectory()); cmSystemTools::SplitPath(outdir, this->HomeDirectoryComponents); - outdir = - cmSystemTools::CollapseFullPath( - this->Makefile->GetCurrentSourceDirectory()); + outdir = cmSystemTools::CollapseFullPath( + this->StateSnapshot.GetCurrentSourceDirectory()); cmSystemTools::SplitPath(outdir, this->StartDirectoryComponents); outdir = cmSystemTools::CollapseFullPath - (this->Makefile->GetHomeOutputDirectory()); + (this->GetState()->GetBinaryDirectory()); cmSystemTools::SplitPath(outdir, this->HomeOutputDirectoryComponents); outdir = cmSystemTools::CollapseFullPath - (this->Makefile->GetCurrentBinaryDirectory()); + (this->StateSnapshot.GetCurrentBinaryDirectory()); cmSystemTools::SplitPath(outdir, this->StartOutputDirectoryComponents); } @@ -303,7 +302,7 @@ void cmLocalGenerator::GenerateTestFiles() const std::string& config = this->Makefile->GetConfigurations(configurationTypes, false); - std::string file = this->Makefile->GetCurrentBinaryDirectory(); + std::string file = this->StateSnapshot.GetCurrentBinaryDirectory(); file += "/"; file += "CTestTestfile.cmake"; @@ -312,9 +311,9 @@ void cmLocalGenerator::GenerateTestFiles() fout << "# CMake generated Testfile for " << std::endl << "# Source directory: " - << this->Makefile->GetCurrentSourceDirectory() << std::endl + << this->StateSnapshot.GetCurrentSourceDirectory() << std::endl << "# Build directory: " - << this->Makefile->GetCurrentBinaryDirectory() << std::endl + << this->StateSnapshot.GetCurrentBinaryDirectory() << std::endl << "# " << std::endl << "# This file includes the relevant testing commands " << "required for " << std::endl @@ -428,9 +427,9 @@ void cmLocalGenerator::GenerateInstallRules() } // Create the install script file. - std::string file = this->Makefile->GetCurrentBinaryDirectory(); - std::string homedir = this->Makefile->GetHomeOutputDirectory(); - std::string currdir = this->Makefile->GetCurrentBinaryDirectory(); + std::string file = this->StateSnapshot.GetCurrentBinaryDirectory(); + std::string homedir = this->GetState()->GetBinaryDirectory(); + std::string currdir = this->StateSnapshot.GetCurrentBinaryDirectory(); cmSystemTools::ConvertToUnixSlashes(file); cmSystemTools::ConvertToUnixSlashes(homedir); cmSystemTools::ConvertToUnixSlashes(currdir); @@ -445,7 +444,7 @@ void cmLocalGenerator::GenerateInstallRules() // Write the header. fout << "# Install script for directory: " - << this->Makefile->GetCurrentSourceDirectory() + << this->StateSnapshot.GetCurrentSourceDirectory() << std::endl << std::endl; fout << "# Set the install prefix" << std::endl << "if(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl @@ -664,7 +663,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, source.GetFullPath(), commandLines, comment.c_str(), - this->Makefile->GetCurrentBinaryDirectory() + this->StateSnapshot.GetCurrentBinaryDirectory() ); } @@ -686,12 +685,12 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, !sf->GetPropertyAsBool("EXTERNAL_OBJECT")) { std::string dir_max; - dir_max += this->Makefile->GetCurrentBinaryDirectory(); + dir_max += this->StateSnapshot.GetCurrentBinaryDirectory(); dir_max += "/"; std::string obj = this->GetObjectFileNameWithoutTarget(*sf, dir_max); if(!obj.empty()) { - std::string ofname = this->Makefile->GetCurrentBinaryDirectory(); + std::string ofname = this->StateSnapshot.GetCurrentBinaryDirectory(); ofname += "/"; ofname += obj; objVector.push_back(ofname); @@ -761,7 +760,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, "", commandLines, comment.c_str(), - this->Makefile->GetCurrentBinaryDirectory() + this->StateSnapshot.GetCurrentBinaryDirectory() ); this->Makefile->GetSource(targetFullPath); target.Target->AddSource(targetFullPath); @@ -1565,19 +1564,19 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, if(includeBinaryDir) { if(emitted.find( - this->Makefile->GetCurrentBinaryDirectory()) == emitted.end()) + this->StateSnapshot.GetCurrentBinaryDirectory()) == emitted.end()) { - dirs.push_back(this->Makefile->GetCurrentBinaryDirectory()); - emitted.insert(this->Makefile->GetCurrentBinaryDirectory()); + dirs.push_back(this->StateSnapshot.GetCurrentBinaryDirectory()); + emitted.insert(this->StateSnapshot.GetCurrentBinaryDirectory()); } } if(includeSourceDir) { if(emitted.find( - this->Makefile->GetCurrentSourceDirectory()) == emitted.end()) + this->StateSnapshot.GetCurrentSourceDirectory()) == emitted.end()) { - dirs.push_back(this->Makefile->GetCurrentSourceDirectory()); - emitted.insert(this->Makefile->GetCurrentSourceDirectory()); + dirs.push_back(this->StateSnapshot.GetCurrentSourceDirectory()); + emitted.insert(this->StateSnapshot.GetCurrentSourceDirectory()); } } @@ -1619,8 +1618,8 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, // it is requested by the project. if(this->Makefile->IsOn("CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE")) { - const char* topSourceDir = this->Makefile->GetHomeDirectory(); - const char* topBinaryDir = this->Makefile->GetHomeOutputDirectory(); + const char* topSourceDir = this->GetState()->GetSourceDirectory(); + const char* topBinaryDir = this->GetState()->GetBinaryDirectory(); for(std::vector::const_iterator i = includes.begin(); i != includes.end(); ++i) { @@ -2178,7 +2177,7 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName, // Treat the name as relative to the source directory in which it // was given. - dep = this->Makefile->GetCurrentSourceDirectory(); + dep = this->StateSnapshot.GetCurrentSourceDirectory(); dep += "/"; dep += inName; return true; @@ -2730,10 +2729,10 @@ const char* cmLocalGenerator::GetRelativeRootPath(RelativeRoot relroot) { switch (relroot) { - case HOME: return this->Makefile->GetHomeDirectory(); - case START: return this->Makefile->GetCurrentSourceDirectory(); - case HOME_OUTPUT: return this->Makefile->GetHomeOutputDirectory(); - case START_OUTPUT: return this->Makefile->GetCurrentBinaryDirectory(); + case HOME: return this->GetState()->GetSourceDirectory(); + case START: return this->StateSnapshot.GetCurrentSourceDirectory(); + case HOME_OUTPUT: return this->GetState()->GetBinaryDirectory(); + case START_OUTPUT: return this->StateSnapshot.GetCurrentBinaryDirectory(); default: break; } return 0; @@ -2861,14 +2860,14 @@ std::string cmLocalGenerator::FindRelativePathTopSource() { std::string parentTop = parent->FindRelativePathTopSource(); if(cmSystemTools::IsSubDirectory( - this->Makefile->GetCurrentSourceDirectory(), parentTop)) + this->StateSnapshot.GetCurrentSourceDirectory(), parentTop)) { return parentTop; } } // Otherwise this directory itself is the new top. - return this->Makefile->GetCurrentSourceDirectory(); + return this->StateSnapshot.GetCurrentSourceDirectory(); } //---------------------------------------------------------------------------- @@ -2881,14 +2880,14 @@ std::string cmLocalGenerator::FindRelativePathTopBinary() { std::string parentTop = parent->FindRelativePathTopBinary(); if(cmSystemTools::IsSubDirectory( - this->Makefile->GetCurrentBinaryDirectory(), parentTop)) + this->StateSnapshot.GetCurrentBinaryDirectory(), parentTop)) { return parentTop; } } // Otherwise this directory itself is the new top. - return this->Makefile->GetCurrentBinaryDirectory(); + return this->StateSnapshot.GetCurrentBinaryDirectory(); } //---------------------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d4bbbbcffc7592c990fe2c64c13eed4550fe48fa commit d4bbbbcffc7592c990fe2c64c13eed4550fe48fa Author: Stephen Kelly AuthorDate: Sun May 3 16:51:51 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 21:50:42 2015 +0200 cmLocalGenerator: Initialize state before creating cmMakefile. Access the state from the local generator in the cmMakefile. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 2f2da20..c099a4d 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -51,6 +51,13 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, if (parent) { parent->AddChild(this); + this->StateSnapshot = + this->GetState()->CreateSnapshot(parent->StateSnapshot); + } + else + { + this->StateSnapshot = + this->GetState()->CreateSnapshot(cmState::Snapshot(this->GetState())); } this->Makefile = new cmMakefile(this); @@ -573,6 +580,16 @@ void cmLocalGenerator::GenerateTargetManifest() } } +cmState* cmLocalGenerator::GetState() const +{ + return this->GlobalGenerator->GetCMakeInstance()->GetState(); +} + +cmState::Snapshot cmLocalGenerator::GetStateSnapshot() const +{ + return this->StateSnapshot; +} + void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, const std::string& lang, cmSourceFile& source, diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 44a2d99..100d27b 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -13,6 +13,7 @@ #define cmLocalGenerator_h #include "cmStandardIncludes.h" +#include "cmState.h" class cmMakefile; class cmGlobalGenerator; @@ -88,6 +89,9 @@ public: const cmGlobalGenerator *GetGlobalGenerator() const { return this->GlobalGenerator; } + cmState* GetState() const; + cmState::Snapshot GetStateSnapshot() const; + /** * Convert something to something else. This is a centralized conversion * routine used by the generators to handle relative paths and the like. @@ -442,6 +446,7 @@ protected: void ReadInputFile(); cmMakefile *Makefile; + cmState::Snapshot StateSnapshot; cmGlobalGenerator *GlobalGenerator; std::vector HomeDirectoryComponents; std::vector StartDirectoryComponents; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 82add86..b448338 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -153,27 +153,13 @@ public: cmMakefile::cmMakefile(cmLocalGenerator* localGenerator) : Internal(new Internals), LocalGenerator(localGenerator), - StateSnapshot(localGenerator->GetGlobalGenerator() - ->GetCMakeInstance()->GetState()) + StateSnapshot(localGenerator->GetStateSnapshot()) { this->Internal->PushDefinitions(); this->Internal->VarInitStack.push(std::set()); this->Internal->VarUsageStack.push(std::set()); this->Internal->IsSourceFileTryCompile = false; - if (this->LocalGenerator->GetParent()) - { - cmMakefile* parentMf = this->LocalGenerator->GetParent()->GetMakefile(); - this->StateSnapshot = - this->GetState()->CreateSnapshot(parentMf->StateSnapshot); - } - else - { - this->StateSnapshot = - this->GetState()->CreateSnapshot(this->StateSnapshot); - } - - // Initialize these first since AddDefaultDefinitions calls AddDefinition this->WarnUnused = false; this->CheckSystemVars = false; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0c801c6963f051c32e0586266539f155a70bd5e3 commit 0c801c6963f051c32e0586266539f155a70bd5e3 Author: Stephen Kelly AuthorDate: Sun May 3 16:50:34 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 21:50:41 2015 +0200 cmLocalGenerator: Require a global generator in the constructor. Port generator factory methods to pass it. diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx index 597e08e..0220799 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.cxx +++ b/Source/cmGlobalBorlandMakefileGenerator.cxx @@ -41,13 +41,12 @@ cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator( cmLocalGenerator* parent) { cmLocalUnixMakefileGenerator3* lg = - new cmLocalUnixMakefileGenerator3(parent); + new cmLocalUnixMakefileGenerator3(this, parent); lg->SetIncludeDirective("!include"); lg->SetWindowsShell(true); lg->SetDefineWindowsNULL(true); lg->SetMakefileVariableSize(32); lg->SetPassMakeflags(true); - lg->SetGlobalGenerator(this); lg->SetUnixCD(false); lg->SetMakeCommandEscapeTargetTwice(true); lg->SetBorlandMakeCurlyHack(true); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 1c90537..7117402 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1877,9 +1877,7 @@ void cmGlobalGenerator::EnableInstallTarget() cmLocalGenerator * cmGlobalGenerator::CreateLocalGenerator(cmLocalGenerator *parent) { - cmLocalGenerator *lg = new cmLocalGenerator(parent); - lg->SetGlobalGenerator(this); - return lg; + return new cmLocalGenerator(this, parent); } void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen, diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 181a517..d6bf75c 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -35,8 +35,7 @@ cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator() cmLocalGenerator * cmGlobalGhsMultiGenerator::CreateLocalGenerator(cmLocalGenerator* parent) { - cmLocalGenerator *lg = new cmLocalGhsMultiGenerator(parent); - lg->SetGlobalGenerator(this); + cmLocalGenerator *lg = new cmLocalGhsMultiGenerator(this, parent); this->SetCurrentLocalGenerator(lg); return lg; } diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx index cfa5072..1caa730 100644 --- a/Source/cmGlobalJOMMakefileGenerator.cxx +++ b/Source/cmGlobalJOMMakefileGenerator.cxx @@ -49,11 +49,10 @@ cmLocalGenerator * cmGlobalJOMMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) { cmLocalUnixMakefileGenerator3* lg - = new cmLocalUnixMakefileGenerator3(parent); + = new cmLocalUnixMakefileGenerator3(this, parent); lg->SetDefineWindowsNULL(true); lg->SetWindowsShell(true); lg->SetMakeSilentFlag("/nologo"); - lg->SetGlobalGenerator(this); lg->SetIgnoreLibPrefix(true); lg->SetPassMakeflags(true); lg->SetNMake(true); diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx index fa23491..319eeaf 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.cxx +++ b/Source/cmGlobalMSYSMakefileGenerator.cxx @@ -97,10 +97,9 @@ cmLocalGenerator * cmGlobalMSYSMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) { cmLocalUnixMakefileGenerator3* lg = - new cmLocalUnixMakefileGenerator3(parent); + new cmLocalUnixMakefileGenerator3(this, parent); lg->SetWindowsShell(false); lg->SetMSYSShell(true); - lg->SetGlobalGenerator(this); lg->SetIgnoreLibPrefix(true); lg->SetPassMakeflags(false); lg->SetUnixCD(true); diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx index c9389aa..c4511e5 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.cxx +++ b/Source/cmGlobalMinGWMakefileGenerator.cxx @@ -35,9 +35,8 @@ cmLocalGenerator * cmGlobalMinGWMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) { cmLocalUnixMakefileGenerator3* lg = - new cmLocalUnixMakefileGenerator3(parent); + new cmLocalUnixMakefileGenerator3(this, parent); lg->SetWindowsShell(true); - lg->SetGlobalGenerator(this); lg->SetIgnoreLibPrefix(true); lg->SetPassMakeflags(false); lg->SetUnixCD(true); diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx index a3b3dd7..2732e22 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.cxx +++ b/Source/cmGlobalNMakeMakefileGenerator.cxx @@ -49,11 +49,10 @@ cmLocalGenerator * cmGlobalNMakeMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) { cmLocalUnixMakefileGenerator3* lg = - new cmLocalUnixMakefileGenerator3(parent); + new cmLocalUnixMakefileGenerator3(this, parent); lg->SetDefineWindowsNULL(true); lg->SetWindowsShell(true); lg->SetMakeSilentFlag("/nologo"); - lg->SetGlobalGenerator(this); lg->SetIgnoreLibPrefix(true); lg->SetPassMakeflags(true); lg->SetNMake(true); diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 678d60b..dde9ca4 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -499,9 +499,7 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator() cmLocalGenerator* cmGlobalNinjaGenerator::CreateLocalGenerator(cmLocalGenerator* parent) { - cmLocalGenerator* lg = new cmLocalNinjaGenerator(parent); - lg->SetGlobalGenerator(this); - return lg; + return new cmLocalNinjaGenerator(this, parent); } void cmGlobalNinjaGenerator diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 95998ae..f5731f4 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -56,9 +56,7 @@ void cmGlobalUnixMakefileGenerator3 cmLocalGenerator * cmGlobalUnixMakefileGenerator3::CreateLocalGenerator(cmLocalGenerator* parent) { - cmLocalGenerator* lg = new cmLocalUnixMakefileGenerator3(parent); - lg->SetGlobalGenerator(this); - return lg; + return new cmLocalUnixMakefileGenerator3(this, parent); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 6481ec2..04bb6ce 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -311,11 +311,8 @@ void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout) cmLocalGenerator * cmGlobalVisualStudio10Generator::CreateLocalGenerator(cmLocalGenerator* parent) { - cmLocalVisualStudio10Generator* lg = - new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS10, - parent); - lg->SetGlobalGenerator(this); - return lg; + return new cmLocalVisualStudio10Generator( + cmLocalVisualStudioGenerator::VS10, this, parent); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 45d6d95..36ae0a4 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -240,11 +240,8 @@ void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout) cmLocalGenerator * cmGlobalVisualStudio11Generator::CreateLocalGenerator(cmLocalGenerator* parent) { - cmLocalVisualStudio10Generator* lg = - new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS11, - parent); - lg->SetGlobalGenerator(this); - return lg; + return new cmLocalVisualStudio10Generator( + cmLocalVisualStudioGenerator::VS11, this, parent); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index e298b06..17b2fc7 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -220,11 +220,8 @@ void cmGlobalVisualStudio12Generator::WriteSLNHeader(std::ostream& fout) cmLocalGenerator * cmGlobalVisualStudio12Generator::CreateLocalGenerator(cmLocalGenerator* parent) { - cmLocalVisualStudio10Generator* lg = - new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS12, - parent); - lg->SetGlobalGenerator(this); - return lg; + return new cmLocalVisualStudio10Generator( + cmLocalVisualStudioGenerator::VS12, this, parent); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index 6642d88..90fcc7e 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -131,9 +131,6 @@ void cmGlobalVisualStudio14Generator::WriteSLNHeader(std::ostream& fout) cmLocalGenerator * cmGlobalVisualStudio14Generator::CreateLocalGenerator(cmLocalGenerator* parent) { - cmLocalVisualStudio10Generator* lg = - new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS14, - parent); - lg->SetGlobalGenerator(this); - return lg; + return new cmLocalVisualStudio10Generator( + cmLocalVisualStudioGenerator::VS14, this, parent); } diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 55e70b3..570314e 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -173,9 +173,7 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand( cmLocalGenerator * cmGlobalVisualStudio6Generator::CreateLocalGenerator(cmLocalGenerator* parent) { - cmLocalGenerator *lg = new cmLocalVisualStudio6Generator(parent); - lg->SetGlobalGenerator(this); - return lg; + return new cmLocalVisualStudio6Generator(this, parent); } diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index db34d44..308e858 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -30,9 +30,8 @@ cmGlobalVisualStudio71Generator::CreateLocalGenerator(cmLocalGenerator* parent) { cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS71, - parent); + this, parent); lg->SetExtraFlagTable(this->GetExtraFlagTableVS7()); - lg->SetGlobalGenerator(this); return lg; } diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index de90f7e..b78823f 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -255,9 +255,8 @@ cmGlobalVisualStudio7Generator::CreateLocalGenerator(cmLocalGenerator* parent) { cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS7, - parent); + this, parent); lg->SetExtraFlagTable(this->GetExtraFlagTableVS7()); - lg->SetGlobalGenerator(this); return lg; } diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 7174f21..ff9ff10 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -130,9 +130,8 @@ cmGlobalVisualStudio8Generator::CreateLocalGenerator(cmLocalGenerator* parent) { cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS8, - parent); + this, parent); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); - lg->SetGlobalGenerator(this); return lg; } diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index 0303c27..8adde23 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -119,9 +119,8 @@ cmGlobalVisualStudio9Generator::CreateLocalGenerator(cmLocalGenerator* parent) { cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9, - parent); + this, parent); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); - lg->SetGlobalGenerator(this); return lg; } diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx index 77c6474..49c516f 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.cxx +++ b/Source/cmGlobalWatcomWMakeGenerator.cxx @@ -45,14 +45,13 @@ cmLocalGenerator * cmGlobalWatcomWMakeGenerator::CreateLocalGenerator(cmLocalGenerator* parent) { cmLocalUnixMakefileGenerator3* lg - = new cmLocalUnixMakefileGenerator3(parent); + = new cmLocalUnixMakefileGenerator3(this, parent); lg->SetDefineWindowsNULL(true); #ifdef _WIN32 lg->SetWindowsShell(true); #endif lg->SetWatcomWMake(true); lg->SetMakeSilentFlag("-h"); - lg->SetGlobalGenerator(this); lg->SetIgnoreLibPrefix(true); lg->SetPassMakeflags(false); lg->SetUnixCD(false); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 742750c..4a7411c 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -371,9 +371,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( cmLocalGenerator * cmGlobalXCodeGenerator::CreateLocalGenerator(cmLocalGenerator* parent) { - cmLocalGenerator *lg = new cmLocalXCodeGenerator(parent); - lg->SetGlobalGenerator(this); - return lg; + return new cmLocalXCodeGenerator(this, parent); } //---------------------------------------------------------------------------- diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 1c3114e..2f2da20 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -43,14 +43,17 @@ #include #endif -cmLocalGenerator::cmLocalGenerator(cmLocalGenerator* parent) +cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, + cmLocalGenerator* parent) { - this->Makefile = 0; // moved to after set on global + this->GlobalGenerator = gg; this->Parent = parent; if (parent) { parent->AddChild(this); } + this->Makefile = new cmMakefile(this); + this->WindowsShell = false; this->WindowsVSIDE = false; this->WatcomWMake = false; @@ -249,13 +252,6 @@ void cmLocalGenerator::SetupPathConversions() this->StartOutputDirectoryComponents); } - -void cmLocalGenerator::SetGlobalGenerator(cmGlobalGenerator *gg) -{ - this->GlobalGenerator = gg; - this->Makefile = new cmMakefile(this); -} - void cmLocalGenerator::ConfigureFinalPass() { this->Makefile->ConfigureFinalPass(); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index af333fd..44a2d99 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -33,7 +33,7 @@ class cmCustomCommandGenerator; class cmLocalGenerator { public: - cmLocalGenerator(cmLocalGenerator* parent); + cmLocalGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent); virtual ~cmLocalGenerator(); /** @@ -88,9 +88,6 @@ public: const cmGlobalGenerator *GetGlobalGenerator() const { return this->GlobalGenerator; } - ///! Set the Global Generator, done on creation by the GlobalGenerator - void SetGlobalGenerator(cmGlobalGenerator *gg); - /** * Convert something to something else. This is a centralized conversion * routine used by the generators to handle relative paths and the like. diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx index fa2a1a5..ddef3f5 100644 --- a/Source/cmLocalGhsMultiGenerator.cxx +++ b/Source/cmLocalGhsMultiGenerator.cxx @@ -16,8 +16,9 @@ #include "cmGhsMultiTargetGenerator.h" #include "cmGeneratedFileStream.h" -cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmLocalGenerator* parent) - : cmLocalGenerator(parent) +cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, + cmLocalGenerator* parent) + : cmLocalGenerator(gg, parent) { } diff --git a/Source/cmLocalGhsMultiGenerator.h b/Source/cmLocalGhsMultiGenerator.h index 7afef56..ec25cba 100644 --- a/Source/cmLocalGhsMultiGenerator.h +++ b/Source/cmLocalGhsMultiGenerator.h @@ -25,7 +25,7 @@ class cmGeneratedFileStream; class cmLocalGhsMultiGenerator : public cmLocalGenerator { public: - cmLocalGhsMultiGenerator(cmLocalGenerator* parent); + cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent); virtual ~cmLocalGhsMultiGenerator(); diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 4e817a0..ac10f09 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -22,8 +22,9 @@ #include -cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmLocalGenerator* parent) - : cmLocalGenerator(parent) +cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg, + cmLocalGenerator* parent) + : cmLocalGenerator(gg, parent) , ConfigName("") , HomeRelativeOutputPath("") { diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index d72677b..0b87426 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -32,7 +32,7 @@ class cmLocalNinjaGenerator : public cmLocalGenerator { public: /// Default constructor. - cmLocalNinjaGenerator(cmLocalGenerator* parent); + cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent); /// Destructor. virtual ~cmLocalNinjaGenerator(); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index faeb9db..a2a3725 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -80,8 +80,8 @@ static std::string cmSplitExtension(std::string const& in, std::string& base) //---------------------------------------------------------------------------- cmLocalUnixMakefileGenerator3:: -cmLocalUnixMakefileGenerator3(cmLocalGenerator* parent) - : cmLocalGenerator(parent) +cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmLocalGenerator* parent) + : cmLocalGenerator(gg, parent) { this->WindowsShell = false; this->IncludeDirective = "include"; diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index aee22ec..4e48ad7 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -34,7 +34,8 @@ class cmSourceFile; class cmLocalUnixMakefileGenerator3 : public cmLocalGenerator { public: - cmLocalUnixMakefileGenerator3(cmLocalGenerator* parent); + cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, + cmLocalGenerator* parent); virtual ~cmLocalUnixMakefileGenerator3(); /** diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index 73a4ec8..06a3b6c 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -62,8 +62,9 @@ class cmVS10XMLParser : public cmXMLParser //---------------------------------------------------------------------------- cmLocalVisualStudio10Generator -::cmLocalVisualStudio10Generator(VSVersion v, cmLocalGenerator* parent): - cmLocalVisualStudio7Generator(v, parent) +::cmLocalVisualStudio10Generator(VSVersion v, cmGlobalGenerator* gg, + cmLocalGenerator* parent): + cmLocalVisualStudio7Generator(v, gg, parent) { } diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h index f90daa0..987e08b 100644 --- a/Source/cmLocalVisualStudio10Generator.h +++ b/Source/cmLocalVisualStudio10Generator.h @@ -25,7 +25,8 @@ class cmLocalVisualStudio10Generator : public cmLocalVisualStudio7Generator { public: ///! Set cache only and recurse to false by default. - cmLocalVisualStudio10Generator(VSVersion v, cmLocalGenerator* parent); + cmLocalVisualStudio10Generator(VSVersion v, cmGlobalGenerator* gg, + cmLocalGenerator* parent); virtual ~cmLocalVisualStudio10Generator(); diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 6d89b15..42da639 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -24,8 +24,9 @@ #include cmLocalVisualStudio6Generator -::cmLocalVisualStudio6Generator(cmLocalGenerator* parent): - cmLocalVisualStudioGenerator(VS6, parent) +::cmLocalVisualStudio6Generator(cmGlobalGenerator* gg, + cmLocalGenerator* parent): + cmLocalVisualStudioGenerator(VS6, gg, parent) { } diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h index 1a0a614..a6e0b3d 100644 --- a/Source/cmLocalVisualStudio6Generator.h +++ b/Source/cmLocalVisualStudio6Generator.h @@ -29,7 +29,8 @@ class cmLocalVisualStudio6Generator : public cmLocalVisualStudioGenerator { public: ///! Set cache only and recurse to false by default. - cmLocalVisualStudio6Generator(cmLocalGenerator* parent); + cmLocalVisualStudio6Generator(cmGlobalGenerator* gg, + cmLocalGenerator* parent); virtual ~cmLocalVisualStudio6Generator(); diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 2152f77..63c18a7 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -55,8 +55,9 @@ static void cmConvertToWindowsSlash(std::string& s) //---------------------------------------------------------------------------- cmLocalVisualStudio7Generator -::cmLocalVisualStudio7Generator(VSVersion v, cmLocalGenerator* parent): - cmLocalVisualStudioGenerator(v, parent) +::cmLocalVisualStudio7Generator(VSVersion v, cmGlobalGenerator* gg, + cmLocalGenerator* parent): + cmLocalVisualStudioGenerator(v, gg, parent) { this->ExtraFlagTable = 0; this->Internal = new cmLocalVisualStudio7GeneratorInternals(this); diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index cfbc63c..1891369 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -35,7 +35,8 @@ class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator { public: ///! Set cache only and recurse to false by default. - cmLocalVisualStudio7Generator(VSVersion v, cmLocalGenerator* parent); + cmLocalVisualStudio7Generator(VSVersion v, cmGlobalGenerator* gg, + cmLocalGenerator* parent); virtual ~cmLocalVisualStudio7Generator(); diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 854ad34..f95d09b 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -19,8 +19,9 @@ //---------------------------------------------------------------------------- cmLocalVisualStudioGenerator -::cmLocalVisualStudioGenerator(VSVersion v, cmLocalGenerator* parent) - : cmLocalGenerator(parent) +::cmLocalVisualStudioGenerator(VSVersion v, cmGlobalGenerator* gg, + cmLocalGenerator* parent) + : cmLocalGenerator(gg, parent) { this->WindowsShell = true; this->WindowsVSIDE = true; diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index 562d595..1152e82 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -45,7 +45,8 @@ public: VS14 = 140 }; - cmLocalVisualStudioGenerator(VSVersion v, cmLocalGenerator* parent); + cmLocalVisualStudioGenerator(VSVersion v, cmGlobalGenerator* gg, + cmLocalGenerator* parent); virtual ~cmLocalVisualStudioGenerator(); /** Construct a script from the given list of command lines. */ diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx index 1d3a8cf..a957c27 100644 --- a/Source/cmLocalXCodeGenerator.cxx +++ b/Source/cmLocalXCodeGenerator.cxx @@ -15,8 +15,9 @@ #include "cmMakefile.h" //---------------------------------------------------------------------------- -cmLocalXCodeGenerator::cmLocalXCodeGenerator(cmLocalGenerator* parent) - : cmLocalGenerator(parent) +cmLocalXCodeGenerator::cmLocalXCodeGenerator(cmGlobalGenerator* gg, + cmLocalGenerator* parent) + : cmLocalGenerator(gg, parent) { // the global generator does this, so do not // put these flags into the language flags diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h index 1a5760f..54bc6df 100644 --- a/Source/cmLocalXCodeGenerator.h +++ b/Source/cmLocalXCodeGenerator.h @@ -24,7 +24,7 @@ class cmLocalXCodeGenerator : public cmLocalGenerator { public: ///! Set cache only and recurse to false by default. - cmLocalXCodeGenerator(cmLocalGenerator* parent); + cmLocalXCodeGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent); virtual ~cmLocalXCodeGenerator(); virtual std::string GetTargetDirectory(cmTarget const& target) const; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5acbe27cf51ba34d34322bd19ac0f32b7ef193d6 commit 5acbe27cf51ba34d34322bd19ac0f32b7ef193d6 Author: Stephen Kelly AuthorDate: Tue May 5 21:50:39 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 21:50:39 2015 +0200 Don't use a cmLocalGenerator instance to call static methods. diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 1109aca..dd276a8 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -242,8 +242,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) } // Detect languages to enable. - cmLocalGenerator* lg = this->Makefile->GetLocalGenerator(); - cmGlobalGenerator* gg = lg->GetGlobalGenerator(); + cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator(); std::set testLangs; for(std::vector::iterator si = sources.begin(); si != sources.end(); ++si) @@ -323,7 +322,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) std::string langFlags = "CMAKE_" + *li + "_FLAGS"; const char* flags = this->Makefile->GetDefinition(langFlags); fprintf(fout, "set(CMAKE_%s_FLAGS %s)\n", li->c_str(), - lg->EscapeForCMake(flags?flags:"").c_str()); + cmLocalGenerator::EscapeForCMake(flags?flags:"").c_str()); fprintf(fout, "set(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}" " ${COMPILE_DEFINITIONS}\")\n", li->c_str(), li->c_str()); } @@ -356,7 +355,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) const char* exeLinkFlags = this->Makefile->GetDefinition("CMAKE_EXE_LINKER_FLAGS"); fprintf(fout, "set(CMAKE_EXE_LINKER_FLAGS %s)\n", - lg->EscapeForCMake(exeLinkFlags?exeLinkFlags:"").c_str()); + cmLocalGenerator::EscapeForCMake( + exeLinkFlags ? exeLinkFlags : "").c_str()); } break; } fprintf(fout, "set(CMAKE_EXE_LINKER_FLAGS \"${CMAKE_EXE_LINKER_FLAGS}" diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index 6dea5c1..3551f83 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -20,15 +20,14 @@ static std::string cmIfCommandError( - cmMakefile* mf, std::vector const& args) + std::vector const& args) { - cmLocalGenerator* lg = mf->GetLocalGenerator(); std::string err = "given arguments:\n "; for(std::vector::const_iterator i = args.begin(); i != args.end(); ++i) { err += " "; - err += lg->EscapeForCMake(i->GetValue()); + err += cmLocalGenerator::EscapeForCMake(i->GetValue()); } err += "\n"; return err; @@ -118,7 +117,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, if (!errorString.empty()) { - std::string err = cmIfCommandError(&mf, expandedArguments); + std::string err = cmIfCommandError(expandedArguments); err += errorString; mf.IssueMessage(messType, err); if (messType == cmake::FATAL_ERROR) @@ -206,7 +205,7 @@ bool cmIfCommand if (!errorString.empty()) { - std::string err = cmIfCommandError(this->Makefile, expandedArguments); + std::string err = cmIfCommandError(expandedArguments); err += errorString; if (status == cmake::FATAL_ERROR) { diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index bf6fb61..faeb9db 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1261,7 +1261,7 @@ cmLocalUnixMakefileGenerator3 f != files.end(); ++f) { std::string fc = this->Convert(*f,START_OUTPUT,UNCHANGED); - fout << " " << this->EscapeForCMake(fc) << "\n"; + fout << " " << cmLocalGenerator::EscapeForCMake(fc) << "\n"; } fout << ")\n"; } @@ -2060,7 +2060,7 @@ void cmLocalUnixMakefileGenerator3 di != defines.end(); ++di) { cmakefileStream - << " " << this->EscapeForCMake(*di) << "\n"; + << " " << cmLocalGenerator::EscapeForCMake(*di) << "\n"; } cmakefileStream << " )\n"; @@ -2113,7 +2113,8 @@ void cmLocalUnixMakefileGenerator3 for(std::vector::const_iterator tri = transformRules.begin(); tri != transformRules.end(); ++tri) { - cmakefileStream << " " << this->EscapeForCMake(*tri) << "\n"; + cmakefileStream << " " + << cmLocalGenerator::EscapeForCMake(*tri) << "\n"; } cmakefileStream << " )\n"; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index a4dad1e..2ee23d1 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1118,8 +1118,8 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() pi != this->MultipleOutputPairs.end(); ++pi) { *this->InfoFileStream - << " " << this->LocalGenerator->EscapeForCMake(pi->first) - << " " << this->LocalGenerator->EscapeForCMake(pi->second) + << " " << cmLocalGenerator::EscapeForCMake(pi->first) + << " " << cmLocalGenerator::EscapeForCMake(pi->second) << "\n"; } *this->InfoFileStream << " )\n\n"; diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index add80fa..7e11d8c 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -82,7 +82,6 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, // be translated. std::string exe = command[0]; cmMakefile* mf = this->Test->GetMakefile(); - cmLocalGenerator* lg = mf->GetLocalGenerator(); cmTarget* target = mf->FindTargetToUse(exe); if(target && target->GetType() == cmTarget::EXECUTABLE) { @@ -98,13 +97,13 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, cmSystemTools::ExpandListArgument(emulator, emulatorWithArgs); std::string emulatorExe(emulatorWithArgs[0]); cmSystemTools::ConvertToUnixSlashes(emulatorExe); - os << lg->EscapeForCMake(emulatorExe) << " "; + os << cmLocalGenerator::EscapeForCMake(emulatorExe) << " "; for(std::vector::const_iterator ei = emulatorWithArgs.begin()+1; ei != emulatorWithArgs.end(); ++ei) { - os << lg->EscapeForCMake(*ei) << " "; + os << cmLocalGenerator::EscapeForCMake(*ei) << " "; } } } @@ -116,11 +115,12 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, } // Generate the command line with full escapes. - os << lg->EscapeForCMake(exe); + os << cmLocalGenerator::EscapeForCMake(exe); for(std::vector::const_iterator ci = command.begin()+1; ci != command.end(); ++ci) { - os << " " << lg->EscapeForCMake(ge.Parse(*ci)->Evaluate(mf, config)); + os << " " << cmLocalGenerator::EscapeForCMake( + ge.Parse(*ci)->Evaluate(mf, config)); } // Finish the test command. @@ -136,7 +136,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, i != pm.end(); ++i) { os << " " << i->first - << " " << lg->EscapeForCMake( + << " " << cmLocalGenerator::EscapeForCMake( ge.Parse(i->second.GetValue())->Evaluate(mf, config)); } os << ")" << std::endl; @@ -197,8 +197,6 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout, fout << ")" << std::endl; // Output properties for the test. - cmMakefile* mf = this->Test->GetMakefile(); - cmLocalGenerator* lg = mf->GetLocalGenerator(); cmPropertyMap& pm = this->Test->GetProperties(); if(!pm.empty()) { @@ -208,7 +206,7 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout, i != pm.end(); ++i) { fout << " " << i->first - << " " << lg->EscapeForCMake(i->second.GetValue()); + << " " << cmLocalGenerator::EscapeForCMake(i->second.GetValue()); } fout << ")" << std::endl; } http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ee05c3c80b3cd59f7aeb64aad492587a631d6447 commit ee05c3c80b3cd59f7aeb64aad492587a631d6447 Author: Stephen Kelly AuthorDate: Tue May 5 00:04:22 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 21:21:02 2015 +0200 cmLocalGenerator: Remove EscapeForShellOldStyle to only caller. diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index 162d7a1..d23f815 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -51,6 +51,35 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const } //---------------------------------------------------------------------------- +std::string escapeForShellOldStyle(const std::string& str) +{ + std::string result; +#if defined(_WIN32) && !defined(__CYGWIN__) + // if there are spaces + std::string temp = str; + if (temp.find(" ") != std::string::npos && + temp.find("\"")==std::string::npos) + { + result = "\""; + result += str; + result += "\""; + return result; + } + return str; +#else + for(const char* ch = str.c_str(); *ch != '\0'; ++ch) + { + if(*ch == ' ') + { + result += '\\'; + } + result += *ch; + } + return result; +#endif +} + +//---------------------------------------------------------------------------- void cmCustomCommandGenerator ::AppendArguments(unsigned int c, std::string& cmd) const @@ -63,7 +92,7 @@ cmCustomCommandGenerator cmd += " "; if(this->OldStyle) { - cmd += this->LG->EscapeForShellOldStyle(arg); + cmd += escapeForShellOldStyle(arg); } else { diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 88c88cd..1c3114e 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -3392,35 +3392,6 @@ cmLocalGenerator } //---------------------------------------------------------------------------- -std::string cmLocalGenerator::EscapeForShellOldStyle(const std::string& str) -{ - std::string result; -#if defined(_WIN32) && !defined(__CYGWIN__) - // if there are spaces - std::string temp = str; - if (temp.find(" ") != std::string::npos && - temp.find("\"")==std::string::npos) - { - result = "\""; - result += str; - result += "\""; - return result; - } - return str; -#else - for(const char* ch = str.c_str(); *ch != '\0'; ++ch) - { - if(*ch == ' ') - { - result += '\\'; - } - result += *ch; - } - return result; -#endif -} - -//---------------------------------------------------------------------------- static bool cmLocalGeneratorIsShellOperator(const std::string& str) { static std::set shellOperators; diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 49ac9a6..af333fd 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -298,9 +298,6 @@ public: bool forEcho = false, bool useWatcomQuote = false); - /** Backwards-compatibility version of EscapeForShell. */ - std::string EscapeForShellOldStyle(const std::string& str); - /** Escape the given string as an argument in a CMake script. */ static std::string EscapeForCMake(const std::string& str); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f9d2545cf0853fe05e2351d80c3b580cf8b3df77 commit f9d2545cf0853fe05e2351d80c3b580cf8b3df77 Author: Stephen Kelly AuthorDate: Mon May 4 22:50:54 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 21:20:59 2015 +0200 cmLocalGenerator: Remove unused members. diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index befddbf..49ac9a6 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -449,9 +449,6 @@ protected: cmMakefile *Makefile; cmGlobalGenerator *GlobalGenerator; - // members used for relative path function ConvertToMakefilePath - std::string RelativePathToSourceDir; - std::string RelativePathToBinaryDir; std::vector HomeDirectoryComponents; std::vector StartDirectoryComponents; std::vector HomeOutputDirectoryComponents; @@ -466,7 +463,6 @@ protected: bool WatcomWMake; bool MinGWMake; bool NMake; - bool ForceUnixPath; bool MSYSShell; bool LinkScriptShell; bool UseRelativePaths; ----------------------------------------------------------------------- Summary of changes: Source/CPack/cpack.cxx | 2 + Source/CTest/cmCTestScriptHandler.cxx | 2 + Source/cmCoreTryCompile.cxx | 8 +- Source/cmCustomCommandGenerator.cxx | 31 ++- Source/cmGlobalBorlandMakefileGenerator.cxx | 5 +- Source/cmGlobalGenerator.cxx | 11 +- Source/cmGlobalGenerator.h | 7 + Source/cmGlobalGhsMultiGenerator.cxx | 3 +- Source/cmGlobalJOMMakefileGenerator.cxx | 5 +- Source/cmGlobalMSYSMakefileGenerator.cxx | 6 +- Source/cmGlobalMinGWMakefileGenerator.cxx | 7 +- Source/cmGlobalNMakeMakefileGenerator.cxx | 7 +- Source/cmGlobalNinjaGenerator.cxx | 7 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 4 +- Source/cmGlobalVisualStudio10Generator.cxx | 7 +- Source/cmGlobalVisualStudio11Generator.cxx | 7 +- Source/cmGlobalVisualStudio12Generator.cxx | 7 +- Source/cmGlobalVisualStudio14Generator.cxx | 7 +- Source/cmGlobalVisualStudio6Generator.cxx | 4 +- Source/cmGlobalVisualStudio71Generator.cxx | 3 +- Source/cmGlobalVisualStudio7Generator.cxx | 3 +- Source/cmGlobalVisualStudio8Generator.cxx | 3 +- Source/cmGlobalVisualStudio9Generator.cxx | 3 +- Source/cmGlobalVisualStudioGenerator.cxx | 2 + Source/cmGlobalWatcomWMakeGenerator.cxx | 11 +- Source/cmGlobalXCodeGenerator.cxx | 4 +- Source/cmIfCommand.cxx | 9 +- Source/cmLocalGenerator.cxx | 289 +++++++++------------------ Source/cmLocalGenerator.h | 47 ++--- Source/cmLocalGhsMultiGenerator.cxx | 5 +- Source/cmLocalGhsMultiGenerator.h | 2 +- Source/cmLocalNinjaGenerator.cxx | 8 +- Source/cmLocalNinjaGenerator.h | 2 +- Source/cmLocalUnixMakefileGenerator3.cxx | 44 ++-- Source/cmLocalUnixMakefileGenerator3.h | 33 +-- Source/cmLocalVisualStudio10Generator.cxx | 5 +- Source/cmLocalVisualStudio10Generator.h | 3 +- Source/cmLocalVisualStudio6Generator.cxx | 5 +- Source/cmLocalVisualStudio6Generator.h | 3 +- Source/cmLocalVisualStudio7Generator.cxx | 5 +- Source/cmLocalVisualStudio7Generator.h | 3 +- Source/cmLocalVisualStudioGenerator.cxx | 7 +- Source/cmLocalVisualStudioGenerator.h | 3 +- Source/cmLocalXCodeGenerator.cxx | 5 +- Source/cmLocalXCodeGenerator.h | 2 +- Source/cmMakefile.cxx | 16 +- Source/cmMakefileTargetGenerator.cxx | 4 +- Source/cmState.cxx | 167 ++++++++++++++++ Source/cmState.h | 31 +++ Source/cmTestGenerator.cxx | 16 +- Source/cmake.cxx | 3 + 51 files changed, 467 insertions(+), 416 deletions(-) hooks/post-receive -- CMake From steveire at gmail.com Tue May 5 16:11:42 2015 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 5 May 2015 16:11:42 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2537-g732ff02 Message-ID: <20150505201142.3455AAB76C@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, next has been updated via 732ff0246956634b57c230beb89e24a3e5772de5 (commit) via 9f6f51794a94e8f3923f0a29c334f051c65aa7d3 (commit) from 057f51af9a2dbdd015f6c69bbfe72c7a1353730a (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=732ff0246956634b57c230beb89e24a3e5772de5 commit 732ff0246956634b57c230beb89e24a3e5772de5 Merge: 057f51a 9f6f517 Author: Stephen Kelly AuthorDate: Tue May 5 16:11:41 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue May 5 16:11:41 2015 -0400 Merge topic 'improve-policies-documentation' into next 9f6f5179 fixup! Help: Extract Policy doc subtitles from cmPolicies.h http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9f6f51794a94e8f3923f0a29c334f051c65aa7d3 commit 9f6f51794a94e8f3923f0a29c334f051c65aa7d3 Author: Stephen Kelly AuthorDate: Tue May 5 22:11:01 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 22:11:01 2015 +0200 fixup! Help: Extract Policy doc subtitles from cmPolicies.h diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index 74ceaaa..ff54621 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -206,15 +206,16 @@ void cmRST::ProcessLine(std::string const& line) } else { - cmPolicies pols; - cmPolicies::PolicyID id; - bool b = pols.GetPolicyID(policy.c_str(), id); + bool b = cmPolicies::GetPolicyID(policy.c_str(), id); if (!b) { this->NormalLine(line); } - this->OutputLine(pols.GetPolicyDocTitle(id) + "\n", true); + else + { + this->OutputLine(cmPolicies::GetPolicyDocTitle(id) + "\n", true); + } } } else if(this->ParsedLiteralDirective.find(line)) ----------------------------------------------------------------------- Summary of changes: Source/cmRST.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From steveire at gmail.com Tue May 5 16:12:39 2015 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 5 May 2015 16:12:39 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2539-g98b925c Message-ID: <20150505201239.45161AD3E7@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, next has been updated via 98b925cbda5e331a3540d57eebe92cf17b7ff548 (commit) via a31a392f60a20b1d63e0a58e11915b5778179ccb (commit) from 732ff0246956634b57c230beb89e24a3e5772de5 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=98b925cbda5e331a3540d57eebe92cf17b7ff548 commit 98b925cbda5e331a3540d57eebe92cf17b7ff548 Merge: 732ff02 a31a392 Author: Stephen Kelly AuthorDate: Tue May 5 16:12:37 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue May 5 16:12:37 2015 -0400 Merge topic 'improve-policies-documentation' into next a31a392f Help: Extract Policy doc subtitles from cmPolicies.h http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a31a392f60a20b1d63e0a58e11915b5778179ccb commit a31a392f60a20b1d63e0a58e11915b5778179ccb Author: Stephen Kelly AuthorDate: Tue May 5 18:45:15 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 22:12:23 2015 +0200 Help: Extract Policy doc subtitles from cmPolicies.h Add a new cmake-policy directive and use it in each policy document. Add API to cmPolicies to access it, and teach cmRST to process the new directive. Extend the data table in cmPolicies to include an optional RST formatted string. The documentation used in the cmake-policies toctree must be unformatted so limited duplication (in one file, instead of spread among multiple files) seems to be the correct approach. Extend the create-policy-list.py script to extract the RST formatted text, and use it if present. diff --git a/Help/policy/CMP0000.rst b/Help/policy/CMP0000.rst index 9fbf842..e3c00e8a 100644 --- a/Help/policy/CMP0000.rst +++ b/Help/policy/CMP0000.rst @@ -1,7 +1,7 @@ CMP0000 ------- -A minimum required CMake version must be specified. +.. cmake-policy:: CMP0000 CMake requires that projects specify the version of CMake to which they have been written. This policy has been put in place so users diff --git a/Help/policy/CMP0001.rst b/Help/policy/CMP0001.rst index 344f1e2..34d2f7d 100644 --- a/Help/policy/CMP0001.rst +++ b/Help/policy/CMP0001.rst @@ -1,7 +1,7 @@ CMP0001 ------- -CMAKE_BACKWARDS_COMPATIBILITY should no longer be used. +.. cmake-policy:: CMP0001 The OLD behavior is to check CMAKE_BACKWARDS_COMPATIBILITY and present it to the user. The NEW behavior is to ignore diff --git a/Help/policy/CMP0002.rst b/Help/policy/CMP0002.rst index 2c15bd4..105d1ee 100644 --- a/Help/policy/CMP0002.rst +++ b/Help/policy/CMP0002.rst @@ -1,7 +1,7 @@ CMP0002 ------- -Logical target names must be globally unique. +.. cmake-policy:: CMP0002 Targets names created with add_executable, add_library, or add_custom_target are logical build target names. Logical target diff --git a/Help/policy/CMP0003.rst b/Help/policy/CMP0003.rst index 27b83f8..7c5007f 100644 --- a/Help/policy/CMP0003.rst +++ b/Help/policy/CMP0003.rst @@ -1,7 +1,7 @@ CMP0003 ------- -Libraries linked via full path no longer produce linker search paths. +.. cmake-policy:: CMP0003 This policy affects how libraries whose full paths are NOT known are found at link time, but was created due to a change in how CMake deals diff --git a/Help/policy/CMP0004.rst b/Help/policy/CMP0004.rst index 80045f5..b06e214 100644 --- a/Help/policy/CMP0004.rst +++ b/Help/policy/CMP0004.rst @@ -1,7 +1,7 @@ CMP0004 ------- -Libraries linked may not have leading or trailing whitespace. +.. cmake-policy:: CMP0004 CMake versions 2.4 and below silently removed leading and trailing whitespace from libraries linked with code like diff --git a/Help/policy/CMP0005.rst b/Help/policy/CMP0005.rst index c11a9e6..b86f550 100644 --- a/Help/policy/CMP0005.rst +++ b/Help/policy/CMP0005.rst @@ -1,7 +1,7 @@ CMP0005 ------- -Preprocessor definition values are now escaped automatically. +.. cmake-policy:: CMP0005 This policy determines whether or not CMake should generate escaped preprocessor definition values added via add_definitions. CMake diff --git a/Help/policy/CMP0006.rst b/Help/policy/CMP0006.rst index 8d1e5bd..abce5c5 100644 --- a/Help/policy/CMP0006.rst +++ b/Help/policy/CMP0006.rst @@ -1,7 +1,7 @@ CMP0006 ------- -Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION. +.. cmake-policy:: CMP0006 This policy determines whether the install(TARGETS) command must be given a BUNDLE DESTINATION when asked to install a target with the diff --git a/Help/policy/CMP0007.rst b/Help/policy/CMP0007.rst index f0d8c16..7cbc47d 100644 --- a/Help/policy/CMP0007.rst +++ b/Help/policy/CMP0007.rst @@ -1,7 +1,7 @@ CMP0007 ------- -list command no longer ignores empty elements. +.. cmake-policy:: CMP0007 This policy determines whether the list command will ignore empty elements in the list. CMake 2.4 and below list commands ignored all diff --git a/Help/policy/CMP0008.rst b/Help/policy/CMP0008.rst index b118ece..a02493e 100644 --- a/Help/policy/CMP0008.rst +++ b/Help/policy/CMP0008.rst @@ -1,7 +1,7 @@ CMP0008 ------- -Libraries linked by full-path must have a valid library file name. +.. cmake-policy:: CMP0008 In CMake 2.4 and below it is possible to write code like diff --git a/Help/policy/CMP0009.rst b/Help/policy/CMP0009.rst index 481af1a..f0a209e 100644 --- a/Help/policy/CMP0009.rst +++ b/Help/policy/CMP0009.rst @@ -1,7 +1,7 @@ CMP0009 ------- -FILE GLOB_RECURSE calls should not follow symlinks by default. +.. cmake-policy:: CMP0009 In CMake 2.6.1 and below, FILE GLOB_RECURSE calls would follow through symlinks, sometimes coming up with unexpectedly large result sets diff --git a/Help/policy/CMP0010.rst b/Help/policy/CMP0010.rst index 9d2eb76..1cf549b 100644 --- a/Help/policy/CMP0010.rst +++ b/Help/policy/CMP0010.rst @@ -1,7 +1,7 @@ CMP0010 ------- -Bad variable reference syntax is an error. +.. cmake-policy:: CMP0010 In CMake 2.6.2 and below, incorrect variable reference syntax such as a missing close-brace ("${FOO") was reported but did not stop diff --git a/Help/policy/CMP0011.rst b/Help/policy/CMP0011.rst index 0f41fff..1ca4ff1 100644 --- a/Help/policy/CMP0011.rst +++ b/Help/policy/CMP0011.rst @@ -1,7 +1,7 @@ CMP0011 ------- -Included scripts do automatic cmake_policy PUSH and POP. +.. cmake-policy:: CMP0011 In CMake 2.6.2 and below, CMake Policy settings in scripts loaded by the include() and find_package() commands would affect the includer. diff --git a/Help/policy/CMP0012.rst b/Help/policy/CMP0012.rst index 7a749bf..63d1a52 100644 --- a/Help/policy/CMP0012.rst +++ b/Help/policy/CMP0012.rst @@ -1,7 +1,7 @@ CMP0012 ------- -if() recognizes numbers and boolean constants. +.. cmake-policy:: CMP0012 In CMake versions 2.6.4 and lower the if() command implicitly dereferenced arguments corresponding to variables, even those named diff --git a/Help/policy/CMP0013.rst b/Help/policy/CMP0013.rst index e99997b..a6ec06a 100644 --- a/Help/policy/CMP0013.rst +++ b/Help/policy/CMP0013.rst @@ -1,7 +1,7 @@ CMP0013 ------- -Duplicate binary directories are not allowed. +.. cmake-policy:: CMP0013 CMake 2.6.3 and below silently permitted add_subdirectory() calls to create the same binary directory multiple times. During build system diff --git a/Help/policy/CMP0014.rst b/Help/policy/CMP0014.rst index 37178d1..8c34caa 100644 --- a/Help/policy/CMP0014.rst +++ b/Help/policy/CMP0014.rst @@ -1,7 +1,7 @@ CMP0014 ------- -Input directories must have CMakeLists.txt. +.. cmake-policy:: CMP0014 CMake versions before 2.8 silently ignored missing CMakeLists.txt files in directories referenced by add_subdirectory() or subdirs(), diff --git a/Help/policy/CMP0015.rst b/Help/policy/CMP0015.rst index 1b54979..5067e03 100644 --- a/Help/policy/CMP0015.rst +++ b/Help/policy/CMP0015.rst @@ -1,7 +1,7 @@ CMP0015 ------- -link_directories() treats paths relative to the source dir. +.. cmake-policy:: CMP0015 In CMake 2.8.0 and lower the link_directories() command passed relative paths unchanged to the linker. In CMake 2.8.1 and above the diff --git a/Help/policy/CMP0016.rst b/Help/policy/CMP0016.rst index 743b1a9..c818da3 100644 --- a/Help/policy/CMP0016.rst +++ b/Help/policy/CMP0016.rst @@ -1,7 +1,7 @@ CMP0016 ------- -target_link_libraries() reports error if its only argument is not a target. +.. cmake-policy:: CMP0016 In CMake 2.8.2 and lower the target_link_libraries() command silently ignored if it was called with only one argument, and this argument diff --git a/Help/policy/CMP0017.rst b/Help/policy/CMP0017.rst index f74e6f0..01b7d93 100644 --- a/Help/policy/CMP0017.rst +++ b/Help/policy/CMP0017.rst @@ -1,7 +1,7 @@ CMP0017 ------- -Prefer files from the CMake module directory when including from there. +.. cmake-policy:: CMP0017 Starting with CMake 2.8.4, if a cmake-module shipped with CMake (i.e. located in the CMake module directory) calls include() or diff --git a/Help/policy/CMP0018.rst b/Help/policy/CMP0018.rst index 0f68267..1ebea5e 100644 --- a/Help/policy/CMP0018.rst +++ b/Help/policy/CMP0018.rst @@ -1,7 +1,7 @@ CMP0018 ------- -Ignore CMAKE_SHARED_LIBRARY__FLAGS variable. +.. cmake-policy:: CMP0018 CMake 2.8.8 and lower compiled sources in SHARED and MODULE libraries using the value of the undocumented CMAKE_SHARED_LIBRARY__FLAGS diff --git a/Help/policy/CMP0019.rst b/Help/policy/CMP0019.rst index 2b37fa1..114c5fc 100644 --- a/Help/policy/CMP0019.rst +++ b/Help/policy/CMP0019.rst @@ -1,7 +1,7 @@ CMP0019 ------- -Do not re-expand variables in include and link information. +.. cmake-policy:: CMP0019 CMake 2.8.10 and lower re-evaluated values given to the include_directories, link_directories, and link_libraries commands to diff --git a/Help/policy/CMP0020.rst b/Help/policy/CMP0020.rst index 6767d08..4e4476c 100644 --- a/Help/policy/CMP0020.rst +++ b/Help/policy/CMP0020.rst @@ -1,7 +1,7 @@ CMP0020 ------- -Automatically link Qt executables to qtmain target on Windows. +.. cmake-policy:: CMP0020 CMake 2.8.10 and lower required users of Qt to always specify a link dependency to the qtmain.lib static library manually on Windows. diff --git a/Help/policy/CMP0021.rst b/Help/policy/CMP0021.rst index 3f5bd03..18f2b40 100644 --- a/Help/policy/CMP0021.rst +++ b/Help/policy/CMP0021.rst @@ -1,7 +1,7 @@ CMP0021 ------- -Fatal error on relative paths in INCLUDE_DIRECTORIES target property. +.. cmake-policy:: CMP0021 CMake 2.8.10.2 and lower allowed the INCLUDE_DIRECTORIES target property to contain relative paths. The base path for such relative diff --git a/Help/policy/CMP0022.rst b/Help/policy/CMP0022.rst index 22c7c4f..b8d6ecb 100644 --- a/Help/policy/CMP0022.rst +++ b/Help/policy/CMP0022.rst @@ -1,7 +1,7 @@ CMP0022 ------- -INTERFACE_LINK_LIBRARIES defines the link interface. +.. cmake-policy:: CMP0022 CMake 2.8.11 constructed the 'link interface' of a target from properties matching ``(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_)?``. diff --git a/Help/policy/CMP0023.rst b/Help/policy/CMP0023.rst index 962b624..5063787 100644 --- a/Help/policy/CMP0023.rst +++ b/Help/policy/CMP0023.rst @@ -1,7 +1,7 @@ CMP0023 ------- -Plain and keyword target_link_libraries signatures cannot be mixed. +.. cmake-policy:: CMP0023 CMake 2.8.12 introduced the target_link_libraries signature using the PUBLIC, PRIVATE, and INTERFACE keywords to generalize the LINK_PUBLIC diff --git a/Help/policy/CMP0024.rst b/Help/policy/CMP0024.rst index ee53d5f..b4c4c92 100644 --- a/Help/policy/CMP0024.rst +++ b/Help/policy/CMP0024.rst @@ -1,7 +1,7 @@ CMP0024 ------- -Disallow include export result. +.. cmake-policy:: CMP0024 CMake 2.8.12 and lower allowed use of the include() command with the result of the export() command. This relies on the assumption that diff --git a/Help/policy/CMP0025.rst b/Help/policy/CMP0025.rst index 8d19edf..bfc4687 100644 --- a/Help/policy/CMP0025.rst +++ b/Help/policy/CMP0025.rst @@ -1,7 +1,7 @@ CMP0025 ------- -Compiler id for Apple Clang is now ``AppleClang``. +.. cmake-policy:: CMP0025 CMake 3.0 and above recognize that Apple Clang is a different compiler than upstream Clang and that they have different version numbers. diff --git a/Help/policy/CMP0026.rst b/Help/policy/CMP0026.rst index 4889249..5b42a1e 100644 --- a/Help/policy/CMP0026.rst +++ b/Help/policy/CMP0026.rst @@ -1,7 +1,7 @@ CMP0026 ------- -Disallow use of the LOCATION property for build targets. +.. cmake-policy:: CMP0026 CMake 2.8.12 and lower allowed reading the LOCATION target property (and configuration-specific variants) to diff --git a/Help/policy/CMP0027.rst b/Help/policy/CMP0027.rst index bedaffe..f2af8ac 100644 --- a/Help/policy/CMP0027.rst +++ b/Help/policy/CMP0027.rst @@ -1,7 +1,7 @@ CMP0027 ------- -Conditionally linked imported targets with missing include directories. +.. cmake-policy:: CMP0027 CMake 2.8.11 introduced introduced the concept of INTERFACE_INCLUDE_DIRECTORIES, and a check at cmake time that the diff --git a/Help/policy/CMP0028.rst b/Help/policy/CMP0028.rst index 24889ec..db58231 100644 --- a/Help/policy/CMP0028.rst +++ b/Help/policy/CMP0028.rst @@ -1,7 +1,7 @@ CMP0028 ------- -Double colon in target name means ALIAS or IMPORTED target. +.. cmake-policy:: CMP0028 CMake 2.8.12 and lower allowed the use of targets and files with double colons in target_link_libraries, with some buildsystem generators. diff --git a/Help/policy/CMP0029.rst b/Help/policy/CMP0029.rst index 8f58a12..70a8909 100644 --- a/Help/policy/CMP0029.rst +++ b/Help/policy/CMP0029.rst @@ -1,7 +1,7 @@ CMP0029 ------- -The :command:`subdir_depends` command should not be called. +.. cmake-policy:: CMP0029 The implementation of this command has been empty since December 2001 but was kept in CMake for compatibility for a long time. diff --git a/Help/policy/CMP0030.rst b/Help/policy/CMP0030.rst index 9e31b38..98bc070 100644 --- a/Help/policy/CMP0030.rst +++ b/Help/policy/CMP0030.rst @@ -1,7 +1,7 @@ CMP0030 ------- -The :command:`use_mangled_mesa` command should not be called. +.. cmake-policy:: CMP0030 This command was created in September 2001 to support VTK before modern CMake language and custom command capabilities. VTK has diff --git a/Help/policy/CMP0031.rst b/Help/policy/CMP0031.rst index 6b89558..857eb16 100644 --- a/Help/policy/CMP0031.rst +++ b/Help/policy/CMP0031.rst @@ -1,7 +1,7 @@ CMP0031 ------- -The :command:`load_command` command should not be called. +.. cmake-policy:: CMP0031 This command was added in August 2002 to allow projects to add arbitrary commands implemented in C or C++. However, it does diff --git a/Help/policy/CMP0032.rst b/Help/policy/CMP0032.rst index f394a06..e4e59d5 100644 --- a/Help/policy/CMP0032.rst +++ b/Help/policy/CMP0032.rst @@ -1,7 +1,7 @@ CMP0032 ------- -The :command:`output_required_files` command should not be called. +.. cmake-policy:: CMP0032 This command was added in June 2001 to expose the then-current CMake implicit dependency scanner. CMake's real implicit dependency scanner diff --git a/Help/policy/CMP0033.rst b/Help/policy/CMP0033.rst index b420065..7709d81 100644 --- a/Help/policy/CMP0033.rst +++ b/Help/policy/CMP0033.rst @@ -1,7 +1,7 @@ CMP0033 ------- -The :command:`export_library_dependencies` command should not be called. +.. cmake-policy:: CMP0033 This command was added in January 2003 to export ``_LIB_DEPENDS`` internal CMake cache entries to a file for installation with a project. diff --git a/Help/policy/CMP0034.rst b/Help/policy/CMP0034.rst index 2133997..3755d08 100644 --- a/Help/policy/CMP0034.rst +++ b/Help/policy/CMP0034.rst @@ -1,7 +1,7 @@ CMP0034 ------- -The :command:`utility_source` command should not be called. +.. cmake-policy:: CMP0034 This command was introduced in March 2001 to help build executables used to generate other files. This approach has long been replaced by diff --git a/Help/policy/CMP0035.rst b/Help/policy/CMP0035.rst index 7335b22..75b8189 100644 --- a/Help/policy/CMP0035.rst +++ b/Help/policy/CMP0035.rst @@ -1,7 +1,7 @@ CMP0035 ------- -The :command:`variable_requires` command should not be called. +.. cmake-policy:: CMP0035 This command was introduced in November 2001 to perform some conditional logic. It has long been replaced by the :command:`if` command. diff --git a/Help/policy/CMP0036.rst b/Help/policy/CMP0036.rst index 817f156..be13726 100644 --- a/Help/policy/CMP0036.rst +++ b/Help/policy/CMP0036.rst @@ -1,7 +1,7 @@ CMP0036 ------- -The :command:`build_name` command should not be called. +.. cmake-policy:: CMP0036 This command was added in May 2001 to compute a name for the current operating system and compiler combination. The command has long been diff --git a/Help/policy/CMP0037.rst b/Help/policy/CMP0037.rst index 4d485bf..3107e50 100644 --- a/Help/policy/CMP0037.rst +++ b/Help/policy/CMP0037.rst @@ -1,7 +1,7 @@ CMP0037 ------- -Target names should not be reserved and should match a validity pattern. +.. cmake-policy:: CMP0037 CMake 2.8.12 and lower allowed creating targets using :command:`add_library`, :command:`add_executable` and :command:`add_custom_target` with unrestricted diff --git a/Help/policy/CMP0038.rst b/Help/policy/CMP0038.rst index df5af6a..b094db3 100644 --- a/Help/policy/CMP0038.rst +++ b/Help/policy/CMP0038.rst @@ -1,7 +1,7 @@ CMP0038 ------- -Targets may not link directly to themselves. +.. cmake-policy:: CMP0038 CMake 2.8.12 and lower allowed a build target to link to itself directly with a :command:`target_link_libraries` call. This is an indicator of a bug in diff --git a/Help/policy/CMP0039.rst b/Help/policy/CMP0039.rst index 58ccc41..4477d2a 100644 --- a/Help/policy/CMP0039.rst +++ b/Help/policy/CMP0039.rst @@ -1,7 +1,7 @@ CMP0039 ------- -Utility targets may not have link dependencies. +.. cmake-policy:: CMP0039 CMake 2.8.12 and lower allowed using utility targets in the left hand side position of the :command:`target_link_libraries` command. This is an indicator diff --git a/Help/policy/CMP0040.rst b/Help/policy/CMP0040.rst index 77a3c81..7e72ee2 100644 --- a/Help/policy/CMP0040.rst +++ b/Help/policy/CMP0040.rst @@ -1,7 +1,7 @@ CMP0040 ------- -The target in the TARGET signature of add_custom_command() must exist. +.. cmake-policy:: CMP0040 CMake 2.8.12 and lower silently ignored a custom command created with the TARGET signature of :command:`add_custom_command` diff --git a/Help/policy/CMP0041.rst b/Help/policy/CMP0041.rst index 5a47de0..975626d 100644 --- a/Help/policy/CMP0041.rst +++ b/Help/policy/CMP0041.rst @@ -1,7 +1,7 @@ CMP0041 ------- -Error on relative include with generator expression. +.. cmake-policy:: CMP0041 Diagnostics in CMake 2.8.12 and lower silently ignored an entry in the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of a target if it contained a generator diff --git a/Help/policy/CMP0042.rst b/Help/policy/CMP0042.rst index fce870c..c385e57 100644 --- a/Help/policy/CMP0042.rst +++ b/Help/policy/CMP0042.rst @@ -1,7 +1,7 @@ CMP0042 ------- -:prop_tgt:`MACOSX_RPATH` is enabled by default. +.. cmake-policy:: CMP0042 CMake 2.8.12 and newer has support for using ``@rpath`` in a target's install name. This was enabled by setting the target property diff --git a/Help/policy/CMP0043.rst b/Help/policy/CMP0043.rst index 629e502..93fd911 100644 --- a/Help/policy/CMP0043.rst +++ b/Help/policy/CMP0043.rst @@ -1,7 +1,7 @@ CMP0043 ------- -Ignore COMPILE_DEFINITIONS_ properties +.. cmake-policy:: CMP0043 CMake 2.8.12 and lower allowed setting the :prop_tgt:`COMPILE_DEFINITIONS_` target property and diff --git a/Help/policy/CMP0044.rst b/Help/policy/CMP0044.rst index 4a3e215..a980c90 100644 --- a/Help/policy/CMP0044.rst +++ b/Help/policy/CMP0044.rst @@ -1,7 +1,7 @@ CMP0044 ------- -Case sensitive ``_COMPILER_ID`` generator expressions +.. cmake-policy:: CMP0044 CMake 2.8.12 introduced the ``_COMPILER_ID`` :manual:`generator expressions ` to allow diff --git a/Help/policy/CMP0045.rst b/Help/policy/CMP0045.rst index 58c422f..a7eac7b 100644 --- a/Help/policy/CMP0045.rst +++ b/Help/policy/CMP0045.rst @@ -1,7 +1,7 @@ CMP0045 ------- -Error on non-existent target in get_target_property. +.. cmake-policy:: CMP0045 In CMake 2.8.12 and lower, the :command:`get_target_property` command accepted a non-existent target argument without issuing any error or warning. The diff --git a/Help/policy/CMP0046.rst b/Help/policy/CMP0046.rst index 1a3bc65..e03b632 100644 --- a/Help/policy/CMP0046.rst +++ b/Help/policy/CMP0046.rst @@ -1,7 +1,7 @@ CMP0046 ------- -Error on non-existent dependency in add_dependencies. +.. cmake-policy:: CMP0046 CMake 2.8.12 and lower silently ignored non-existent dependencies listed in the :command:`add_dependencies` command. diff --git a/Help/policy/CMP0047.rst b/Help/policy/CMP0047.rst index 26ae439..86e6a89 100644 --- a/Help/policy/CMP0047.rst +++ b/Help/policy/CMP0047.rst @@ -1,7 +1,7 @@ CMP0047 ------- -Use ``QCC`` compiler id for the qcc drivers on QNX. +.. cmake-policy:: CMP0047 CMake 3.0 and above recognize that the QNX qcc compiler driver is different from the GNU compiler. diff --git a/Help/policy/CMP0048.rst b/Help/policy/CMP0048.rst index a54205e..25e23bd 100644 --- a/Help/policy/CMP0048.rst +++ b/Help/policy/CMP0048.rst @@ -1,7 +1,7 @@ CMP0048 ------- -The :command:`project` command manages VERSION variables. +.. cmake-policy:: CMP0048 CMake version 3.0 introduced the ``VERSION`` option of the :command:`project` command to specify a project version as well as the name. In order to keep diff --git a/Help/policy/CMP0049.rst b/Help/policy/CMP0049.rst index 5c8d4a8..b95d811 100644 --- a/Help/policy/CMP0049.rst +++ b/Help/policy/CMP0049.rst @@ -1,7 +1,7 @@ CMP0049 ------- -Do not expand variables in target source entries. +.. cmake-policy:: CMP0049 CMake 2.8.12 and lower performed and extra layer of variable expansion when evaluating source file names: diff --git a/Help/policy/CMP0050.rst b/Help/policy/CMP0050.rst index 76ae0aa..e4c6735 100644 --- a/Help/policy/CMP0050.rst +++ b/Help/policy/CMP0050.rst @@ -1,7 +1,7 @@ CMP0050 ------- -Disallow add_custom_command SOURCE signatures. +.. cmake-policy:: CMP0050 CMake 2.8.12 and lower allowed a signature for :command:`add_custom_command` which specified an input to a command. This was undocumented behavior. diff --git a/Help/policy/CMP0051.rst b/Help/policy/CMP0051.rst index 1b56cb0..19e1b37 100644 --- a/Help/policy/CMP0051.rst +++ b/Help/policy/CMP0051.rst @@ -1,7 +1,7 @@ CMP0051 ------- -List TARGET_OBJECTS in SOURCES target property. +.. cmake-policy:: CMP0051 CMake 3.0 and lower did not include the ``TARGET_OBJECTS`` :manual:`generator expression ` when diff --git a/Help/policy/CMP0052.rst b/Help/policy/CMP0052.rst index 48cfc9c..5a86f8a 100644 --- a/Help/policy/CMP0052.rst +++ b/Help/policy/CMP0052.rst @@ -1,7 +1,7 @@ CMP0052 ------- -Reject source and build dirs in installed INTERFACE_INCLUDE_DIRECTORIES. +.. cmake-policy:: CMP0052 CMake 3.0 and lower allowed subdirectories of the source directory or build directory to be in the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of diff --git a/Help/policy/CMP0053.rst b/Help/policy/CMP0053.rst index bb0ff8b..5d1bb34 100644 --- a/Help/policy/CMP0053.rst +++ b/Help/policy/CMP0053.rst @@ -1,7 +1,7 @@ CMP0053 ------- -Simplify variable reference and escape sequence evaluation. +.. cmake-policy:: CMP0053 CMake 3.1 introduced a much faster implementation of evaluation of the :ref:`Variable References` and :ref:`Escape Sequences` documented in the diff --git a/Help/policy/CMP0054.rst b/Help/policy/CMP0054.rst index 3754fda..6e72b1c 100644 --- a/Help/policy/CMP0054.rst +++ b/Help/policy/CMP0054.rst @@ -1,7 +1,7 @@ CMP0054 ------- -Only interpret :command:`if` arguments as variables or keywords when unquoted. +.. cmake-policy:: CMP0054 CMake 3.1 and above no longer implicitly dereference variables or interpret keywords in an :command:`if` command argument when diff --git a/Help/policy/CMP0055.rst b/Help/policy/CMP0055.rst index fe7ab6f..a64f85b 100644 --- a/Help/policy/CMP0055.rst +++ b/Help/policy/CMP0055.rst @@ -1,7 +1,7 @@ CMP0055 ------- -Strict checking for the :command:`break` command. +.. cmake-policy:: CMP0055 CMake 3.1 and lower allowed calls to the :command:`break` command outside of a loop context and also ignored any given arguments. diff --git a/Help/policy/CMP0056.rst b/Help/policy/CMP0056.rst index 3c75ff4..3fa0889 100644 --- a/Help/policy/CMP0056.rst +++ b/Help/policy/CMP0056.rst @@ -1,7 +1,7 @@ CMP0056 ------- -Honor link flags in :command:`try_compile` source-file signature. +.. cmake-policy:: CMP0056 The :command:`try_compile` command source-file signature generates a ``CMakeLists.txt`` file to build the source file into an executable. diff --git a/Help/policy/CMP0057.rst b/Help/policy/CMP0057.rst index 1298a16..ef18ac4 100644 --- a/Help/policy/CMP0057.rst +++ b/Help/policy/CMP0057.rst @@ -1,7 +1,7 @@ CMP0057 ------- -Support new :command:`if` IN_LIST operator. +.. cmake-policy:: CMP0057 CMake 3.3 adds support for the new IN_LIST operator. diff --git a/Help/policy/CMP0058.rst b/Help/policy/CMP0058.rst index 0f20383..1d0c0a9 100644 --- a/Help/policy/CMP0058.rst +++ b/Help/policy/CMP0058.rst @@ -1,7 +1,7 @@ CMP0058 ------- -Ninja requires custom command byproducts to be explicit. +.. cmake-policy:: CMP0058 When an intermediate file generated during the build is consumed by an expensive operation or a large tree of dependents, one may diff --git a/Help/policy/CMP0059.rst b/Help/policy/CMP0059.rst index e40f450..cc717a5 100644 --- a/Help/policy/CMP0059.rst +++ b/Help/policy/CMP0059.rst @@ -1,7 +1,7 @@ CMP0059 ------- -Don't treat ``DEFINITIONS`` as a built-in directory property. +.. cmake-policy:: CMP0059 CMake 3.3 and above no longer make a list of definitions available through the :prop_dir:`DEFINITIONS` directory property. The diff --git a/Help/policy/CMP0060.rst b/Help/policy/CMP0060.rst index cc37b1b..b249f84 100644 --- a/Help/policy/CMP0060.rst +++ b/Help/policy/CMP0060.rst @@ -1,7 +1,7 @@ CMP0060 ------- -Link libraries by full path even in implicit directories. +.. cmake-policy:: CMP0060 Policy :policy:`CMP0003` was introduced with the intention of always linking library files by full path when a full path is given to the diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index f8d61db..599c174 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -45,14 +45,18 @@ static bool stringToId(const char* input, cmPolicies::PolicyID& pid) return true; } -#define CM_SELECT_ID_VERSION(F, A1, A2, A3, A4, A5, A6) F(A1, A3, A4, A5) +#define CM_SELECT_ID_VERSION(F, A1, A2, A3, A4, A5, A6, A7) F(A1, A4, A5, A6) #define CM_FOR_EACH_POLICY_ID_VERSION(POLICY) \ CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID_VERSION) -#define CM_SELECT_ID_DOC(F, A1, A2, A3, A4, A5, A6) F(A1, A2) +#define CM_SELECT_ID_DOC(F, A1, A2, A3, A4, A5, A6, A7) F(A1, A2) #define CM_FOR_EACH_POLICY_ID_DOC(POLICY) \ CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID_DOC) +#define CM_SELECT_ID_RST(F, A1, A2, A3, A4, A5, A6, A7) F(A1, A3) +#define CM_FOR_EACH_POLICY_ID_RST(POLICY) \ + CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID_RST) + static const char* idToString(cmPolicies::PolicyID id) { switch(id) @@ -343,6 +347,21 @@ cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id) return e.str(); } +std::string cmPolicies::GetPolicyDocTitle(cmPolicies::PolicyID id) +{ + switch(id) + { +#define POLICY_CASE(ID, DOC_TITLE) \ + case cmPolicies::ID: \ + return DOC_TITLE; + CM_FOR_EACH_POLICY_ID_RST(POLICY_CASE) +#undef POLICY_CASE + case cmPolicies::CMPCOUNT: + return 0; + } + return 0; +} + cmPolicies::PolicyMap::PolicyMap() { this->UNDEFINED.set(); diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 63376dd..226b43d 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -21,196 +21,260 @@ class cmPolicy; #define CM_FOR_EACH_POLICY_TABLE(POLICY, SELECT) \ SELECT(POLICY, CMP0000, \ - "A minimum required CMake version must be specified.", \ + "A minimum required CMake version must be specified.", 0, \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0001, \ "CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.", \ + ":variable:`CMAKE_BACKWARDS_COMPATIBILITY` should no longer be used.", \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0002, \ - "Logical target names must be globally unique.", \ + "Logical target names must be globally unique.", 0, \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0003, \ "Libraries linked via full path no longer produce linker search paths.", \ + 0, \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0004, \ - "Libraries linked may not have leading or trailing whitespace.", \ + "Libraries linked may not have leading or trailing whitespace.", 0, \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0005, \ - "Preprocessor definition values are now escaped automatically.", \ + "Preprocessor definition values are now escaped automatically.", 0, \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0006, \ "Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.", \ + "Installing :prop_tgt:`MACOSX_BUNDLE` targets requires a " \ + ":command:`BUNDLE DESTINATION `.", \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0007, \ "list command no longer ignores empty elements.", \ + ":command:`list()` command no longer ignores empty elements.", \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0008, \ - "Libraries linked by full-path must have a valid library file name.", \ + "Libraries linked by full-path must have a valid library file name.", 0, \ 2, 6, 1, cmPolicies::WARN) \ SELECT(POLICY, CMP0009, \ "FILE GLOB_RECURSE calls should not follow symlinks by default.", \ + ":command:`file(GLOB_RECURSE)` calls should not follow symlinks by " \ + "default.", \ 2, 6, 2, cmPolicies::WARN) \ SELECT(POLICY, CMP0010, \ - "Bad variable reference syntax is an error.", \ + "Bad variable reference syntax is an error.", 0, \ 2, 6, 3, cmPolicies::WARN) \ SELECT(POLICY, CMP0011, \ "Included scripts do automatic cmake_policy PUSH and POP.", \ + ":command:`Included ` scripts do automatic " \ + ":command:`cmake_policy` ``PUSH`` and ``POP``.", \ 2, 6, 3, cmPolicies::WARN) \ SELECT(POLICY, CMP0012, \ "if() recognizes numbers and boolean constants.", \ + ":command:`if()` recognizes numbers and boolean constants.", \ 2, 8, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0013, \ - "Duplicate binary directories are not allowed.", \ + "Duplicate binary directories are not allowed.", 0, \ 2, 8, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0014, \ - "Input directories must have CMakeLists.txt.", \ + "Input directories must have CMakeLists.txt.", 0, \ 2, 8, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0015, \ "link_directories() treats paths relative to the source dir.", \ + ":command:`link_directories()` treats paths relative to the " \ + ":variable:`CMAKE_CURRENT_SOURCE_DIR`.", \ 2, 8, 1, cmPolicies::WARN) \ SELECT(POLICY, CMP0016, \ "target_link_libraries() reports error if its only argument " \ "is not a target.", \ + ":command:`target_link_libraries()` reports error if its only argument " \ + "is not a target.", \ 2, 8, 3, cmPolicies::WARN) \ SELECT(POLICY, CMP0017, \ "Prefer files from the CMake module directory when including from " \ - "there.", \ + "there.", 0, \ 2, 8, 4, cmPolicies::WARN) \ SELECT(POLICY, CMP0018, \ - "Ignore CMAKE_SHARED_LIBRARY__FLAGS variable.", \ + "Ignore CMAKE_SHARED_LIBRARY__FLAGS variable.", 0, \ 2, 8, 9, cmPolicies::WARN) \ SELECT(POLICY, CMP0019, \ - "Do not re-expand variables in include and link information.", \ + "Do not re-expand variables in include and link information.", 0, \ 2, 8, 11, cmPolicies::WARN) \ SELECT(POLICY, CMP0020, \ "Automatically link Qt executables to qtmain target on Windows.", \ + "Automatically link :manual:`Qt executables ` to qtmain " \ + "target on Windows.", \ 2, 8, 11, cmPolicies::WARN) \ SELECT(POLICY, CMP0021, \ "Fatal error on relative paths in INCLUDE_DIRECTORIES target property.", \ + "Fatal error on relative paths in :prop_tgt:`INCLUDE_DIRECTORIES` " \ + "target property.", \ 2, 8, 12, cmPolicies::WARN) \ SELECT(POLICY, CMP0022, \ "INTERFACE_LINK_LIBRARIES defines the link interface.", \ + ":prop_tgt:`INTERFACE_LINK_LIBRARIES` defines the link interface.", \ 2, 8, 12, cmPolicies::WARN) \ SELECT(POLICY, CMP0023, \ "Plain and keyword target_link_libraries signatures cannot be mixed.", \ + "Plain and keyword :command:`target_link_libraries()` signatures cannot " \ + "be mixed.", \ 2, 8, 12, cmPolicies::WARN) \ SELECT(POLICY, CMP0024, \ - "Disallow include export result.", \ + "Disallow include() of export() result.", \ + "Disallow :command:`include()` of :command:`export()` result.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0025, \ "Compiler id for Apple Clang is now AppleClang.", \ + ":variable:`Compiler id _COMPILER_ID>` for Apple Clang is " \ + "now ``AppleClang``.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0026, \ "Disallow use of the LOCATION target property.", \ + "Disallow use of the :prop_tgt:`LOCATION` target property.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0027, \ - "Conditionally linked imported targets with missing include " \ + "Conditionally linked IMPORTED targets with missing include " \ + "directories.", \ + "Conditionally linked :prop_tgt:`IMPORTED` targets with missing include " \ "directories.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0028, \ "Double colon in target name means ALIAS or IMPORTED target.", \ + "Double colon in target name means :ref:`ALIAS ` or " \ + ":ref:`IMPORTED ` target.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0029, \ "The subdir_depends command should not be called.", \ + "The :command:`subdir_depends()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0030, \ "The use_mangled_mesa command should not be called.", \ + "The :command:`use_mangled_mesa()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0031, \ "The load_command command should not be called.", \ + "The :command:`load_command()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0032, \ "The output_required_files command should not be called.", \ + "The :command:`output_required_files()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0033, \ "The export_library_dependencies command should not be called.", \ + "The :command:`export_library_dependencies()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0034, \ "The utility_source command should not be called.", \ + "The :command:`utility_source()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0035, \ "The variable_requires command should not be called.", \ + "The :command:`variable_requires()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0036, \ "The build_name command should not be called.", \ + "The :command:`build_name()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0037, \ "Target names should not be reserved and should match a validity " \ "pattern.", \ + "Target :prop_tgt:`names ` should not be reserved and should " \ + "match a validity pattern.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0038, \ - "Targets may not link directly to themselves.", \ + "Targets may not link directly to themselves.", 0, \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0039, \ - "Utility targets may not have link dependencies.", \ + "Utility targets may not have link dependencies.", 0, \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0040, \ "The target in the TARGET signature of add_custom_command() must " \ "exist.", \ + "The target in the ``TARGET`` signature of " \ + ":command:`add_custom_command()` must exist.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0041, \ "Error on relative include with generator expression.", \ + "Error on relative include with " \ + ":manual:`generator expression `.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0042, \ "MACOSX_RPATH is enabled by default.", \ + ":prop_tgt:`MACOSX_RPATH` is enabled by default.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0043, \ "Ignore COMPILE_DEFINITIONS_ properties.", \ + "Ignore ``COMPILE_DEFINITIONS_`` properties.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0044, \ "Case sensitive _COMPILER_ID generator expressions.", \ + "Case sensitive ``_COMPILER_ID`` " \ + ":manual:`generator expression `", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0045, \ "Error on non-existent target in get_target_property.", \ + "Error on non-existent target in :command:`get_target_property()`.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0046, \ "Error on non-existent dependency in add_dependencies.", \ + "Error on non-existent dependency in :command:`add_dependencies()`.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0047, \ "Use QCC compiler id for the qcc drivers on QNX.", \ + "Use ``QCC`` :variable:`compiler id _COMPILER_ID>` for " \ + "the qcc drivers on QNX.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0048, \ "project() command manages VERSION variables.", \ + ":command:`project()` command manages ``VERSION`` variables.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0049, \ - "Do not expand variables in target source entries.", \ + "Do not expand variables in target source entries.", 0, \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0050, \ "Disallow add_custom_command SOURCE signatures.", \ + "Disallow :command:`add_custom_command(SOURCE)` signatures.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0051, \ "List TARGET_OBJECTS in SOURCES target property.", \ + "List :manual:`TARGET_OBJECTS ` " \ + "in :prop_tgt:`SOURCES` target property.", \ 3, 1, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0052, \ "Reject source and build dirs in installed " \ "INTERFACE_INCLUDE_DIRECTORIES.", \ + "Reject source and build dirs in installed " \ + ":prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES`.", \ 3, 1, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0053, \ - "Simplify variable reference and escape sequence evaluation.", \ + "Simplify variable reference and escape sequence evaluation.", 0, \ 3, 1, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0054, \ "Only interpret if() arguments as variables or keywords when unquoted.", \ + "Only interpret :command:`if()` arguments as variables or keywords " \ + "when unquoted.", \ 3, 1, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0055, \ "Strict checking for break() command.", \ + "Strict checking for :command:`break()` command.", \ 3, 2, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0056, \ "Honor link flags in try_compile() source-file signature.", \ + "Honor link flags in :command:`try_compile()` source-file signature.", \ 3, 2, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0057, \ "Support new IN_LIST if() operator.", \ + "Support new ``IN_LIST`` :command:`if()` operator.", \ 3, 3, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0058, \ - "Ninja requires custom command byproducts to be explicit.", \ + "Ninja requires custom command byproducts to be explicit.", 0, \ 3, 3, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0059, \ - "Do no treat DEFINITIONS as a built-in directory property.", \ + "Do not treat DEFINITIONS as a built-in directory property.", \ + "Do not treat :prop_dir:`DEFINITIONS` as a built-in directory " \ + "property.", \ 3, 3, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0060, \ - "Link libraries by full path even in implicit directories.", \ + "Link libraries by full path even in implicit directories.", 0, \ 3, 3, 0, cmPolicies::WARN) -#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) +#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6, A7) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID) @@ -269,6 +333,8 @@ public: ///! return an error string for when a required policy is unspecified static std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id); + static std::string GetPolicyDocTitle(cmPolicies::PolicyID id); + /** Represent a set of policy values. */ struct PolicyMap { diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index cb61ed9..ff54621 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -14,6 +14,7 @@ #include "cmSystemTools.h" #include "cmAlgorithms.h" #include "cmVersion.h" +#include "cmPolicies.h" #include #include @@ -30,6 +31,7 @@ cmRST::cmRST(std::ostream& os, std::string const& docroot): "command|variable" ")::[ \t]+([^ \t\n]+)$"), CMakeModuleDirective("^.. cmake-module::[ \t]+([^ \t\n]+)$"), + CMakePolicyDirective("^.. cmake-policy::[ \t]+(.+)$"), ParsedLiteralDirective("^.. parsed-literal::[ \t]*(.*)$"), CodeBlockDirective("^.. code-block::[ \t]*(.*)$"), ReplaceDirective("^.. (\\|[^|]+\\|) replace::[ \t]*(.*)$"), @@ -195,6 +197,27 @@ void cmRST::ProcessLine(std::string const& line) this->NormalLine(line); } } + else if(this->CMakePolicyDirective.find(line)) + { + std::string policy = this->CMakePolicyDirective.match(1); + if(policy.empty()) + { + this->NormalLine(line); + } + else + { + cmPolicies::PolicyID id; + bool b = cmPolicies::GetPolicyID(policy.c_str(), id); + if (!b) + { + this->NormalLine(line); + } + else + { + this->OutputLine(cmPolicies::GetPolicyDocTitle(id) + "\n", true); + } + } + } else if(this->ParsedLiteralDirective.find(line)) { // Record the literal lines to output after whole block. diff --git a/Source/cmRST.h b/Source/cmRST.h index b9b2366..52c9f2e 100644 --- a/Source/cmRST.h +++ b/Source/cmRST.h @@ -79,6 +79,7 @@ private: DirectiveType Directive; cmsys::RegularExpression CMakeDirective; cmsys::RegularExpression CMakeModuleDirective; + cmsys::RegularExpression CMakePolicyDirective; cmsys::RegularExpression ParsedLiteralDirective; cmsys::RegularExpression CodeBlockDirective; cmsys::RegularExpression ReplaceDirective; diff --git a/Tests/RunCMake/CMP0027/CMP0027-WARN-stderr.txt b/Tests/RunCMake/CMP0027/CMP0027-WARN-stderr.txt index 9bcec3c..984d9c1 100644 --- a/Tests/RunCMake/CMP0027/CMP0027-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0027/CMP0027-WARN-stderr.txt @@ -1,5 +1,5 @@ CMake Warning \(dev\) in CMakeLists.txt: - Policy CMP0027 is not set: Conditionally linked imported targets with + Policy CMP0027 is not set: Conditionally linked IMPORTED targets with missing include directories. Run "cmake --help-policy CMP0027" for policy details. Use the cmake_policy command to set the policy and suppress this warning. diff --git a/Tests/RunCMake/CMP0059/CMP0059-WARN-stderr.txt b/Tests/RunCMake/CMP0059/CMP0059-WARN-stderr.txt index 4e04d15..06c7be3 100644 --- a/Tests/RunCMake/CMP0059/CMP0059-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0059/CMP0059-WARN-stderr.txt @@ -1,5 +1,5 @@ CMake Warning \(dev\) at CMP0059-WARN.cmake:6 \(get_property\): - Policy CMP0059 is not set: Do no treat DEFINITIONS as a built-in directory + Policy CMP0059 is not set: Do not treat DEFINITIONS as a built-in directory property. Run "cmake --help-policy CMP0059" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Call Stack \(most recent call first\): @@ -8,7 +8,7 @@ This warning is for project developers. Use -Wno-dev to suppress it. DEFS: -DSOME_DEF CMake Warning \(dev\) at CMP0059-WARN.cmake:14 \(get_property\): - Policy CMP0059 is not set: Do no treat DEFINITIONS as a built-in directory + Policy CMP0059 is not set: Do not treat DEFINITIONS as a built-in directory property. Run "cmake --help-policy CMP0059" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/include/CMP0024-WARN-stderr.txt b/Tests/RunCMake/include/CMP0024-WARN-stderr.txt index 9c79007..ae57674 100644 --- a/Tests/RunCMake/include/CMP0024-WARN-stderr.txt +++ b/Tests/RunCMake/include/CMP0024-WARN-stderr.txt @@ -1,7 +1,7 @@ CMake Warning \(dev\) at subdir2/CMakeLists.txt:2 \(include\): - Policy CMP0024 is not set: Disallow include export result. Run "cmake - --help-policy CMP0024" for policy details. Use the cmake_policy command to - set the policy and suppress this warning. + Policy CMP0024 is not set: Disallow include\(\) of export\(\) result. Run + "cmake --help-policy CMP0024" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. The file diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py index fe60033..26094b2 100644 --- a/Utilities/Sphinx/cmake.py +++ b/Utilities/Sphinx/cmake.py @@ -150,6 +150,21 @@ class CMakePolicyList(Directive): self.state_machine.insert_input(include_lines, "") return [] +class CMakePolicy(Directive): + required_arguments = 1 + def run(self): + + env = self.state.document.settings.env + with open("PolicyList.json", "r") as f: + policies = json.load(f) + + for policy in policies: + if policy["id"] == self.arguments[0]: + include_lines = statemachine.string2lines(policy["rst"]) + self.state_machine.insert_input(include_lines, "") + break + return [] + class _cmake_index_entry: def __init__(self, desc): self.desc = desc @@ -411,6 +426,7 @@ class CMakeDomain(Domain): def setup(app): app.add_directive('cmake-module', CMakeModule) + app.add_directive('cmake-policy', CMakePolicy) app.add_directive('cmake-policy-list', CMakePolicyList) app.add_transform(CMakeTransform) app.add_transform(CMakeXRefTransform) diff --git a/Utilities/Sphinx/create-policy-list.py b/Utilities/Sphinx/create-policy-list.py index d825c66..6b0f10e 100755 --- a/Utilities/Sphinx/create-policy-list.py +++ b/Utilities/Sphinx/create-policy-list.py @@ -7,6 +7,10 @@ def collectString(s): result = "" idx = s.find('"') + nullptr = s.find('0') + if (nullptr < idx): + return (None, None) + oldIdx = idx + 1 i = 0 while idx != -1: @@ -41,13 +45,19 @@ with open(sys.argv[2]) as policyHeader: policyId, content = content.split(",", 1) docString, docLength = collectString(content) content = content[docLength:] + rstString, rstLength = collectString(content) + if (rstString is None): + rstString = docString + else: + content = content[rstLength:] versionMajor, versionMinor, versionPatch, content = content.split(",", 3) versionMajor = cleanString(versionMajor) versionMinor = cleanString(versionMinor) versionPatch = cleanString(versionPatch) version = versionMajor + "." + versionMinor + "." + versionPatch - policies.append({"id": policyId, "doc": docString, "version": version}) + policies.append({"id": policyId, "doc": docString, + "rst": rstString, "version": version}) start = content.find("SELECT(POLICY, ") ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From steveire at gmail.com Tue May 5 16:19:12 2015 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 5 May 2015 16:19:12 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2543-g6260e4a Message-ID: <20150505201912.B60F8AEBEA@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, next has been updated via 6260e4aecdcd21ed488c93842c0a3a5302f1037f (commit) via d63bc31e0201c36cc88e51426ff4987ca32b60f2 (commit) via 00dbdef2b085a6aeffbac2dcd6747df610fd155e (commit) via 13b00c09d99dfde1dd4532b269399edffa68b65c (commit) from 98b925cbda5e331a3540d57eebe92cf17b7ff548 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6260e4aecdcd21ed488c93842c0a3a5302f1037f commit 6260e4aecdcd21ed488c93842c0a3a5302f1037f Merge: 98b925c d63bc31 Author: Stephen Kelly AuthorDate: Tue May 5 16:19:11 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue May 5 16:19:11 2015 -0400 Merge topic 'refactor-cmLocalGenerator' into next d63bc31e Revert "Revert "cmState::Snapshot: Store components for current directories."" 00dbdef2 Revert "cmState::Snapshot: Store components for current directories." 13b00c09 Revert "cmState: Store computed relative paths to to current directories." http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d63bc31e0201c36cc88e51426ff4987ca32b60f2 commit d63bc31e0201c36cc88e51426ff4987ca32b60f2 Author: Stephen Kelly AuthorDate: Tue May 5 22:18:48 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 22:18:48 2015 +0200 Revert "Revert "cmState::Snapshot: Store components for current directories."" This reverts commit 00dbdef2b085a6aeffbac2dcd6747df610fd155e. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 0a955bb..f64cb2d 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -67,7 +67,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, this->Configured = false; this->EmitUniversalBinaryFlags = true; this->RelativePathsConfigured = false; - this->PathConversionsSetup = false; this->BackwardsCompatibility = 0; this->BackwardsCompatibilityFinal = false; } @@ -229,22 +228,6 @@ void cmLocalGenerator::ReadInputFile() } } -void cmLocalGenerator::SetupPathConversions() -{ - // Setup the current output directory components for use by - // Convert - std::string outdir; - - outdir = cmSystemTools::CollapseFullPath( - this->StateSnapshot.GetCurrentSourceDirectory()); - cmSystemTools::SplitPath(outdir, this->StartDirectoryComponents); - - outdir = cmSystemTools::CollapseFullPath - (this->StateSnapshot.GetCurrentBinaryDirectory()); - cmSystemTools::SplitPath(outdir, - this->StartOutputDirectoryComponents); -} - void cmLocalGenerator::ConfigureFinalPass() { this->Makefile->ConfigureFinalPass(); @@ -2731,13 +2714,6 @@ std::string cmLocalGenerator::Convert(const std::string& source, OutputFormat output, bool optional) { - // Make sure the relative path conversion components are set. - if(!this->PathConversionsSetup) - { - this->SetupPathConversions(); - this->PathConversionsSetup = true; - } - // Convert the path to a relative path. std::string result = source; @@ -2752,20 +2728,18 @@ std::string cmLocalGenerator::Convert(const std::string& source, break; case START: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = this->ConvertToRelativePath(this->StartDirectoryComponents, - result); + result = this->ConvertToRelativePath( + this->StateSnapshot.GetCurrentSourceDirectoryComponents(), result); break; case HOME_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = - this->ConvertToRelativePath( - this->GetState()->GetBinaryDirectoryComponents(), result); + result = this->ConvertToRelativePath( + this->GetState()->GetBinaryDirectoryComponents(), result); break; case START_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = - this->ConvertToRelativePath(this->StartOutputDirectoryComponents, - result); + result = this->ConvertToRelativePath( + this->StateSnapshot.GetCurrentBinaryDirectoryComponents(), result); break; case FULL: result = cmSystemTools::CollapseFullPath(result); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 5cdf161..bf447e5 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -438,7 +438,6 @@ protected: void ConfigureRelativePaths(); std::string FindRelativePathTopSource(); std::string FindRelativePathTopBinary(); - void SetupPathConversions(); virtual std::string ConvertToLinkReference(std::string const& lib, OutputFormat format = SHELL); @@ -453,8 +452,6 @@ protected: cmMakefile *Makefile; cmState::Snapshot StateSnapshot; cmGlobalGenerator *GlobalGenerator; - std::vector StartDirectoryComponents; - std::vector StartOutputDirectoryComponents; cmLocalGenerator* Parent; std::vector Children; std::map UniqueObjectNamesMap; @@ -479,7 +476,6 @@ protected: std::string RelativePathTopSource; std::string RelativePathTopBinary; bool RelativePathsConfigured; - bool PathConversionsSetup; cmIML_INT_uint64_t BackwardsCompatibility; bool BackwardsCompatibilityFinal; diff --git a/Source/cmState.cxx b/Source/cmState.cxx index c5b12d9..dacf799 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -500,6 +500,10 @@ cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) this->ParentPositions.push_back(originSnapshot.Position); this->Locations.resize(this->Locations.size() + 1); this->OutputLocations.resize(this->OutputLocations.size() + 1); + this->CurrentSourceDirectoryComponents.resize( + this->CurrentSourceDirectoryComponents.size() + 1); + this->CurrentBinaryDirectoryComponents.resize( + this->CurrentBinaryDirectoryComponents.size() + 1); return cmState::Snapshot(this, pos); } @@ -523,6 +527,10 @@ void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir) this->State->Locations[this->Position]); this->State->Locations[this->Position] = cmSystemTools::CollapseFullPath(this->State->Locations[this->Position]); + + cmSystemTools::SplitPath( + this->State->Locations[this->Position], + this->State->CurrentSourceDirectoryComponents[this->Position]); } const char* cmState::Snapshot::GetCurrentBinaryDirectory() const @@ -539,6 +547,22 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) this->State->OutputLocations[this->Position] = cmSystemTools::CollapseFullPath( this->State->OutputLocations[this->Position]); + + cmSystemTools::SplitPath( + this->State->OutputLocations[this->Position], + this->State->CurrentBinaryDirectoryComponents[this->Position]); +} + +std::vector const& +cmState::Snapshot::GetCurrentSourceDirectoryComponents() +{ + return this->State->CurrentSourceDirectoryComponents[this->Position]; +} + +std::vector const& +cmState::Snapshot::GetCurrentBinaryDirectoryComponents() +{ + return this->State->CurrentBinaryDirectoryComponents[this->Position]; } bool cmState::Snapshot::IsValid() const diff --git a/Source/cmState.h b/Source/cmState.h index c58a461..81f2d48 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -36,6 +36,9 @@ public: const char* GetCurrentBinaryDirectory() const; void SetCurrentBinaryDirectory(std::string const& dir); + std::vector const& GetCurrentSourceDirectoryComponents(); + std::vector const& GetCurrentBinaryDirectoryComponents(); + bool IsValid() const; Snapshot GetParent() const; @@ -138,6 +141,8 @@ private: std::vector SourceDirectoryComponents; std::vector BinaryDirectoryComponents; + std::vector > CurrentSourceDirectoryComponents; + std::vector > CurrentBinaryDirectoryComponents; std::string SourceDirectory; std::string BinaryDirectory; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=00dbdef2b085a6aeffbac2dcd6747df610fd155e commit 00dbdef2b085a6aeffbac2dcd6747df610fd155e Author: Stephen Kelly AuthorDate: Tue May 5 22:12:01 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 22:12:01 2015 +0200 Revert "cmState::Snapshot: Store components for current directories." This reverts commit 091bf33f737f7fc8115eb4c3f066df41dbcebb44. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index f64cb2d..0a955bb 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -67,6 +67,7 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, this->Configured = false; this->EmitUniversalBinaryFlags = true; this->RelativePathsConfigured = false; + this->PathConversionsSetup = false; this->BackwardsCompatibility = 0; this->BackwardsCompatibilityFinal = false; } @@ -228,6 +229,22 @@ void cmLocalGenerator::ReadInputFile() } } +void cmLocalGenerator::SetupPathConversions() +{ + // Setup the current output directory components for use by + // Convert + std::string outdir; + + outdir = cmSystemTools::CollapseFullPath( + this->StateSnapshot.GetCurrentSourceDirectory()); + cmSystemTools::SplitPath(outdir, this->StartDirectoryComponents); + + outdir = cmSystemTools::CollapseFullPath + (this->StateSnapshot.GetCurrentBinaryDirectory()); + cmSystemTools::SplitPath(outdir, + this->StartOutputDirectoryComponents); +} + void cmLocalGenerator::ConfigureFinalPass() { this->Makefile->ConfigureFinalPass(); @@ -2714,6 +2731,13 @@ std::string cmLocalGenerator::Convert(const std::string& source, OutputFormat output, bool optional) { + // Make sure the relative path conversion components are set. + if(!this->PathConversionsSetup) + { + this->SetupPathConversions(); + this->PathConversionsSetup = true; + } + // Convert the path to a relative path. std::string result = source; @@ -2728,18 +2752,20 @@ std::string cmLocalGenerator::Convert(const std::string& source, break; case START: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = this->ConvertToRelativePath( - this->StateSnapshot.GetCurrentSourceDirectoryComponents(), result); + result = this->ConvertToRelativePath(this->StartDirectoryComponents, + result); break; case HOME_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = this->ConvertToRelativePath( - this->GetState()->GetBinaryDirectoryComponents(), result); + result = + this->ConvertToRelativePath( + this->GetState()->GetBinaryDirectoryComponents(), result); break; case START_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = this->ConvertToRelativePath( - this->StateSnapshot.GetCurrentBinaryDirectoryComponents(), result); + result = + this->ConvertToRelativePath(this->StartOutputDirectoryComponents, + result); break; case FULL: result = cmSystemTools::CollapseFullPath(result); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index bf447e5..5cdf161 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -438,6 +438,7 @@ protected: void ConfigureRelativePaths(); std::string FindRelativePathTopSource(); std::string FindRelativePathTopBinary(); + void SetupPathConversions(); virtual std::string ConvertToLinkReference(std::string const& lib, OutputFormat format = SHELL); @@ -452,6 +453,8 @@ protected: cmMakefile *Makefile; cmState::Snapshot StateSnapshot; cmGlobalGenerator *GlobalGenerator; + std::vector StartDirectoryComponents; + std::vector StartOutputDirectoryComponents; cmLocalGenerator* Parent; std::vector Children; std::map UniqueObjectNamesMap; @@ -476,6 +479,7 @@ protected: std::string RelativePathTopSource; std::string RelativePathTopBinary; bool RelativePathsConfigured; + bool PathConversionsSetup; cmIML_INT_uint64_t BackwardsCompatibility; bool BackwardsCompatibilityFinal; diff --git a/Source/cmState.cxx b/Source/cmState.cxx index dacf799..c5b12d9 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -500,10 +500,6 @@ cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) this->ParentPositions.push_back(originSnapshot.Position); this->Locations.resize(this->Locations.size() + 1); this->OutputLocations.resize(this->OutputLocations.size() + 1); - this->CurrentSourceDirectoryComponents.resize( - this->CurrentSourceDirectoryComponents.size() + 1); - this->CurrentBinaryDirectoryComponents.resize( - this->CurrentBinaryDirectoryComponents.size() + 1); return cmState::Snapshot(this, pos); } @@ -527,10 +523,6 @@ void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir) this->State->Locations[this->Position]); this->State->Locations[this->Position] = cmSystemTools::CollapseFullPath(this->State->Locations[this->Position]); - - cmSystemTools::SplitPath( - this->State->Locations[this->Position], - this->State->CurrentSourceDirectoryComponents[this->Position]); } const char* cmState::Snapshot::GetCurrentBinaryDirectory() const @@ -547,22 +539,6 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) this->State->OutputLocations[this->Position] = cmSystemTools::CollapseFullPath( this->State->OutputLocations[this->Position]); - - cmSystemTools::SplitPath( - this->State->OutputLocations[this->Position], - this->State->CurrentBinaryDirectoryComponents[this->Position]); -} - -std::vector const& -cmState::Snapshot::GetCurrentSourceDirectoryComponents() -{ - return this->State->CurrentSourceDirectoryComponents[this->Position]; -} - -std::vector const& -cmState::Snapshot::GetCurrentBinaryDirectoryComponents() -{ - return this->State->CurrentBinaryDirectoryComponents[this->Position]; } bool cmState::Snapshot::IsValid() const diff --git a/Source/cmState.h b/Source/cmState.h index 81f2d48..c58a461 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -36,9 +36,6 @@ public: const char* GetCurrentBinaryDirectory() const; void SetCurrentBinaryDirectory(std::string const& dir); - std::vector const& GetCurrentSourceDirectoryComponents(); - std::vector const& GetCurrentBinaryDirectoryComponents(); - bool IsValid() const; Snapshot GetParent() const; @@ -141,8 +138,6 @@ private: std::vector SourceDirectoryComponents; std::vector BinaryDirectoryComponents; - std::vector > CurrentSourceDirectoryComponents; - std::vector > CurrentBinaryDirectoryComponents; std::string SourceDirectory; std::string BinaryDirectory; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=13b00c09d99dfde1dd4532b269399edffa68b65c commit 13b00c09d99dfde1dd4532b269399edffa68b65c Author: Stephen Kelly AuthorDate: Tue May 5 22:04:00 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 22:04:00 2015 +0200 Revert "cmState: Store computed relative paths to to current directories." This reverts commit 364469ce9338c1720475425f64d8328e94607880. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index a5f603f..f64cb2d 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -66,6 +66,7 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, this->UseRelativePaths = false; this->Configured = false; this->EmitUniversalBinaryFlags = true; + this->RelativePathsConfigured = false; this->BackwardsCompatibility = 0; this->BackwardsCompatibilityFinal = false; } @@ -2811,6 +2812,97 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote, } //---------------------------------------------------------------------------- +std::string cmLocalGenerator::FindRelativePathTopSource() +{ + cmState::Snapshot snapshot = this->StateSnapshot; + std::vector snapshots; + snapshots.push_back(snapshot); + while (true) + { + snapshot = snapshot.GetParent(); + if (snapshot.IsValid()) + { + snapshots.push_back(snapshot); + } + else + { + break; + } + } + + std::string result = snapshots.front().GetCurrentSourceDirectory(); + + for (std::vector::const_iterator it = + snapshots.begin() + 1; it != snapshots.end(); ++it) + { + std::string currentSource = it->GetCurrentSourceDirectory(); + if(cmSystemTools::IsSubDirectory(result, currentSource)) + { + result = currentSource; + } + } + + return result; +} + +//---------------------------------------------------------------------------- +std::string cmLocalGenerator::FindRelativePathTopBinary() +{ + cmState::Snapshot snapshot = this->StateSnapshot; + std::vector snapshots; + snapshots.push_back(snapshot); + while (true) + { + snapshot = snapshot.GetParent(); + if (snapshot.IsValid()) + { + snapshots.push_back(snapshot); + } + else + { + break; + } + } + + std::string result = snapshots.front().GetCurrentBinaryDirectory(); + + for (std::vector::const_iterator it = + snapshots.begin() + 1; it != snapshots.end(); ++it) + { + std::string currentBinary = it->GetCurrentBinaryDirectory(); + if(cmSystemTools::IsSubDirectory(result, currentBinary)) + { + result = currentBinary; + } + } + + return result; +} + +//---------------------------------------------------------------------------- +void cmLocalGenerator::ConfigureRelativePaths() +{ + // Relative path conversion inside the source tree is not used to + // construct relative paths passed to build tools so it is safe to + // even when the source is a network path. + std::string source = this->FindRelativePathTopSource(); + this->RelativePathTopSource = source; + + // The current working directory on Windows cannot be a network + // path. Therefore relative paths cannot work when the binary tree + // is a network path. + std::string binary = this->FindRelativePathTopBinary(); + if(binary.size() < 2 || binary.substr(0, 2) != "//") + { + this->RelativePathTopBinary = binary; + } + else + { + this->RelativePathTopBinary = ""; + } +} + +//---------------------------------------------------------------------------- static bool cmLocalGeneratorNotAbove(const char* a, const char* b) { return (cmSystemTools::ComparePath(a, b) || @@ -2835,19 +2927,26 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector& local, return in_remote; } + // Make sure relative path conversion is configured. + if(!this->RelativePathsConfigured) + { + this->ConfigureRelativePaths(); + this->RelativePathsConfigured = true; + } + if(!force) { // Skip conversion if the path and local are not both in the source // or both in the binary tree. std::string local_path = cmSystemTools::JoinPath(local); if(!((cmLocalGeneratorNotAbove(local_path.c_str(), - this->StateSnapshot.GetRelativePathTopBinary()) && + this->RelativePathTopBinary.c_str()) && cmLocalGeneratorNotAbove(in_remote.c_str(), - this->StateSnapshot.GetRelativePathTopBinary())) || + this->RelativePathTopBinary.c_str())) || (cmLocalGeneratorNotAbove(local_path.c_str(), - this->StateSnapshot.GetRelativePathTopSource()) && + this->RelativePathTopSource.c_str()) && cmLocalGeneratorNotAbove(in_remote.c_str(), - this->StateSnapshot.GetRelativePathTopSource())))) + this->RelativePathTopSource.c_str())))) { return in_remote; } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index c0da4f6..bf447e5 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -435,6 +435,10 @@ protected: std::string const& dir_max); void ComputeObjectMaxPath(); + void ConfigureRelativePaths(); + std::string FindRelativePathTopSource(); + std::string FindRelativePathTopBinary(); + virtual std::string ConvertToLinkReference(std::string const& lib, OutputFormat format = SHELL); @@ -464,6 +468,15 @@ protected: // committed. std::string TargetImplib; + // The top-most directories for relative path conversion. Both the + // source and destination location of a relative path conversion + // must be underneath one of these directories (both under source or + // both under binary) in order for the relative path to be evaluated + // safely by the build tools. + std::string RelativePathTopSource; + std::string RelativePathTopBinary; + bool RelativePathsConfigured; + cmIML_INT_uint64_t BackwardsCompatibility; bool BackwardsCompatibilityFinal; private: diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 54bff7f..f11c79e 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -545,11 +545,9 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() // Setup relative path conversion tops. infoFileStream << "# Relative path conversion top directories.\n" - << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" - << this->StateSnapshot.GetRelativePathTopSource() + << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" << this->RelativePathTopSource << "\")\n" - << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \"" - << this->StateSnapshot.GetRelativePathTopBinary() + << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \"" << this->RelativePathTopBinary << "\")\n" << "\n"; @@ -1615,15 +1613,16 @@ cmLocalUnixMakefileGenerator3 } // Setup relative path top directories. + this->RelativePathsConfigured = true; if(const char* relativePathTopSource = mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_SOURCE")) { - this->StateSnapshot.SetRelativePathTopSource(relativePathTopSource); + this->RelativePathTopSource = relativePathTopSource; } if(const char* relativePathTopBinary = mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_BINARY")) { - this->StateSnapshot.SetRelativePathTopBinary(relativePathTopBinary); + this->RelativePathTopBinary = relativePathTopBinary; } } else diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 04a59fc..dacf799 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -494,86 +494,6 @@ std::vector const& cmState::GetBinaryDirectoryComponents() const return this->BinaryDirectoryComponents; } -void cmState::Snapshot::ComputeRelativePathTopSource() -{ - // Relative path conversion inside the source tree is not used to - // construct relative paths passed to build tools so it is safe to use - // even when the source is a network path. - - cmState::Snapshot snapshot = *this; - std::vector snapshots; - snapshots.push_back(snapshot); - while (true) - { - snapshot = snapshot.GetParent(); - if (snapshot.IsValid()) - { - snapshots.push_back(snapshot); - } - else - { - break; - } - } - - std::string result = snapshots.front().GetCurrentSourceDirectory(); - - for (std::vector::const_iterator it = - snapshots.begin() + 1; it != snapshots.end(); ++it) - { - std::string currentSource = it->GetCurrentSourceDirectory(); - if(cmSystemTools::IsSubDirectory(result, currentSource)) - { - result = currentSource; - } - } - this->State->RelativePathTopSource[this->Position] = result; -} - -void cmState::Snapshot::ComputeRelativePathTopBinary() -{ - cmState::Snapshot snapshot = *this; - std::vector snapshots; - snapshots.push_back(snapshot); - while (true) - { - snapshot = snapshot.GetParent(); - if (snapshot.IsValid()) - { - snapshots.push_back(snapshot); - } - else - { - break; - } - } - - std::string result = - snapshots.front().GetCurrentBinaryDirectory(); - - for (std::vector::const_iterator it = - snapshots.begin() + 1; it != snapshots.end(); ++it) - { - std::string currentBinary = it->GetCurrentBinaryDirectory(); - if(cmSystemTools::IsSubDirectory(result, currentBinary)) - { - result = currentBinary; - } - } - - // The current working directory on Windows cannot be a network - // path. Therefore relative paths cannot work when the binary tree - // is a network path. - if(result.size() < 2 || result.substr(0, 2) != "//") - { - this->State->RelativePathTopBinary[this->Position] = result; - } - else - { - this->State->RelativePathTopBinary[this->Position] = ""; - } -} - cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) { PositionType pos = this->ParentPositions.size(); @@ -584,8 +504,6 @@ cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) this->CurrentSourceDirectoryComponents.size() + 1); this->CurrentBinaryDirectoryComponents.resize( this->CurrentBinaryDirectoryComponents.size() + 1); - this->RelativePathTopSource.resize(this->RelativePathTopSource.size() + 1); - this->RelativePathTopBinary.resize(this->RelativePathTopBinary.size() + 1); return cmState::Snapshot(this, pos); } @@ -613,7 +531,6 @@ void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir) cmSystemTools::SplitPath( this->State->Locations[this->Position], this->State->CurrentSourceDirectoryComponents[this->Position]); - this->ComputeRelativePathTopSource(); } const char* cmState::Snapshot::GetCurrentBinaryDirectory() const @@ -634,7 +551,6 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) cmSystemTools::SplitPath( this->State->OutputLocations[this->Position], this->State->CurrentBinaryDirectoryComponents[this->Position]); - this->ComputeRelativePathTopBinary(); } std::vector const& @@ -649,26 +565,6 @@ cmState::Snapshot::GetCurrentBinaryDirectoryComponents() return this->State->CurrentBinaryDirectoryComponents[this->Position]; } -const char* cmState::Snapshot::GetRelativePathTopSource() const -{ - return this->State->RelativePathTopSource[this->Position].c_str(); -} - -const char* cmState::Snapshot::GetRelativePathTopBinary() const -{ - return this->State->RelativePathTopBinary[this->Position].c_str(); -} - -void cmState::Snapshot::SetRelativePathTopSource(const char* dir) -{ - this->State->RelativePathTopSource[this->Position] = dir; -} - -void cmState::Snapshot::SetRelativePathTopBinary(const char* dir) -{ - this->State->RelativePathTopBinary[this->Position] = dir; -} - bool cmState::Snapshot::IsValid() const { return this->State; diff --git a/Source/cmState.h b/Source/cmState.h index 23d3f0d..81f2d48 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -39,19 +39,10 @@ public: std::vector const& GetCurrentSourceDirectoryComponents(); std::vector const& GetCurrentBinaryDirectoryComponents(); - const char* GetRelativePathTopSource() const; - const char* GetRelativePathTopBinary() const; - void SetRelativePathTopSource(const char* dir); - void SetRelativePathTopBinary(const char* dir); - bool IsValid() const; Snapshot GetParent() const; private: - void ComputeRelativePathTopSource(); - void ComputeRelativePathTopBinary(); - - private: friend class cmState; cmState* State; cmState::PositionType Position; @@ -148,18 +139,11 @@ private: std::vector OutputLocations; std::vector ParentPositions; + std::vector SourceDirectoryComponents; + std::vector BinaryDirectoryComponents; std::vector > CurrentSourceDirectoryComponents; std::vector > CurrentBinaryDirectoryComponents; - // The top-most directories for relative path conversion. Both the - // source and destination location of a relative path conversion - // must be underneath one of these directories (both under source or - // both under binary) in order for the relative path to be evaluated - // safely by the build tools. - std::vector RelativePathTopSource; - std::vector RelativePathTopBinary; - std::vector SourceDirectoryComponents; - std::vector BinaryDirectoryComponents; std::string SourceDirectory; std::string BinaryDirectory; bool IsInTryCompile; ----------------------------------------------------------------------- Summary of changes: Source/cmLocalGenerator.cxx | 107 ++++++++++++++++++++++++++++-- Source/cmLocalGenerator.h | 13 ++++ Source/cmLocalUnixMakefileGenerator3.cxx | 11 ++- Source/cmState.cxx | 104 ----------------------------- Source/cmState.h | 20 +----- 5 files changed, 123 insertions(+), 132 deletions(-) hooks/post-receive -- CMake From steveire at gmail.com Tue May 5 17:01:54 2015 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 5 May 2015 17:01:54 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2546-g40711ca Message-ID: <20150505210154.4670AAFA62@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, next has been updated via 40711ca7f849f9d753f8c06a20f54085034c8110 (commit) via d426a2e46e08f675456048c5b2c321a5ee56f6cc (commit) via 2d4ccb49a8df14b95ad6f1d23a8683ba72bc6967 (commit) from 6260e4aecdcd21ed488c93842c0a3a5302f1037f (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=40711ca7f849f9d753f8c06a20f54085034c8110 commit 40711ca7f849f9d753f8c06a20f54085034c8110 Merge: 6260e4a d426a2e Author: Stephen Kelly AuthorDate: Tue May 5 17:01:53 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue May 5 17:01:53 2015 -0400 Merge topic 'refactor-cmLocalGenerator' into next d426a2e4 fixup! cmState: Compute and store directory components. 2d4ccb49 Revert some commits. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d426a2e46e08f675456048c5b2c321a5ee56f6cc commit d426a2e46e08f675456048c5b2c321a5ee56f6cc Author: Stephen Kelly AuthorDate: Tue May 5 23:01:26 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 23:01:26 2015 +0200 fixup! cmState: Compute and store directory components. diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 586070b..20d303d 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -204,6 +204,8 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) } cmake cm; + cm.SetHomeDirectory(""); + cm.SetHomeOutputDirectory(""); std::string cmakeOutString; cmCTestBuildAndTestCaptureRAII captureRAII(cm, cmakeOutString); static_cast(captureRAII); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2d4ccb49a8df14b95ad6f1d23a8683ba72bc6967 commit 2d4ccb49a8df14b95ad6f1d23a8683ba72bc6967 Author: Stephen Kelly AuthorDate: Tue May 5 23:00:42 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 23:00:56 2015 +0200 Revert some commits. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index f64cb2d..a5f603f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -66,7 +66,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, this->UseRelativePaths = false; this->Configured = false; this->EmitUniversalBinaryFlags = true; - this->RelativePathsConfigured = false; this->BackwardsCompatibility = 0; this->BackwardsCompatibilityFinal = false; } @@ -2812,97 +2811,6 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote, } //---------------------------------------------------------------------------- -std::string cmLocalGenerator::FindRelativePathTopSource() -{ - cmState::Snapshot snapshot = this->StateSnapshot; - std::vector snapshots; - snapshots.push_back(snapshot); - while (true) - { - snapshot = snapshot.GetParent(); - if (snapshot.IsValid()) - { - snapshots.push_back(snapshot); - } - else - { - break; - } - } - - std::string result = snapshots.front().GetCurrentSourceDirectory(); - - for (std::vector::const_iterator it = - snapshots.begin() + 1; it != snapshots.end(); ++it) - { - std::string currentSource = it->GetCurrentSourceDirectory(); - if(cmSystemTools::IsSubDirectory(result, currentSource)) - { - result = currentSource; - } - } - - return result; -} - -//---------------------------------------------------------------------------- -std::string cmLocalGenerator::FindRelativePathTopBinary() -{ - cmState::Snapshot snapshot = this->StateSnapshot; - std::vector snapshots; - snapshots.push_back(snapshot); - while (true) - { - snapshot = snapshot.GetParent(); - if (snapshot.IsValid()) - { - snapshots.push_back(snapshot); - } - else - { - break; - } - } - - std::string result = snapshots.front().GetCurrentBinaryDirectory(); - - for (std::vector::const_iterator it = - snapshots.begin() + 1; it != snapshots.end(); ++it) - { - std::string currentBinary = it->GetCurrentBinaryDirectory(); - if(cmSystemTools::IsSubDirectory(result, currentBinary)) - { - result = currentBinary; - } - } - - return result; -} - -//---------------------------------------------------------------------------- -void cmLocalGenerator::ConfigureRelativePaths() -{ - // Relative path conversion inside the source tree is not used to - // construct relative paths passed to build tools so it is safe to - // even when the source is a network path. - std::string source = this->FindRelativePathTopSource(); - this->RelativePathTopSource = source; - - // The current working directory on Windows cannot be a network - // path. Therefore relative paths cannot work when the binary tree - // is a network path. - std::string binary = this->FindRelativePathTopBinary(); - if(binary.size() < 2 || binary.substr(0, 2) != "//") - { - this->RelativePathTopBinary = binary; - } - else - { - this->RelativePathTopBinary = ""; - } -} - -//---------------------------------------------------------------------------- static bool cmLocalGeneratorNotAbove(const char* a, const char* b) { return (cmSystemTools::ComparePath(a, b) || @@ -2927,26 +2835,19 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector& local, return in_remote; } - // Make sure relative path conversion is configured. - if(!this->RelativePathsConfigured) - { - this->ConfigureRelativePaths(); - this->RelativePathsConfigured = true; - } - if(!force) { // Skip conversion if the path and local are not both in the source // or both in the binary tree. std::string local_path = cmSystemTools::JoinPath(local); if(!((cmLocalGeneratorNotAbove(local_path.c_str(), - this->RelativePathTopBinary.c_str()) && + this->StateSnapshot.GetRelativePathTopBinary()) && cmLocalGeneratorNotAbove(in_remote.c_str(), - this->RelativePathTopBinary.c_str())) || + this->StateSnapshot.GetRelativePathTopBinary())) || (cmLocalGeneratorNotAbove(local_path.c_str(), - this->RelativePathTopSource.c_str()) && + this->StateSnapshot.GetRelativePathTopSource()) && cmLocalGeneratorNotAbove(in_remote.c_str(), - this->RelativePathTopSource.c_str())))) + this->StateSnapshot.GetRelativePathTopSource())))) { return in_remote; } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index bf447e5..c0da4f6 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -435,10 +435,6 @@ protected: std::string const& dir_max); void ComputeObjectMaxPath(); - void ConfigureRelativePaths(); - std::string FindRelativePathTopSource(); - std::string FindRelativePathTopBinary(); - virtual std::string ConvertToLinkReference(std::string const& lib, OutputFormat format = SHELL); @@ -468,15 +464,6 @@ protected: // committed. std::string TargetImplib; - // The top-most directories for relative path conversion. Both the - // source and destination location of a relative path conversion - // must be underneath one of these directories (both under source or - // both under binary) in order for the relative path to be evaluated - // safely by the build tools. - std::string RelativePathTopSource; - std::string RelativePathTopBinary; - bool RelativePathsConfigured; - cmIML_INT_uint64_t BackwardsCompatibility; bool BackwardsCompatibilityFinal; private: diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index f11c79e..54bff7f 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -545,9 +545,11 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() // Setup relative path conversion tops. infoFileStream << "# Relative path conversion top directories.\n" - << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" << this->RelativePathTopSource + << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" + << this->StateSnapshot.GetRelativePathTopSource() << "\")\n" - << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \"" << this->RelativePathTopBinary + << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \"" + << this->StateSnapshot.GetRelativePathTopBinary() << "\")\n" << "\n"; @@ -1613,16 +1615,15 @@ cmLocalUnixMakefileGenerator3 } // Setup relative path top directories. - this->RelativePathsConfigured = true; if(const char* relativePathTopSource = mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_SOURCE")) { - this->RelativePathTopSource = relativePathTopSource; + this->StateSnapshot.SetRelativePathTopSource(relativePathTopSource); } if(const char* relativePathTopBinary = mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_BINARY")) { - this->RelativePathTopBinary = relativePathTopBinary; + this->StateSnapshot.SetRelativePathTopBinary(relativePathTopBinary); } } else diff --git a/Source/cmState.cxx b/Source/cmState.cxx index dacf799..04a59fc 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -494,6 +494,86 @@ std::vector const& cmState::GetBinaryDirectoryComponents() const return this->BinaryDirectoryComponents; } +void cmState::Snapshot::ComputeRelativePathTopSource() +{ + // Relative path conversion inside the source tree is not used to + // construct relative paths passed to build tools so it is safe to use + // even when the source is a network path. + + cmState::Snapshot snapshot = *this; + std::vector snapshots; + snapshots.push_back(snapshot); + while (true) + { + snapshot = snapshot.GetParent(); + if (snapshot.IsValid()) + { + snapshots.push_back(snapshot); + } + else + { + break; + } + } + + std::string result = snapshots.front().GetCurrentSourceDirectory(); + + for (std::vector::const_iterator it = + snapshots.begin() + 1; it != snapshots.end(); ++it) + { + std::string currentSource = it->GetCurrentSourceDirectory(); + if(cmSystemTools::IsSubDirectory(result, currentSource)) + { + result = currentSource; + } + } + this->State->RelativePathTopSource[this->Position] = result; +} + +void cmState::Snapshot::ComputeRelativePathTopBinary() +{ + cmState::Snapshot snapshot = *this; + std::vector snapshots; + snapshots.push_back(snapshot); + while (true) + { + snapshot = snapshot.GetParent(); + if (snapshot.IsValid()) + { + snapshots.push_back(snapshot); + } + else + { + break; + } + } + + std::string result = + snapshots.front().GetCurrentBinaryDirectory(); + + for (std::vector::const_iterator it = + snapshots.begin() + 1; it != snapshots.end(); ++it) + { + std::string currentBinary = it->GetCurrentBinaryDirectory(); + if(cmSystemTools::IsSubDirectory(result, currentBinary)) + { + result = currentBinary; + } + } + + // The current working directory on Windows cannot be a network + // path. Therefore relative paths cannot work when the binary tree + // is a network path. + if(result.size() < 2 || result.substr(0, 2) != "//") + { + this->State->RelativePathTopBinary[this->Position] = result; + } + else + { + this->State->RelativePathTopBinary[this->Position] = ""; + } +} + cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) { PositionType pos = this->ParentPositions.size(); @@ -504,6 +584,8 @@ cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) this->CurrentSourceDirectoryComponents.size() + 1); this->CurrentBinaryDirectoryComponents.resize( this->CurrentBinaryDirectoryComponents.size() + 1); + this->RelativePathTopSource.resize(this->RelativePathTopSource.size() + 1); + this->RelativePathTopBinary.resize(this->RelativePathTopBinary.size() + 1); return cmState::Snapshot(this, pos); } @@ -531,6 +613,7 @@ void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir) cmSystemTools::SplitPath( this->State->Locations[this->Position], this->State->CurrentSourceDirectoryComponents[this->Position]); + this->ComputeRelativePathTopSource(); } const char* cmState::Snapshot::GetCurrentBinaryDirectory() const @@ -551,6 +634,7 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) cmSystemTools::SplitPath( this->State->OutputLocations[this->Position], this->State->CurrentBinaryDirectoryComponents[this->Position]); + this->ComputeRelativePathTopBinary(); } std::vector const& @@ -565,6 +649,26 @@ cmState::Snapshot::GetCurrentBinaryDirectoryComponents() return this->State->CurrentBinaryDirectoryComponents[this->Position]; } +const char* cmState::Snapshot::GetRelativePathTopSource() const +{ + return this->State->RelativePathTopSource[this->Position].c_str(); +} + +const char* cmState::Snapshot::GetRelativePathTopBinary() const +{ + return this->State->RelativePathTopBinary[this->Position].c_str(); +} + +void cmState::Snapshot::SetRelativePathTopSource(const char* dir) +{ + this->State->RelativePathTopSource[this->Position] = dir; +} + +void cmState::Snapshot::SetRelativePathTopBinary(const char* dir) +{ + this->State->RelativePathTopBinary[this->Position] = dir; +} + bool cmState::Snapshot::IsValid() const { return this->State; diff --git a/Source/cmState.h b/Source/cmState.h index 81f2d48..23d3f0d 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -39,10 +39,19 @@ public: std::vector const& GetCurrentSourceDirectoryComponents(); std::vector const& GetCurrentBinaryDirectoryComponents(); + const char* GetRelativePathTopSource() const; + const char* GetRelativePathTopBinary() const; + void SetRelativePathTopSource(const char* dir); + void SetRelativePathTopBinary(const char* dir); + bool IsValid() const; Snapshot GetParent() const; private: + void ComputeRelativePathTopSource(); + void ComputeRelativePathTopBinary(); + + private: friend class cmState; cmState* State; cmState::PositionType Position; @@ -139,11 +148,18 @@ private: std::vector OutputLocations; std::vector ParentPositions; - std::vector SourceDirectoryComponents; - std::vector BinaryDirectoryComponents; std::vector > CurrentSourceDirectoryComponents; std::vector > CurrentBinaryDirectoryComponents; + // The top-most directories for relative path conversion. Both the + // source and destination location of a relative path conversion + // must be underneath one of these directories (both under source or + // both under binary) in order for the relative path to be evaluated + // safely by the build tools. + std::vector RelativePathTopSource; + std::vector RelativePathTopBinary; + std::vector SourceDirectoryComponents; + std::vector BinaryDirectoryComponents; std::string SourceDirectory; std::string BinaryDirectory; bool IsInTryCompile; ----------------------------------------------------------------------- Summary of changes: Source/CTest/cmCTestBuildAndTestHandler.cxx | 2 + Source/cmLocalGenerator.cxx | 107 +-------------------------- Source/cmLocalGenerator.h | 13 ---- Source/cmLocalUnixMakefileGenerator3.cxx | 11 +-- Source/cmState.cxx | 104 ++++++++++++++++++++++++++ Source/cmState.h | 20 ++++- 6 files changed, 134 insertions(+), 123 deletions(-) hooks/post-receive -- CMake From steveire at gmail.com Tue May 5 17:02:33 2015 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 5 May 2015 17:02:33 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2550-g9cf7e15 Message-ID: <20150505210233.D98ABAFAA5@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, next has been updated via 9cf7e15e8be12d58d3d257c1ba62df8c2ee4a0d3 (commit) via a6180fd30f3e33151aebe0b75c049d0fae19186c (commit) via 3dfa9565ae08bdbc33f387776324c9aee6cdefcb (commit) via 647a02df5394e4a5f1f78b1588a7e99fc0369009 (commit) from 40711ca7f849f9d753f8c06a20f54085034c8110 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9cf7e15e8be12d58d3d257c1ba62df8c2ee4a0d3 commit 9cf7e15e8be12d58d3d257c1ba62df8c2ee4a0d3 Merge: 40711ca a6180fd Author: Stephen Kelly AuthorDate: Tue May 5 17:02:33 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue May 5 17:02:33 2015 -0400 Merge topic 'refactor-cmLocalGenerator' into next a6180fd3 cmState: Store computed relative paths to to current directories. 3dfa9565 cmState::Snapshot: Store components for current directories. 647a02df cmState: Compute and store directory components. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a6180fd30f3e33151aebe0b75c049d0fae19186c commit a6180fd30f3e33151aebe0b75c049d0fae19186c Author: Stephen Kelly AuthorDate: Mon May 4 23:30:29 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 23:02:07 2015 +0200 cmState: Store computed relative paths to to current directories. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index f64cb2d..a5f603f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -66,7 +66,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, this->UseRelativePaths = false; this->Configured = false; this->EmitUniversalBinaryFlags = true; - this->RelativePathsConfigured = false; this->BackwardsCompatibility = 0; this->BackwardsCompatibilityFinal = false; } @@ -2812,97 +2811,6 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote, } //---------------------------------------------------------------------------- -std::string cmLocalGenerator::FindRelativePathTopSource() -{ - cmState::Snapshot snapshot = this->StateSnapshot; - std::vector snapshots; - snapshots.push_back(snapshot); - while (true) - { - snapshot = snapshot.GetParent(); - if (snapshot.IsValid()) - { - snapshots.push_back(snapshot); - } - else - { - break; - } - } - - std::string result = snapshots.front().GetCurrentSourceDirectory(); - - for (std::vector::const_iterator it = - snapshots.begin() + 1; it != snapshots.end(); ++it) - { - std::string currentSource = it->GetCurrentSourceDirectory(); - if(cmSystemTools::IsSubDirectory(result, currentSource)) - { - result = currentSource; - } - } - - return result; -} - -//---------------------------------------------------------------------------- -std::string cmLocalGenerator::FindRelativePathTopBinary() -{ - cmState::Snapshot snapshot = this->StateSnapshot; - std::vector snapshots; - snapshots.push_back(snapshot); - while (true) - { - snapshot = snapshot.GetParent(); - if (snapshot.IsValid()) - { - snapshots.push_back(snapshot); - } - else - { - break; - } - } - - std::string result = snapshots.front().GetCurrentBinaryDirectory(); - - for (std::vector::const_iterator it = - snapshots.begin() + 1; it != snapshots.end(); ++it) - { - std::string currentBinary = it->GetCurrentBinaryDirectory(); - if(cmSystemTools::IsSubDirectory(result, currentBinary)) - { - result = currentBinary; - } - } - - return result; -} - -//---------------------------------------------------------------------------- -void cmLocalGenerator::ConfigureRelativePaths() -{ - // Relative path conversion inside the source tree is not used to - // construct relative paths passed to build tools so it is safe to - // even when the source is a network path. - std::string source = this->FindRelativePathTopSource(); - this->RelativePathTopSource = source; - - // The current working directory on Windows cannot be a network - // path. Therefore relative paths cannot work when the binary tree - // is a network path. - std::string binary = this->FindRelativePathTopBinary(); - if(binary.size() < 2 || binary.substr(0, 2) != "//") - { - this->RelativePathTopBinary = binary; - } - else - { - this->RelativePathTopBinary = ""; - } -} - -//---------------------------------------------------------------------------- static bool cmLocalGeneratorNotAbove(const char* a, const char* b) { return (cmSystemTools::ComparePath(a, b) || @@ -2927,26 +2835,19 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector& local, return in_remote; } - // Make sure relative path conversion is configured. - if(!this->RelativePathsConfigured) - { - this->ConfigureRelativePaths(); - this->RelativePathsConfigured = true; - } - if(!force) { // Skip conversion if the path and local are not both in the source // or both in the binary tree. std::string local_path = cmSystemTools::JoinPath(local); if(!((cmLocalGeneratorNotAbove(local_path.c_str(), - this->RelativePathTopBinary.c_str()) && + this->StateSnapshot.GetRelativePathTopBinary()) && cmLocalGeneratorNotAbove(in_remote.c_str(), - this->RelativePathTopBinary.c_str())) || + this->StateSnapshot.GetRelativePathTopBinary())) || (cmLocalGeneratorNotAbove(local_path.c_str(), - this->RelativePathTopSource.c_str()) && + this->StateSnapshot.GetRelativePathTopSource()) && cmLocalGeneratorNotAbove(in_remote.c_str(), - this->RelativePathTopSource.c_str())))) + this->StateSnapshot.GetRelativePathTopSource())))) { return in_remote; } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index bf447e5..c0da4f6 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -435,10 +435,6 @@ protected: std::string const& dir_max); void ComputeObjectMaxPath(); - void ConfigureRelativePaths(); - std::string FindRelativePathTopSource(); - std::string FindRelativePathTopBinary(); - virtual std::string ConvertToLinkReference(std::string const& lib, OutputFormat format = SHELL); @@ -468,15 +464,6 @@ protected: // committed. std::string TargetImplib; - // The top-most directories for relative path conversion. Both the - // source and destination location of a relative path conversion - // must be underneath one of these directories (both under source or - // both under binary) in order for the relative path to be evaluated - // safely by the build tools. - std::string RelativePathTopSource; - std::string RelativePathTopBinary; - bool RelativePathsConfigured; - cmIML_INT_uint64_t BackwardsCompatibility; bool BackwardsCompatibilityFinal; private: diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index f11c79e..54bff7f 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -545,9 +545,11 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() // Setup relative path conversion tops. infoFileStream << "# Relative path conversion top directories.\n" - << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" << this->RelativePathTopSource + << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" + << this->StateSnapshot.GetRelativePathTopSource() << "\")\n" - << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \"" << this->RelativePathTopBinary + << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \"" + << this->StateSnapshot.GetRelativePathTopBinary() << "\")\n" << "\n"; @@ -1613,16 +1615,15 @@ cmLocalUnixMakefileGenerator3 } // Setup relative path top directories. - this->RelativePathsConfigured = true; if(const char* relativePathTopSource = mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_SOURCE")) { - this->RelativePathTopSource = relativePathTopSource; + this->StateSnapshot.SetRelativePathTopSource(relativePathTopSource); } if(const char* relativePathTopBinary = mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_BINARY")) { - this->RelativePathTopBinary = relativePathTopBinary; + this->StateSnapshot.SetRelativePathTopBinary(relativePathTopBinary); } } else diff --git a/Source/cmState.cxx b/Source/cmState.cxx index dacf799..04a59fc 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -494,6 +494,86 @@ std::vector const& cmState::GetBinaryDirectoryComponents() const return this->BinaryDirectoryComponents; } +void cmState::Snapshot::ComputeRelativePathTopSource() +{ + // Relative path conversion inside the source tree is not used to + // construct relative paths passed to build tools so it is safe to use + // even when the source is a network path. + + cmState::Snapshot snapshot = *this; + std::vector snapshots; + snapshots.push_back(snapshot); + while (true) + { + snapshot = snapshot.GetParent(); + if (snapshot.IsValid()) + { + snapshots.push_back(snapshot); + } + else + { + break; + } + } + + std::string result = snapshots.front().GetCurrentSourceDirectory(); + + for (std::vector::const_iterator it = + snapshots.begin() + 1; it != snapshots.end(); ++it) + { + std::string currentSource = it->GetCurrentSourceDirectory(); + if(cmSystemTools::IsSubDirectory(result, currentSource)) + { + result = currentSource; + } + } + this->State->RelativePathTopSource[this->Position] = result; +} + +void cmState::Snapshot::ComputeRelativePathTopBinary() +{ + cmState::Snapshot snapshot = *this; + std::vector snapshots; + snapshots.push_back(snapshot); + while (true) + { + snapshot = snapshot.GetParent(); + if (snapshot.IsValid()) + { + snapshots.push_back(snapshot); + } + else + { + break; + } + } + + std::string result = + snapshots.front().GetCurrentBinaryDirectory(); + + for (std::vector::const_iterator it = + snapshots.begin() + 1; it != snapshots.end(); ++it) + { + std::string currentBinary = it->GetCurrentBinaryDirectory(); + if(cmSystemTools::IsSubDirectory(result, currentBinary)) + { + result = currentBinary; + } + } + + // The current working directory on Windows cannot be a network + // path. Therefore relative paths cannot work when the binary tree + // is a network path. + if(result.size() < 2 || result.substr(0, 2) != "//") + { + this->State->RelativePathTopBinary[this->Position] = result; + } + else + { + this->State->RelativePathTopBinary[this->Position] = ""; + } +} + cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) { PositionType pos = this->ParentPositions.size(); @@ -504,6 +584,8 @@ cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) this->CurrentSourceDirectoryComponents.size() + 1); this->CurrentBinaryDirectoryComponents.resize( this->CurrentBinaryDirectoryComponents.size() + 1); + this->RelativePathTopSource.resize(this->RelativePathTopSource.size() + 1); + this->RelativePathTopBinary.resize(this->RelativePathTopBinary.size() + 1); return cmState::Snapshot(this, pos); } @@ -531,6 +613,7 @@ void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir) cmSystemTools::SplitPath( this->State->Locations[this->Position], this->State->CurrentSourceDirectoryComponents[this->Position]); + this->ComputeRelativePathTopSource(); } const char* cmState::Snapshot::GetCurrentBinaryDirectory() const @@ -551,6 +634,7 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) cmSystemTools::SplitPath( this->State->OutputLocations[this->Position], this->State->CurrentBinaryDirectoryComponents[this->Position]); + this->ComputeRelativePathTopBinary(); } std::vector const& @@ -565,6 +649,26 @@ cmState::Snapshot::GetCurrentBinaryDirectoryComponents() return this->State->CurrentBinaryDirectoryComponents[this->Position]; } +const char* cmState::Snapshot::GetRelativePathTopSource() const +{ + return this->State->RelativePathTopSource[this->Position].c_str(); +} + +const char* cmState::Snapshot::GetRelativePathTopBinary() const +{ + return this->State->RelativePathTopBinary[this->Position].c_str(); +} + +void cmState::Snapshot::SetRelativePathTopSource(const char* dir) +{ + this->State->RelativePathTopSource[this->Position] = dir; +} + +void cmState::Snapshot::SetRelativePathTopBinary(const char* dir) +{ + this->State->RelativePathTopBinary[this->Position] = dir; +} + bool cmState::Snapshot::IsValid() const { return this->State; diff --git a/Source/cmState.h b/Source/cmState.h index 81f2d48..23d3f0d 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -39,10 +39,19 @@ public: std::vector const& GetCurrentSourceDirectoryComponents(); std::vector const& GetCurrentBinaryDirectoryComponents(); + const char* GetRelativePathTopSource() const; + const char* GetRelativePathTopBinary() const; + void SetRelativePathTopSource(const char* dir); + void SetRelativePathTopBinary(const char* dir); + bool IsValid() const; Snapshot GetParent() const; private: + void ComputeRelativePathTopSource(); + void ComputeRelativePathTopBinary(); + + private: friend class cmState; cmState* State; cmState::PositionType Position; @@ -139,11 +148,18 @@ private: std::vector OutputLocations; std::vector ParentPositions; - std::vector SourceDirectoryComponents; - std::vector BinaryDirectoryComponents; std::vector > CurrentSourceDirectoryComponents; std::vector > CurrentBinaryDirectoryComponents; + // The top-most directories for relative path conversion. Both the + // source and destination location of a relative path conversion + // must be underneath one of these directories (both under source or + // both under binary) in order for the relative path to be evaluated + // safely by the build tools. + std::vector RelativePathTopSource; + std::vector RelativePathTopBinary; + std::vector SourceDirectoryComponents; + std::vector BinaryDirectoryComponents; std::string SourceDirectory; std::string BinaryDirectory; bool IsInTryCompile; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3dfa9565ae08bdbc33f387776324c9aee6cdefcb commit 3dfa9565ae08bdbc33f387776324c9aee6cdefcb Author: Stephen Kelly AuthorDate: Mon May 4 23:08:19 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 23:02:06 2015 +0200 cmState::Snapshot: Store components for current directories. Remove this responsibility from cmLocalGenerator. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 0a955bb..f64cb2d 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -67,7 +67,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, this->Configured = false; this->EmitUniversalBinaryFlags = true; this->RelativePathsConfigured = false; - this->PathConversionsSetup = false; this->BackwardsCompatibility = 0; this->BackwardsCompatibilityFinal = false; } @@ -229,22 +228,6 @@ void cmLocalGenerator::ReadInputFile() } } -void cmLocalGenerator::SetupPathConversions() -{ - // Setup the current output directory components for use by - // Convert - std::string outdir; - - outdir = cmSystemTools::CollapseFullPath( - this->StateSnapshot.GetCurrentSourceDirectory()); - cmSystemTools::SplitPath(outdir, this->StartDirectoryComponents); - - outdir = cmSystemTools::CollapseFullPath - (this->StateSnapshot.GetCurrentBinaryDirectory()); - cmSystemTools::SplitPath(outdir, - this->StartOutputDirectoryComponents); -} - void cmLocalGenerator::ConfigureFinalPass() { this->Makefile->ConfigureFinalPass(); @@ -2731,13 +2714,6 @@ std::string cmLocalGenerator::Convert(const std::string& source, OutputFormat output, bool optional) { - // Make sure the relative path conversion components are set. - if(!this->PathConversionsSetup) - { - this->SetupPathConversions(); - this->PathConversionsSetup = true; - } - // Convert the path to a relative path. std::string result = source; @@ -2752,20 +2728,18 @@ std::string cmLocalGenerator::Convert(const std::string& source, break; case START: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = this->ConvertToRelativePath(this->StartDirectoryComponents, - result); + result = this->ConvertToRelativePath( + this->StateSnapshot.GetCurrentSourceDirectoryComponents(), result); break; case HOME_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = - this->ConvertToRelativePath( - this->GetState()->GetBinaryDirectoryComponents(), result); + result = this->ConvertToRelativePath( + this->GetState()->GetBinaryDirectoryComponents(), result); break; case START_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = - this->ConvertToRelativePath(this->StartOutputDirectoryComponents, - result); + result = this->ConvertToRelativePath( + this->StateSnapshot.GetCurrentBinaryDirectoryComponents(), result); break; case FULL: result = cmSystemTools::CollapseFullPath(result); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 5cdf161..bf447e5 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -438,7 +438,6 @@ protected: void ConfigureRelativePaths(); std::string FindRelativePathTopSource(); std::string FindRelativePathTopBinary(); - void SetupPathConversions(); virtual std::string ConvertToLinkReference(std::string const& lib, OutputFormat format = SHELL); @@ -453,8 +452,6 @@ protected: cmMakefile *Makefile; cmState::Snapshot StateSnapshot; cmGlobalGenerator *GlobalGenerator; - std::vector StartDirectoryComponents; - std::vector StartOutputDirectoryComponents; cmLocalGenerator* Parent; std::vector Children; std::map UniqueObjectNamesMap; @@ -479,7 +476,6 @@ protected: std::string RelativePathTopSource; std::string RelativePathTopBinary; bool RelativePathsConfigured; - bool PathConversionsSetup; cmIML_INT_uint64_t BackwardsCompatibility; bool BackwardsCompatibilityFinal; diff --git a/Source/cmState.cxx b/Source/cmState.cxx index c5b12d9..dacf799 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -500,6 +500,10 @@ cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) this->ParentPositions.push_back(originSnapshot.Position); this->Locations.resize(this->Locations.size() + 1); this->OutputLocations.resize(this->OutputLocations.size() + 1); + this->CurrentSourceDirectoryComponents.resize( + this->CurrentSourceDirectoryComponents.size() + 1); + this->CurrentBinaryDirectoryComponents.resize( + this->CurrentBinaryDirectoryComponents.size() + 1); return cmState::Snapshot(this, pos); } @@ -523,6 +527,10 @@ void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir) this->State->Locations[this->Position]); this->State->Locations[this->Position] = cmSystemTools::CollapseFullPath(this->State->Locations[this->Position]); + + cmSystemTools::SplitPath( + this->State->Locations[this->Position], + this->State->CurrentSourceDirectoryComponents[this->Position]); } const char* cmState::Snapshot::GetCurrentBinaryDirectory() const @@ -539,6 +547,22 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) this->State->OutputLocations[this->Position] = cmSystemTools::CollapseFullPath( this->State->OutputLocations[this->Position]); + + cmSystemTools::SplitPath( + this->State->OutputLocations[this->Position], + this->State->CurrentBinaryDirectoryComponents[this->Position]); +} + +std::vector const& +cmState::Snapshot::GetCurrentSourceDirectoryComponents() +{ + return this->State->CurrentSourceDirectoryComponents[this->Position]; +} + +std::vector const& +cmState::Snapshot::GetCurrentBinaryDirectoryComponents() +{ + return this->State->CurrentBinaryDirectoryComponents[this->Position]; } bool cmState::Snapshot::IsValid() const diff --git a/Source/cmState.h b/Source/cmState.h index c58a461..81f2d48 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -36,6 +36,9 @@ public: const char* GetCurrentBinaryDirectory() const; void SetCurrentBinaryDirectory(std::string const& dir); + std::vector const& GetCurrentSourceDirectoryComponents(); + std::vector const& GetCurrentBinaryDirectoryComponents(); + bool IsValid() const; Snapshot GetParent() const; @@ -138,6 +141,8 @@ private: std::vector SourceDirectoryComponents; std::vector BinaryDirectoryComponents; + std::vector > CurrentSourceDirectoryComponents; + std::vector > CurrentBinaryDirectoryComponents; std::string SourceDirectory; std::string BinaryDirectory; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=647a02df5394e4a5f1f78b1588a7e99fc0369009 commit 647a02df5394e4a5f1f78b1588a7e99fc0369009 Author: Stephen Kelly AuthorDate: Mon May 4 23:01:29 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 23:02:06 2015 +0200 cmState: Compute and store directory components. There is no need to duplicate these in all cmLocalGenerators. Rename the symbols according to current conventions. Add explicit calls to Set{Source,Binary}Directory with empty strings in order to trigger the population of the components containers with the current working directory in cmLocalGenerator. Having directories set to empty is a special case in CMake, which is relied on for the `if(CMAKE_BINARY_DIR)` condition at the end of CMakeDetermineSystem.cmake. diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 2207873..d08b5de 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -198,6 +198,8 @@ int main (int argc, char const* const* argv) "Read CPack config file: " << cpackConfigFile << std::endl); cmake cminst; + cminst.SetHomeDirectory(""); + cminst.SetHomeOutputDirectory(""); cminst.GetState()->RemoveUnscriptableCommands(); cmGlobalGenerator cmgg; cmgg.SetCMakeInstance(&cminst); diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 586070b..20d303d 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -204,6 +204,8 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) } cmake cm; + cm.SetHomeDirectory(""); + cm.SetHomeOutputDirectory(""); std::string cmakeOutString; cmCTestBuildAndTestCaptureRAII captureRAII(cm, cmakeOutString); static_cast(captureRAII); diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 0a34be8..322855a 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -336,6 +336,8 @@ void cmCTestScriptHandler::CreateCMake() delete this->LocalGenerator; } this->CMake = new cmake; + this->CMake->SetHomeDirectory(""); + this->CMake->SetHomeOutputDirectory(""); this->CMake->AddCMakePaths(); this->GlobalGenerator = new cmGlobalGenerator; this->GlobalGenerator->SetCMakeInstance(this->CMake); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index bd6af8c..0a955bb 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -234,19 +234,12 @@ void cmLocalGenerator::SetupPathConversions() // Setup the current output directory components for use by // Convert std::string outdir; - outdir = - cmSystemTools::CollapseFullPath(this->GetState()->GetSourceDirectory()); - cmSystemTools::SplitPath(outdir, this->HomeDirectoryComponents); + outdir = cmSystemTools::CollapseFullPath( this->StateSnapshot.GetCurrentSourceDirectory()); cmSystemTools::SplitPath(outdir, this->StartDirectoryComponents); outdir = cmSystemTools::CollapseFullPath - (this->GetState()->GetBinaryDirectory()); - cmSystemTools::SplitPath(outdir, - this->HomeOutputDirectoryComponents); - - outdir = cmSystemTools::CollapseFullPath (this->StateSnapshot.GetCurrentBinaryDirectory()); cmSystemTools::SplitPath(outdir, this->StartOutputDirectoryComponents); @@ -2754,8 +2747,8 @@ std::string cmLocalGenerator::Convert(const std::string& source, { case HOME: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = this->ConvertToRelativePath(this->HomeDirectoryComponents, - result); + result = this->ConvertToRelativePath( + this->GetState()->GetSourceDirectoryComponents(), result); break; case START: //result = cmSystemTools::CollapseFullPath(result.c_str()); @@ -2765,8 +2758,8 @@ std::string cmLocalGenerator::Convert(const std::string& source, case HOME_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); result = - this->ConvertToRelativePath(this->HomeOutputDirectoryComponents, - result); + this->ConvertToRelativePath( + this->GetState()->GetBinaryDirectoryComponents(), result); break; case START_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 47c0877..5cdf161 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -453,9 +453,7 @@ protected: cmMakefile *Makefile; cmState::Snapshot StateSnapshot; cmGlobalGenerator *GlobalGenerator; - std::vector HomeDirectoryComponents; std::vector StartDirectoryComponents; - std::vector HomeOutputDirectoryComponents; std::vector StartOutputDirectoryComponents; cmLocalGenerator* Parent; std::vector Children; diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 3cca3a7..c5b12d9 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -458,6 +458,10 @@ void cmState::SetSourceDirectory(std::string const& sourceDirectory) { this->SourceDirectory = sourceDirectory; cmSystemTools::ConvertToUnixSlashes(this->SourceDirectory); + + cmSystemTools::SplitPath( + cmSystemTools::CollapseFullPath(this->SourceDirectory), + this->SourceDirectoryComponents); } const char* cmState::GetSourceDirectory() const @@ -465,10 +469,19 @@ const char* cmState::GetSourceDirectory() const return this->SourceDirectory.c_str(); } +std::vector const& cmState::GetSourceDirectoryComponents() const +{ + return this->SourceDirectoryComponents; +} + void cmState::SetBinaryDirectory(std::string const& binaryDirectory) { this->BinaryDirectory = binaryDirectory; cmSystemTools::ConvertToUnixSlashes(this->BinaryDirectory); + + cmSystemTools::SplitPath( + cmSystemTools::CollapseFullPath(this->BinaryDirectory), + this->BinaryDirectoryComponents); } const char* cmState::GetBinaryDirectory() const @@ -476,6 +489,11 @@ const char* cmState::GetBinaryDirectory() const return this->BinaryDirectory.c_str(); } +std::vector const& cmState::GetBinaryDirectoryComponents() const +{ + return this->BinaryDirectoryComponents; +} + cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) { PositionType pos = this->ParentPositions.size(); diff --git a/Source/cmState.h b/Source/cmState.h index ed58c64..c58a461 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -123,6 +123,9 @@ public: const char* GetBinaryDirectory() const; void SetBinaryDirectory(std::string const& binaryDirectory); + std::vector const& GetSourceDirectoryComponents() const; + std::vector const& GetBinaryDirectoryComponents() const; + private: std::map PropertyDefinitions; std::vector EnabledLanguages; @@ -132,6 +135,10 @@ private: std::vector Locations; std::vector OutputLocations; std::vector ParentPositions; + + std::vector SourceDirectoryComponents; + std::vector BinaryDirectoryComponents; + std::string SourceDirectory; std::string BinaryDirectory; bool IsInTryCompile; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5c5c428..2f9789d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2580,6 +2580,9 @@ int cmake::Build(const std::string& dir, const std::vector& nativeOptions, bool clean) { + + this->SetHomeDirectory(""); + this->SetHomeOutputDirectory(""); if(!cmSystemTools::FileIsDirectory(dir)) { std::cerr << "Error: " << dir << " is not a directory\n"; ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From steveire at gmail.com Tue May 5 17:10:13 2015 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 5 May 2015 17:10:13 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2552-gf3e0ba0 Message-ID: <20150505211013.CA6D29CAD0@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, next has been updated via f3e0ba0e2986b80877617b96e3dc9973bb27aaaa (commit) via 16f8a814c5dc95ee28789e7515d3218e08244463 (commit) from 9cf7e15e8be12d58d3d257c1ba62df8c2ee4a0d3 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f3e0ba0e2986b80877617b96e3dc9973bb27aaaa commit f3e0ba0e2986b80877617b96e3dc9973bb27aaaa Merge: 9cf7e15 16f8a81 Author: Stephen Kelly AuthorDate: Tue May 5 17:10:13 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue May 5 17:10:13 2015 -0400 Merge topic 'refactor-cmLocalGenerator' into next 16f8a814 fixup! cmState::Snapshot: Store components for current directories. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=16f8a814c5dc95ee28789e7515d3218e08244463 commit 16f8a814c5dc95ee28789e7515d3218e08244463 Author: Stephen Kelly AuthorDate: Tue May 5 23:04:22 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 23:04:22 2015 +0200 fixup! cmState::Snapshot: Store components for current directories. diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 04a59fc..7a1c715 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -197,6 +197,10 @@ void cmState::Initialize() this->Locations.clear(); this->OutputLocations.clear(); this->ParentPositions.clear(); + this->CurrentSourceDirectoryComponents.clear(); + this->CurrentBinaryDirectoryComponents.clear(); + this->RelativePathTopSource.clear(); + this->RelativePathTopBinary.clear(); this->CreateSnapshot(Snapshot()); this->DefineProperty ----------------------------------------------------------------------- Summary of changes: Source/cmState.cxx | 4 ++++ 1 file changed, 4 insertions(+) hooks/post-receive -- CMake From steveire at gmail.com Tue May 5 17:16:30 2015 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 5 May 2015 17:16:30 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2556-gb270789 Message-ID: <20150505211630.6D128AEBE5@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, next has been updated via b270789a64407fdd7084b458e192ab0a7c4e945b (commit) via 1a63b05ea899cadb7fbba35629321a09d65739fb (commit) via 9935b34e0fa225edfb2a10b3b1396e21ceb6a588 (commit) via d0c2eb342927c74c40c9e977b25805cdd9daf3a8 (commit) from f3e0ba0e2986b80877617b96e3dc9973bb27aaaa (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b270789a64407fdd7084b458e192ab0a7c4e945b commit b270789a64407fdd7084b458e192ab0a7c4e945b Merge: f3e0ba0 1a63b05 Author: Stephen Kelly AuthorDate: Tue May 5 17:16:29 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue May 5 17:16:29 2015 -0400 Merge topic 'refactor-cmLocalGenerator' into next 1a63b05e cmState: Store computed relative paths to to current directories. 9935b34e cmState::Snapshot: Store components for current directories. d0c2eb34 cmState: Compute and store directory components. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1a63b05ea899cadb7fbba35629321a09d65739fb commit 1a63b05ea899cadb7fbba35629321a09d65739fb Author: Stephen Kelly AuthorDate: Mon May 4 23:30:29 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 23:15:07 2015 +0200 cmState: Store computed relative paths to to current directories. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index f64cb2d..a5f603f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -66,7 +66,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, this->UseRelativePaths = false; this->Configured = false; this->EmitUniversalBinaryFlags = true; - this->RelativePathsConfigured = false; this->BackwardsCompatibility = 0; this->BackwardsCompatibilityFinal = false; } @@ -2812,97 +2811,6 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote, } //---------------------------------------------------------------------------- -std::string cmLocalGenerator::FindRelativePathTopSource() -{ - cmState::Snapshot snapshot = this->StateSnapshot; - std::vector snapshots; - snapshots.push_back(snapshot); - while (true) - { - snapshot = snapshot.GetParent(); - if (snapshot.IsValid()) - { - snapshots.push_back(snapshot); - } - else - { - break; - } - } - - std::string result = snapshots.front().GetCurrentSourceDirectory(); - - for (std::vector::const_iterator it = - snapshots.begin() + 1; it != snapshots.end(); ++it) - { - std::string currentSource = it->GetCurrentSourceDirectory(); - if(cmSystemTools::IsSubDirectory(result, currentSource)) - { - result = currentSource; - } - } - - return result; -} - -//---------------------------------------------------------------------------- -std::string cmLocalGenerator::FindRelativePathTopBinary() -{ - cmState::Snapshot snapshot = this->StateSnapshot; - std::vector snapshots; - snapshots.push_back(snapshot); - while (true) - { - snapshot = snapshot.GetParent(); - if (snapshot.IsValid()) - { - snapshots.push_back(snapshot); - } - else - { - break; - } - } - - std::string result = snapshots.front().GetCurrentBinaryDirectory(); - - for (std::vector::const_iterator it = - snapshots.begin() + 1; it != snapshots.end(); ++it) - { - std::string currentBinary = it->GetCurrentBinaryDirectory(); - if(cmSystemTools::IsSubDirectory(result, currentBinary)) - { - result = currentBinary; - } - } - - return result; -} - -//---------------------------------------------------------------------------- -void cmLocalGenerator::ConfigureRelativePaths() -{ - // Relative path conversion inside the source tree is not used to - // construct relative paths passed to build tools so it is safe to - // even when the source is a network path. - std::string source = this->FindRelativePathTopSource(); - this->RelativePathTopSource = source; - - // The current working directory on Windows cannot be a network - // path. Therefore relative paths cannot work when the binary tree - // is a network path. - std::string binary = this->FindRelativePathTopBinary(); - if(binary.size() < 2 || binary.substr(0, 2) != "//") - { - this->RelativePathTopBinary = binary; - } - else - { - this->RelativePathTopBinary = ""; - } -} - -//---------------------------------------------------------------------------- static bool cmLocalGeneratorNotAbove(const char* a, const char* b) { return (cmSystemTools::ComparePath(a, b) || @@ -2927,26 +2835,19 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector& local, return in_remote; } - // Make sure relative path conversion is configured. - if(!this->RelativePathsConfigured) - { - this->ConfigureRelativePaths(); - this->RelativePathsConfigured = true; - } - if(!force) { // Skip conversion if the path and local are not both in the source // or both in the binary tree. std::string local_path = cmSystemTools::JoinPath(local); if(!((cmLocalGeneratorNotAbove(local_path.c_str(), - this->RelativePathTopBinary.c_str()) && + this->StateSnapshot.GetRelativePathTopBinary()) && cmLocalGeneratorNotAbove(in_remote.c_str(), - this->RelativePathTopBinary.c_str())) || + this->StateSnapshot.GetRelativePathTopBinary())) || (cmLocalGeneratorNotAbove(local_path.c_str(), - this->RelativePathTopSource.c_str()) && + this->StateSnapshot.GetRelativePathTopSource()) && cmLocalGeneratorNotAbove(in_remote.c_str(), - this->RelativePathTopSource.c_str())))) + this->StateSnapshot.GetRelativePathTopSource())))) { return in_remote; } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index bf447e5..c0da4f6 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -435,10 +435,6 @@ protected: std::string const& dir_max); void ComputeObjectMaxPath(); - void ConfigureRelativePaths(); - std::string FindRelativePathTopSource(); - std::string FindRelativePathTopBinary(); - virtual std::string ConvertToLinkReference(std::string const& lib, OutputFormat format = SHELL); @@ -468,15 +464,6 @@ protected: // committed. std::string TargetImplib; - // The top-most directories for relative path conversion. Both the - // source and destination location of a relative path conversion - // must be underneath one of these directories (both under source or - // both under binary) in order for the relative path to be evaluated - // safely by the build tools. - std::string RelativePathTopSource; - std::string RelativePathTopBinary; - bool RelativePathsConfigured; - cmIML_INT_uint64_t BackwardsCompatibility; bool BackwardsCompatibilityFinal; private: diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index f11c79e..54bff7f 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -545,9 +545,11 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() // Setup relative path conversion tops. infoFileStream << "# Relative path conversion top directories.\n" - << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" << this->RelativePathTopSource + << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" + << this->StateSnapshot.GetRelativePathTopSource() << "\")\n" - << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \"" << this->RelativePathTopBinary + << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \"" + << this->StateSnapshot.GetRelativePathTopBinary() << "\")\n" << "\n"; @@ -1613,16 +1615,15 @@ cmLocalUnixMakefileGenerator3 } // Setup relative path top directories. - this->RelativePathsConfigured = true; if(const char* relativePathTopSource = mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_SOURCE")) { - this->RelativePathTopSource = relativePathTopSource; + this->StateSnapshot.SetRelativePathTopSource(relativePathTopSource); } if(const char* relativePathTopBinary = mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_BINARY")) { - this->RelativePathTopBinary = relativePathTopBinary; + this->StateSnapshot.SetRelativePathTopBinary(relativePathTopBinary); } } else diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 219bd0c..7a1c715 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -199,6 +199,8 @@ void cmState::Initialize() this->ParentPositions.clear(); this->CurrentSourceDirectoryComponents.clear(); this->CurrentBinaryDirectoryComponents.clear(); + this->RelativePathTopSource.clear(); + this->RelativePathTopBinary.clear(); this->CreateSnapshot(Snapshot()); this->DefineProperty @@ -496,6 +498,86 @@ std::vector const& cmState::GetBinaryDirectoryComponents() const return this->BinaryDirectoryComponents; } +void cmState::Snapshot::ComputeRelativePathTopSource() +{ + // Relative path conversion inside the source tree is not used to + // construct relative paths passed to build tools so it is safe to use + // even when the source is a network path. + + cmState::Snapshot snapshot = *this; + std::vector snapshots; + snapshots.push_back(snapshot); + while (true) + { + snapshot = snapshot.GetParent(); + if (snapshot.IsValid()) + { + snapshots.push_back(snapshot); + } + else + { + break; + } + } + + std::string result = snapshots.front().GetCurrentSourceDirectory(); + + for (std::vector::const_iterator it = + snapshots.begin() + 1; it != snapshots.end(); ++it) + { + std::string currentSource = it->GetCurrentSourceDirectory(); + if(cmSystemTools::IsSubDirectory(result, currentSource)) + { + result = currentSource; + } + } + this->State->RelativePathTopSource[this->Position] = result; +} + +void cmState::Snapshot::ComputeRelativePathTopBinary() +{ + cmState::Snapshot snapshot = *this; + std::vector snapshots; + snapshots.push_back(snapshot); + while (true) + { + snapshot = snapshot.GetParent(); + if (snapshot.IsValid()) + { + snapshots.push_back(snapshot); + } + else + { + break; + } + } + + std::string result = + snapshots.front().GetCurrentBinaryDirectory(); + + for (std::vector::const_iterator it = + snapshots.begin() + 1; it != snapshots.end(); ++it) + { + std::string currentBinary = it->GetCurrentBinaryDirectory(); + if(cmSystemTools::IsSubDirectory(result, currentBinary)) + { + result = currentBinary; + } + } + + // The current working directory on Windows cannot be a network + // path. Therefore relative paths cannot work when the binary tree + // is a network path. + if(result.size() < 2 || result.substr(0, 2) != "//") + { + this->State->RelativePathTopBinary[this->Position] = result; + } + else + { + this->State->RelativePathTopBinary[this->Position] = ""; + } +} + cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) { PositionType pos = this->ParentPositions.size(); @@ -506,6 +588,8 @@ cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) this->CurrentSourceDirectoryComponents.size() + 1); this->CurrentBinaryDirectoryComponents.resize( this->CurrentBinaryDirectoryComponents.size() + 1); + this->RelativePathTopSource.resize(this->RelativePathTopSource.size() + 1); + this->RelativePathTopBinary.resize(this->RelativePathTopBinary.size() + 1); return cmState::Snapshot(this, pos); } @@ -533,6 +617,7 @@ void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir) cmSystemTools::SplitPath( this->State->Locations[this->Position], this->State->CurrentSourceDirectoryComponents[this->Position]); + this->ComputeRelativePathTopSource(); } const char* cmState::Snapshot::GetCurrentBinaryDirectory() const @@ -553,6 +638,7 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) cmSystemTools::SplitPath( this->State->OutputLocations[this->Position], this->State->CurrentBinaryDirectoryComponents[this->Position]); + this->ComputeRelativePathTopBinary(); } std::vector const& @@ -567,6 +653,26 @@ cmState::Snapshot::GetCurrentBinaryDirectoryComponents() return this->State->CurrentBinaryDirectoryComponents[this->Position]; } +const char* cmState::Snapshot::GetRelativePathTopSource() const +{ + return this->State->RelativePathTopSource[this->Position].c_str(); +} + +const char* cmState::Snapshot::GetRelativePathTopBinary() const +{ + return this->State->RelativePathTopBinary[this->Position].c_str(); +} + +void cmState::Snapshot::SetRelativePathTopSource(const char* dir) +{ + this->State->RelativePathTopSource[this->Position] = dir; +} + +void cmState::Snapshot::SetRelativePathTopBinary(const char* dir) +{ + this->State->RelativePathTopBinary[this->Position] = dir; +} + bool cmState::Snapshot::IsValid() const { return this->State; diff --git a/Source/cmState.h b/Source/cmState.h index faf0739..23d3f0d 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -39,10 +39,19 @@ public: std::vector const& GetCurrentSourceDirectoryComponents(); std::vector const& GetCurrentBinaryDirectoryComponents(); + const char* GetRelativePathTopSource() const; + const char* GetRelativePathTopBinary() const; + void SetRelativePathTopSource(const char* dir); + void SetRelativePathTopBinary(const char* dir); + bool IsValid() const; Snapshot GetParent() const; private: + void ComputeRelativePathTopSource(); + void ComputeRelativePathTopBinary(); + + private: friend class cmState; cmState* State; cmState::PositionType Position; @@ -141,6 +150,13 @@ private: std::vector > CurrentSourceDirectoryComponents; std::vector > CurrentBinaryDirectoryComponents; + // The top-most directories for relative path conversion. Both the + // source and destination location of a relative path conversion + // must be underneath one of these directories (both under source or + // both under binary) in order for the relative path to be evaluated + // safely by the build tools. + std::vector RelativePathTopSource; + std::vector RelativePathTopBinary; std::vector SourceDirectoryComponents; std::vector BinaryDirectoryComponents; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9935b34e0fa225edfb2a10b3b1396e21ceb6a588 commit 9935b34e0fa225edfb2a10b3b1396e21ceb6a588 Author: Stephen Kelly AuthorDate: Mon May 4 23:08:19 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 23:14:40 2015 +0200 cmState::Snapshot: Store components for current directories. Remove this responsibility from cmLocalGenerator. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 0a955bb..f64cb2d 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -67,7 +67,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, this->Configured = false; this->EmitUniversalBinaryFlags = true; this->RelativePathsConfigured = false; - this->PathConversionsSetup = false; this->BackwardsCompatibility = 0; this->BackwardsCompatibilityFinal = false; } @@ -229,22 +228,6 @@ void cmLocalGenerator::ReadInputFile() } } -void cmLocalGenerator::SetupPathConversions() -{ - // Setup the current output directory components for use by - // Convert - std::string outdir; - - outdir = cmSystemTools::CollapseFullPath( - this->StateSnapshot.GetCurrentSourceDirectory()); - cmSystemTools::SplitPath(outdir, this->StartDirectoryComponents); - - outdir = cmSystemTools::CollapseFullPath - (this->StateSnapshot.GetCurrentBinaryDirectory()); - cmSystemTools::SplitPath(outdir, - this->StartOutputDirectoryComponents); -} - void cmLocalGenerator::ConfigureFinalPass() { this->Makefile->ConfigureFinalPass(); @@ -2731,13 +2714,6 @@ std::string cmLocalGenerator::Convert(const std::string& source, OutputFormat output, bool optional) { - // Make sure the relative path conversion components are set. - if(!this->PathConversionsSetup) - { - this->SetupPathConversions(); - this->PathConversionsSetup = true; - } - // Convert the path to a relative path. std::string result = source; @@ -2752,20 +2728,18 @@ std::string cmLocalGenerator::Convert(const std::string& source, break; case START: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = this->ConvertToRelativePath(this->StartDirectoryComponents, - result); + result = this->ConvertToRelativePath( + this->StateSnapshot.GetCurrentSourceDirectoryComponents(), result); break; case HOME_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = - this->ConvertToRelativePath( - this->GetState()->GetBinaryDirectoryComponents(), result); + result = this->ConvertToRelativePath( + this->GetState()->GetBinaryDirectoryComponents(), result); break; case START_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = - this->ConvertToRelativePath(this->StartOutputDirectoryComponents, - result); + result = this->ConvertToRelativePath( + this->StateSnapshot.GetCurrentBinaryDirectoryComponents(), result); break; case FULL: result = cmSystemTools::CollapseFullPath(result); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 5cdf161..bf447e5 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -438,7 +438,6 @@ protected: void ConfigureRelativePaths(); std::string FindRelativePathTopSource(); std::string FindRelativePathTopBinary(); - void SetupPathConversions(); virtual std::string ConvertToLinkReference(std::string const& lib, OutputFormat format = SHELL); @@ -453,8 +452,6 @@ protected: cmMakefile *Makefile; cmState::Snapshot StateSnapshot; cmGlobalGenerator *GlobalGenerator; - std::vector StartDirectoryComponents; - std::vector StartOutputDirectoryComponents; cmLocalGenerator* Parent; std::vector Children; std::map UniqueObjectNamesMap; @@ -479,7 +476,6 @@ protected: std::string RelativePathTopSource; std::string RelativePathTopBinary; bool RelativePathsConfigured; - bool PathConversionsSetup; cmIML_INT_uint64_t BackwardsCompatibility; bool BackwardsCompatibilityFinal; diff --git a/Source/cmState.cxx b/Source/cmState.cxx index c5b12d9..219bd0c 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -197,6 +197,8 @@ void cmState::Initialize() this->Locations.clear(); this->OutputLocations.clear(); this->ParentPositions.clear(); + this->CurrentSourceDirectoryComponents.clear(); + this->CurrentBinaryDirectoryComponents.clear(); this->CreateSnapshot(Snapshot()); this->DefineProperty @@ -500,6 +502,10 @@ cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) this->ParentPositions.push_back(originSnapshot.Position); this->Locations.resize(this->Locations.size() + 1); this->OutputLocations.resize(this->OutputLocations.size() + 1); + this->CurrentSourceDirectoryComponents.resize( + this->CurrentSourceDirectoryComponents.size() + 1); + this->CurrentBinaryDirectoryComponents.resize( + this->CurrentBinaryDirectoryComponents.size() + 1); return cmState::Snapshot(this, pos); } @@ -523,6 +529,10 @@ void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir) this->State->Locations[this->Position]); this->State->Locations[this->Position] = cmSystemTools::CollapseFullPath(this->State->Locations[this->Position]); + + cmSystemTools::SplitPath( + this->State->Locations[this->Position], + this->State->CurrentSourceDirectoryComponents[this->Position]); } const char* cmState::Snapshot::GetCurrentBinaryDirectory() const @@ -539,6 +549,22 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) this->State->OutputLocations[this->Position] = cmSystemTools::CollapseFullPath( this->State->OutputLocations[this->Position]); + + cmSystemTools::SplitPath( + this->State->OutputLocations[this->Position], + this->State->CurrentBinaryDirectoryComponents[this->Position]); +} + +std::vector const& +cmState::Snapshot::GetCurrentSourceDirectoryComponents() +{ + return this->State->CurrentSourceDirectoryComponents[this->Position]; +} + +std::vector const& +cmState::Snapshot::GetCurrentBinaryDirectoryComponents() +{ + return this->State->CurrentBinaryDirectoryComponents[this->Position]; } bool cmState::Snapshot::IsValid() const diff --git a/Source/cmState.h b/Source/cmState.h index 956b4f4..faf0739 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -36,6 +36,9 @@ public: const char* GetCurrentBinaryDirectory() const; void SetCurrentBinaryDirectory(std::string const& dir); + std::vector const& GetCurrentSourceDirectoryComponents(); + std::vector const& GetCurrentBinaryDirectoryComponents(); + bool IsValid() const; Snapshot GetParent() const; @@ -136,6 +139,9 @@ private: std::vector OutputLocations; std::vector ParentPositions; + std::vector > CurrentSourceDirectoryComponents; + std::vector > CurrentBinaryDirectoryComponents; + std::vector SourceDirectoryComponents; std::vector BinaryDirectoryComponents; std::string SourceDirectory; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d0c2eb342927c74c40c9e977b25805cdd9daf3a8 commit d0c2eb342927c74c40c9e977b25805cdd9daf3a8 Author: Stephen Kelly AuthorDate: Mon May 4 23:01:29 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 23:11:21 2015 +0200 cmState: Compute and store directory components. There is no need to duplicate these in all cmLocalGenerators. Rename the symbols according to current conventions. Add explicit calls to Set{Source,Binary}Directory with empty strings in order to trigger the population of the components containers with the current working directory in cmLocalGenerator. Having directories set to empty is a special case in CMake, which is relied on for the `if(CMAKE_BINARY_DIR)` condition at the end of CMakeDetermineSystem.cmake. diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 2207873..d08b5de 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -198,6 +198,8 @@ int main (int argc, char const* const* argv) "Read CPack config file: " << cpackConfigFile << std::endl); cmake cminst; + cminst.SetHomeDirectory(""); + cminst.SetHomeOutputDirectory(""); cminst.GetState()->RemoveUnscriptableCommands(); cmGlobalGenerator cmgg; cmgg.SetCMakeInstance(&cminst); diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 586070b..20d303d 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -204,6 +204,8 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) } cmake cm; + cm.SetHomeDirectory(""); + cm.SetHomeOutputDirectory(""); std::string cmakeOutString; cmCTestBuildAndTestCaptureRAII captureRAII(cm, cmakeOutString); static_cast(captureRAII); diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 0a34be8..322855a 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -336,6 +336,8 @@ void cmCTestScriptHandler::CreateCMake() delete this->LocalGenerator; } this->CMake = new cmake; + this->CMake->SetHomeDirectory(""); + this->CMake->SetHomeOutputDirectory(""); this->CMake->AddCMakePaths(); this->GlobalGenerator = new cmGlobalGenerator; this->GlobalGenerator->SetCMakeInstance(this->CMake); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index bd6af8c..0a955bb 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -234,19 +234,12 @@ void cmLocalGenerator::SetupPathConversions() // Setup the current output directory components for use by // Convert std::string outdir; - outdir = - cmSystemTools::CollapseFullPath(this->GetState()->GetSourceDirectory()); - cmSystemTools::SplitPath(outdir, this->HomeDirectoryComponents); + outdir = cmSystemTools::CollapseFullPath( this->StateSnapshot.GetCurrentSourceDirectory()); cmSystemTools::SplitPath(outdir, this->StartDirectoryComponents); outdir = cmSystemTools::CollapseFullPath - (this->GetState()->GetBinaryDirectory()); - cmSystemTools::SplitPath(outdir, - this->HomeOutputDirectoryComponents); - - outdir = cmSystemTools::CollapseFullPath (this->StateSnapshot.GetCurrentBinaryDirectory()); cmSystemTools::SplitPath(outdir, this->StartOutputDirectoryComponents); @@ -2754,8 +2747,8 @@ std::string cmLocalGenerator::Convert(const std::string& source, { case HOME: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = this->ConvertToRelativePath(this->HomeDirectoryComponents, - result); + result = this->ConvertToRelativePath( + this->GetState()->GetSourceDirectoryComponents(), result); break; case START: //result = cmSystemTools::CollapseFullPath(result.c_str()); @@ -2765,8 +2758,8 @@ std::string cmLocalGenerator::Convert(const std::string& source, case HOME_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); result = - this->ConvertToRelativePath(this->HomeOutputDirectoryComponents, - result); + this->ConvertToRelativePath( + this->GetState()->GetBinaryDirectoryComponents(), result); break; case START_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 47c0877..5cdf161 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -453,9 +453,7 @@ protected: cmMakefile *Makefile; cmState::Snapshot StateSnapshot; cmGlobalGenerator *GlobalGenerator; - std::vector HomeDirectoryComponents; std::vector StartDirectoryComponents; - std::vector HomeOutputDirectoryComponents; std::vector StartOutputDirectoryComponents; cmLocalGenerator* Parent; std::vector Children; diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 3cca3a7..c5b12d9 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -458,6 +458,10 @@ void cmState::SetSourceDirectory(std::string const& sourceDirectory) { this->SourceDirectory = sourceDirectory; cmSystemTools::ConvertToUnixSlashes(this->SourceDirectory); + + cmSystemTools::SplitPath( + cmSystemTools::CollapseFullPath(this->SourceDirectory), + this->SourceDirectoryComponents); } const char* cmState::GetSourceDirectory() const @@ -465,10 +469,19 @@ const char* cmState::GetSourceDirectory() const return this->SourceDirectory.c_str(); } +std::vector const& cmState::GetSourceDirectoryComponents() const +{ + return this->SourceDirectoryComponents; +} + void cmState::SetBinaryDirectory(std::string const& binaryDirectory) { this->BinaryDirectory = binaryDirectory; cmSystemTools::ConvertToUnixSlashes(this->BinaryDirectory); + + cmSystemTools::SplitPath( + cmSystemTools::CollapseFullPath(this->BinaryDirectory), + this->BinaryDirectoryComponents); } const char* cmState::GetBinaryDirectory() const @@ -476,6 +489,11 @@ const char* cmState::GetBinaryDirectory() const return this->BinaryDirectory.c_str(); } +std::vector const& cmState::GetBinaryDirectoryComponents() const +{ + return this->BinaryDirectoryComponents; +} + cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) { PositionType pos = this->ParentPositions.size(); diff --git a/Source/cmState.h b/Source/cmState.h index ed58c64..956b4f4 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -123,6 +123,9 @@ public: const char* GetBinaryDirectory() const; void SetBinaryDirectory(std::string const& binaryDirectory); + std::vector const& GetSourceDirectoryComponents() const; + std::vector const& GetBinaryDirectoryComponents() const; + private: std::map PropertyDefinitions; std::vector EnabledLanguages; @@ -132,6 +135,9 @@ private: std::vector Locations; std::vector OutputLocations; std::vector ParentPositions; + + std::vector SourceDirectoryComponents; + std::vector BinaryDirectoryComponents; std::string SourceDirectory; std::string BinaryDirectory; bool IsInTryCompile; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5c5c428..2f9789d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2580,6 +2580,9 @@ int cmake::Build(const std::string& dir, const std::vector& nativeOptions, bool clean) { + + this->SetHomeDirectory(""); + this->SetHomeOutputDirectory(""); if(!cmSystemTools::FileIsDirectory(dir)) { std::cerr << "Error: " << dir << " is not a directory\n"; ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From steveire at gmail.com Tue May 5 17:24:30 2015 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 5 May 2015 17:24:30 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2558-g6d2f594 Message-ID: <20150505212430.A82AAAF639@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, next has been updated via 6d2f594648726880be490c95dba19167d0776182 (commit) via d11003bc7ca3b39924d95ad6f116162501cab449 (commit) from b270789a64407fdd7084b458e192ab0a7c4e945b (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6d2f594648726880be490c95dba19167d0776182 commit 6d2f594648726880be490c95dba19167d0776182 Merge: b270789 d11003b Author: Stephen Kelly AuthorDate: Tue May 5 17:24:29 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue May 5 17:24:29 2015 -0400 Merge topic 'refactor-cmLocalGenerator' into next d11003bc fixup! cmGlobalGenerator: Move some flags from cmLocalGenerator. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d11003bc7ca3b39924d95ad6f116162501cab449 commit d11003bc7ca3b39924d95ad6f116162501cab449 Author: Stephen Kelly AuthorDate: Tue May 5 23:24:15 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 23:24:15 2015 +0200 fixup! cmGlobalGenerator: Move some flags from cmLocalGenerator. diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx index f1f7984..25613eb 100644 --- a/Source/cmGlobalJOMMakefileGenerator.cxx +++ b/Source/cmGlobalJOMMakefileGenerator.cxx @@ -20,6 +20,7 @@ cmGlobalJOMMakefileGenerator::cmGlobalJOMMakefileGenerator() this->ToolSupportsColor = true; this->UseLinkScript = false; this->WindowsShell = true; + this->NMake = true; } void cmGlobalJOMMakefileGenerator @@ -55,7 +56,6 @@ cmGlobalJOMMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) lg->SetMakeSilentFlag("/nologo"); lg->SetIgnoreLibPrefix(true); lg->SetPassMakeflags(true); - lg->SetNMake(true); lg->SetUnixCD(false); return lg; } diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx index 9f9e888..b6adcbb 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.cxx +++ b/Source/cmGlobalMSYSMakefileGenerator.cxx @@ -21,7 +21,7 @@ cmGlobalMSYSMakefileGenerator::cmGlobalMSYSMakefileGenerator() this->ForceUnixPaths = true; this->ToolSupportsColor = true; this->UseLinkScript = false; - this->SetMSYSShell = true; + this->MSYSShell = true; } std::string ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalJOMMakefileGenerator.cxx | 2 +- Source/cmGlobalMSYSMakefileGenerator.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From steveire at gmail.com Tue May 5 17:25:18 2015 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 5 May 2015 17:25:18 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2563-g52d911c Message-ID: <20150505212518.C7531AF6D1@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, next has been updated via 52d911c79caa96c0a08bf138c2df2dcfd477f388 (commit) via d63d21bcc422504ad8a783da8d681370f7c3fc28 (commit) via f963ecf516a5bcbb0350023e32dad672018f549a (commit) via 5fb6ec642b9b40735405ca5382609521815bb9b0 (commit) via 3b884afa00e188b449d46d63b694296fc18c4117 (commit) from 6d2f594648726880be490c95dba19167d0776182 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=52d911c79caa96c0a08bf138c2df2dcfd477f388 commit 52d911c79caa96c0a08bf138c2df2dcfd477f388 Merge: 6d2f594 d63d21b Author: Stephen Kelly AuthorDate: Tue May 5 17:25:17 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue May 5 17:25:17 2015 -0400 Merge topic 'refactor-cmLocalGenerator' into next d63d21bc cmState: Store computed relative paths to to current directories. f963ecf5 cmState::Snapshot: Store components for current directories. 5fb6ec64 cmState: Compute and store directory components. 3b884afa cmGlobalGenerator: Move some flags from cmLocalGenerator. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d63d21bcc422504ad8a783da8d681370f7c3fc28 commit d63d21bcc422504ad8a783da8d681370f7c3fc28 Author: Stephen Kelly AuthorDate: Mon May 4 23:30:29 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 23:24:51 2015 +0200 cmState: Store computed relative paths to to current directories. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index f64cb2d..a5f603f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -66,7 +66,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, this->UseRelativePaths = false; this->Configured = false; this->EmitUniversalBinaryFlags = true; - this->RelativePathsConfigured = false; this->BackwardsCompatibility = 0; this->BackwardsCompatibilityFinal = false; } @@ -2812,97 +2811,6 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote, } //---------------------------------------------------------------------------- -std::string cmLocalGenerator::FindRelativePathTopSource() -{ - cmState::Snapshot snapshot = this->StateSnapshot; - std::vector snapshots; - snapshots.push_back(snapshot); - while (true) - { - snapshot = snapshot.GetParent(); - if (snapshot.IsValid()) - { - snapshots.push_back(snapshot); - } - else - { - break; - } - } - - std::string result = snapshots.front().GetCurrentSourceDirectory(); - - for (std::vector::const_iterator it = - snapshots.begin() + 1; it != snapshots.end(); ++it) - { - std::string currentSource = it->GetCurrentSourceDirectory(); - if(cmSystemTools::IsSubDirectory(result, currentSource)) - { - result = currentSource; - } - } - - return result; -} - -//---------------------------------------------------------------------------- -std::string cmLocalGenerator::FindRelativePathTopBinary() -{ - cmState::Snapshot snapshot = this->StateSnapshot; - std::vector snapshots; - snapshots.push_back(snapshot); - while (true) - { - snapshot = snapshot.GetParent(); - if (snapshot.IsValid()) - { - snapshots.push_back(snapshot); - } - else - { - break; - } - } - - std::string result = snapshots.front().GetCurrentBinaryDirectory(); - - for (std::vector::const_iterator it = - snapshots.begin() + 1; it != snapshots.end(); ++it) - { - std::string currentBinary = it->GetCurrentBinaryDirectory(); - if(cmSystemTools::IsSubDirectory(result, currentBinary)) - { - result = currentBinary; - } - } - - return result; -} - -//---------------------------------------------------------------------------- -void cmLocalGenerator::ConfigureRelativePaths() -{ - // Relative path conversion inside the source tree is not used to - // construct relative paths passed to build tools so it is safe to - // even when the source is a network path. - std::string source = this->FindRelativePathTopSource(); - this->RelativePathTopSource = source; - - // The current working directory on Windows cannot be a network - // path. Therefore relative paths cannot work when the binary tree - // is a network path. - std::string binary = this->FindRelativePathTopBinary(); - if(binary.size() < 2 || binary.substr(0, 2) != "//") - { - this->RelativePathTopBinary = binary; - } - else - { - this->RelativePathTopBinary = ""; - } -} - -//---------------------------------------------------------------------------- static bool cmLocalGeneratorNotAbove(const char* a, const char* b) { return (cmSystemTools::ComparePath(a, b) || @@ -2927,26 +2835,19 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector& local, return in_remote; } - // Make sure relative path conversion is configured. - if(!this->RelativePathsConfigured) - { - this->ConfigureRelativePaths(); - this->RelativePathsConfigured = true; - } - if(!force) { // Skip conversion if the path and local are not both in the source // or both in the binary tree. std::string local_path = cmSystemTools::JoinPath(local); if(!((cmLocalGeneratorNotAbove(local_path.c_str(), - this->RelativePathTopBinary.c_str()) && + this->StateSnapshot.GetRelativePathTopBinary()) && cmLocalGeneratorNotAbove(in_remote.c_str(), - this->RelativePathTopBinary.c_str())) || + this->StateSnapshot.GetRelativePathTopBinary())) || (cmLocalGeneratorNotAbove(local_path.c_str(), - this->RelativePathTopSource.c_str()) && + this->StateSnapshot.GetRelativePathTopSource()) && cmLocalGeneratorNotAbove(in_remote.c_str(), - this->RelativePathTopSource.c_str())))) + this->StateSnapshot.GetRelativePathTopSource())))) { return in_remote; } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index bf447e5..c0da4f6 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -435,10 +435,6 @@ protected: std::string const& dir_max); void ComputeObjectMaxPath(); - void ConfigureRelativePaths(); - std::string FindRelativePathTopSource(); - std::string FindRelativePathTopBinary(); - virtual std::string ConvertToLinkReference(std::string const& lib, OutputFormat format = SHELL); @@ -468,15 +464,6 @@ protected: // committed. std::string TargetImplib; - // The top-most directories for relative path conversion. Both the - // source and destination location of a relative path conversion - // must be underneath one of these directories (both under source or - // both under binary) in order for the relative path to be evaluated - // safely by the build tools. - std::string RelativePathTopSource; - std::string RelativePathTopBinary; - bool RelativePathsConfigured; - cmIML_INT_uint64_t BackwardsCompatibility; bool BackwardsCompatibilityFinal; private: diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index f11c79e..54bff7f 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -545,9 +545,11 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() // Setup relative path conversion tops. infoFileStream << "# Relative path conversion top directories.\n" - << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" << this->RelativePathTopSource + << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" + << this->StateSnapshot.GetRelativePathTopSource() << "\")\n" - << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \"" << this->RelativePathTopBinary + << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \"" + << this->StateSnapshot.GetRelativePathTopBinary() << "\")\n" << "\n"; @@ -1613,16 +1615,15 @@ cmLocalUnixMakefileGenerator3 } // Setup relative path top directories. - this->RelativePathsConfigured = true; if(const char* relativePathTopSource = mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_SOURCE")) { - this->RelativePathTopSource = relativePathTopSource; + this->StateSnapshot.SetRelativePathTopSource(relativePathTopSource); } if(const char* relativePathTopBinary = mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_BINARY")) { - this->RelativePathTopBinary = relativePathTopBinary; + this->StateSnapshot.SetRelativePathTopBinary(relativePathTopBinary); } } else diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 219bd0c..7a1c715 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -199,6 +199,8 @@ void cmState::Initialize() this->ParentPositions.clear(); this->CurrentSourceDirectoryComponents.clear(); this->CurrentBinaryDirectoryComponents.clear(); + this->RelativePathTopSource.clear(); + this->RelativePathTopBinary.clear(); this->CreateSnapshot(Snapshot()); this->DefineProperty @@ -496,6 +498,86 @@ std::vector const& cmState::GetBinaryDirectoryComponents() const return this->BinaryDirectoryComponents; } +void cmState::Snapshot::ComputeRelativePathTopSource() +{ + // Relative path conversion inside the source tree is not used to + // construct relative paths passed to build tools so it is safe to use + // even when the source is a network path. + + cmState::Snapshot snapshot = *this; + std::vector snapshots; + snapshots.push_back(snapshot); + while (true) + { + snapshot = snapshot.GetParent(); + if (snapshot.IsValid()) + { + snapshots.push_back(snapshot); + } + else + { + break; + } + } + + std::string result = snapshots.front().GetCurrentSourceDirectory(); + + for (std::vector::const_iterator it = + snapshots.begin() + 1; it != snapshots.end(); ++it) + { + std::string currentSource = it->GetCurrentSourceDirectory(); + if(cmSystemTools::IsSubDirectory(result, currentSource)) + { + result = currentSource; + } + } + this->State->RelativePathTopSource[this->Position] = result; +} + +void cmState::Snapshot::ComputeRelativePathTopBinary() +{ + cmState::Snapshot snapshot = *this; + std::vector snapshots; + snapshots.push_back(snapshot); + while (true) + { + snapshot = snapshot.GetParent(); + if (snapshot.IsValid()) + { + snapshots.push_back(snapshot); + } + else + { + break; + } + } + + std::string result = + snapshots.front().GetCurrentBinaryDirectory(); + + for (std::vector::const_iterator it = + snapshots.begin() + 1; it != snapshots.end(); ++it) + { + std::string currentBinary = it->GetCurrentBinaryDirectory(); + if(cmSystemTools::IsSubDirectory(result, currentBinary)) + { + result = currentBinary; + } + } + + // The current working directory on Windows cannot be a network + // path. Therefore relative paths cannot work when the binary tree + // is a network path. + if(result.size() < 2 || result.substr(0, 2) != "//") + { + this->State->RelativePathTopBinary[this->Position] = result; + } + else + { + this->State->RelativePathTopBinary[this->Position] = ""; + } +} + cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) { PositionType pos = this->ParentPositions.size(); @@ -506,6 +588,8 @@ cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) this->CurrentSourceDirectoryComponents.size() + 1); this->CurrentBinaryDirectoryComponents.resize( this->CurrentBinaryDirectoryComponents.size() + 1); + this->RelativePathTopSource.resize(this->RelativePathTopSource.size() + 1); + this->RelativePathTopBinary.resize(this->RelativePathTopBinary.size() + 1); return cmState::Snapshot(this, pos); } @@ -533,6 +617,7 @@ void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir) cmSystemTools::SplitPath( this->State->Locations[this->Position], this->State->CurrentSourceDirectoryComponents[this->Position]); + this->ComputeRelativePathTopSource(); } const char* cmState::Snapshot::GetCurrentBinaryDirectory() const @@ -553,6 +638,7 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) cmSystemTools::SplitPath( this->State->OutputLocations[this->Position], this->State->CurrentBinaryDirectoryComponents[this->Position]); + this->ComputeRelativePathTopBinary(); } std::vector const& @@ -567,6 +653,26 @@ cmState::Snapshot::GetCurrentBinaryDirectoryComponents() return this->State->CurrentBinaryDirectoryComponents[this->Position]; } +const char* cmState::Snapshot::GetRelativePathTopSource() const +{ + return this->State->RelativePathTopSource[this->Position].c_str(); +} + +const char* cmState::Snapshot::GetRelativePathTopBinary() const +{ + return this->State->RelativePathTopBinary[this->Position].c_str(); +} + +void cmState::Snapshot::SetRelativePathTopSource(const char* dir) +{ + this->State->RelativePathTopSource[this->Position] = dir; +} + +void cmState::Snapshot::SetRelativePathTopBinary(const char* dir) +{ + this->State->RelativePathTopBinary[this->Position] = dir; +} + bool cmState::Snapshot::IsValid() const { return this->State; diff --git a/Source/cmState.h b/Source/cmState.h index faf0739..23d3f0d 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -39,10 +39,19 @@ public: std::vector const& GetCurrentSourceDirectoryComponents(); std::vector const& GetCurrentBinaryDirectoryComponents(); + const char* GetRelativePathTopSource() const; + const char* GetRelativePathTopBinary() const; + void SetRelativePathTopSource(const char* dir); + void SetRelativePathTopBinary(const char* dir); + bool IsValid() const; Snapshot GetParent() const; private: + void ComputeRelativePathTopSource(); + void ComputeRelativePathTopBinary(); + + private: friend class cmState; cmState* State; cmState::PositionType Position; @@ -141,6 +150,13 @@ private: std::vector > CurrentSourceDirectoryComponents; std::vector > CurrentBinaryDirectoryComponents; + // The top-most directories for relative path conversion. Both the + // source and destination location of a relative path conversion + // must be underneath one of these directories (both under source or + // both under binary) in order for the relative path to be evaluated + // safely by the build tools. + std::vector RelativePathTopSource; + std::vector RelativePathTopBinary; std::vector SourceDirectoryComponents; std::vector BinaryDirectoryComponents; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f963ecf516a5bcbb0350023e32dad672018f549a commit f963ecf516a5bcbb0350023e32dad672018f549a Author: Stephen Kelly AuthorDate: Mon May 4 23:08:19 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 23:24:51 2015 +0200 cmState::Snapshot: Store components for current directories. Remove this responsibility from cmLocalGenerator. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 0a955bb..f64cb2d 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -67,7 +67,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, this->Configured = false; this->EmitUniversalBinaryFlags = true; this->RelativePathsConfigured = false; - this->PathConversionsSetup = false; this->BackwardsCompatibility = 0; this->BackwardsCompatibilityFinal = false; } @@ -229,22 +228,6 @@ void cmLocalGenerator::ReadInputFile() } } -void cmLocalGenerator::SetupPathConversions() -{ - // Setup the current output directory components for use by - // Convert - std::string outdir; - - outdir = cmSystemTools::CollapseFullPath( - this->StateSnapshot.GetCurrentSourceDirectory()); - cmSystemTools::SplitPath(outdir, this->StartDirectoryComponents); - - outdir = cmSystemTools::CollapseFullPath - (this->StateSnapshot.GetCurrentBinaryDirectory()); - cmSystemTools::SplitPath(outdir, - this->StartOutputDirectoryComponents); -} - void cmLocalGenerator::ConfigureFinalPass() { this->Makefile->ConfigureFinalPass(); @@ -2731,13 +2714,6 @@ std::string cmLocalGenerator::Convert(const std::string& source, OutputFormat output, bool optional) { - // Make sure the relative path conversion components are set. - if(!this->PathConversionsSetup) - { - this->SetupPathConversions(); - this->PathConversionsSetup = true; - } - // Convert the path to a relative path. std::string result = source; @@ -2752,20 +2728,18 @@ std::string cmLocalGenerator::Convert(const std::string& source, break; case START: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = this->ConvertToRelativePath(this->StartDirectoryComponents, - result); + result = this->ConvertToRelativePath( + this->StateSnapshot.GetCurrentSourceDirectoryComponents(), result); break; case HOME_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = - this->ConvertToRelativePath( - this->GetState()->GetBinaryDirectoryComponents(), result); + result = this->ConvertToRelativePath( + this->GetState()->GetBinaryDirectoryComponents(), result); break; case START_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = - this->ConvertToRelativePath(this->StartOutputDirectoryComponents, - result); + result = this->ConvertToRelativePath( + this->StateSnapshot.GetCurrentBinaryDirectoryComponents(), result); break; case FULL: result = cmSystemTools::CollapseFullPath(result); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 5cdf161..bf447e5 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -438,7 +438,6 @@ protected: void ConfigureRelativePaths(); std::string FindRelativePathTopSource(); std::string FindRelativePathTopBinary(); - void SetupPathConversions(); virtual std::string ConvertToLinkReference(std::string const& lib, OutputFormat format = SHELL); @@ -453,8 +452,6 @@ protected: cmMakefile *Makefile; cmState::Snapshot StateSnapshot; cmGlobalGenerator *GlobalGenerator; - std::vector StartDirectoryComponents; - std::vector StartOutputDirectoryComponents; cmLocalGenerator* Parent; std::vector Children; std::map UniqueObjectNamesMap; @@ -479,7 +476,6 @@ protected: std::string RelativePathTopSource; std::string RelativePathTopBinary; bool RelativePathsConfigured; - bool PathConversionsSetup; cmIML_INT_uint64_t BackwardsCompatibility; bool BackwardsCompatibilityFinal; diff --git a/Source/cmState.cxx b/Source/cmState.cxx index c5b12d9..219bd0c 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -197,6 +197,8 @@ void cmState::Initialize() this->Locations.clear(); this->OutputLocations.clear(); this->ParentPositions.clear(); + this->CurrentSourceDirectoryComponents.clear(); + this->CurrentBinaryDirectoryComponents.clear(); this->CreateSnapshot(Snapshot()); this->DefineProperty @@ -500,6 +502,10 @@ cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) this->ParentPositions.push_back(originSnapshot.Position); this->Locations.resize(this->Locations.size() + 1); this->OutputLocations.resize(this->OutputLocations.size() + 1); + this->CurrentSourceDirectoryComponents.resize( + this->CurrentSourceDirectoryComponents.size() + 1); + this->CurrentBinaryDirectoryComponents.resize( + this->CurrentBinaryDirectoryComponents.size() + 1); return cmState::Snapshot(this, pos); } @@ -523,6 +529,10 @@ void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir) this->State->Locations[this->Position]); this->State->Locations[this->Position] = cmSystemTools::CollapseFullPath(this->State->Locations[this->Position]); + + cmSystemTools::SplitPath( + this->State->Locations[this->Position], + this->State->CurrentSourceDirectoryComponents[this->Position]); } const char* cmState::Snapshot::GetCurrentBinaryDirectory() const @@ -539,6 +549,22 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) this->State->OutputLocations[this->Position] = cmSystemTools::CollapseFullPath( this->State->OutputLocations[this->Position]); + + cmSystemTools::SplitPath( + this->State->OutputLocations[this->Position], + this->State->CurrentBinaryDirectoryComponents[this->Position]); +} + +std::vector const& +cmState::Snapshot::GetCurrentSourceDirectoryComponents() +{ + return this->State->CurrentSourceDirectoryComponents[this->Position]; +} + +std::vector const& +cmState::Snapshot::GetCurrentBinaryDirectoryComponents() +{ + return this->State->CurrentBinaryDirectoryComponents[this->Position]; } bool cmState::Snapshot::IsValid() const diff --git a/Source/cmState.h b/Source/cmState.h index 956b4f4..faf0739 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -36,6 +36,9 @@ public: const char* GetCurrentBinaryDirectory() const; void SetCurrentBinaryDirectory(std::string const& dir); + std::vector const& GetCurrentSourceDirectoryComponents(); + std::vector const& GetCurrentBinaryDirectoryComponents(); + bool IsValid() const; Snapshot GetParent() const; @@ -136,6 +139,9 @@ private: std::vector OutputLocations; std::vector ParentPositions; + std::vector > CurrentSourceDirectoryComponents; + std::vector > CurrentBinaryDirectoryComponents; + std::vector SourceDirectoryComponents; std::vector BinaryDirectoryComponents; std::string SourceDirectory; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5fb6ec642b9b40735405ca5382609521815bb9b0 commit 5fb6ec642b9b40735405ca5382609521815bb9b0 Author: Stephen Kelly AuthorDate: Mon May 4 23:01:29 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 23:24:51 2015 +0200 cmState: Compute and store directory components. There is no need to duplicate these in all cmLocalGenerators. Rename the symbols according to current conventions. Add explicit calls to Set{Source,Binary}Directory with empty strings in order to trigger the population of the components containers with the current working directory in cmLocalGenerator. Having directories set to empty is a special case in CMake, which is relied on for the `if(CMAKE_BINARY_DIR)` condition at the end of CMakeDetermineSystem.cmake. diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 2207873..d08b5de 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -198,6 +198,8 @@ int main (int argc, char const* const* argv) "Read CPack config file: " << cpackConfigFile << std::endl); cmake cminst; + cminst.SetHomeDirectory(""); + cminst.SetHomeOutputDirectory(""); cminst.GetState()->RemoveUnscriptableCommands(); cmGlobalGenerator cmgg; cmgg.SetCMakeInstance(&cminst); diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 586070b..20d303d 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -204,6 +204,8 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) } cmake cm; + cm.SetHomeDirectory(""); + cm.SetHomeOutputDirectory(""); std::string cmakeOutString; cmCTestBuildAndTestCaptureRAII captureRAII(cm, cmakeOutString); static_cast(captureRAII); diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 0a34be8..322855a 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -336,6 +336,8 @@ void cmCTestScriptHandler::CreateCMake() delete this->LocalGenerator; } this->CMake = new cmake; + this->CMake->SetHomeDirectory(""); + this->CMake->SetHomeOutputDirectory(""); this->CMake->AddCMakePaths(); this->GlobalGenerator = new cmGlobalGenerator; this->GlobalGenerator->SetCMakeInstance(this->CMake); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index bd6af8c..0a955bb 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -234,19 +234,12 @@ void cmLocalGenerator::SetupPathConversions() // Setup the current output directory components for use by // Convert std::string outdir; - outdir = - cmSystemTools::CollapseFullPath(this->GetState()->GetSourceDirectory()); - cmSystemTools::SplitPath(outdir, this->HomeDirectoryComponents); + outdir = cmSystemTools::CollapseFullPath( this->StateSnapshot.GetCurrentSourceDirectory()); cmSystemTools::SplitPath(outdir, this->StartDirectoryComponents); outdir = cmSystemTools::CollapseFullPath - (this->GetState()->GetBinaryDirectory()); - cmSystemTools::SplitPath(outdir, - this->HomeOutputDirectoryComponents); - - outdir = cmSystemTools::CollapseFullPath (this->StateSnapshot.GetCurrentBinaryDirectory()); cmSystemTools::SplitPath(outdir, this->StartOutputDirectoryComponents); @@ -2754,8 +2747,8 @@ std::string cmLocalGenerator::Convert(const std::string& source, { case HOME: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = this->ConvertToRelativePath(this->HomeDirectoryComponents, - result); + result = this->ConvertToRelativePath( + this->GetState()->GetSourceDirectoryComponents(), result); break; case START: //result = cmSystemTools::CollapseFullPath(result.c_str()); @@ -2765,8 +2758,8 @@ std::string cmLocalGenerator::Convert(const std::string& source, case HOME_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); result = - this->ConvertToRelativePath(this->HomeOutputDirectoryComponents, - result); + this->ConvertToRelativePath( + this->GetState()->GetBinaryDirectoryComponents(), result); break; case START_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 47c0877..5cdf161 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -453,9 +453,7 @@ protected: cmMakefile *Makefile; cmState::Snapshot StateSnapshot; cmGlobalGenerator *GlobalGenerator; - std::vector HomeDirectoryComponents; std::vector StartDirectoryComponents; - std::vector HomeOutputDirectoryComponents; std::vector StartOutputDirectoryComponents; cmLocalGenerator* Parent; std::vector Children; diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 3cca3a7..c5b12d9 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -458,6 +458,10 @@ void cmState::SetSourceDirectory(std::string const& sourceDirectory) { this->SourceDirectory = sourceDirectory; cmSystemTools::ConvertToUnixSlashes(this->SourceDirectory); + + cmSystemTools::SplitPath( + cmSystemTools::CollapseFullPath(this->SourceDirectory), + this->SourceDirectoryComponents); } const char* cmState::GetSourceDirectory() const @@ -465,10 +469,19 @@ const char* cmState::GetSourceDirectory() const return this->SourceDirectory.c_str(); } +std::vector const& cmState::GetSourceDirectoryComponents() const +{ + return this->SourceDirectoryComponents; +} + void cmState::SetBinaryDirectory(std::string const& binaryDirectory) { this->BinaryDirectory = binaryDirectory; cmSystemTools::ConvertToUnixSlashes(this->BinaryDirectory); + + cmSystemTools::SplitPath( + cmSystemTools::CollapseFullPath(this->BinaryDirectory), + this->BinaryDirectoryComponents); } const char* cmState::GetBinaryDirectory() const @@ -476,6 +489,11 @@ const char* cmState::GetBinaryDirectory() const return this->BinaryDirectory.c_str(); } +std::vector const& cmState::GetBinaryDirectoryComponents() const +{ + return this->BinaryDirectoryComponents; +} + cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) { PositionType pos = this->ParentPositions.size(); diff --git a/Source/cmState.h b/Source/cmState.h index ed58c64..956b4f4 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -123,6 +123,9 @@ public: const char* GetBinaryDirectory() const; void SetBinaryDirectory(std::string const& binaryDirectory); + std::vector const& GetSourceDirectoryComponents() const; + std::vector const& GetBinaryDirectoryComponents() const; + private: std::map PropertyDefinitions; std::vector EnabledLanguages; @@ -132,6 +135,9 @@ private: std::vector Locations; std::vector OutputLocations; std::vector ParentPositions; + + std::vector SourceDirectoryComponents; + std::vector BinaryDirectoryComponents; std::string SourceDirectory; std::string BinaryDirectory; bool IsInTryCompile; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5c5c428..2f9789d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2580,6 +2580,9 @@ int cmake::Build(const std::string& dir, const std::vector& nativeOptions, bool clean) { + + this->SetHomeDirectory(""); + this->SetHomeOutputDirectory(""); if(!cmSystemTools::FileIsDirectory(dir)) { std::cerr << "Error: " << dir << " is not a directory\n"; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3b884afa00e188b449d46d63b694296fc18c4117 commit 3b884afa00e188b449d46d63b694296fc18c4117 Author: Stephen Kelly AuthorDate: Mon May 4 22:40:11 2015 +0200 Commit: Stephen Kelly CommitDate: Tue May 5 23:24:51 2015 +0200 cmGlobalGenerator: Move some flags from cmLocalGenerator. These flags are global, and so they belong here instead of being set on each local generator. diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx index 0220799..d191056 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.cxx +++ b/Source/cmGlobalBorlandMakefileGenerator.cxx @@ -21,6 +21,7 @@ cmGlobalBorlandMakefileGenerator::cmGlobalBorlandMakefileGenerator() this->ForceUnixPaths = false; this->ToolSupportsColor = true; this->UseLinkScript = false; + this->WindowsShell = true; } @@ -43,7 +44,6 @@ cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator( cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3(this, parent); lg->SetIncludeDirective("!include"); - lg->SetWindowsShell(true); lg->SetDefineWindowsNULL(true); lg->SetMakefileVariableSize(32); lg->SetPassMakeflags(true); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 7117402..fe73e8c 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -71,6 +71,13 @@ cmGlobalGenerator::cmGlobalGenerator() this->ExtraGenerator = 0; this->CurrentLocalGenerator = 0; this->TryCompileOuterMakefile = 0; + + this->WindowsShell = false; + this->WindowsVSIDE = false; + this->WatcomWMake = false; + this->MinGWMake = false; + this->NMake = false; + this->MSYSShell = false; } cmGlobalGenerator::~cmGlobalGenerator() diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 7107198..3b321f2 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -354,6 +354,13 @@ public: cmFileLockPool& GetFileLockPool() { return FileLockPool; } #endif + bool WindowsShell; + bool WindowsVSIDE; + bool WatcomWMake; + bool MinGWMake; + bool NMake; + bool MSYSShell; + protected: virtual void Generate(); diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx index 1caa730..25613eb 100644 --- a/Source/cmGlobalJOMMakefileGenerator.cxx +++ b/Source/cmGlobalJOMMakefileGenerator.cxx @@ -19,6 +19,8 @@ cmGlobalJOMMakefileGenerator::cmGlobalJOMMakefileGenerator() this->ForceUnixPaths = false; this->ToolSupportsColor = true; this->UseLinkScript = false; + this->WindowsShell = true; + this->NMake = true; } void cmGlobalJOMMakefileGenerator @@ -51,11 +53,9 @@ cmGlobalJOMMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3(this, parent); lg->SetDefineWindowsNULL(true); - lg->SetWindowsShell(true); lg->SetMakeSilentFlag("/nologo"); lg->SetIgnoreLibPrefix(true); lg->SetPassMakeflags(true); - lg->SetNMake(true); lg->SetUnixCD(false); return lg; } diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx index 319eeaf..b6adcbb 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.cxx +++ b/Source/cmGlobalMSYSMakefileGenerator.cxx @@ -21,6 +21,7 @@ cmGlobalMSYSMakefileGenerator::cmGlobalMSYSMakefileGenerator() this->ForceUnixPaths = true; this->ToolSupportsColor = true; this->UseLinkScript = false; + this->MSYSShell = true; } std::string @@ -98,8 +99,6 @@ cmGlobalMSYSMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) { cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3(this, parent); - lg->SetWindowsShell(false); - lg->SetMSYSShell(true); lg->SetIgnoreLibPrefix(true); lg->SetPassMakeflags(false); lg->SetUnixCD(true); diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx index c4511e5..ba0790d 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.cxx +++ b/Source/cmGlobalMinGWMakefileGenerator.cxx @@ -19,6 +19,8 @@ cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator() this->ForceUnixPaths = true; this->ToolSupportsColor = true; this->UseLinkScript = true; + this->WindowsShell = true; + this->MinGWMake = true; } void cmGlobalMinGWMakefileGenerator @@ -36,11 +38,9 @@ cmGlobalMinGWMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) { cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3(this, parent); - lg->SetWindowsShell(true); lg->SetIgnoreLibPrefix(true); lg->SetPassMakeflags(false); lg->SetUnixCD(true); - lg->SetMinGWMake(true); return lg; } diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx index 2732e22..98d7fb4 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.cxx +++ b/Source/cmGlobalNMakeMakefileGenerator.cxx @@ -19,6 +19,8 @@ cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator() this->ForceUnixPaths = false; this->ToolSupportsColor = true; this->UseLinkScript = false; + this->WindowsShell = true; + this->NMake = true; } void cmGlobalNMakeMakefileGenerator @@ -51,11 +53,9 @@ cmGlobalNMakeMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3(this, parent); lg->SetDefineWindowsNULL(true); - lg->SetWindowsShell(true); lg->SetMakeSilentFlag("/nologo"); lg->SetIgnoreLibPrefix(true); lg->SetPassMakeflags(true); - lg->SetNMake(true); lg->SetUnixCD(false); return lg; } diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index dde9ca4..7a26cc0 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -487,6 +487,9 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator() , ComputingUnknownDependencies(false) , PolicyCMP0058(cmPolicies::WARN) { +#ifdef _WIN32 + this->WindowsShell = true; +#endif // // Ninja is not ported to non-Unix OS yet. // this->ForceUnixPaths = true; this->FindMakeProgramFile = "CMakeNinjaFindMake.cmake"; diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 60d545b..b74ba6f 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -23,6 +23,8 @@ //---------------------------------------------------------------------------- cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator() { + this->WindowsShell = true; + this->WindowsVSIDE = true; } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx index 49c516f..181178f 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.cxx +++ b/Source/cmGlobalWatcomWMakeGenerator.cxx @@ -22,6 +22,10 @@ cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator() this->ToolSupportsColor = true; this->NeedSymbolicMark = true; this->EmptyRuleHackCommand = "@cd ."; +#ifdef _WIN32 + this->WindowsShell = true; +#endif + this->WatcomWMake = true; } void cmGlobalWatcomWMakeGenerator @@ -47,10 +51,6 @@ cmGlobalWatcomWMakeGenerator::CreateLocalGenerator(cmLocalGenerator* parent) cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3(this, parent); lg->SetDefineWindowsNULL(true); -#ifdef _WIN32 - lg->SetWindowsShell(true); -#endif - lg->SetWatcomWMake(true); lg->SetMakeSilentFlag("-h"); lg->SetIgnoreLibPrefix(true); lg->SetPassMakeflags(false); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 5ef0a3b..bd6af8c 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -61,12 +61,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, } this->Makefile = new cmMakefile(this); - this->WindowsShell = false; - this->WindowsVSIDE = false; - this->WatcomWMake = false; - this->MinGWMake = false; - this->NMake = false; - this->MSYSShell = false; this->LinkScriptShell = false; this->IgnoreLibPrefix = false; this->UseRelativePaths = false; @@ -1254,7 +1248,7 @@ cmLocalGenerator::ConvertToOutputForExistingCommon(const std::string& remote, // If this is a windows shell, the result has a space, and the path // already exists, we can use a short-path to reference it without a // space. - if(this->WindowsShell && result.find(' ') != result.npos && + if(this->GlobalGenerator->WindowsShell && result.find(' ') != result.npos && cmSystemTools::FileExists(remote.c_str())) { std::string tmp; @@ -2626,7 +2620,7 @@ void cmLocalGenerator::JoinDefines(const std::set& defines, { // Append the definition with proper escaping. std::string def = dflag; - if(this->WatcomWMake) + if(this->GlobalGenerator->WatcomWMake) { // The Watcom compiler does its own command line parsing instead // of using the windows shell rules. Definitions are one of @@ -2805,7 +2799,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source, // For the MSYS shell convert drive letters to posix paths, so // that c:/some/path becomes /c/some/path. This is needed to // avoid problems with the shell path translation. - if(this->MSYSShell && !this->LinkScriptShell) + if(this->GlobalGenerator->MSYSShell && !this->LinkScriptShell) { if(result.size() > 2 && result[1] == ':') { @@ -2813,7 +2807,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source, result[0] = '/'; } } - if(this->WindowsShell) + if(this->GlobalGenerator->WindowsShell) { std::replace(result.begin(), result.end(), '/', '\\'); } @@ -3324,6 +3318,26 @@ void cmLocalGenerator::ComputeObjectFilenames( } +bool cmLocalGenerator::IsWindowsShell() const +{ + return this->GlobalGenerator->WindowsShell; +} + +bool cmLocalGenerator::IsWatcomWMake() const +{ + return this->GlobalGenerator->WatcomWMake; +} + +bool cmLocalGenerator::IsMinGWMake() const +{ + return this->GlobalGenerator->MinGWMake; +} + +bool cmLocalGenerator::IsNMake() const +{ + return this->GlobalGenerator->NMake; +} + //---------------------------------------------------------------------------- std::string cmLocalGenerator @@ -3467,7 +3481,7 @@ std::string cmLocalGenerator::EscapeForShell(const std::string& str, // Compute the flags for the target shell environment. int flags = 0; - if(this->WindowsVSIDE) + if(this->GlobalGenerator->WindowsVSIDE) { flags |= cmsysSystem_Shell_Flag_VSIDE; } @@ -3487,27 +3501,27 @@ std::string cmLocalGenerator::EscapeForShell(const std::string& str, { flags |= cmsysSystem_Shell_Flag_WatcomQuote; } - if(this->WatcomWMake) + if(this->GlobalGenerator->WatcomWMake) { flags |= cmsysSystem_Shell_Flag_WatcomWMake; } - if(this->MinGWMake) + if(this->GlobalGenerator->MinGWMake) { flags |= cmsysSystem_Shell_Flag_MinGWMake; } - if(this->NMake) + if(this->GlobalGenerator->NMake) { flags |= cmsysSystem_Shell_Flag_NMake; } // Compute the buffer size needed. - int size = (this->WindowsShell ? + int size = (this->GlobalGenerator->WindowsShell ? cmsysSystem_Shell_GetArgumentSizeForWindows(str.c_str(), flags) : cmsysSystem_Shell_GetArgumentSizeForUnix(str.c_str(), flags)); // Compute the shell argument itself. std::vector arg(size); - if(this->WindowsShell) + if(this->GlobalGenerator->WindowsShell) { cmsysSystem_Shell_GetArgumentForWindows(str.c_str(), &arg[0], flags); } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 100d27b..47c0877 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -383,6 +383,11 @@ public: std::map& mapping, cmGeneratorTarget const* gt = 0); + bool IsWindowsShell() const; + bool IsWatcomWMake() const; + bool IsMinGWMake() const; + bool IsNMake() const; + protected: ///! put all the libraries for a target on into the given stream virtual void OutputLinkLibraries(std::string& linkLibraries, @@ -457,17 +462,13 @@ protected: std::map UniqueObjectNamesMap; std::string::size_type ObjectPathMax; std::set ObjectMaxPathViolations; - bool WindowsShell; - bool WindowsVSIDE; - bool WatcomWMake; - bool MinGWMake; - bool NMake; - bool MSYSShell; + bool LinkScriptShell; bool UseRelativePaths; bool IgnoreLibPrefix; bool Configured; bool EmitUniversalBinaryFlags; + // Hack for ExpandRuleVariable until object-oriented version is // committed. std::string TargetImplib; diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index ac10f09..ded4c25 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -28,9 +28,6 @@ cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg, , ConfigName("") , HomeRelativeOutputPath("") { -#ifdef _WIN32 - this->WindowsShell = true; -#endif this->TargetImplib = "$TARGET_IMPLIB"; } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index a2a3725..f11c79e 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -83,7 +83,6 @@ cmLocalUnixMakefileGenerator3:: cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmLocalGenerator* parent) : cmLocalGenerator(gg, parent) { - this->WindowsShell = false; this->IncludeDirective = "include"; this->MakefileVariableSize = 0; this->IgnoreLibPrefix = false; @@ -679,7 +678,7 @@ cmLocalUnixMakefileGenerator3 // Write the list of commands. os << cmWrap("\t", commands, "", "\n") << "\n"; - if(symbolic && !this->WatcomWMake) + if(symbolic && !this->IsWatcomWMake()) { os << ".PHONY : " << cmMakeSafe(tgt) << "\n"; } @@ -696,7 +695,7 @@ std::string cmLocalUnixMakefileGenerator3 ::ConvertShellCommand(std::string const& cmd, RelativeRoot root) { - if(this->WatcomWMake && + if(this->IsWatcomWMake() && cmSystemTools::FileIsFullPath(cmd.c_str()) && cmd.find_first_of("( )") != cmd.npos) { @@ -730,7 +729,7 @@ cmLocalUnixMakefileGenerator3 << "NULL=nul\n" << "!ENDIF\n"; } - if(this->WindowsShell) + if(this->IsWindowsShell()) { makefileStream << "SHELL = cmd.exe\n" @@ -798,7 +797,8 @@ cmLocalUnixMakefileGenerator3 makefileStream, "Disable implicit rules so canonical targets will work.", ".SUFFIXES", no_depends, no_commands, false); - if(!this->NMake && !this->WatcomWMake && !this->BorlandMakeCurlyHack) + if(!this->IsNMake() + && !this->IsWatcomWMake() && !this->BorlandMakeCurlyHack) { // turn off RCS and SCCS automatic stuff from gmake makefileStream @@ -810,7 +810,7 @@ cmLocalUnixMakefileGenerator3 depends.push_back(".hpux_make_needs_suffix_list"); this->WriteMakeRule(makefileStream, 0, ".SUFFIXES", depends, no_commands, false); - if(this->WatcomWMake) + if(this->IsWatcomWMake()) { // Switch on WMake feature, if an error or interrupt occurs during // makefile processing, the current target being made may be deleted @@ -828,7 +828,7 @@ cmLocalUnixMakefileGenerator3 << "VERBOSE = 1\n" << "\n"; } - if(this->WatcomWMake) + if(this->IsWatcomWMake()) { makefileStream << "!ifndef VERBOSE\n" @@ -962,7 +962,7 @@ cmLocalUnixMakefileGenerator3 void cmLocalUnixMakefileGenerator3::AppendFlags(std::string& flags, const std::string& newFlags) { - if(this->WatcomWMake && !newFlags.empty()) + if(this->IsWatcomWMake() && !newFlags.empty()) { std::string newf = newFlags; if(newf.find("\\\"") != newf.npos) @@ -1112,7 +1112,7 @@ cmLocalUnixMakefileGenerator3 // bool useCall = false; - if (this->WindowsShell) + if (this->IsWindowsShell()) { std::string suffix; if (cmd.size() > 4) @@ -1179,7 +1179,7 @@ cmLocalUnixMakefileGenerator3 { cmd = "call " + cmd; } - else if (this->NMake && cmd[0]=='"') + else if (this->IsNMake() && cmd[0]=='"') { cmd = "echo >nul && " + cmd; } @@ -2344,7 +2344,7 @@ void cmLocalUnixMakefileGenerator3 // used by NMake and Borland make does not support "cd /d" so this // feature simply cannot work with them (Borland make does not even // support changing the drive letter with just "d:"). - const char* cd_cmd = this->MinGWMake? "cd /d " : "cd "; + const char* cd_cmd = this->IsMinGWMake() ? "cd /d " : "cd "; if(!this->UnixCD) { diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 4e48ad7..7b436a5 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -81,36 +81,6 @@ public: std::string &GetMakeSilentFlag() { return this->MakeSilentFlag; } /** - * Set to true if the shell being used is the windows shell. - * This controls if statements in the makefile and the SHELL variable. - * The default is false. - */ - void SetWindowsShell(bool v) {this->WindowsShell = v;} - - /** - * Set to true if the make tool being used is Watcom WMake. - */ - void SetWatcomWMake(bool v) {this->WatcomWMake = v;} - - /** - * Set to true if the make tool being used is MinGW Make. - */ - void SetMinGWMake(bool v) {this->MinGWMake = v;} - bool IsMinGWMake() const { return this->MinGWMake; } - - /** - * Set to true if the make tool being used is NMake. - */ - void SetNMake(bool v) {this->NMake = v;} - - /** - * Set to true if the shell being used is the MSYS shell. - * This controls if statements in the makefile and the SHELL variable. - * The default is false. - */ - void SetMSYSShell(bool v) {this->MSYSShell = v;} - - /** * If set to true, then NULL is set to nil for non Windows_NT. * This uses make syntax used by nmake and borland. * The default is false. diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index f95d09b..4a596d5 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -23,8 +23,6 @@ cmLocalVisualStudioGenerator cmLocalGenerator* parent) : cmLocalGenerator(gg, parent) { - this->WindowsShell = true; - this->WindowsVSIDE = true; this->Version = v; } ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Wed May 6 00:01:09 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 6 May 2015 00:01:09 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.2-1055-g3bc6f4f Message-ID: <20150506040109.C3B03AFA21@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 3bc6f4f4762ba32d77b229e3385a8084015369b2 (commit) from 2c5a1bff237f240faf9a45860b0007a44e2d6205 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3bc6f4f4762ba32d77b229e3385a8084015369b2 commit 3bc6f4f4762ba32d77b229e3385a8084015369b2 Author: Kitware Robot AuthorDate: Wed May 6 00:01:06 2015 -0400 Commit: Kitware Robot CommitDate: Wed May 6 00:01:06 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8a73f00..76d3865 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 2) -set(CMake_VERSION_PATCH 20150505) +set(CMake_VERSION_PATCH 20150506) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From steveire at gmail.com Wed May 6 02:01:29 2015 From: steveire at gmail.com (Stephen Kelly) Date: Wed, 6 May 2015 02:01:29 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2565-gdd08530 Message-ID: <20150506060130.02A90AFAA8@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, next has been updated via dd08530978146a806014c6778f472db667899378 (commit) via 1aa99bb34441cde7954054ed9b24faf25c90ee40 (commit) from 52d911c79caa96c0a08bf138c2df2dcfd477f388 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dd08530978146a806014c6778f472db667899378 commit dd08530978146a806014c6778f472db667899378 Merge: 52d911c 1aa99bb Author: Stephen Kelly AuthorDate: Wed May 6 02:01:26 2015 -0400 Commit: CMake Topic Stage CommitDate: Wed May 6 02:01:26 2015 -0400 Merge topic 'improve-policies-documentation' into next 1aa99bb3 fixup! Help: Extract Policy doc subtitles from cmPolicies.h http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1aa99bb34441cde7954054ed9b24faf25c90ee40 commit 1aa99bb34441cde7954054ed9b24faf25c90ee40 Author: Stephen Kelly AuthorDate: Wed May 6 08:00:56 2015 +0200 Commit: Stephen Kelly CommitDate: Wed May 6 08:00:56 2015 +0200 fixup! Help: Extract Policy doc subtitles from cmPolicies.h diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 226b43d..04d5f10 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -157,7 +157,8 @@ class cmPolicy; 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0033, \ "The export_library_dependencies command should not be called.", \ - "The :command:`export_library_dependencies()` command should not be called.", \ + "The :command:`export_library_dependencies()` command should not be " \ + "called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0034, \ "The utility_source command should not be called.", \ ----------------------------------------------------------------------- Summary of changes: Source/cmPolicies.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From steveire at gmail.com Wed May 6 02:02:03 2015 From: steveire at gmail.com (Stephen Kelly) Date: Wed, 6 May 2015 02:02:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2567-gdcce21d Message-ID: <20150506060204.BAD1BAFAD0@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, next has been updated via dcce21d77e98066a420e28a253f112443002e8d0 (commit) via 6b707e196485bb00397c7152c388de64164f2c09 (commit) from dd08530978146a806014c6778f472db667899378 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dcce21d77e98066a420e28a253f112443002e8d0 commit dcce21d77e98066a420e28a253f112443002e8d0 Merge: dd08530 6b707e1 Author: Stephen Kelly AuthorDate: Wed May 6 02:02:02 2015 -0400 Commit: CMake Topic Stage CommitDate: Wed May 6 02:02:02 2015 -0400 Merge topic 'improve-policies-documentation' into next 6b707e19 Help: Extract Policy doc subtitles from cmPolicies.h http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6b707e196485bb00397c7152c388de64164f2c09 commit 6b707e196485bb00397c7152c388de64164f2c09 Author: Stephen Kelly AuthorDate: Tue May 5 18:45:15 2015 +0200 Commit: Stephen Kelly CommitDate: Wed May 6 08:01:36 2015 +0200 Help: Extract Policy doc subtitles from cmPolicies.h Add a new cmake-policy directive and use it in each policy document. Add API to cmPolicies to access it, and teach cmRST to process the new directive. Extend the data table in cmPolicies to include an optional RST formatted string. The documentation used in the cmake-policies toctree must be unformatted so limited duplication (in one file, instead of spread among multiple files) seems to be the correct approach. Extend the create-policy-list.py script to extract the RST formatted text, and use it if present. diff --git a/Help/policy/CMP0000.rst b/Help/policy/CMP0000.rst index 9fbf842..e3c00e8a 100644 --- a/Help/policy/CMP0000.rst +++ b/Help/policy/CMP0000.rst @@ -1,7 +1,7 @@ CMP0000 ------- -A minimum required CMake version must be specified. +.. cmake-policy:: CMP0000 CMake requires that projects specify the version of CMake to which they have been written. This policy has been put in place so users diff --git a/Help/policy/CMP0001.rst b/Help/policy/CMP0001.rst index 344f1e2..34d2f7d 100644 --- a/Help/policy/CMP0001.rst +++ b/Help/policy/CMP0001.rst @@ -1,7 +1,7 @@ CMP0001 ------- -CMAKE_BACKWARDS_COMPATIBILITY should no longer be used. +.. cmake-policy:: CMP0001 The OLD behavior is to check CMAKE_BACKWARDS_COMPATIBILITY and present it to the user. The NEW behavior is to ignore diff --git a/Help/policy/CMP0002.rst b/Help/policy/CMP0002.rst index 2c15bd4..105d1ee 100644 --- a/Help/policy/CMP0002.rst +++ b/Help/policy/CMP0002.rst @@ -1,7 +1,7 @@ CMP0002 ------- -Logical target names must be globally unique. +.. cmake-policy:: CMP0002 Targets names created with add_executable, add_library, or add_custom_target are logical build target names. Logical target diff --git a/Help/policy/CMP0003.rst b/Help/policy/CMP0003.rst index 27b83f8..7c5007f 100644 --- a/Help/policy/CMP0003.rst +++ b/Help/policy/CMP0003.rst @@ -1,7 +1,7 @@ CMP0003 ------- -Libraries linked via full path no longer produce linker search paths. +.. cmake-policy:: CMP0003 This policy affects how libraries whose full paths are NOT known are found at link time, but was created due to a change in how CMake deals diff --git a/Help/policy/CMP0004.rst b/Help/policy/CMP0004.rst index 80045f5..b06e214 100644 --- a/Help/policy/CMP0004.rst +++ b/Help/policy/CMP0004.rst @@ -1,7 +1,7 @@ CMP0004 ------- -Libraries linked may not have leading or trailing whitespace. +.. cmake-policy:: CMP0004 CMake versions 2.4 and below silently removed leading and trailing whitespace from libraries linked with code like diff --git a/Help/policy/CMP0005.rst b/Help/policy/CMP0005.rst index c11a9e6..b86f550 100644 --- a/Help/policy/CMP0005.rst +++ b/Help/policy/CMP0005.rst @@ -1,7 +1,7 @@ CMP0005 ------- -Preprocessor definition values are now escaped automatically. +.. cmake-policy:: CMP0005 This policy determines whether or not CMake should generate escaped preprocessor definition values added via add_definitions. CMake diff --git a/Help/policy/CMP0006.rst b/Help/policy/CMP0006.rst index 8d1e5bd..abce5c5 100644 --- a/Help/policy/CMP0006.rst +++ b/Help/policy/CMP0006.rst @@ -1,7 +1,7 @@ CMP0006 ------- -Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION. +.. cmake-policy:: CMP0006 This policy determines whether the install(TARGETS) command must be given a BUNDLE DESTINATION when asked to install a target with the diff --git a/Help/policy/CMP0007.rst b/Help/policy/CMP0007.rst index f0d8c16..7cbc47d 100644 --- a/Help/policy/CMP0007.rst +++ b/Help/policy/CMP0007.rst @@ -1,7 +1,7 @@ CMP0007 ------- -list command no longer ignores empty elements. +.. cmake-policy:: CMP0007 This policy determines whether the list command will ignore empty elements in the list. CMake 2.4 and below list commands ignored all diff --git a/Help/policy/CMP0008.rst b/Help/policy/CMP0008.rst index b118ece..a02493e 100644 --- a/Help/policy/CMP0008.rst +++ b/Help/policy/CMP0008.rst @@ -1,7 +1,7 @@ CMP0008 ------- -Libraries linked by full-path must have a valid library file name. +.. cmake-policy:: CMP0008 In CMake 2.4 and below it is possible to write code like diff --git a/Help/policy/CMP0009.rst b/Help/policy/CMP0009.rst index 481af1a..f0a209e 100644 --- a/Help/policy/CMP0009.rst +++ b/Help/policy/CMP0009.rst @@ -1,7 +1,7 @@ CMP0009 ------- -FILE GLOB_RECURSE calls should not follow symlinks by default. +.. cmake-policy:: CMP0009 In CMake 2.6.1 and below, FILE GLOB_RECURSE calls would follow through symlinks, sometimes coming up with unexpectedly large result sets diff --git a/Help/policy/CMP0010.rst b/Help/policy/CMP0010.rst index 9d2eb76..1cf549b 100644 --- a/Help/policy/CMP0010.rst +++ b/Help/policy/CMP0010.rst @@ -1,7 +1,7 @@ CMP0010 ------- -Bad variable reference syntax is an error. +.. cmake-policy:: CMP0010 In CMake 2.6.2 and below, incorrect variable reference syntax such as a missing close-brace ("${FOO") was reported but did not stop diff --git a/Help/policy/CMP0011.rst b/Help/policy/CMP0011.rst index 0f41fff..1ca4ff1 100644 --- a/Help/policy/CMP0011.rst +++ b/Help/policy/CMP0011.rst @@ -1,7 +1,7 @@ CMP0011 ------- -Included scripts do automatic cmake_policy PUSH and POP. +.. cmake-policy:: CMP0011 In CMake 2.6.2 and below, CMake Policy settings in scripts loaded by the include() and find_package() commands would affect the includer. diff --git a/Help/policy/CMP0012.rst b/Help/policy/CMP0012.rst index 7a749bf..63d1a52 100644 --- a/Help/policy/CMP0012.rst +++ b/Help/policy/CMP0012.rst @@ -1,7 +1,7 @@ CMP0012 ------- -if() recognizes numbers and boolean constants. +.. cmake-policy:: CMP0012 In CMake versions 2.6.4 and lower the if() command implicitly dereferenced arguments corresponding to variables, even those named diff --git a/Help/policy/CMP0013.rst b/Help/policy/CMP0013.rst index e99997b..a6ec06a 100644 --- a/Help/policy/CMP0013.rst +++ b/Help/policy/CMP0013.rst @@ -1,7 +1,7 @@ CMP0013 ------- -Duplicate binary directories are not allowed. +.. cmake-policy:: CMP0013 CMake 2.6.3 and below silently permitted add_subdirectory() calls to create the same binary directory multiple times. During build system diff --git a/Help/policy/CMP0014.rst b/Help/policy/CMP0014.rst index 37178d1..8c34caa 100644 --- a/Help/policy/CMP0014.rst +++ b/Help/policy/CMP0014.rst @@ -1,7 +1,7 @@ CMP0014 ------- -Input directories must have CMakeLists.txt. +.. cmake-policy:: CMP0014 CMake versions before 2.8 silently ignored missing CMakeLists.txt files in directories referenced by add_subdirectory() or subdirs(), diff --git a/Help/policy/CMP0015.rst b/Help/policy/CMP0015.rst index 1b54979..5067e03 100644 --- a/Help/policy/CMP0015.rst +++ b/Help/policy/CMP0015.rst @@ -1,7 +1,7 @@ CMP0015 ------- -link_directories() treats paths relative to the source dir. +.. cmake-policy:: CMP0015 In CMake 2.8.0 and lower the link_directories() command passed relative paths unchanged to the linker. In CMake 2.8.1 and above the diff --git a/Help/policy/CMP0016.rst b/Help/policy/CMP0016.rst index 743b1a9..c818da3 100644 --- a/Help/policy/CMP0016.rst +++ b/Help/policy/CMP0016.rst @@ -1,7 +1,7 @@ CMP0016 ------- -target_link_libraries() reports error if its only argument is not a target. +.. cmake-policy:: CMP0016 In CMake 2.8.2 and lower the target_link_libraries() command silently ignored if it was called with only one argument, and this argument diff --git a/Help/policy/CMP0017.rst b/Help/policy/CMP0017.rst index f74e6f0..01b7d93 100644 --- a/Help/policy/CMP0017.rst +++ b/Help/policy/CMP0017.rst @@ -1,7 +1,7 @@ CMP0017 ------- -Prefer files from the CMake module directory when including from there. +.. cmake-policy:: CMP0017 Starting with CMake 2.8.4, if a cmake-module shipped with CMake (i.e. located in the CMake module directory) calls include() or diff --git a/Help/policy/CMP0018.rst b/Help/policy/CMP0018.rst index 0f68267..1ebea5e 100644 --- a/Help/policy/CMP0018.rst +++ b/Help/policy/CMP0018.rst @@ -1,7 +1,7 @@ CMP0018 ------- -Ignore CMAKE_SHARED_LIBRARY__FLAGS variable. +.. cmake-policy:: CMP0018 CMake 2.8.8 and lower compiled sources in SHARED and MODULE libraries using the value of the undocumented CMAKE_SHARED_LIBRARY__FLAGS diff --git a/Help/policy/CMP0019.rst b/Help/policy/CMP0019.rst index 2b37fa1..114c5fc 100644 --- a/Help/policy/CMP0019.rst +++ b/Help/policy/CMP0019.rst @@ -1,7 +1,7 @@ CMP0019 ------- -Do not re-expand variables in include and link information. +.. cmake-policy:: CMP0019 CMake 2.8.10 and lower re-evaluated values given to the include_directories, link_directories, and link_libraries commands to diff --git a/Help/policy/CMP0020.rst b/Help/policy/CMP0020.rst index 6767d08..4e4476c 100644 --- a/Help/policy/CMP0020.rst +++ b/Help/policy/CMP0020.rst @@ -1,7 +1,7 @@ CMP0020 ------- -Automatically link Qt executables to qtmain target on Windows. +.. cmake-policy:: CMP0020 CMake 2.8.10 and lower required users of Qt to always specify a link dependency to the qtmain.lib static library manually on Windows. diff --git a/Help/policy/CMP0021.rst b/Help/policy/CMP0021.rst index 3f5bd03..18f2b40 100644 --- a/Help/policy/CMP0021.rst +++ b/Help/policy/CMP0021.rst @@ -1,7 +1,7 @@ CMP0021 ------- -Fatal error on relative paths in INCLUDE_DIRECTORIES target property. +.. cmake-policy:: CMP0021 CMake 2.8.10.2 and lower allowed the INCLUDE_DIRECTORIES target property to contain relative paths. The base path for such relative diff --git a/Help/policy/CMP0022.rst b/Help/policy/CMP0022.rst index 22c7c4f..b8d6ecb 100644 --- a/Help/policy/CMP0022.rst +++ b/Help/policy/CMP0022.rst @@ -1,7 +1,7 @@ CMP0022 ------- -INTERFACE_LINK_LIBRARIES defines the link interface. +.. cmake-policy:: CMP0022 CMake 2.8.11 constructed the 'link interface' of a target from properties matching ``(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_)?``. diff --git a/Help/policy/CMP0023.rst b/Help/policy/CMP0023.rst index 962b624..5063787 100644 --- a/Help/policy/CMP0023.rst +++ b/Help/policy/CMP0023.rst @@ -1,7 +1,7 @@ CMP0023 ------- -Plain and keyword target_link_libraries signatures cannot be mixed. +.. cmake-policy:: CMP0023 CMake 2.8.12 introduced the target_link_libraries signature using the PUBLIC, PRIVATE, and INTERFACE keywords to generalize the LINK_PUBLIC diff --git a/Help/policy/CMP0024.rst b/Help/policy/CMP0024.rst index ee53d5f..b4c4c92 100644 --- a/Help/policy/CMP0024.rst +++ b/Help/policy/CMP0024.rst @@ -1,7 +1,7 @@ CMP0024 ------- -Disallow include export result. +.. cmake-policy:: CMP0024 CMake 2.8.12 and lower allowed use of the include() command with the result of the export() command. This relies on the assumption that diff --git a/Help/policy/CMP0025.rst b/Help/policy/CMP0025.rst index 8d19edf..bfc4687 100644 --- a/Help/policy/CMP0025.rst +++ b/Help/policy/CMP0025.rst @@ -1,7 +1,7 @@ CMP0025 ------- -Compiler id for Apple Clang is now ``AppleClang``. +.. cmake-policy:: CMP0025 CMake 3.0 and above recognize that Apple Clang is a different compiler than upstream Clang and that they have different version numbers. diff --git a/Help/policy/CMP0026.rst b/Help/policy/CMP0026.rst index 4889249..5b42a1e 100644 --- a/Help/policy/CMP0026.rst +++ b/Help/policy/CMP0026.rst @@ -1,7 +1,7 @@ CMP0026 ------- -Disallow use of the LOCATION property for build targets. +.. cmake-policy:: CMP0026 CMake 2.8.12 and lower allowed reading the LOCATION target property (and configuration-specific variants) to diff --git a/Help/policy/CMP0027.rst b/Help/policy/CMP0027.rst index bedaffe..f2af8ac 100644 --- a/Help/policy/CMP0027.rst +++ b/Help/policy/CMP0027.rst @@ -1,7 +1,7 @@ CMP0027 ------- -Conditionally linked imported targets with missing include directories. +.. cmake-policy:: CMP0027 CMake 2.8.11 introduced introduced the concept of INTERFACE_INCLUDE_DIRECTORIES, and a check at cmake time that the diff --git a/Help/policy/CMP0028.rst b/Help/policy/CMP0028.rst index 24889ec..db58231 100644 --- a/Help/policy/CMP0028.rst +++ b/Help/policy/CMP0028.rst @@ -1,7 +1,7 @@ CMP0028 ------- -Double colon in target name means ALIAS or IMPORTED target. +.. cmake-policy:: CMP0028 CMake 2.8.12 and lower allowed the use of targets and files with double colons in target_link_libraries, with some buildsystem generators. diff --git a/Help/policy/CMP0029.rst b/Help/policy/CMP0029.rst index 8f58a12..70a8909 100644 --- a/Help/policy/CMP0029.rst +++ b/Help/policy/CMP0029.rst @@ -1,7 +1,7 @@ CMP0029 ------- -The :command:`subdir_depends` command should not be called. +.. cmake-policy:: CMP0029 The implementation of this command has been empty since December 2001 but was kept in CMake for compatibility for a long time. diff --git a/Help/policy/CMP0030.rst b/Help/policy/CMP0030.rst index 9e31b38..98bc070 100644 --- a/Help/policy/CMP0030.rst +++ b/Help/policy/CMP0030.rst @@ -1,7 +1,7 @@ CMP0030 ------- -The :command:`use_mangled_mesa` command should not be called. +.. cmake-policy:: CMP0030 This command was created in September 2001 to support VTK before modern CMake language and custom command capabilities. VTK has diff --git a/Help/policy/CMP0031.rst b/Help/policy/CMP0031.rst index 6b89558..857eb16 100644 --- a/Help/policy/CMP0031.rst +++ b/Help/policy/CMP0031.rst @@ -1,7 +1,7 @@ CMP0031 ------- -The :command:`load_command` command should not be called. +.. cmake-policy:: CMP0031 This command was added in August 2002 to allow projects to add arbitrary commands implemented in C or C++. However, it does diff --git a/Help/policy/CMP0032.rst b/Help/policy/CMP0032.rst index f394a06..e4e59d5 100644 --- a/Help/policy/CMP0032.rst +++ b/Help/policy/CMP0032.rst @@ -1,7 +1,7 @@ CMP0032 ------- -The :command:`output_required_files` command should not be called. +.. cmake-policy:: CMP0032 This command was added in June 2001 to expose the then-current CMake implicit dependency scanner. CMake's real implicit dependency scanner diff --git a/Help/policy/CMP0033.rst b/Help/policy/CMP0033.rst index b420065..7709d81 100644 --- a/Help/policy/CMP0033.rst +++ b/Help/policy/CMP0033.rst @@ -1,7 +1,7 @@ CMP0033 ------- -The :command:`export_library_dependencies` command should not be called. +.. cmake-policy:: CMP0033 This command was added in January 2003 to export ``_LIB_DEPENDS`` internal CMake cache entries to a file for installation with a project. diff --git a/Help/policy/CMP0034.rst b/Help/policy/CMP0034.rst index 2133997..3755d08 100644 --- a/Help/policy/CMP0034.rst +++ b/Help/policy/CMP0034.rst @@ -1,7 +1,7 @@ CMP0034 ------- -The :command:`utility_source` command should not be called. +.. cmake-policy:: CMP0034 This command was introduced in March 2001 to help build executables used to generate other files. This approach has long been replaced by diff --git a/Help/policy/CMP0035.rst b/Help/policy/CMP0035.rst index 7335b22..75b8189 100644 --- a/Help/policy/CMP0035.rst +++ b/Help/policy/CMP0035.rst @@ -1,7 +1,7 @@ CMP0035 ------- -The :command:`variable_requires` command should not be called. +.. cmake-policy:: CMP0035 This command was introduced in November 2001 to perform some conditional logic. It has long been replaced by the :command:`if` command. diff --git a/Help/policy/CMP0036.rst b/Help/policy/CMP0036.rst index 817f156..be13726 100644 --- a/Help/policy/CMP0036.rst +++ b/Help/policy/CMP0036.rst @@ -1,7 +1,7 @@ CMP0036 ------- -The :command:`build_name` command should not be called. +.. cmake-policy:: CMP0036 This command was added in May 2001 to compute a name for the current operating system and compiler combination. The command has long been diff --git a/Help/policy/CMP0037.rst b/Help/policy/CMP0037.rst index 4d485bf..3107e50 100644 --- a/Help/policy/CMP0037.rst +++ b/Help/policy/CMP0037.rst @@ -1,7 +1,7 @@ CMP0037 ------- -Target names should not be reserved and should match a validity pattern. +.. cmake-policy:: CMP0037 CMake 2.8.12 and lower allowed creating targets using :command:`add_library`, :command:`add_executable` and :command:`add_custom_target` with unrestricted diff --git a/Help/policy/CMP0038.rst b/Help/policy/CMP0038.rst index df5af6a..b094db3 100644 --- a/Help/policy/CMP0038.rst +++ b/Help/policy/CMP0038.rst @@ -1,7 +1,7 @@ CMP0038 ------- -Targets may not link directly to themselves. +.. cmake-policy:: CMP0038 CMake 2.8.12 and lower allowed a build target to link to itself directly with a :command:`target_link_libraries` call. This is an indicator of a bug in diff --git a/Help/policy/CMP0039.rst b/Help/policy/CMP0039.rst index 58ccc41..4477d2a 100644 --- a/Help/policy/CMP0039.rst +++ b/Help/policy/CMP0039.rst @@ -1,7 +1,7 @@ CMP0039 ------- -Utility targets may not have link dependencies. +.. cmake-policy:: CMP0039 CMake 2.8.12 and lower allowed using utility targets in the left hand side position of the :command:`target_link_libraries` command. This is an indicator diff --git a/Help/policy/CMP0040.rst b/Help/policy/CMP0040.rst index 77a3c81..7e72ee2 100644 --- a/Help/policy/CMP0040.rst +++ b/Help/policy/CMP0040.rst @@ -1,7 +1,7 @@ CMP0040 ------- -The target in the TARGET signature of add_custom_command() must exist. +.. cmake-policy:: CMP0040 CMake 2.8.12 and lower silently ignored a custom command created with the TARGET signature of :command:`add_custom_command` diff --git a/Help/policy/CMP0041.rst b/Help/policy/CMP0041.rst index 5a47de0..975626d 100644 --- a/Help/policy/CMP0041.rst +++ b/Help/policy/CMP0041.rst @@ -1,7 +1,7 @@ CMP0041 ------- -Error on relative include with generator expression. +.. cmake-policy:: CMP0041 Diagnostics in CMake 2.8.12 and lower silently ignored an entry in the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of a target if it contained a generator diff --git a/Help/policy/CMP0042.rst b/Help/policy/CMP0042.rst index fce870c..c385e57 100644 --- a/Help/policy/CMP0042.rst +++ b/Help/policy/CMP0042.rst @@ -1,7 +1,7 @@ CMP0042 ------- -:prop_tgt:`MACOSX_RPATH` is enabled by default. +.. cmake-policy:: CMP0042 CMake 2.8.12 and newer has support for using ``@rpath`` in a target's install name. This was enabled by setting the target property diff --git a/Help/policy/CMP0043.rst b/Help/policy/CMP0043.rst index 629e502..93fd911 100644 --- a/Help/policy/CMP0043.rst +++ b/Help/policy/CMP0043.rst @@ -1,7 +1,7 @@ CMP0043 ------- -Ignore COMPILE_DEFINITIONS_ properties +.. cmake-policy:: CMP0043 CMake 2.8.12 and lower allowed setting the :prop_tgt:`COMPILE_DEFINITIONS_` target property and diff --git a/Help/policy/CMP0044.rst b/Help/policy/CMP0044.rst index 4a3e215..a980c90 100644 --- a/Help/policy/CMP0044.rst +++ b/Help/policy/CMP0044.rst @@ -1,7 +1,7 @@ CMP0044 ------- -Case sensitive ``_COMPILER_ID`` generator expressions +.. cmake-policy:: CMP0044 CMake 2.8.12 introduced the ``_COMPILER_ID`` :manual:`generator expressions ` to allow diff --git a/Help/policy/CMP0045.rst b/Help/policy/CMP0045.rst index 58c422f..a7eac7b 100644 --- a/Help/policy/CMP0045.rst +++ b/Help/policy/CMP0045.rst @@ -1,7 +1,7 @@ CMP0045 ------- -Error on non-existent target in get_target_property. +.. cmake-policy:: CMP0045 In CMake 2.8.12 and lower, the :command:`get_target_property` command accepted a non-existent target argument without issuing any error or warning. The diff --git a/Help/policy/CMP0046.rst b/Help/policy/CMP0046.rst index 1a3bc65..e03b632 100644 --- a/Help/policy/CMP0046.rst +++ b/Help/policy/CMP0046.rst @@ -1,7 +1,7 @@ CMP0046 ------- -Error on non-existent dependency in add_dependencies. +.. cmake-policy:: CMP0046 CMake 2.8.12 and lower silently ignored non-existent dependencies listed in the :command:`add_dependencies` command. diff --git a/Help/policy/CMP0047.rst b/Help/policy/CMP0047.rst index 26ae439..86e6a89 100644 --- a/Help/policy/CMP0047.rst +++ b/Help/policy/CMP0047.rst @@ -1,7 +1,7 @@ CMP0047 ------- -Use ``QCC`` compiler id for the qcc drivers on QNX. +.. cmake-policy:: CMP0047 CMake 3.0 and above recognize that the QNX qcc compiler driver is different from the GNU compiler. diff --git a/Help/policy/CMP0048.rst b/Help/policy/CMP0048.rst index a54205e..25e23bd 100644 --- a/Help/policy/CMP0048.rst +++ b/Help/policy/CMP0048.rst @@ -1,7 +1,7 @@ CMP0048 ------- -The :command:`project` command manages VERSION variables. +.. cmake-policy:: CMP0048 CMake version 3.0 introduced the ``VERSION`` option of the :command:`project` command to specify a project version as well as the name. In order to keep diff --git a/Help/policy/CMP0049.rst b/Help/policy/CMP0049.rst index 5c8d4a8..b95d811 100644 --- a/Help/policy/CMP0049.rst +++ b/Help/policy/CMP0049.rst @@ -1,7 +1,7 @@ CMP0049 ------- -Do not expand variables in target source entries. +.. cmake-policy:: CMP0049 CMake 2.8.12 and lower performed and extra layer of variable expansion when evaluating source file names: diff --git a/Help/policy/CMP0050.rst b/Help/policy/CMP0050.rst index 76ae0aa..e4c6735 100644 --- a/Help/policy/CMP0050.rst +++ b/Help/policy/CMP0050.rst @@ -1,7 +1,7 @@ CMP0050 ------- -Disallow add_custom_command SOURCE signatures. +.. cmake-policy:: CMP0050 CMake 2.8.12 and lower allowed a signature for :command:`add_custom_command` which specified an input to a command. This was undocumented behavior. diff --git a/Help/policy/CMP0051.rst b/Help/policy/CMP0051.rst index 1b56cb0..19e1b37 100644 --- a/Help/policy/CMP0051.rst +++ b/Help/policy/CMP0051.rst @@ -1,7 +1,7 @@ CMP0051 ------- -List TARGET_OBJECTS in SOURCES target property. +.. cmake-policy:: CMP0051 CMake 3.0 and lower did not include the ``TARGET_OBJECTS`` :manual:`generator expression ` when diff --git a/Help/policy/CMP0052.rst b/Help/policy/CMP0052.rst index 48cfc9c..5a86f8a 100644 --- a/Help/policy/CMP0052.rst +++ b/Help/policy/CMP0052.rst @@ -1,7 +1,7 @@ CMP0052 ------- -Reject source and build dirs in installed INTERFACE_INCLUDE_DIRECTORIES. +.. cmake-policy:: CMP0052 CMake 3.0 and lower allowed subdirectories of the source directory or build directory to be in the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of diff --git a/Help/policy/CMP0053.rst b/Help/policy/CMP0053.rst index bb0ff8b..5d1bb34 100644 --- a/Help/policy/CMP0053.rst +++ b/Help/policy/CMP0053.rst @@ -1,7 +1,7 @@ CMP0053 ------- -Simplify variable reference and escape sequence evaluation. +.. cmake-policy:: CMP0053 CMake 3.1 introduced a much faster implementation of evaluation of the :ref:`Variable References` and :ref:`Escape Sequences` documented in the diff --git a/Help/policy/CMP0054.rst b/Help/policy/CMP0054.rst index 3754fda..6e72b1c 100644 --- a/Help/policy/CMP0054.rst +++ b/Help/policy/CMP0054.rst @@ -1,7 +1,7 @@ CMP0054 ------- -Only interpret :command:`if` arguments as variables or keywords when unquoted. +.. cmake-policy:: CMP0054 CMake 3.1 and above no longer implicitly dereference variables or interpret keywords in an :command:`if` command argument when diff --git a/Help/policy/CMP0055.rst b/Help/policy/CMP0055.rst index fe7ab6f..a64f85b 100644 --- a/Help/policy/CMP0055.rst +++ b/Help/policy/CMP0055.rst @@ -1,7 +1,7 @@ CMP0055 ------- -Strict checking for the :command:`break` command. +.. cmake-policy:: CMP0055 CMake 3.1 and lower allowed calls to the :command:`break` command outside of a loop context and also ignored any given arguments. diff --git a/Help/policy/CMP0056.rst b/Help/policy/CMP0056.rst index 3c75ff4..3fa0889 100644 --- a/Help/policy/CMP0056.rst +++ b/Help/policy/CMP0056.rst @@ -1,7 +1,7 @@ CMP0056 ------- -Honor link flags in :command:`try_compile` source-file signature. +.. cmake-policy:: CMP0056 The :command:`try_compile` command source-file signature generates a ``CMakeLists.txt`` file to build the source file into an executable. diff --git a/Help/policy/CMP0057.rst b/Help/policy/CMP0057.rst index 1298a16..ef18ac4 100644 --- a/Help/policy/CMP0057.rst +++ b/Help/policy/CMP0057.rst @@ -1,7 +1,7 @@ CMP0057 ------- -Support new :command:`if` IN_LIST operator. +.. cmake-policy:: CMP0057 CMake 3.3 adds support for the new IN_LIST operator. diff --git a/Help/policy/CMP0058.rst b/Help/policy/CMP0058.rst index 0f20383..1d0c0a9 100644 --- a/Help/policy/CMP0058.rst +++ b/Help/policy/CMP0058.rst @@ -1,7 +1,7 @@ CMP0058 ------- -Ninja requires custom command byproducts to be explicit. +.. cmake-policy:: CMP0058 When an intermediate file generated during the build is consumed by an expensive operation or a large tree of dependents, one may diff --git a/Help/policy/CMP0059.rst b/Help/policy/CMP0059.rst index e40f450..cc717a5 100644 --- a/Help/policy/CMP0059.rst +++ b/Help/policy/CMP0059.rst @@ -1,7 +1,7 @@ CMP0059 ------- -Don't treat ``DEFINITIONS`` as a built-in directory property. +.. cmake-policy:: CMP0059 CMake 3.3 and above no longer make a list of definitions available through the :prop_dir:`DEFINITIONS` directory property. The diff --git a/Help/policy/CMP0060.rst b/Help/policy/CMP0060.rst index cc37b1b..b249f84 100644 --- a/Help/policy/CMP0060.rst +++ b/Help/policy/CMP0060.rst @@ -1,7 +1,7 @@ CMP0060 ------- -Link libraries by full path even in implicit directories. +.. cmake-policy:: CMP0060 Policy :policy:`CMP0003` was introduced with the intention of always linking library files by full path when a full path is given to the diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index f8d61db..599c174 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -45,14 +45,18 @@ static bool stringToId(const char* input, cmPolicies::PolicyID& pid) return true; } -#define CM_SELECT_ID_VERSION(F, A1, A2, A3, A4, A5, A6) F(A1, A3, A4, A5) +#define CM_SELECT_ID_VERSION(F, A1, A2, A3, A4, A5, A6, A7) F(A1, A4, A5, A6) #define CM_FOR_EACH_POLICY_ID_VERSION(POLICY) \ CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID_VERSION) -#define CM_SELECT_ID_DOC(F, A1, A2, A3, A4, A5, A6) F(A1, A2) +#define CM_SELECT_ID_DOC(F, A1, A2, A3, A4, A5, A6, A7) F(A1, A2) #define CM_FOR_EACH_POLICY_ID_DOC(POLICY) \ CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID_DOC) +#define CM_SELECT_ID_RST(F, A1, A2, A3, A4, A5, A6, A7) F(A1, A3) +#define CM_FOR_EACH_POLICY_ID_RST(POLICY) \ + CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID_RST) + static const char* idToString(cmPolicies::PolicyID id) { switch(id) @@ -343,6 +347,21 @@ cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id) return e.str(); } +std::string cmPolicies::GetPolicyDocTitle(cmPolicies::PolicyID id) +{ + switch(id) + { +#define POLICY_CASE(ID, DOC_TITLE) \ + case cmPolicies::ID: \ + return DOC_TITLE; + CM_FOR_EACH_POLICY_ID_RST(POLICY_CASE) +#undef POLICY_CASE + case cmPolicies::CMPCOUNT: + return 0; + } + return 0; +} + cmPolicies::PolicyMap::PolicyMap() { this->UNDEFINED.set(); diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 63376dd..04d5f10 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -21,196 +21,261 @@ class cmPolicy; #define CM_FOR_EACH_POLICY_TABLE(POLICY, SELECT) \ SELECT(POLICY, CMP0000, \ - "A minimum required CMake version must be specified.", \ + "A minimum required CMake version must be specified.", 0, \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0001, \ "CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.", \ + ":variable:`CMAKE_BACKWARDS_COMPATIBILITY` should no longer be used.", \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0002, \ - "Logical target names must be globally unique.", \ + "Logical target names must be globally unique.", 0, \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0003, \ "Libraries linked via full path no longer produce linker search paths.", \ + 0, \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0004, \ - "Libraries linked may not have leading or trailing whitespace.", \ + "Libraries linked may not have leading or trailing whitespace.", 0, \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0005, \ - "Preprocessor definition values are now escaped automatically.", \ + "Preprocessor definition values are now escaped automatically.", 0, \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0006, \ "Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.", \ + "Installing :prop_tgt:`MACOSX_BUNDLE` targets requires a " \ + ":command:`BUNDLE DESTINATION `.", \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0007, \ "list command no longer ignores empty elements.", \ + ":command:`list()` command no longer ignores empty elements.", \ 2, 6, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0008, \ - "Libraries linked by full-path must have a valid library file name.", \ + "Libraries linked by full-path must have a valid library file name.", 0, \ 2, 6, 1, cmPolicies::WARN) \ SELECT(POLICY, CMP0009, \ "FILE GLOB_RECURSE calls should not follow symlinks by default.", \ + ":command:`file(GLOB_RECURSE)` calls should not follow symlinks by " \ + "default.", \ 2, 6, 2, cmPolicies::WARN) \ SELECT(POLICY, CMP0010, \ - "Bad variable reference syntax is an error.", \ + "Bad variable reference syntax is an error.", 0, \ 2, 6, 3, cmPolicies::WARN) \ SELECT(POLICY, CMP0011, \ "Included scripts do automatic cmake_policy PUSH and POP.", \ + ":command:`Included ` scripts do automatic " \ + ":command:`cmake_policy` ``PUSH`` and ``POP``.", \ 2, 6, 3, cmPolicies::WARN) \ SELECT(POLICY, CMP0012, \ "if() recognizes numbers and boolean constants.", \ + ":command:`if()` recognizes numbers and boolean constants.", \ 2, 8, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0013, \ - "Duplicate binary directories are not allowed.", \ + "Duplicate binary directories are not allowed.", 0, \ 2, 8, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0014, \ - "Input directories must have CMakeLists.txt.", \ + "Input directories must have CMakeLists.txt.", 0, \ 2, 8, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0015, \ "link_directories() treats paths relative to the source dir.", \ + ":command:`link_directories()` treats paths relative to the " \ + ":variable:`CMAKE_CURRENT_SOURCE_DIR`.", \ 2, 8, 1, cmPolicies::WARN) \ SELECT(POLICY, CMP0016, \ "target_link_libraries() reports error if its only argument " \ "is not a target.", \ + ":command:`target_link_libraries()` reports error if its only argument " \ + "is not a target.", \ 2, 8, 3, cmPolicies::WARN) \ SELECT(POLICY, CMP0017, \ "Prefer files from the CMake module directory when including from " \ - "there.", \ + "there.", 0, \ 2, 8, 4, cmPolicies::WARN) \ SELECT(POLICY, CMP0018, \ - "Ignore CMAKE_SHARED_LIBRARY__FLAGS variable.", \ + "Ignore CMAKE_SHARED_LIBRARY__FLAGS variable.", 0, \ 2, 8, 9, cmPolicies::WARN) \ SELECT(POLICY, CMP0019, \ - "Do not re-expand variables in include and link information.", \ + "Do not re-expand variables in include and link information.", 0, \ 2, 8, 11, cmPolicies::WARN) \ SELECT(POLICY, CMP0020, \ "Automatically link Qt executables to qtmain target on Windows.", \ + "Automatically link :manual:`Qt executables ` to qtmain " \ + "target on Windows.", \ 2, 8, 11, cmPolicies::WARN) \ SELECT(POLICY, CMP0021, \ "Fatal error on relative paths in INCLUDE_DIRECTORIES target property.", \ + "Fatal error on relative paths in :prop_tgt:`INCLUDE_DIRECTORIES` " \ + "target property.", \ 2, 8, 12, cmPolicies::WARN) \ SELECT(POLICY, CMP0022, \ "INTERFACE_LINK_LIBRARIES defines the link interface.", \ + ":prop_tgt:`INTERFACE_LINK_LIBRARIES` defines the link interface.", \ 2, 8, 12, cmPolicies::WARN) \ SELECT(POLICY, CMP0023, \ "Plain and keyword target_link_libraries signatures cannot be mixed.", \ + "Plain and keyword :command:`target_link_libraries()` signatures cannot " \ + "be mixed.", \ 2, 8, 12, cmPolicies::WARN) \ SELECT(POLICY, CMP0024, \ - "Disallow include export result.", \ + "Disallow include() of export() result.", \ + "Disallow :command:`include()` of :command:`export()` result.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0025, \ "Compiler id for Apple Clang is now AppleClang.", \ + ":variable:`Compiler id _COMPILER_ID>` for Apple Clang is " \ + "now ``AppleClang``.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0026, \ "Disallow use of the LOCATION target property.", \ + "Disallow use of the :prop_tgt:`LOCATION` target property.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0027, \ - "Conditionally linked imported targets with missing include " \ + "Conditionally linked IMPORTED targets with missing include " \ + "directories.", \ + "Conditionally linked :prop_tgt:`IMPORTED` targets with missing include " \ "directories.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0028, \ "Double colon in target name means ALIAS or IMPORTED target.", \ + "Double colon in target name means :ref:`ALIAS ` or " \ + ":ref:`IMPORTED ` target.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0029, \ "The subdir_depends command should not be called.", \ + "The :command:`subdir_depends()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0030, \ "The use_mangled_mesa command should not be called.", \ + "The :command:`use_mangled_mesa()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0031, \ "The load_command command should not be called.", \ + "The :command:`load_command()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0032, \ "The output_required_files command should not be called.", \ + "The :command:`output_required_files()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0033, \ "The export_library_dependencies command should not be called.", \ + "The :command:`export_library_dependencies()` command should not be " \ + "called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0034, \ "The utility_source command should not be called.", \ + "The :command:`utility_source()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0035, \ "The variable_requires command should not be called.", \ + "The :command:`variable_requires()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0036, \ "The build_name command should not be called.", \ + "The :command:`build_name()` command should not be called.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0037, \ "Target names should not be reserved and should match a validity " \ "pattern.", \ + "Target :prop_tgt:`names ` should not be reserved and should " \ + "match a validity pattern.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0038, \ - "Targets may not link directly to themselves.", \ + "Targets may not link directly to themselves.", 0, \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0039, \ - "Utility targets may not have link dependencies.", \ + "Utility targets may not have link dependencies.", 0, \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0040, \ "The target in the TARGET signature of add_custom_command() must " \ "exist.", \ + "The target in the ``TARGET`` signature of " \ + ":command:`add_custom_command()` must exist.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0041, \ "Error on relative include with generator expression.", \ + "Error on relative include with " \ + ":manual:`generator expression `.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0042, \ "MACOSX_RPATH is enabled by default.", \ + ":prop_tgt:`MACOSX_RPATH` is enabled by default.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0043, \ "Ignore COMPILE_DEFINITIONS_ properties.", \ + "Ignore ``COMPILE_DEFINITIONS_`` properties.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0044, \ "Case sensitive _COMPILER_ID generator expressions.", \ + "Case sensitive ``_COMPILER_ID`` " \ + ":manual:`generator expression `", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0045, \ "Error on non-existent target in get_target_property.", \ + "Error on non-existent target in :command:`get_target_property()`.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0046, \ "Error on non-existent dependency in add_dependencies.", \ + "Error on non-existent dependency in :command:`add_dependencies()`.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0047, \ "Use QCC compiler id for the qcc drivers on QNX.", \ + "Use ``QCC`` :variable:`compiler id _COMPILER_ID>` for " \ + "the qcc drivers on QNX.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0048, \ "project() command manages VERSION variables.", \ + ":command:`project()` command manages ``VERSION`` variables.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0049, \ - "Do not expand variables in target source entries.", \ + "Do not expand variables in target source entries.", 0, \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0050, \ "Disallow add_custom_command SOURCE signatures.", \ + "Disallow :command:`add_custom_command(SOURCE)` signatures.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0051, \ "List TARGET_OBJECTS in SOURCES target property.", \ + "List :manual:`TARGET_OBJECTS ` " \ + "in :prop_tgt:`SOURCES` target property.", \ 3, 1, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0052, \ "Reject source and build dirs in installed " \ "INTERFACE_INCLUDE_DIRECTORIES.", \ + "Reject source and build dirs in installed " \ + ":prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES`.", \ 3, 1, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0053, \ - "Simplify variable reference and escape sequence evaluation.", \ + "Simplify variable reference and escape sequence evaluation.", 0, \ 3, 1, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0054, \ "Only interpret if() arguments as variables or keywords when unquoted.", \ + "Only interpret :command:`if()` arguments as variables or keywords " \ + "when unquoted.", \ 3, 1, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0055, \ "Strict checking for break() command.", \ + "Strict checking for :command:`break()` command.", \ 3, 2, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0056, \ "Honor link flags in try_compile() source-file signature.", \ + "Honor link flags in :command:`try_compile()` source-file signature.", \ 3, 2, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0057, \ "Support new IN_LIST if() operator.", \ + "Support new ``IN_LIST`` :command:`if()` operator.", \ 3, 3, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0058, \ - "Ninja requires custom command byproducts to be explicit.", \ + "Ninja requires custom command byproducts to be explicit.", 0, \ 3, 3, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0059, \ - "Do no treat DEFINITIONS as a built-in directory property.", \ + "Do not treat DEFINITIONS as a built-in directory property.", \ + "Do not treat :prop_dir:`DEFINITIONS` as a built-in directory " \ + "property.", \ 3, 3, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0060, \ - "Link libraries by full path even in implicit directories.", \ + "Link libraries by full path even in implicit directories.", 0, \ 3, 3, 0, cmPolicies::WARN) -#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) +#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6, A7) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID) @@ -269,6 +334,8 @@ public: ///! return an error string for when a required policy is unspecified static std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id); + static std::string GetPolicyDocTitle(cmPolicies::PolicyID id); + /** Represent a set of policy values. */ struct PolicyMap { diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index cb61ed9..ff54621 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -14,6 +14,7 @@ #include "cmSystemTools.h" #include "cmAlgorithms.h" #include "cmVersion.h" +#include "cmPolicies.h" #include #include @@ -30,6 +31,7 @@ cmRST::cmRST(std::ostream& os, std::string const& docroot): "command|variable" ")::[ \t]+([^ \t\n]+)$"), CMakeModuleDirective("^.. cmake-module::[ \t]+([^ \t\n]+)$"), + CMakePolicyDirective("^.. cmake-policy::[ \t]+(.+)$"), ParsedLiteralDirective("^.. parsed-literal::[ \t]*(.*)$"), CodeBlockDirective("^.. code-block::[ \t]*(.*)$"), ReplaceDirective("^.. (\\|[^|]+\\|) replace::[ \t]*(.*)$"), @@ -195,6 +197,27 @@ void cmRST::ProcessLine(std::string const& line) this->NormalLine(line); } } + else if(this->CMakePolicyDirective.find(line)) + { + std::string policy = this->CMakePolicyDirective.match(1); + if(policy.empty()) + { + this->NormalLine(line); + } + else + { + cmPolicies::PolicyID id; + bool b = cmPolicies::GetPolicyID(policy.c_str(), id); + if (!b) + { + this->NormalLine(line); + } + else + { + this->OutputLine(cmPolicies::GetPolicyDocTitle(id) + "\n", true); + } + } + } else if(this->ParsedLiteralDirective.find(line)) { // Record the literal lines to output after whole block. diff --git a/Source/cmRST.h b/Source/cmRST.h index b9b2366..52c9f2e 100644 --- a/Source/cmRST.h +++ b/Source/cmRST.h @@ -79,6 +79,7 @@ private: DirectiveType Directive; cmsys::RegularExpression CMakeDirective; cmsys::RegularExpression CMakeModuleDirective; + cmsys::RegularExpression CMakePolicyDirective; cmsys::RegularExpression ParsedLiteralDirective; cmsys::RegularExpression CodeBlockDirective; cmsys::RegularExpression ReplaceDirective; diff --git a/Tests/RunCMake/CMP0027/CMP0027-WARN-stderr.txt b/Tests/RunCMake/CMP0027/CMP0027-WARN-stderr.txt index 9bcec3c..984d9c1 100644 --- a/Tests/RunCMake/CMP0027/CMP0027-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0027/CMP0027-WARN-stderr.txt @@ -1,5 +1,5 @@ CMake Warning \(dev\) in CMakeLists.txt: - Policy CMP0027 is not set: Conditionally linked imported targets with + Policy CMP0027 is not set: Conditionally linked IMPORTED targets with missing include directories. Run "cmake --help-policy CMP0027" for policy details. Use the cmake_policy command to set the policy and suppress this warning. diff --git a/Tests/RunCMake/CMP0059/CMP0059-WARN-stderr.txt b/Tests/RunCMake/CMP0059/CMP0059-WARN-stderr.txt index 4e04d15..06c7be3 100644 --- a/Tests/RunCMake/CMP0059/CMP0059-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0059/CMP0059-WARN-stderr.txt @@ -1,5 +1,5 @@ CMake Warning \(dev\) at CMP0059-WARN.cmake:6 \(get_property\): - Policy CMP0059 is not set: Do no treat DEFINITIONS as a built-in directory + Policy CMP0059 is not set: Do not treat DEFINITIONS as a built-in directory property. Run "cmake --help-policy CMP0059" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Call Stack \(most recent call first\): @@ -8,7 +8,7 @@ This warning is for project developers. Use -Wno-dev to suppress it. DEFS: -DSOME_DEF CMake Warning \(dev\) at CMP0059-WARN.cmake:14 \(get_property\): - Policy CMP0059 is not set: Do no treat DEFINITIONS as a built-in directory + Policy CMP0059 is not set: Do not treat DEFINITIONS as a built-in directory property. Run "cmake --help-policy CMP0059" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/include/CMP0024-WARN-stderr.txt b/Tests/RunCMake/include/CMP0024-WARN-stderr.txt index 9c79007..ae57674 100644 --- a/Tests/RunCMake/include/CMP0024-WARN-stderr.txt +++ b/Tests/RunCMake/include/CMP0024-WARN-stderr.txt @@ -1,7 +1,7 @@ CMake Warning \(dev\) at subdir2/CMakeLists.txt:2 \(include\): - Policy CMP0024 is not set: Disallow include export result. Run "cmake - --help-policy CMP0024" for policy details. Use the cmake_policy command to - set the policy and suppress this warning. + Policy CMP0024 is not set: Disallow include\(\) of export\(\) result. Run + "cmake --help-policy CMP0024" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. The file diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py index fe60033..26094b2 100644 --- a/Utilities/Sphinx/cmake.py +++ b/Utilities/Sphinx/cmake.py @@ -150,6 +150,21 @@ class CMakePolicyList(Directive): self.state_machine.insert_input(include_lines, "") return [] +class CMakePolicy(Directive): + required_arguments = 1 + def run(self): + + env = self.state.document.settings.env + with open("PolicyList.json", "r") as f: + policies = json.load(f) + + for policy in policies: + if policy["id"] == self.arguments[0]: + include_lines = statemachine.string2lines(policy["rst"]) + self.state_machine.insert_input(include_lines, "") + break + return [] + class _cmake_index_entry: def __init__(self, desc): self.desc = desc @@ -411,6 +426,7 @@ class CMakeDomain(Domain): def setup(app): app.add_directive('cmake-module', CMakeModule) + app.add_directive('cmake-policy', CMakePolicy) app.add_directive('cmake-policy-list', CMakePolicyList) app.add_transform(CMakeTransform) app.add_transform(CMakeXRefTransform) diff --git a/Utilities/Sphinx/create-policy-list.py b/Utilities/Sphinx/create-policy-list.py index d825c66..6b0f10e 100755 --- a/Utilities/Sphinx/create-policy-list.py +++ b/Utilities/Sphinx/create-policy-list.py @@ -7,6 +7,10 @@ def collectString(s): result = "" idx = s.find('"') + nullptr = s.find('0') + if (nullptr < idx): + return (None, None) + oldIdx = idx + 1 i = 0 while idx != -1: @@ -41,13 +45,19 @@ with open(sys.argv[2]) as policyHeader: policyId, content = content.split(",", 1) docString, docLength = collectString(content) content = content[docLength:] + rstString, rstLength = collectString(content) + if (rstString is None): + rstString = docString + else: + content = content[rstLength:] versionMajor, versionMinor, versionPatch, content = content.split(",", 3) versionMajor = cleanString(versionMajor) versionMinor = cleanString(versionMinor) versionPatch = cleanString(versionPatch) version = versionMajor + "." + versionMinor + "." + versionPatch - policies.append({"id": policyId, "doc": docString, "version": version}) + policies.append({"id": policyId, "doc": docString, + "rst": rstString, "version": version}) start = content.find("SELECT(POLICY, ") ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From steveire at gmail.com Wed May 6 02:02:36 2015 From: steveire at gmail.com (Stephen Kelly) Date: Wed, 6 May 2015 02:02:36 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2569-gea1db6c Message-ID: <20150506060237.1CFC5AFAE2@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, next has been updated via ea1db6c43d9709169525ee481670e187b7293273 (commit) via ca021ca377980243db5aea1a503c787d608d0a36 (commit) from dcce21d77e98066a420e28a253f112443002e8d0 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ea1db6c43d9709169525ee481670e187b7293273 commit ea1db6c43d9709169525ee481670e187b7293273 Merge: dcce21d ca021ca Author: Stephen Kelly AuthorDate: Wed May 6 02:02:35 2015 -0400 Commit: CMake Topic Stage CommitDate: Wed May 6 02:02:35 2015 -0400 Merge topic 'refactor-cmLocalGenerator' into next ca021ca3 fixup! cmState: Add an accessor for Parent snapshot and a validity check. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ca021ca377980243db5aea1a503c787d608d0a36 commit ca021ca377980243db5aea1a503c787d608d0a36 Author: Stephen Kelly AuthorDate: Wed May 6 07:57:09 2015 +0200 Commit: Stephen Kelly CommitDate: Wed May 6 07:57:09 2015 +0200 fixup! cmState: Add an accessor for Parent snapshot and a validity check. diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 7a1c715..4965ae3 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -675,7 +675,7 @@ void cmState::Snapshot::SetRelativePathTopBinary(const char* dir) bool cmState::Snapshot::IsValid() const { - return this->State; + return this->State ? true : false; } cmState::Snapshot cmState::Snapshot::GetParent() const ----------------------------------------------------------------------- Summary of changes: Source/cmState.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From steveire at gmail.com Wed May 6 02:03:18 2015 From: steveire at gmail.com (Stephen Kelly) Date: Wed, 6 May 2015 02:03:18 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2576-g3b2929c Message-ID: <20150506060318.A3AF7AFB33@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, next has been updated via 3b2929cd2d253b02f88112943db9b19b5ff81a9f (commit) via d4ac41f29ea30f0f66f081cbc6b02906febd1fcb (commit) via 69bddf1ae02e554645ca96631d1f2741d982170b (commit) via 76f07b81b3dcb35846cef4b73eb4d67016270ad5 (commit) via bbda52fdfa4b838fee4391111fa3c0626f747ad8 (commit) via 062836296c13271047c00490cbc02d64169cc8a0 (commit) via 1e4f6618dfaac13e70a5b3941daed02c8f989285 (commit) from ea1db6c43d9709169525ee481670e187b7293273 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3b2929cd2d253b02f88112943db9b19b5ff81a9f commit 3b2929cd2d253b02f88112943db9b19b5ff81a9f Merge: ea1db6c d4ac41f Author: Stephen Kelly AuthorDate: Wed May 6 02:03:16 2015 -0400 Commit: CMake Topic Stage CommitDate: Wed May 6 02:03:16 2015 -0400 Merge topic 'refactor-cmLocalGenerator' into next d4ac41f2 cmState: Store computed relative paths to to current directories. 69bddf1a cmState::Snapshot: Store components for current directories. 76f07b81 cmState: Compute and store directory components. bbda52fd cmGlobalGenerator: Move some flags from cmLocalGenerator. 06283629 cmLocalGenerator: Port loops to cmState::Snapshot. 1e4f6618 cmState: Add an accessor for Parent snapshot and a validity check. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d4ac41f29ea30f0f66f081cbc6b02906febd1fcb commit d4ac41f29ea30f0f66f081cbc6b02906febd1fcb Author: Stephen Kelly AuthorDate: Mon May 4 23:30:29 2015 +0200 Commit: Stephen Kelly CommitDate: Wed May 6 08:02:58 2015 +0200 cmState: Store computed relative paths to to current directories. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index f64cb2d..a5f603f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -66,7 +66,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, this->UseRelativePaths = false; this->Configured = false; this->EmitUniversalBinaryFlags = true; - this->RelativePathsConfigured = false; this->BackwardsCompatibility = 0; this->BackwardsCompatibilityFinal = false; } @@ -2812,97 +2811,6 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote, } //---------------------------------------------------------------------------- -std::string cmLocalGenerator::FindRelativePathTopSource() -{ - cmState::Snapshot snapshot = this->StateSnapshot; - std::vector snapshots; - snapshots.push_back(snapshot); - while (true) - { - snapshot = snapshot.GetParent(); - if (snapshot.IsValid()) - { - snapshots.push_back(snapshot); - } - else - { - break; - } - } - - std::string result = snapshots.front().GetCurrentSourceDirectory(); - - for (std::vector::const_iterator it = - snapshots.begin() + 1; it != snapshots.end(); ++it) - { - std::string currentSource = it->GetCurrentSourceDirectory(); - if(cmSystemTools::IsSubDirectory(result, currentSource)) - { - result = currentSource; - } - } - - return result; -} - -//---------------------------------------------------------------------------- -std::string cmLocalGenerator::FindRelativePathTopBinary() -{ - cmState::Snapshot snapshot = this->StateSnapshot; - std::vector snapshots; - snapshots.push_back(snapshot); - while (true) - { - snapshot = snapshot.GetParent(); - if (snapshot.IsValid()) - { - snapshots.push_back(snapshot); - } - else - { - break; - } - } - - std::string result = snapshots.front().GetCurrentBinaryDirectory(); - - for (std::vector::const_iterator it = - snapshots.begin() + 1; it != snapshots.end(); ++it) - { - std::string currentBinary = it->GetCurrentBinaryDirectory(); - if(cmSystemTools::IsSubDirectory(result, currentBinary)) - { - result = currentBinary; - } - } - - return result; -} - -//---------------------------------------------------------------------------- -void cmLocalGenerator::ConfigureRelativePaths() -{ - // Relative path conversion inside the source tree is not used to - // construct relative paths passed to build tools so it is safe to - // even when the source is a network path. - std::string source = this->FindRelativePathTopSource(); - this->RelativePathTopSource = source; - - // The current working directory on Windows cannot be a network - // path. Therefore relative paths cannot work when the binary tree - // is a network path. - std::string binary = this->FindRelativePathTopBinary(); - if(binary.size() < 2 || binary.substr(0, 2) != "//") - { - this->RelativePathTopBinary = binary; - } - else - { - this->RelativePathTopBinary = ""; - } -} - -//---------------------------------------------------------------------------- static bool cmLocalGeneratorNotAbove(const char* a, const char* b) { return (cmSystemTools::ComparePath(a, b) || @@ -2927,26 +2835,19 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector& local, return in_remote; } - // Make sure relative path conversion is configured. - if(!this->RelativePathsConfigured) - { - this->ConfigureRelativePaths(); - this->RelativePathsConfigured = true; - } - if(!force) { // Skip conversion if the path and local are not both in the source // or both in the binary tree. std::string local_path = cmSystemTools::JoinPath(local); if(!((cmLocalGeneratorNotAbove(local_path.c_str(), - this->RelativePathTopBinary.c_str()) && + this->StateSnapshot.GetRelativePathTopBinary()) && cmLocalGeneratorNotAbove(in_remote.c_str(), - this->RelativePathTopBinary.c_str())) || + this->StateSnapshot.GetRelativePathTopBinary())) || (cmLocalGeneratorNotAbove(local_path.c_str(), - this->RelativePathTopSource.c_str()) && + this->StateSnapshot.GetRelativePathTopSource()) && cmLocalGeneratorNotAbove(in_remote.c_str(), - this->RelativePathTopSource.c_str())))) + this->StateSnapshot.GetRelativePathTopSource())))) { return in_remote; } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index bf447e5..c0da4f6 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -435,10 +435,6 @@ protected: std::string const& dir_max); void ComputeObjectMaxPath(); - void ConfigureRelativePaths(); - std::string FindRelativePathTopSource(); - std::string FindRelativePathTopBinary(); - virtual std::string ConvertToLinkReference(std::string const& lib, OutputFormat format = SHELL); @@ -468,15 +464,6 @@ protected: // committed. std::string TargetImplib; - // The top-most directories for relative path conversion. Both the - // source and destination location of a relative path conversion - // must be underneath one of these directories (both under source or - // both under binary) in order for the relative path to be evaluated - // safely by the build tools. - std::string RelativePathTopSource; - std::string RelativePathTopBinary; - bool RelativePathsConfigured; - cmIML_INT_uint64_t BackwardsCompatibility; bool BackwardsCompatibilityFinal; private: diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index f11c79e..54bff7f 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -545,9 +545,11 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() // Setup relative path conversion tops. infoFileStream << "# Relative path conversion top directories.\n" - << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" << this->RelativePathTopSource + << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" + << this->StateSnapshot.GetRelativePathTopSource() << "\")\n" - << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \"" << this->RelativePathTopBinary + << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \"" + << this->StateSnapshot.GetRelativePathTopBinary() << "\")\n" << "\n"; @@ -1613,16 +1615,15 @@ cmLocalUnixMakefileGenerator3 } // Setup relative path top directories. - this->RelativePathsConfigured = true; if(const char* relativePathTopSource = mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_SOURCE")) { - this->RelativePathTopSource = relativePathTopSource; + this->StateSnapshot.SetRelativePathTopSource(relativePathTopSource); } if(const char* relativePathTopBinary = mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_BINARY")) { - this->RelativePathTopBinary = relativePathTopBinary; + this->StateSnapshot.SetRelativePathTopBinary(relativePathTopBinary); } } else diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 27a36bc..4965ae3 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -199,6 +199,8 @@ void cmState::Initialize() this->ParentPositions.clear(); this->CurrentSourceDirectoryComponents.clear(); this->CurrentBinaryDirectoryComponents.clear(); + this->RelativePathTopSource.clear(); + this->RelativePathTopBinary.clear(); this->CreateSnapshot(Snapshot()); this->DefineProperty @@ -496,6 +498,86 @@ std::vector const& cmState::GetBinaryDirectoryComponents() const return this->BinaryDirectoryComponents; } +void cmState::Snapshot::ComputeRelativePathTopSource() +{ + // Relative path conversion inside the source tree is not used to + // construct relative paths passed to build tools so it is safe to use + // even when the source is a network path. + + cmState::Snapshot snapshot = *this; + std::vector snapshots; + snapshots.push_back(snapshot); + while (true) + { + snapshot = snapshot.GetParent(); + if (snapshot.IsValid()) + { + snapshots.push_back(snapshot); + } + else + { + break; + } + } + + std::string result = snapshots.front().GetCurrentSourceDirectory(); + + for (std::vector::const_iterator it = + snapshots.begin() + 1; it != snapshots.end(); ++it) + { + std::string currentSource = it->GetCurrentSourceDirectory(); + if(cmSystemTools::IsSubDirectory(result, currentSource)) + { + result = currentSource; + } + } + this->State->RelativePathTopSource[this->Position] = result; +} + +void cmState::Snapshot::ComputeRelativePathTopBinary() +{ + cmState::Snapshot snapshot = *this; + std::vector snapshots; + snapshots.push_back(snapshot); + while (true) + { + snapshot = snapshot.GetParent(); + if (snapshot.IsValid()) + { + snapshots.push_back(snapshot); + } + else + { + break; + } + } + + std::string result = + snapshots.front().GetCurrentBinaryDirectory(); + + for (std::vector::const_iterator it = + snapshots.begin() + 1; it != snapshots.end(); ++it) + { + std::string currentBinary = it->GetCurrentBinaryDirectory(); + if(cmSystemTools::IsSubDirectory(result, currentBinary)) + { + result = currentBinary; + } + } + + // The current working directory on Windows cannot be a network + // path. Therefore relative paths cannot work when the binary tree + // is a network path. + if(result.size() < 2 || result.substr(0, 2) != "//") + { + this->State->RelativePathTopBinary[this->Position] = result; + } + else + { + this->State->RelativePathTopBinary[this->Position] = ""; + } +} + cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) { PositionType pos = this->ParentPositions.size(); @@ -506,6 +588,8 @@ cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) this->CurrentSourceDirectoryComponents.size() + 1); this->CurrentBinaryDirectoryComponents.resize( this->CurrentBinaryDirectoryComponents.size() + 1); + this->RelativePathTopSource.resize(this->RelativePathTopSource.size() + 1); + this->RelativePathTopBinary.resize(this->RelativePathTopBinary.size() + 1); return cmState::Snapshot(this, pos); } @@ -533,6 +617,7 @@ void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir) cmSystemTools::SplitPath( this->State->Locations[this->Position], this->State->CurrentSourceDirectoryComponents[this->Position]); + this->ComputeRelativePathTopSource(); } const char* cmState::Snapshot::GetCurrentBinaryDirectory() const @@ -553,6 +638,7 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) cmSystemTools::SplitPath( this->State->OutputLocations[this->Position], this->State->CurrentBinaryDirectoryComponents[this->Position]); + this->ComputeRelativePathTopBinary(); } std::vector const& @@ -567,6 +653,26 @@ cmState::Snapshot::GetCurrentBinaryDirectoryComponents() return this->State->CurrentBinaryDirectoryComponents[this->Position]; } +const char* cmState::Snapshot::GetRelativePathTopSource() const +{ + return this->State->RelativePathTopSource[this->Position].c_str(); +} + +const char* cmState::Snapshot::GetRelativePathTopBinary() const +{ + return this->State->RelativePathTopBinary[this->Position].c_str(); +} + +void cmState::Snapshot::SetRelativePathTopSource(const char* dir) +{ + this->State->RelativePathTopSource[this->Position] = dir; +} + +void cmState::Snapshot::SetRelativePathTopBinary(const char* dir) +{ + this->State->RelativePathTopBinary[this->Position] = dir; +} + bool cmState::Snapshot::IsValid() const { return this->State ? true : false; diff --git a/Source/cmState.h b/Source/cmState.h index faf0739..23d3f0d 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -39,10 +39,19 @@ public: std::vector const& GetCurrentSourceDirectoryComponents(); std::vector const& GetCurrentBinaryDirectoryComponents(); + const char* GetRelativePathTopSource() const; + const char* GetRelativePathTopBinary() const; + void SetRelativePathTopSource(const char* dir); + void SetRelativePathTopBinary(const char* dir); + bool IsValid() const; Snapshot GetParent() const; private: + void ComputeRelativePathTopSource(); + void ComputeRelativePathTopBinary(); + + private: friend class cmState; cmState* State; cmState::PositionType Position; @@ -141,6 +150,13 @@ private: std::vector > CurrentSourceDirectoryComponents; std::vector > CurrentBinaryDirectoryComponents; + // The top-most directories for relative path conversion. Both the + // source and destination location of a relative path conversion + // must be underneath one of these directories (both under source or + // both under binary) in order for the relative path to be evaluated + // safely by the build tools. + std::vector RelativePathTopSource; + std::vector RelativePathTopBinary; std::vector SourceDirectoryComponents; std::vector BinaryDirectoryComponents; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=69bddf1ae02e554645ca96631d1f2741d982170b commit 69bddf1ae02e554645ca96631d1f2741d982170b Author: Stephen Kelly AuthorDate: Mon May 4 23:08:19 2015 +0200 Commit: Stephen Kelly CommitDate: Wed May 6 08:02:58 2015 +0200 cmState::Snapshot: Store components for current directories. Remove this responsibility from cmLocalGenerator. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 0a955bb..f64cb2d 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -67,7 +67,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, this->Configured = false; this->EmitUniversalBinaryFlags = true; this->RelativePathsConfigured = false; - this->PathConversionsSetup = false; this->BackwardsCompatibility = 0; this->BackwardsCompatibilityFinal = false; } @@ -229,22 +228,6 @@ void cmLocalGenerator::ReadInputFile() } } -void cmLocalGenerator::SetupPathConversions() -{ - // Setup the current output directory components for use by - // Convert - std::string outdir; - - outdir = cmSystemTools::CollapseFullPath( - this->StateSnapshot.GetCurrentSourceDirectory()); - cmSystemTools::SplitPath(outdir, this->StartDirectoryComponents); - - outdir = cmSystemTools::CollapseFullPath - (this->StateSnapshot.GetCurrentBinaryDirectory()); - cmSystemTools::SplitPath(outdir, - this->StartOutputDirectoryComponents); -} - void cmLocalGenerator::ConfigureFinalPass() { this->Makefile->ConfigureFinalPass(); @@ -2731,13 +2714,6 @@ std::string cmLocalGenerator::Convert(const std::string& source, OutputFormat output, bool optional) { - // Make sure the relative path conversion components are set. - if(!this->PathConversionsSetup) - { - this->SetupPathConversions(); - this->PathConversionsSetup = true; - } - // Convert the path to a relative path. std::string result = source; @@ -2752,20 +2728,18 @@ std::string cmLocalGenerator::Convert(const std::string& source, break; case START: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = this->ConvertToRelativePath(this->StartDirectoryComponents, - result); + result = this->ConvertToRelativePath( + this->StateSnapshot.GetCurrentSourceDirectoryComponents(), result); break; case HOME_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = - this->ConvertToRelativePath( - this->GetState()->GetBinaryDirectoryComponents(), result); + result = this->ConvertToRelativePath( + this->GetState()->GetBinaryDirectoryComponents(), result); break; case START_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = - this->ConvertToRelativePath(this->StartOutputDirectoryComponents, - result); + result = this->ConvertToRelativePath( + this->StateSnapshot.GetCurrentBinaryDirectoryComponents(), result); break; case FULL: result = cmSystemTools::CollapseFullPath(result); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 5cdf161..bf447e5 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -438,7 +438,6 @@ protected: void ConfigureRelativePaths(); std::string FindRelativePathTopSource(); std::string FindRelativePathTopBinary(); - void SetupPathConversions(); virtual std::string ConvertToLinkReference(std::string const& lib, OutputFormat format = SHELL); @@ -453,8 +452,6 @@ protected: cmMakefile *Makefile; cmState::Snapshot StateSnapshot; cmGlobalGenerator *GlobalGenerator; - std::vector StartDirectoryComponents; - std::vector StartOutputDirectoryComponents; cmLocalGenerator* Parent; std::vector Children; std::map UniqueObjectNamesMap; @@ -479,7 +476,6 @@ protected: std::string RelativePathTopSource; std::string RelativePathTopBinary; bool RelativePathsConfigured; - bool PathConversionsSetup; cmIML_INT_uint64_t BackwardsCompatibility; bool BackwardsCompatibilityFinal; diff --git a/Source/cmState.cxx b/Source/cmState.cxx index aa690dc..27a36bc 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -197,6 +197,8 @@ void cmState::Initialize() this->Locations.clear(); this->OutputLocations.clear(); this->ParentPositions.clear(); + this->CurrentSourceDirectoryComponents.clear(); + this->CurrentBinaryDirectoryComponents.clear(); this->CreateSnapshot(Snapshot()); this->DefineProperty @@ -500,6 +502,10 @@ cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) this->ParentPositions.push_back(originSnapshot.Position); this->Locations.resize(this->Locations.size() + 1); this->OutputLocations.resize(this->OutputLocations.size() + 1); + this->CurrentSourceDirectoryComponents.resize( + this->CurrentSourceDirectoryComponents.size() + 1); + this->CurrentBinaryDirectoryComponents.resize( + this->CurrentBinaryDirectoryComponents.size() + 1); return cmState::Snapshot(this, pos); } @@ -523,6 +529,10 @@ void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir) this->State->Locations[this->Position]); this->State->Locations[this->Position] = cmSystemTools::CollapseFullPath(this->State->Locations[this->Position]); + + cmSystemTools::SplitPath( + this->State->Locations[this->Position], + this->State->CurrentSourceDirectoryComponents[this->Position]); } const char* cmState::Snapshot::GetCurrentBinaryDirectory() const @@ -539,6 +549,22 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) this->State->OutputLocations[this->Position] = cmSystemTools::CollapseFullPath( this->State->OutputLocations[this->Position]); + + cmSystemTools::SplitPath( + this->State->OutputLocations[this->Position], + this->State->CurrentBinaryDirectoryComponents[this->Position]); +} + +std::vector const& +cmState::Snapshot::GetCurrentSourceDirectoryComponents() +{ + return this->State->CurrentSourceDirectoryComponents[this->Position]; +} + +std::vector const& +cmState::Snapshot::GetCurrentBinaryDirectoryComponents() +{ + return this->State->CurrentBinaryDirectoryComponents[this->Position]; } bool cmState::Snapshot::IsValid() const diff --git a/Source/cmState.h b/Source/cmState.h index 956b4f4..faf0739 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -36,6 +36,9 @@ public: const char* GetCurrentBinaryDirectory() const; void SetCurrentBinaryDirectory(std::string const& dir); + std::vector const& GetCurrentSourceDirectoryComponents(); + std::vector const& GetCurrentBinaryDirectoryComponents(); + bool IsValid() const; Snapshot GetParent() const; @@ -136,6 +139,9 @@ private: std::vector OutputLocations; std::vector ParentPositions; + std::vector > CurrentSourceDirectoryComponents; + std::vector > CurrentBinaryDirectoryComponents; + std::vector SourceDirectoryComponents; std::vector BinaryDirectoryComponents; std::string SourceDirectory; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=76f07b81b3dcb35846cef4b73eb4d67016270ad5 commit 76f07b81b3dcb35846cef4b73eb4d67016270ad5 Author: Stephen Kelly AuthorDate: Mon May 4 23:01:29 2015 +0200 Commit: Stephen Kelly CommitDate: Wed May 6 08:02:58 2015 +0200 cmState: Compute and store directory components. There is no need to duplicate these in all cmLocalGenerators. Rename the symbols according to current conventions. Add explicit calls to Set{Source,Binary}Directory with empty strings in order to trigger the population of the components containers with the current working directory in cmLocalGenerator. Having directories set to empty is a special case in CMake, which is relied on for the `if(CMAKE_BINARY_DIR)` condition at the end of CMakeDetermineSystem.cmake. diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 2207873..d08b5de 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -198,6 +198,8 @@ int main (int argc, char const* const* argv) "Read CPack config file: " << cpackConfigFile << std::endl); cmake cminst; + cminst.SetHomeDirectory(""); + cminst.SetHomeOutputDirectory(""); cminst.GetState()->RemoveUnscriptableCommands(); cmGlobalGenerator cmgg; cmgg.SetCMakeInstance(&cminst); diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 586070b..20d303d 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -204,6 +204,8 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) } cmake cm; + cm.SetHomeDirectory(""); + cm.SetHomeOutputDirectory(""); std::string cmakeOutString; cmCTestBuildAndTestCaptureRAII captureRAII(cm, cmakeOutString); static_cast(captureRAII); diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 0a34be8..322855a 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -336,6 +336,8 @@ void cmCTestScriptHandler::CreateCMake() delete this->LocalGenerator; } this->CMake = new cmake; + this->CMake->SetHomeDirectory(""); + this->CMake->SetHomeOutputDirectory(""); this->CMake->AddCMakePaths(); this->GlobalGenerator = new cmGlobalGenerator; this->GlobalGenerator->SetCMakeInstance(this->CMake); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index bd6af8c..0a955bb 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -234,19 +234,12 @@ void cmLocalGenerator::SetupPathConversions() // Setup the current output directory components for use by // Convert std::string outdir; - outdir = - cmSystemTools::CollapseFullPath(this->GetState()->GetSourceDirectory()); - cmSystemTools::SplitPath(outdir, this->HomeDirectoryComponents); + outdir = cmSystemTools::CollapseFullPath( this->StateSnapshot.GetCurrentSourceDirectory()); cmSystemTools::SplitPath(outdir, this->StartDirectoryComponents); outdir = cmSystemTools::CollapseFullPath - (this->GetState()->GetBinaryDirectory()); - cmSystemTools::SplitPath(outdir, - this->HomeOutputDirectoryComponents); - - outdir = cmSystemTools::CollapseFullPath (this->StateSnapshot.GetCurrentBinaryDirectory()); cmSystemTools::SplitPath(outdir, this->StartOutputDirectoryComponents); @@ -2754,8 +2747,8 @@ std::string cmLocalGenerator::Convert(const std::string& source, { case HOME: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = this->ConvertToRelativePath(this->HomeDirectoryComponents, - result); + result = this->ConvertToRelativePath( + this->GetState()->GetSourceDirectoryComponents(), result); break; case START: //result = cmSystemTools::CollapseFullPath(result.c_str()); @@ -2765,8 +2758,8 @@ std::string cmLocalGenerator::Convert(const std::string& source, case HOME_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); result = - this->ConvertToRelativePath(this->HomeOutputDirectoryComponents, - result); + this->ConvertToRelativePath( + this->GetState()->GetBinaryDirectoryComponents(), result); break; case START_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 47c0877..5cdf161 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -453,9 +453,7 @@ protected: cmMakefile *Makefile; cmState::Snapshot StateSnapshot; cmGlobalGenerator *GlobalGenerator; - std::vector HomeDirectoryComponents; std::vector StartDirectoryComponents; - std::vector HomeOutputDirectoryComponents; std::vector StartOutputDirectoryComponents; cmLocalGenerator* Parent; std::vector Children; diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 82a2939..aa690dc 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -458,6 +458,10 @@ void cmState::SetSourceDirectory(std::string const& sourceDirectory) { this->SourceDirectory = sourceDirectory; cmSystemTools::ConvertToUnixSlashes(this->SourceDirectory); + + cmSystemTools::SplitPath( + cmSystemTools::CollapseFullPath(this->SourceDirectory), + this->SourceDirectoryComponents); } const char* cmState::GetSourceDirectory() const @@ -465,10 +469,19 @@ const char* cmState::GetSourceDirectory() const return this->SourceDirectory.c_str(); } +std::vector const& cmState::GetSourceDirectoryComponents() const +{ + return this->SourceDirectoryComponents; +} + void cmState::SetBinaryDirectory(std::string const& binaryDirectory) { this->BinaryDirectory = binaryDirectory; cmSystemTools::ConvertToUnixSlashes(this->BinaryDirectory); + + cmSystemTools::SplitPath( + cmSystemTools::CollapseFullPath(this->BinaryDirectory), + this->BinaryDirectoryComponents); } const char* cmState::GetBinaryDirectory() const @@ -476,6 +489,11 @@ const char* cmState::GetBinaryDirectory() const return this->BinaryDirectory.c_str(); } +std::vector const& cmState::GetBinaryDirectoryComponents() const +{ + return this->BinaryDirectoryComponents; +} + cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) { PositionType pos = this->ParentPositions.size(); diff --git a/Source/cmState.h b/Source/cmState.h index ed58c64..956b4f4 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -123,6 +123,9 @@ public: const char* GetBinaryDirectory() const; void SetBinaryDirectory(std::string const& binaryDirectory); + std::vector const& GetSourceDirectoryComponents() const; + std::vector const& GetBinaryDirectoryComponents() const; + private: std::map PropertyDefinitions; std::vector EnabledLanguages; @@ -132,6 +135,9 @@ private: std::vector Locations; std::vector OutputLocations; std::vector ParentPositions; + + std::vector SourceDirectoryComponents; + std::vector BinaryDirectoryComponents; std::string SourceDirectory; std::string BinaryDirectory; bool IsInTryCompile; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5c5c428..2f9789d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2580,6 +2580,9 @@ int cmake::Build(const std::string& dir, const std::vector& nativeOptions, bool clean) { + + this->SetHomeDirectory(""); + this->SetHomeOutputDirectory(""); if(!cmSystemTools::FileIsDirectory(dir)) { std::cerr << "Error: " << dir << " is not a directory\n"; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bbda52fdfa4b838fee4391111fa3c0626f747ad8 commit bbda52fdfa4b838fee4391111fa3c0626f747ad8 Author: Stephen Kelly AuthorDate: Mon May 4 22:40:11 2015 +0200 Commit: Stephen Kelly CommitDate: Wed May 6 08:02:57 2015 +0200 cmGlobalGenerator: Move some flags from cmLocalGenerator. These flags are global, and so they belong here instead of being set on each local generator. diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx index 0220799..d191056 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.cxx +++ b/Source/cmGlobalBorlandMakefileGenerator.cxx @@ -21,6 +21,7 @@ cmGlobalBorlandMakefileGenerator::cmGlobalBorlandMakefileGenerator() this->ForceUnixPaths = false; this->ToolSupportsColor = true; this->UseLinkScript = false; + this->WindowsShell = true; } @@ -43,7 +44,6 @@ cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator( cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3(this, parent); lg->SetIncludeDirective("!include"); - lg->SetWindowsShell(true); lg->SetDefineWindowsNULL(true); lg->SetMakefileVariableSize(32); lg->SetPassMakeflags(true); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 7117402..fe73e8c 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -71,6 +71,13 @@ cmGlobalGenerator::cmGlobalGenerator() this->ExtraGenerator = 0; this->CurrentLocalGenerator = 0; this->TryCompileOuterMakefile = 0; + + this->WindowsShell = false; + this->WindowsVSIDE = false; + this->WatcomWMake = false; + this->MinGWMake = false; + this->NMake = false; + this->MSYSShell = false; } cmGlobalGenerator::~cmGlobalGenerator() diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 7107198..3b321f2 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -354,6 +354,13 @@ public: cmFileLockPool& GetFileLockPool() { return FileLockPool; } #endif + bool WindowsShell; + bool WindowsVSIDE; + bool WatcomWMake; + bool MinGWMake; + bool NMake; + bool MSYSShell; + protected: virtual void Generate(); diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx index 1caa730..25613eb 100644 --- a/Source/cmGlobalJOMMakefileGenerator.cxx +++ b/Source/cmGlobalJOMMakefileGenerator.cxx @@ -19,6 +19,8 @@ cmGlobalJOMMakefileGenerator::cmGlobalJOMMakefileGenerator() this->ForceUnixPaths = false; this->ToolSupportsColor = true; this->UseLinkScript = false; + this->WindowsShell = true; + this->NMake = true; } void cmGlobalJOMMakefileGenerator @@ -51,11 +53,9 @@ cmGlobalJOMMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3(this, parent); lg->SetDefineWindowsNULL(true); - lg->SetWindowsShell(true); lg->SetMakeSilentFlag("/nologo"); lg->SetIgnoreLibPrefix(true); lg->SetPassMakeflags(true); - lg->SetNMake(true); lg->SetUnixCD(false); return lg; } diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx index 319eeaf..b6adcbb 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.cxx +++ b/Source/cmGlobalMSYSMakefileGenerator.cxx @@ -21,6 +21,7 @@ cmGlobalMSYSMakefileGenerator::cmGlobalMSYSMakefileGenerator() this->ForceUnixPaths = true; this->ToolSupportsColor = true; this->UseLinkScript = false; + this->MSYSShell = true; } std::string @@ -98,8 +99,6 @@ cmGlobalMSYSMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) { cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3(this, parent); - lg->SetWindowsShell(false); - lg->SetMSYSShell(true); lg->SetIgnoreLibPrefix(true); lg->SetPassMakeflags(false); lg->SetUnixCD(true); diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx index c4511e5..ba0790d 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.cxx +++ b/Source/cmGlobalMinGWMakefileGenerator.cxx @@ -19,6 +19,8 @@ cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator() this->ForceUnixPaths = true; this->ToolSupportsColor = true; this->UseLinkScript = true; + this->WindowsShell = true; + this->MinGWMake = true; } void cmGlobalMinGWMakefileGenerator @@ -36,11 +38,9 @@ cmGlobalMinGWMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) { cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3(this, parent); - lg->SetWindowsShell(true); lg->SetIgnoreLibPrefix(true); lg->SetPassMakeflags(false); lg->SetUnixCD(true); - lg->SetMinGWMake(true); return lg; } diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx index 2732e22..98d7fb4 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.cxx +++ b/Source/cmGlobalNMakeMakefileGenerator.cxx @@ -19,6 +19,8 @@ cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator() this->ForceUnixPaths = false; this->ToolSupportsColor = true; this->UseLinkScript = false; + this->WindowsShell = true; + this->NMake = true; } void cmGlobalNMakeMakefileGenerator @@ -51,11 +53,9 @@ cmGlobalNMakeMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3(this, parent); lg->SetDefineWindowsNULL(true); - lg->SetWindowsShell(true); lg->SetMakeSilentFlag("/nologo"); lg->SetIgnoreLibPrefix(true); lg->SetPassMakeflags(true); - lg->SetNMake(true); lg->SetUnixCD(false); return lg; } diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index dde9ca4..7a26cc0 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -487,6 +487,9 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator() , ComputingUnknownDependencies(false) , PolicyCMP0058(cmPolicies::WARN) { +#ifdef _WIN32 + this->WindowsShell = true; +#endif // // Ninja is not ported to non-Unix OS yet. // this->ForceUnixPaths = true; this->FindMakeProgramFile = "CMakeNinjaFindMake.cmake"; diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 60d545b..b74ba6f 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -23,6 +23,8 @@ //---------------------------------------------------------------------------- cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator() { + this->WindowsShell = true; + this->WindowsVSIDE = true; } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx index 49c516f..181178f 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.cxx +++ b/Source/cmGlobalWatcomWMakeGenerator.cxx @@ -22,6 +22,10 @@ cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator() this->ToolSupportsColor = true; this->NeedSymbolicMark = true; this->EmptyRuleHackCommand = "@cd ."; +#ifdef _WIN32 + this->WindowsShell = true; +#endif + this->WatcomWMake = true; } void cmGlobalWatcomWMakeGenerator @@ -47,10 +51,6 @@ cmGlobalWatcomWMakeGenerator::CreateLocalGenerator(cmLocalGenerator* parent) cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3(this, parent); lg->SetDefineWindowsNULL(true); -#ifdef _WIN32 - lg->SetWindowsShell(true); -#endif - lg->SetWatcomWMake(true); lg->SetMakeSilentFlag("-h"); lg->SetIgnoreLibPrefix(true); lg->SetPassMakeflags(false); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 5ef0a3b..bd6af8c 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -61,12 +61,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, } this->Makefile = new cmMakefile(this); - this->WindowsShell = false; - this->WindowsVSIDE = false; - this->WatcomWMake = false; - this->MinGWMake = false; - this->NMake = false; - this->MSYSShell = false; this->LinkScriptShell = false; this->IgnoreLibPrefix = false; this->UseRelativePaths = false; @@ -1254,7 +1248,7 @@ cmLocalGenerator::ConvertToOutputForExistingCommon(const std::string& remote, // If this is a windows shell, the result has a space, and the path // already exists, we can use a short-path to reference it without a // space. - if(this->WindowsShell && result.find(' ') != result.npos && + if(this->GlobalGenerator->WindowsShell && result.find(' ') != result.npos && cmSystemTools::FileExists(remote.c_str())) { std::string tmp; @@ -2626,7 +2620,7 @@ void cmLocalGenerator::JoinDefines(const std::set& defines, { // Append the definition with proper escaping. std::string def = dflag; - if(this->WatcomWMake) + if(this->GlobalGenerator->WatcomWMake) { // The Watcom compiler does its own command line parsing instead // of using the windows shell rules. Definitions are one of @@ -2805,7 +2799,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source, // For the MSYS shell convert drive letters to posix paths, so // that c:/some/path becomes /c/some/path. This is needed to // avoid problems with the shell path translation. - if(this->MSYSShell && !this->LinkScriptShell) + if(this->GlobalGenerator->MSYSShell && !this->LinkScriptShell) { if(result.size() > 2 && result[1] == ':') { @@ -2813,7 +2807,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source, result[0] = '/'; } } - if(this->WindowsShell) + if(this->GlobalGenerator->WindowsShell) { std::replace(result.begin(), result.end(), '/', '\\'); } @@ -3324,6 +3318,26 @@ void cmLocalGenerator::ComputeObjectFilenames( } +bool cmLocalGenerator::IsWindowsShell() const +{ + return this->GlobalGenerator->WindowsShell; +} + +bool cmLocalGenerator::IsWatcomWMake() const +{ + return this->GlobalGenerator->WatcomWMake; +} + +bool cmLocalGenerator::IsMinGWMake() const +{ + return this->GlobalGenerator->MinGWMake; +} + +bool cmLocalGenerator::IsNMake() const +{ + return this->GlobalGenerator->NMake; +} + //---------------------------------------------------------------------------- std::string cmLocalGenerator @@ -3467,7 +3481,7 @@ std::string cmLocalGenerator::EscapeForShell(const std::string& str, // Compute the flags for the target shell environment. int flags = 0; - if(this->WindowsVSIDE) + if(this->GlobalGenerator->WindowsVSIDE) { flags |= cmsysSystem_Shell_Flag_VSIDE; } @@ -3487,27 +3501,27 @@ std::string cmLocalGenerator::EscapeForShell(const std::string& str, { flags |= cmsysSystem_Shell_Flag_WatcomQuote; } - if(this->WatcomWMake) + if(this->GlobalGenerator->WatcomWMake) { flags |= cmsysSystem_Shell_Flag_WatcomWMake; } - if(this->MinGWMake) + if(this->GlobalGenerator->MinGWMake) { flags |= cmsysSystem_Shell_Flag_MinGWMake; } - if(this->NMake) + if(this->GlobalGenerator->NMake) { flags |= cmsysSystem_Shell_Flag_NMake; } // Compute the buffer size needed. - int size = (this->WindowsShell ? + int size = (this->GlobalGenerator->WindowsShell ? cmsysSystem_Shell_GetArgumentSizeForWindows(str.c_str(), flags) : cmsysSystem_Shell_GetArgumentSizeForUnix(str.c_str(), flags)); // Compute the shell argument itself. std::vector arg(size); - if(this->WindowsShell) + if(this->GlobalGenerator->WindowsShell) { cmsysSystem_Shell_GetArgumentForWindows(str.c_str(), &arg[0], flags); } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 100d27b..47c0877 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -383,6 +383,11 @@ public: std::map& mapping, cmGeneratorTarget const* gt = 0); + bool IsWindowsShell() const; + bool IsWatcomWMake() const; + bool IsMinGWMake() const; + bool IsNMake() const; + protected: ///! put all the libraries for a target on into the given stream virtual void OutputLinkLibraries(std::string& linkLibraries, @@ -457,17 +462,13 @@ protected: std::map UniqueObjectNamesMap; std::string::size_type ObjectPathMax; std::set ObjectMaxPathViolations; - bool WindowsShell; - bool WindowsVSIDE; - bool WatcomWMake; - bool MinGWMake; - bool NMake; - bool MSYSShell; + bool LinkScriptShell; bool UseRelativePaths; bool IgnoreLibPrefix; bool Configured; bool EmitUniversalBinaryFlags; + // Hack for ExpandRuleVariable until object-oriented version is // committed. std::string TargetImplib; diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index ac10f09..ded4c25 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -28,9 +28,6 @@ cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg, , ConfigName("") , HomeRelativeOutputPath("") { -#ifdef _WIN32 - this->WindowsShell = true; -#endif this->TargetImplib = "$TARGET_IMPLIB"; } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index a2a3725..f11c79e 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -83,7 +83,6 @@ cmLocalUnixMakefileGenerator3:: cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmLocalGenerator* parent) : cmLocalGenerator(gg, parent) { - this->WindowsShell = false; this->IncludeDirective = "include"; this->MakefileVariableSize = 0; this->IgnoreLibPrefix = false; @@ -679,7 +678,7 @@ cmLocalUnixMakefileGenerator3 // Write the list of commands. os << cmWrap("\t", commands, "", "\n") << "\n"; - if(symbolic && !this->WatcomWMake) + if(symbolic && !this->IsWatcomWMake()) { os << ".PHONY : " << cmMakeSafe(tgt) << "\n"; } @@ -696,7 +695,7 @@ std::string cmLocalUnixMakefileGenerator3 ::ConvertShellCommand(std::string const& cmd, RelativeRoot root) { - if(this->WatcomWMake && + if(this->IsWatcomWMake() && cmSystemTools::FileIsFullPath(cmd.c_str()) && cmd.find_first_of("( )") != cmd.npos) { @@ -730,7 +729,7 @@ cmLocalUnixMakefileGenerator3 << "NULL=nul\n" << "!ENDIF\n"; } - if(this->WindowsShell) + if(this->IsWindowsShell()) { makefileStream << "SHELL = cmd.exe\n" @@ -798,7 +797,8 @@ cmLocalUnixMakefileGenerator3 makefileStream, "Disable implicit rules so canonical targets will work.", ".SUFFIXES", no_depends, no_commands, false); - if(!this->NMake && !this->WatcomWMake && !this->BorlandMakeCurlyHack) + if(!this->IsNMake() + && !this->IsWatcomWMake() && !this->BorlandMakeCurlyHack) { // turn off RCS and SCCS automatic stuff from gmake makefileStream @@ -810,7 +810,7 @@ cmLocalUnixMakefileGenerator3 depends.push_back(".hpux_make_needs_suffix_list"); this->WriteMakeRule(makefileStream, 0, ".SUFFIXES", depends, no_commands, false); - if(this->WatcomWMake) + if(this->IsWatcomWMake()) { // Switch on WMake feature, if an error or interrupt occurs during // makefile processing, the current target being made may be deleted @@ -828,7 +828,7 @@ cmLocalUnixMakefileGenerator3 << "VERBOSE = 1\n" << "\n"; } - if(this->WatcomWMake) + if(this->IsWatcomWMake()) { makefileStream << "!ifndef VERBOSE\n" @@ -962,7 +962,7 @@ cmLocalUnixMakefileGenerator3 void cmLocalUnixMakefileGenerator3::AppendFlags(std::string& flags, const std::string& newFlags) { - if(this->WatcomWMake && !newFlags.empty()) + if(this->IsWatcomWMake() && !newFlags.empty()) { std::string newf = newFlags; if(newf.find("\\\"") != newf.npos) @@ -1112,7 +1112,7 @@ cmLocalUnixMakefileGenerator3 // bool useCall = false; - if (this->WindowsShell) + if (this->IsWindowsShell()) { std::string suffix; if (cmd.size() > 4) @@ -1179,7 +1179,7 @@ cmLocalUnixMakefileGenerator3 { cmd = "call " + cmd; } - else if (this->NMake && cmd[0]=='"') + else if (this->IsNMake() && cmd[0]=='"') { cmd = "echo >nul && " + cmd; } @@ -2344,7 +2344,7 @@ void cmLocalUnixMakefileGenerator3 // used by NMake and Borland make does not support "cd /d" so this // feature simply cannot work with them (Borland make does not even // support changing the drive letter with just "d:"). - const char* cd_cmd = this->MinGWMake? "cd /d " : "cd "; + const char* cd_cmd = this->IsMinGWMake() ? "cd /d " : "cd "; if(!this->UnixCD) { diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 4e48ad7..7b436a5 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -81,36 +81,6 @@ public: std::string &GetMakeSilentFlag() { return this->MakeSilentFlag; } /** - * Set to true if the shell being used is the windows shell. - * This controls if statements in the makefile and the SHELL variable. - * The default is false. - */ - void SetWindowsShell(bool v) {this->WindowsShell = v;} - - /** - * Set to true if the make tool being used is Watcom WMake. - */ - void SetWatcomWMake(bool v) {this->WatcomWMake = v;} - - /** - * Set to true if the make tool being used is MinGW Make. - */ - void SetMinGWMake(bool v) {this->MinGWMake = v;} - bool IsMinGWMake() const { return this->MinGWMake; } - - /** - * Set to true if the make tool being used is NMake. - */ - void SetNMake(bool v) {this->NMake = v;} - - /** - * Set to true if the shell being used is the MSYS shell. - * This controls if statements in the makefile and the SHELL variable. - * The default is false. - */ - void SetMSYSShell(bool v) {this->MSYSShell = v;} - - /** * If set to true, then NULL is set to nil for non Windows_NT. * This uses make syntax used by nmake and borland. * The default is false. diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index f95d09b..4a596d5 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -23,8 +23,6 @@ cmLocalVisualStudioGenerator cmLocalGenerator* parent) : cmLocalGenerator(gg, parent) { - this->WindowsShell = true; - this->WindowsVSIDE = true; this->Version = v; } http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=062836296c13271047c00490cbc02d64169cc8a0 commit 062836296c13271047c00490cbc02d64169cc8a0 Author: Stephen Kelly AuthorDate: Mon May 4 22:40:07 2015 +0200 Commit: Stephen Kelly CommitDate: Wed May 6 08:02:57 2015 +0200 cmLocalGenerator: Port loops to cmState::Snapshot. Make this code less dependent on being part of cmLocalGenerator, where it doesn't really belong. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 1099f0f..5ef0a3b 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2853,15 +2853,15 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote, //---------------------------------------------------------------------------- std::string cmLocalGenerator::FindRelativePathTopSource() { - cmLocalGenerator* gen = this; - std::vector gens; - gens.push_back(gen); + cmState::Snapshot snapshot = this->StateSnapshot; + std::vector snapshots; + snapshots.push_back(snapshot); while (true) { - gen = gen->GetParent(); - if (gen) + snapshot = snapshot.GetParent(); + if (snapshot.IsValid()) { - gens.push_back(gen); + snapshots.push_back(snapshot); } else { @@ -2869,13 +2869,12 @@ std::string cmLocalGenerator::FindRelativePathTopSource() } } - std::string result = gens.front()->StateSnapshot.GetCurrentSourceDirectory(); + std::string result = snapshots.front().GetCurrentSourceDirectory(); - for (std::vector::const_iterator it = gens.begin() + 1; - it != gens.end(); ++it) + for (std::vector::const_iterator it = + snapshots.begin() + 1; it != snapshots.end(); ++it) { - std::string currentSource = - (*it)->StateSnapshot.GetCurrentSourceDirectory(); + std::string currentSource = it->GetCurrentSourceDirectory(); if(cmSystemTools::IsSubDirectory(result, currentSource)) { result = currentSource; @@ -2888,15 +2887,15 @@ std::string cmLocalGenerator::FindRelativePathTopSource() //---------------------------------------------------------------------------- std::string cmLocalGenerator::FindRelativePathTopBinary() { - cmLocalGenerator* gen = this; - std::vector gens; - gens.push_back(gen); + cmState::Snapshot snapshot = this->StateSnapshot; + std::vector snapshots; + snapshots.push_back(snapshot); while (true) { - gen = gen->GetParent(); - if (gen) + snapshot = snapshot.GetParent(); + if (snapshot.IsValid()) { - gens.push_back(gen); + snapshots.push_back(snapshot); } else { @@ -2904,13 +2903,12 @@ std::string cmLocalGenerator::FindRelativePathTopBinary() } } - std::string result = gens.front()->StateSnapshot.GetCurrentBinaryDirectory(); + std::string result = snapshots.front().GetCurrentBinaryDirectory(); - for (std::vector::const_iterator it = gens.begin() + 1; - it != gens.end(); ++it) + for (std::vector::const_iterator it = + snapshots.begin() + 1; it != snapshots.end(); ++it) { - std::string currentBinary = - (*it)->StateSnapshot.GetCurrentBinaryDirectory(); + std::string currentBinary = it->GetCurrentBinaryDirectory(); if(cmSystemTools::IsSubDirectory(result, currentBinary)) { result = currentBinary; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1e4f6618dfaac13e70a5b3941daed02c8f989285 commit 1e4f6618dfaac13e70a5b3941daed02c8f989285 Author: Stephen Kelly AuthorDate: Mon May 4 22:38:37 2015 +0200 Commit: Stephen Kelly CommitDate: Wed May 6 08:02:57 2015 +0200 cmState: Add an accessor for Parent snapshot and a validity check. diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 67a2274..82a2939 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -522,3 +522,24 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) cmSystemTools::CollapseFullPath( this->State->OutputLocations[this->Position]); } + +bool cmState::Snapshot::IsValid() const +{ + return this->State ? true : false; +} + +cmState::Snapshot cmState::Snapshot::GetParent() const +{ + Snapshot snapshot; + if (!this->State) + { + return snapshot; + } + PositionType parentPos = this->State->ParentPositions[this->Position]; + if (parentPos > 0) + { + snapshot = Snapshot(this->State, parentPos); + } + + return snapshot; +} diff --git a/Source/cmState.h b/Source/cmState.h index d10fae3..ed58c64 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -36,6 +36,9 @@ public: const char* GetCurrentBinaryDirectory() const; void SetCurrentBinaryDirectory(std::string const& dir); + bool IsValid() const; + Snapshot GetParent() const; + private: friend class cmState; cmState* State; ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Wed May 6 10:35:44 2015 From: brad.king at kitware.com (Brad King) Date: Wed, 6 May 2015 10:35:44 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2579-g6a6fae9 Message-ID: <20150506143544.55ABCAFE7E@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, next has been updated via 6a6fae9caf7d70999db96e4317e62859a53dd5d4 (commit) via a6e4e73da3de092439b6fcfe884f44a7c8a1ad81 (commit) via 562e69dd500f3b1558ab3ffd62679b8b4b0df842 (commit) from 3b2929cd2d253b02f88112943db9b19b5ff81a9f (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6a6fae9caf7d70999db96e4317e62859a53dd5d4 commit 6a6fae9caf7d70999db96e4317e62859a53dd5d4 Merge: 3b2929c a6e4e73 Author: Brad King AuthorDate: Wed May 6 10:35:42 2015 -0400 Commit: CMake Topic Stage CommitDate: Wed May 6 10:35:42 2015 -0400 Merge topic 'vs-install-in-default-build' into next a6e4e73d VS: Add option to put INSTALL target in .sln default build 562e69dd Tests: Enable devenv tests on VS >= 10 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a6e4e73da3de092439b6fcfe884f44a7c8a1ad81 commit a6e4e73da3de092439b6fcfe884f44a7c8a1ad81 Author: Robert Goulet AuthorDate: Fri May 1 13:46:17 2015 -0400 Commit: Brad King CommitDate: Wed May 6 10:31:39 2015 -0400 VS: Add option to put INSTALL target in .sln default build Add a CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD variable to control this behavior. diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index cbc8a07..e6c966b 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -268,6 +268,7 @@ Variables that Control the Build /variable/CMAKE_TRY_COMPILE_CONFIGURATION /variable/CMAKE_USE_RELATIVE_PATHS /variable/CMAKE_VISIBILITY_INLINES_HIDDEN + /variable/CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD /variable/CMAKE_WIN32_EXECUTABLE /variable/CMAKE_XCODE_ATTRIBUTE_an-attribute /variable/EXECUTABLE_OUTPUT_PATH diff --git a/Help/release/dev/vs-install-in-default-build.rst b/Help/release/dev/vs-install-in-default-build.rst new file mode 100644 index 0000000..b57592e --- /dev/null +++ b/Help/release/dev/vs-install-in-default-build.rst @@ -0,0 +1,7 @@ +vs-install-in-default-build +--------------------------- + +* The :ref:`Visual Studio Generators` learned a new + :variable:`CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD` option + to put the ``INSTALL`` target in the default build of a + solution (``.sln``) file. diff --git a/Help/variable/CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD.rst b/Help/variable/CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD.rst new file mode 100644 index 0000000..68f1ff6 --- /dev/null +++ b/Help/variable/CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD.rst @@ -0,0 +1,8 @@ +CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD +----------------------------------------- + +Include INSTALL target to default build. + +In Visual Studio solution, by default the INSTALL target will not be part of +the default build. Setting this variable will enable the INSTALL target to be +part of the default build. diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index de90f7e..ead5ddc 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -1031,6 +1031,24 @@ cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild( int type = target->GetType(); if (type == cmTarget::GLOBAL_TARGET) { + // check if INSTALL target is part of default build + if(target->GetName() == "INSTALL") + { + // inspect CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD properties + for(std::vector::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + const char* propertyValue = target->GetMakefile() + ->GetDefinition("CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD"); + cmGeneratorExpression ge; + cmsys::auto_ptr + cge = ge.Parse(propertyValue); + if(cmSystemTools::IsOn(cge->Evaluate(target->GetMakefile(), *i))) + { + activeConfigs.insert(*i); + } + } + } return activeConfigs; } if(type == cmTarget::UTILITY && !this->IsDependedOn(projectTargets, target)) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index a6cefa2..9e340a8 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1870,6 +1870,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-project VSExcludeFromDefaultBuild + --build-target install --test-command ${CMAKE_COMMAND} -D "activeConfig=${config}" -D "allConfigs=${CMAKE_CONFIGURATION_TYPES}" diff --git a/Tests/VSExcludeFromDefaultBuild/CMakeLists.txt b/Tests/VSExcludeFromDefaultBuild/CMakeLists.txt index d30414b..243fdf5 100644 --- a/Tests/VSExcludeFromDefaultBuild/CMakeLists.txt +++ b/Tests/VSExcludeFromDefaultBuild/CMakeLists.txt @@ -1,6 +1,9 @@ cmake_minimum_required(VERSION 2.8.9) project(VSExcludeFromDefaultBuild) +# CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD will enable the INSTALL target to be part of the default build +set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) + # First step is to clear all .exe files in output so that possible past # failures of this test do not prevent it from succeeding. add_custom_target(ClearExes ALL @@ -13,6 +16,7 @@ add_custom_target(ClearExes ALL function(add_test_executable target) add_executable("${target}" ${ARGN}) add_dependencies("${target}" ClearExes) + install(TARGETS "${target}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/$/install" OPTIONAL) endfunction() add_test_executable(DefaultBuilt main.c) diff --git a/Tests/VSExcludeFromDefaultBuild/ClearExes.cmake b/Tests/VSExcludeFromDefaultBuild/ClearExes.cmake index ece30ad..99cf1a5 100644 --- a/Tests/VSExcludeFromDefaultBuild/ClearExes.cmake +++ b/Tests/VSExcludeFromDefaultBuild/ClearExes.cmake @@ -2,3 +2,7 @@ file(GLOB exeFiles "${dir}/*.exe") foreach(exeFile IN LISTS exeFiles) file(REMOVE "${exeFile}") endforeach() +file(GLOB exeFiles "${dir}/install/*.exe") +foreach(exeFile IN LISTS exeFiles) + file(REMOVE "${exeFile}") +endforeach() diff --git a/Tests/VSExcludeFromDefaultBuild/ResultTest.cmake b/Tests/VSExcludeFromDefaultBuild/ResultTest.cmake index 8fb00bf..f96e70b 100644 --- a/Tests/VSExcludeFromDefaultBuild/ResultTest.cmake +++ b/Tests/VSExcludeFromDefaultBuild/ResultTest.cmake @@ -7,6 +7,12 @@ macro(TestExists exeName) else() message(FATAL_ERROR "File ${exeFile} was expected ${ARGN} to exist!") endif() + set(exeFile "${dir}/${activeConfig}/install/${exeName}.exe") + if(${ARGN} EXISTS "${exeFile}") + message(STATUS "File ${exeFile} was correctly found ${ARGN} to exist.") + else() + message(FATAL_ERROR "File ${exeFile} was expected ${ARGN} to exist!") + endif() endmacro() TestExists(DefaultBuilt) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=562e69dd500f3b1558ab3ffd62679b8b4b0df842 commit 562e69dd500f3b1558ab3ffd62679b8b4b0df842 Author: Brad King AuthorDate: Mon May 4 16:03:43 2015 -0400 Commit: Brad King CommitDate: Mon May 4 16:07:23 2015 -0400 Tests: Enable devenv tests on VS >= 10 The VSExcludeFromDefaultBuild have not been enabled on VS >= 10 since commit v3.0.0-rc1~260^2~9 (Tests: Simplify VSExcludeFromDefaultBuild configuration, 2013-11-14). Since commit v3.0.0-rc1~260^2~2 (VS: Add CMAKE_VS_(DEVENV|MSBUILD|MSDEV)_COMMAND variables, 2013-12-04) we can simply check the CMAKE_VS_DEVENV_COMMAND variable for a devenv tool to use for the test. diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 07545ae..a6cefa2 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -46,7 +46,9 @@ configure_file(${CMake_SOURCE_DIR}/Tests/EnforceConfig.cmake.in # Testing if(BUILD_TESTING) set(CMake_TEST_DEVENV "") - if(CMAKE_GENERATOR MATCHES "Visual Studio [7-9] " AND + if(CMAKE_VS_DEVENV_COMMAND) + set(CMake_TEST_DEVENV "${CMAKE_VS_DEVENV_COMMAND}") + elseif(CMAKE_GENERATOR MATCHES "Visual Studio [7-9] " AND NOT CMAKE_MAKE_PROGRAM MATCHES "[mM][sS][bB][uU][iI][lL][dD]\\.[eE][xX][eE]") set(CMake_TEST_DEVENV "${CMAKE_MAKE_PROGRAM}") endif() ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-variables.7.rst | 1 + Help/release/dev/vs-install-in-default-build.rst | 7 +++++++ .../CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD.rst | 8 ++++++++ Source/cmGlobalVisualStudio7Generator.cxx | 18 ++++++++++++++++++ Tests/CMakeLists.txt | 5 ++++- Tests/VSExcludeFromDefaultBuild/CMakeLists.txt | 4 ++++ Tests/VSExcludeFromDefaultBuild/ClearExes.cmake | 4 ++++ Tests/VSExcludeFromDefaultBuild/ResultTest.cmake | 6 ++++++ 8 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 Help/release/dev/vs-install-in-default-build.rst create mode 100644 Help/variable/CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD.rst hooks/post-receive -- CMake From brad.king at kitware.com Wed May 6 15:05:47 2015 From: brad.king at kitware.com (Brad King) Date: Wed, 6 May 2015 15:05:47 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2581-g86d8b40 Message-ID: <20150506190547.D6C42AFA42@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, next has been updated via 86d8b40eac87b4b62510761d0d05782cc880e4d3 (commit) via aff70532bfd39f2e7073d40983506a13ec362410 (commit) from 6a6fae9caf7d70999db96e4317e62859a53dd5d4 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=86d8b40eac87b4b62510761d0d05782cc880e4d3 commit 86d8b40eac87b4b62510761d0d05782cc880e4d3 Merge: 6a6fae9 aff7053 Author: Brad King AuthorDate: Wed May 6 15:05:47 2015 -0400 Commit: CMake Topic Stage CommitDate: Wed May 6 15:05:47 2015 -0400 Merge topic 'refactor-cmLocalGenerator' into next aff70532 cmGlobalBorlandMakefileGenerator: Do not inherit from NMake generator http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=aff70532bfd39f2e7073d40983506a13ec362410 commit aff70532bfd39f2e7073d40983506a13ec362410 Author: Brad King AuthorDate: Wed May 6 14:48:28 2015 -0400 Commit: Brad King CommitDate: Wed May 6 14:48:28 2015 -0400 cmGlobalBorlandMakefileGenerator: Do not inherit from NMake generator The Borland generator re-implements every method the NMake generator does, so there is no reason to inherit this way. Instead inherit directly from cmGlobalUnixMakefileGenerator3 like all the other makefile generators do. diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h index 3f79414..4f24d2d 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.h +++ b/Source/cmGlobalBorlandMakefileGenerator.h @@ -19,7 +19,7 @@ * * cmGlobalBorlandMakefileGenerator manages nmake build process for a tree */ -class cmGlobalBorlandMakefileGenerator : public cmGlobalNMakeMakefileGenerator +class cmGlobalBorlandMakefileGenerator : public cmGlobalUnixMakefileGenerator3 { public: cmGlobalBorlandMakefileGenerator(); ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalBorlandMakefileGenerator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From domen.vrankar at gmail.com Wed May 6 15:57:18 2015 From: domen.vrankar at gmail.com (Domen Vrankar) Date: Wed, 6 May 2015 15:57:18 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2583-g583be25 Message-ID: <20150506195718.3E3BFAF287@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, next has been updated via 583be259f60d03db0b74905e4905f93db1bf7cc4 (commit) via a62900e206b322d127ff0efc07d2d7e6da8ab412 (commit) from 86d8b40eac87b4b62510761d0d05782cc880e4d3 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=583be259f60d03db0b74905e4905f93db1bf7cc4 commit 583be259f60d03db0b74905e4905f93db1bf7cc4 Merge: 86d8b40 a62900e Author: Domen Vrankar AuthorDate: Wed May 6 15:57:17 2015 -0400 Commit: CMake Topic Stage CommitDate: Wed May 6 15:57:17 2015 -0400 Merge topic 'cpack-deb-component-auto-discovery' into next a62900e2 fixup! CPack/DEB component dependency auto-discovery http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a62900e206b322d127ff0efc07d2d7e6da8ab412 commit a62900e206b322d127ff0efc07d2d7e6da8ab412 Author: Domen Vrankar AuthorDate: Wed May 6 21:56:29 2015 +0200 Commit: Domen Vrankar CommitDate: Wed May 6 21:56:29 2015 +0200 fixup! CPack/DEB component dependency auto-discovery Only execute dpkg-shlibdeps if executable files linked to dynamically linked libraries were found inside a currently generated package diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 609d2ec..ac0fbe1 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -312,22 +312,24 @@ function(cpack_deb_prepare_package_vars) if( ${_FILE} MATCHES "ELF.*dynamically linked") string(REGEX MATCH "(^.*):" _FILE_NAME "${_FILE}") list(APPEND CPACK_DEB_BINARY_FILES "${CMAKE_MATCH_1}") + set(CONTAINS_EXECUTABLE_FILES_ TRUE) endif() endforeach() - message( "CPackDeb: - Generating dependency list") + if(CONTAINS_EXECUTABLE_FILES_) + message("CPackDeb: - Generating dependency list") - # Create blank control file for running dpkg-shlibdeps - # There might be some other way to invoke dpkg-shlibdeps without creating this file - # but standard debian package should not have anything that can collide with this file or directory - file(MAKE_DIRECTORY ${CPACK_TEMPORARY_DIRECTORY}/debian) - file(WRITE ${CPACK_TEMPORARY_DIRECTORY}/debian/control "") + # Create blank control file for running dpkg-shlibdeps + # There might be some other way to invoke dpkg-shlibdeps without creating this file + # but standard debian package should not have anything that can collide with this file or directory + file(MAKE_DIRECTORY ${CPACK_TEMPORARY_DIRECTORY}/debian) + file(WRITE ${CPACK_TEMPORARY_DIRECTORY}/debian/control "") - # only set ignore-missing-info flag for dpkg-shlibdeps that have --version option - # (those are newer and also have --ignore-missing-info flag) - if(SHLIBDEPS_EXECUTABLE_VERSION) - set(IGNORE_MISSING_INFO_FLAG "--ignore-missing-info") - endif() + # only set ignore-missing-info flag for dpkg-shlibdeps that have --version option + # (those are newer and also have --ignore-missing-info flag) + if(SHLIBDEPS_EXECUTABLE_VERSION) + set(IGNORE_MISSING_INFO_FLAG "--ignore-missing-info") + endif() # Execute dpkg-shlibdeps # --ignore-missing-info : allow dpkg-shlibdeps to run even if some libs do not belong to a package @@ -350,24 +352,28 @@ function(cpack_deb_prepare_package_vars) "binary files: '${CPACK_DEB_BINARY_FILES}'") endif() - #Get rid of prefix generated by dpkg-shlibdeps - string(REGEX REPLACE "^.*Depends=" "" CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS "${SHLIBDEPS_OUTPUT}") + #Get rid of prefix generated by dpkg-shlibdeps + string(REGEX REPLACE "^.*Depends=" "" CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS "${SHLIBDEPS_OUTPUT}") - if(CPACK_DEBIAN_PACKAGE_DEBUG) - message( "CPackDeb Debug: Found dependency: ${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}") - endif() + if(CPACK_DEBIAN_PACKAGE_DEBUG) + message( "CPackDeb Debug: Found dependency: ${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}") + endif() - # Remove blank control file - # Might not be safe if package actual contain file or directory named debian - file(REMOVE_RECURSE "${CPACK_TEMPORARY_DIRECTORY}/debian") + # Remove blank control file + # Might not be safe if package actual contain file or directory named debian + file(REMOVE_RECURSE "${CPACK_TEMPORARY_DIRECTORY}/debian") - # Append user depend if set - if(CPACK_DEBIAN_PACKAGE_DEPENDS) - set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}, ${CPACK_DEBIAN_PACKAGE_DEPENDS}") + # Append user depend if set + if(CPACK_DEBIAN_PACKAGE_DEPENDS) + set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}, ${CPACK_DEBIAN_PACKAGE_DEPENDS}") + else() + set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}") + endif() else() - set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}") + if(CPACK_DEBIAN_PACKAGE_DEBUG) + message( "CPackDeb Debug: Using only user-provided depends because package does not contain executable files.") + endif() endif() - else() if(CPACK_DEBIAN_PACKAGE_DEBUG) message( "CPackDeb Debug: Using only user-provided depends because dpkg-shlibdeps is not found.") ----------------------------------------------------------------------- Summary of changes: Modules/CPackDeb.cmake | 54 +++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 24 deletions(-) hooks/post-receive -- CMake From domen.vrankar at gmail.com Wed May 6 17:15:57 2015 From: domen.vrankar at gmail.com (Domen Vrankar) Date: Wed, 6 May 2015 17:15:57 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2585-gffd4c58 Message-ID: <20150506211557.DD177AE08A@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, next has been updated via ffd4c588ef0e205f665f19e1bc9ad241cc757061 (commit) via d498c8b1b6c98c72208d60f91bfc321e455b0f84 (commit) from 583be259f60d03db0b74905e4905f93db1bf7cc4 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ffd4c588ef0e205f665f19e1bc9ad241cc757061 commit ffd4c588ef0e205f665f19e1bc9ad241cc757061 Merge: 583be25 d498c8b Author: Domen Vrankar AuthorDate: Wed May 6 17:15:55 2015 -0400 Commit: CMake Topic Stage CommitDate: Wed May 6 17:15:55 2015 -0400 Merge topic 'cpack-deb-component-auto-discovery' into next d498c8b1 fixup! CPack/DEB component dependency auto-discovery http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d498c8b1b6c98c72208d60f91bfc321e455b0f84 commit d498c8b1b6c98c72208d60f91bfc321e455b0f84 Author: Domen Vrankar AuthorDate: Wed May 6 23:15:39 2015 +0200 Commit: Domen Vrankar CommitDate: Wed May 6 23:15:39 2015 +0200 fixup! CPack/DEB component dependency auto-discovery Cosmetic changes diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index ac0fbe1..d1d5d09 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -331,26 +331,26 @@ function(cpack_deb_prepare_package_vars) set(IGNORE_MISSING_INFO_FLAG "--ignore-missing-info") endif() - # Execute dpkg-shlibdeps - # --ignore-missing-info : allow dpkg-shlibdeps to run even if some libs do not belong to a package - # -O : print to STDOUT - execute_process(COMMAND ${SHLIBDEPS_EXECUTABLE} ${IGNORE_MISSING_INFO_FLAG} -O ${CPACK_DEB_BINARY_FILES} - WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" - OUTPUT_VARIABLE SHLIBDEPS_OUTPUT - RESULT_VARIABLE SHLIBDEPS_RESULT - ERROR_VARIABLE SHLIBDEPS_ERROR - OUTPUT_STRIP_TRAILING_WHITESPACE ) - if(CPACK_DEBIAN_PACKAGE_DEBUG) - # dpkg-shlibdeps will throw some warnings if some input files are not binary - message( "CPackDeb Debug: dpkg-shlibdeps warnings \n${SHLIBDEPS_ERROR}") - endif() - if(NOT SHLIBDEPS_RESULT EQUAL 0) - message (FATAL_ERROR "CPackDeb: dpkg-shlibdeps: '${SHLIBDEPS_ERROR}';\n" - "executed command: '${SHLIBDEPS_EXECUTABLE} ${IGNORE_MISSING_INFO_FLAG} -O ${CPACK_DEB_BINARY_FILES}';\n" - "found files: '${INSTALL_FILE_}';\n" - "files info: '${CPACK_DEB_INSTALL_FILES}';\n" - "binary files: '${CPACK_DEB_BINARY_FILES}'") - endif() + # Execute dpkg-shlibdeps + # --ignore-missing-info : allow dpkg-shlibdeps to run even if some libs do not belong to a package + # -O : print to STDOUT + execute_process(COMMAND ${SHLIBDEPS_EXECUTABLE} ${IGNORE_MISSING_INFO_FLAG} -O ${CPACK_DEB_BINARY_FILES} + WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" + OUTPUT_VARIABLE SHLIBDEPS_OUTPUT + RESULT_VARIABLE SHLIBDEPS_RESULT + ERROR_VARIABLE SHLIBDEPS_ERROR + OUTPUT_STRIP_TRAILING_WHITESPACE ) + if(CPACK_DEBIAN_PACKAGE_DEBUG) + # dpkg-shlibdeps will throw some warnings if some input files are not binary + message( "CPackDeb Debug: dpkg-shlibdeps warnings \n${SHLIBDEPS_ERROR}") + endif() + if(NOT SHLIBDEPS_RESULT EQUAL 0) + message (FATAL_ERROR "CPackDeb: dpkg-shlibdeps: '${SHLIBDEPS_ERROR}';\n" + "executed command: '${SHLIBDEPS_EXECUTABLE} ${IGNORE_MISSING_INFO_FLAG} -O ${CPACK_DEB_BINARY_FILES}';\n" + "found files: '${INSTALL_FILE_}';\n" + "files info: '${CPACK_DEB_INSTALL_FILES}';\n" + "binary files: '${CPACK_DEB_BINARY_FILES}'") + endif() #Get rid of prefix generated by dpkg-shlibdeps string(REGEX REPLACE "^.*Depends=" "" CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS "${SHLIBDEPS_OUTPUT}") @@ -371,7 +371,7 @@ function(cpack_deb_prepare_package_vars) endif() else() if(CPACK_DEBIAN_PACKAGE_DEBUG) - message( "CPackDeb Debug: Using only user-provided depends because package does not contain executable files.") + message( "CPackDeb Debug: Using only user-provided depends because package does not contain executable files that contain dynamically linked libraries.") endif() endif() else() ----------------------------------------------------------------------- Summary of changes: Modules/CPackDeb.cmake | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu May 7 00:01:07 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 7 May 2015 00:01:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.2-1056-gb3ae060 Message-ID: <20150507040107.7D0BEAFBB1@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 b3ae0609db88d8f82f7fb4f18ddb73f3456a67d2 (commit) from 3bc6f4f4762ba32d77b229e3385a8084015369b2 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b3ae0609db88d8f82f7fb4f18ddb73f3456a67d2 commit b3ae0609db88d8f82f7fb4f18ddb73f3456a67d2 Author: Kitware Robot AuthorDate: Thu May 7 00:01:05 2015 -0400 Commit: Kitware Robot CommitDate: Thu May 7 00:01:05 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 76d3865..180cdd7 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 2) -set(CMake_VERSION_PATCH 20150506) +set(CMake_VERSION_PATCH 20150507) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu May 7 09:08:11 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 7 May 2015 09:08:11 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2588-g67d888e Message-ID: <20150507130811.DA620AFF41@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, next has been updated via 67d888ec916cff125030f00c5770a2cc547ec7cb (commit) via 65e6b1152fad1b8282761abdfcc389ea4fd4747e (commit) via 3bc6f4f4762ba32d77b229e3385a8084015369b2 (commit) from ffd4c588ef0e205f665f19e1bc9ad241cc757061 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=67d888ec916cff125030f00c5770a2cc547ec7cb commit 67d888ec916cff125030f00c5770a2cc547ec7cb Merge: ffd4c58 65e6b11 Author: Brad King AuthorDate: Thu May 7 09:08:08 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu May 7 09:08:08 2015 -0400 Merge topic 'WCDH-CMP0054-safety' into next 65e6b115 WCDH: Fix condition when variables named "FILE" or "PREFIX" are defined 3bc6f4f4 CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=65e6b1152fad1b8282761abdfcc389ea4fd4747e commit 65e6b1152fad1b8282761abdfcc389ea4fd4747e Author: Brad King AuthorDate: Thu May 7 09:00:45 2015 -0400 Commit: Brad King CommitDate: Thu May 7 09:00:45 2015 -0400 WCDH: Fix condition when variables named "FILE" or "PREFIX" are defined Reported-by: Kevin Godby diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake index f4dcb21..a3b73bb 100644 --- a/Modules/WriteCompilerDetectionHeader.cmake +++ b/Modules/WriteCompilerDetectionHeader.cmake @@ -246,10 +246,10 @@ function(write_compiler_detection_header file_keyword file_arg prefix_keyword prefix_arg ) - if (NOT file_keyword STREQUAL FILE) + if (NOT "x${file_keyword}" STREQUAL "xFILE") message(FATAL_ERROR "write_compiler_detection_header: FILE parameter missing.") endif() - if (NOT prefix_keyword STREQUAL PREFIX) + if (NOT "x${prefix_keyword}" STREQUAL "xPREFIX") message(FATAL_ERROR "write_compiler_detection_header: PREFIX parameter missing.") endif() set(options) ----------------------------------------------------------------------- Summary of changes: Modules/WriteCompilerDetectionHeader.cmake | 4 ++-- Source/CMakeVersion.cmake | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu May 7 09:38:24 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 7 May 2015 09:38:24 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2590-gabd6448 Message-ID: <20150507133824.5BB03AFF5B@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, next has been updated via abd6448ad81d3c865c2462a41f965bf5775fc410 (commit) via e228d66d60ca8c7609d56fb135b2e68f686d34af (commit) from 67d888ec916cff125030f00c5770a2cc547ec7cb (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=abd6448ad81d3c865c2462a41f965bf5775fc410 commit abd6448ad81d3c865c2462a41f965bf5775fc410 Merge: 67d888e e228d66 Author: Brad King AuthorDate: Thu May 7 09:38:23 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu May 7 09:38:23 2015 -0400 Merge topic 'suppress-LNK4089-warning' into next e228d66d CTestCustom: Suppress LNK4089 warning about ole32 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e228d66d60ca8c7609d56fb135b2e68f686d34af commit e228d66d60ca8c7609d56fb135b2e68f686d34af Author: Brad King AuthorDate: Thu May 7 08:58:38 2015 -0400 Commit: Brad King CommitDate: Thu May 7 09:37:34 2015 -0400 CTestCustom: Suppress LNK4089 warning about ole32 diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index 8a345b0..2fecebb 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -35,6 +35,7 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION "LINK : warning LNK4089: all references to.*PSAPI.DLL.*discarded by /OPT:REF" "LINK : warning LNK4089: all references to.*SHELL32.dll.*discarded by /OPT:REF" "LINK : warning LNK4089: all references to.*USER32.dll.*discarded by /OPT:REF" + "LINK : warning LNK4089: all references to.*ole32.dll.*discarded by /OPT:REF" "Warning: library was too large for page size.*" "Warning: public.*_archive_.*in module.*archive_*clashes with prior module.*archive_.*" "Warning: public.*BZ2_bz.*in module.*bzlib.*clashes with prior module.*bzlib.*" ----------------------------------------------------------------------- Summary of changes: CTestCustom.cmake.in | 1 + 1 file changed, 1 insertion(+) hooks/post-receive -- CMake From ben.boeckel at kitware.com Thu May 7 13:01:48 2015 From: ben.boeckel at kitware.com (Ben Boeckel) Date: Thu, 7 May 2015 13:01:48 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2593-gfd1cf6d Message-ID: <20150507170149.53631AFBC0@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, next has been updated via fd1cf6da106a1f77e5d7b0c79c1c01677d41385f (commit) via 0f5c6d89535655a83953b5b58ad8422778736780 (commit) via b3ae0609db88d8f82f7fb4f18ddb73f3456a67d2 (commit) from abd6448ad81d3c865c2462a41f965bf5775fc410 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fd1cf6da106a1f77e5d7b0c79c1c01677d41385f commit fd1cf6da106a1f77e5d7b0c79c1c01677d41385f Merge: abd6448 0f5c6d8 Author: Ben Boeckel AuthorDate: Thu May 7 13:01:46 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu May 7 13:01:46 2015 -0400 Merge topic 'replace-make--i' into next 0f5c6d89 cmGlobalUnixMakefileGenerator3: use -k rather than -i b3ae0609 CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0f5c6d89535655a83953b5b58ad8422778736780 commit 0f5c6d89535655a83953b5b58ad8422778736780 Author: Ben Boeckel AuthorDate: Thu May 7 12:56:28 2015 -0400 Commit: Ben Boeckel CommitDate: Thu May 7 13:01:04 2015 -0400 cmGlobalUnixMakefileGenerator3: use -k rather than -i The `-i` flag ignores errors and causes the return code to always be "success". This causes problems because make implementations put "i" into the MAKEFLAGS environment variable which is then used in any submake invokations. This is particularly bad when using ExternalProject which may use `make` during a configure step and can cause a project to get invalid results when detecting its environment. Instead, use `-k` which is similar except that the return code indicates whether the tool actually completed successfully or not. diff --git a/Help/release/dev/replace-make--i.rst b/Help/release/dev/replace-make--i.rst new file mode 100644 index 0000000..db50382 --- /dev/null +++ b/Help/release/dev/replace-make--i.rst @@ -0,0 +1,5 @@ +replace-make--i +--------------- + +* When building with :command:`ctest_build`, use ``-k`` rather than ``-i`` so + that the return code is meaningful. diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 165a3c8..67cb23f 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -198,7 +198,7 @@ protected: cmGeneratedFileStream *CommandDatabase; private: - virtual const char* GetBuildIgnoreErrorsFlag() const { return "-i"; } + virtual const char* GetBuildIgnoreErrorsFlag() const { return "-k"; } virtual std::string GetEditCacheCommand() const; }; ----------------------------------------------------------------------- Summary of changes: Help/release/dev/replace-make--i.rst | 5 +++++ Source/CMakeVersion.cmake | 2 +- Source/cmGlobalUnixMakefileGenerator3.h | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 Help/release/dev/replace-make--i.rst hooks/post-receive -- CMake From ben.boeckel at kitware.com Thu May 7 13:06:07 2015 From: ben.boeckel at kitware.com (Ben Boeckel) Date: Thu, 7 May 2015 13:06:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2597-gd186a17 Message-ID: <20150507170613.5185BAFD38@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, next has been updated via d186a17dcfc4c5950ccba09408f434dde606af59 (commit) via 5731fb2e5e30747a46b1e328539310d059115ad9 (commit) via 753da8c6f14f68d59978b63a57c343c7f0dec72f (commit) via 5ab896aede1efc0cd35ae73f0a9b400258fcad09 (commit) from fd1cf6da106a1f77e5d7b0c79c1c01677d41385f (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d186a17dcfc4c5950ccba09408f434dde606af59 commit d186a17dcfc4c5950ccba09408f434dde606af59 Merge: fd1cf6d 5731fb2 Author: Ben Boeckel AuthorDate: Thu May 7 13:06:05 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu May 7 13:06:05 2015 -0400 Merge topic 'update-ctest_build-docs' into next 5731fb2e ctest_build: mention CTEST_BUILD_COMMAND in the docs 753da8c6 ctest_build: update the default target documentation 5ab896ae ctest_build: spruce up the documentation a bit http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5731fb2e5e30747a46b1e328539310d059115ad9 commit 5731fb2e5e30747a46b1e328539310d059115ad9 Author: Ben Boeckel AuthorDate: Thu May 7 13:05:30 2015 -0400 Commit: Ben Boeckel CommitDate: Thu May 7 13:05:54 2015 -0400 ctest_build: mention CTEST_BUILD_COMMAND in the docs diff --git a/Help/command/ctest_build.rst b/Help/command/ctest_build.rst index 2c3cfa8..5c0a4e9 100644 --- a/Help/command/ctest_build.rst +++ b/Help/command/ctest_build.rst @@ -29,7 +29,8 @@ that would have been printed to the console otherwise. The summary of warnings / errors, as well as the output from the native build tool is unaffected by this option. -If set, the contents of the variable ``CTEST_BUILD_FLAGS`` are passed as -additional arguments to the underlying build command. This can, e.g., be used -to trigger a parallel build using the ``-j`` option of make. See -:module:`ProcessorCount` for an example. +If set, the contents of the variable ``CTEST_BUILD_COMMAND`` is used to build +the project. In addition, if set, the contents of the variable +``CTEST_BUILD_FLAGS`` are passed as additional arguments to the underlying +build command. This can, e.g., be used to trigger a parallel build using the +``-j`` option of make. See :module:`ProcessorCount` for an example. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=753da8c6f14f68d59978b63a57c343c7f0dec72f commit 753da8c6f14f68d59978b63a57c343c7f0dec72f Author: Ben Boeckel AuthorDate: Thu May 7 13:05:15 2015 -0400 Commit: Ben Boeckel CommitDate: Thu May 7 13:05:54 2015 -0400 ctest_build: update the default target documentation diff --git a/Help/command/ctest_build.rst b/Help/command/ctest_build.rst index 7c9029e..2c3cfa8 100644 --- a/Help/command/ctest_build.rst +++ b/Help/command/ctest_build.rst @@ -12,7 +12,8 @@ Builds the given build directory and stores results in Build.xml. If no ``BUILD`` is given, the :variable:`CTEST_BINARY_DIRECTORY` variable is used. The ``TARGET`` variable can be used to specify a build target. If none is -specified, the "all" target will be built. +specified, the default target ("ALL_BUILD" for Visual Studio generators and +"all" in others) will be built. The ``RETURN_VALUE`` option specifies a variable in which to store the return value of the native build tool. The ``NUMBER_ERRORS`` and http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5ab896aede1efc0cd35ae73f0a9b400258fcad09 commit 5ab896aede1efc0cd35ae73f0a9b400258fcad09 Author: Ben Boeckel AuthorDate: Thu May 7 13:04:21 2015 -0400 Commit: Ben Boeckel CommitDate: Thu May 7 13:05:54 2015 -0400 ctest_build: spruce up the documentation a bit Adds markup and links to other sections. diff --git a/Help/command/ctest_build.rst b/Help/command/ctest_build.rst index e7a54d1..7c9029e 100644 --- a/Help/command/ctest_build.rst +++ b/Help/command/ctest_build.rst @@ -8,27 +8,27 @@ Build the project. ctest_build([BUILD build_dir] [TARGET target] [RETURN_VALUE res] [APPEND][NUMBER_ERRORS val] [NUMBER_WARNINGS val]) -Builds the given build directory and stores results in Build.xml. If -no BUILD is given, the CTEST_BINARY_DIRECTORY variable is used. +Builds the given build directory and stores results in Build.xml. If no +``BUILD`` is given, the :variable:`CTEST_BINARY_DIRECTORY` variable is used. -The TARGET variable can be used to specify a build target. If none is +The ``TARGET`` variable can be used to specify a build target. If none is specified, the "all" target will be built. -The RETURN_VALUE option specifies a variable in which to store the -return value of the native build tool. The NUMBER_ERRORS and -NUMBER_WARNINGS options specify variables in which to store the number +The ``RETURN_VALUE`` option specifies a variable in which to store the +return value of the native build tool. The ``NUMBER_ERRORS`` and +``NUMBER_WARNINGS`` options specify variables in which to store the number of build errors and warnings detected. -The APPEND option marks results for append to those previously -submitted to a dashboard server since the last ctest_start. Append +The ``APPEND`` option marks results for append to those previously +submitted to a dashboard server since the last :command:`ctest_start`. Append semantics are defined by the dashboard server in use. -The QUIET option suppresses any CTest-specific non-error output +The ``QUIET`` option suppresses any CTest-specific non-error output that would have been printed to the console otherwise. The summary of warnings / errors, as well as the output from the native build tool is unaffected by this option. -If set, the contents of the variable CTEST_BUILD_FLAGS are passed as -additional arguments to the underlying build command. This can e.g. be -used to trigger a parallel build using the -j option of make. See +If set, the contents of the variable ``CTEST_BUILD_FLAGS`` are passed as +additional arguments to the underlying build command. This can, e.g., be used +to trigger a parallel build using the ``-j`` option of make. See :module:`ProcessorCount` for an example. ----------------------------------------------------------------------- Summary of changes: Help/command/ctest_build.rst | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu May 7 14:23:11 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 7 May 2015 14:23:11 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2599-gd46ef6e Message-ID: <20150507182312.2E1ECAF6CE@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, next has been updated via d46ef6e9675f427e643ef387d9c60a13bf02fbc8 (commit) via 4588a1697f47404598c728c4a61a0bba091cd5a7 (commit) from d186a17dcfc4c5950ccba09408f434dde606af59 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d46ef6e9675f427e643ef387d9c60a13bf02fbc8 commit d46ef6e9675f427e643ef387d9c60a13bf02fbc8 Merge: d186a17 4588a16 Author: Brad King AuthorDate: Thu May 7 14:23:08 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu May 7 14:23:08 2015 -0400 Merge topic 'cpack-deb-component-auto-discovery' into next 4588a169 CPack/DEB component dependency auto-discovery http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4588a1697f47404598c728c4a61a0bba091cd5a7 commit 4588a1697f47404598c728c4a61a0bba091cd5a7 Author: Raffi Enficiaud AuthorDate: Sat May 2 22:14:57 2015 +0200 Commit: Brad King CommitDate: Thu May 7 14:21:57 2015 -0400 CPack/DEB component dependency auto-discovery Dependency auto-discovery can now be set per component diff --git a/Help/release/dev/cpack-deb-component-auto-discovery.rst b/Help/release/dev/cpack-deb-component-auto-discovery.rst new file mode 100644 index 0000000..cc74db2 --- /dev/null +++ b/Help/release/dev/cpack-deb-component-auto-discovery.rst @@ -0,0 +1,6 @@ +cpack-deb-component-auto-discovery +---------------------------------- + +* The :module:`CPackDeb` module learned a new + :variable:`CPACK_DEBIAN__PACKAGE_SHLIBDEPS` + variable to specify per-component use of ``dpkg-shlibdeps``. diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 24452a6..d1d5d09 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -103,16 +103,23 @@ # characters such as <>. # # .. variable:: CPACK_DEBIAN_PACKAGE_SHLIBDEPS -# -# * Mandatory : NO -# * Default : OFF +# CPACK_DEBIAN__PACKAGE_SHLIBDEPS # # May be set to ON in order to use dpkg-shlibdeps to generate # better package dependency list. -# You may need set CMAKE_INSTALL_RPATH toi appropriate value -# if you use this feature, because if you don't dpkg-shlibdeps -# may fail to find your own shared libs. -# See http://www.cmake.org/Wiki/CMake_RPATH_handling. +# +# * Mandatory : NO +# * Default : +# +# - :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS` if set or +# - OFF +# +# .. note:: +# +# 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 http://www.cmake.org/Wiki/CMake_RPATH_handling. # # .. variable:: CPACK_DEBIAN_PACKAGE_DEBUG # @@ -245,92 +252,135 @@ function(cpack_deb_prepare_package_vars) set(CPACK_DEBIAN_FAKEROOT_EXECUTABLE ${FAKEROOT_EXECUTABLE}) endif() + set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_PATH}") + + # per component automatic discover: some of the component might not have + # binaries. + if(CPACK_DEB_PACKAGE_COMPONENT) + string(TOUPPER "${CPACK_DEB_PACKAGE_COMPONENT}" _local_component_name) + set(_component_shlibdeps_var "CPACK_DEBIAN_${_local_component_name}_PACKAGE_SHLIBDEPS") + + # if set, overrides the global configuration + if(DEFINED ${_component_shlibdeps_var}) + set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS "${${_component_shlibdeps_var}}") + if(CPACK_DEBIAN_PACKAGE_DEBUG) + message("CPackDeb Debug: component '${CPACK_DEB_PACKAGE_COMPONENT}' dpkg-shlibdeps set to ${CPACK_DEBIAN_PACKAGE_SHLIBDEPS}") + endif() + endif() + endif() + if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS) # dpkg-shlibdeps is a Debian utility for generating dependency list find_program(SHLIBDEPS_EXECUTABLE dpkg-shlibdeps) - # Check version of the dpkg-shlibdeps tool using CPackRPM method if(SHLIBDEPS_EXECUTABLE) + # Check version of the dpkg-shlibdeps tool using CPackRPM method execute_process(COMMAND env LC_ALL=C ${SHLIBDEPS_EXECUTABLE} --version OUTPUT_VARIABLE _TMP_VERSION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) string(REGEX MATCH "dpkg-shlibdeps version ([0-9]+\\.[0-9]+\\.[0-9]+)" SHLIBDEPS_EXECUTABLE_VERSION - ${_TMP_VERSION}) + "${_TMP_VERSION}") set(SHLIBDEPS_EXECUTABLE_VERSION "${CMAKE_MATCH_1}") + if(CPACK_DEBIAN_PACKAGE_DEBUG) - message( "CPackDeb Debug: dpkg-shlibdeps version is <${SHLIBDEPS_EXECUTABLE_VERSION}>") + message("CPackDeb Debug: dpkg-shlibdeps --version output is '${_TMP_VERSION}'") + message("CPackDeb Debug: dpkg-shlibdeps version is <${SHLIBDEPS_EXECUTABLE_VERSION}>") endif() # Generating binary list - Get type of all install files - execute_process(COMMAND find -type f - COMMAND xargs file - WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" - OUTPUT_VARIABLE CPACK_DEB_INSTALL_FILES) - - # Convert to CMake list - string(REPLACE "\n" ";" CPACK_DEB_INSTALL_FILES ${CPACK_DEB_INSTALL_FILES}) + cmake_policy(PUSH) + # Tell file(GLOB_RECURSE) not to follow directory symlinks + # even if the project does not set this policy to NEW. + cmake_policy(SET CMP0009 NEW) + file(GLOB_RECURSE FILE_PATHS_ LIST_DIRECTORIES false RELATIVE "${WDIR}" "${WDIR}/*") + cmake_policy(POP) + + # get file info so that we can determine if file is executable or not + unset(CPACK_DEB_INSTALL_FILES) + foreach(FILE_ IN LISTS FILE_PATHS_) + execute_process(COMMAND file "./${FILE_}" + WORKING_DIRECTORY "${WDIR}" + OUTPUT_VARIABLE INSTALL_FILE_) + list(APPEND CPACK_DEB_INSTALL_FILES "${INSTALL_FILE_}") + endforeach() # Only dynamically linked ELF files are included # Extract only file name infront of ":" - foreach ( _FILE ${CPACK_DEB_INSTALL_FILES}) - if ( ${_FILE} MATCHES "ELF.*dynamically linked") - string(REGEX MATCH "(^.*):" _FILE_NAME ${_FILE}) - list(APPEND CPACK_DEB_BINARY_FILES ${CMAKE_MATCH_1}) + foreach(_FILE ${CPACK_DEB_INSTALL_FILES}) + if( ${_FILE} MATCHES "ELF.*dynamically linked") + string(REGEX MATCH "(^.*):" _FILE_NAME "${_FILE}") + list(APPEND CPACK_DEB_BINARY_FILES "${CMAKE_MATCH_1}") + set(CONTAINS_EXECUTABLE_FILES_ TRUE) endif() endforeach() - message( "CPackDeb: - Generating dependency list") - - # Create blank control file for running dpkg-shlibdeps - # There might be some other way to invoke dpkg-shlibdeps without creating this file - # but standard debian package should not have anything that can collide with this file or directory - file(MAKE_DIRECTORY ${CPACK_TEMPORARY_DIRECTORY}/debian) - file(WRITE ${CPACK_TEMPORARY_DIRECTORY}/debian/control "") - - # Execute dpkg-shlibdeps - # --ignore-missing-info : allow dpkg-shlibdeps to run even if some libs do not belong to a package - # -O : print to STDOUT - execute_process(COMMAND ${SHLIBDEPS_EXECUTABLE} --ignore-missing-info -O ${CPACK_DEB_BINARY_FILES} - WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" - OUTPUT_VARIABLE SHLIBDEPS_OUTPUT - RESULT_VARIABLE SHLIBDEPS_RESULT - ERROR_VARIABLE SHLIBDEPS_ERROR - OUTPUT_STRIP_TRAILING_WHITESPACE ) - if(CPACK_DEBIAN_PACKAGE_DEBUG) - # dpkg-shlibdeps will throw some warnings if some input files are not binary - message( "CPackDeb Debug: dpkg-shlibdeps warnings \n${SHLIBDEPS_ERROR}") - endif() - if (NOT SHLIBDEPS_RESULT EQUAL 0) - message (FATAL_ERROR "CPackDeb: dpkg-shlibdeps: ${SHLIBDEPS_ERROR}") - endif () + if(CONTAINS_EXECUTABLE_FILES_) + message("CPackDeb: - Generating dependency list") - #Get rid of prefix generated by dpkg-shlibdeps - string (REGEX REPLACE "^.*Depends=" "" CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS ${SHLIBDEPS_OUTPUT}) + # Create blank control file for running dpkg-shlibdeps + # There might be some other way to invoke dpkg-shlibdeps without creating this file + # but standard debian package should not have anything that can collide with this file or directory + file(MAKE_DIRECTORY ${CPACK_TEMPORARY_DIRECTORY}/debian) + file(WRITE ${CPACK_TEMPORARY_DIRECTORY}/debian/control "") - if(CPACK_DEBIAN_PACKAGE_DEBUG) - message( "CPackDeb Debug: Found dependency: ${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}") - endif() + # only set ignore-missing-info flag for dpkg-shlibdeps that have --version option + # (those are newer and also have --ignore-missing-info flag) + if(SHLIBDEPS_EXECUTABLE_VERSION) + set(IGNORE_MISSING_INFO_FLAG "--ignore-missing-info") + endif() + + # Execute dpkg-shlibdeps + # --ignore-missing-info : allow dpkg-shlibdeps to run even if some libs do not belong to a package + # -O : print to STDOUT + execute_process(COMMAND ${SHLIBDEPS_EXECUTABLE} ${IGNORE_MISSING_INFO_FLAG} -O ${CPACK_DEB_BINARY_FILES} + WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" + OUTPUT_VARIABLE SHLIBDEPS_OUTPUT + RESULT_VARIABLE SHLIBDEPS_RESULT + ERROR_VARIABLE SHLIBDEPS_ERROR + OUTPUT_STRIP_TRAILING_WHITESPACE ) + if(CPACK_DEBIAN_PACKAGE_DEBUG) + # dpkg-shlibdeps will throw some warnings if some input files are not binary + message( "CPackDeb Debug: dpkg-shlibdeps warnings \n${SHLIBDEPS_ERROR}") + endif() + if(NOT SHLIBDEPS_RESULT EQUAL 0) + message (FATAL_ERROR "CPackDeb: dpkg-shlibdeps: '${SHLIBDEPS_ERROR}';\n" + "executed command: '${SHLIBDEPS_EXECUTABLE} ${IGNORE_MISSING_INFO_FLAG} -O ${CPACK_DEB_BINARY_FILES}';\n" + "found files: '${INSTALL_FILE_}';\n" + "files info: '${CPACK_DEB_INSTALL_FILES}';\n" + "binary files: '${CPACK_DEB_BINARY_FILES}'") + endif() + + #Get rid of prefix generated by dpkg-shlibdeps + string(REGEX REPLACE "^.*Depends=" "" CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS "${SHLIBDEPS_OUTPUT}") - # Remove blank control file - # Might not be safe if package actual contain file or directory named debian - file(REMOVE_RECURSE "${CPACK_TEMPORARY_DIRECTORY}/debian") + if(CPACK_DEBIAN_PACKAGE_DEBUG) + message( "CPackDeb Debug: Found dependency: ${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}") + endif() - # Append user depend if set - if (CPACK_DEBIAN_PACKAGE_DEPENDS) - set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}, ${CPACK_DEBIAN_PACKAGE_DEPENDS}") - else () - set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}") - endif () + # Remove blank control file + # Might not be safe if package actual contain file or directory named debian + file(REMOVE_RECURSE "${CPACK_TEMPORARY_DIRECTORY}/debian") - else () + # Append user depend if set + if(CPACK_DEBIAN_PACKAGE_DEPENDS) + set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}, ${CPACK_DEBIAN_PACKAGE_DEPENDS}") + else() + set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}") + endif() + else() + if(CPACK_DEBIAN_PACKAGE_DEBUG) + message( "CPackDeb Debug: Using only user-provided depends because package does not contain executable files that contain dynamically linked libraries.") + endif() + endif() + else() if(CPACK_DEBIAN_PACKAGE_DEBUG) message( "CPackDeb Debug: Using only user-provided depends because dpkg-shlibdeps is not found.") endif() endif() - else () + else() if(CPACK_DEBIAN_PACKAGE_DEBUG) message( "CPackDeb Debug: Using only user-provided depends") endif() @@ -452,8 +502,6 @@ function(cpack_deb_prepare_package_vars) set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "") endif() - set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_PATH}") - # Print out some debug information if we were asked for that if(CPACK_DEBIAN_PACKAGE_DEBUG) message("CPackDeb:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}") diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 07545ae..35326a5 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1010,7 +1010,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(DEB_TEST_NAMES "CPackComponentsDEB") set(DEB_CONFIGURATIONS_TO_TEST "components-lintian-dpkgdeb-checks" "components-description1" - "components-description2") + "components-description2" + "components-shlibdeps1") set(CPackGen "DEB") set(CPackRun_CPackGen "-DCPackGen=${CPackGen}") diff --git a/Tests/CPackComponentsDEB/MyLibCPackConfig-components-shlibdeps1.cmake.in b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-shlibdeps1.cmake.in new file mode 100644 index 0000000..cfe6df5 --- /dev/null +++ b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-shlibdeps1.cmake.in @@ -0,0 +1,24 @@ +# +# Activate component packaging +# + +if(CPACK_GENERATOR MATCHES "DEB") + set(CPACK_DEB_COMPONENT_INSTALL "ON") +endif() + +# +# Choose grouping way +# +#set(CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE) +#set(CPACK_COMPONENTS_GROUPING) +set(CPACK_COMPONENTS_IGNORE_GROUPS 1) +#set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1) + +# we set shlibdeps to on +set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) +# except for the component "headers" that do not contain any binary. +# the packaging will just fail if this does not work +set(CPACK_DEBIAN_HEADERS_PACKAGE_SHLIBDEPS OFF) + +# Also libraries contains only a static library. +set(CPACK_DEBIAN_LIBRARIES_PACKAGE_SHLIBDEPS OFF) diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-shlibdeps1.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-shlibdeps1.cmake new file mode 100644 index 0000000..79d8f0d --- /dev/null +++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-shlibdeps1.cmake @@ -0,0 +1,75 @@ +if(NOT CPackComponentsDEB_SOURCE_DIR) + message(FATAL_ERROR "CPackComponentsDEB_SOURCE_DIR not set") +endif() + +include(${CPackComponentsDEB_SOURCE_DIR}/RunCPackVerifyResult.cmake) + + + +# requirements + +# debian now produces lower case names +set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/MyLib-*.deb") +set(expected_count 3) + + +set(actual_output) +run_cpack(actual_output + CPack_output + CPack_error + EXPECTED_FILE_MASK "${expected_file_mask}" + CONFIG_ARGS ${config_args} + CONFIG_VERBOSE ${config_verbose}) + +message(STATUS "expected_count='${expected_count}'") +message(STATUS "expected_file_mask='${expected_file_mask}'") +message(STATUS "actual_output_files='${actual_output}'") + +if(NOT actual_output) + message(FATAL_ERROR "error: expected_files do not exist: CPackComponentsDEB test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error}") +endif() + +list(LENGTH actual_output actual_count) +message(STATUS "actual_count='${actual_count}'") +if(NOT actual_count EQUAL expected_count) + message(FATAL_ERROR "error: expected_count=${expected_count} does not match actual_count=${actual_count}: CPackComponents test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error})") +endif() + + +# dpkg-deb checks for the summary of the packages +find_program(DPKGDEB_EXECUTABLE dpkg-deb) +if(DPKGDEB_EXECUTABLE) + set(dpkgdeb_output_errors_all) + foreach(_f IN LISTS actual_output) + + # extracts the metadata from the package + run_dpkgdeb(dpkg_output + FILENAME ${_f} + ) + + dpkgdeb_return_specific_metaentry(dpkg_package_name + DPKGDEB_OUTPUT "${dpkg_output}" + METAENTRY "Package:") + + message(STATUS "package='${dpkg_package_name}'") + + if("${dpkg_package_name}" STREQUAL "mylib-applications") + # pass + elseif("${dpkg_package_name}" STREQUAL "mylib-headers") + # pass + elseif("${dpkg_package_name}" STREQUAL "mylib-libraries") + # pass + else() + set(dpkgdeb_output_errors_all ${dpkgdeb_output_errors_all} + "dpkg-deb: ${_f}: component name not found: ${dpkg_package_name}\n") + endif() + + endforeach() + + + if(NOT "${dpkgdeb_output_errors_all}" STREQUAL "") + message(FATAL_ERROR "dpkg-deb checks failed:\n${dpkgdeb_output_errors_all}") + endif() +else() + message("dpkg-deb executable not found - skipping dpkg-deb test") +endif() ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Thu May 7 14:25:33 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 7 May 2015 14:25:33 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.2-1058-g6b9e2f7 Message-ID: <20150507182535.25128AE71D@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 6b9e2f710054da4acb67240670ba75b22044d3a5 (commit) via 4588a1697f47404598c728c4a61a0bba091cd5a7 (commit) from b3ae0609db88d8f82f7fb4f18ddb73f3456a67d2 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6b9e2f710054da4acb67240670ba75b22044d3a5 commit 6b9e2f710054da4acb67240670ba75b22044d3a5 Merge: b3ae060 4588a16 Author: Brad King AuthorDate: Thu May 7 14:25:31 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu May 7 14:25:31 2015 -0400 Merge topic 'cpack-deb-component-auto-discovery' 4588a169 CPack/DEB component dependency auto-discovery ----------------------------------------------------------------------- Summary of changes: .../dev/cpack-deb-component-auto-discovery.rst | 6 + Modules/CPackDeb.cmake | 174 +++++++++++++------- Tests/CMakeLists.txt | 3 +- ...MyLibCPackConfig-components-shlibdeps1.cmake.in | 24 +++ ...nCPackVerifyResult-components-shlibdeps1.cmake} | 34 ++-- 5 files changed, 155 insertions(+), 86 deletions(-) create mode 100644 Help/release/dev/cpack-deb-component-auto-discovery.rst create mode 100644 Tests/CPackComponentsDEB/MyLibCPackConfig-components-shlibdeps1.cmake.in copy Tests/CPackComponentsDEB/{RunCPackVerifyResult-components-description2.cmake => RunCPackVerifyResult-components-shlibdeps1.cmake} (59%) hooks/post-receive -- CMake From brad.king at kitware.com Thu May 7 14:25:38 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 7 May 2015 14:25:38 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.2-1061-g18527c4 Message-ID: <20150507182539.469E1AFA67@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 18527c4991a5f555c0464270ca283d37632b9395 (commit) via a6e4e73da3de092439b6fcfe884f44a7c8a1ad81 (commit) via 562e69dd500f3b1558ab3ffd62679b8b4b0df842 (commit) from 6b9e2f710054da4acb67240670ba75b22044d3a5 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=18527c4991a5f555c0464270ca283d37632b9395 commit 18527c4991a5f555c0464270ca283d37632b9395 Merge: 6b9e2f7 a6e4e73 Author: Brad King AuthorDate: Thu May 7 14:25:37 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu May 7 14:25:37 2015 -0400 Merge topic 'vs-install-in-default-build' a6e4e73d VS: Add option to put INSTALL target in .sln default build 562e69dd Tests: Enable devenv tests on VS >= 10 ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-variables.7.rst | 1 + Help/release/dev/vs-install-in-default-build.rst | 7 +++++++ .../CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD.rst | 8 ++++++++ Source/cmGlobalVisualStudio7Generator.cxx | 18 ++++++++++++++++++ Tests/CMakeLists.txt | 5 ++++- Tests/VSExcludeFromDefaultBuild/CMakeLists.txt | 4 ++++ Tests/VSExcludeFromDefaultBuild/ClearExes.cmake | 4 ++++ Tests/VSExcludeFromDefaultBuild/ResultTest.cmake | 6 ++++++ 8 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 Help/release/dev/vs-install-in-default-build.rst create mode 100644 Help/variable/CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD.rst hooks/post-receive -- CMake From brad.king at kitware.com Thu May 7 14:25:41 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 7 May 2015 14:25:41 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.2-1063-g8102417 Message-ID: <20150507182542.3ADD0AFA8C@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 8102417695cb0800de38d60c26c1b0a1d7eaa182 (commit) via 1a2a73a5181fd519559e140da24fcd2d9b33fdca (commit) from 18527c4991a5f555c0464270ca283d37632b9395 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8102417695cb0800de38d60c26c1b0a1d7eaa182 commit 8102417695cb0800de38d60c26c1b0a1d7eaa182 Merge: 18527c4 1a2a73a Author: Brad King AuthorDate: Thu May 7 14:25:40 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu May 7 14:25:40 2015 -0400 Merge topic 'cpack-rpm-debug-log-fix' 1a2a73a5 CPack/RPM fix output in debug log ----------------------------------------------------------------------- Summary of changes: Modules/CPackRPM.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu May 7 14:25:45 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 7 May 2015 14:25:45 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.2-1068-ge4e09de Message-ID: <20150507182546.B87A3AF854@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 e4e09dee92da27218b96f3add3036abb701c8352 (commit) via a874700fc2da9331140e93df4088c6a1021d3cc3 (commit) via 71f38d060bb729e1ac6cfe8db412c0ef96b68cc7 (commit) via f6749f727451ef3e35c20e80e712f0bda38348f9 (commit) via 0c34ac2f0159645f6a2cd0f57a45ffae36b4352d (commit) from 8102417695cb0800de38d60c26c1b0a1d7eaa182 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e4e09dee92da27218b96f3add3036abb701c8352 commit e4e09dee92da27218b96f3add3036abb701c8352 Merge: 8102417 a874700 Author: Brad King AuthorDate: Thu May 7 14:25:43 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu May 7 14:25:43 2015 -0400 Merge topic 'update-kwsys' a874700f Merge branch 'upstream-kwsys' into update-kwsys 71f38d06 KWSys 2015-05-05 (8c8b2273) f6749f72 Merge branch 'upstream-kwsys' into update-kwsys 0c34ac2f KWSys 2015-05-04 (c2387a4b) ----------------------------------------------------------------------- Summary of changes: Source/kwsys/.gitattributes | 16 ++ Source/kwsys/DynamicLoader.cxx | 4 + Source/kwsys/Glob.hxx.in | 6 + Source/kwsys/ProcessUNIX.c | 355 +++++++++++++------------ Source/kwsys/ProcessWin32.c | 559 ++++++++++++++++++---------------------- 5 files changed, 472 insertions(+), 468 deletions(-) create mode 100644 Source/kwsys/.gitattributes hooks/post-receive -- CMake From brad.king at kitware.com Thu May 7 14:26:26 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 7 May 2015 14:26:26 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2604-g7ec84d7 Message-ID: <20150507182627.3F8B6AFAF4@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, next has been updated via 7ec84d7f0f861f49abaa801604bbff2b1518746c (commit) via e4e09dee92da27218b96f3add3036abb701c8352 (commit) via 8102417695cb0800de38d60c26c1b0a1d7eaa182 (commit) via 18527c4991a5f555c0464270ca283d37632b9395 (commit) via 6b9e2f710054da4acb67240670ba75b22044d3a5 (commit) from d46ef6e9675f427e643ef387d9c60a13bf02fbc8 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7ec84d7f0f861f49abaa801604bbff2b1518746c commit 7ec84d7f0f861f49abaa801604bbff2b1518746c Merge: d46ef6e e4e09de Author: Brad King AuthorDate: Thu May 7 14:26:17 2015 -0400 Commit: Brad King CommitDate: Thu May 7 14:26:17 2015 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Thu May 7 14:32:13 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 7 May 2015 14:32:13 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.2-1072-gee1ddec Message-ID: <20150507183232.D4356AFE0D@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 ee1ddec4c19488216289dfd26998091b695bf3ee (commit) via 5731fb2e5e30747a46b1e328539310d059115ad9 (commit) via 753da8c6f14f68d59978b63a57c343c7f0dec72f (commit) via 5ab896aede1efc0cd35ae73f0a9b400258fcad09 (commit) from e4e09dee92da27218b96f3add3036abb701c8352 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ee1ddec4c19488216289dfd26998091b695bf3ee commit ee1ddec4c19488216289dfd26998091b695bf3ee Merge: e4e09de 5731fb2 Author: Brad King AuthorDate: Thu May 7 14:32:11 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu May 7 14:32:11 2015 -0400 Merge topic 'update-ctest_build-docs' 5731fb2e ctest_build: mention CTEST_BUILD_COMMAND in the docs 753da8c6 ctest_build: update the default target documentation 5ab896ae ctest_build: spruce up the documentation a bit ----------------------------------------------------------------------- Summary of changes: Help/command/ctest_build.rst | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu May 7 14:32:48 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 7 May 2015 14:32:48 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2606-g7d49049 Message-ID: <20150507183250.B0D9BAFBBE@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, next has been updated via 7d490498bc8156ea5fc66078642268491d44281e (commit) via ee1ddec4c19488216289dfd26998091b695bf3ee (commit) from 7ec84d7f0f861f49abaa801604bbff2b1518746c (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7d490498bc8156ea5fc66078642268491d44281e commit 7d490498bc8156ea5fc66078642268491d44281e Merge: 7ec84d7 ee1ddec Author: Brad King AuthorDate: Thu May 7 14:32:41 2015 -0400 Commit: Brad King CommitDate: Thu May 7 14:32:41 2015 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Thu May 7 15:07:07 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 7 May 2015 15:07:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2609-g397cd9f Message-ID: <20150507190709.747C2AFC91@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, next has been updated via 397cd9f9e643b01f271b796403d39443422b6a1a (commit) via 31c218e6e12affd482b9ce2880bd9385c77d9025 (commit) via ac94a796f1f0c5acc06d67d5ad283b29476c1d2e (commit) from 7d490498bc8156ea5fc66078642268491d44281e (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=397cd9f9e643b01f271b796403d39443422b6a1a commit 397cd9f9e643b01f271b796403d39443422b6a1a Merge: 7d49049 31c218e Author: Brad King AuthorDate: Thu May 7 15:07:04 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu May 7 15:07:04 2015 -0400 Merge topic 'update-kwsys' into next 31c218e6 Merge branch 'upstream-kwsys' into update-kwsys ac94a796 KWSys 2015-05-05 (34fceb50) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=31c218e6e12affd482b9ce2880bd9385c77d9025 commit 31c218e6e12affd482b9ce2880bd9385c77d9025 Merge: ee1ddec ac94a79 Author: Brad King AuthorDate: Thu May 7 14:34:50 2015 -0400 Commit: Brad King CommitDate: Thu May 7 14:34:50 2015 -0400 Merge branch 'upstream-kwsys' into update-kwsys http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ac94a796f1f0c5acc06d67d5ad283b29476c1d2e commit ac94a796f1f0c5acc06d67d5ad283b29476c1d2e Author: KWSys Robot AuthorDate: Tue May 5 09:05:38 2015 -0400 Commit: Brad King CommitDate: Thu May 7 14:34:47 2015 -0400 KWSys 2015-05-05 (34fceb50) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ 34fceb50 | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' 8c8b2273..34fceb50 Brad King (1): 34fceb50 Process: Add option to merge stdout/stderr diff --git a/Process.h.in b/Process.h.in index c5995ea..e35939f 100644 --- a/Process.h.in +++ b/Process.h.in @@ -36,6 +36,7 @@ # define kwsysProcess_SetPipeShared kwsys_ns(Process_SetPipeShared) # define kwsysProcess_Option_Detach kwsys_ns(Process_Option_Detach) # define kwsysProcess_Option_HideWindow kwsys_ns(Process_Option_HideWindow) +# define kwsysProcess_Option_MergeOutput kwsys_ns(Process_Option_MergeOutput) # define kwsysProcess_Option_Verbatim kwsys_ns(Process_Option_Verbatim) # define kwsysProcess_GetOption kwsys_ns(Process_GetOption) # define kwsysProcess_SetOption kwsys_ns(Process_SetOption) @@ -186,6 +187,12 @@ kwsysEXPORT void kwsysProcess_SetPipeNative(kwsysProcess* cp, int pipe, * 0 = No (default) * 1 = Yes * + * kwsysProcess_Option_MergeOutput = Whether to merge stdout/stderr. + * No content will be returned as stderr. + * Any actual stderr will be on stdout. + * 0 = No (default) + * 1 = Yes + * * kwsysProcess_Option_Verbatim = Whether SetCommand and AddCommand * should treat the first argument * as a verbatim command line @@ -200,6 +207,7 @@ enum kwsysProcess_Option_e { kwsysProcess_Option_HideWindow, kwsysProcess_Option_Detach, + kwsysProcess_Option_MergeOutput, kwsysProcess_Option_Verbatim }; @@ -384,6 +392,7 @@ kwsysEXPORT void kwsysProcess_Kill(kwsysProcess* cp); # undef kwsysProcess_SetPipeShared # undef kwsysProcess_Option_Detach # undef kwsysProcess_Option_HideWindow +# undef kwsysProcess_Option_MergeOutput # undef kwsysProcess_Option_Verbatim # undef kwsysProcess_GetOption # undef kwsysProcess_SetOption diff --git a/ProcessUNIX.c b/ProcessUNIX.c index 68722c2..0393a6d 100644 --- a/ProcessUNIX.c +++ b/ProcessUNIX.c @@ -234,6 +234,9 @@ struct kwsysProcess_s /* Whether to treat command lines as verbatim. */ int Verbatim; + /* Whether to merge stdout/stderr of the child. */ + int MergeOutput; + /* Time at which the child started. Negative for no timeout. */ kwsysProcessTime StartTime; @@ -644,6 +647,7 @@ int kwsysProcess_GetOption(kwsysProcess* cp, int optionId) switch(optionId) { case kwsysProcess_Option_Detach: return cp->OptionDetach; + case kwsysProcess_Option_MergeOutput: return cp->MergeOutput; case kwsysProcess_Option_Verbatim: return cp->Verbatim; default: return 0; } @@ -660,6 +664,7 @@ void kwsysProcess_SetOption(kwsysProcess* cp, int optionId, int value) switch(optionId) { case kwsysProcess_Option_Detach: cp->OptionDetach = value; break; + case kwsysProcess_Option_MergeOutput: cp->MergeOutput = value; break; case kwsysProcess_Option_Verbatim: cp->Verbatim = value; break; default: break; } @@ -997,7 +1002,7 @@ void kwsysProcess_Execute(kwsysProcess* cp) nextStdIn = p[0]; si.StdOut = p[1]; } - si.StdErr = cp->PipeChildStd[2]; + si.StdErr = cp->MergeOutput? cp->PipeChildStd[1] : cp->PipeChildStd[2]; { int res = kwsysProcessCreate(cp, i, &si); @@ -1011,7 +1016,7 @@ void kwsysProcess_Execute(kwsysProcess* cp) { kwsysProcessCleanupDescriptor(&si.StdOut); } - if (si.StdErr != cp->PipeChildStd[2]) + if (si.StdErr != cp->PipeChildStd[2] && !cp->MergeOutput) { kwsysProcessCleanupDescriptor(&si.StdErr); } diff --git a/ProcessWin32.c b/ProcessWin32.c index da1bc15..f630171 100644 --- a/ProcessWin32.c +++ b/ProcessWin32.c @@ -226,6 +226,9 @@ struct kwsysProcess_s /* Whether to treat command lines as verbatim. */ int Verbatim; + /* Whether to merge stdout/stderr of the child. */ + int MergeOutput; + /* Mutex to protect the shared index used by threads to report data. */ HANDLE SharedIndexMutex; @@ -806,6 +809,7 @@ int kwsysProcess_GetOption(kwsysProcess* cp, int optionId) { case kwsysProcess_Option_Detach: return cp->OptionDetach; case kwsysProcess_Option_HideWindow: return cp->HideWindow; + case kwsysProcess_Option_MergeOutput: return cp->MergeOutput; case kwsysProcess_Option_Verbatim: return cp->Verbatim; default: return 0; } @@ -823,6 +827,7 @@ void kwsysProcess_SetOption(kwsysProcess* cp, int optionId, int value) { case kwsysProcess_Option_Detach: cp->OptionDetach = value; break; case kwsysProcess_Option_HideWindow: cp->HideWindow = value; break; + case kwsysProcess_Option_MergeOutput: cp->MergeOutput = value; break; case kwsysProcess_Option_Verbatim: cp->Verbatim = value; break; default: break; } @@ -1086,7 +1091,7 @@ void kwsysProcess_Execute(kwsysProcess* cp) nextStdInput = p[0]; si.hStdOutput = p[1]; } - si.hStdError = cp->PipeChildStd[2]; + si.hStdError = cp->MergeOutput? cp->PipeChildStd[1] : cp->PipeChildStd[2]; { int res = kwsysProcessCreate(cp, i, &si); @@ -1100,7 +1105,7 @@ void kwsysProcess_Execute(kwsysProcess* cp) { kwsysProcessCleanupHandle(&si.hStdOutput); } - if (si.hStdError != cp->PipeChildStd[2]) + if (si.hStdError != cp->PipeChildStd[2] && !cp->MergeOutput) { kwsysProcessCleanupHandle(&si.hStdError); } ----------------------------------------------------------------------- Summary of changes: Source/kwsys/Process.h.in | 9 +++++++++ Source/kwsys/ProcessUNIX.c | 9 +++++++-- Source/kwsys/ProcessWin32.c | 9 +++++++-- 3 files changed, 23 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu May 7 15:07:23 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 7 May 2015 15:07:23 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2611-g28b1e89 Message-ID: <20150507190725.3B259AFC96@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, next has been updated via 28b1e89eb7c05634610d4ec1f38c8fa27877d200 (commit) via f65bb82f3688ba33faccf2ef0690571e1aa6edc2 (commit) from 397cd9f9e643b01f271b796403d39443422b6a1a (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=28b1e89eb7c05634610d4ec1f38c8fa27877d200 commit 28b1e89eb7c05634610d4ec1f38c8fa27877d200 Merge: 397cd9f f65bb82 Author: Brad King AuthorDate: Thu May 7 15:07:15 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu May 7 15:07:15 2015 -0400 Merge topic 'execute_process-merge-output' into next f65bb82f execute_process: Improve stdout/stderr merging http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f65bb82f3688ba33faccf2ef0690571e1aa6edc2 commit f65bb82f3688ba33faccf2ef0690571e1aa6edc2 Author: Brad King AuthorDate: Thu May 7 14:40:38 2015 -0400 Commit: Brad King CommitDate: Thu May 7 14:40:38 2015 -0400 execute_process: Improve stdout/stderr merging Use the KWSys Process "MergeOutput" option to give the child process the same pipe (or file) for both stdout and stderr. This allows natural merging of stdout and stderr together instead of merging on arbitrary buffered read boundaries as before. diff --git a/Help/command/execute_process.rst b/Help/command/execute_process.rst index 478b30e..c38ec1a 100644 --- a/Help/command/execute_process.rst +++ b/Help/command/execute_process.rst @@ -57,7 +57,8 @@ OUTPUT_VARIABLE, ERROR_VARIABLE INPUT_FILE, OUTPUT_FILE, ERROR_FILE The file named will be attached to the standard input of the first process, standard output of the last process, or standard error of - all processes, respectively. + all processes, respectively. If the same file is named for both + output and error then it will be used for both. OUTPUT_QUIET, ERROR_QUIET The standard output or standard error results will be quietly ignored. diff --git a/Help/release/dev/execute_process-merge-output.rst b/Help/release/dev/execute_process-merge-output.rst new file mode 100644 index 0000000..4c80cdd --- /dev/null +++ b/Help/release/dev/execute_process-merge-output.rst @@ -0,0 +1,5 @@ +execute_process-merge-output +---------------------------- + +* The :command:`execute_process` command learned to support specifying + the same file for ``OUTPUT_FILE`` and ``ERROR_FILE``. diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx index 1225992..a371390 100644 --- a/Source/cmExecuteProcessCommand.cxx +++ b/Source/cmExecuteProcessCommand.cxx @@ -255,7 +255,7 @@ bool cmExecuteProcessCommand cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1); // Check the output variables. - bool merge_output = (output_variable == error_variable); + bool merge_output = false; if(!input_file.empty()) { cmsysProcess_SetPipeFile(cp, cmsysProcess_Pipe_STDIN, input_file.c_str()); @@ -267,8 +267,23 @@ bool cmExecuteProcessCommand } if(!error_file.empty()) { - cmsysProcess_SetPipeFile(cp, cmsysProcess_Pipe_STDERR, - error_file.c_str()); + if (error_file == output_file) + { + merge_output = true; + } + else + { + cmsysProcess_SetPipeFile(cp, cmsysProcess_Pipe_STDERR, + error_file.c_str()); + } + } + if (!output_variable.empty() && output_variable == error_variable) + { + merge_output = true; + } + if (merge_output) + { + cmsysProcess_SetOption(cp, cmsysProcess_Option_MergeOutput, 1); } // Set the timeout if any. @@ -289,8 +304,7 @@ bool cmExecuteProcessCommand while((p = cmsysProcess_WaitForData(cp, &data, &length, 0), p)) { // Put the output in the right place. - if((p == cmsysProcess_Pipe_STDOUT && !output_quiet) || - (p == cmsysProcess_Pipe_STDERR && !error_quiet && merge_output)) + if (p == cmsysProcess_Pipe_STDOUT && !output_quiet) { if(output_variable.empty()) { diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index d5f1d22..16fb056 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -132,6 +132,7 @@ add_RunCMake_test(add_custom_command) add_RunCMake_test(add_custom_target) add_RunCMake_test(add_dependencies) add_RunCMake_test(build_command) +add_RunCMake_test(execute_process) add_RunCMake_test(export) add_RunCMake_test(cmake_minimum_required) add_RunCMake_test(continue) diff --git a/Tests/RunCMake/execute_process/MergeOutput-stdout.txt b/Tests/RunCMake/execute_process/MergeOutput-stdout.txt new file mode 100644 index 0000000..676f0ed --- /dev/null +++ b/Tests/RunCMake/execute_process/MergeOutput-stdout.txt @@ -0,0 +1,10 @@ +^-- Output on stdout +Output on stderr +-- Output on stdout +Output on stderr +-- Output on stdout +Output on stderr +-- Output on stdout +Output on stderr +-- Output on stdout +Output on stderr$ diff --git a/Tests/RunCMake/execute_process/MergeOutput.cmake b/Tests/RunCMake/execute_process/MergeOutput.cmake new file mode 100644 index 0000000..528ac90 --- /dev/null +++ b/Tests/RunCMake/execute_process/MergeOutput.cmake @@ -0,0 +1,4 @@ +foreach(i RANGE 1 5) + message(STATUS "Output on stdout") + message("Output on stderr") +endforeach() diff --git a/Tests/RunCMake/execute_process/MergeOutputFile-stderr.txt b/Tests/RunCMake/execute_process/MergeOutputFile-stderr.txt new file mode 100644 index 0000000..676f0ed --- /dev/null +++ b/Tests/RunCMake/execute_process/MergeOutputFile-stderr.txt @@ -0,0 +1,10 @@ +^-- Output on stdout +Output on stderr +-- Output on stdout +Output on stderr +-- Output on stdout +Output on stderr +-- Output on stdout +Output on stderr +-- Output on stdout +Output on stderr$ diff --git a/Tests/RunCMake/execute_process/MergeOutputFile.cmake b/Tests/RunCMake/execute_process/MergeOutputFile.cmake new file mode 100644 index 0000000..1a0d90e --- /dev/null +++ b/Tests/RunCMake/execute_process/MergeOutputFile.cmake @@ -0,0 +1,7 @@ +execute_process( + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_LIST_DIR}/MergeOutput.cmake + OUTPUT_FILE out.txt + ERROR_FILE out.txt + ) +file(READ out.txt out) +message("${out}") diff --git a/Tests/RunCMake/execute_process/MergeOutputVars-stderr.txt b/Tests/RunCMake/execute_process/MergeOutputVars-stderr.txt new file mode 100644 index 0000000..676f0ed --- /dev/null +++ b/Tests/RunCMake/execute_process/MergeOutputVars-stderr.txt @@ -0,0 +1,10 @@ +^-- Output on stdout +Output on stderr +-- Output on stdout +Output on stderr +-- Output on stdout +Output on stderr +-- Output on stdout +Output on stderr +-- Output on stdout +Output on stderr$ diff --git a/Tests/RunCMake/execute_process/MergeOutputVars.cmake b/Tests/RunCMake/execute_process/MergeOutputVars.cmake new file mode 100644 index 0000000..3e7c69e --- /dev/null +++ b/Tests/RunCMake/execute_process/MergeOutputVars.cmake @@ -0,0 +1,6 @@ +execute_process( + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_LIST_DIR}/MergeOutput.cmake + OUTPUT_VARIABLE out + ERROR_VARIABLE out + ) +message("${out}") diff --git a/Tests/RunCMake/execute_process/RunCMakeTest.cmake b/Tests/RunCMake/execute_process/RunCMakeTest.cmake new file mode 100644 index 0000000..2080437 --- /dev/null +++ b/Tests/RunCMake/execute_process/RunCMakeTest.cmake @@ -0,0 +1,8 @@ +include(RunCMake) + +set(RunCMake_TEST_OUTPUT_MERGE 1) +run_cmake_command(MergeOutput ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/MergeOutput.cmake) +unset(RunCMake_TEST_OUTPUT_MERGE) + +run_cmake_command(MergeOutputFile ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/MergeOutputFile.cmake) +run_cmake_command(MergeOutputVars ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/MergeOutputVars.cmake) ----------------------------------------------------------------------- Summary of changes: Help/command/execute_process.rst | 3 ++- Help/release/dev/execute_process-merge-output.rst | 5 ++++ Source/cmExecuteProcessCommand.cxx | 24 ++++++++++++++++---- Tests/RunCMake/CMakeLists.txt | 1 + .../execute_process/MergeOutput-stdout.txt | 10 ++++++++ Tests/RunCMake/execute_process/MergeOutput.cmake | 4 ++++ .../execute_process/MergeOutputFile-stderr.txt | 10 ++++++++ .../RunCMake/execute_process/MergeOutputFile.cmake | 7 ++++++ .../execute_process/MergeOutputVars-stderr.txt | 10 ++++++++ .../RunCMake/execute_process/MergeOutputVars.cmake | 6 +++++ Tests/RunCMake/execute_process/RunCMakeTest.cmake | 8 +++++++ 11 files changed, 82 insertions(+), 6 deletions(-) create mode 100644 Help/release/dev/execute_process-merge-output.rst create mode 100644 Tests/RunCMake/execute_process/MergeOutput-stdout.txt create mode 100644 Tests/RunCMake/execute_process/MergeOutput.cmake create mode 100644 Tests/RunCMake/execute_process/MergeOutputFile-stderr.txt create mode 100644 Tests/RunCMake/execute_process/MergeOutputFile.cmake create mode 100644 Tests/RunCMake/execute_process/MergeOutputVars-stderr.txt create mode 100644 Tests/RunCMake/execute_process/MergeOutputVars.cmake create mode 100644 Tests/RunCMake/execute_process/RunCMakeTest.cmake hooks/post-receive -- CMake From brad.king at kitware.com Thu May 7 15:10:37 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 7 May 2015 15:10:37 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2616-gef9e39a Message-ID: <20150507191044.4A6FBA7650@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, next has been updated via ef9e39a1cca51551a755cdeeebbaaf2c73708dff (commit) via 20560e8dca47d7ff80d1a2d9b4e0cf952fa1a790 (commit) via b3de0dfe93af769ee7420cd1380395d656b4dac9 (commit) via 378c2a0e860f32e0435844d7d6af79a4fdc2b455 (commit) via 957c2aac7fb4833b333cf3362cb8c6918a8e8a82 (commit) from 28b1e89eb7c05634610d4ec1f38c8fa27877d200 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ef9e39a1cca51551a755cdeeebbaaf2c73708dff commit ef9e39a1cca51551a755cdeeebbaaf2c73708dff Merge: 28b1e89 20560e8 Author: Brad King AuthorDate: Thu May 7 15:10:35 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu May 7 15:10:35 2015 -0400 Merge topic 'ninja-gcc-windows' into next 20560e8d Ninja: Do not use newlines in response files with Windows GNU tools (#15439) b3de0dfe Ninja: Use forward slashes for any GCC on Windows (#15439) 378c2a0e Ninja: Refactor detection of MinGW tools on Windows 957c2aac RC: Simplify selection of resource compiler based on C/C++ toolchain http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=20560e8dca47d7ff80d1a2d9b4e0cf952fa1a790 commit 20560e8dca47d7ff80d1a2d9b4e0cf952fa1a790 Author: Thomas Herz AuthorDate: Thu May 7 00:48:03 2015 +0200 Commit: Brad King CommitDate: Thu May 7 14:10:21 2015 -0400 Ninja: Do not use newlines in response files with Windows GNU tools (#15439) Since commit v2.8.11~213^2 (Ninja: Avoid LNK1170 linker error, 2013-02-01) we generate linker response files with "$in_newline" to support a large number of object files with the MS link.exe tool. However, the GNU linker on Windows does not understand the newline endings that Ninja puts in the response files. Switch back to "$in" for that case. diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 155a30e..4c51d23 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -202,7 +202,12 @@ cmNinjaNormalTargetGenerator responseFlag += rspfile; // build response file content - rspcontent = "$in_newline $LINK_PATH $LINK_LIBRARIES"; + if (this->GetGlobalGenerator()->IsGCCOnWindows()) { + rspcontent = "$in"; + } else { + rspcontent = "$in_newline"; + } + rspcontent += " $LINK_PATH $LINK_LIBRARIES"; vars.Objects = responseFlag.c_str(); vars.LinkLibraries = ""; } http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b3de0dfe93af769ee7420cd1380395d656b4dac9 commit b3de0dfe93af769ee7420cd1380395d656b4dac9 Author: Thomas Herz AuthorDate: Thu May 7 00:45:01 2015 +0200 Commit: Brad King CommitDate: Thu May 7 14:07:20 2015 -0400 Ninja: Use forward slashes for any GCC on Windows (#15439) Any GCC compiler on a Windows host needs forward slashes, not just those built for MinGW. diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 9894aa8..65e80e4 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -96,7 +96,7 @@ std::string cmGlobalNinjaGenerator::EncodePath(const std::string &path) { std::string result = path; #ifdef _WIN32 - if (this->IsMinGW()) + if (this->IsGCCOnWindows()) cmSystemTools::ReplaceString(result, "\\", "/"); else cmSystemTools::ReplaceString(result, "/", "\\"); @@ -484,7 +484,7 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator() , CompileCommandsStream(0) , Rules() , AllDependencies() - , UsingMinGW(false) + , UsingGCCOnWindows(false) , ComputingUnknownDependencies(false) , PolicyCMP0058(cmPolicies::WARN) { @@ -565,9 +565,13 @@ void cmGlobalNinjaGenerator this->ResolveLanguageCompiler(*l, mf, optional); } #ifdef _WIN32 - if (mf->IsOn("CMAKE_COMPILER_IS_MINGW")) + if (mf->IsOn("CMAKE_COMPILER_IS_MINGW") || + strcmp(mf->GetSafeDefinition("CMAKE_C_COMPILER_ID"), "GNU") == 0 || + strcmp(mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID"), "GNU") == 0 || + strcmp(mf->GetSafeDefinition("CMAKE_C_SIMULATE_ID"), "GNU") == 0 || + strcmp(mf->GetSafeDefinition("CMAKE_CXX_SIMULATE_ID"), "GNU") == 0) { - this->UsingMinGW = true; + this->UsingGCCOnWindows = true; } #endif } diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 9b6717a..00dc237 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -155,7 +155,7 @@ public: const cmNinjaDeps& targets, const std::string& comment = ""); - bool IsMinGW() const { return this->UsingMinGW; } + bool IsGCCOnWindows() const { return UsingGCCOnWindows; } public: /// Default constructor. @@ -360,7 +360,7 @@ private: /// The set of dependencies to add to the "all" target. cmNinjaDeps AllDependencies; - bool UsingMinGW; + bool UsingGCCOnWindows; /// The set of custom commands we have seen. std::set CustomCommands; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index a3c9be6..128a35b 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -175,7 +175,7 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile const* source, // needed by cmcldeps false, this->GetConfigName()); - if (this->GetGlobalGenerator()->IsMinGW()) + if (this->GetGlobalGenerator()->IsGCCOnWindows()) cmSystemTools::ReplaceString(includeFlags, "\\", "/"); this->LocalGenerator->AppendFlags(languageFlags, includeFlags); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=378c2a0e860f32e0435844d7d6af79a4fdc2b455 commit 378c2a0e860f32e0435844d7d6af79a4fdc2b455 Author: Brad King AuthorDate: Thu May 7 14:01:58 2015 -0400 Commit: Brad King CommitDate: Thu May 7 14:02:44 2015 -0400 Ninja: Refactor detection of MinGW tools on Windows Check for CMAKE_COMPILER_IS_MINGW only after enabling a language when it might actually be set. Previously this worked by accident because the check for working compiler or a second language enabled would cause the code path to be taken. Store UsingMinGW as an instance member of cmGlobalNinjaGenerator so that it is reset on each reconfigure. Otherwise cmake-gui cannot switch between build trees for MinGW or non-MinGW tools. diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 9a017e5..9894aa8 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -96,7 +96,7 @@ std::string cmGlobalNinjaGenerator::EncodePath(const std::string &path) { std::string result = path; #ifdef _WIN32 - if(UsingMinGW) + if (this->IsMinGW()) cmSystemTools::ReplaceString(result, "\\", "/"); else cmSystemTools::ReplaceString(result, "/", "\\"); @@ -484,6 +484,7 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator() , CompileCommandsStream(0) , Rules() , AllDependencies() + , UsingMinGW(false) , ComputingUnknownDependencies(false) , PolicyCMP0058(cmPolicies::WARN) { @@ -544,23 +545,16 @@ void cmGlobalNinjaGenerator::Generate() this->CloseBuildFileStream(); } -// Implemented in all cmGlobaleGenerator sub-classes. -// Used in: -// Source/cmMakefile.cxx: void cmGlobalNinjaGenerator ::EnableLanguage(std::vectorconst& langs, - cmMakefile* makefile, + cmMakefile* mf, bool optional) { - if (makefile->IsOn("CMAKE_COMPILER_IS_MINGW")) - { - UsingMinGW = true; - } if (std::find(langs.begin(), langs.end(), "Fortran") != langs.end()) { cmSystemTools::Error("The Ninja generator does not support Fortran yet."); } - this->cmGlobalGenerator::EnableLanguage(langs, makefile, optional); + this->cmGlobalGenerator::EnableLanguage(langs, mf, optional); for(std::vector::const_iterator l = langs.begin(); l != langs.end(); ++l) { @@ -568,12 +562,16 @@ void cmGlobalNinjaGenerator { continue; } - this->ResolveLanguageCompiler(*l, makefile, optional); + this->ResolveLanguageCompiler(*l, mf, optional); } +#ifdef _WIN32 + if (mf->IsOn("CMAKE_COMPILER_IS_MINGW")) + { + this->UsingMinGW = true; + } +#endif } -bool cmGlobalNinjaGenerator::UsingMinGW = false; - // Implemented by: // cmGlobalUnixMakefileGenerator3 // cmGlobalGhsMultiGenerator diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index d7b3add..9b6717a 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -63,7 +63,7 @@ public: static std::string EncodeIdent(const std::string &ident, std::ostream &vars); static std::string EncodeLiteral(const std::string &lit); - static std::string EncodePath(const std::string &path); + std::string EncodePath(const std::string &path); static std::string EncodeDepfileSpace(const std::string &path); /** @@ -155,9 +155,7 @@ public: const cmNinjaDeps& targets, const std::string& comment = ""); - - static bool IsMinGW() { return UsingMinGW; } - + bool IsMinGW() const { return this->UsingMinGW; } public: /// Default constructor. @@ -362,6 +360,8 @@ private: /// The set of dependencies to add to the "all" target. cmNinjaDeps AllDependencies; + bool UsingMinGW; + /// The set of custom commands we have seen. std::set CustomCommands; @@ -385,9 +385,6 @@ private: typedef std::map TargetAliasMap; TargetAliasMap TargetAliases; - - static bool UsingMinGW; - }; #endif // ! cmGlobalNinjaGenerator_h diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index dfd3c04..a3c9be6 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -175,7 +175,7 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile const* source, // needed by cmcldeps false, this->GetConfigName()); - if(cmGlobalNinjaGenerator::IsMinGW()) + if (this->GetGlobalGenerator()->IsMinGW()) cmSystemTools::ReplaceString(includeFlags, "\\", "/"); this->LocalGenerator->AppendFlags(languageFlags, includeFlags); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=957c2aac7fb4833b333cf3362cb8c6918a8e8a82 commit 957c2aac7fb4833b333cf3362cb8c6918a8e8a82 Author: Brad King AuthorDate: Thu May 7 11:43:02 2015 -0400 Commit: Brad King CommitDate: Thu May 7 11:43:02 2015 -0400 RC: Simplify selection of resource compiler based on C/C++ toolchain Revert the refactoring by commit v2.8.11~105^2~1 (Ninja: use MinGW generator code in EnableLanguage, 2013-03-09) and move the MinGW- specific logic back to the "MinGW Makefiles" generator. Instead teach the platform information modules for GNU and MSVC on Windows to set the preferred RC compiler just before enabling the RC language. This way we choose the RC compiler based on the C/C++ toolchain that is actually enabled. diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake index 3144ac4..1a46c10 100644 --- a/Modules/Platform/CYGWIN-GNU.cmake +++ b/Modules/Platform/CYGWIN-GNU.cmake @@ -53,5 +53,9 @@ macro(__cygwin_compiler_gnu lang) set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,--enable-auto-import") set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS}") + if(NOT CMAKE_RC_COMPILER_INIT) + set(CMAKE_RC_COMPILER_INIT windres) + endif() + enable_language(RC) endmacro() diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index c827c32..c0d7d8c 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -138,6 +138,10 @@ macro(__windows_compiler_gnu lang) endforeach() endif() + if(NOT CMAKE_RC_COMPILER_INIT) + set(CMAKE_RC_COMPILER_INIT windres) + endif() + enable_language(RC) endmacro() diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 2905cee..13fe8bc 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -298,6 +298,9 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON) + if(NOT CMAKE_RC_COMPILER_INIT) + set(CMAKE_RC_COMPILER_INIT rc) + endif() if(NOT CMAKE_RC_FLAGS_INIT) set(CMAKE_RC_FLAGS_INIT "${_PLATFORM_DEFINES} ${_PLATFORM_DEFINES_${lang}}") endif() diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 1c90537..746be4d 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2421,38 +2421,6 @@ bool cmGlobalGenerator::UseFolderProperty() } //---------------------------------------------------------------------------- -void cmGlobalGenerator::EnableMinGWLanguage(cmMakefile *mf) -{ - this->FindMakeProgram(mf); - std::string makeProgram = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); - std::vector locations; - locations.push_back(cmSystemTools::GetProgramPath(makeProgram)); - locations.push_back("/mingw/bin"); - locations.push_back("c:/mingw/bin"); - std::string tgcc = cmSystemTools::FindProgram("gcc", locations); - std::string gcc = "gcc.exe"; - if(!tgcc.empty()) - { - gcc = tgcc; - } - std::string tgxx = cmSystemTools::FindProgram("g++", locations); - std::string gxx = "g++.exe"; - if(!tgxx.empty()) - { - gxx = tgxx; - } - std::string trc = cmSystemTools::FindProgram("windres", locations); - std::string rc = "windres.exe"; - if(!trc.empty()) - { - rc = trc; - } - mf->AddDefinition("CMAKE_GENERATOR_CC", gcc.c_str()); - mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx.c_str()); - mf->AddDefinition("CMAKE_GENERATOR_RC", rc.c_str()); -} - -//---------------------------------------------------------------------------- cmTarget cmGlobalGenerator::CreateGlobalTarget( const std::string& name, const char* message, const cmCustomCommandLines* commandLines, diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 7107198..22ba288 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -433,7 +433,6 @@ protected: virtual const char* GetPredefinedTargetsFolder(); virtual bool UseFolderProperty(); - void EnableMinGWLanguage(cmMakefile *mf); private: cmMakefile* TryCompileOuterMakefile; diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx index c9389aa..b128870 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.cxx +++ b/Source/cmGlobalMinGWMakefileGenerator.cxx @@ -26,7 +26,33 @@ void cmGlobalMinGWMakefileGenerator cmMakefile *mf, bool optional) { - this->EnableMinGWLanguage(mf); + this->FindMakeProgram(mf); + std::string makeProgram = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); + std::vector locations; + locations.push_back(cmSystemTools::GetProgramPath(makeProgram)); + locations.push_back("/mingw/bin"); + locations.push_back("c:/mingw/bin"); + std::string tgcc = cmSystemTools::FindProgram("gcc", locations); + std::string gcc = "gcc.exe"; + if(!tgcc.empty()) + { + gcc = tgcc; + } + std::string tgxx = cmSystemTools::FindProgram("g++", locations); + std::string gxx = "g++.exe"; + if(!tgxx.empty()) + { + gxx = tgxx; + } + std::string trc = cmSystemTools::FindProgram("windres", locations); + std::string rc = "windres.exe"; + if(!trc.empty()) + { + rc = trc; + } + mf->AddDefinition("CMAKE_GENERATOR_CC", gcc.c_str()); + mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx.c_str()); + mf->AddDefinition("CMAKE_GENERATOR_RC", rc.c_str()); this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); } diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 678d60b..9a017e5 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -555,7 +555,6 @@ void cmGlobalNinjaGenerator if (makefile->IsOn("CMAKE_COMPILER_IS_MINGW")) { UsingMinGW = true; - this->EnableMinGWLanguage(makefile); } if (std::find(langs.begin(), langs.end(), "Fortran") != langs.end()) { ----------------------------------------------------------------------- Summary of changes: Modules/Platform/CYGWIN-GNU.cmake | 4 ++++ Modules/Platform/Windows-GNU.cmake | 4 ++++ Modules/Platform/Windows-MSVC.cmake | 3 +++ Source/cmGlobalGenerator.cxx | 32 ----------------------------- Source/cmGlobalGenerator.h | 1 - Source/cmGlobalMinGWMakefileGenerator.cxx | 28 ++++++++++++++++++++++++- Source/cmGlobalNinjaGenerator.cxx | 29 +++++++++++++------------- Source/cmGlobalNinjaGenerator.h | 11 ++++------ Source/cmNinjaNormalTargetGenerator.cxx | 7 ++++++- Source/cmNinjaTargetGenerator.cxx | 2 +- 10 files changed, 64 insertions(+), 57 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu May 7 16:13:58 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 7 May 2015 16:13:58 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.2-2619-g74e9daa Message-ID: <20150507201359.D0CD2AD5BD@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, next has been updated via 74e9daafbd5473099394bdcb4c86afaea834864a (commit) via 695d6f62d31efc8c979e80713dc550a1b1054e00 (commit) via f8716c8b4466dd464853a5f9484ac151689c1d0c (commit) from ef9e39a1cca51551a755cdeeebbaaf2c73708dff (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=74e9daafbd5473099394bdcb4c86afaea834864a commit 74e9daafbd5473099394bdcb4c86afaea834864a Merge: ef9e39a 695d6f6 Author: Brad King AuthorDate: Thu May 7 16:13:51 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu May 7 16:13:51 2015 -0400 Merge topic 'doc-ctest-command-formatting' into next 695d6f62 Help: Revise ctest_* command documentation (#15559) f8716c8b Help: Update cmake-generators(7) organization for GHS http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=695d6f62d31efc8c979e80713dc550a1b1054e00 commit 695d6f62d31efc8c979e80713dc550a1b1054e00 Author: Brad King AuthorDate: Thu May 7 16:10:20 2015 -0400 Commit: Brad King CommitDate: Thu May 7 16:10:20 2015 -0400 Help: Revise ctest_* command documentation (#15559) Revise documentation for the major dashboard client step ``ctest_*`` commands. Modernize the documentation formatting. Add some missing options. diff --git a/Help/command/ctest_build.rst b/Help/command/ctest_build.rst index 5c0a4e9..e1b7793 100644 --- a/Help/command/ctest_build.rst +++ b/Help/command/ctest_build.rst @@ -1,36 +1,73 @@ ctest_build ----------- -Build the project. +Perform the :ref:`CTest Build Step` as a :ref:`Dashboard Client`. :: - ctest_build([BUILD build_dir] [TARGET target] [RETURN_VALUE res] - [APPEND][NUMBER_ERRORS val] [NUMBER_WARNINGS val]) + ctest_build([BUILD ] [APPEND] + [CONFIGURATION ] + [FLAGS ] + [PROJECT_NAME ] + [TARGET ] + [NUMBER_ERRORS ] + [NUMBER_WARNINGS ] + [RETURN_VALUE ] + ) -Builds the given build directory and stores results in Build.xml. If no -``BUILD`` is given, the :variable:`CTEST_BINARY_DIRECTORY` variable is used. +Build the project and store results in ``Build.xml`` +for submission with the :command:`ctest_submit` command. -The ``TARGET`` variable can be used to specify a build target. If none is -specified, the default target ("ALL_BUILD" for Visual Studio generators and -"all" in others) will be built. +The :variable:`CTEST_BUILD_COMMAND` variable may be set to explicitly +specify the build command line. Otherwise the build command line is +computed automatically based on the options given. -The ``RETURN_VALUE`` option specifies a variable in which to store the -return value of the native build tool. The ``NUMBER_ERRORS`` and -``NUMBER_WARNINGS`` options specify variables in which to store the number -of build errors and warnings detected. +The options are: -The ``APPEND`` option marks results for append to those previously -submitted to a dashboard server since the last :command:`ctest_start`. Append -semantics are defined by the dashboard server in use. +``BUILD `` + Specify the top-level build directory. If not given, the + :variable:`CTEST_BINARY_DIRECTORY` variable is used. -The ``QUIET`` option suppresses any CTest-specific non-error output -that would have been printed to the console otherwise. The summary -of warnings / errors, as well as the output from the native build tool -is unaffected by this option. +``APPEND`` + Mark results for append to those previously submitted to a + dashboard server since the last :command:`ctest_start` call. + Append semantics are defined by the dashboard server in use. -If set, the contents of the variable ``CTEST_BUILD_COMMAND`` is used to build -the project. In addition, if set, the contents of the variable -``CTEST_BUILD_FLAGS`` are passed as additional arguments to the underlying -build command. This can, e.g., be used to trigger a parallel build using the -``-j`` option of make. See :module:`ProcessorCount` for an example. +``CONFIGURATION `` + Specify the build configuration (e.g. ``Debug``). If not + specified the ``CTEST_BUILD_CONFIGURATION`` variable will be checked. + Otherwise the ``-C `` option given to the :manual:`ctest(1)` + command will be used, if any. + +``FLAGS `` + Pass additional arguments to the underlying build command. + If not specified the ``CTEST_BUILD_FLAGS`` variable will be checked. + This can, e.g., be used to trigger a parallel build using the + ``-j`` option of make. See the :module:`ProcessorCount` module + for an example. + +``PROJECT_NAME `` + Set the name of the project to build. This should correspond + to the top-level call to the :command:`project` command. + If not specified the ``CTEST_PROJECT_NAME`` variable will be checked. + +``TARGET `` + Specify the name of a target to build. If not specified the + ``CTEST_BUILD_TARGET`` variable will be checked. Otherwise the + default target will be built. This is the "all" target + (called ``ALL_BUILD`` in :ref:`Visual Studio Generators`). + +``NUMBER_ERRORS `` + Store the number of build errors detected in the given variable. + +``NUMBER_WARNINGS `` + Store the number of build warnings detected in the given variable. + +``RETURN_VALUE `` + Store the return value of the native build tool in the given variable. + +``QUIET`` + Suppress any CTest-specific non-error output that would have been + printed to the console otherwise. The summary of warnings / errors, + as well as the output from the native build tool is unaffected by + this option. diff --git a/Help/command/ctest_configure.rst b/Help/command/ctest_configure.rst index 61d9320..851c292 100644 --- a/Help/command/ctest_configure.rst +++ b/Help/command/ctest_configure.rst @@ -1,25 +1,39 @@ ctest_configure --------------- -Configure the project build tree. +Perform the :ref:`CTest Configure Step` as a :ref:`Dashboard Client`. :: - ctest_configure([BUILD build_dir] [SOURCE source_dir] [APPEND] - [OPTIONS options] [RETURN_VALUE res] [QUIET]) + ctest_configure([BUILD ] [SOURCE ] [APPEND] + [OPTIONS ] [RETURN_VALUE ] [QUIET]) -Configures the given build directory and stores results in -Configure.xml. If no BUILD is given, the CTEST_BINARY_DIRECTORY -variable is used. If no SOURCE is given, the CTEST_SOURCE_DIRECTORY -variable is used. The OPTIONS argument specifies command line -arguments to pass to the configuration tool. The RETURN_VALUE option -specifies a variable in which to store the return value of the native -build tool. +Configure the project build tree and record results in ``Configure.xml`` +for submission with the :command:`ctest_submit` command. -The APPEND option marks results for append to those previously -submitted to a dashboard server since the last ctest_start. Append -semantics are defined by the dashboard server in use. +The options are: -The QUIET option suppresses any CTest-specific non-error messages -that would have otherwise been printed to the console. Output from -the underlying configure command is not affected. +``BUILD `` + Specify the top-level build directory. If not given, the + :variable:`CTEST_BINARY_DIRECTORY` variable is used. + +``SOURCE `` + Specify the source directory. If not given, the + :variable:`CTEST_SOURCE_DIRECTORY` variable is used. + +``APPEND`` + Mark results for append to those previously submitted to a + dashboard server since the last :command:`ctest_start` call. + Append semantics are defined by the dashboard server in use. + +``OPTIONS `` + Specify command-line arguments to pass to the configuration tool. + +``RETURN_VALUE `` + Store in the ```` variable the return value of the native + configuration tool. + +``QUIET`` + Suppress any CTest-specific non-error messages that would have + otherwise been printed to the console. Output from the underlying + configure command is not affected. diff --git a/Help/command/ctest_coverage.rst b/Help/command/ctest_coverage.rst index bac5c1c..12429b9 100644 --- a/Help/command/ctest_coverage.rst +++ b/Help/command/ctest_coverage.rst @@ -1,25 +1,39 @@ ctest_coverage -------------- -Collect coverage tool results. +Perform the :ref:`CTest Coverage Step` as a :ref:`Dashboard Client`. :: - ctest_coverage([BUILD build_dir] [RETURN_VALUE res] [APPEND] - [LABELS label1 [label2 [...]]]) + ctest_coverage([BUILD ] [APPEND] + [LABELS