From kwrobot at kitware.com Sun Jul 1 00:05:10 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 1 Jul 2018 00:05:10 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc2-110-gdc70284 Message-ID: <20180701040510.7FF9811CD03@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 dc70284c811a3183295371903d965658a9d2f8e0 (commit) from ed95fe5c7a923a204ad41ba0b7f2b1748ec7e99c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dc70284c811a3183295371903d965658a9d2f8e0 commit dc70284c811a3183295371903d965658a9d2f8e0 Author: Kitware Robot AuthorDate: Sun Jul 1 00:01:23 2018 -0400 Commit: Kitware Robot CommitDate: Sun Jul 1 00:01:23 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 3af5446..bc7569a 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 12) -set(CMake_VERSION_PATCH 20180630) +set(CMake_VERSION_PATCH 20180701) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jul 2 00:05:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 2 Jul 2018 00:05:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc2-111-g752c272 Message-ID: <20180702040506.596071193CD@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 752c2721a17e95f642874562f6b406f1f05b4430 (commit) from dc70284c811a3183295371903d965658a9d2f8e0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=752c2721a17e95f642874562f6b406f1f05b4430 commit 752c2721a17e95f642874562f6b406f1f05b4430 Author: Kitware Robot AuthorDate: Mon Jul 2 00:01:04 2018 -0400 Commit: Kitware Robot CommitDate: Mon Jul 2 00:01:04 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index bc7569a..3734784 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 12) -set(CMake_VERSION_PATCH 20180701) +set(CMake_VERSION_PATCH 20180702) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jul 2 11:55:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 2 Jul 2018 11:55:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc2-113-g8ad3396 Message-ID: <20180702155504.30F64113857@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 8ad33961582bd0a70bf8226558c28fb3829b99a7 (commit) via 19f338109d8909feba37513285afe4a583811d54 (commit) from 752c2721a17e95f642874562f6b406f1f05b4430 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8ad33961582bd0a70bf8226558c28fb3829b99a7 commit 8ad33961582bd0a70bf8226558c28fb3829b99a7 Merge: 752c272 19f3381 Author: Brad King AuthorDate: Mon Jul 2 15:48:51 2018 +0000 Commit: Kitware Robot CommitDate: Mon Jul 2 11:48:56 2018 -0400 Merge topic 'policy_max_docs' 19f338109d Help: Clarify ... behavior for policy-related commands Acked-by: Kitware Robot Merge-request: !2180 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=19f338109d8909feba37513285afe4a583811d54 commit 19f338109d8909feba37513285afe4a583811d54 Author: Craig Scott AuthorDate: Sun Jul 1 08:05:01 2018 +1000 Commit: Craig Scott CommitDate: Mon Jul 2 08:41:46 2018 +1000 Help: Clarify ... behavior for policy-related commands Affects cmake_minimum_required() and cmake_policy(VERSION) diff --git a/Help/command/cmake_minimum_required.rst b/Help/command/cmake_minimum_required.rst index 7c02190..2f1ab60 100644 --- a/Help/command/cmake_minimum_required.rst +++ b/Help/command/cmake_minimum_required.rst @@ -13,6 +13,10 @@ If the running version of CMake is lower than the ```` required version it will stop processing the project and report an error. The optional ```` version, if specified, must be at least the ```` version and affects policy settings as described below. +If the running version of CMake is older than 3.12, the extra ``...`` +dots will be seen as version component separators, resulting in the +``...`` part being ignored and preserving the pre-3.12 behavior +of basing policies on ````. The ``FATAL_ERROR`` option is accepted but ignored by CMake 2.6 and higher. It should be specified so CMake versions 2.4 and lower fail diff --git a/Help/command/cmake_policy.rst b/Help/command/cmake_policy.rst index 6a8dd62..c3f7cfb 100644 --- a/Help/command/cmake_policy.rst +++ b/Help/command/cmake_policy.rst @@ -30,7 +30,10 @@ encourage projects to set policies based on CMake versions:: ``major.minor[.patch[.tweak]]``, and the ``...`` is literal. The ```` version must be at least ``2.4`` and at most the running version of CMake. The ```` version, if specified, must be at least the ```` version -but may exceed the running version of CMake. +but may exceed the running version of CMake. If the running version of +CMake is older than 3.12, the extra ``...`` dots will be seen as version +component separators, resulting in the ``...`` part being ignored and +preserving the pre-3.12 behavior of basing policies on ````. This specifies that the current CMake code is written for the given range of CMake versions. All policies known to the running version of CMake diff --git a/Help/release/3.12.rst b/Help/release/3.12.rst index 4d1135e..79ebc8e 100644 --- a/Help/release/3.12.rst +++ b/Help/release/3.12.rst @@ -34,7 +34,8 @@ Commands * The :command:`cmake_minimum_required` and :command:`cmake_policy(VERSION)` commands now accept a version range using the form ``[...]``. The ```` version is required but policies are set based on the - ```` version. This allows projects to specify a range of versions + older of the running CMake version and the version specified by + ````. This allows projects to specify a range of versions for which they have been updated and avoid explicit policy settings. * The :command:`file(GLOB)` and :command:`file(GLOB_RECURSE)` commands ----------------------------------------------------------------------- Summary of changes: Help/command/cmake_minimum_required.rst | 4 ++++ Help/command/cmake_policy.rst | 5 ++++- Help/release/3.12.rst | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jul 3 00:05:07 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 3 Jul 2018 00:05:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc2-114-gb49b406 Message-ID: <20180703040508.B69D011CF75@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 b49b4066c01fce2d1e4f766581016b036e3e06a4 (commit) from 8ad33961582bd0a70bf8226558c28fb3829b99a7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b49b4066c01fce2d1e4f766581016b036e3e06a4 commit b49b4066c01fce2d1e4f766581016b036e3e06a4 Author: Kitware Robot AuthorDate: Tue Jul 3 00:01:06 2018 -0400 Commit: Kitware Robot CommitDate: Tue Jul 3 00:01:06 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 3734784..c8cecc0 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 12) -set(CMake_VERSION_PATCH 20180702) +set(CMake_VERSION_PATCH 20180703) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jul 3 10:55:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 3 Jul 2018 10:55:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc2-124-gf4d4d5d Message-ID: <20180703145505.0022111416F@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 f4d4d5df5bb408bdfc4c572d801d24eae7f2016e (commit) via 5d933ad77b10da5f23c595a9ac33afd5ba77d064 (commit) via 83db42fa9997318da5ae5daf17f29c8e6068edbf (commit) via 3017e501f356f0c87a6c4976dbf4678667f68eeb (commit) via 39851a6d43c40078c7f6d479c49e29e9a4842f1a (commit) via 277425910007d524f14451296876b02f9683af0e (commit) via ea6ad5e4be446d7c85bc19c7bc4ab5425f93c698 (commit) via eb63a07eaa70ab56ccf46500b9a077d6cbbd289a (commit) via 724bd7790e1a28826b5457c0b28edbfff9af4d15 (commit) via cc9f88af53b6dd95d3fc1786166dd05599e2ba91 (commit) from b49b4066c01fce2d1e4f766581016b036e3e06a4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f4d4d5df5bb408bdfc4c572d801d24eae7f2016e commit f4d4d5df5bb408bdfc4c572d801d24eae7f2016e Merge: 5d933ad 724bd77 Author: Brad King AuthorDate: Tue Jul 3 14:52:05 2018 +0000 Commit: Kitware Robot CommitDate: Tue Jul 3 10:52:24 2018 -0400 Merge topic 'LINK_DEPENDS' 724bd7790e LINK_DEPENDS: add support of 'generator expressions' cc9f88af53 LINK_DEPENDS: add support for property INTERFACE_LINK_DEPENDS Acked-by: Kitware Robot Merge-request: !2175 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5d933ad77b10da5f23c595a9ac33afd5ba77d064 commit 5d933ad77b10da5f23c595a9ac33afd5ba77d064 Merge: 83db42f 39851a6 Author: Brad King AuthorDate: Tue Jul 3 10:48:46 2018 -0400 Commit: Brad King CommitDate: Tue Jul 3 10:48:46 2018 -0400 Merge branch 'release-3.12' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=83db42fa9997318da5ae5daf17f29c8e6068edbf commit 83db42fa9997318da5ae5daf17f29c8e6068edbf Merge: 3017e50 2774259 Author: Brad King AuthorDate: Tue Jul 3 14:47:54 2018 +0000 Commit: Kitware Robot CommitDate: Tue Jul 3 10:48:03 2018 -0400 Merge topic 'cpack-fix-deb-packaging' 2774259100 CPack/Deb: Restore setting of root as the owner of files Acked-by: Kitware Robot Merge-request: !2178 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3017e501f356f0c87a6c4976dbf4678667f68eeb commit 3017e501f356f0c87a6c4976dbf4678667f68eeb Merge: b49b406 eb63a07 Author: Brad King AuthorDate: Tue Jul 3 14:46:44 2018 +0000 Commit: Kitware Robot CommitDate: Tue Jul 3 10:46:51 2018 -0400 Merge topic 'rel-explicit-ccmake' eb63a07eaa Utilities/Release: Explicitly enable ccmake on macOS and Linux Acked-by: Kitware Robot Merge-request: !2186 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=eb63a07eaa70ab56ccf46500b9a077d6cbbd289a commit eb63a07eaa70ab56ccf46500b9a077d6cbbd289a Author: Brad King AuthorDate: Mon Jul 2 11:35:27 2018 -0400 Commit: Brad King CommitDate: Mon Jul 2 11:36:15 2018 -0400 Utilities/Release: Explicitly enable ccmake on macOS and Linux Since commit v3.12.0-rc1~325^2 (ccmake: Check for curses more robustly before enabling, 2018-03-21) we may not enable ccmake by default when using a non-system curses (e.g. the static curses we build on Linux for our binaries). Enable the option explicitly for our prebuilt binaries. diff --git a/Utilities/Release/linux64_release.cmake b/Utilities/Release/linux64_release.cmake index 04a74ac..f2ca2d5 100644 --- a/Utilities/Release/linux64_release.cmake +++ b/Utilities/Release/linux64_release.cmake @@ -34,6 +34,7 @@ OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.1.0h/include OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.1.0h/lib/libssl.a PYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3 CPACK_SYSTEM_NAME:STRING=Linux-x86_64 +BUILD_CursesDialog:BOOL=ON BUILD_QtDialog:BOOL=TRUE CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=3 diff --git a/Utilities/Release/osx_release.cmake b/Utilities/Release/osx_release.cmake index c69eb11..be11d47 100644 --- a/Utilities/Release/osx_release.cmake +++ b/Utilities/Release/osx_release.cmake @@ -19,6 +19,7 @@ CMAKE_OSX_ARCHITECTURES:STRING=x86_64 CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7 CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE CPACK_SYSTEM_NAME:STRING=Darwin-x86_64 +BUILD_CursesDialog:BOOL=ON BUILD_QtDialog:BOOL=TRUE CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=3 CMake_INSTALL_DEPENDENCIES:BOOL=ON https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=724bd7790e1a28826b5457c0b28edbfff9af4d15 commit 724bd7790e1a28826b5457c0b28edbfff9af4d15 Author: Marc Chevrier AuthorDate: Wed Jun 27 18:36:47 2018 +0200 Commit: Marc Chevrier CommitDate: Wed Jun 27 18:38:36 2018 +0200 LINK_DEPENDS: add support of 'generator expressions' diff --git a/Help/prop_tgt/LINK_DEPENDS.rst b/Help/prop_tgt/LINK_DEPENDS.rst index bc83393..3ab8658 100644 --- a/Help/prop_tgt/LINK_DEPENDS.rst +++ b/Help/prop_tgt/LINK_DEPENDS.rst @@ -10,3 +10,8 @@ linked if any of the named files is newer than it. This property is supported only by Makefile and Ninja generators. It is intended to specify dependencies on "linker scripts" for custom Makefile link rules. + +Contents of ``LINK_DEPENDS`` may use "generator expressions" with +the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` +manual for available expressions. See the :manual:`cmake-buildsystem(7)` +manual for more on defining buildsystem properties. diff --git a/Help/release/dev/LINK_DEPENDS-property.rst b/Help/release/dev/LINK_DEPENDS-property.rst new file mode 100644 index 0000000..83beba8 --- /dev/null +++ b/Help/release/dev/LINK_DEPENDS-property.rst @@ -0,0 +1,5 @@ +LINK_DEPENDS-property +--------------------- + +* The :prop_tgt:`LINK_DEPENDS` target property learned to support + :manual:`generator expressions `. diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index d4686c2..e07ccd9 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3027,15 +3027,21 @@ void cmGeneratorTarget::GetLinkDepends(std::vector& result, const std::string& config, const std::string& language) const { - if (const char* linkDepends = this->GetProperty("LINK_DEPENDS")) { - cmSystemTools::ExpandListArgument(linkDepends, result); - } - - std::unordered_set uniqueOptions; std::vector linkDependsEntries; + std::unordered_set uniqueOptions; cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "LINK_DEPENDS", nullptr, nullptr); + if (const char* linkDepends = this->GetProperty("LINK_DEPENDS")) { + std::vector depends; + cmGeneratorExpression ge; + cmSystemTools::ExpandListArgument(linkDepends, depends); + for (const auto& depend : depends) { + std::unique_ptr cge = ge.Parse(depend); + linkDependsEntries.push_back( + new cmGeneratorTarget::TargetPropertyEntry(std::move(cge))); + } + } AddInterfaceEntries(this, config, "INTERFACE_LINK_DEPENDS", linkDependsEntries); processLinkDepends(this, linkDependsEntries, result, uniqueOptions, diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt index 09be3ea..3f41b26 100644 --- a/Tests/BuildDepends/Project/CMakeLists.txt +++ b/Tests/BuildDepends/Project/CMakeLists.txt @@ -106,7 +106,7 @@ set_property( if(TEST_LINK_DEPENDS) add_executable(linkdep linkdep.cxx) - set_property(TARGET linkdep PROPERTY LINK_DEPENDS ${TEST_LINK_DEPENDS}) + set_property(TARGET linkdep PROPERTY LINK_DEPENDS $<1:${TEST_LINK_DEPENDS}>) add_library(foo_interface INTERFACE) set_property(TARGET foo_interface PROPERTY INTERFACE_LINK_DEPENDS $<1:${TEST_LINK_DEPENDS}>) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cc9f88af53b6dd95d3fc1786166dd05599e2ba91 commit cc9f88af53b6dd95d3fc1786166dd05599e2ba91 Author: Marc Chevrier AuthorDate: Tue Jun 26 16:21:05 2018 +0200 Commit: Marc Chevrier CommitDate: Wed Jun 27 18:38:36 2018 +0200 LINK_DEPENDS: add support for property INTERFACE_LINK_DEPENDS Fixes: #17997 diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 03a6a27..9c2ac03 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -198,6 +198,7 @@ Properties on Targets /prop_tgt/IMPORTED_LIBNAME_CONFIG /prop_tgt/IMPORTED_LIBNAME /prop_tgt/IMPORTED_LINK_DEPENDENT_LIBRARIES_CONFIG + /prop_tgt/IMPORTED_LINK_DEPENDENT_LIBRARIES_CONFIG /prop_tgt/IMPORTED_LINK_DEPENDENT_LIBRARIES /prop_tgt/IMPORTED_LINK_INTERFACE_LANGUAGES_CONFIG /prop_tgt/IMPORTED_LINK_INTERFACE_LANGUAGES @@ -225,6 +226,7 @@ Properties on Targets /prop_tgt/INTERFACE_COMPILE_FEATURES /prop_tgt/INTERFACE_COMPILE_OPTIONS /prop_tgt/INTERFACE_INCLUDE_DIRECTORIES + /prop_tgt/INTERFACE_LINK_DEPENDS /prop_tgt/INTERFACE_LINK_LIBRARIES /prop_tgt/INTERFACE_LINK_OPTIONS /prop_tgt/INTERFACE_POSITION_INDEPENDENT_CODE diff --git a/Help/prop_tgt/INTERFACE_LINK_DEPENDS.rst b/Help/prop_tgt/INTERFACE_LINK_DEPENDS.rst new file mode 100644 index 0000000..d07f8ea --- /dev/null +++ b/Help/prop_tgt/INTERFACE_LINK_DEPENDS.rst @@ -0,0 +1,31 @@ +INTERFACE_LINK_DEPENDS +---------------------- + +Additional public interface files on which a target binary depends for linking. + +This property is supported only by Makefile and Ninja generators. It is +intended to specify dependencies on "linker scripts" for custom Makefile link +rules. + +When target dependencies are specified using :command:`target_link_libraries`, +CMake will read this property from all target dependencies to determine the +build properties of the consumer. + +Contents of ``INTERFACE_LINK_DEPENDS`` may use "generator expressions" +with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` +manual for available expressions. See the :manual:`cmake-buildsystem(7)` +-manual for more on defining buildsystem properties. + +Link dependency files usage requirements commonly differ between the build-tree +and the install-tree. The ``BUILD_INTERFACE`` and ``INSTALL_INTERFACE`` +generator expressions can be used to describe separate usage requirements +based on the usage location. Relative paths are allowed within the +``INSTALL_INTERFACE`` expression and are interpreted relative to the +installation prefix. For example: + +.. code-block:: cmake + + set_property(TARGET mylib PROPERTY INTERFACE_LINK_DEPENDS + $ + $ # /mylinkscript + ) diff --git a/Help/prop_tgt/LINK_DEPENDS.rst b/Help/prop_tgt/LINK_DEPENDS.rst index 5576b85..bc83393 100644 --- a/Help/prop_tgt/LINK_DEPENDS.rst +++ b/Help/prop_tgt/LINK_DEPENDS.rst @@ -7,6 +7,6 @@ Specifies a semicolon-separated list of full-paths to files on which the link rule for this target depends. The target binary will be linked if any of the named files is newer than it. -This property is ignored by non-Makefile generators. It is intended -to specify dependencies on "linker scripts" for custom Makefile link +This property is supported only by Makefile and Ninja generators. It is +intended to specify dependencies on "linker scripts" for custom Makefile link rules. diff --git a/Help/release/dev/INTERFACE_LINK_DEPENDS-property.rst b/Help/release/dev/INTERFACE_LINK_DEPENDS-property.rst new file mode 100644 index 0000000..9527c97 --- /dev/null +++ b/Help/release/dev/INTERFACE_LINK_DEPENDS-property.rst @@ -0,0 +1,4 @@ +INTERFACE_LINK_DEPENDS-property +------------------------------- + +* Binary targets gained new :prop_tgt:`INTERFACE_LINK_DEPENDS` property. diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index 9f2e01d..7f42035 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -98,6 +98,9 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) this->PopulateInterfaceProperty("INTERFACE_LINK_OPTIONS", gte, cmGeneratorExpression::BuildInterface, properties, missingTargets); + this->PopulateInterfaceProperty("INTERFACE_LINK_DEPENDS", gte, + cmGeneratorExpression::BuildInterface, + properties, missingTargets); this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE", gte, properties); diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 5f61571..ec68fce 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -420,6 +420,37 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( } } +void cmExportFileGenerator::PopulateLinkDependsInterface( + cmTargetExport* tei, cmGeneratorExpression::PreprocessContext preprocessRule, + ImportPropertyMap& properties, std::vector& missingTargets) +{ + cmGeneratorTarget* gt = tei->Target; + assert(preprocessRule == cmGeneratorExpression::InstallInterface); + + const char* propName = "INTERFACE_LINK_DEPENDS"; + const char* input = gt->GetProperty(propName); + + if (!input) { + return; + } + + if (!*input) { + properties[propName].clear(); + return; + } + + std::string prepro = + cmGeneratorExpression::Preprocess(input, preprocessRule, true); + if (!prepro.empty()) { + this->ResolveTargetsInGeneratorExpressions(prepro, gt, missingTargets); + + if (!checkInterfaceDirs(prepro, gt, propName)) { + return; + } + properties[propName] = prepro; + } +} + void cmExportFileGenerator::PopulateInterfaceProperty( const std::string& propName, cmGeneratorTarget* target, cmGeneratorExpression::PreprocessContext preprocessRule, diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index 954e6c5..6ca2e07 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -147,6 +147,10 @@ protected: cmTargetExport* target, cmGeneratorExpression::PreprocessContext preprocessRule, ImportPropertyMap& properties, std::vector& missingTargets); + void PopulateLinkDependsInterface( + cmTargetExport* target, + cmGeneratorExpression::PreprocessContext preprocessRule, + ImportPropertyMap& properties, std::vector& missingTargets); void SetImportLinkInterface( const std::string& config, std::string const& suffix, diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 1db76ac..3595708 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -106,6 +106,8 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) this->PopulateInterfaceProperty("INTERFACE_LINK_OPTIONS", gt, cmGeneratorExpression::InstallInterface, properties, missingTargets); + this->PopulateLinkDependsInterface( + te, cmGeneratorExpression::InstallInterface, properties, missingTargets); std::string errorMessage; if (!this->PopulateExportProperties(gt, properties, errorMessage)) { diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h index cfe31f1..cd23904 100644 --- a/Source/cmGeneratorExpressionDAGChecker.h +++ b/Source/cmGeneratorExpressionDAGChecker.h @@ -26,7 +26,8 @@ struct cmGeneratorExpressionContext; SELECT(F, EvaluatingAutoUicOptions, AUTOUIC_OPTIONS) \ SELECT(F, EvaluatingSources, SOURCES) \ SELECT(F, EvaluatingCompileFeatures, COMPILE_FEATURES) \ - SELECT(F, EvaluatingLinkOptions, LINK_OPTIONS) + SELECT(F, EvaluatingLinkOptions, LINK_OPTIONS) \ + SELECT(F, EvaluatingLinkDepends, LINK_DEPENDS) #define CM_FOR_EACH_TRANSITIVE_PROPERTY(F) \ CM_FOR_EACH_TRANSITIVE_PROPERTY_IMPL(F, CM_SELECT_BOTH) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 41e55a5..d4686c2 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3008,6 +3008,42 @@ void cmGeneratorTarget::GetLinkOptions(std::vector& result, } } +namespace { +void processLinkDepends( + cmGeneratorTarget const* tgt, + const std::vector& entries, + std::vector& options, + std::unordered_set& uniqueOptions, + cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config, + std::string const& language) +{ + processOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, + config, false, "link depends", language, + OptionsParse::None); +} +} + +void cmGeneratorTarget::GetLinkDepends(std::vector& result, + const std::string& config, + const std::string& language) const +{ + if (const char* linkDepends = this->GetProperty("LINK_DEPENDS")) { + cmSystemTools::ExpandListArgument(linkDepends, result); + } + + std::unordered_set uniqueOptions; + std::vector linkDependsEntries; + cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "LINK_DEPENDS", + nullptr, nullptr); + + AddInterfaceEntries(this, config, "INTERFACE_LINK_DEPENDS", + linkDependsEntries); + processLinkDepends(this, linkDependsEntries, result, uniqueOptions, + &dagChecker, config, language); + + cmDeleteAll(linkDependsEntries); +} + void cmGeneratorTarget::ComputeTargetManifest(const std::string& config) const { if (this->IsImported()) { diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index aa36823..4cc0aac 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -422,6 +422,10 @@ public: const std::string& config, const std::string& language) const; + void GetLinkDepends(std::vector& result, + const std::string& config, + const std::string& language) const; + bool IsSystemIncludeDirectory(const std::string& dir, const std::string& config, const std::string& language) const; diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 82f4683..b9845ba 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -97,15 +97,15 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule( std::vector commands; - // Build list of dependencies. - std::vector depends; - this->AppendLinkDepends(depends); - // Get the language to use for linking this library. std::string linkLanguage = "CUDA"; std::string const objExt = this->Makefile->GetSafeDefinition("CMAKE_CUDA_OUTPUT_EXTENSION"); + // Build list of dependencies. + std::vector depends; + this->AppendLinkDepends(depends, linkLanguage); + // Get the name of the device object to generate. std::string const targetOutputReal = this->GeneratorTarget->ObjectDirectory + "cmake_device_link" + objExt; @@ -294,13 +294,6 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) { std::vector commands; - // Build list of dependencies. - std::vector depends; - this->AppendLinkDepends(depends); - if (!this->DeviceLinkObject.empty()) { - depends.push_back(this->DeviceLinkObject); - } - // Get the name of the executable to generate. std::string targetName; std::string targetNameReal; @@ -378,6 +371,13 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) return; } + // Build list of dependencies. + std::vector depends; + this->AppendLinkDepends(depends, linkLanguage); + if (!this->DeviceLinkObject.empty()) { + depends.push_back(this->DeviceLinkObject); + } + this->NumberOfProgressActions++; if (!this->NoRuleMessages) { cmLocalUnixMakefileGenerator3::EchoProgress progress; diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 036acc7..571e74b 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -260,15 +260,15 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules( // code duplication. std::vector commands; - // Build list of dependencies. - std::vector depends; - this->AppendLinkDepends(depends); - // Get the language to use for linking this library. std::string linkLanguage = "CUDA"; std::string const objExt = this->Makefile->GetSafeDefinition("CMAKE_CUDA_OUTPUT_EXTENSION"); + // Build list of dependencies. + std::vector depends; + this->AppendLinkDepends(depends, linkLanguage); + // Create set of linking flags. std::string linkFlags; this->GetTargetLinkFlags(linkFlags, linkLanguage); @@ -444,13 +444,6 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( // code duplication. std::vector commands; - // Build list of dependencies. - std::vector depends; - this->AppendLinkDepends(depends); - if (!this->DeviceLinkObject.empty()) { - depends.push_back(this->DeviceLinkObject); - } - // Get the language to use for linking this library. std::string linkLanguage = this->GeneratorTarget->GetLinkerLanguage(this->ConfigName); @@ -462,6 +455,13 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( return; } + // Build list of dependencies. + std::vector depends; + this->AppendLinkDepends(depends, linkLanguage); + if (!this->DeviceLinkObject.empty()) { + depends.push_back(this->DeviceLinkObject); + } + // Create set of linking flags. std::string linkFlags; this->LocalGenerator->AppendFlags(linkFlags, extraFlags); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 08fcd8f..7cae305 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1387,7 +1387,7 @@ void cmMakefileTargetGenerator::AppendObjectDepends( } void cmMakefileTargetGenerator::AppendLinkDepends( - std::vector& depends) + std::vector& depends, const std::string& linkLanguage) { this->AppendObjectDepends(depends); @@ -1411,10 +1411,8 @@ void cmMakefileTargetGenerator::AppendLinkDepends( } // Add user-specified dependencies. - if (const char* linkDepends = - this->GeneratorTarget->GetProperty("LINK_DEPENDS")) { - cmSystemTools::ExpandListArgument(linkDepends, depends); - } + this->GeneratorTarget->GetLinkDepends(depends, this->ConfigName, + linkLanguage); } std::string cmMakefileTargetGenerator::GetLinkRule( diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 4d1c9ec..f21362a 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -128,7 +128,8 @@ protected: void AppendObjectDepends(std::vector& depends); // Append link rule dependencies (objects, etc.). - void AppendLinkDepends(std::vector& depends); + void AppendLinkDepends(std::vector& depends, + const std::string& linkLanguage); // Lookup the link rule for this target. std::string GetLinkRule(const std::string& linkRuleVar); diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 7394188..f94e5bc 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -625,7 +625,7 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement() outputs.push_back(targetOutputReal); // Compute specific libraries to link with. cmNinjaDeps explicitDeps = this->GetObjects(); - cmNinjaDeps implicitDeps = this->ComputeLinkDeps(); + cmNinjaDeps implicitDeps = this->ComputeLinkDeps(this->TargetLinkLanguage); std::string frameworkPath; std::string linkPath; @@ -794,7 +794,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() // Compute specific libraries to link with. cmNinjaDeps explicitDeps = this->GetObjects(); - cmNinjaDeps implicitDeps = this->ComputeLinkDeps(); + cmNinjaDeps implicitDeps = this->ComputeLinkDeps(this->TargetLinkLanguage); if (!this->DeviceLinkObject.empty()) { explicitDeps.push_back(this->DeviceLinkObject); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 9d41948..df32f40 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -235,7 +235,8 @@ std::string cmNinjaTargetGenerator::ComputeIncludes( return includesString; } -cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const +cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps( + const std::string& linkLanguage) const { // Static libraries never depend on other targets for linking. if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY || @@ -270,13 +271,11 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const } // Add user-specified dependencies. - if (const char* linkDepends = - this->GeneratorTarget->GetProperty("LINK_DEPENDS")) { - std::vector linkDeps; - cmSystemTools::ExpandListArgument(linkDepends, linkDeps); - std::transform(linkDeps.begin(), linkDeps.end(), - std::back_inserter(result), MapToNinjaPath()); - } + std::vector linkDeps; + this->GeneratorTarget->GetLinkDepends(linkDeps, this->ConfigName, + linkLanguage); + std::transform(linkDeps.begin(), linkDeps.end(), std::back_inserter(result), + MapToNinjaPath()); return result; } diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 4660a3a..e58a8a0 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -95,7 +95,7 @@ protected: } /// @return the list of link dependency for the given target @a target. - cmNinjaDeps ComputeLinkDeps() const; + cmNinjaDeps ComputeLinkDeps(const std::string& linkLanguage) const; /// @return the source file path for the given @a source. std::string GetSourceFilePath(cmSourceFile const* source) const; diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt index 3b4ff60..39a5131 100644 --- a/Tests/BuildDepends/CMakeLists.txt +++ b/Tests/BuildDepends/CMakeLists.txt @@ -345,6 +345,17 @@ is not newer than dependency ${TEST_LINK_DEPENDS} ") endif() + + set(linkdep2 ${BuildDepends_BINARY_DIR}/Project/linkdep2${CMAKE_EXECUTABLE_SUFFIX}) + if(${linkdep2} IS_NEWER_THAN ${TEST_LINK_DEPENDS}) + message("INTERFACE_LINK_DEPENDS worked") + else() + message(SEND_ERROR "INTERFACE_LINK_DEPENDS failed. Executable + ${linkdep2} +is not newer than dependency + ${TEST_LINK_DEPENDS} +") + endif() endif() if(EXISTS "${link_depends_no_shared_check_txt}") diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt index 127b365..09be3ea 100644 --- a/Tests/BuildDepends/Project/CMakeLists.txt +++ b/Tests/BuildDepends/Project/CMakeLists.txt @@ -107,6 +107,11 @@ set_property( if(TEST_LINK_DEPENDS) add_executable(linkdep linkdep.cxx) set_property(TARGET linkdep PROPERTY LINK_DEPENDS ${TEST_LINK_DEPENDS}) + + add_library(foo_interface INTERFACE) + set_property(TARGET foo_interface PROPERTY INTERFACE_LINK_DEPENDS $<1:${TEST_LINK_DEPENDS}>) + add_executable(linkdep2 linkdep.cxx) + target_link_libraries(linkdep2 PRIVATE foo_interface) endif() add_library(link_depends_no_shared_lib SHARED link_depends_no_shared_lib.c diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index a1c4993..470a5bd 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -607,3 +607,17 @@ target_link_options(testLinkOptions INTERFACE INTERFACE_FLAG) install(TARGETS testLinkOptions EXPORT RequiredExp DESTINATION lib) export(TARGETS testLinkOptions NAMESPACE bld_ APPEND FILE ExportBuildTree.cmake) + + +#------------------------------------------------------------------------------ +# test export of INTERFACE_LINK_DEPENDS +if(CMAKE_GENERATOR MATCHES "Make|Ninja") + add_library(testLinkDepends INTERFACE) + set_property(TARGET testLinkDepends PROPERTY INTERFACE_LINK_DEPENDS + $ + $) + + install(TARGETS testLinkDepends + EXPORT RequiredExp DESTINATION lib) + export(TARGETS testLinkDepends NAMESPACE bld_ APPEND FILE ExportBuildTree.cmake) +endif() diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index f8eb721..7510d7e 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -477,3 +477,10 @@ endif() # check that imported libraries have the expected INTERFACE_LINK_OPTIONS property checkForProperty(bld_testLinkOptions "INTERFACE_LINK_OPTIONS" "INTERFACE_FLAG") checkForProperty(Req::testLinkOptions "INTERFACE_LINK_OPTIONS" "INTERFACE_FLAG") + +#--------------------------------------------------------------------------------- +# check that imported libraries have the expected INTERFACE_LINK_DEPENDS property +if(CMAKE_GENERATOR MATCHES "Make|Ninja") + checkForProperty(bld_testLinkDepends "INTERFACE_LINK_DEPENDS" "BUILD_LINK_DEPENDS") + checkForProperty(Req::testLinkDepends "INTERFACE_LINK_DEPENDS" "${CMAKE_INSTALL_PREFIX}/INSTALL_LINK_DEPENDS") +endif() ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-properties.7.rst | 2 ++ Help/prop_tgt/INTERFACE_LINK_DEPENDS.rst | 31 ++++++++++++++++ Help/prop_tgt/LINK_DEPENDS.rst | 9 +++-- .../dev/INTERFACE_LINK_DEPENDS-property.rst | 4 +++ Help/release/dev/LINK_DEPENDS-property.rst | 5 +++ Source/CPack/cmCPackDebGenerator.cxx | 6 ++++ Source/cmExportBuildFileGenerator.cxx | 3 ++ Source/cmExportFileGenerator.cxx | 31 ++++++++++++++++ Source/cmExportFileGenerator.h | 4 +++ Source/cmExportInstallFileGenerator.cxx | 2 ++ Source/cmGeneratorExpressionDAGChecker.h | 3 +- Source/cmGeneratorTarget.cxx | 42 ++++++++++++++++++++++ Source/cmGeneratorTarget.h | 4 +++ Source/cmMakefileExecutableTargetGenerator.cxx | 22 ++++++------ Source/cmMakefileLibraryTargetGenerator.cxx | 22 ++++++------ Source/cmMakefileTargetGenerator.cxx | 8 ++--- Source/cmMakefileTargetGenerator.h | 3 +- Source/cmNinjaNormalTargetGenerator.cxx | 4 +-- Source/cmNinjaTargetGenerator.cxx | 15 ++++---- Source/cmNinjaTargetGenerator.h | 2 +- Tests/BuildDepends/CMakeLists.txt | 11 ++++++ Tests/BuildDepends/Project/CMakeLists.txt | 7 +++- Tests/ExportImport/Export/CMakeLists.txt | 14 ++++++++ Tests/ExportImport/Import/A/CMakeLists.txt | 7 ++++ Utilities/Release/linux64_release.cmake | 1 + Utilities/Release/osx_release.cmake | 1 + 26 files changed, 220 insertions(+), 43 deletions(-) create mode 100644 Help/prop_tgt/INTERFACE_LINK_DEPENDS.rst create mode 100644 Help/release/dev/INTERFACE_LINK_DEPENDS-property.rst create mode 100644 Help/release/dev/LINK_DEPENDS-property.rst hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jul 3 10:55:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 3 Jul 2018 10:55:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.12.0-rc2-4-g39851a6 Message-ID: <20180703145505.1FCB4115550@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via 39851a6d43c40078c7f6d479c49e29e9a4842f1a (commit) via 277425910007d524f14451296876b02f9683af0e (commit) via ea6ad5e4be446d7c85bc19c7bc4ab5425f93c698 (commit) via 19f338109d8909feba37513285afe4a583811d54 (commit) from 51e7d4150756a01d51da38acfd0a469b138e1fde (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Help/command/cmake_minimum_required.rst | 4 ++++ Help/command/cmake_policy.rst | 5 ++++- Help/release/3.12.rst | 3 ++- Source/CPack/cmCPackDebGenerator.cxx | 6 ++++++ 4 files changed, 16 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jul 3 11:05:02 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 3 Jul 2018 11:05:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc2-134-g4330f10 Message-ID: <20180703150502.A4BED113C3E@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 4330f10186e994b3a7b64729f8b4e64e10a30896 (commit) via c4b1c0751d48c1c3b7ccf92f1306a0a162cd249e (commit) via 4c7154876622b7639c7f0907adfed52a980985f6 (commit) via 47c87cdd1ff61abb153b2b5e081532fa7f7465eb (commit) via 2ef966bc77e9efd036747ee9d6977e2f2c7e024d (commit) via 80914d88da3e5c997158fd3cc703a39b6673f780 (commit) via 3ced881db63a97eb402bd68be5e45298371f4519 (commit) via 4938abb6002cb60501a0da651059ca0aefeed24f (commit) via 42cc0644d5cc7a50ea2f65aa29b49f629ff17384 (commit) via 127094f2f0e444b78d224d933a28a8313e487d36 (commit) from f4d4d5df5bb408bdfc4c572d801d24eae7f2016e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4330f10186e994b3a7b64729f8b4e64e10a30896 commit 4330f10186e994b3a7b64729f8b4e64e10a30896 Merge: c4b1c07 42cc064 Author: Brad King AuthorDate: Tue Jul 3 14:56:25 2018 +0000 Commit: Kitware Robot CommitDate: Tue Jul 3 10:56:31 2018 -0400 Merge topic 'safe_property' 42cc0644d5 Autogen: Use default and remove custom GetSafeProperty functions 127094f2f0 Add GetSafeProperty method to cmTarget, cmGeneratorTarget and cmSourceFile Acked-by: Kitware Robot Merge-request: !2185 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c4b1c0751d48c1c3b7ccf92f1306a0a162cd249e commit c4b1c0751d48c1c3b7ccf92f1306a0a162cd249e Merge: f4d4d5d 4c71548 Author: Brad King AuthorDate: Tue Jul 3 14:54:57 2018 +0000 Commit: Kitware Robot CommitDate: Tue Jul 3 10:55:06 2018 -0400 Merge topic 'cpack-external' 4c71548766 Help: Add release notes for CPack External generator 47c87cdd1f Help: Add documentation for CPack External generator 2ef966bc77 Testing: Add test for CPack External generator 80914d88da CPack: Add "CPack External" generator 3ced881db6 cmCPackGenerator: Store CPACK_INSTALL_CMAKE_PROJECTS in an internal field 4938abb600 cmCPackGenerator: Refactor InstallProjectViaInstallCMakeProjects() Acked-by: Kitware Robot Merge-request: !2142 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4c7154876622b7639c7f0907adfed52a980985f6 commit 4c7154876622b7639c7f0907adfed52a980985f6 Author: Kyle Edwards AuthorDate: Thu Jun 14 15:32:27 2018 -0400 Commit: Kyle Edwards CommitDate: Mon Jul 2 09:51:02 2018 -0400 Help: Add release notes for CPack External generator diff --git a/Help/release/dev/cpack-external.rst b/Help/release/dev/cpack-external.rst new file mode 100644 index 0000000..fb9a061 --- /dev/null +++ b/Help/release/dev/cpack-external.rst @@ -0,0 +1,8 @@ +cpack-external +-------------- + +* CPack gained a new :cpack_gen:`CPack External Generator` which is used to + export the CPack metadata in a format that other software can understand. The + intention of this generator is to allow external packaging software to take + advantage of CPack's features when it may not be possible to use CPack for + the entire packaging process. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=47c87cdd1ff61abb153b2b5e081532fa7f7465eb commit 47c87cdd1ff61abb153b2b5e081532fa7f7465eb Author: Kyle Edwards AuthorDate: Fri Jun 22 13:16:41 2018 -0400 Commit: Kyle Edwards CommitDate: Mon Jul 2 09:51:02 2018 -0400 Help: Add documentation for CPack External generator diff --git a/Help/cpack_gen/external.rst b/Help/cpack_gen/external.rst new file mode 100644 index 0000000..a69866d --- /dev/null +++ b/Help/cpack_gen/external.rst @@ -0,0 +1,249 @@ +CPack External Generator +------------------------ + +CPack provides many generators to create packages for a variety of platforms +and packaging systems. The intention is for CMake/CPack to be a complete +end-to-end solution for building and packaging a software project. However, it +may not always be possible to use CPack for the entire packaging process, due +to either technical limitations or policies that require the use of certain +tools. For this reason, CPack provides the "External" generator, which allows +external packaging software to take advantage of some of the functionality +provided by CPack, such as component installation and the dependency graph. + +The CPack External generator doesn't actually package any files. Instead, it +generates a .json file containing the CPack internal metadata, which gives +external software information on how to package the software. This metadata +file contains a list of CPack components and component groups, the various +options passed to :command:`cpack_add_component` and +:command:`cpack_add_component_group`, the dependencies between the components +and component groups, and various other options passed to CPack. + +Format +^^^^^^ + +The file produced by the CPack External generator is a .json file with an +object as its root. This root object will always provide two fields: +``formatVersionMajor`` and ``formatVersionMinor``, which are always integers +that describe the output format of the generator. Backwards-compatible changes +to the output format (for example, adding a new field that didn't exist before) +cause the minor version to be incremented, and backwards-incompatible changes +(for example, deleting a field or changing its meaning) cause the major version +to be incremented and the minor version reset to 0. The format version is +always of the format ``major.minor``. In other words, it always has exactly two +parts, separated by a period. + +You can request one or more specific versions of the output format as described +below with :variable:`CPACK_EXT_REQUESTED_VERSIONS`. The output format will +have a major version that exactly matches the requested major version, and a +minor version that is greater than or equal to the requested minor version. If +no version is requested with :variable:`CPACK_EXT_REQUESTED_VERSIONS`, the +latest known major version is used by default. Currently, the only supported +format is 1.0, which is described below. + +Version 1.0 +*********** + +In addition to the standard format fields, format version 1.0 provides the +following fields in the root: + +``components`` + The ``components`` field is an object with component names as the keys and + objects describing the components as the values. The component objects have + the following fields: + + ``name`` + The name of the component. This is always the same as the key in the + ``components`` object. + + ``displayName`` + The value of the ``DISPLAY_NAME`` field passed to + :command:`cpack_add_component`. + + ``description`` + The value of the ``DESCRIPTION`` field passed to + :command:`cpack_add_component`. + + ``isHidden`` + True if ``HIDDEN`` was passed to :command:`cpack_add_component`, false if + it was not. + + ``isRequired`` + True if ``REQUIRED`` was passed to :command:`cpack_add_component`, false if + it was not. + + ``isDisabledByDefault`` + True if ``DISABLED`` was passed to :command:`cpack_add_component`, false if + it was not. + + ``group`` + Only present if ``GROUP`` was passed to :command:`cpack_add_component`. If + so, this field is a string value containing the component's group. + + ``dependencies`` + An array of components the component depends on. This contains the values + in the ``DEPENDS`` argument passed to :command:`cpack_add_component`. If no + ``DEPENDS`` argument was passed, this is an empty list. + + ``installationTypes`` + An array of installation types the component is part of. This contains the + values in the ``INSTALL_TYPES`` argument passed to + :command:`cpack_add_component`. If no ``INSTALL_TYPES`` argument was + passed, this is an empty list. + + ``isDownloaded`` + True if ``DOWNLOADED`` was passed to :command:`cpack_add_component`, false + if it was not. + + ``archiveFile`` + The name of the archive file passed with the ``ARCHIVE_FILE`` argument to + :command:`cpack_add_component`. If no ``ARCHIVE_FILE`` argument was passed, + this is an empty string. + +``componentGroups`` + The ``componentGroups`` field is an object with component group names as the + keys and objects describing the component groups as the values. The component + group objects have the following fields: + + ``name`` + The name of the component group. This is always the same as the key in the + ``componentGroups`` object. + + ``displayName`` + The value of the ``DISPLAY_NAME`` field passed to + :command:`cpack_add_component_group`. + + ``description`` + The value of the ``DESCRIPTION`` field passed to + :command:`cpack_add_component_group`. + + ``parentGroup`` + Only present if ``PARENT_GROUP`` was passed to + :command:`cpack_add_component_group`. If so, this field is a string value + containing the component group's parent group. + + ``isExpandedByDefault`` + True if ``EXPANDED`` was passed to :command:`cpack_add_component_group`, + false if it was not. + + ``isBold`` + True if ``BOLD_TITLE`` was passed to :command:`cpack_add_component_group`, + false if it was not. + + ``components`` + An array of names of components that are direct members of the group + (components that have this group as their ``GROUP``). Components of + subgroups are not included. + + ``subgroups`` + An array of names of component groups that are subgroups of the group + (groups that have this group as their ``PARENT_GROUP``). + +``installationTypes`` + The ``installationTypes`` field is an object with installation type names as + the keys and objects describing the installation types as the values. The + installation type objects have the following fields: + + ``name`` + The name of the installation type. This is always the same as the key in + the ``installationTypes`` object. + + ``displayName`` + The value of the ``DISPLAY_NAME`` field passed to + :command:`cpack_add_install_type`. + + ``index`` + The integer index of the installation type in the list. + +``projects`` + The ``projects`` field is an array of objects describing CMake projects which + comprise the CPack project. The values in this field are derived from + :variable:`CPACK_INSTALL_CMAKE_PROJECTS`. In most cases, this will be only a + single project. The project objects have the following fields: + + ``projectName`` + The project name passed to :variable:`CPACK_INSTALL_CMAKE_PROJECTS`. + + ``component`` + The name of the component or component set which comprises the project. + + ``directory`` + The build directory of the CMake project. This is the directory which + contains the ``cmake_install.cmake`` script. + + ``subDirectory`` + The subdirectory to install the project into inside the CPack package. + +``packageName`` + The package name given in :variable:`CPACK_PACKAGE_NAME`. Only present if + this option is set. + +``packageVersion`` + The package version given in :variable:`CPACK_PACKAGE_VERSION`. Only present + if this option is set. + +``packageDescriptionFile`` + The package description file given in + :variable:`CPACK_PACKAGE_DESCRIPTION_FILE`. Only present if this option is + set. + +``packageDescriptionSummary`` + The package description summary given in + :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`. Only present if this option is + set. + +``buildConfig`` + The build configuration given to CPack with the ``-C`` option. Only present + if this option is set. + +``defaultDirectoryPermissions`` + The default directory permissions given in + :variable:`CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS`. Only present if this + option is set. + +``setDestdir`` + True if :variable:`CPACK_SET_DESTDIR` is true, false if it is not. + +``packagingInstallPrefix`` + The install prefix given in :variable:`CPACK_PACKAGING_INSTALL_PREFIX`. Only + present if :variable:`CPACK_SET_DESTDIR` is true. + +``stripFiles`` + True if :variable:`CPACK_STRIP_FILES` is true, false if it is not. + +``warnOnAbsoluteInstallDestination`` + True if :variable:`CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION` is true, false + if it is not. + +``errorOnAbsoluteInstallDestination`` + True if :variable:`CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION` is true, + false if it is not. + +Variables specific to CPack External generator +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. variable:: CPACK_EXT_REQUESTED_VERSIONS + + This variable is used to request a specific version of the CPack External + generator. It is a list of ``major.minor`` values, separated by semicolons. + + If this variable is set to a non-empty value, the CPack External generator + will iterate through each item in the list to search for a version that it + knows how to generate. Requested versions should be listed in order of + descending preference by the client software, as the first matching version + in the list will be generated. + + The generator knows how to generate the version if it has a versioned + generator whose major version exactly matches the requested major version, + and whose minor version is greater than or equal to the requested minor + version. For example, if ``CPACK_EXT_REQUESTED_VERSIONS`` contains 1.0, and + the CPack External generator knows how to generate 1.1, it will generate 1.1. + If the generator doesn't know how to generate a version in the list, it skips + the version and looks at the next one. If it doesn't know how to generate any + of the requested versions, an error is thrown. + + If this variable is not set, or is empty, the CPack External generator will + generate the highest major and minor version that it knows how to generate. + + If an invalid version is encountered in ``CPACK_EXT_REQUESTED_VERSIONS`` (one + that doesn't match ``major.minor``, where ``major`` and ``minor`` are + integers), it is ignored. diff --git a/Help/manual/cpack-generators.7.rst b/Help/manual/cpack-generators.7.rst index 4614b1c..ade9149 100644 --- a/Help/manual/cpack-generators.7.rst +++ b/Help/manual/cpack-generators.7.rst @@ -18,6 +18,7 @@ Generators /cpack_gen/cygwin /cpack_gen/deb /cpack_gen/dmg + /cpack_gen/external /cpack_gen/freebsd /cpack_gen/ifw /cpack_gen/nsis https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2ef966bc77e9efd036747ee9d6977e2f2c7e024d commit 2ef966bc77e9efd036747ee9d6977e2f2c7e024d Author: Kyle Edwards AuthorDate: Mon Jun 11 15:33:23 2018 -0400 Commit: Kyle Edwards CommitDate: Mon Jul 2 09:51:02 2018 -0400 Testing: Add test for CPack External generator This test case ensures that the CPack External generator produces the proper .json file, and also ensures that the version negotation with CPACK_EXT_REQUESTED_VERSIONS works properly. diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index daf3940..dcc7c98 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -422,7 +422,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") add_RunCMake_test(ctest_labels_for_subprojects) endif() -add_RunCMake_test_group(CPack "DEB;RPM;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ") +add_RunCMake_test_group(CPack "DEB;RPM;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;Ext") # add a test to make sure symbols are exported from a shared library # for MSVC compilers CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS property is used add_RunCMake_test(AutoExportDll) diff --git a/Tests/RunCMake/CPack/Ext/Helpers.cmake b/Tests/RunCMake/CPack/Ext/Helpers.cmake new file mode 100644 index 0000000..2c67e06 --- /dev/null +++ b/Tests/RunCMake/CPack/Ext/Helpers.cmake @@ -0,0 +1,31 @@ +function(getPackageNameGlobexpr NAME COMPONENT VERSION REVISION FILE_NO RESULT_VAR) + set(${RESULT_VAR} "${NAME}-${VERSION}-*.json" PARENT_SCOPE) +endfunction() + +function(getPackageContentList FILE RESULT_VAR) + set("${RESULT_VAR}" "" PARENT_SCOPE) +endfunction() + +function(toExpectedContentList FILE_NO CONTENT_VAR) + set("${CONTENT_VAR}" "" PARENT_SCOPE) +endfunction() + +set(ALL_FILES_GLOB "*.json") + +function(check_ext_json EXPECTED_FILE ACTUAL_FILE) + file(READ "${EXPECTED_FILE}" _expected_regex) + file(READ "${ACTUAL_FILE}" _actual_contents) + + string(REGEX REPLACE "\n+$" "" _expected_regex "${_expected_regex}") + string(REGEX REPLACE "\n+$" "" _actual_contents "${_actual_contents}") + + if(NOT "${_actual_contents}" MATCHES "${_expected_regex}") + message(FATAL_ERROR + "Output JSON does not match expected regex.\n" + "Expected regex:\n" + "${_expected_regex}\n" + "Actual output:\n" + "${_actual_contents}\n" + ) + endif() +endfunction() diff --git a/Tests/RunCMake/CPack/Ext/Prerequirements.cmake b/Tests/RunCMake/CPack/Ext/Prerequirements.cmake new file mode 100644 index 0000000..e69de29 diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 4b7f146..bc25b12 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -18,7 +18,7 @@ run_cpack_test(GENERATE_SHLIBS_LDCONFIG "DEB" true "COMPONENT") run_cpack_test(INSTALL_SCRIPTS "RPM" false "COMPONENT") run_cpack_test(LONG_FILENAMES "DEB" false "MONOLITHIC") run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM" false "COMPONENT") -run_cpack_test(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ" false "MONOLITHIC;COMPONENT") +run_cpack_test(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;Ext" false "MONOLITHIC;COMPONENT") run_cpack_test_subtests(PACKAGE_CHECKSUM "invalid;MD5;SHA1;SHA224;SHA256;SHA384;SHA512" "TGZ" false "MONOLITHIC") run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM" false "COMPONENT") run_cpack_test(PER_COMPONENT_FIELDS "RPM;DEB" false "COMPONENT") @@ -31,3 +31,4 @@ run_cpack_test(USER_FILELIST "RPM" false "MONOLITHIC") run_cpack_test(MD5SUMS "DEB" false "MONOLITHIC;COMPONENT") run_cpack_test(CPACK_INSTALL_SCRIPT "ZIP" false "MONOLITHIC") run_cpack_test(DEB_PACKAGE_VERSION_BACK_COMPATIBILITY "DEB" false "MONOLITHIC;COMPONENT") +run_cpack_test_subtests(EXT "none;good;good_multi;bad_major;bad_minor;invalid_good;invalid_bad" "Ext" false "MONOLITHIC;COMPONENT") diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake index 1f5ab87..af12d37 100644 --- a/Tests/RunCMake/CPack/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/VerifyResult.cmake @@ -56,8 +56,12 @@ if(NOT EXPECTED_FILES_COUNT EQUAL 0) set(EXPECTED_FILE_CONTENT_${file_no_} "${EXPECTED_FILE_CONTENT_${file_no_}_LIST}") toExpectedContentList("${file_no_}" "EXPECTED_FILE_CONTENT_${file_no_}") - list(SORT PACKAGE_CONTENT) - list(SORT EXPECTED_FILE_CONTENT_${file_no_}) + if(NOT PACKAGE_CONTENT STREQUAL "") + list(SORT PACKAGE_CONTENT) + endif() + if(NOT EXPECTED_FILE_CONTENT_${file_no_} STREQUAL "") + list(SORT EXPECTED_FILE_CONTENT_${file_no_}) + endif() if(PACKAGE_CONTENT STREQUAL EXPECTED_FILE_CONTENT_${file_no_}) set(expected_content_list TRUE) diff --git a/Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake new file mode 100644 index 0000000..2634111 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake @@ -0,0 +1,6 @@ +if(RunCMake_SUBTEST_SUFFIX MATCHES "^(none|good(_multi)?|invalid_good)$") + set(EXPECTED_FILES_COUNT "1") + set(EXPECTED_FILE_CONTENT_1_LIST "/share;/share/cpack-test;/share/cpack-test/f1.txt;/share/cpack-test/f2.txt;/share/cpack-test/f3.txt;/share/cpack-test/f4.txt") +else() + set(EXPECTED_FILES_COUNT "0") +endif() diff --git a/Tests/RunCMake/CPack/tests/EXT/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/EXT/VerifyResult.cmake new file mode 100644 index 0000000..97b74f7 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/VerifyResult.cmake @@ -0,0 +1,3 @@ +if(RunCMake_SUBTEST_SUFFIX MATCHES "^(none|good(_multi)?|invalid_good)") + check_ext_json("${src_dir}/tests/EXT/expected-json-1.0.txt" "${FOUND_FILE_1}") +endif() diff --git a/Tests/RunCMake/CPack/tests/EXT/bad_major-stderr.txt b/Tests/RunCMake/CPack/tests/EXT/bad_major-stderr.txt new file mode 100644 index 0000000..372c5e4 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/bad_major-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/Internal/CPack/CPackExt\.cmake:[0-9]+ \(message\): + Could not find a suitable version in CPACK_EXT_REQUESTED_VERSIONS + + +CPack Error: Error while executing CPackExt\.cmake +CPack Error: Cannot initialize the generator Ext diff --git a/Tests/RunCMake/CPack/tests/EXT/bad_minor-stderr.txt b/Tests/RunCMake/CPack/tests/EXT/bad_minor-stderr.txt new file mode 100644 index 0000000..372c5e4 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/bad_minor-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/Internal/CPack/CPackExt\.cmake:[0-9]+ \(message\): + Could not find a suitable version in CPACK_EXT_REQUESTED_VERSIONS + + +CPack Error: Error while executing CPackExt\.cmake +CPack Error: Cannot initialize the generator Ext diff --git a/Tests/RunCMake/CPack/tests/EXT/expected-json-1.0.txt b/Tests/RunCMake/CPack/tests/EXT/expected-json-1.0.txt new file mode 100644 index 0000000..b96cf0b --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/expected-json-1.0.txt @@ -0,0 +1,176 @@ +^\{ + "componentGroups" :[ ] + \{ + "f12" :[ ] + \{ + "components" :[ ] + \[ + "f1", + "f2" + \], + "description" : "Component group for files 1 and 2", + "displayName" : "Files 1 and 2", + "isBold" : false, + "isExpandedByDefault" : false, + "name" : "f12", + "parentGroup" : "f1234", + "subgroups" : \[\] + \}, + "f1234" :[ ] + \{ + "components" : \[\], + "description" : "Component group for all files", + "displayName" : "Files 1-4", + "isBold" : false, + "isExpandedByDefault" : false, + "name" : "f1234", + "subgroups" :[ ] + \[ + "f12", + "f34" + \] + \}, + "f34" :[ ] + \{ + "components" :[ ] + \[ + "f3", + "f4" + \], + "description" : "Component group for files 3 and 4", + "displayName" : "Files 3 and 4", + "isBold" : false, + "isExpandedByDefault" : false, + "name" : "f34", + "parentGroup" : "f1234", + "subgroups" : \[\] + \} + \}, + "components" :[ ] + \{ + "f1" :[ ] + \{ + "archiveFile" : "", + "dependencies" : \[\], + "description" : "Component for file 1", + "displayName" : "File 1", + "group" : "f12", + "installationTypes" :[ ] + \[ + "full", + "f12" + \], + "isDisabledByDefault" : false, + "isDownloaded" : false, + "isHidden" : false, + "isRequired" : false, + "name" : "f1" + \}, + "f2" :[ ] + \{ + "archiveFile" : "", + "dependencies" :[ ] + \[ + "f1" + \], + "description" : "Component for file 2", + "displayName" : "File 2", + "group" : "f12", + "installationTypes" :[ ] + \[ + "full", + "f12" + \], + "isDisabledByDefault" : false, + "isDownloaded" : false, + "isHidden" : false, + "isRequired" : false, + "name" : "f2" + \}, + "f3" :[ ] + \{ + "archiveFile" : "", + "dependencies" :[ ] + \[ + "f1", + "f2" + \], + "description" : "Component for file 3", + "displayName" : "File 3", + "group" : "f34", + "installationTypes" :[ ] + \[ + "full" + \], + "isDisabledByDefault" : false, + "isDownloaded" : false, + "isHidden" : false, + "isRequired" : false, + "name" : "f3" + \}, + "f4" :[ ] + \{ + "archiveFile" : "", + "dependencies" :[ ] + \[ + "f2", + "f3", + "f1" + \], + "description" : "Component for file 4", + "displayName" : "File 4", + "group" : "f34", + "installationTypes" :[ ] + \[ + "full" + \], + "isDisabledByDefault" : false, + "isDownloaded" : false, + "isHidden" : false, + "isRequired" : false, + "name" : "f4" + \} + \}, + "errorOnAbsoluteInstallDestination" : false, + "formatVersionMajor" : 1, + "formatVersionMinor" : 0, + "installationTypes" :[ ] + \{ + "f12" :[ ] + \{ + "displayName" : "Only files 1 and 2", + "index" : 2, + "name" : "f12" + \}, + "full" :[ ] + \{ + "displayName" : "Full installation", + "index" : 1, + "name" : "full" + \} + \}, + "packageDescriptionFile" : ".*/Templates/CPack\.GenericDescription\.txt", + "packageDescriptionSummary" : "EXT-(none|good(_multi)?|invalid_good)-subtest-(MONOLITHIC|COMPONENT)-type built using CMake", + "packageName" : "ext", + "packageVersion" : "0\.1\.1", + "projects" :[ ] + \[ + \{ + "component" : "ALL", + "components" :[ ] + \[ + "f1", + "f2", + "f3", + "f4" + \], + "directory" : ".*/Tests/RunCMake/Ext/CPack/EXT-build-(none|good(_multi)?|invalid_good)-subtest", + "installationTypes" : \[\], + "projectName" : "EXT-(none|good(_multi)?|invalid_good)-subtest-(MONOLITHIC|COMPONENT)-type", + "subDirectory" : "/" + \} + \], + "setDestdir" : false, + "stripFiles" : false, + "warnOnAbsoluteInstallDestination" : false +\}$ diff --git a/Tests/RunCMake/CPack/tests/EXT/invalid_bad-stderr.txt b/Tests/RunCMake/CPack/tests/EXT/invalid_bad-stderr.txt new file mode 100644 index 0000000..372c5e4 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/invalid_bad-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/Internal/CPack/CPackExt\.cmake:[0-9]+ \(message\): + Could not find a suitable version in CPACK_EXT_REQUESTED_VERSIONS + + +CPack Error: Error while executing CPackExt\.cmake +CPack Error: Cannot initialize the generator Ext diff --git a/Tests/RunCMake/CPack/tests/EXT/test.cmake b/Tests/RunCMake/CPack/tests/EXT/test.cmake new file mode 100644 index 0000000..6bd3cb8 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/test.cmake @@ -0,0 +1,83 @@ +include(CPackComponent) + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "none") + unset(CPACK_EXT_REQUESTED_VERSIONS) +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "good") + set(CPACK_EXT_REQUESTED_VERSIONS "1.0") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "good_multi") + set(CPACK_EXT_REQUESTED_VERSIONS "1.0;2.0") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "bad_major") + set(CPACK_EXT_REQUESTED_VERSIONS "2.0") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "bad_minor") + set(CPACK_EXT_REQUESTED_VERSIONS "1.1") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid_good") + set(CPACK_EXT_REQUESTED_VERSIONS "1;1.0") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid_bad") + set(CPACK_EXT_REQUESTED_VERSIONS "1") +endif() + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f1.txt" test1) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f2.txt" test2) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f3.txt" test3) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f4.txt" test4) + +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f1.txt" DESTINATION share/cpack-test COMPONENT f1) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f2.txt" DESTINATION share/cpack-test COMPONENT f2) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f3.txt" DESTINATION share/cpack-test COMPONENT f3) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f4.txt" DESTINATION share/cpack-test COMPONENT f4) + +cpack_add_component(f1 + DISPLAY_NAME "File 1" + DESCRIPTION "Component for file 1" + GROUP f12 + INSTALL_TYPES full f12 +) + +cpack_add_component(f2 + DISPLAY_NAME "File 2" + DESCRIPTION "Component for file 2" + GROUP f12 + DEPENDS f1 + INSTALL_TYPES full f12 +) + +cpack_add_component(f3 + DISPLAY_NAME "File 3" + DESCRIPTION "Component for file 3" + GROUP f34 + DEPENDS f1 f2 + INSTALL_TYPES full +) + +cpack_add_component(f4 + DISPLAY_NAME "File 4" + DESCRIPTION "Component for file 4" + GROUP f34 + DEPENDS f2 f3 f1 + INSTALL_TYPES full +) + +cpack_add_component_group(f12 + DISPLAY_NAME "Files 1 and 2" + DESCRIPTION "Component group for files 1 and 2" + PARENT_GROUP f1234 +) + +cpack_add_component_group(f34 + DISPLAY_NAME "Files 3 and 4" + DESCRIPTION "Component group for files 3 and 4" + PARENT_GROUP f1234 +) + +cpack_add_component_group(f1234 + DISPLAY_NAME "Files 1-4" + DESCRIPTION "Component group for all files" +) + +cpack_add_install_type(full + DISPLAY_NAME "Full installation" +) + +cpack_add_install_type(f12 + DISPLAY_NAME "Only files 1 and 2" +) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=80914d88da3e5c997158fd3cc703a39b6673f780 commit 80914d88da3e5c997158fd3cc703a39b6673f780 Author: Kyle Edwards AuthorDate: Fri Jun 8 15:14:10 2018 -0400 Commit: Kyle Edwards CommitDate: Mon Jul 2 09:51:02 2018 -0400 CPack: Add "CPack External" generator This generator doesn't actually package the files. Instead, it provides a metadata JSON file that can be used by external packaging software to do its own packaging. This JSON file provides information about the components, component groups, installation types, and CMake projects. diff --git a/Modules/Internal/CPack/CPackExt.cmake b/Modules/Internal/CPack/CPackExt.cmake new file mode 100644 index 0000000..e52d978 --- /dev/null +++ b/Modules/Internal/CPack/CPackExt.cmake @@ -0,0 +1,53 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +if(NOT "${CPACK_EXT_REQUESTED_VERSIONS}" STREQUAL "") + unset(_found_major) + + foreach(_req_version IN LISTS CPACK_EXT_REQUESTED_VERSIONS) + if(_req_version MATCHES "^([0-9]+)\\.([0-9]+)$") + set(_req_major "${CMAKE_MATCH_1}") + set(_req_minor "${CMAKE_MATCH_2}") + + foreach(_known_version IN LISTS CPACK_EXT_KNOWN_VERSIONS) + string(REGEX MATCH + "^([0-9]+)\\.([0-9]+)$" + _known_version_dummy + "${_known_version}" + ) + + set(_known_major "${CMAKE_MATCH_1}") + set(_known_minor "${CMAKE_MATCH_2}") + + if(_req_major EQUAL _known_major AND NOT _known_minor LESS _req_minor) + set(_found_major "${_known_major}") + set(_found_minor "${_known_minor}") + break() + endif() + endforeach() + + if(DEFINED _found_major) + break() + endif() + endif() + endforeach() + + if(DEFINED _found_major) + set(CPACK_EXT_SELECTED_MAJOR "${_found_major}") + set(CPACK_EXT_SELECTED_MINOR "${_found_minor}") + set(CPACK_EXT_SELECTED_VERSION "${_found_major}.${_found_minor}") + else() + message(FATAL_ERROR + "Could not find a suitable version in CPACK_EXT_REQUESTED_VERSIONS" + ) + endif() +else() + list(GET CPACK_EXT_KNOWN_VERSIONS 0 CPACK_EXT_SELECTED_VERSION) + string(REGEX MATCH + "^([0-9]+)\\.([0-9]+)$" + _dummy + "${CPACK_EXT_SELECTED_VERSION}" + ) + set(CPACK_EXT_SELECTED_MAJOR "${CMAKE_MATCH_1}") + set(CPACK_EXT_SELECTED_MINOR "${CMAKE_MATCH_2}") +endif() diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 6623ba4..0457984 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -886,6 +886,8 @@ include_directories( set(CPACK_SRCS CPack/cmCPackArchiveGenerator.cxx CPack/cmCPackComponentGroup.cxx + CPack/cmCPackDebGenerator.cxx + CPack/cmCPackExtGenerator.cxx CPack/cmCPackGeneratorFactory.cxx CPack/cmCPackGenerator.cxx CPack/cmCPackLog.cxx @@ -898,7 +900,6 @@ set(CPACK_SRCS CPack/cmCPackTarCompressGenerator.cxx CPack/cmCPackZIPGenerator.cxx CPack/cmCPack7zGenerator.cxx - CPack/cmCPackDebGenerator.cxx ) # CPack IFW generator set(CPACK_SRCS ${CPACK_SRCS} diff --git a/Source/CPack/cmCPackExtGenerator.cxx b/Source/CPack/cmCPackExtGenerator.cxx new file mode 100644 index 0000000..c36b098 --- /dev/null +++ b/Source/CPack/cmCPackExtGenerator.cxx @@ -0,0 +1,291 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmCPackExtGenerator.h" + +#include "cmAlgorithms.h" +#include "cmCPackComponentGroup.h" +#include "cmCPackLog.h" +#include "cmSystemTools.h" + +#include "cm_jsoncpp_value.h" +#include "cm_jsoncpp_writer.h" + +#include "cmsys/FStream.hxx" + +#include +#include + +int cmCPackExtGenerator::InitializeInternal() +{ + this->SetOption("CPACK_EXT_KNOWN_VERSIONS", "1.0"); + + if (!this->ReadListFile("Internal/CPack/CPackExt.cmake")) { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error while executing CPackExt.cmake" << std::endl); + return 0; + } + + std::string major = this->GetOption("CPACK_EXT_SELECTED_MAJOR"); + if (major == "1") { + this->Generator = cm::make_unique(this); + } + + return this->Superclass::InitializeInternal(); +} + +int cmCPackExtGenerator::PackageFiles() +{ + Json::StreamWriterBuilder builder; + builder["indentation"] = " "; + + std::string filename = "package.json"; + if (!this->packageFileNames.empty()) { + filename = this->packageFileNames[0]; + } + + cmsys::ofstream fout(filename.c_str()); + std::unique_ptr jout(builder.newStreamWriter()); + + Json::Value root(Json::objectValue); + + if (!this->Generator->WriteToJSON(root)) { + return 0; + } + + if (jout->write(root, &fout)) { + return 0; + } + + return 1; +} + +bool cmCPackExtGenerator::SupportsComponentInstallation() const +{ + return true; +} + +int cmCPackExtGenerator::InstallProjectViaInstallCommands( + bool setDestDir, const std::string& tempInstallDirectory) +{ + (void)setDestDir; + (void)tempInstallDirectory; + return 1; +} + +int cmCPackExtGenerator::InstallProjectViaInstallScript( + bool setDestDir, const std::string& tempInstallDirectory) +{ + (void)setDestDir; + (void)tempInstallDirectory; + return 1; +} + +int cmCPackExtGenerator::InstallProjectViaInstalledDirectories( + bool setDestDir, const std::string& tempInstallDirectory, + const mode_t* default_dir_mode) +{ + (void)setDestDir; + (void)tempInstallDirectory; + (void)default_dir_mode; + return 1; +} + +int cmCPackExtGenerator::RunPreinstallTarget( + const std::string& installProjectName, const std::string& installDirectory, + cmGlobalGenerator* globalGenerator, const std::string& buildConfig) +{ + (void)installProjectName; + (void)installDirectory; + (void)globalGenerator; + (void)buildConfig; + return 1; +} + +int cmCPackExtGenerator::InstallCMakeProject( + bool setDestDir, const std::string& installDirectory, + const std::string& baseTempInstallDirectory, const mode_t* default_dir_mode, + const std::string& component, bool componentInstall, + const std::string& installSubDirectory, const std::string& buildConfig, + std::string& absoluteDestFiles) +{ + (void)setDestDir; + (void)installDirectory; + (void)baseTempInstallDirectory; + (void)default_dir_mode; + (void)component; + (void)componentInstall; + (void)installSubDirectory; + (void)buildConfig; + (void)absoluteDestFiles; + return 1; +} + +cmCPackExtGenerator::cmCPackExtVersionGenerator::cmCPackExtVersionGenerator( + cmCPackExtGenerator* parent) + : Parent(parent) +{ +} + +int cmCPackExtGenerator::cmCPackExtVersionGenerator::WriteVersion( + Json::Value& root) +{ + root["formatVersionMajor"] = this->GetVersionMajor(); + root["formatVersionMinor"] = this->GetVersionMinor(); + + return 1; +} + +int cmCPackExtGenerator::cmCPackExtVersionGenerator::WriteToJSON( + Json::Value& root) +{ + if (!this->WriteVersion(root)) { + return 0; + } + + const char* packageName = this->Parent->GetOption("CPACK_PACKAGE_NAME"); + if (packageName) { + root["packageName"] = packageName; + } + + const char* packageVersion = + this->Parent->GetOption("CPACK_PACKAGE_VERSION"); + if (packageVersion) { + root["packageVersion"] = packageVersion; + } + + const char* packageDescriptionFile = + this->Parent->GetOption("CPACK_PACKAGE_DESCRIPTION_FILE"); + if (packageDescriptionFile) { + root["packageDescriptionFile"] = packageDescriptionFile; + } + + const char* packageDescriptionSummary = + this->Parent->GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY"); + if (packageDescriptionSummary) { + root["packageDescriptionSummary"] = packageDescriptionSummary; + } + + const char* buildConfigCstr = this->Parent->GetOption("CPACK_BUILD_CONFIG"); + if (buildConfigCstr) { + root["buildConfig"] = buildConfigCstr; + } + + const char* defaultDirectoryPermissions = + this->Parent->GetOption("CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS"); + if (defaultDirectoryPermissions && *defaultDirectoryPermissions) { + root["defaultDirectoryPermissions"] = defaultDirectoryPermissions; + } + if (cmSystemTools::IsInternallyOn( + this->Parent->GetOption("CPACK_SET_DESTDIR"))) { + root["setDestdir"] = true; + root["packagingInstallPrefix"] = + this->Parent->GetOption("CPACK_PACKAGING_INSTALL_PREFIX"); + } else { + root["setDestdir"] = false; + } + + root["stripFiles"] = + !cmSystemTools::IsOff(this->Parent->GetOption("CPACK_STRIP_FILES")); + root["warnOnAbsoluteInstallDestination"] = + this->Parent->IsOn("CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION"); + root["errorOnAbsoluteInstallDestination"] = + this->Parent->IsOn("CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION"); + + Json::Value& projects = root["projects"] = Json::Value(Json::arrayValue); + for (auto& project : this->Parent->CMakeProjects) { + Json::Value jsonProject(Json::objectValue); + + jsonProject["projectName"] = project.ProjectName; + jsonProject["component"] = project.Component; + jsonProject["directory"] = project.Directory; + jsonProject["subDirectory"] = project.SubDirectory; + + Json::Value& installationTypes = jsonProject["installationTypes"] = + Json::Value(Json::arrayValue); + for (auto& installationType : project.InstallationTypes) { + installationTypes.append(installationType->Name); + } + + Json::Value& components = jsonProject["components"] = + Json::Value(Json::arrayValue); + for (auto& component : project.Components) { + components.append(component->Name); + } + + projects.append(jsonProject); + } + + Json::Value& installationTypes = root["installationTypes"] = + Json::Value(Json::objectValue); + for (auto& installationType : this->Parent->InstallationTypes) { + Json::Value& jsonInstallationType = + installationTypes[installationType.first] = + Json::Value(Json::objectValue); + + jsonInstallationType["name"] = installationType.second.Name; + jsonInstallationType["displayName"] = installationType.second.DisplayName; + jsonInstallationType["index"] = installationType.second.Index; + } + + Json::Value& components = root["components"] = + Json::Value(Json::objectValue); + for (auto& component : this->Parent->Components) { + Json::Value& jsonComponent = components[component.first] = + Json::Value(Json::objectValue); + + jsonComponent["name"] = component.second.Name; + jsonComponent["displayName"] = component.second.DisplayName; + if (component.second.Group) { + jsonComponent["group"] = component.second.Group->Name; + } + jsonComponent["isRequired"] = component.second.IsRequired; + jsonComponent["isHidden"] = component.second.IsHidden; + jsonComponent["isDisabledByDefault"] = + component.second.IsDisabledByDefault; + jsonComponent["isDownloaded"] = component.second.IsDownloaded; + jsonComponent["description"] = component.second.Description; + jsonComponent["archiveFile"] = component.second.ArchiveFile; + + Json::Value& cmpInstallationTypes = jsonComponent["installationTypes"] = + Json::Value(Json::arrayValue); + for (auto& installationType : component.second.InstallationTypes) { + cmpInstallationTypes.append(installationType->Name); + } + + Json::Value& dependencies = jsonComponent["dependencies"] = + Json::Value(Json::arrayValue); + for (auto& dep : component.second.Dependencies) { + dependencies.append(dep->Name); + } + } + + Json::Value& groups = root["componentGroups"] = + Json::Value(Json::objectValue); + for (auto& group : this->Parent->ComponentGroups) { + Json::Value& jsonGroup = groups[group.first] = + Json::Value(Json::objectValue); + + jsonGroup["name"] = group.second.Name; + jsonGroup["displayName"] = group.second.DisplayName; + jsonGroup["description"] = group.second.Description; + jsonGroup["isBold"] = group.second.IsBold; + jsonGroup["isExpandedByDefault"] = group.second.IsExpandedByDefault; + if (group.second.ParentGroup) { + jsonGroup["parentGroup"] = group.second.ParentGroup->Name; + } + + Json::Value& subgroups = jsonGroup["subgroups"] = + Json::Value(Json::arrayValue); + for (auto& subgroup : group.second.Subgroups) { + subgroups.append(subgroup->Name); + } + + Json::Value& groupComponents = jsonGroup["components"] = + Json::Value(Json::arrayValue); + for (auto& component : group.second.Components) { + groupComponents.append(component->Name); + } + } + + return 1; +} diff --git a/Source/CPack/cmCPackExtGenerator.h b/Source/CPack/cmCPackExtGenerator.h new file mode 100644 index 0000000..fa12d7f --- /dev/null +++ b/Source/CPack/cmCPackExtGenerator.h @@ -0,0 +1,86 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cmCPackExtGenerator_h +#define cmCPackExtGenerator_h + +#include "cmCPackGenerator.h" +#include "cm_sys_stat.h" + +#include +#include + +class cmGlobalGenerator; +namespace Json { +class Value; +} + +/** \class cmCPackExtGenerator + * \brief A generator for CPack External packaging tools + */ +class cmCPackExtGenerator : public cmCPackGenerator +{ +public: + cmCPackTypeMacro(cmCPackExtGenerator, cmCPackGenerator); + + const char* GetOutputExtension() override { return ".json"; } + +protected: + int InitializeInternal() override; + + int PackageFiles() override; + + bool SupportsComponentInstallation() const override; + + int InstallProjectViaInstallCommands( + bool setDestDir, const std::string& tempInstallDirectory) override; + int InstallProjectViaInstallScript( + bool setDestDir, const std::string& tempInstallDirectory) override; + int InstallProjectViaInstalledDirectories( + bool setDestDir, const std::string& tempInstallDirectory, + const mode_t* default_dir_mode) override; + + int RunPreinstallTarget(const std::string& installProjectName, + const std::string& installDirectory, + cmGlobalGenerator* globalGenerator, + const std::string& buildConfig) override; + int InstallCMakeProject(bool setDestDir, const std::string& installDirectory, + const std::string& baseTempInstallDirectory, + const mode_t* default_dir_mode, + const std::string& component, bool componentInstall, + const std::string& installSubDirectory, + const std::string& buildConfig, + std::string& absoluteDestFiles) override; + +private: + class cmCPackExtVersionGenerator + { + public: + cmCPackExtVersionGenerator(cmCPackExtGenerator* parent); + + virtual ~cmCPackExtVersionGenerator() = default; + + virtual int WriteToJSON(Json::Value& root); + + protected: + virtual int GetVersionMajor() = 0; + virtual int GetVersionMinor() = 0; + + int WriteVersion(Json::Value& root); + + cmCPackExtGenerator* Parent; + }; + + class cmCPackExtVersion1Generator : public cmCPackExtVersionGenerator + { + public: + using cmCPackExtVersionGenerator::cmCPackExtVersionGenerator; + + protected: + int GetVersionMajor() override { return 1; } + int GetVersionMinor() override { return 0; } + }; + + std::unique_ptr Generator; +}; + +#endif diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx index d47e5ed..8ef24f7 100644 --- a/Source/CPack/cmCPackGeneratorFactory.cxx +++ b/Source/CPack/cmCPackGeneratorFactory.cxx @@ -12,6 +12,7 @@ # include "cmCPackFreeBSDGenerator.h" #endif #include "cmCPackDebGenerator.h" +#include "cmCPackExtGenerator.h" #include "cmCPackGenerator.h" #include "cmCPackLog.h" #include "cmCPackNSISGenerator.h" @@ -110,6 +111,10 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory() this->RegisterGenerator("NuGet", "NuGet packages", cmCPackNuGetGenerator::CreateGenerator); } + if (cmCPackExtGenerator::CanGenerate()) { + this->RegisterGenerator("Ext", "CPack External packages", + cmCPackExtGenerator::CreateGenerator); + } #ifdef __APPLE__ if (cmCPackDragNDropGenerator::CanGenerate()) { this->RegisterGenerator("DragNDrop", "Mac OSX Drag And Drop", https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3ced881db63a97eb402bd68be5e45298371f4519 commit 3ced881db63a97eb402bd68be5e45298371f4519 Author: Kyle Edwards AuthorDate: Fri Jun 8 15:08:36 2018 -0400 Commit: Kyle Edwards CommitDate: Mon Jul 2 09:51:02 2018 -0400 cmCPackGenerator: Store CPACK_INSTALL_CMAKE_PROJECTS in an internal field By storing this information in an internal field in the class, it can be used later on by generators that need it. diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h index f2907db..bb980d7 100644 --- a/Source/CPack/cmCPackComponentGroup.h +++ b/Source/CPack/cmCPackComponentGroup.h @@ -143,4 +143,29 @@ public: std::vector Subgroups; }; +/** \class cmCPackInstallCMakeProject + * \brief A single quadruplet from the CPACK_INSTALL_CMAKE_PROJECTS variable. + */ +class cmCPackInstallCMakeProject +{ +public: + /// The directory of the CMake project. + std::string Directory; + + /// The name of the CMake project. + std::string ProjectName; + + /// The name of the component (or component set) to install. + std::string Component; + + /// The subdirectory to install into. + std::string SubDirectory; + + /// The list of installation types. + std::vector InstallationTypes; + + /// The list of components. + std::vector Components; +}; + #endif diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 6924873..7014676 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -545,9 +545,13 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( ++it; std::string installProjectName = *it; ++it; - std::string installComponent = *it; + cmCPackInstallCMakeProject project; + + project.Directory = installDirectory; + project.ProjectName = installProjectName; + project.Component = *it; ++it; - std::string installSubDirectory = *it; + project.SubDirectory = *it; std::vector componentsVector; @@ -562,30 +566,32 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( !(this->IsOn("CPACK_MONOLITHIC_INSTALL"))) { // Determine the installation types for this project (if provided). std::string installTypesVar = "CPACK_" + - cmSystemTools::UpperCase(installComponent) + "_INSTALL_TYPES"; + cmSystemTools::UpperCase(project.Component) + "_INSTALL_TYPES"; const char* installTypes = this->GetOption(installTypesVar); if (installTypes && *installTypes) { std::vector installTypesVector; cmSystemTools::ExpandListArgument(installTypes, installTypesVector); for (std::string const& installType : installTypesVector) { - this->GetInstallationType(installProjectName, installType); + project.InstallationTypes.push_back( + this->GetInstallationType(project.ProjectName, installType)); } } // Determine the set of components that will be used in this project std::string componentsVar = - "CPACK_COMPONENTS_" + cmSystemTools::UpperCase(installComponent); + "CPACK_COMPONENTS_" + cmSystemTools::UpperCase(project.Component); const char* components = this->GetOption(componentsVar); if (components && *components) { cmSystemTools::ExpandListArgument(components, componentsVector); for (std::string const& comp : componentsVector) { - GetComponent(installProjectName, comp); + project.Components.push_back( + this->GetComponent(project.ProjectName, comp)); } componentInstall = true; } } if (componentsVector.empty()) { - componentsVector.push_back(installComponent); + componentsVector.push_back(project.Component); } const char* buildConfigCstr = this->GetOption("CPACK_BUILD_CONFIG"); @@ -605,7 +611,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( // on windows. cmSystemTools::SetForceUnixPaths(globalGenerator->GetForceUnixPaths()); - if (!this->RunPreinstallTarget(installProjectName, installDirectory, + if (!this->RunPreinstallTarget(project.ProjectName, project.Directory, globalGenerator, buildConfig)) { return 0; } @@ -613,17 +619,19 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( delete globalGenerator; cmCPackLogger(cmCPackLog::LOG_OUTPUT, - "- Install project: " << installProjectName << std::endl); + "- Install project: " << project.ProjectName << std::endl); // Run the installation for each component for (std::string const& component : componentsVector) { if (!this->InstallCMakeProject( - setDestDir, installDirectory, baseTempInstallDirectory, + setDestDir, project.Directory, baseTempInstallDirectory, default_dir_mode, component, componentInstall, - installSubDirectory, buildConfig, absoluteDestFiles)) { + project.SubDirectory, buildConfig, absoluteDestFiles)) { return 0; } } + + this->CMakeProjects.push_back(project); } } this->SetOption("CPACK_ABSOLUTE_DESTINATION_FILES", diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index 9128f36..c13c649 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -283,6 +283,7 @@ protected: */ std::vector files; + std::vector CMakeProjects; std::map InstallationTypes; /** * The set of components. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4938abb6002cb60501a0da651059ca0aefeed24f commit 4938abb6002cb60501a0da651059ca0aefeed24f Author: Kyle Edwards AuthorDate: Fri Jun 8 10:48:25 2018 -0400 Commit: Kyle Edwards CommitDate: Mon Jul 2 09:51:02 2018 -0400 cmCPackGenerator: Refactor InstallProjectViaInstallCMakeProjects() This refactoring will allow cmCPackExtGenerator to skip the install step while still gathering up information about the CPack components and groups. Besides, this function was too long, and needed to be broken up anyway. diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index f15445b..6924873 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -548,7 +548,6 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( std::string installComponent = *it; ++it; std::string installSubDirectory = *it; - std::string installFile = installDirectory + "/cmake_install.cmake"; std::vector componentsVector; @@ -559,7 +558,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( * - the user did not request Monolithic install * (this works at CPack time too) */ - if (this->SupportsComponentInstallation() & + if (this->SupportsComponentInstallation() && !(this->IsOn("CPACK_MONOLITHIC_INSTALL"))) { // Determine the installation types for this project (if provided). std::string installTypesVar = "CPACK_" + @@ -606,38 +605,11 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( // on windows. cmSystemTools::SetForceUnixPaths(globalGenerator->GetForceUnixPaths()); - // Does this generator require pre-install? - if (const char* preinstall = - globalGenerator->GetPreinstallTargetName()) { - std::string buildCommand = globalGenerator->GenerateCMakeBuildCommand( - preinstall, buildConfig, "", false); - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "- Install command: " << buildCommand << std::endl); - cmCPackLogger(cmCPackLog::LOG_OUTPUT, - "- Run preinstall target for: " << installProjectName - << std::endl); - std::string output; - int retVal = 1; - bool resB = cmSystemTools::RunSingleCommand( - buildCommand.c_str(), &output, &output, &retVal, - installDirectory.c_str(), this->GeneratorVerbose, - cmDuration::zero()); - if (!resB || retVal) { - std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); - tmpFile += "/PreinstallOutput.log"; - cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << buildCommand << std::endl - << "# Directory: " << installDirectory << std::endl - << "# Output:" << std::endl - << output << std::endl; - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem running install command: " - << buildCommand << std::endl - << "Please check " << tmpFile << " for errors" - << std::endl); - return 0; - } + if (!this->RunPreinstallTarget(installProjectName, installDirectory, + globalGenerator, buildConfig)) { + return 0; } + delete globalGenerator; cmCPackLogger(cmCPackLog::LOG_OUTPUT, @@ -645,258 +617,302 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( // Run the installation for each component for (std::string const& component : componentsVector) { - std::string tempInstallDirectory = baseTempInstallDirectory; - installComponent = component; - if (componentInstall) { - cmCPackLogger(cmCPackLog::LOG_OUTPUT, - "- Install component: " << installComponent - << std::endl); + if (!this->InstallCMakeProject( + setDestDir, installDirectory, baseTempInstallDirectory, + default_dir_mode, component, componentInstall, + installSubDirectory, buildConfig, absoluteDestFiles)) { + return 0; } + } + } + } + this->SetOption("CPACK_ABSOLUTE_DESTINATION_FILES", + absoluteDestFiles.c_str()); + return 1; +} - cmake cm(cmake::RoleScript); - cm.SetHomeDirectory(""); - cm.SetHomeOutputDirectory(""); - cm.GetCurrentSnapshot().SetDefaultDefinitions(); - cm.AddCMakePaths(); - cm.SetProgressCallback(cmCPackGeneratorProgress, this); - cm.SetTrace(this->Trace); - cm.SetTraceExpand(this->TraceExpand); - cmGlobalGenerator gg(&cm); - cmMakefile mf(&gg, cm.GetCurrentSnapshot()); - if (!installSubDirectory.empty() && installSubDirectory != "/" && - installSubDirectory != ".") { - tempInstallDirectory += installSubDirectory; - } - if (componentInstall) { - tempInstallDirectory += "/"; - // Some CPack generators would rather chose - // the local installation directory suffix. - // Some (e.g. RPM) use - // one install directory for each component **GROUP** - // instead of the default - // one install directory for each component. - tempInstallDirectory += - GetComponentInstallDirNameSuffix(installComponent); - if (this->IsOn("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY")) { - tempInstallDirectory += "/"; - tempInstallDirectory += this->GetOption("CPACK_PACKAGE_FILE_NAME"); - } - } +int cmCPackGenerator::RunPreinstallTarget( + const std::string& installProjectName, const std::string& installDirectory, + cmGlobalGenerator* globalGenerator, const std::string& buildConfig) +{ + // Does this generator require pre-install? + if (const char* preinstall = globalGenerator->GetPreinstallTargetName()) { + std::string buildCommand = globalGenerator->GenerateCMakeBuildCommand( + preinstall, buildConfig, "", false); + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "- Install command: " << buildCommand << std::endl); + cmCPackLogger(cmCPackLog::LOG_OUTPUT, + "- Run preinstall target for: " << installProjectName + << std::endl); + std::string output; + int retVal = 1; + bool resB = cmSystemTools::RunSingleCommand( + buildCommand.c_str(), &output, &output, &retVal, + installDirectory.c_str(), this->GeneratorVerbose, cmDuration::zero()); + if (!resB || retVal) { + std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); + tmpFile += "/PreinstallOutput.log"; + cmGeneratedFileStream ofs(tmpFile.c_str()); + ofs << "# Run command: " << buildCommand << std::endl + << "# Directory: " << installDirectory << std::endl + << "# Output:" << std::endl + << output << std::endl; + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Problem running install command: " + << buildCommand << std::endl + << "Please check " << tmpFile << " for errors" + << std::endl); + return 0; + } + } - const char* default_dir_inst_permissions = - this->GetOption("CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS"); - if (default_dir_inst_permissions && *default_dir_inst_permissions) { - mf.AddDefinition("CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS", - default_dir_inst_permissions); - } + return 1; +} - if (!setDestDir) { - tempInstallDirectory += this->GetPackagingInstallPrefix(); - } +int cmCPackGenerator::InstallCMakeProject( + bool setDestDir, const std::string& installDirectory, + const std::string& baseTempInstallDirectory, const mode_t* default_dir_mode, + const std::string& component, bool componentInstall, + const std::string& installSubDirectory, const std::string& buildConfig, + std::string& absoluteDestFiles) +{ + std::string tempInstallDirectory = baseTempInstallDirectory; + std::string installFile = installDirectory + "/cmake_install.cmake"; - if (setDestDir) { - // For DESTDIR based packaging, use the *project* - // CMAKE_INSTALL_PREFIX underneath the tempInstallDirectory. The - // value of the project's CMAKE_INSTALL_PREFIX is sent in here as - // the value of the CPACK_INSTALL_PREFIX variable. - // - // If DESTDIR has been 'internally set ON' this means that - // the underlying CPack specific generator did ask for that - // In this case we may override CPACK_INSTALL_PREFIX with - // CPACK_PACKAGING_INSTALL_PREFIX - // I know this is tricky and awkward but it's the price for - // CPACK_SET_DESTDIR backward compatibility. - if (cmSystemTools::IsInternallyOn( - this->GetOption("CPACK_SET_DESTDIR"))) { - this->SetOption("CPACK_INSTALL_PREFIX", - this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX")); - } - std::string dir; - if (this->GetOption("CPACK_INSTALL_PREFIX")) { - dir += this->GetOption("CPACK_INSTALL_PREFIX"); - } - mf.AddDefinition("CMAKE_INSTALL_PREFIX", dir.c_str()); + if (componentInstall) { + cmCPackLogger(cmCPackLog::LOG_OUTPUT, + "- Install component: " << component << std::endl); + } - cmCPackLogger( - cmCPackLog::LOG_DEBUG, - "- Using DESTDIR + CPACK_INSTALL_PREFIX... (mf.AddDefinition)" - << std::endl); - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "- Setting CMAKE_INSTALL_PREFIX to '" << dir << "'" - << std::endl); - - // Make sure that DESTDIR + CPACK_INSTALL_PREFIX directory - // exists: - // - if (cmSystemTools::StringStartsWith(dir.c_str(), "/")) { - dir = tempInstallDirectory + dir; - } else { - dir = tempInstallDirectory + "/" + dir; - } - /* - * We must re-set DESTDIR for each component - * We must not add the CPACK_INSTALL_PREFIX part because - * it will be added using the override of CMAKE_INSTALL_PREFIX - * The main reason for this awkward trick is that - * are using DESTDIR for 2 different reasons: - * - Because it was asked by the CPack Generator or the user - * using CPACK_SET_DESTDIR - * - Because it was already used for component install - * in order to put things in subdirs... - */ - cmSystemTools::PutEnv(std::string("DESTDIR=") + - tempInstallDirectory); - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "- Creating directory: '" << dir << "'" << std::endl); + cmake cm(cmake::RoleScript); + cm.SetHomeDirectory(""); + cm.SetHomeOutputDirectory(""); + cm.GetCurrentSnapshot().SetDefaultDefinitions(); + cm.AddCMakePaths(); + cm.SetProgressCallback(cmCPackGeneratorProgress, this); + cm.SetTrace(this->Trace); + cm.SetTraceExpand(this->TraceExpand); + cmGlobalGenerator gg(&cm); + cmMakefile mf(&gg, cm.GetCurrentSnapshot()); + if (!installSubDirectory.empty() && installSubDirectory != "/" && + installSubDirectory != ".") { + tempInstallDirectory += installSubDirectory; + } + if (componentInstall) { + tempInstallDirectory += "/"; + // Some CPack generators would rather chose + // the local installation directory suffix. + // Some (e.g. RPM) use + // one install directory for each component **GROUP** + // instead of the default + // one install directory for each component. + tempInstallDirectory += GetComponentInstallDirNameSuffix(component); + if (this->IsOn("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY")) { + tempInstallDirectory += "/"; + tempInstallDirectory += this->GetOption("CPACK_PACKAGE_FILE_NAME"); + } + } - if (!cmsys::SystemTools::MakeDirectory(dir, default_dir_mode)) { - cmCPackLogger( - cmCPackLog::LOG_ERROR, - "Problem creating temporary directory: " << dir << std::endl); - return 0; - } - } else { - mf.AddDefinition("CMAKE_INSTALL_PREFIX", - tempInstallDirectory.c_str()); + const char* default_dir_inst_permissions = + this->GetOption("CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS"); + if (default_dir_inst_permissions && *default_dir_inst_permissions) { + mf.AddDefinition("CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS", + default_dir_inst_permissions); + } - if (!cmsys::SystemTools::MakeDirectory(tempInstallDirectory, - default_dir_mode)) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem creating temporary directory: " - << tempInstallDirectory << std::endl); - return 0; - } + if (!setDestDir) { + tempInstallDirectory += this->GetPackagingInstallPrefix(); + } - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "- Using non-DESTDIR install... (mf.AddDefinition)" - << std::endl); - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "- Setting CMAKE_INSTALL_PREFIX to '" - << tempInstallDirectory << "'" << std::endl); - } + if (setDestDir) { + // For DESTDIR based packaging, use the *project* + // CMAKE_INSTALL_PREFIX underneath the tempInstallDirectory. The + // value of the project's CMAKE_INSTALL_PREFIX is sent in here as + // the value of the CPACK_INSTALL_PREFIX variable. + // + // If DESTDIR has been 'internally set ON' this means that + // the underlying CPack specific generator did ask for that + // In this case we may override CPACK_INSTALL_PREFIX with + // CPACK_PACKAGING_INSTALL_PREFIX + // I know this is tricky and awkward but it's the price for + // CPACK_SET_DESTDIR backward compatibility. + if (cmSystemTools::IsInternallyOn(this->GetOption("CPACK_SET_DESTDIR"))) { + this->SetOption("CPACK_INSTALL_PREFIX", + this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX")); + } + std::string dir; + if (this->GetOption("CPACK_INSTALL_PREFIX")) { + dir += this->GetOption("CPACK_INSTALL_PREFIX"); + } + mf.AddDefinition("CMAKE_INSTALL_PREFIX", dir.c_str()); - if (!buildConfig.empty()) { - mf.AddDefinition("BUILD_TYPE", buildConfig.c_str()); - } - std::string installComponentLowerCase = - cmSystemTools::LowerCase(installComponent); - if (installComponentLowerCase != "all") { - mf.AddDefinition("CMAKE_INSTALL_COMPONENT", - installComponent.c_str()); - } + cmCPackLogger( + cmCPackLog::LOG_DEBUG, + "- Using DESTDIR + CPACK_INSTALL_PREFIX... (mf.AddDefinition)" + << std::endl); + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "- Setting CMAKE_INSTALL_PREFIX to '" << dir << "'" + << std::endl); + + // Make sure that DESTDIR + CPACK_INSTALL_PREFIX directory + // exists: + // + if (cmSystemTools::StringStartsWith(dir.c_str(), "/")) { + dir = tempInstallDirectory + dir; + } else { + dir = tempInstallDirectory + "/" + dir; + } + /* + * We must re-set DESTDIR for each component + * We must not add the CPACK_INSTALL_PREFIX part because + * it will be added using the override of CMAKE_INSTALL_PREFIX + * The main reason for this awkward trick is that + * are using DESTDIR for 2 different reasons: + * - Because it was asked by the CPack Generator or the user + * using CPACK_SET_DESTDIR + * - Because it was already used for component install + * in order to put things in subdirs... + */ + cmSystemTools::PutEnv(std::string("DESTDIR=") + tempInstallDirectory); + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "- Creating directory: '" << dir << "'" << std::endl); - // strip on TRUE, ON, 1, one or several file names, but not on - // FALSE, OFF, 0 and an empty string - if (!cmSystemTools::IsOff(this->GetOption("CPACK_STRIP_FILES"))) { - mf.AddDefinition("CMAKE_INSTALL_DO_STRIP", "1"); - } - // Remember the list of files before installation - // of the current component (if we are in component install) - std::string const& InstallPrefix = tempInstallDirectory; - std::vector filesBefore; - std::string findExpr = tempInstallDirectory; - if (componentInstall) { - cmsys::Glob glB; - findExpr += "/*"; - glB.RecurseOn(); - glB.SetRecurseListDirs(true); - glB.FindFiles(findExpr); - filesBefore = glB.GetFiles(); - std::sort(filesBefore.begin(), filesBefore.end()); - } + if (!cmsys::SystemTools::MakeDirectory(dir, default_dir_mode)) { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Problem creating temporary directory: " << dir + << std::endl); + return 0; + } + } else { + mf.AddDefinition("CMAKE_INSTALL_PREFIX", tempInstallDirectory.c_str()); - // If CPack was asked to warn on ABSOLUTE INSTALL DESTINATION - // then forward request to cmake_install.cmake script - if (this->IsOn("CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION")) { - mf.AddDefinition("CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION", "1"); - } - // If current CPack generator does support - // ABSOLUTE INSTALL DESTINATION or CPack has been asked for - // then ask cmake_install.cmake script to error out - // as soon as it occurs (before installing file) - if (!SupportsAbsoluteDestination() || - this->IsOn("CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION")) { - mf.AddDefinition("CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION", "1"); - } - // do installation - int res = mf.ReadListFile(installFile.c_str()); - // forward definition of CMAKE_ABSOLUTE_DESTINATION_FILES - // to CPack (may be used by generators like CPack RPM or DEB) - // in order to transparently handle ABSOLUTE PATH - if (mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES")) { - mf.AddDefinition( - "CPACK_ABSOLUTE_DESTINATION_FILES", - mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES")); - } + if (!cmsys::SystemTools::MakeDirectory(tempInstallDirectory, + default_dir_mode)) { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Problem creating temporary directory: " + << tempInstallDirectory << std::endl); + return 0; + } - // Now rebuild the list of files after installation - // of the current component (if we are in component install) - if (componentInstall) { - cmsys::Glob glA; - glA.RecurseOn(); - glA.SetRecurseListDirs(true); - glA.SetRecurseThroughSymlinks(false); - glA.FindFiles(findExpr); - std::vector filesAfter = glA.GetFiles(); - std::sort(filesAfter.begin(), filesAfter.end()); - std::vector::iterator diff; - std::vector result(filesAfter.size()); - diff = std::set_difference(filesAfter.begin(), filesAfter.end(), - filesBefore.begin(), filesBefore.end(), - result.begin()); - - std::vector::iterator fit; - std::string localFileName; - // Populate the File field of each component - for (fit = result.begin(); fit != diff; ++fit) { - localFileName = cmSystemTools::RelativePath(InstallPrefix, *fit); - localFileName = - localFileName.substr(localFileName.find_first_not_of('/')); - Components[installComponent].Files.push_back(localFileName); - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "Adding file <" - << localFileName << "> to component <" - << installComponent << ">" << std::endl); - } - } + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "- Using non-DESTDIR install... (mf.AddDefinition)" + << std::endl); + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "- Setting CMAKE_INSTALL_PREFIX to '" << tempInstallDirectory + << "'" << std::endl); + } - if (nullptr != mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) { - if (!absoluteDestFiles.empty()) { - absoluteDestFiles += ";"; - } - absoluteDestFiles += - mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES"); - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "Got some ABSOLUTE DESTINATION FILES: " - << absoluteDestFiles << std::endl); - // define component specific var - if (componentInstall) { - std::string absoluteDestFileComponent = - std::string("CPACK_ABSOLUTE_DESTINATION_FILES") + "_" + - GetComponentInstallDirNameSuffix(installComponent); - if (nullptr != this->GetOption(absoluteDestFileComponent)) { - std::string absoluteDestFilesListComponent = - this->GetOption(absoluteDestFileComponent); - absoluteDestFilesListComponent += ";"; - absoluteDestFilesListComponent += - mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES"); - this->SetOption(absoluteDestFileComponent, - absoluteDestFilesListComponent.c_str()); - } else { - this->SetOption( - absoluteDestFileComponent, - mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")); - } - } - } - if (cmSystemTools::GetErrorOccuredFlag() || !res) { - return 0; - } + if (!buildConfig.empty()) { + mf.AddDefinition("BUILD_TYPE", buildConfig.c_str()); + } + std::string installComponentLowerCase = cmSystemTools::LowerCase(component); + if (installComponentLowerCase != "all") { + mf.AddDefinition("CMAKE_INSTALL_COMPONENT", component.c_str()); + } + + // strip on TRUE, ON, 1, one or several file names, but not on + // FALSE, OFF, 0 and an empty string + if (!cmSystemTools::IsOff(this->GetOption("CPACK_STRIP_FILES"))) { + mf.AddDefinition("CMAKE_INSTALL_DO_STRIP", "1"); + } + // Remember the list of files before installation + // of the current component (if we are in component install) + std::string const& InstallPrefix = tempInstallDirectory; + std::vector filesBefore; + std::string findExpr = tempInstallDirectory; + if (componentInstall) { + cmsys::Glob glB; + findExpr += "/*"; + glB.RecurseOn(); + glB.SetRecurseListDirs(true); + glB.FindFiles(findExpr); + filesBefore = glB.GetFiles(); + std::sort(filesBefore.begin(), filesBefore.end()); + } + + // If CPack was asked to warn on ABSOLUTE INSTALL DESTINATION + // then forward request to cmake_install.cmake script + if (this->IsOn("CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION")) { + mf.AddDefinition("CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION", "1"); + } + // If current CPack generator does support + // ABSOLUTE INSTALL DESTINATION or CPack has been asked for + // then ask cmake_install.cmake script to error out + // as soon as it occurs (before installing file) + if (!SupportsAbsoluteDestination() || + this->IsOn("CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION")) { + mf.AddDefinition("CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION", "1"); + } + // do installation + int res = mf.ReadListFile(installFile.c_str()); + // forward definition of CMAKE_ABSOLUTE_DESTINATION_FILES + // to CPack (may be used by generators like CPack RPM or DEB) + // in order to transparently handle ABSOLUTE PATH + if (mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES")) { + mf.AddDefinition("CPACK_ABSOLUTE_DESTINATION_FILES", + mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES")); + } + + // Now rebuild the list of files after installation + // of the current component (if we are in component install) + if (componentInstall) { + cmsys::Glob glA; + glA.RecurseOn(); + glA.SetRecurseListDirs(true); + glA.SetRecurseThroughSymlinks(false); + glA.FindFiles(findExpr); + std::vector filesAfter = glA.GetFiles(); + std::sort(filesAfter.begin(), filesAfter.end()); + std::vector::iterator diff; + std::vector result(filesAfter.size()); + diff = std::set_difference(filesAfter.begin(), filesAfter.end(), + filesBefore.begin(), filesBefore.end(), + result.begin()); + + std::vector::iterator fit; + std::string localFileName; + // Populate the File field of each component + for (fit = result.begin(); fit != diff; ++fit) { + localFileName = cmSystemTools::RelativePath(InstallPrefix, *fit); + localFileName = + localFileName.substr(localFileName.find_first_not_of('/')); + Components[component].Files.push_back(localFileName); + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "Adding file <" << localFileName << "> to component <" + << component << ">" << std::endl); + } + } + + if (nullptr != mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) { + if (!absoluteDestFiles.empty()) { + absoluteDestFiles += ";"; + } + absoluteDestFiles += mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES"); + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "Got some ABSOLUTE DESTINATION FILES: " << absoluteDestFiles + << std::endl); + // define component specific var + if (componentInstall) { + std::string absoluteDestFileComponent = + std::string("CPACK_ABSOLUTE_DESTINATION_FILES") + "_" + + GetComponentInstallDirNameSuffix(component); + if (nullptr != this->GetOption(absoluteDestFileComponent)) { + std::string absoluteDestFilesListComponent = + this->GetOption(absoluteDestFileComponent); + absoluteDestFilesListComponent += ";"; + absoluteDestFilesListComponent += + mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES"); + this->SetOption(absoluteDestFileComponent, + absoluteDestFilesListComponent.c_str()); + } else { + this->SetOption(absoluteDestFileComponent, + mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")); } } } - this->SetOption("CPACK_ABSOLUTE_DESTINATION_FILES", - absoluteDestFiles.c_str()); + if (cmSystemTools::GetErrorOccuredFlag() || !res) { + return 0; + } return 1; } diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index c22f36b..9128f36 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -15,6 +15,7 @@ #include "cm_sys_stat.h" class cmCPackLog; +class cmGlobalGenerator; class cmInstalledFile; class cmMakefile; @@ -185,6 +186,17 @@ protected: bool setDestDir, const std::string& tempInstallDirectory, const mode_t* default_dir_mode); + virtual int RunPreinstallTarget(const std::string& installProjectName, + const std::string& installDirectory, + cmGlobalGenerator* globalGenerator, + const std::string& buildConfig); + virtual int InstallCMakeProject( + bool setDestDir, const std::string& installDirectory, + const std::string& baseTempInstallDirectory, + const mode_t* default_dir_mode, const std::string& component, + bool componentInstall, const std::string& installSubDirectory, + const std::string& buildConfig, std::string& absoluteDestFiles); + /** * The various level of support of * CPACK_SET_DESTDIR used by the generator. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=42cc0644d5cc7a50ea2f65aa29b49f629ff17384 commit 42cc0644d5cc7a50ea2f65aa29b49f629ff17384 Author: Sebastian Holtermann AuthorDate: Mon Jul 2 12:53:44 2018 +0200 Commit: Sebastian Holtermann CommitDate: Mon Jul 2 12:53:44 2018 +0200 Autogen: Use default and remove custom GetSafeProperty functions diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 37155fa..8ede960 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -42,18 +42,6 @@ inline static const char* SafeString(const char* value) return (value != nullptr) ? value : ""; } -inline static std::string GetSafeProperty(cmGeneratorTarget const* target, - const char* key) -{ - return std::string(SafeString(target->GetProperty(key))); -} - -inline static std::string GetSafeProperty(cmSourceFile const* sf, - const char* key) -{ - return std::string(SafeString(sf->GetProperty(key))); -} - static std::size_t GetParallelCPUCount() { static std::size_t count = 0; @@ -249,7 +237,7 @@ void cmQtAutoGenInitializer::InitCustomTargets() cmSystemTools::ConvertToUnixSlashes(this->DirInfo); // Autogen build dir - this->DirBuild = GetSafeProperty(this->Target, "AUTOGEN_BUILD_DIR"); + this->DirBuild = this->Target->GetSafeProperty("AUTOGEN_BUILD_DIR"); if (this->DirBuild.empty()) { this->DirBuild = cbd; this->DirBuild += '/'; @@ -281,7 +269,7 @@ void cmQtAutoGenInitializer::InitCustomTargets() } // Inherit FOLDER property from target (#13688) if (folder == nullptr) { - folder = SafeString(this->Target->Target->GetProperty("FOLDER")); + folder = this->Target->GetProperty("FOLDER"); } if (folder != nullptr) { this->AutogenFolder = folder; @@ -432,7 +420,7 @@ void cmQtAutoGenInitializer::InitCustomTargets() qrc.Generated = sf->GetPropertyAsBool("GENERATED"); // RCC options { - std::string const opts = GetSafeProperty(sf, "AUTORCC_OPTIONS"); + std::string const opts = sf->GetSafeProperty("AUTORCC_OPTIONS"); if (!opts.empty()) { cmSystemTools::ExpandListArgument(opts, qrc.Options); } @@ -568,7 +556,7 @@ void cmQtAutoGenInitializer::InitCustomTargets() // Target rcc options std::vector optionsTarget; cmSystemTools::ExpandListArgument( - GetSafeProperty(this->Target, "AUTORCC_OPTIONS"), optionsTarget); + this->Target->GetSafeProperty("AUTORCC_OPTIONS"), optionsTarget); // Check if file name is unique for (Qrc& qrc : this->Qrcs) { @@ -734,7 +722,7 @@ void cmQtAutoGenInitializer::InitCustomTargets() // Add user defined autogen target dependencies { std::string const deps = - GetSafeProperty(this->Target, "AUTOGEN_TARGET_DEPENDS"); + this->Target->GetSafeProperty("AUTOGEN_TARGET_DEPENDS"); if (!deps.empty()) { std::vector extraDeps; cmSystemTools::ExpandListArgument(deps, extraDeps); @@ -907,7 +895,7 @@ void cmQtAutoGenInitializer::SetupCustomTargets() } // Parallel processing - this->Parallel = GetSafeProperty(this->Target, "AUTOGEN_PARALLEL"); + this->Parallel = this->Target->GetSafeProperty("AUTOGEN_PARALLEL"); if (this->Parallel.empty() || (this->Parallel == "AUTO")) { // Autodetect number of CPUs this->Parallel = std::to_string(GetParallelCPUCount()); @@ -1000,12 +988,12 @@ void cmQtAutoGenInitializer::SetupCustomTargets() CWrite("AM_MOC_INCLUDES", this->MocIncludes); CWriteMap("AM_MOC_INCLUDES", this->MocIncludesConfig); CWrite("AM_MOC_OPTIONS", - GetSafeProperty(this->Target, "AUTOMOC_MOC_OPTIONS")); + this->Target->GetSafeProperty("AUTOMOC_MOC_OPTIONS")); CWrite("AM_MOC_RELAXED_MODE", MfDef("CMAKE_AUTOMOC_RELAXED_MODE")); CWrite("AM_MOC_MACRO_NAMES", - GetSafeProperty(this->Target, "AUTOMOC_MACRO_NAMES")); + this->Target->GetSafeProperty("AUTOMOC_MACRO_NAMES")); CWrite("AM_MOC_DEPEND_FILTERS", - GetSafeProperty(this->Target, "AUTOMOC_DEPEND_FILTERS")); + this->Target->GetSafeProperty("AUTOMOC_DEPEND_FILTERS")); CWrite("AM_MOC_PREDEFS_CMD", this->MocPredefsCmd); } @@ -1182,7 +1170,7 @@ void cmQtAutoGenInitializer::SetupCustomTargetsUic() // Uic search paths { std::string const usp = - GetSafeProperty(this->Target, "AUTOUIC_SEARCH_PATHS"); + this->Target->GetSafeProperty("AUTOUIC_SEARCH_PATHS"); if (!usp.empty()) { cmSystemTools::ExpandListArgument(usp, this->UicSearchPaths); std::string const srcDir = makefile->GetCurrentSourceDirectory(); @@ -1231,7 +1219,7 @@ void cmQtAutoGenInitializer::SetupCustomTargetsUic() this->UicSkip.insert(absFile); } // Check if the .ui file has uic options - std::string const uicOpts = GetSafeProperty(sf, "AUTOUIC_OPTIONS"); + std::string const uicOpts = sf->GetSafeProperty("AUTOUIC_OPTIONS"); if (!uicOpts.empty()) { // Check if file isn't skipped if (this->UicSkip.count(absFile) == 0) { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=127094f2f0e444b78d224d933a28a8313e487d36 commit 127094f2f0e444b78d224d933a28a8313e487d36 Author: Sebastian Holtermann AuthorDate: Mon Jul 2 12:39:54 2018 +0200 Commit: Sebastian Holtermann CommitDate: Mon Jul 2 12:39:54 2018 +0200 Add GetSafeProperty method to cmTarget, cmGeneratorTarget and cmSourceFile diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 41e55a5..02f181e 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -221,6 +221,15 @@ const char* cmGeneratorTarget::GetProperty(const std::string& prop) const return this->Target->GetProperty(prop); } +const char* cmGeneratorTarget::GetSafeProperty(const std::string& prop) const +{ + const char* ret = this->GetProperty(prop); + if (!ret) { + return ""; + } + return ret; +} + const char* cmGeneratorTarget::GetOutputTargetType( cmStateEnums::ArtifactType artifact) const { diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index aa36823..5b77610 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -68,7 +68,10 @@ public: std::string GetExportName() const; std::vector GetPropertyKeys() const; + ///! Might return a nullptr if the property is not set or invalid const char* GetProperty(const std::string& prop) const; + ///! Always returns a valid pointer + const char* GetSafeProperty(const std::string& prop) const; bool GetPropertyAsBool(const std::string& prop) const; void GetSourceFiles(std::vector& files, const std::string& config) const; diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 6792d66..05e26ea 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -296,6 +296,15 @@ const char* cmSourceFile::GetProperty(const std::string& prop) const return retVal; } +const char* cmSourceFile::GetSafeProperty(const std::string& prop) const +{ + const char* ret = this->GetProperty(prop); + if (!ret) { + return ""; + } + return ret; +} + bool cmSourceFile::GetPropertyAsBool(const std::string& prop) const { return cmSystemTools::IsOn(this->GetProperty(prop)); diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index 1516d98..ab0f229 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -45,7 +45,10 @@ public: void SetProperty(const std::string& prop, const char* value); void AppendProperty(const std::string& prop, const char* value, bool asString = false); + ///! Might return a nullptr if the property is not set or invalid const char* GetProperty(const std::string& prop) const; + ///! Always returns a valid pointer + const char* GetSafeProperty(const std::string& prop) const; bool GetPropertyAsBool(const std::string& prop) const; /** Implement getting a property when called from a CMake language diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 1a6e1d1..803a0a9 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1412,6 +1412,15 @@ const char* cmTarget::GetProperty(const std::string& prop) const return retVal; } +const char* cmTarget::GetSafeProperty(const std::string& prop) const +{ + const char* ret = this->GetProperty(prop); + if (!ret) { + return ""; + } + return ret; +} + bool cmTarget::GetPropertyAsBool(const std::string& prop) const { return cmSystemTools::IsOn(this->GetProperty(prop)); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 5f0b33c..7a3ab65 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -200,7 +200,10 @@ public: void SetProperty(const std::string& prop, const char* value); void AppendProperty(const std::string& prop, const char* value, bool asString = false); + ///! Might return a nullptr if the property is not set or invalid const char* GetProperty(const std::string& prop) const; + ///! Always returns a valid pointer + const char* GetSafeProperty(const std::string& prop) const; bool GetPropertyAsBool(const std::string& prop) const; void CheckProperty(const std::string& prop, cmMakefile* context) const; const char* GetComputedProperty(const std::string& prop, ----------------------------------------------------------------------- Summary of changes: Help/cpack_gen/external.rst | 249 +++++++++ Help/manual/cpack-generators.7.rst | 1 + Help/release/dev/cpack-external.rst | 8 + Modules/Internal/CPack/CPackExt.cmake | 53 ++ Source/CMakeLists.txt | 3 +- Source/CPack/cmCPackComponentGroup.h | 25 + Source/CPack/cmCPackExtGenerator.cxx | 291 +++++++++++ Source/CPack/cmCPackExtGenerator.h | 86 +++ Source/CPack/cmCPackGenerator.cxx | 576 +++++++++++---------- Source/CPack/cmCPackGenerator.h | 13 + Source/CPack/cmCPackGeneratorFactory.cxx | 5 + Source/cmGeneratorTarget.cxx | 9 + Source/cmGeneratorTarget.h | 3 + Source/cmQtAutoGenInitializer.cxx | 34 +- Source/cmSourceFile.cxx | 9 + Source/cmSourceFile.h | 3 + Source/cmTarget.cxx | 9 + Source/cmTarget.h | 3 + Tests/RunCMake/CMakeLists.txt | 2 +- Tests/RunCMake/CPack/Ext/Helpers.cmake | 31 ++ .../CPack/Ext/Prerequirements.cmake} | 0 Tests/RunCMake/CPack/RunCMakeTest.cmake | 3 +- Tests/RunCMake/CPack/VerifyResult.cmake | 8 +- Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake | 6 + Tests/RunCMake/CPack/tests/EXT/VerifyResult.cmake | 3 + .../RunCMake/CPack/tests/EXT/bad_major-stderr.txt | 6 + .../RunCMake/CPack/tests/EXT/bad_minor-stderr.txt | 6 + .../RunCMake/CPack/tests/EXT/expected-json-1.0.txt | 176 +++++++ .../CPack/tests/EXT/invalid_bad-stderr.txt | 6 + Tests/RunCMake/CPack/tests/EXT/test.cmake | 83 +++ 30 files changed, 1406 insertions(+), 304 deletions(-) create mode 100644 Help/cpack_gen/external.rst create mode 100644 Help/release/dev/cpack-external.rst create mode 100644 Modules/Internal/CPack/CPackExt.cmake create mode 100644 Source/CPack/cmCPackExtGenerator.cxx create mode 100644 Source/CPack/cmCPackExtGenerator.h create mode 100644 Tests/RunCMake/CPack/Ext/Helpers.cmake copy Tests/{Wrapping/vtkIncluded.cxx => RunCMake/CPack/Ext/Prerequirements.cmake} (100%) create mode 100644 Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake create mode 100644 Tests/RunCMake/CPack/tests/EXT/VerifyResult.cmake create mode 100644 Tests/RunCMake/CPack/tests/EXT/bad_major-stderr.txt create mode 100644 Tests/RunCMake/CPack/tests/EXT/bad_minor-stderr.txt create mode 100644 Tests/RunCMake/CPack/tests/EXT/expected-json-1.0.txt create mode 100644 Tests/RunCMake/CPack/tests/EXT/invalid_bad-stderr.txt create mode 100644 Tests/RunCMake/CPack/tests/EXT/test.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jul 4 00:05:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 4 Jul 2018 00:05:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc2-135-g80d29a8 Message-ID: <20180704040505.06B9111E3A0@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 80d29a8ac4006376e3bb1d1962651e18da641aaa (commit) from 4330f10186e994b3a7b64729f8b4e64e10a30896 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=80d29a8ac4006376e3bb1d1962651e18da641aaa commit 80d29a8ac4006376e3bb1d1962651e18da641aaa Author: Kitware Robot AuthorDate: Wed Jul 4 00:01:06 2018 -0400 Commit: Kitware Robot CommitDate: Wed Jul 4 00:01:06 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index c8cecc0..bddd027 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 12) -set(CMake_VERSION_PATCH 20180703) +set(CMake_VERSION_PATCH 20180704) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jul 5 00:05:07 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 5 Jul 2018 00:05:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc2-136-g5fec622 Message-ID: <20180705040507.366F011D6F3@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 5fec622ece869b30560b797e469c93c57d7016b6 (commit) from 80d29a8ac4006376e3bb1d1962651e18da641aaa (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5fec622ece869b30560b797e469c93c57d7016b6 commit 5fec622ece869b30560b797e469c93c57d7016b6 Author: Kitware Robot AuthorDate: Thu Jul 5 00:01:04 2018 -0400 Commit: Kitware Robot CommitDate: Thu Jul 5 00:01:04 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index bddd027..18440bd 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 12) -set(CMake_VERSION_PATCH 20180704) +set(CMake_VERSION_PATCH 20180705) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jul 5 10:35:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 5 Jul 2018 10:35:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc2-142-gca733cd Message-ID: <20180705143504.8457D113FC0@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 ca733cdf4532a4a3d05b82c49a5f2fbf994149de (commit) via 5dbee9d2d0f68e1fc343d04ac00a4a35d43df6fa (commit) via 8661e7052c4f711f13e7168231276e23c4c0defd (commit) via 7c4c13ffef87d748b896e2c762ad0b2c00afcd31 (commit) via 5b0f73a15a7b49461123a969bbebceff4284df9c (commit) via 963b8d9f6c1c4bcce2a82ade137a82b17ef75780 (commit) from 5fec622ece869b30560b797e469c93c57d7016b6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ca733cdf4532a4a3d05b82c49a5f2fbf994149de commit ca733cdf4532a4a3d05b82c49a5f2fbf994149de Merge: 5fec622 5dbee9d Author: Brad King AuthorDate: Thu Jul 5 14:25:56 2018 +0000 Commit: Kitware Robot CommitDate: Thu Jul 5 10:26:05 2018 -0400 Merge topic 'math-hex' 5dbee9d2d0 math: Add options to calculate and format output as hexadecimal 8661e7052c math: Diagnose divide-by-zero 7c4c13ffef math: Reject unexpected expression input explicitly 5b0f73a15a math: Use 64-bit integer type for computation 963b8d9f6c math: Add RunCMake.math test to prepare for error cases Acked-by: Kitware Robot Merge-request: !2056 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5dbee9d2d0f68e1fc343d04ac00a4a35d43df6fa commit 5dbee9d2d0f68e1fc343d04ac00a4a35d43df6fa Author: Daniel Franke AuthorDate: Fri May 18 21:59:46 2018 +0200 Commit: Brad King CommitDate: Tue Jul 3 09:55:58 2018 -0400 math: Add options to calculate and format output as hexadecimal diff --git a/Help/command/math.rst b/Help/command/math.rst index f99dc3d..63af931 100644 --- a/Help/command/math.rst +++ b/Help/command/math.rst @@ -5,10 +5,26 @@ Mathematical expressions. :: - math(EXPR ) + math(EXPR [OUTPUT_FORMAT ]) ``EXPR`` evaluates mathematical expression and returns result in the output variable. Example mathematical expression is ``5 * (10 + 13)``. Supported operators are ``+``, ``-``, ``*``, ``/``, ``%``, ``|``, ``&``, ``^``, ``~``, ``<<``, ``>>``, and ``(...)``. They have the same meaning as they do in C code. + +Numeric constants are evaluated in decimal or hexadecimal representation. + +The result is formatted according to the option "OUTPUT_FORMAT" , +where ```` is one of: +:: + + HEXADECIMAL = Result in output variable will be formatted in C code + Hexadecimal notation. + DECIMAL = Result in output variable will be formatted in decimal notation. + + +For example:: + + math(EXPR value "100 * 0xA" DECIMAL) results in value is set to "1000" + math(EXPR value "100 * 0xA" HEXADECIMAL) results in value is set to "0x3e8" diff --git a/Help/release/dev/math-hex.rst b/Help/release/dev/math-hex.rst new file mode 100644 index 0000000..16e21ec --- /dev/null +++ b/Help/release/dev/math-hex.rst @@ -0,0 +1,4 @@ +math-hex +-------- + +* The :command:`math` command gained options for hexadecimal. diff --git a/Source/LexerParser/cmExprLexer.cxx b/Source/LexerParser/cmExprLexer.cxx index 93b3ffd..1548daf 100644 --- a/Source/LexerParser/cmExprLexer.cxx +++ b/Source/LexerParser/cmExprLexer.cxx @@ -548,8 +548,8 @@ static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner ); yyg->yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 17 -#define YY_END_OF_BUFFER 18 +#define YY_NUM_RULES 18 +#define YY_END_OF_BUFFER 19 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -557,11 +557,11 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static const flex_int16_t yy_accept[25] = +static const flex_int16_t yy_accept[29] = { 0, - 0, 0, 18, 16, 1, 17, 7, 9, 14, 15, - 5, 3, 4, 6, 2, 16, 16, 10, 8, 11, - 2, 12, 13, 0 + 0, 0, 19, 17, 1, 18, 8, 10, 15, 16, + 6, 4, 5, 7, 2, 2, 17, 17, 11, 9, + 12, 2, 0, 13, 14, 3, 3, 0 } ; static const YY_CHAR yy_ec[256] = @@ -570,16 +570,16 @@ static const YY_CHAR yy_ec[256] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 4, 5, 1, 6, - 7, 8, 9, 1, 10, 1, 11, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 1, 1, 13, - 1, 14, 1, 1, 1, 1, 1, 1, 1, 1, + 7, 8, 9, 1, 10, 1, 11, 12, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 1, 1, 14, + 1, 15, 1, 1, 16, 16, 16, 16, 16, 16, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 15, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 17, 1, 1, + 1, 1, 1, 18, 1, 1, 16, 16, 16, 16, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 16, 1, 17, 1, 1, 1, 1, + 16, 16, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 17, + 1, 1, 1, 19, 1, 20, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -596,40 +596,46 @@ static const YY_CHAR yy_ec[256] = 1, 1, 1, 1, 1 } ; -static const YY_CHAR yy_meta[18] = +static const YY_CHAR yy_meta[21] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1 + 1, 2, 2, 1, 1, 3, 4, 1, 1, 1 } ; -static const flex_int16_t yy_base[25] = +static const flex_int16_t yy_base[32] = { 0, - 0, 0, 22, 23, 23, 23, 23, 23, 23, 23, - 23, 23, 23, 23, 9, 7, 5, 23, 23, 23, - 6, 23, 23, 23 + 0, 0, 34, 35, 35, 35, 35, 35, 35, 35, + 35, 35, 35, 35, 16, 9, 18, 11, 35, 35, + 35, 11, 0, 35, 35, 0, 0, 35, 23, 26, + 28 } ; -static const flex_int16_t yy_def[25] = +static const flex_int16_t yy_def[32] = { 0, - 24, 1, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 0 + 28, 1, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 29, 28, 28, 28, 28, 28, + 28, 28, 30, 28, 28, 31, 31, 0, 28, 28, + 28 } ; -static const flex_int16_t yy_nxt[41] = +static const flex_int16_t yy_nxt[56] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 23, 22, - 21, 24, 3, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24 + 14, 15, 16, 17, 18, 4, 4, 19, 20, 21, + 22, 22, 22, 22, 22, 25, 22, 26, 26, 27, + 27, 24, 23, 28, 3, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28 } ; -static const flex_int16_t yy_chk[41] = +static const flex_int16_t yy_chk[56] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 21, 17, 16, - 15, 3, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 16, 16, 22, 22, 29, 18, 29, 30, 30, 31, + 31, 17, 15, 3, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28 } ; /* The intent behind this definition is that it'll catch @@ -948,13 +954,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 25 ) + if ( yy_current_state >= 29 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 23 ); + while ( yy_base[yy_current_state] != 35 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -988,62 +994,66 @@ YY_RULE_SETUP YY_BREAK case 3: YY_RULE_SETUP -{ return exp_PLUS; } +{ yylvalp->Number = std::stoll(yytext, nullptr, 16); return exp_NUMBER; } YY_BREAK case 4: YY_RULE_SETUP -{ return exp_MINUS; } +{ return exp_PLUS; } YY_BREAK case 5: YY_RULE_SETUP -{ return exp_TIMES; } +{ return exp_MINUS; } YY_BREAK case 6: YY_RULE_SETUP -{ return exp_DIVIDE; } +{ return exp_TIMES; } YY_BREAK case 7: YY_RULE_SETUP -{ return exp_MOD; } +{ return exp_DIVIDE; } YY_BREAK case 8: YY_RULE_SETUP -{ return exp_OR; } +{ return exp_MOD; } YY_BREAK case 9: YY_RULE_SETUP -{ return exp_AND; } +{ return exp_OR; } YY_BREAK case 10: YY_RULE_SETUP -{ return exp_XOR; } +{ return exp_AND; } YY_BREAK case 11: YY_RULE_SETUP -{ return exp_NOT; } +{ return exp_XOR; } YY_BREAK case 12: YY_RULE_SETUP -{ return exp_SHIFTLEFT; } +{ return exp_NOT; } YY_BREAK case 13: YY_RULE_SETUP -{ return exp_SHIFTRIGHT; } +{ return exp_SHIFTLEFT; } YY_BREAK case 14: YY_RULE_SETUP -{ return exp_OPENPARENT; } +{ return exp_SHIFTRIGHT; } YY_BREAK case 15: YY_RULE_SETUP -{ return exp_CLOSEPARENT; } +{ return exp_OPENPARENT; } YY_BREAK case 16: YY_RULE_SETUP -{return exp_UNEXPECTED;} +{ return exp_CLOSEPARENT; } YY_BREAK case 17: YY_RULE_SETUP +{return exp_UNEXPECTED;} + YY_BREAK +case 18: +YY_RULE_SETUP ECHO; YY_BREAK case YY_STATE_EOF(INITIAL): @@ -1344,7 +1354,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 25 ) + if ( yy_current_state >= 29 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; @@ -1373,11 +1383,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 25 ) + if ( yy_current_state >= 29 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 24); + yy_is_jam = (yy_current_state == 28); (void)yyg; return yy_is_jam ? 0 : yy_current_state; diff --git a/Source/LexerParser/cmExprLexer.in.l b/Source/LexerParser/cmExprLexer.in.l index 0c4eb9e..87237d1 100644 --- a/Source/LexerParser/cmExprLexer.in.l +++ b/Source/LexerParser/cmExprLexer.in.l @@ -43,6 +43,7 @@ Modify cmExprLexer.cxx: [ \t] {} [0-9][0-9]* { yylvalp->Number = std::stoll(yytext, nullptr, 10); return exp_NUMBER; } +0[xX][0-9a-fA-F][0-9a-fA-F]* { yylvalp->Number = std::stoll(yytext, nullptr, 16); return exp_NUMBER; } "+" { return exp_PLUS; } "-" { return exp_MINUS; } diff --git a/Source/cmMathCommand.cxx b/Source/cmMathCommand.cxx index ab77dc3..5d1b099 100644 --- a/Source/cmMathCommand.cxx +++ b/Source/cmMathCommand.cxx @@ -28,16 +28,59 @@ bool cmMathCommand::InitialPass(std::vector const& args, bool cmMathCommand::HandleExprCommand(std::vector const& args) { - if (args.size() != 3) { + if ((args.size() != 3) && (args.size() != 5)) { this->SetError("EXPR called with incorrect arguments."); return false; } + enum class NumericFormat + { + UNINITIALIZED, + DECIMAL, + HEXADECIMAL, + }; + const std::string& outputVariable = args[1]; const std::string& expression = args[2]; + size_t argumentIndex = 3; + NumericFormat outputFormat = NumericFormat::UNINITIALIZED; this->Makefile->AddDefinition(outputVariable, "ERROR"); + if (argumentIndex < args.size()) { + const std::string messageHint = "sub-command EXPR "; + const std::string option = args[argumentIndex++]; + if (option == "OUTPUT_FORMAT") { + if (argumentIndex < args.size()) { + const std::string argument = args[argumentIndex++]; + if (argument == "DECIMAL") { + outputFormat = NumericFormat::DECIMAL; + } else if (argument == "HEXADECIMAL") { + outputFormat = NumericFormat::HEXADECIMAL; + } else { + std::string error = messageHint + "value \"" + argument + + "\" for option \"" + option + "\" is invalid."; + this->SetError(error); + return false; + } + } else { + std::string error = + messageHint + "missing argument for option \"" + option + "\"."; + this->SetError(error); + return false; + } + } else { + std::string error = + messageHint + "option \"" + option + "\" is unknown."; + this->SetError(error); + return false; + } + } + + if (outputFormat == NumericFormat::UNINITIALIZED) { + outputFormat = NumericFormat::DECIMAL; + } + cmExprParserHelper helper; if (!helper.ParseString(expression.c_str(), 0)) { this->SetError(helper.GetError()); @@ -45,7 +88,18 @@ bool cmMathCommand::HandleExprCommand(std::vector const& args) } char buffer[1024]; - sprintf(buffer, "%" KWIML_INT_PRId64, helper.GetResult()); + const char* fmt; + switch (outputFormat) { + case NumericFormat::HEXADECIMAL: + fmt = "0x%" KWIML_INT_PRIx64; + break; + case NumericFormat::DECIMAL: + CM_FALLTHROUGH; + default: + fmt = "%" KWIML_INT_PRId64; + break; + } + sprintf(buffer, fmt, helper.GetResult()); this->Makefile->AddDefinition(outputVariable, buffer); return true; diff --git a/Tests/MathTest/CMakeLists.txt b/Tests/MathTest/CMakeLists.txt index f764b3a..5403d29 100644 --- a/Tests/MathTest/CMakeLists.txt +++ b/Tests/MathTest/CMakeLists.txt @@ -13,14 +13,35 @@ set(expressions "-1 + +1" "+1 - -1" "+1 - - + + -(-3 + - - +1)" + "1000 -12*5" + "1000 +12*-5" + "1000 -12*-5" ) -set(FILE_EXPRESSIONS "") -foreach(expression - ${expressions}) - math(EXPR expr "${expression}") - string(APPEND FILE_EXPRESSIONS "TEST_EXPRESSION(${expression}, ${expr})\n") -endforeach() +set(FILE_EXPRESSIONS "extern void test_expression(int x, int y, const char * text);\n") + + +macro(add_math_test expression) + math(EXPR result ${expression} ${ARGV1} ${ARGV2}) + set(CODE "test_expression(${expression}, ${result}, \"${expression}\");") + string(APPEND FILE_EXPRESSIONS "${CODE}\n") +endmacro() + +macro(add_math_tests) + foreach (expression ${expressions}) + add_math_test(${expression} ${ARGV0} ${ARGV1}) + endforeach () +endmacro() + +add_math_tests() +add_math_tests("OUTPUT_FORMAT" "DECIMAL") +add_math_tests("OUTPUT_FORMAT" "HEXADECIMAL") + +# Avoid the test with negative result and hexadecimal formatting +# therefore more tests with a negative result +add_math_test("-12*5") +add_math_test("12*-5") + configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/MathTestTests.h.in" diff --git a/Tests/MathTest/MathTestExec.cxx b/Tests/MathTest/MathTestExec.cxx index 124eba4..fbcddc4 100644 --- a/Tests/MathTest/MathTestExec.cxx +++ b/Tests/MathTest/MathTestExec.cxx @@ -1,21 +1,43 @@ #include +#include +#include -#define TEST_EXPRESSION(x, y) \ - if ((x) != (y)) { \ - printf("Problem with EXPR: Expression: \"%s\" in C returns %d while in " \ - "CMake returns: %d\n", \ - #x, (x), (y)); \ - res++; \ +int res = 0; +bool print = false; + +void test_expression(int x, int y, const char* text) +{ + bool fail = (x) != (y); + if (fail) { + res++; + printf("Problem with EXPR:"); + } + if (fail || print) { + printf("Expression: \"%s\" in CMake returns %d", text, (y)); + if (fail) { + printf(" while in C returns: %d", (x)); + } + printf("\n"); } +} int main(int argc, char* argv[]) { - if (argc > 1) { - printf("Usage: %s\n", argv[0]); + if (argc > 2) { + printf("Usage: %s [print]\n", argv[0]); return 1; } - int res = 0; + + if (argc > 1) { + if (strcmp(argv[1], "print") != 0) { + printf("Usage: %s [print]\n", argv[0]); + return 1; + } + print = true; + } + #include "MathTestTests.h" + if (res != 0) { printf("%s: %d math tests failed\n", argv[0], res); return 1; diff --git a/Tests/RunCMake/math/MATH-DoubleOption-result.txt b/Tests/RunCMake/math/MATH-DoubleOption-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/math/MATH-DoubleOption-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/math/MATH-DoubleOption-stderr.txt b/Tests/RunCMake/math/MATH-DoubleOption-stderr.txt new file mode 100644 index 0000000..767a060 --- /dev/null +++ b/Tests/RunCMake/math/MATH-DoubleOption-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at MATH-DoubleOption.cmake:1 \(math\): + math EXPR called with incorrect arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/math/MATH-DoubleOption.cmake b/Tests/RunCMake/math/MATH-DoubleOption.cmake new file mode 100644 index 0000000..7bcb78e --- /dev/null +++ b/Tests/RunCMake/math/MATH-DoubleOption.cmake @@ -0,0 +1 @@ +math(EXPR var "10*10" OUTPUT_FORMAT DECIMAL OUTPUT_FORMAT HEXADECIMAL) diff --git a/Tests/RunCMake/math/MATH-TooManyArguments-result.txt b/Tests/RunCMake/math/MATH-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/math/MATH-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/math/MATH-TooManyArguments-stderr.txt b/Tests/RunCMake/math/MATH-TooManyArguments-stderr.txt new file mode 100644 index 0000000..fdcfecf --- /dev/null +++ b/Tests/RunCMake/math/MATH-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at MATH-TooManyArguments.cmake:1 \(math\): + math EXPR called with incorrect arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/math/MATH-TooManyArguments.cmake b/Tests/RunCMake/math/MATH-TooManyArguments.cmake new file mode 100644 index 0000000..969dc80 --- /dev/null +++ b/Tests/RunCMake/math/MATH-TooManyArguments.cmake @@ -0,0 +1 @@ +math(EXPR var "10*10" OUTPUT_FORMAT DECIMAL OUTPUT_FORMAT ) diff --git a/Tests/RunCMake/math/MATH-WrongArgument-result.txt b/Tests/RunCMake/math/MATH-WrongArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/math/MATH-WrongArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/math/MATH-WrongArgument-stderr.txt b/Tests/RunCMake/math/MATH-WrongArgument-stderr.txt new file mode 100644 index 0000000..bbe54bf --- /dev/null +++ b/Tests/RunCMake/math/MATH-WrongArgument-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at MATH-WrongArgument.cmake:1 \(math\): + math sub-command EXPR option "OUT" is unknown. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/math/MATH-WrongArgument.cmake b/Tests/RunCMake/math/MATH-WrongArgument.cmake new file mode 100644 index 0000000..fb6d2e7 --- /dev/null +++ b/Tests/RunCMake/math/MATH-WrongArgument.cmake @@ -0,0 +1 @@ +math(EXPR var "10*10" OUT HEX ) diff --git a/Tests/RunCMake/math/MATH.cmake b/Tests/RunCMake/math/MATH.cmake index 4ec7f9c..a5f50cd 100644 --- a/Tests/RunCMake/math/MATH.cmake +++ b/Tests/RunCMake/math/MATH.cmake @@ -7,3 +7,6 @@ endmacro() math_test("100 * 10" 1000) +math_test("100 * 10" 1000 OUTPUT_FORMAT DECIMAL) +math_test("100 * 0xA" 1000 OUTPUT_FORMAT DECIMAL) +math_test("100 * 0xA" 0x3e8 OUTPUT_FORMAT HEXADECIMAL) diff --git a/Tests/RunCMake/math/RunCMakeTest.cmake b/Tests/RunCMake/math/RunCMakeTest.cmake index 4c4b725..494b813 100644 --- a/Tests/RunCMake/math/RunCMakeTest.cmake +++ b/Tests/RunCMake/math/RunCMakeTest.cmake @@ -1,5 +1,8 @@ include(RunCMake) run_cmake(MATH) +run_cmake(MATH-WrongArgument) +run_cmake(MATH-DoubleOption) +run_cmake(MATH-TooManyArguments) run_cmake(MATH-InvalidExpression) run_cmake(MATH-DivideByZero) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8661e7052c4f711f13e7168231276e23c4c0defd commit 8661e7052c4f711f13e7168231276e23c4c0defd Author: Daniel Franke AuthorDate: Fri May 18 21:59:46 2018 +0200 Commit: Brad King CommitDate: Tue Jun 26 14:21:18 2018 -0400 math: Diagnose divide-by-zero diff --git a/Source/LexerParser/cmExprParser.cxx b/Source/LexerParser/cmExprParser.cxx index 1311390..cbb8078 100644 --- a/Source/LexerParser/cmExprParser.cxx +++ b/Source/LexerParser/cmExprParser.cxx @@ -89,6 +89,7 @@ Modify cmExprParser.cxx: #include #include +#include /*-------------------------------------------------------------------------*/ #define YYDEBUG 1 @@ -108,7 +109,7 @@ static void cmExpr_yyerror(yyscan_t yyscanner, const char* message); # pragma warning (disable: 4065) /* Switch statement contains default but no case. */ #endif -#line 112 "cmExprParser.cxx" /* yacc.c:339 */ +#line 113 "cmExprParser.cxx" /* yacc.c:339 */ # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus @@ -187,7 +188,7 @@ int cmExpr_yyparse (yyscan_t yyscanner); /* Copy the second part of user declarations. */ -#line 191 "cmExprParser.cxx" /* yacc.c:358 */ +#line 192 "cmExprParser.cxx" /* yacc.c:358 */ #ifdef short # undef short @@ -486,9 +487,9 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 74, 74, 79, 82, 87, 90, 95, 98, 103, - 106, 109, 114, 117, 120, 125, 128, 131, 134, 139, - 142, 145, 150, 153 + 0, 75, 75, 80, 83, 88, 91, 96, 99, 104, + 107, 110, 115, 118, 121, 126, 129, 132, 138, 143, + 146, 149, 154, 157 }; #endif @@ -1284,183 +1285,186 @@ yyreduce: switch (yyn) { case 2: -#line 74 "cmExprParser.y" /* yacc.c:1646 */ +#line 75 "cmExprParser.y" /* yacc.c:1646 */ { cmExpr_yyget_extra(yyscanner)->SetResult((yyvsp[0].Number)); } -#line 1292 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1293 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 3: -#line 79 "cmExprParser.y" /* yacc.c:1646 */ +#line 80 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1300 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1301 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 4: -#line 82 "cmExprParser.y" /* yacc.c:1646 */ +#line 83 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) | (yyvsp[0].Number); } -#line 1308 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1309 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 5: -#line 87 "cmExprParser.y" /* yacc.c:1646 */ +#line 88 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1316 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1317 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 6: -#line 90 "cmExprParser.y" /* yacc.c:1646 */ +#line 91 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) ^ (yyvsp[0].Number); } -#line 1324 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1325 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 7: -#line 95 "cmExprParser.y" /* yacc.c:1646 */ +#line 96 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1332 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1333 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 8: -#line 98 "cmExprParser.y" /* yacc.c:1646 */ +#line 99 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) & (yyvsp[0].Number); } -#line 1340 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1341 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 9: -#line 103 "cmExprParser.y" /* yacc.c:1646 */ +#line 104 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1348 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1349 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 10: -#line 106 "cmExprParser.y" /* yacc.c:1646 */ +#line 107 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) << (yyvsp[0].Number); } -#line 1356 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1357 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 11: -#line 109 "cmExprParser.y" /* yacc.c:1646 */ +#line 110 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) >> (yyvsp[0].Number); } -#line 1364 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1365 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 12: -#line 114 "cmExprParser.y" /* yacc.c:1646 */ +#line 115 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1372 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1373 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 13: -#line 117 "cmExprParser.y" /* yacc.c:1646 */ +#line 118 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) + (yyvsp[0].Number); } -#line 1380 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1381 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 14: -#line 120 "cmExprParser.y" /* yacc.c:1646 */ +#line 121 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) - (yyvsp[0].Number); } -#line 1388 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1389 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 15: -#line 125 "cmExprParser.y" /* yacc.c:1646 */ +#line 126 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1396 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1397 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 16: -#line 128 "cmExprParser.y" /* yacc.c:1646 */ +#line 129 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) * (yyvsp[0].Number); } -#line 1404 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1405 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 17: -#line 131 "cmExprParser.y" /* yacc.c:1646 */ +#line 132 "cmExprParser.y" /* yacc.c:1646 */ { + if (yyvsp[0].Number == 0) { + throw std::overflow_error("divide by zero"); + } (yyval.Number) = (yyvsp[-2].Number) / (yyvsp[0].Number); } -#line 1412 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1416 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 18: -#line 134 "cmExprParser.y" /* yacc.c:1646 */ +#line 138 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) % (yyvsp[0].Number); } -#line 1420 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1424 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 19: -#line 139 "cmExprParser.y" /* yacc.c:1646 */ +#line 143 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1428 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1432 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 20: -#line 142 "cmExprParser.y" /* yacc.c:1646 */ +#line 146 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = + (yyvsp[0].Number); } -#line 1436 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1440 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 21: -#line 145 "cmExprParser.y" /* yacc.c:1646 */ +#line 149 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = - (yyvsp[0].Number); } -#line 1444 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1448 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 22: -#line 150 "cmExprParser.y" /* yacc.c:1646 */ +#line 154 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1452 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1456 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 23: -#line 153 "cmExprParser.y" /* yacc.c:1646 */ +#line 157 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-1].Number); } -#line 1460 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1464 "cmExprParser.cxx" /* yacc.c:1646 */ break; -#line 1464 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1468 "cmExprParser.cxx" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1690,7 +1694,7 @@ yyreturn: #endif return yyresult; } -#line 158 "cmExprParser.y" /* yacc.c:1906 */ +#line 162 "cmExprParser.y" /* yacc.c:1906 */ /* End of grammar */ diff --git a/Source/LexerParser/cmExprParser.y b/Source/LexerParser/cmExprParser.y index 575ffa7..510daaa 100644 --- a/Source/LexerParser/cmExprParser.y +++ b/Source/LexerParser/cmExprParser.y @@ -18,6 +18,7 @@ Modify cmExprParser.cxx: #include #include +#include /*-------------------------------------------------------------------------*/ #define YYDEBUG 1 @@ -129,6 +130,9 @@ term: $$ = $1 * $3; } | term exp_DIVIDE unary { + if (yyvsp[0].Number == 0) { + throw std::overflow_error("divide by zero"); + } $$ = $1 / $3; } | term exp_MOD unary { diff --git a/Tests/RunCMake/math/MATH-DivideByZero-result.txt b/Tests/RunCMake/math/MATH-DivideByZero-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/math/MATH-DivideByZero-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/math/MATH-DivideByZero-stderr.txt b/Tests/RunCMake/math/MATH-DivideByZero-stderr.txt new file mode 100644 index 0000000..66ad633 --- /dev/null +++ b/Tests/RunCMake/math/MATH-DivideByZero-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at MATH-DivideByZero.cmake:1 \(math\): + math cannot evaluate the expression: "100/0": divide by zero. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/math/MATH-DivideByZero.cmake b/Tests/RunCMake/math/MATH-DivideByZero.cmake new file mode 100644 index 0000000..3ac161e --- /dev/null +++ b/Tests/RunCMake/math/MATH-DivideByZero.cmake @@ -0,0 +1 @@ +math(EXPR var "100/0") diff --git a/Tests/RunCMake/math/RunCMakeTest.cmake b/Tests/RunCMake/math/RunCMakeTest.cmake index d767547..4c4b725 100644 --- a/Tests/RunCMake/math/RunCMakeTest.cmake +++ b/Tests/RunCMake/math/RunCMakeTest.cmake @@ -2,3 +2,4 @@ include(RunCMake) run_cmake(MATH) run_cmake(MATH-InvalidExpression) +run_cmake(MATH-DivideByZero) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7c4c13ffef87d748b896e2c762ad0b2c00afcd31 commit 7c4c13ffef87d748b896e2c762ad0b2c00afcd31 Author: Daniel Franke AuthorDate: Fri May 18 21:59:46 2018 +0200 Commit: Brad King CommitDate: Tue Jun 26 14:15:21 2018 -0400 math: Reject unexpected expression input explicitly Switch to C++ exceptions for lexer/parser error handling. Teach the lexer/parser to fail on unexpected input. diff --git a/Source/LexerParser/cmExprLexer.cxx b/Source/LexerParser/cmExprLexer.cxx index 81a1ec5..93b3ffd 100644 --- a/Source/LexerParser/cmExprLexer.cxx +++ b/Source/LexerParser/cmExprLexer.cxx @@ -548,8 +548,8 @@ static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner ); yyg->yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 15 -#define YY_END_OF_BUFFER 16 +#define YY_NUM_RULES 17 +#define YY_END_OF_BUFFER 18 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -557,29 +557,29 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static const flex_int16_t yy_accept[23] = +static const flex_int16_t yy_accept[25] = { 0, - 0, 0, 16, 15, 6, 8, 13, 14, 4, 2, - 3, 5, 1, 15, 15, 9, 7, 10, 1, 11, - 12, 0 + 0, 0, 18, 16, 1, 17, 7, 9, 14, 15, + 5, 3, 4, 6, 2, 16, 16, 10, 8, 11, + 2, 12, 13, 0 } ; static const YY_CHAR yy_ec[256] = { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 1, 1, 1, 4, 5, 1, 6, + 7, 8, 9, 1, 10, 1, 11, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 1, 1, 13, + 1, 14, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 2, 3, 1, 4, - 5, 6, 7, 1, 8, 1, 9, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 1, 1, 11, - 1, 12, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 13, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 15, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 14, 1, 15, 1, 1, 1, 1, + 1, 1, 1, 16, 1, 17, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -596,40 +596,40 @@ static const YY_CHAR yy_ec[256] = 1, 1, 1, 1, 1 } ; -static const YY_CHAR yy_meta[16] = +static const YY_CHAR yy_meta[18] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 + 1, 1, 1, 1, 1, 1, 1 } ; -static const flex_int16_t yy_base[23] = +static const flex_int16_t yy_base[25] = { 0, - 0, 0, 20, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 9, 7, 5, 21, 21, 21, 6, 21, - 21, 21 + 0, 0, 22, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 9, 7, 5, 23, 23, 23, + 6, 23, 23, 23 } ; -static const flex_int16_t yy_def[23] = +static const flex_int16_t yy_def[25] = { 0, - 22, 1, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 0 + 24, 1, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 0 } ; -static const flex_int16_t yy_nxt[37] = +static const flex_int16_t yy_nxt[41] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 21, 20, 19, 22, - 3, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22 + 14, 15, 16, 17, 18, 19, 20, 21, 23, 22, + 21, 24, 3, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24 } ; -static const flex_int16_t yy_chk[37] = +static const flex_int16_t yy_chk[41] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 19, 15, 14, 13, 3, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22 + 1, 1, 1, 1, 1, 1, 1, 21, 17, 16, + 15, 3, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24 } ; /* The intent behind this definition is that it'll catch @@ -668,6 +668,8 @@ Modify cmExprLexer.cxx: /* Include the set of tokens from the parser. */ #include "cmExprParserTokens.h" +#include + /*--------------------------------------------------------------------------*/ #define INITIAL 0 @@ -946,13 +948,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 23 ) + if ( yy_current_state >= 25 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 21 ); + while ( yy_base[yy_current_state] != 23 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -978,62 +980,70 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -{ yylvalp->Number = atoi(yytext); return exp_NUMBER; } +{} YY_BREAK case 2: YY_RULE_SETUP -{ return exp_PLUS; } +{ yylvalp->Number = std::stoll(yytext, nullptr, 10); return exp_NUMBER; } YY_BREAK case 3: YY_RULE_SETUP -{ return exp_MINUS; } +{ return exp_PLUS; } YY_BREAK case 4: YY_RULE_SETUP -{ return exp_TIMES; } +{ return exp_MINUS; } YY_BREAK case 5: YY_RULE_SETUP -{ return exp_DIVIDE; } +{ return exp_TIMES; } YY_BREAK case 6: YY_RULE_SETUP -{ return exp_MOD; } +{ return exp_DIVIDE; } YY_BREAK case 7: YY_RULE_SETUP -{ return exp_OR; } +{ return exp_MOD; } YY_BREAK case 8: YY_RULE_SETUP -{ return exp_AND; } +{ return exp_OR; } YY_BREAK case 9: YY_RULE_SETUP -{ return exp_XOR; } +{ return exp_AND; } YY_BREAK case 10: YY_RULE_SETUP -{ return exp_NOT; } +{ return exp_XOR; } YY_BREAK case 11: YY_RULE_SETUP -{ return exp_SHIFTLEFT; } +{ return exp_NOT; } YY_BREAK case 12: YY_RULE_SETUP -{ return exp_SHIFTRIGHT; } +{ return exp_SHIFTLEFT; } YY_BREAK case 13: YY_RULE_SETUP -{ return exp_OPENPARENT; } +{ return exp_SHIFTRIGHT; } YY_BREAK case 14: YY_RULE_SETUP -{ return exp_CLOSEPARENT; } +{ return exp_OPENPARENT; } YY_BREAK case 15: YY_RULE_SETUP +{ return exp_CLOSEPARENT; } + YY_BREAK +case 16: +YY_RULE_SETUP +{return exp_UNEXPECTED;} + YY_BREAK +case 17: +YY_RULE_SETUP ECHO; YY_BREAK case YY_STATE_EOF(INITIAL): @@ -1334,7 +1344,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 23 ) + if ( yy_current_state >= 25 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; @@ -1363,11 +1373,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 23 ) + if ( yy_current_state >= 25 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 22); + yy_is_jam = (yy_current_state == 24); (void)yyg; return yy_is_jam ? 0 : yy_current_state; diff --git a/Source/LexerParser/cmExprLexer.in.l b/Source/LexerParser/cmExprLexer.in.l index e5f177a..0c4eb9e 100644 --- a/Source/LexerParser/cmExprLexer.in.l +++ b/Source/LexerParser/cmExprLexer.in.l @@ -28,6 +28,8 @@ Modify cmExprLexer.cxx: /* Include the set of tokens from the parser. */ #include "cmExprParserTokens.h" +#include + /*--------------------------------------------------------------------------*/ %} @@ -38,8 +40,9 @@ Modify cmExprLexer.cxx: %pointer %% +[ \t] {} -[0-9][0-9]* { yylvalp->Number = atoi(yytext); return exp_NUMBER; } +[0-9][0-9]* { yylvalp->Number = std::stoll(yytext, nullptr, 10); return exp_NUMBER; } "+" { return exp_PLUS; } "-" { return exp_MINUS; } @@ -54,5 +57,6 @@ Modify cmExprLexer.cxx: ">>" { return exp_SHIFTRIGHT; } "(" { return exp_OPENPARENT; } ")" { return exp_CLOSEPARENT; } +. {return exp_UNEXPECTED;} %% diff --git a/Source/LexerParser/cmExprParser.cxx b/Source/LexerParser/cmExprParser.cxx index 67664a5..1311390 100644 --- a/Source/LexerParser/cmExprParser.cxx +++ b/Source/LexerParser/cmExprParser.cxx @@ -156,7 +156,8 @@ extern int cmExpr_yydebug; exp_AND = 268, exp_XOR = 269, exp_NOT = 270, - exp_NUMBER = 271 + exp_NUMBER = 271, + exp_UNEXPECTED = 272 }; #endif /* Tokens. */ @@ -174,6 +175,7 @@ extern int cmExpr_yydebug; #define exp_XOR 269 #define exp_NOT 270 #define exp_NUMBER 271 +#define exp_UNEXPECTED 272 /* Value type. */ @@ -185,7 +187,7 @@ int cmExpr_yyparse (yyscan_t yyscanner); /* Copy the second part of user declarations. */ -#line 189 "cmExprParser.cxx" /* yacc.c:358 */ +#line 191 "cmExprParser.cxx" /* yacc.c:358 */ #ifdef short # undef short @@ -430,7 +432,7 @@ union yyalloc #define YYLAST 30 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 17 +#define YYNTOKENS 18 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 10 /* YYNRULES -- Number of rules. */ @@ -441,7 +443,7 @@ union yyalloc /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 271 +#define YYMAXUTOK 272 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -477,16 +479,16 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16 + 15, 16, 17 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 73, 73, 78, 81, 86, 89, 94, 97, 102, - 105, 108, 113, 116, 119, 124, 127, 130, 133, 138, - 141, 144, 149, 152 + 0, 74, 74, 79, 82, 87, 90, 95, 98, 103, + 106, 109, 114, 117, 120, 125, 128, 131, 134, 139, + 142, 145, 150, 153 }; #endif @@ -498,8 +500,9 @@ static const char *const yytname[] = "$end", "error", "$undefined", "exp_PLUS", "exp_MINUS", "exp_TIMES", "exp_DIVIDE", "exp_MOD", "exp_SHIFTLEFT", "exp_SHIFTRIGHT", "exp_OPENPARENT", "exp_CLOSEPARENT", "exp_OR", "exp_AND", "exp_XOR", - "exp_NOT", "exp_NUMBER", "$accept", "start", "exp", "bitwiseor", - "bitwisexor", "bitwiseand", "shift", "term", "unary", "factor", YY_NULLPTR + "exp_NOT", "exp_NUMBER", "\"character\"", "$accept", "start", "exp", + "bitwiseor", "bitwisexor", "bitwiseand", "shift", "term", "unary", + "factor", YY_NULLPTR }; #endif @@ -509,7 +512,7 @@ static const char *const yytname[] = static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271 + 265, 266, 267, 268, 269, 270, 271, 272 }; # endif @@ -579,18 +582,18 @@ static const yytype_int8 yycheck[] = symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 3, 4, 10, 16, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 25, 25, 19, 0, 12, 14, - 13, 8, 9, 3, 4, 5, 6, 7, 11, 20, - 21, 22, 23, 23, 24, 24, 25, 25, 25 + 0, 3, 4, 10, 16, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 26, 26, 20, 0, 12, 14, + 13, 8, 9, 3, 4, 5, 6, 7, 11, 21, + 22, 23, 24, 24, 25, 25, 26, 26, 26 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 17, 18, 19, 19, 20, 20, 21, 21, 22, - 22, 22, 23, 23, 23, 24, 24, 24, 24, 25, - 25, 25, 26, 26 + 0, 18, 19, 20, 20, 21, 21, 22, 22, 23, + 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, + 26, 26, 27, 27 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ @@ -1281,183 +1284,183 @@ yyreduce: switch (yyn) { case 2: -#line 73 "cmExprParser.y" /* yacc.c:1646 */ +#line 74 "cmExprParser.y" /* yacc.c:1646 */ { cmExpr_yyget_extra(yyscanner)->SetResult((yyvsp[0].Number)); } -#line 1289 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1292 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 3: -#line 78 "cmExprParser.y" /* yacc.c:1646 */ +#line 79 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1297 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1300 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 4: -#line 81 "cmExprParser.y" /* yacc.c:1646 */ +#line 82 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) | (yyvsp[0].Number); } -#line 1305 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1308 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 5: -#line 86 "cmExprParser.y" /* yacc.c:1646 */ +#line 87 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1313 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1316 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 6: -#line 89 "cmExprParser.y" /* yacc.c:1646 */ +#line 90 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) ^ (yyvsp[0].Number); } -#line 1321 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1324 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 7: -#line 94 "cmExprParser.y" /* yacc.c:1646 */ +#line 95 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1329 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1332 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 8: -#line 97 "cmExprParser.y" /* yacc.c:1646 */ +#line 98 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) & (yyvsp[0].Number); } -#line 1337 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1340 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 9: -#line 102 "cmExprParser.y" /* yacc.c:1646 */ +#line 103 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1345 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1348 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 10: -#line 105 "cmExprParser.y" /* yacc.c:1646 */ +#line 106 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) << (yyvsp[0].Number); } -#line 1353 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1356 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 11: -#line 108 "cmExprParser.y" /* yacc.c:1646 */ +#line 109 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) >> (yyvsp[0].Number); } -#line 1361 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1364 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 12: -#line 113 "cmExprParser.y" /* yacc.c:1646 */ +#line 114 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1369 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1372 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 13: -#line 116 "cmExprParser.y" /* yacc.c:1646 */ +#line 117 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) + (yyvsp[0].Number); } -#line 1377 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1380 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 14: -#line 119 "cmExprParser.y" /* yacc.c:1646 */ +#line 120 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) - (yyvsp[0].Number); } -#line 1385 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1388 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 15: -#line 124 "cmExprParser.y" /* yacc.c:1646 */ +#line 125 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1393 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1396 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 16: -#line 127 "cmExprParser.y" /* yacc.c:1646 */ +#line 128 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) * (yyvsp[0].Number); } -#line 1401 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1404 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 17: -#line 130 "cmExprParser.y" /* yacc.c:1646 */ +#line 131 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) / (yyvsp[0].Number); } -#line 1409 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1412 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 18: -#line 133 "cmExprParser.y" /* yacc.c:1646 */ +#line 134 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) % (yyvsp[0].Number); } -#line 1417 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1420 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 19: -#line 138 "cmExprParser.y" /* yacc.c:1646 */ +#line 139 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1425 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1428 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 20: -#line 141 "cmExprParser.y" /* yacc.c:1646 */ +#line 142 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = + (yyvsp[0].Number); } -#line 1433 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1436 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 21: -#line 144 "cmExprParser.y" /* yacc.c:1646 */ +#line 145 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = - (yyvsp[0].Number); } -#line 1441 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1444 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 22: -#line 149 "cmExprParser.y" /* yacc.c:1646 */ +#line 150 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1449 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1452 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 23: -#line 152 "cmExprParser.y" /* yacc.c:1646 */ +#line 153 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-1].Number); } -#line 1457 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1460 "cmExprParser.cxx" /* yacc.c:1646 */ break; -#line 1461 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1464 "cmExprParser.cxx" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1687,7 +1690,7 @@ yyreturn: #endif return yyresult; } -#line 157 "cmExprParser.y" /* yacc.c:1906 */ +#line 158 "cmExprParser.y" /* yacc.c:1906 */ /* End of grammar */ diff --git a/Source/LexerParser/cmExprParser.y b/Source/LexerParser/cmExprParser.y index d1c3a97..575ffa7 100644 --- a/Source/LexerParser/cmExprParser.y +++ b/Source/LexerParser/cmExprParser.y @@ -63,6 +63,7 @@ static void cmExpr_yyerror(yyscan_t yyscanner, const char* message); %token exp_XOR; %token exp_NOT; %token exp_NUMBER; +%token exp_UNEXPECTED "character"; /*-------------------------------------------------------------------------*/ /* grammar */ diff --git a/Source/LexerParser/cmExprParserTokens.h b/Source/LexerParser/cmExprParserTokens.h index 84b2bbd..00be4e9 100644 --- a/Source/LexerParser/cmExprParserTokens.h +++ b/Source/LexerParser/cmExprParserTokens.h @@ -58,7 +58,8 @@ extern int cmExpr_yydebug; exp_AND = 268, exp_XOR = 269, exp_NOT = 270, - exp_NUMBER = 271 + exp_NUMBER = 271, + exp_UNEXPECTED = 272 }; #endif /* Tokens. */ @@ -76,6 +77,7 @@ extern int cmExpr_yydebug; #define exp_XOR 269 #define exp_NOT 270 #define exp_NUMBER 271 +#define exp_UNEXPECTED 272 /* Value type. */ diff --git a/Source/cmExprParserHelper.cxx b/Source/cmExprParserHelper.cxx index c68ebc0..d90d8b9 100644 --- a/Source/cmExprParserHelper.cxx +++ b/Source/cmExprParserHelper.cxx @@ -6,6 +6,8 @@ #include #include +#include +#include int cmExpr_yyparse(yyscan_t yyscanner); // @@ -38,7 +40,33 @@ int cmExprParserHelper::ParseString(const char* str, int verb) yyscan_t yyscanner; cmExpr_yylex_init(&yyscanner); cmExpr_yyset_extra(this, yyscanner); - int res = cmExpr_yyparse(yyscanner); + int res; + + try { + res = cmExpr_yyparse(yyscanner); + if (res != 0) { + std::string e = "cannot parse the expression: \"" + InputBuffer + "\": "; + e += ErrorString; + e += "."; + this->SetError(std::move(e)); + } + } catch (std::runtime_error const& fail) { + std::string e = + "cannot evaluate the expression: \"" + InputBuffer + "\": "; + e += fail.what(); + e += "."; + this->SetError(std::move(e)); + res = 1; + } catch (std::out_of_range const&) { + std::string e = "cannot evaluate the expression: \"" + InputBuffer + + "\": a numeric value is out of range."; + this->SetError(std::move(e)); + res = 1; + } catch (...) { + std::string e = "cannot parse the expression: \"" + InputBuffer + "\"."; + this->SetError(std::move(e)); + res = 1; + } cmExpr_yylex_destroy(yyscanner); if (res != 0) { // str << "CAL_Parser returned: " << res << std::endl; @@ -90,3 +118,8 @@ void cmExprParserHelper::SetResult(KWIML_INT_int64_t value) { this->Result = value; } + +void cmExprParserHelper::SetError(std::string errorString) +{ + this->ErrorString = std::move(errorString); +} diff --git a/Source/cmExprParserHelper.h b/Source/cmExprParserHelper.h index c3cb53b..d4d95b4 100644 --- a/Source/cmExprParserHelper.h +++ b/Source/cmExprParserHelper.h @@ -42,6 +42,7 @@ private: void Print(const char* place, const char* str); void CleanupParser(); + void SetError(std::string errorString); KWIML_INT_int64_t Result; const char* FileName; diff --git a/Source/cmMathCommand.cxx b/Source/cmMathCommand.cxx index f0945b2..ab77dc3 100644 --- a/Source/cmMathCommand.cxx +++ b/Source/cmMathCommand.cxx @@ -36,11 +36,11 @@ bool cmMathCommand::HandleExprCommand(std::vector const& args) const std::string& outputVariable = args[1]; const std::string& expression = args[2]; + this->Makefile->AddDefinition(outputVariable, "ERROR"); + cmExprParserHelper helper; if (!helper.ParseString(expression.c_str(), 0)) { - std::string e = "cannot parse the expression: \"" + expression + "\": "; - e += helper.GetError(); - this->SetError(e); + this->SetError(helper.GetError()); return false; } diff --git a/Tests/RunCMake/math/MATH-InvalidExpression-result.txt b/Tests/RunCMake/math/MATH-InvalidExpression-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/math/MATH-InvalidExpression-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt b/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt new file mode 100644 index 0000000..18ac9f7 --- /dev/null +++ b/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at MATH-InvalidExpression.cmake:1 \(math\): + *math cannot parse the expression: "INVALID": syntax error, unexpected + *character, expecting exp_PLUS or exp_MINUS or exp_OPENPARENT or exp_NUMBER + *\(1\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/math/MATH-InvalidExpression.cmake b/Tests/RunCMake/math/MATH-InvalidExpression.cmake new file mode 100644 index 0000000..6e37128 --- /dev/null +++ b/Tests/RunCMake/math/MATH-InvalidExpression.cmake @@ -0,0 +1 @@ +math(EXPR var "INVALID") diff --git a/Tests/RunCMake/math/RunCMakeTest.cmake b/Tests/RunCMake/math/RunCMakeTest.cmake index 7098f67..d767547 100644 --- a/Tests/RunCMake/math/RunCMakeTest.cmake +++ b/Tests/RunCMake/math/RunCMakeTest.cmake @@ -1,3 +1,4 @@ include(RunCMake) run_cmake(MATH) +run_cmake(MATH-InvalidExpression) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5b0f73a15a7b49461123a969bbebceff4284df9c commit 5b0f73a15a7b49461123a969bbebceff4284df9c Author: Daniel Franke AuthorDate: Fri May 18 21:59:46 2018 +0200 Commit: Brad King CommitDate: Fri Jun 22 09:00:34 2018 -0400 math: Use 64-bit integer type for computation diff --git a/Source/cmExprParserHelper.cxx b/Source/cmExprParserHelper.cxx index fe7159a..c68ebc0 100644 --- a/Source/cmExprParserHelper.cxx +++ b/Source/cmExprParserHelper.cxx @@ -13,6 +13,7 @@ cmExprParserHelper::cmExprParserHelper() { this->FileLine = -1; this->FileName = nullptr; + this->Result = 0; } cmExprParserHelper::~cmExprParserHelper() @@ -85,7 +86,7 @@ void cmExprParserHelper::Error(const char* str) this->ErrorString = ostr.str(); } -void cmExprParserHelper::SetResult(int value) +void cmExprParserHelper::SetResult(KWIML_INT_int64_t value) { this->Result = value; } diff --git a/Source/cmExprParserHelper.h b/Source/cmExprParserHelper.h index dcdaca9..c3cb53b 100644 --- a/Source/cmExprParserHelper.h +++ b/Source/cmExprParserHelper.h @@ -5,6 +5,8 @@ #include "cmConfigure.h" // IWYU pragma: keep +#include "cm_kwiml.h" + #include #include @@ -13,7 +15,7 @@ class cmExprParserHelper public: struct ParserType { - int Number; + KWIML_INT_int64_t Number; }; cmExprParserHelper(); @@ -24,9 +26,9 @@ public: int LexInput(char* buf, int maxlen); void Error(const char* str); - void SetResult(int value); + void SetResult(KWIML_INT_int64_t value); - int GetResult() { return this->Result; } + KWIML_INT_int64_t GetResult() { return this->Result; } const char* GetError() { return this->ErrorString.c_str(); } @@ -41,7 +43,7 @@ private: void CleanupParser(); - int Result; + KWIML_INT_int64_t Result; const char* FileName; long FileLine; std::string ErrorString; diff --git a/Source/cmMathCommand.cxx b/Source/cmMathCommand.cxx index c1cd1b6..f0945b2 100644 --- a/Source/cmMathCommand.cxx +++ b/Source/cmMathCommand.cxx @@ -2,10 +2,11 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmMathCommand.h" -#include - #include "cmExprParserHelper.h" #include "cmMakefile.h" +#include "cm_kwiml.h" + +#include class cmExecutionStatus; @@ -44,7 +45,7 @@ bool cmMathCommand::HandleExprCommand(std::vector const& args) } char buffer[1024]; - sprintf(buffer, "%d", helper.GetResult()); + sprintf(buffer, "%" KWIML_INT_PRId64, helper.GetResult()); this->Makefile->AddDefinition(outputVariable, buffer); return true; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=963b8d9f6c1c4bcce2a82ade137a82b17ef75780 commit 963b8d9f6c1c4bcce2a82ade137a82b17ef75780 Author: Daniel Franke AuthorDate: Fri May 18 21:59:46 2018 +0200 Commit: Brad King CommitDate: Fri Jun 22 09:00:34 2018 -0400 math: Add RunCMake.math test to prepare for error cases diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index daf3940..bd7626a 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -238,6 +238,7 @@ add_RunCMake_test(include) add_RunCMake_test(include_directories) add_RunCMake_test(include_guard) add_RunCMake_test(list) +add_RunCMake_test(math) add_RunCMake_test(message) add_RunCMake_test(project -DCMake_TEST_RESOURCES=${CMake_TEST_RESOURCES}) add_RunCMake_test(return) diff --git a/Tests/RunCMake/math/CMakeLists.txt b/Tests/RunCMake/math/CMakeLists.txt new file mode 100644 index 0000000..12cd3c7 --- /dev/null +++ b/Tests/RunCMake/math/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/math/MATH.cmake b/Tests/RunCMake/math/MATH.cmake new file mode 100644 index 0000000..4ec7f9c --- /dev/null +++ b/Tests/RunCMake/math/MATH.cmake @@ -0,0 +1,9 @@ +macro(math_test expression expected) + math(EXPR evaluated ${expression} ${ARGN}) + if (NOT evaluated STREQUAL ${expected}) + message(FATAL_ERROR "wrong math result: ${evaluated} != ${expected}") + endif () +endmacro() + + +math_test("100 * 10" 1000) diff --git a/Tests/RunCMake/math/RunCMakeTest.cmake b/Tests/RunCMake/math/RunCMakeTest.cmake new file mode 100644 index 0000000..7098f67 --- /dev/null +++ b/Tests/RunCMake/math/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(MATH) ----------------------------------------------------------------------- Summary of changes: Help/command/math.rst | 18 ++- Help/release/dev/math-hex.rst | 4 + Source/LexerParser/cmExprLexer.cxx | 126 +++++++++++-------- Source/LexerParser/cmExprLexer.in.l | 7 +- Source/LexerParser/cmExprParser.cxx | 137 +++++++++++---------- Source/LexerParser/cmExprParser.y | 5 + Source/LexerParser/cmExprParserTokens.h | 4 +- Source/cmExprParserHelper.cxx | 38 +++++- Source/cmExprParserHelper.h | 11 +- Source/cmMathCommand.cxx | 69 +++++++++-- Tests/MathTest/CMakeLists.txt | 33 ++++- Tests/MathTest/MathTestExec.cxx | 40 ++++-- Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/{while => math}/CMakeLists.txt | 0 .../MATH-DivideByZero-result.txt} | 0 Tests/RunCMake/math/MATH-DivideByZero-stderr.txt | 4 + Tests/RunCMake/math/MATH-DivideByZero.cmake | 1 + .../MATH-DoubleOption-result.txt} | 0 Tests/RunCMake/math/MATH-DoubleOption-stderr.txt | 4 + Tests/RunCMake/math/MATH-DoubleOption.cmake | 1 + .../MATH-InvalidExpression-result.txt} | 0 .../math/MATH-InvalidExpression-stderr.txt | 6 + Tests/RunCMake/math/MATH-InvalidExpression.cmake | 1 + .../MATH-TooManyArguments-result.txt} | 0 .../RunCMake/math/MATH-TooManyArguments-stderr.txt | 4 + Tests/RunCMake/math/MATH-TooManyArguments.cmake | 1 + .../MATH-WrongArgument-result.txt} | 0 Tests/RunCMake/math/MATH-WrongArgument-stderr.txt | 4 + Tests/RunCMake/math/MATH-WrongArgument.cmake | 1 + Tests/RunCMake/math/MATH.cmake | 12 ++ Tests/RunCMake/math/RunCMakeTest.cmake | 8 ++ 31 files changed, 391 insertions(+), 149 deletions(-) create mode 100644 Help/release/dev/math-hex.rst copy Tests/RunCMake/{while => math}/CMakeLists.txt (100%) copy Tests/RunCMake/{while/MissingArgument-result.txt => math/MATH-DivideByZero-result.txt} (100%) create mode 100644 Tests/RunCMake/math/MATH-DivideByZero-stderr.txt create mode 100644 Tests/RunCMake/math/MATH-DivideByZero.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => math/MATH-DoubleOption-result.txt} (100%) create mode 100644 Tests/RunCMake/math/MATH-DoubleOption-stderr.txt create mode 100644 Tests/RunCMake/math/MATH-DoubleOption.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => math/MATH-InvalidExpression-result.txt} (100%) create mode 100644 Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt create mode 100644 Tests/RunCMake/math/MATH-InvalidExpression.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => math/MATH-TooManyArguments-result.txt} (100%) create mode 100644 Tests/RunCMake/math/MATH-TooManyArguments-stderr.txt create mode 100644 Tests/RunCMake/math/MATH-TooManyArguments.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => math/MATH-WrongArgument-result.txt} (100%) create mode 100644 Tests/RunCMake/math/MATH-WrongArgument-stderr.txt create mode 100644 Tests/RunCMake/math/MATH-WrongArgument.cmake create mode 100644 Tests/RunCMake/math/MATH.cmake create mode 100644 Tests/RunCMake/math/RunCMakeTest.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jul 5 11:35:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 5 Jul 2018 11:35:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc2-144-g326ebdf Message-ID: <20180705153505.47126113A2B@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 326ebdf12a59e7a115d7326299eb6be54316f34e (commit) via 0d7114987c78085df6449e93bdda8a1749862025 (commit) from ca733cdf4532a4a3d05b82c49a5f2fbf994149de (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=326ebdf12a59e7a115d7326299eb6be54316f34e commit 326ebdf12a59e7a115d7326299eb6be54316f34e Merge: ca733cd 0d71149 Author: Brad King AuthorDate: Thu Jul 5 15:31:11 2018 +0000 Commit: Kitware Robot CommitDate: Thu Jul 5 11:31:17 2018 -0400 Merge topic 'revert-subdirectory-linking' 0d7114987c Revert "target_link_libraries: Allow use with targets in other directories" Acked-by: Kitware Robot Merge-request: !2191 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0d7114987c78085df6449e93bdda8a1749862025 commit 0d7114987c78085df6449e93bdda8a1749862025 Author: Brad King AuthorDate: Tue Jul 3 09:37:29 2018 -0400 Commit: Brad King CommitDate: Tue Jul 3 09:39:28 2018 -0400 Revert "target_link_libraries: Allow use with targets in other directories" Revert commit v3.12.0-rc1~82^2 (target_link_libraries: Allow use with targets in other directories, 2018-05-11). The RHS target scoping and visibility rules are not clear and will need further investigation before the feature can be added. Issue: #17943 diff --git a/Help/command/target_link_libraries.rst b/Help/command/target_link_libraries.rst index 6379730..fcc2c07 100644 --- a/Help/command/target_link_libraries.rst +++ b/Help/command/target_link_libraries.rst @@ -18,7 +18,7 @@ All of them have the general form:: target_link_libraries( ... ... ...) -The named ```` must have been created by +The named ```` must have been created in the current directory by a command such as :command:`add_executable` or :command:`add_library` and must not be an :ref:`ALIAS target `. Repeated calls for the same ```` append items in the order called. diff --git a/Help/release/3.12.rst b/Help/release/3.12.rst index 4d1135e..84ef695 100644 --- a/Help/release/3.12.rst +++ b/Help/release/3.12.rst @@ -81,9 +81,6 @@ Commands :ref:`Object Libraries`. Linking to an object library uses its object files in direct dependents and also propagates usage requirements. -* The :command:`target_link_libraries` command may now be called - to modify targets created outside the current directory. - Variables --------- diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 73f9a2e..1bbcf46 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -365,7 +365,7 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, if (this->CurrentProcessingState != ProcessingKeywordLinkInterface && this->CurrentProcessingState != ProcessingPlainLinkInterface) { - // Find target on the LHS locally + // Assure that the target on the LHS was created in the current directory. cmTarget* t = this->Makefile->FindLocalNonAliasTarget(this->Target->GetName()); if (!t) { @@ -378,18 +378,11 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, } } } - - // If no local target has been found, find it in the global scope - if (!t) { - t = this->Makefile->GetGlobalGenerator()->FindTarget( - this->Target->GetName(), true); - } - if (!t) { std::ostringstream e; e << "Attempt to add link library \"" << lib << "\" to target \"" << this->Target->GetName() - << "\" which does not exist or is an alias target."; + << "\" which is not built in this directory."; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return false; } diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake index d61fa5f..97b0888 100644 --- a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake @@ -8,10 +8,7 @@ run_cmake(ImportedTarget) run_cmake(ImportedTargetFailure) run_cmake(MixedSignature) run_cmake(Separate-PRIVATE-LINK_PRIVATE-uses) -run_cmake(SubDirImportedTarget) run_cmake(SubDirTarget) -run_cmake(SubDirTarget-UNKNOWN-IMPORTED) -run_cmake(SubDirTarget-UNKNOWN-IMPORTED-GLOBAL) run_cmake(SharedDepNotTarget) run_cmake(StaticPrivateDepNotExported) run_cmake(StaticPrivateDepNotTarget) diff --git a/Tests/RunCMake/target_link_libraries/SubDirImportedTarget-stdout.txt b/Tests/RunCMake/target_link_libraries/SubDirImportedTarget-stdout.txt deleted file mode 100644 index a7ef260..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirImportedTarget-stdout.txt +++ /dev/null @@ -1,4 +0,0 @@ --- mainexeUnknownImportedGlobal: mainlib;sublib --- mainlibUnknownImportedGlobal: mainlib;sublib --- subexeUnknownImportedGlobal: mainlib;sublib --- sublibUnknownImportedGlobal: mainlib;sublib diff --git a/Tests/RunCMake/target_link_libraries/SubDirImportedTarget.cmake b/Tests/RunCMake/target_link_libraries/SubDirImportedTarget.cmake deleted file mode 100644 index 738280b..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirImportedTarget.cmake +++ /dev/null @@ -1,17 +0,0 @@ -enable_language(C) - -add_executable(mainexeUnknownImportedGlobal IMPORTED GLOBAL) -add_library(mainlibUnknownImportedGlobal UNKNOWN IMPORTED GLOBAL) -add_library(mainlib empty.c) - -add_subdirectory(SubDirImportedTarget) - -target_link_libraries(subexeUnknownImportedGlobal INTERFACE mainlib) -target_link_libraries(subexeUnknownImportedGlobal INTERFACE sublib) -get_property(subexeUnknownImportedGlobal_libs TARGET subexeUnknownImportedGlobal PROPERTY INTERFACE_LINK_LIBRARIES) -message(STATUS "subexeUnknownImportedGlobal: ${subexeUnknownImportedGlobal_libs}") - -target_link_libraries(sublibUnknownImportedGlobal INTERFACE mainlib) -target_link_libraries(sublibUnknownImportedGlobal INTERFACE sublib) -get_property(sublibUnknownImportedGlobal_libs TARGET sublibUnknownImportedGlobal PROPERTY INTERFACE_LINK_LIBRARIES) -message(STATUS "sublibUnknownImportedGlobal: ${sublibUnknownImportedGlobal_libs}") diff --git a/Tests/RunCMake/target_link_libraries/SubDirImportedTarget/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/SubDirImportedTarget/CMakeLists.txt deleted file mode 100644 index d67a01c..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirImportedTarget/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -add_executable(subexeUnknownImportedGlobal IMPORTED GLOBAL) -add_library(sublibUnknownImportedGlobal UNKNOWN IMPORTED GLOBAL) -add_library(sublib ../empty.c) - -target_link_libraries(mainexeUnknownImportedGlobal INTERFACE mainlib) -target_link_libraries(mainexeUnknownImportedGlobal INTERFACE sublib) -get_property(mainexeUnknownImportedGlobal_libs TARGET mainexeUnknownImportedGlobal PROPERTY INTERFACE_LINK_LIBRARIES) -message(STATUS "mainexeUnknownImportedGlobal: ${mainexeUnknownImportedGlobal_libs}") - -target_link_libraries(mainlibUnknownImportedGlobal INTERFACE mainlib) -target_link_libraries(mainlibUnknownImportedGlobal INTERFACE sublib) -get_property(mainlibUnknownImportedGlobal_libs TARGET mainlibUnknownImportedGlobal PROPERTY INTERFACE_LINK_LIBRARIES) -message(STATUS "mainlibUnknownImportedGlobal: ${mainlibUnknownImportedGlobal_libs}") diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL-stdout.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL-stdout.txt deleted file mode 100644 index a8c77cb..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL-stdout.txt +++ /dev/null @@ -1,2 +0,0 @@ --- mainexe: mainlibUnknownImportedGlobal;sublibUnknownImportedGlobal --- subexe: mainlibUnknownImportedGlobal;sublibUnknownImportedGlobal diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL.cmake b/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL.cmake deleted file mode 100644 index 04d64e6..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL.cmake +++ /dev/null @@ -1,11 +0,0 @@ -enable_language(C) - -add_executable(mainexe empty.c) -add_library(mainlibUnknownImportedGlobal UNKNOWN IMPORTED GLOBAL) - -add_subdirectory(SubDirTarget-UNKNOWN-IMPORTED-GLOBAL) - -target_link_libraries(subexe mainlibUnknownImportedGlobal) -target_link_libraries(subexe sublibUnknownImportedGlobal) -get_property(subexe_libs TARGET subexe PROPERTY INTERFACE_LINK_LIBRARIES) -message(STATUS "subexe: ${subexe_libs}") diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL/CMakeLists.txt deleted file mode 100644 index 6c0c8b2..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -add_executable(subexe ../empty.c) -add_library(sublibUnknownImportedGlobal UNKNOWN IMPORTED GLOBAL) - -target_link_libraries(mainexe mainlibUnknownImportedGlobal) -target_link_libraries(mainexe sublibUnknownImportedGlobal) -get_property(mainexe_libs TARGET mainexe PROPERTY INTERFACE_LINK_LIBRARIES) -message(STATUS "mainexe: ${mainexe_libs}") diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-stdout.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-stdout.txt deleted file mode 100644 index 4980dc9..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-stdout.txt +++ /dev/null @@ -1,2 +0,0 @@ --- mainexe: mainlibUnknownImported;sublibUnknownImported --- subexe: mainlibUnknownImported;sublibUnknownImported diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED.cmake b/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED.cmake deleted file mode 100644 index e476a3f..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED.cmake +++ /dev/null @@ -1,11 +0,0 @@ -enable_language(C) - -add_executable(mainexe empty.c) -add_library(mainlibUnknownImported UNKNOWN IMPORTED) - -add_subdirectory(SubDirTarget-UNKNOWN-IMPORTED) - -target_link_libraries(subexe mainlibUnknownImported) -target_link_libraries(subexe sublibUnknownImported) -get_property(subexe_libs TARGET subexe PROPERTY INTERFACE_LINK_LIBRARIES) -message(STATUS "subexe: ${subexe_libs}") diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED/CMakeLists.txt deleted file mode 100644 index 4a40a68..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -add_executable(subexe ../empty.c) -add_library(sublibUnknownImported UNKNOWN IMPORTED) - -target_link_libraries(mainexe mainlibUnknownImported) -target_link_libraries(mainexe sublibUnknownImported) -get_property(mainexe_libs TARGET mainexe PROPERTY INTERFACE_LINK_LIBRARIES) -message(STATUS "mainexe: ${mainexe_libs}") diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt new file mode 100644 index 0000000..5cd1f23 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at SubDirTarget.cmake:[0-9]+ \(target_link_libraries\): + Attempt to add link library "m" to target "subexe" which is not built in + this directory. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-stdout.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-stdout.txt deleted file mode 100644 index 646f984..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget-stdout.txt +++ /dev/null @@ -1,2 +0,0 @@ --- mainexe: mainlib;sublib --- subexe: mainlib;sublib diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake b/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake index 55c658d..32431ce 100644 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake +++ b/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake @@ -1,11 +1,3 @@ enable_language(C) - -add_executable(mainexe empty.c) -add_library(mainlib empty.c) - add_subdirectory(SubDirTarget) - -target_link_libraries(subexe mainlib) -target_link_libraries(subexe sublib) -get_property(subexe_libs TARGET subexe PROPERTY INTERFACE_LINK_LIBRARIES) -message(STATUS "subexe: ${subexe_libs}") +target_link_libraries(subexe m) diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt index 3d956a8..b0b2380 100644 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt +++ b/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt @@ -1,7 +1 @@ add_executable(subexe ../empty.c) -add_library(sublib ../empty.c) - -target_link_libraries(mainexe mainlib) -target_link_libraries(mainexe sublib) -get_property(mainexe_libs TARGET mainexe PROPERTY INTERFACE_LINK_LIBRARIES) -message(STATUS "mainexe: ${mainexe_libs}") ----------------------------------------------------------------------- Summary of changes: Help/command/target_link_libraries.rst | 2 +- Help/release/3.12.rst | 3 --- Source/cmTargetLinkLibrariesCommand.cxx | 11 ++--------- Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake | 3 --- .../SubDirImportedTarget-stdout.txt | 4 ---- .../target_link_libraries/SubDirImportedTarget.cmake | 17 ----------------- .../SubDirImportedTarget/CMakeLists.txt | 13 ------------- .../SubDirTarget-UNKNOWN-IMPORTED-GLOBAL-stdout.txt | 2 -- .../SubDirTarget-UNKNOWN-IMPORTED-GLOBAL.cmake | 11 ----------- .../SubDirTarget-UNKNOWN-IMPORTED-GLOBAL/CMakeLists.txt | 7 ------- .../SubDirTarget-UNKNOWN-IMPORTED-stdout.txt | 2 -- .../SubDirTarget-UNKNOWN-IMPORTED.cmake | 11 ----------- .../SubDirTarget-UNKNOWN-IMPORTED/CMakeLists.txt | 7 ------- .../SubDirTarget-result.txt} | 0 .../target_link_libraries/SubDirTarget-stderr.txt | 5 +++++ .../target_link_libraries/SubDirTarget-stdout.txt | 2 -- Tests/RunCMake/target_link_libraries/SubDirTarget.cmake | 10 +--------- .../target_link_libraries/SubDirTarget/CMakeLists.txt | 6 ------ 18 files changed, 9 insertions(+), 107 deletions(-) delete mode 100644 Tests/RunCMake/target_link_libraries/SubDirImportedTarget-stdout.txt delete mode 100644 Tests/RunCMake/target_link_libraries/SubDirImportedTarget.cmake delete mode 100644 Tests/RunCMake/target_link_libraries/SubDirImportedTarget/CMakeLists.txt delete mode 100644 Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL-stdout.txt delete mode 100644 Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL.cmake delete mode 100644 Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL/CMakeLists.txt delete mode 100644 Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-stdout.txt delete mode 100644 Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED.cmake delete mode 100644 Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED/CMakeLists.txt copy Tests/RunCMake/{while/MissingArgument-result.txt => target_link_libraries/SubDirTarget-result.txt} (100%) create mode 100644 Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt delete mode 100644 Tests/RunCMake/target_link_libraries/SubDirTarget-stdout.txt hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jul 5 11:45:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 5 Jul 2018 11:45:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc2-158-g6683edc Message-ID: <20180705154504.5C624FC126@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 6683edc80354b94233b6b87b77d87c12dfb80c61 (commit) via d101446a56e9a743813f9b6dd84e479cd7e58d79 (commit) via 7f9652773a386ea6bf7eec66f2c58174ebe1b5d4 (commit) via 5c60e80c46fff4c3f8a5cbe8a60eb7dabaae566b (commit) via 8dac71ee72d68baf7925147e65f90ff60d7e7212 (commit) via 0f3d7a1398f943b2417b317fa28c4a7cd5f7c6de (commit) via 89e3e62e138ca1e666d5b4c7a9fa8198c4241d11 (commit) via 84ecbf44b6d3953bb7f33dd48c4382bc3c15f519 (commit) via 890be0145def8d9c469fcaf6db1e7e6bc485f6cc (commit) via f598166124eee89f21be6d518a09cc37d767c5d1 (commit) via 8f2b483c0642589bec51a4caf26cd8c7fa75dd32 (commit) via 38ffcedd26af077cbfb0e0c2c96c5018df23849b (commit) via 9c01704e9fb6b1f34aa52b1299b1a0dcc2de817e (commit) via 91f4adb0284b20c23223bc0243aa96ff8bbc1941 (commit) from 326ebdf12a59e7a115d7326299eb6be54316f34e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6683edc80354b94233b6b87b77d87c12dfb80c61 commit 6683edc80354b94233b6b87b77d87c12dfb80c61 Merge: d101446 0f3d7a1 Author: Brad King AuthorDate: Thu Jul 5 11:41:56 2018 -0400 Commit: Brad King CommitDate: Thu Jul 5 11:41:56 2018 -0400 Merge branch 'release-3.12' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d101446a56e9a743813f9b6dd84e479cd7e58d79 commit d101446a56e9a743813f9b6dd84e479cd7e58d79 Merge: 7f96527 89e3e62 Author: Brad King AuthorDate: Thu Jul 5 15:41:16 2018 +0000 Commit: Kitware Robot CommitDate: Thu Jul 5 11:41:23 2018 -0400 Merge topic 'doc-add_compile_definitions' 89e3e62e13 Help: fix add_compile_definitions() documentation Acked-by: Kitware Robot Merge-request: !2192 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7f9652773a386ea6bf7eec66f2c58174ebe1b5d4 commit 7f9652773a386ea6bf7eec66f2c58174ebe1b5d4 Merge: 5c60e80 8f2b483 Author: Brad King AuthorDate: Thu Jul 5 15:39:02 2018 +0000 Commit: Kitware Robot CommitDate: Thu Jul 5 11:39:09 2018 -0400 Merge topic 'UseSWIG-legacy-targets' 8f2b483c06 Merge branch 'backport-UseSWIG-legacy-targets' into UseSWIG-legacy-targets 38ffcedd26 UseSWIG: reintroduce legacy target name management Acked-by: Kitware Robot Merge-request: !2188 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5c60e80c46fff4c3f8a5cbe8a60eb7dabaae566b commit 5c60e80c46fff4c3f8a5cbe8a60eb7dabaae566b Merge: 8dac71e 91f4adb Author: Brad King AuthorDate: Thu Jul 5 15:37:57 2018 +0000 Commit: Kitware Robot CommitDate: Thu Jul 5 11:38:03 2018 -0400 Merge topic 'FindLua-CMP0012' 91f4adb028 FindLua: Set CMP0012 to NEW for the revised search code Acked-by: Kitware Robot Acked-by: Rolf Eike Beer Acked-by: Alexander Grund Merge-request: !2189 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8dac71ee72d68baf7925147e65f90ff60d7e7212 commit 8dac71ee72d68baf7925147e65f90ff60d7e7212 Merge: 326ebdf 9c01704 Author: Brad King AuthorDate: Thu Jul 5 15:36:10 2018 +0000 Commit: Kitware Robot CommitDate: Thu Jul 5 11:36:25 2018 -0400 Merge topic 'gitignore-vscode' 9c01704e9f gitignore: Ignore a .vscode directory in the source tree Acked-by: Kitware Robot Merge-request: !2182 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8f2b483c0642589bec51a4caf26cd8c7fa75dd32 commit 8f2b483c0642589bec51a4caf26cd8c7fa75dd32 Merge: c4b1c07 38ffced Author: Brad King AuthorDate: Tue Jul 3 11:09:29 2018 -0400 Commit: Brad King CommitDate: Tue Jul 3 12:48:02 2018 -0400 Merge branch 'backport-UseSWIG-legacy-targets' into UseSWIG-legacy-targets Resolve conflicts by integrating changes from both sides. diff --cc Modules/UseSWIG.cmake index 851101b,b306181..8424a9f --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@@ -322,19 -344,11 +358,19 @@@ function(SWIG_ADD_SOURCE_TO_MODULE nam if (include_directories) list (APPEND swig_source_file_flags "$<$:-I$-I>>") endif() - set (property "$") - list (APPEND swig_source_file_flags "$<$:-I$,$-I>>") - set (property "$") + set (property "$") + list (APPEND swig_source_file_flags "$<$:-I$,$-I>>") ++ set (property "$") + get_source_file_property(use_target_include_dirs "${infile}" USE_TARGET_INCLUDE_DIRECTORIES) + if (use_target_include_dirs) + list (APPEND swig_source_file_flags "$<$:-I$-I>>") + elseif(use_target_include_dirs STREQUAL "NOTFOUND") + # not defined at source level, rely on target level - list (APPEND swig_source_file_flags "$<$>,$>:-I$-I>>") ++ list (APPEND swig_source_file_flags "$<$>,$>:-I$-I>>") + endif() - set (property "$") - list (APPEND swig_source_file_flags "$<$:-D$,$-D>>") + set (property "$") + list (APPEND swig_source_file_flags "$<$:-D$,$-D>>") get_source_file_property (compile_definitions "${infile}" COMPILE_DEFINITIONS) if (compile_definitions) list (APPEND swig_source_file_flags "$<$:-D$-D>>") diff --cc Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt index 3e266c3,0000000..d0855bf mode 100644,000000..100644 --- a/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt +++ b/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt @@@ -1,45 -1,0 +1,46 @@@ +cmake_minimum_required(VERSION 3.1) + +project(TestUseTargetINCLUDE_DIRECTORIES CXX) + +include(CTest) + +find_package(SWIG REQUIRED) +include(${SWIG_USE_FILE}) + +find_package(Python3 REQUIRED COMPONENTS Interpreter Development) + ++set(UseSWIG_TARGET_NAME_PREFERENCE STANDARD) +unset(CMAKE_SWIG_FLAGS) + +set_property(SOURCE "example.i" PROPERTY CPLUSPLUS ON) +set_property(SOURCE "example.i" PROPERTY COMPILE_OPTIONS -includeall) + +swig_add_library(example1 + LANGUAGE python + OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/example1" + SOURCES example.i ../example.cxx) +set_target_properties (example1 PROPERTIES + INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/.." + SWIG_USE_TARGET_INCLUDE_DIRECTORIES TRUE + OUTPUT_NAME example1 + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1") +target_link_libraries(example1 PRIVATE Python3::Python) + + +# Check that source property override target property +set_property(SOURCE "example.i" PROPERTY USE_TARGET_INCLUDE_DIRECTORIES TRUE) + +swig_add_library(example2 + LANGUAGE python + OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/example2" + SOURCES example.i ../example.cxx) +set_target_properties (example2 PROPERTIES + INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/.." + SWIG_USE_TARGET_INCLUDE_DIRECTORIES FALSE + OUTPUT_NAME example2 + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example2" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example2" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example2") +target_link_libraries(example2 PRIVATE Python3::Python) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9c01704e9fb6b1f34aa52b1299b1a0dcc2de817e commit 9c01704e9fb6b1f34aa52b1299b1a0dcc2de817e Author: Dakota Hawkins AuthorDate: Sun Jul 1 14:40:50 2018 -0400 Commit: Brad King CommitDate: Tue Jul 3 11:48:14 2018 -0400 gitignore: Ignore a .vscode directory in the source tree diff --git a/.gitignore b/.gitignore index 22e9800..1a257d2 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ Testing # Visual Studio work directory .vs/ + +# Visual Studio Code +.vscode/ ----------------------------------------------------------------------- Summary of changes: .gitignore | 3 + Help/command/add_compile_definitions.rst | 6 +- Modules/FindLua.cmake | 5 + Modules/UseSWIG.cmake | 168 ++++++++++++++------- Tests/UseSWIG/BasicConfiguration.cmake | 1 + Tests/UseSWIG/ModuleVersion2/CMakeLists.txt | 1 + Tests/UseSWIG/MultipleModules/CMakeLists.txt | 1 + Tests/UseSWIG/MultiplePython/CMakeLists.txt | 1 + .../UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt | 1 + 9 files changed, 129 insertions(+), 58 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jul 5 11:45:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 5 Jul 2018 11:45:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.12.0-rc2-12-g0f3d7a1 Message-ID: <20180705154504.A6B50103369@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via 0f3d7a1398f943b2417b317fa28c4a7cd5f7c6de (commit) via 89e3e62e138ca1e666d5b4c7a9fa8198c4241d11 (commit) via 84ecbf44b6d3953bb7f33dd48c4382bc3c15f519 (commit) via 890be0145def8d9c469fcaf6db1e7e6bc485f6cc (commit) via f598166124eee89f21be6d518a09cc37d767c5d1 (commit) via 38ffcedd26af077cbfb0e0c2c96c5018df23849b (commit) via 91f4adb0284b20c23223bc0243aa96ff8bbc1941 (commit) via 0d7114987c78085df6449e93bdda8a1749862025 (commit) from 39851a6d43c40078c7f6d479c49e29e9a4842f1a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Help/command/add_compile_definitions.rst | 6 +- Help/command/target_link_libraries.rst | 2 +- Help/release/3.12.rst | 3 - Modules/FindLua.cmake | 5 + Modules/UseSWIG.cmake | 164 ++++++++++++++------- Source/cmTargetLinkLibrariesCommand.cxx | 11 +- .../target_link_libraries/RunCMakeTest.cmake | 3 - .../SubDirImportedTarget-stdout.txt | 4 - .../SubDirImportedTarget.cmake | 17 --- .../SubDirImportedTarget/CMakeLists.txt | 13 -- ...SubDirTarget-UNKNOWN-IMPORTED-GLOBAL-stdout.txt | 2 - .../SubDirTarget-UNKNOWN-IMPORTED-GLOBAL.cmake | 11 -- .../CMakeLists.txt | 7 - .../SubDirTarget-UNKNOWN-IMPORTED-stdout.txt | 2 - .../SubDirTarget-UNKNOWN-IMPORTED.cmake | 11 -- .../SubDirTarget-UNKNOWN-IMPORTED/CMakeLists.txt | 7 - .../SubDirTarget-result.txt} | 0 .../target_link_libraries/SubDirTarget-stderr.txt | 5 + .../target_link_libraries/SubDirTarget-stdout.txt | 2 - .../target_link_libraries/SubDirTarget.cmake | 10 +- .../SubDirTarget/CMakeLists.txt | 6 - Tests/UseSWIG/BasicConfiguration.cmake | 1 + Tests/UseSWIG/ModuleVersion2/CMakeLists.txt | 1 + Tests/UseSWIG/MultipleModules/CMakeLists.txt | 1 + Tests/UseSWIG/MultiplePython/CMakeLists.txt | 1 + 25 files changed, 132 insertions(+), 163 deletions(-) delete mode 100644 Tests/RunCMake/target_link_libraries/SubDirImportedTarget-stdout.txt delete mode 100644 Tests/RunCMake/target_link_libraries/SubDirImportedTarget.cmake delete mode 100644 Tests/RunCMake/target_link_libraries/SubDirImportedTarget/CMakeLists.txt delete mode 100644 Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL-stdout.txt delete mode 100644 Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL.cmake delete mode 100644 Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL/CMakeLists.txt delete mode 100644 Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-stdout.txt delete mode 100644 Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED.cmake delete mode 100644 Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED/CMakeLists.txt copy Tests/RunCMake/{while/MissingArgument-result.txt => target_link_libraries/SubDirTarget-result.txt} (100%) create mode 100644 Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt delete mode 100644 Tests/RunCMake/target_link_libraries/SubDirTarget-stdout.txt hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jul 6 00:05:08 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 6 Jul 2018 00:05:08 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc2-159-gf6b2017 Message-ID: <20180706040508.EF817115542@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 f6b20179aa21ee6997879d3d0fb3288e79a4b58f (commit) from 6683edc80354b94233b6b87b77d87c12dfb80c61 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f6b20179aa21ee6997879d3d0fb3288e79a4b58f commit f6b20179aa21ee6997879d3d0fb3288e79a4b58f Author: Kitware Robot AuthorDate: Fri Jul 6 00:01:08 2018 -0400 Commit: Kitware Robot CommitDate: Fri Jul 6 00:01:08 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 18440bd..3a60252 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 12) -set(CMake_VERSION_PATCH 20180705) +set(CMake_VERSION_PATCH 20180706) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jul 6 09:45:08 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 6 Jul 2018 09:45:08 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc2-166-gb74962d Message-ID: <20180706134508.24D2110A793@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 b74962d8989428c3f94b602662f9dcdd1f4e5cfd (commit) via edfeeba34785599fdce39a16bc65cc2023a0cd90 (commit) via 9d1bc0a918d0e3b97a3669e11d0d6ce6710af3b0 (commit) via a08154d493a08f1fc1473038f897eb5468a8f79b (commit) via 59b3e78451a1b19b95f7cb40fbd19454ace7f483 (commit) via 6a9fe250a7a56f98d6af081ca172cfc28d127206 (commit) via cb694f8cd65dfb4e73fedcfa04f92c8be7a2bcf6 (commit) from f6b20179aa21ee6997879d3d0fb3288e79a4b58f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b74962d8989428c3f94b602662f9dcdd1f4e5cfd commit b74962d8989428c3f94b602662f9dcdd1f4e5cfd Merge: edfeeba cb694f8 Author: Brad King AuthorDate: Fri Jul 6 13:43:17 2018 +0000 Commit: Kitware Robot CommitDate: Fri Jul 6 09:43:23 2018 -0400 Merge topic 'vsnasm-quoting' cb694f8cd6 VS: Properly quote arguments in nasm.xml Acked-by: Kitware Robot Merge-request: !2179 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=edfeeba34785599fdce39a16bc65cc2023a0cd90 commit edfeeba34785599fdce39a16bc65cc2023a0cd90 Merge: 9d1bc0a 59b3e78 Author: Brad King AuthorDate: Fri Jul 6 13:42:25 2018 +0000 Commit: Kitware Robot CommitDate: Fri Jul 6 09:42:31 2018 -0400 Merge topic 'FindCURL-per-config' 59b3e78451 FindCURL: Find debug and release variants separately 6a9fe250a7 FindCURL: Improve CURL::libcurl property code layout Acked-by: Kitware Robot Merge-request: !1940 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9d1bc0a918d0e3b97a3669e11d0d6ce6710af3b0 commit 9d1bc0a918d0e3b97a3669e11d0d6ce6710af3b0 Merge: f6b2017 a08154d Author: Brad King AuthorDate: Fri Jul 6 13:41:18 2018 +0000 Commit: Kitware Robot CommitDate: Fri Jul 6 09:41:24 2018 -0400 Merge topic 'list-command-insert' a08154d493 list: Allow inserting at the end of a list Acked-by: Kitware Robot Merge-request: !2181 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a08154d493a08f1fc1473038f897eb5468a8f79b commit a08154d493a08f1fc1473038f897eb5468a8f79b Author: Daniel Chabrowski AuthorDate: Sun Jul 1 18:30:21 2018 +0200 Commit: Brad King CommitDate: Thu Jul 5 13:53:49 2018 -0400 list: Allow inserting at the end of a list Fixes: #18069 diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index ba0c843..d7de2fa 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -289,12 +289,10 @@ bool cmListCommand::HandleInsertCommand(std::vector const& args) if (item < 0) { item = static_cast(nitem) + item; } - if (item < 0 || nitem <= static_cast(item)) { + if (item < 0 || nitem < static_cast(item)) { std::ostringstream str; str << "index: " << item << " out of range (-" << varArgsExpanded.size() - << ", " - << (varArgsExpanded.empty() ? 0 : (varArgsExpanded.size() - 1)) - << ")"; + << ", " << varArgsExpanded.size() << ")"; this->SetError(str.str()); return false; } diff --git a/Tests/CMakeTests/ListTest.cmake.in b/Tests/CMakeTests/ListTest.cmake.in index 76f5e4f..f517e64 100644 --- a/Tests/CMakeTests/ListTest.cmake.in +++ b/Tests/CMakeTests/ListTest.cmake.in @@ -53,6 +53,10 @@ set(result andy brad) list(INSERT result -1 bill ken) TEST("INSERT result -1 bill ken" "andy;bill;ken;brad") +set(result andy brad) +list(INSERT result 2 bill ken) +TEST("INSERT result 2 bill ken" "andy;brad;bill;ken") + set(result andy bill brad ken bob) list(REMOVE_ITEM result bob) TEST("REMOVE_ITEM result bob" "andy;bill;brad;ken") diff --git a/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt b/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt index 6e15c0b..9b9c5e0 100644 --- a/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt +++ b/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt @@ -1,4 +1,4 @@ ^CMake Error at INSERT-InvalidIndex.cmake:2 \(list\): - list index: 3 out of range \(-3, 2\) + list index: 4 out of range \(-3, 3\) Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/INSERT-InvalidIndex.cmake b/Tests/RunCMake/list/INSERT-InvalidIndex.cmake index 4103d97..12ac114 100644 --- a/Tests/RunCMake/list/INSERT-InvalidIndex.cmake +++ b/Tests/RunCMake/list/INSERT-InvalidIndex.cmake @@ -1,2 +1,2 @@ set(mylist alpha bravo charlie) -list(INSERT mylist 3 delta) +list(INSERT mylist 4 delta) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=59b3e78451a1b19b95f7cb40fbd19454ace7f483 commit 59b3e78451a1b19b95f7cb40fbd19454ace7f483 Author: Hiroshi Miura AuthorDate: Thu Jun 28 02:02:54 2018 +0900 Commit: Brad King CommitDate: Tue Jul 3 13:40:49 2018 -0400 FindCURL: Find debug and release variants separately Fixes: #17887 diff --git a/Help/release/dev/FindCURL-per-config.rst b/Help/release/dev/FindCURL-per-config.rst new file mode 100644 index 0000000..5ba1425 --- /dev/null +++ b/Help/release/dev/FindCURL-per-config.rst @@ -0,0 +1,5 @@ +FindCURL-per-config +------------------- + +* The :module:`FindCURL` module learned to find debug and release variants + separately. diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake index 0bd47f7..60ddf7b 100644 --- a/Modules/FindCURL.cmake +++ b/Modules/FindCURL.cmake @@ -34,17 +34,29 @@ find_path(CURL_INCLUDE_DIR NAMES curl/curl.h) mark_as_advanced(CURL_INCLUDE_DIR) -# Look for the library (sorted from most current/relevant entry to least). -find_library(CURL_LIBRARY NAMES - curl - # Windows MSVC prebuilts: - curllib - libcurl_imp - curllib_static - # Windows older "Win32 - MSVC" prebuilts (libcurl.lib, e.g. libcurl-7.15.5-win32-msvc.zip): - libcurl -) -mark_as_advanced(CURL_LIBRARY) +if(NOT CURL_LIBRARY) + # Look for the library (sorted from most current/relevant entry to least). + find_library(CURL_LIBRARY_RELEASE NAMES + curl + # Windows MSVC prebuilts: + curllib + libcurl_imp + curllib_static + # Windows older "Win32 - MSVC" prebuilts (libcurl.lib, e.g. libcurl-7.15.5-win32-msvc.zip): + libcurl + ) + mark_as_advanced(CURL_LIBRARY_RELEASE) + + find_library(CURL_LIBRARY_DEBUG NAMES + # Windows MSVC CMake builds in debug configuration on vcpkg: + libcurl-d_imp + libcurl-d + ) + mark_as_advanced(CURL_LIBRARY_DEBUG) + + include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + select_library_configurations(CURL) +endif() if(CURL_INCLUDE_DIR) foreach(_curl_version_header curlver.h curl.h) @@ -71,7 +83,25 @@ if(CURL_FOUND) add_library(CURL::libcurl UNKNOWN IMPORTED) set_target_properties(CURL::libcurl PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}") - set_property(TARGET CURL::libcurl PROPERTY - IMPORTED_LOCATION "${CURL_LIBRARY}") + + if(EXISTS "${CURL_LIBRARY}") + set_target_properties(CURL::libcurl PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${CURL_LIBRARY}") + endif() + if(CURL_LIBRARY_RELEASE) + set_property(TARGET CURL::libcurl APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(CURL::libcurl PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION_RELEASE "${CURL_LIBRARY_RELEASE}") + endif() + if(CURL_LIBRARY_DEBUG) + set_property(TARGET CURL::libcurl APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(CURL::libcurl PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION_DEBUG "${CURL_LIBRARY_DEBUG}") + endif() endif() endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6a9fe250a7a56f98d6af081ca172cfc28d127206 commit 6a9fe250a7a56f98d6af081ca172cfc28d127206 Author: Hiroshi Miura AuthorDate: Thu Jun 28 02:02:54 2018 +0900 Commit: Brad King CommitDate: Tue Jul 3 13:31:48 2018 -0400 FindCURL: Improve CURL::libcurl property code layout diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake index a549765..0bd47f7 100644 --- a/Modules/FindCURL.cmake +++ b/Modules/FindCURL.cmake @@ -69,7 +69,9 @@ if(CURL_FOUND) if(NOT TARGET CURL::libcurl) add_library(CURL::libcurl UNKNOWN IMPORTED) - set_target_properties(CURL::libcurl PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}") - set_property(TARGET CURL::libcurl APPEND PROPERTY IMPORTED_LOCATION "${CURL_LIBRARY}") + set_target_properties(CURL::libcurl PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}") + set_property(TARGET CURL::libcurl PROPERTY + IMPORTED_LOCATION "${CURL_LIBRARY}") endif() endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cb694f8cd65dfb4e73fedcfa04f92c8be7a2bcf6 commit cb694f8cd65dfb4e73fedcfa04f92c8be7a2bcf6 Author: David Benjamin AuthorDate: Fri Jun 29 15:54:42 2018 -0400 Commit: David Benjamin CommitDate: Mon Jul 2 18:50:12 2018 -0400 VS: Properly quote arguments in nasm.xml Most arguments were quoted, but some weren't, causing problems if the arguments contained whitespace. In particular, the _STL_EXTRA_DISABLED_WARNINGS value takes spaces and CMake's NASM support applies all add_definitions lines to NASM. The -D flag is missing quotes, so projects using NASM and setting _STL_EXTRA_DISABLED_WARNINGS break in the Visual Studio generator. Likewise, the -o flag is missing quotes, which means filenames with spaces do not work. (The -U flag is unlikely to need quotes, but include them for consistency.) Extend the existing VSNASM test to cover these cases. diff --git a/Templates/MSBuild/nasm.xml b/Templates/MSBuild/nasm.xml index 92f8548..a5dcdd5 100644 --- a/Templates/MSBuild/nasm.xml +++ b/Templates/MSBuild/nasm.xml @@ -36,7 +36,7 @@ - + @@ -48,8 +48,8 @@ - - + + diff --git a/Tests/VSNASM/CMakeLists.txt b/Tests/VSNASM/CMakeLists.txt index c2e29df..821d022 100644 --- a/Tests/VSNASM/CMakeLists.txt +++ b/Tests/VSNASM/CMakeLists.txt @@ -1,10 +1,20 @@ cmake_minimum_required(VERSION 2.8.12) project(VSNASM C ASM_NASM) + if(CMAKE_SIZEOF_VOID_P EQUAL 8) add_definitions(-DTESTx64) string(APPEND CMAKE_ASM_NASM_FLAGS " -DTEST2x64") else() add_definitions(-DTESTi386) endif() + +# Test quoting for definitions with spaces. +add_definitions("-DEAX_COMMA_SPACE_ZERO=eax, 0") + +# Test quoting for file names with spaces. The file is generated because CMake +# itself cannot have files with spaces. +file(READ bar.asm BAR_ASM_CONTENTS) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/bar baz.asm" "${BAR_ASM_CONTENTS}") + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) -add_executable(VSNASM main.c foo.asm) +add_executable(VSNASM main.c foo.asm "${CMAKE_CURRENT_BINARY_DIR}/bar baz.asm") diff --git a/Tests/VSNASM/bar.asm b/Tests/VSNASM/bar.asm new file mode 100644 index 0000000..b486d82 --- /dev/null +++ b/Tests/VSNASM/bar.asm @@ -0,0 +1,13 @@ +section .text +%ifdef TEST2x64 +global bar +%else +global _bar +%endif +%ifdef TESTx64 +bar: +%else +_bar: +%endif + mov EAX_COMMA_SPACE_ZERO + ret diff --git a/Tests/VSNASM/include/foo-proc.asm b/Tests/VSNASM/include/foo-proc.asm index 450a791..eb5bb2b 100644 --- a/Tests/VSNASM/include/foo-proc.asm +++ b/Tests/VSNASM/include/foo-proc.asm @@ -3,5 +3,5 @@ foo: %else _foo: %endif - mov eax, 0 + mov EAX_COMMA_SPACE_ZERO ret diff --git a/Tests/VSNASM/main.c b/Tests/VSNASM/main.c index 18ddb78..b1401b6 100644 --- a/Tests/VSNASM/main.c +++ b/Tests/VSNASM/main.c @@ -1,5 +1,6 @@ extern int foo(void); +extern int bar(void); int main(void) { - return foo(); + return foo() + bar(); } ----------------------------------------------------------------------- Summary of changes: Help/release/dev/FindCURL-per-config.rst | 5 ++ Modules/FindCURL.cmake | 58 +++++++++++++++++----- Source/cmListCommand.cxx | 6 +-- Templates/MSBuild/nasm.xml | 6 +-- Tests/CMakeTests/ListTest.cmake.in | 4 ++ Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt | 2 +- Tests/RunCMake/list/INSERT-InvalidIndex.cmake | 2 +- Tests/VSNASM/CMakeLists.txt | 12 ++++- Tests/VSNASM/bar.asm | 13 +++++ Tests/VSNASM/include/foo-proc.asm | 2 +- Tests/VSNASM/main.c | 3 +- 11 files changed, 88 insertions(+), 25 deletions(-) create mode 100644 Help/release/dev/FindCURL-per-config.rst create mode 100644 Tests/VSNASM/bar.asm hooks/post-receive -- CMake From kwrobot at kitware.com Sat Jul 7 00:05:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 7 Jul 2018 00:05:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc2-167-gc29dda6 Message-ID: <20180707040507.0F0DD11D8B1@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 c29dda6c9927f6be2fccb671dc7ab385e5a6ac36 (commit) from b74962d8989428c3f94b602662f9dcdd1f4e5cfd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c29dda6c9927f6be2fccb671dc7ab385e5a6ac36 commit c29dda6c9927f6be2fccb671dc7ab385e5a6ac36 Author: Kitware Robot AuthorDate: Sat Jul 7 00:01:10 2018 -0400 Commit: Kitware Robot CommitDate: Sat Jul 7 00:01:10 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 3a60252..81a3ac5 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 12) -set(CMake_VERSION_PATCH 20180706) +set(CMake_VERSION_PATCH 20180707) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sun Jul 8 00:05:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 8 Jul 2018 00:05:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc2-168-ge3ade3c Message-ID: <20180708040504.B248F113E16@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 e3ade3cc7232cf234d43ffc6ab5f48b2134391ca (commit) from c29dda6c9927f6be2fccb671dc7ab385e5a6ac36 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e3ade3cc7232cf234d43ffc6ab5f48b2134391ca commit e3ade3cc7232cf234d43ffc6ab5f48b2134391ca Author: Kitware Robot AuthorDate: Sun Jul 8 00:01:06 2018 -0400 Commit: Kitware Robot CommitDate: Sun Jul 8 00:01:06 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 81a3ac5..8bf452c 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 12) -set(CMake_VERSION_PATCH 20180707) +set(CMake_VERSION_PATCH 20180708) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jul 9 00:05:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 9 Jul 2018 00:05:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc2-169-g0100e5b Message-ID: <20180709040506.C423711E85E@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 0100e5b2a73deedc4c82ad1925a2ab39d5d63960 (commit) from e3ade3cc7232cf234d43ffc6ab5f48b2134391ca (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0100e5b2a73deedc4c82ad1925a2ab39d5d63960 commit 0100e5b2a73deedc4c82ad1925a2ab39d5d63960 Author: Kitware Robot AuthorDate: Mon Jul 9 00:01:04 2018 -0400 Commit: Kitware Robot CommitDate: Mon Jul 9 00:01:04 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8bf452c..4a05801 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 12) -set(CMake_VERSION_PATCH 20180708) +set(CMake_VERSION_PATCH 20180709) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jul 9 07:35:08 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 9 Jul 2018 07:35:08 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc2-171-ged75309 Message-ID: <20180709113509.360D811DA8D@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 ed75309344efe28eeb931fd537853ed8030db0a1 (commit) via 8a6107650e60b0ca2b9dfdad4b86d1b2f57bbfd7 (commit) from 0100e5b2a73deedc4c82ad1925a2ab39d5d63960 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ed75309344efe28eeb931fd537853ed8030db0a1 commit ed75309344efe28eeb931fd537853ed8030db0a1 Merge: 0100e5b 8a61076 Author: Brad King AuthorDate: Mon Jul 9 11:33:28 2018 +0000 Commit: Kitware Robot CommitDate: Mon Jul 9 07:33:35 2018 -0400 Merge topic 'csharp-link-file' 8a6107650e VS: Only link cs files when they're not in binary dir Acked-by: Kitware Robot Acked-by: Michael St?rmer Merge-request: !2177 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8a6107650e60b0ca2b9dfdad4b86d1b2f57bbfd7 commit 8a6107650e60b0ca2b9dfdad4b86d1b2f57bbfd7 Author: Robert Dailey AuthorDate: Fri Jun 29 15:30:59 2018 -0500 Commit: Brad King CommitDate: Fri Jul 6 09:45:15 2018 -0400 VS: Only link cs files when they're not in binary dir When `*.cs` files are provided, do not generate a `` element in the `.csproj` project if those files are descendants of `CMAKE_CURRENT_BINARY_DIR`. This comparison happens for each file. diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index b9ec301..eff915b 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -4523,14 +4523,17 @@ void cmVisualStudio10TargetGenerator::WriteCSharpSourceProperties( void cmVisualStudio10TargetGenerator::GetCSharpSourceLink( cmSourceFile const* sf, std::string& link) { - std::string f = sf->GetFullPath(); - if (!this->InSourceBuild) { + std::string const& sourceFilePath = sf->GetFullPath(); + std::string const& binaryDir = LocalGenerator->GetCurrentBinaryDirectory(); + + if (!cmSystemTools::IsSubDirectory(sourceFilePath, binaryDir)) { const std::string stripFromPath = this->Makefile->GetCurrentSourceDirectory(); - if (f.find(stripFromPath) != std::string::npos) { - link = f.substr(stripFromPath.length() + 1); + if (sourceFilePath.find(stripFromPath) == 0) { if (const char* l = sf->GetProperty("VS_CSHARP_Link")) { link = l; + } else { + link = sourceFilePath.substr(stripFromPath.length() + 1); } ConvertToWindowsSlash(link); } ----------------------------------------------------------------------- Summary of changes: Source/cmVisualStudio10TargetGenerator.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jul 9 07:55:07 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 9 Jul 2018 07:55:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.12.0-rc2-14-g855dafd Message-ID: <20180709115507.C7AC611DF2A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via 855dafdda090b182c966415b5fc2e0a515fbb701 (commit) via 8a6107650e60b0ca2b9dfdad4b86d1b2f57bbfd7 (commit) from 0f3d7a1398f943b2417b317fa28c4a7cd5f7c6de (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/cmVisualStudio10TargetGenerator.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jul 9 07:55:07 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 9 Jul 2018 07:55:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc2-173-g6c33f39 Message-ID: <20180709115507.478ED11DF57@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 6c33f39c30f869ef78f33a0b3a05e286767929c7 (commit) via 855dafdda090b182c966415b5fc2e0a515fbb701 (commit) from ed75309344efe28eeb931fd537853ed8030db0a1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6c33f39c30f869ef78f33a0b3a05e286767929c7 commit 6c33f39c30f869ef78f33a0b3a05e286767929c7 Merge: ed75309 855dafd Author: Brad King AuthorDate: Mon Jul 9 07:49:19 2018 -0400 Commit: Brad King CommitDate: Mon Jul 9 07:49:19 2018 -0400 Merge branch 'release-3.12' ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jul 9 09:35:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 9 Jul 2018 09:35:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc2-175-g1b5b1dc Message-ID: <20180709133504.E18A81142C7@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 1b5b1dc5cc5d1fd92fafcece3b4ae8ad51fd5817 (commit) via 7f1569d2d8c1a647cf4d1b0696834952cf8f00fb (commit) from 6c33f39c30f869ef78f33a0b3a05e286767929c7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1b5b1dc5cc5d1fd92fafcece3b4ae8ad51fd5817 commit 1b5b1dc5cc5d1fd92fafcece3b4ae8ad51fd5817 Merge: 6c33f39 7f1569d Author: Brad King AuthorDate: Mon Jul 9 09:30:54 2018 -0400 Commit: Brad King CommitDate: Mon Jul 9 09:30:54 2018 -0400 Merge branch 'release-3.12' ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jul 9 09:35:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 9 Jul 2018 09:35:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.12.0-rc2-15-g7f1569d Message-ID: <20180709133504.F2D8A11DAB3@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via 7f1569d2d8c1a647cf4d1b0696834952cf8f00fb (commit) from 855dafdda090b182c966415b5fc2e0a515fbb701 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jul 9 09:45:03 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 9 Jul 2018 09:45:03 -0400 (EDT) Subject: [Cmake-commits] CMake annotated tag, v3.12.0-rc3, created. v3.12.0-rc3 Message-ID: <20180709134503.8BEB0113F96@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 annotated tag, v3.12.0-rc3 has been created at 03ff07ae692ae37b41ae8bd2790f9eb6c00aa4ad (tag) tagging 7f1569d2d8c1a647cf4d1b0696834952cf8f00fb (commit) replaces v3.12.0-rc2 tagged by Brad King on Mon Jul 9 09:30:19 2018 -0400 - Log ----------------------------------------------------------------- CMake 3.12.0-rc3 -----BEGIN PGP SIGNATURE----- iQJKBAABCgA0FiEExsJlMku+vcNQtRPQLSzvEDSSFoQFAltDY2sWHGJyYWQua2lu Z0BraXR3YXJlLmNvbQAKCRAtLO8QNJIWhBYhD/wMEEJX4hpLWSDB/96PXNEysdHF aK0TBvpwuEHzg/GRMsFDs4w8SQXsjWiNUdc3wS6Uhpwg2V8kLfYB9OEpTQt6eGif nS39/1C4ZwnR7m+z4fPI25wxfn0mMs6X515w6iV3FrRahHA8Pe1a6vaaqEzg5+Gu lyzFtLJaaeaDIW5qVIO4TNXyetzogSl49nCztjxHgyJax+oEDXEkYcBb+KY+AGcA tt2fNE/ko5XEMPJFDuIDmTSRl35m6pn5gL8kwfHhpk/ZL2q1EtjVV+Bj3ZhCe4LP 719QfgQnN8TCfHTI42MWdIZTq9RHZLv+QUtx+02r8U4JTByn6uoccOCfGHUa2pBD 4Mi/NRjeQudxu+uKLH/1fAKiPzDWSLytevdOha7KtFfo1DZSKVB8vfYgMDfAVDiT VSdwcPFJUclLPvQGOEdwZY7g9q/WO98nuHpzjRrdmHpZ0Ms/ZzCNsG5qaFhS7A8Q oAZPaA+3sRx3q/8u86oAVEyJqdbZtTpvX9Et4jth4gDk6HruLUgzZYk7Y2R1Spn9 mG0YqGdtCxDU5u0CMA6qWXeNNv8pNN4w7g6SVVYDU8v5W8nM+z/tm32NCkfcatwR YkPMIOKj4hPuMJGSMzbs23ntG3ucRVwJU87d61SWyenHFvzLJvEPhDFGIPSvnzgL 1s8rxkHs7jbwhJFacA== =Fvee -----END PGP SIGNATURE----- Adriaan de Groot (1): FindLua: Set CMP0012 to NEW for the revised search code Andrew Fuller (1): CPack/Deb: Restore setting of root as the owner of files Brad King (9): Merge branch 'policy_max_docs' into release-3.12 Merge branch 'cpack-fix-deb-packaging' into release-3.12 Revert "target_link_libraries: Allow use with targets in other directories" Merge branch 'backport-UseSWIG-legacy-targets' into release-3.12 Merge branch 'FindLua-CMP0012' into release-3.12 Merge branch 'revert-subdirectory-linking' into release-3.12 Merge branch 'doc-add_compile_definitions' into release-3.12 Merge branch 'csharp-link-file' into release-3.12 CMake 3.12.0-rc3 Craig Scott (1): Help: Clarify ... behavior for policy-related commands Marc Chevrier (2): UseSWIG: reintroduce legacy target name management Help: fix add_compile_definitions() documentation Robert Dailey (1): VS: Only link cs files when they're not in binary dir ----------------------------------------------------------------------- hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jul 9 10:35:07 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 9 Jul 2018 10:35:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc3-166-g8d478c0 Message-ID: <20180709143507.7997211CD92@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 8d478c0003cc9bb4836038fc1a27d3bbd40348d2 (commit) via c878e6f8cc89ae5864d3446bf237bf53f1ee6563 (commit) via 67ae6da331d4c7fbcb8109820779200002bae54a (commit) via 2a5f5c0e316d415e1b8207348b34761d34f191ae (commit) via 12e6f83319d089b3295b4211d0d4810575e8f7d5 (commit) via 5bb3d40a289c44f350aa68f32e5ef0c1ad7f13b1 (commit) from 1b5b1dc5cc5d1fd92fafcece3b4ae8ad51fd5817 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8d478c0003cc9bb4836038fc1a27d3bbd40348d2 commit 8d478c0003cc9bb4836038fc1a27d3bbd40348d2 Merge: c878e6f 67ae6da Author: Brad King AuthorDate: Mon Jul 9 14:26:35 2018 +0000 Commit: Kitware Robot CommitDate: Mon Jul 9 10:26:40 2018 -0400 Merge topic 'emacs-fix-unescaped-character-literals' 67ae6da331 cmake-mode.el: Fix "unescaped character literals" warning Acked-by: Kitware Robot Merge-request: !2195 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c878e6f8cc89ae5864d3446bf237bf53f1ee6563 commit c878e6f8cc89ae5864d3446bf237bf53f1ee6563 Merge: 1b5b1dc 2a5f5c0 Author: Brad King AuthorDate: Mon Jul 9 14:25:24 2018 +0000 Commit: Kitware Robot CommitDate: Mon Jul 9 10:25:33 2018 -0400 Merge topic 'option-normal-variable' 2a5f5c0e31 option: respect existing normal variable 12e6f83319 Option: Add a test that verifies interaction with normal variables 5bb3d40a28 cmOption: Remove VTK 4.0 workarounds Acked-by: Kitware Robot Merge-request: !2155 diff --cc Tests/RunCMake/CMakeLists.txt index c211f99,e55d97d..97c3178 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@@ -238,8 -238,8 +238,9 @@@ add_RunCMake_test(include add_RunCMake_test(include_directories) add_RunCMake_test(include_guard) add_RunCMake_test(list) +add_RunCMake_test(math) add_RunCMake_test(message) + add_RunCMake_test(option) add_RunCMake_test(project -DCMake_TEST_RESOURCES=${CMake_TEST_RESOURCES}) add_RunCMake_test(return) add_RunCMake_test(separate_arguments) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=67ae6da331d4c7fbcb8109820779200002bae54a commit 67ae6da331d4c7fbcb8109820779200002bae54a Author: Jeff Kowalski AuthorDate: Fri Jul 6 16:56:32 2018 -0700 Commit: Brad King CommitDate: Mon Jul 9 10:06:33 2018 -0400 cmake-mode.el: Fix "unescaped character literals" warning Emacs 27.0 warns Loading ?cmake-mode?: unescaped character literals `?(', `?)' detected! during byte-compilation of cmake-mode.el The new warning was added in emacs commit c2bbdc3316 (Warn about missing backslashes during load). Add backslashes to escape the literals. diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el index 8ae57d4..e4fa6c1 100644 --- a/Auxiliary/cmake-mode.el +++ b/Auxiliary/cmake-mode.el @@ -55,7 +55,7 @@ set the path with these commands: (* (or (not (any space "()#\\\n")) (and ?\\ nonl))))) (defconst cmake-regex-token (rx-to-string `(group (or (regexp ,cmake-regex-comment) - ?( ?) + ?\( ?\) (regexp ,cmake-regex-argument-unquoted) (regexp ,cmake-regex-argument-quoted))))) (defconst cmake-regex-indented https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2a5f5c0e316d415e1b8207348b34761d34f191ae commit 2a5f5c0e316d415e1b8207348b34761d34f191ae Author: Robert Maynard AuthorDate: Thu Jun 21 14:53:11 2018 -0400 Commit: Brad King CommitDate: Mon Jul 9 07:48:28 2018 -0400 option: respect existing normal variable Add policy CMP0077 to change this behavior in a compatible way. diff --git a/Help/command/option.rst b/Help/command/option.rst index 91cd0a7..4fabb87 100644 --- a/Help/command/option.rst +++ b/Help/command/option.rst @@ -9,7 +9,9 @@ Provides an option that the user can optionally select. [initial value]) Provide an option for the user to select as ``ON`` or ``OFF``. If no -initial value is provided, ``OFF`` is used. +initial value is provided, ``OFF`` is used. If the option is already +set as a normal variable then the command does nothing +(see policy :policy:`CMP0077`). If you have options that depend on the values of other options, see the module help for :module:`CMakeDependentOption`. diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 6179a7c..b2eeb3a 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -57,6 +57,7 @@ Policies Introduced by CMake 3.13 .. toctree:: :maxdepth: 1 + CMP0077: option() honors normal variables. CMP0076: target_sources() command converts relative paths to absolute. Policies Introduced by CMake 3.12 diff --git a/Help/policy/CMP0077.rst b/Help/policy/CMP0077.rst new file mode 100644 index 0000000..8efe198 --- /dev/null +++ b/Help/policy/CMP0077.rst @@ -0,0 +1,16 @@ +CMP0077 +------- + +:command:`option` honors normal variables. + +The ``OLD`` behavior for this policy is to clear any existing normal variables +with the same name. The ``NEW`` behavior for this policy is to not create +a cache entry or modify any existing normal variables if a normal variable +with the same name already exists. + +This policy was introduced in CMake version 3.13. CMake version +|release| warns when the policy is not set and uses ``OLD`` behavior. +Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` +explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/release/dev/option-normal-variable.rst b/Help/release/dev/option-normal-variable.rst new file mode 100644 index 0000000..19b9a64 --- /dev/null +++ b/Help/release/dev/option-normal-variable.rst @@ -0,0 +1,5 @@ +option-normal-variable +---------------------- + +* The :command:`option` command now honors existing normal variables instead + of replacing them with a cache entry. See policy :policy:`CMP0077`. diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index 13bcd03..4ab0e96 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -2,11 +2,16 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmOptionCommand.h" +#include + #include "cmAlgorithms.h" #include "cmMakefile.h" +#include "cmPolicies.h" #include "cmState.h" +#include "cmStateSnapshot.h" #include "cmStateTypes.h" #include "cmSystemTools.h" +#include "cmake.h" class cmExecutionStatus; @@ -22,18 +27,47 @@ bool cmOptionCommand::InitialPass(std::vector const& args, return false; } - std::string initialValue = "Off"; - // Now check and see if the value has been stored in the cache - // already, if so use that value and don't look for the program + // Determine the state of the option policy + auto status = this->Makefile->GetPolicyStatus(cmPolicies::CMP0077); + const char* exists = + this->Makefile->GetStateSnapshot().GetDefinition(args[0]); + switch (status) { + case cmPolicies::WARN: + if (exists) { + std::ostringstream w; + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0077) + << "\n" + "For compatibility with older versions of CMake, option " + "is clearing the normal variable '" + << args[0] << "'."; + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + } + case cmPolicies::OLD: + // OLD behavior does not warn. + break; + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::NEW: { + // See if a local variable with this name already exists. + // If so we ignore the option command. + if (exists) { + return true; + } + } break; + } + + // See if a cache variable with this name already exists + // If so just make sure the doc state is correct cmState* state = this->Makefile->GetState(); const char* existingValue = state->GetCacheEntryValue(args[0]); - if (existingValue) { - if (state->GetCacheEntryType(args[0]) != cmStateEnums::UNINITIALIZED) { - state->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]); - return true; - } - initialValue = existingValue; + if (existingValue && + (state->GetCacheEntryType(args[0]) != cmStateEnums::UNINITIALIZED)) { + state->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]); + return true; } + + // Nothing in the cache so add it + std::string initialValue = existingValue ? existingValue : "Off"; if (args.size() == 3) { initialValue = args[2]; } diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 1732ad6..d0d9307 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -226,7 +226,9 @@ class cmMakefile; 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0076, \ "target_sources() command converts relative paths to absolute.", 3, \ - 13, 0, cmPolicies::WARN) + 13, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0077, "option() honors normal variables.", 3, 13, 0, \ + cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt index 8a3a83b..204d54c 100644 --- a/Tests/CMakeOnly/CMakeLists.txt +++ b/Tests/CMakeOnly/CMakeLists.txt @@ -49,7 +49,6 @@ add_CMakeOnly_test(TargetScope) add_CMakeOnly_test(find_library) add_CMakeOnly_test(find_path) -add_CMakeOnly_test(option) add_test(CMakeOnly.ProjectInclude ${CMAKE_CMAKE_COMMAND} -DTEST=ProjectInclude diff --git a/Tests/CMakeOnly/option/CMakeLists.txt b/Tests/CMakeOnly/option/CMakeLists.txt deleted file mode 100644 index d040fb5..0000000 --- a/Tests/CMakeOnly/option/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -cmake_minimum_required (VERSION 2.8) -project(OptionTest NONE) - -#Verify that normal variable take precedence over cache variables -option(OPT_LOCAL_VAR1 "TEST_VAR" ON) -set(OPT_LOCAL_VAR1 FALSE) -if(OPT_LOCAL_VAR1) - message(FATAL_ERROR "local variable didn't take precedence over cache variable") -endif() - -#Verify that option overwrites existing normal variable -set(OPT_LOCAL_VAR2 FALSE) -option(OPT_LOCAL_VAR2 "TEST_VAR" ON) -if(NOT OPT_LOCAL_VAR2) - message(FATAL_ERROR "option failed to overwrite existing normal variable") -endif() diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index daf3940..e55d97d 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -239,6 +239,7 @@ add_RunCMake_test(include_directories) add_RunCMake_test(include_guard) add_RunCMake_test(list) add_RunCMake_test(message) +add_RunCMake_test(option) add_RunCMake_test(project -DCMake_TEST_RESOURCES=${CMake_TEST_RESOURCES}) add_RunCMake_test(return) add_RunCMake_test(separate_arguments) diff --git a/Tests/RunCMake/option/CMP0077-NEW.cmake b/Tests/RunCMake/option/CMP0077-NEW.cmake new file mode 100644 index 0000000..d4c518b --- /dev/null +++ b/Tests/RunCMake/option/CMP0077-NEW.cmake @@ -0,0 +1,14 @@ + +#Verify that option DOESN'T overwrite existing normal variable when the policy +#is set to NEW +cmake_policy(SET CMP0077 NEW) +set(OPT_LOCAL_VAR FALSE) +option(OPT_LOCAL_VAR "TEST_VAR" ON) +if(OPT_LOCAL_VAR) + message(FATAL_ERROR "option failed to overwrite existing normal variable") +endif() + +get_property(_exists_in_cache CACHE OPT_LOCAL_VAR PROPERTY VALUE SET) +if(_exists_in_cache) + message(FATAL_ERROR "value should not exist in cache as it was already a local variable") +endif() diff --git a/Tests/RunCMake/option/CMP0077-OLD.cmake b/Tests/RunCMake/option/CMP0077-OLD.cmake new file mode 100644 index 0000000..4c52d4b --- /dev/null +++ b/Tests/RunCMake/option/CMP0077-OLD.cmake @@ -0,0 +1,9 @@ + +#Verify that option overwrites existing normal variable when the policy +#is set to OLD +cmake_policy(SET CMP0077 OLD) +set(OPT_LOCAL_VAR FALSE) +option(OPT_LOCAL_VAR "TEST_VAR" ON) +if(NOT OPT_LOCAL_VAR) + message(FATAL_ERROR "option failed to overwrite existing normal variable") +endif() diff --git a/Tests/RunCMake/option/CMP0077-WARN-stderr.txt b/Tests/RunCMake/option/CMP0077-WARN-stderr.txt new file mode 100644 index 0000000..0d02ffb --- /dev/null +++ b/Tests/RunCMake/option/CMP0077-WARN-stderr.txt @@ -0,0 +1,7 @@ +CMake Warning \(dev\) at CMP0077-WARN.cmake:5 \(option\): + Policy CMP0077 is not set: option\(\) honors normal variables. Run "cmake + --help-policy CMP0077" for policy details. Use the cmake_policy command to + set the policy and suppress this warning. + + For compatibility with older versions of CMake, option is clearing the + normal variable 'OPT_LOCAL_VAR'. diff --git a/Tests/RunCMake/option/CMP0077-WARN.cmake b/Tests/RunCMake/option/CMP0077-WARN.cmake new file mode 100644 index 0000000..7f99456 --- /dev/null +++ b/Tests/RunCMake/option/CMP0077-WARN.cmake @@ -0,0 +1,5 @@ + +#Verify that option overwrites existing normal variable when the policy +#is set to OLD +set(OPT_LOCAL_VAR FALSE) +option(OPT_LOCAL_VAR "TEST_VAR" ON) diff --git a/Tests/RunCMake/option/CMakeLists.txt b/Tests/RunCMake/option/CMakeLists.txt new file mode 100644 index 0000000..11dc49a --- /dev/null +++ b/Tests/RunCMake/option/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.12) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/option/RunCMakeTest.cmake b/Tests/RunCMake/option/RunCMakeTest.cmake new file mode 100644 index 0000000..0501624 --- /dev/null +++ b/Tests/RunCMake/option/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0077-OLD) +run_cmake(CMP0077-NEW) +run_cmake(CMP0077-WARN) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=12e6f83319d089b3295b4211d0d4810575e8f7d5 commit 12e6f83319d089b3295b4211d0d4810575e8f7d5 Author: Robert Maynard AuthorDate: Thu Jun 21 14:52:12 2018 -0400 Commit: Robert Maynard CommitDate: Thu Jun 21 14:52:12 2018 -0400 Option: Add a test that verifies interaction with normal variables diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt index 204d54c..8a3a83b 100644 --- a/Tests/CMakeOnly/CMakeLists.txt +++ b/Tests/CMakeOnly/CMakeLists.txt @@ -49,6 +49,7 @@ add_CMakeOnly_test(TargetScope) add_CMakeOnly_test(find_library) add_CMakeOnly_test(find_path) +add_CMakeOnly_test(option) add_test(CMakeOnly.ProjectInclude ${CMAKE_CMAKE_COMMAND} -DTEST=ProjectInclude diff --git a/Tests/CMakeOnly/option/CMakeLists.txt b/Tests/CMakeOnly/option/CMakeLists.txt new file mode 100644 index 0000000..d040fb5 --- /dev/null +++ b/Tests/CMakeOnly/option/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required (VERSION 2.8) +project(OptionTest NONE) + +#Verify that normal variable take precedence over cache variables +option(OPT_LOCAL_VAR1 "TEST_VAR" ON) +set(OPT_LOCAL_VAR1 FALSE) +if(OPT_LOCAL_VAR1) + message(FATAL_ERROR "local variable didn't take precedence over cache variable") +endif() + +#Verify that option overwrites existing normal variable +set(OPT_LOCAL_VAR2 FALSE) +option(OPT_LOCAL_VAR2 "TEST_VAR" ON) +if(NOT OPT_LOCAL_VAR2) + message(FATAL_ERROR "option failed to overwrite existing normal variable") +endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5bb3d40a289c44f350aa68f32e5ef0c1ad7f13b1 commit 5bb3d40a289c44f350aa68f32e5ef0c1ad7f13b1 Author: Robert Maynard AuthorDate: Mon Jun 18 10:40:36 2018 -0400 Commit: Robert Maynard CommitDate: Thu Jun 21 11:18:16 2018 -0400 cmOption: Remove VTK 4.0 workarounds CMake has no reason to have special logic to fix bad logic within VTK 4.0. diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index 00a2d2b..13bcd03 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -14,19 +14,7 @@ class cmExecutionStatus; bool cmOptionCommand::InitialPass(std::vector const& args, cmExecutionStatus&) { - bool argError = false; - if (args.size() < 2) { - argError = true; - } - // for VTK 4.0 we have to support the option command with more than 3 - // arguments if CMAKE_MINIMUM_REQUIRED_VERSION is not defined, if - // CMAKE_MINIMUM_REQUIRED_VERSION is defined, then we can have stricter - // checking. - if (this->Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION")) { - if (args.size() > 3) { - argError = true; - } - } + const bool argError = (args.size() < 2) || (args.size() > 3); if (argError) { std::string m = "called with incorrect number of arguments: "; m += cmJoin(args, " "); ----------------------------------------------------------------------- Summary of changes: Auxiliary/cmake-mode.el | 2 +- Help/command/option.rst | 4 +- Help/manual/cmake-policies.7.rst | 1 + Help/policy/CMP0077.rst | 16 ++++++ Help/release/dev/option-normal-variable.rst | 5 ++ Source/cmOptionCommand.cxx | 66 +++++++++++++++-------- Source/cmPolicies.h | 4 +- Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/option/CMP0077-NEW.cmake | 14 +++++ Tests/RunCMake/option/CMP0077-OLD.cmake | 9 ++++ Tests/RunCMake/option/CMP0077-WARN-stderr.txt | 7 +++ Tests/RunCMake/option/CMP0077-WARN.cmake | 5 ++ Tests/RunCMake/{CMP0053 => option}/CMakeLists.txt | 2 +- Tests/RunCMake/option/RunCMakeTest.cmake | 5 ++ 14 files changed, 115 insertions(+), 26 deletions(-) create mode 100644 Help/policy/CMP0077.rst create mode 100644 Help/release/dev/option-normal-variable.rst create mode 100644 Tests/RunCMake/option/CMP0077-NEW.cmake create mode 100644 Tests/RunCMake/option/CMP0077-OLD.cmake create mode 100644 Tests/RunCMake/option/CMP0077-WARN-stderr.txt create mode 100644 Tests/RunCMake/option/CMP0077-WARN.cmake copy Tests/RunCMake/{CMP0053 => option}/CMakeLists.txt (62%) create mode 100644 Tests/RunCMake/option/RunCMakeTest.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jul 10 00:05:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 10 Jul 2018 00:05:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc3-167-gbe69317 Message-ID: <20180710040505.2B3C211D6EC@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 be69317b971dd381fe771701aa9ed944416e26c6 (commit) from 8d478c0003cc9bb4836038fc1a27d3bbd40348d2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=be69317b971dd381fe771701aa9ed944416e26c6 commit be69317b971dd381fe771701aa9ed944416e26c6 Author: Kitware Robot AuthorDate: Tue Jul 10 00:01:07 2018 -0400 Commit: Kitware Robot CommitDate: Tue Jul 10 00:01:07 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4a05801..ceac5cb 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 12) -set(CMake_VERSION_PATCH 20180709) +set(CMake_VERSION_PATCH 20180710) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jul 10 10:15:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 10 Jul 2018 10:15:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc3-175-gd73ad4e Message-ID: <20180710141506.BA312FB64E@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 d73ad4ed8b55cae3cd87bc06e7baefddce36944e (commit) via c48129450864052160d061c6d7bd59f9044445a4 (commit) via 5f7886c52b8f06c6429c66c102af9f4afe72896c (commit) via eb2ee1dc7e82e7f89ccca024103bf64186a6d101 (commit) via 3b2ea092ef42f52434c9618023d3a7216bb43c98 (commit) via b771b2c3001e2137293de4197a8567e5cd9f6466 (commit) via de5a4653d73aa601af9d08c91d4de2e09c430c1e (commit) via 2f4075fa45a180dce701295dbabb131518652221 (commit) from be69317b971dd381fe771701aa9ed944416e26c6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d73ad4ed8b55cae3cd87bc06e7baefddce36944e commit d73ad4ed8b55cae3cd87bc06e7baefddce36944e Merge: c481294 eb2ee1d Author: Brad King AuthorDate: Tue Jul 10 14:07:34 2018 +0000 Commit: Kitware Robot CommitDate: Tue Jul 10 10:07:39 2018 -0400 Merge topic 'skip_mfc_test' eb2ee1dc7e Tests: skip MFC test when building cmake when no file association for vcproj Acked-by: Kitware Robot Merge-request: !2196 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c48129450864052160d061c6d7bd59f9044445a4 commit c48129450864052160d061c6d7bd59f9044445a4 Merge: 5f7886c de5a465 Author: Brad King AuthorDate: Tue Jul 10 14:06:47 2018 +0000 Commit: Kitware Robot CommitDate: Tue Jul 10 10:06:53 2018 -0400 Merge topic 'uwp' de5a4653d7 Add WindowsPhone and WindowsStore platform modules for Clang/GNU C/CXX Acked-by: Kitware Robot Merge-request: !2197 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5f7886c52b8f06c6429c66c102af9f4afe72896c commit 5f7886c52b8f06c6429c66c102af9f4afe72896c Merge: be69317 3b2ea09 Author: Brad King AuthorDate: Tue Jul 10 14:06:00 2018 +0000 Commit: Kitware Robot CommitDate: Tue Jul 10 10:06:07 2018 -0400 Merge topic 'vs-deployment-files' 3b2ea092ef Help: Add documentation for DEPLOYMENT_ADDITIONAL_FILES b771b2c300 VS: extended OutputDeploymentDebuggerTool for AdditionalFiles 2f4075fa45 VS: moved EscapeForXML function higher up and made static Acked-by: Kitware Robot Merge-request: !2184 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=eb2ee1dc7e82e7f89ccca024103bf64186a6d101 commit eb2ee1dc7e82e7f89ccca024103bf64186a6d101 Author: Fred Baksik AuthorDate: Sat Jul 7 13:01:54 2018 -0400 Commit: Fred Baksik CommitDate: Mon Jul 9 11:29:54 2018 -0400 Tests: skip MFC test when building cmake when no file association for vcproj diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index b389a13..9200579 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1940,6 +1940,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release message(STATUS ".vcproj file association indicates VCExpress, avoiding MFC test") set(CTEST_RUN_MFC OFF) + elseif( NOT ov ) + message(STATUS + ".vcproj has no file association, avoiding MFC test") + set(CTEST_RUN_MFC OFF) endif() endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3b2ea092ef42f52434c9618023d3a7216bb43c98 commit 3b2ea092ef42f52434c9618023d3a7216bb43c98 Author: Frank Goyens AuthorDate: Mon Jul 2 10:35:26 2018 +0200 Commit: Brad King CommitDate: Mon Jul 9 07:39:39 2018 -0400 Help: Add documentation for DEPLOYMENT_ADDITIONAL_FILES diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 03a6a27..bebd591 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -173,6 +173,7 @@ Properties on Targets /prop_tgt/DEBUG_POSTFIX /prop_tgt/DEFINE_SYMBOL /prop_tgt/DEPLOYMENT_REMOTE_DIRECTORY + /prop_tgt/DEPLOYMENT_ADDITIONAL_FILES /prop_tgt/DOTNET_TARGET_FRAMEWORK_VERSION /prop_tgt/EchoString /prop_tgt/ENABLE_EXPORTS diff --git a/Help/prop_tgt/DEPLOYMENT_ADDITIONAL_FILES.rst b/Help/prop_tgt/DEPLOYMENT_ADDITIONAL_FILES.rst new file mode 100644 index 0000000..5e9c191 --- /dev/null +++ b/Help/prop_tgt/DEPLOYMENT_ADDITIONAL_FILES.rst @@ -0,0 +1,18 @@ +DEPLOYMENT_ADDITIONAL_FILES +--------------------------- + +Set the WinCE project ``AdditionalFiles`` in ``DeploymentTool`` in ``.vcproj`` +files generated by the :generator:`Visual Studio 9 2008` generator. +This is useful when you want to debug on remote WinCE device. +Specify additional files that will be copied to the device. +For example: + +.. code-block:: cmake + + set_property(TARGET ${TARGET} PROPERTY + DEPLOYMENT_ADDITIONAL_FILES "english.lng|local_folder|remote_folder|0" + "german.lng|local_folder|remote_folder|0") + +produces:: + + diff --git a/Help/release/dev/vs-deployment-files.rst b/Help/release/dev/vs-deployment-files.rst new file mode 100644 index 0000000..1590ed9 --- /dev/null +++ b/Help/release/dev/vs-deployment-files.rst @@ -0,0 +1,7 @@ +vs-deployment-files +------------------- + +* The :prop_tgt:`DEPLOYMENT_ADDITIONAL_FILES` target property was + added to tell the :generator:`Visual Studio 9 2008` generator + to specify additional files for deployment to WinCE devices + for remote debugging. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b771b2c3001e2137293de4197a8567e5cd9f6466 commit b771b2c3001e2137293de4197a8567e5cd9f6466 Author: Frank Goyens AuthorDate: Fri Jun 29 15:41:41 2018 +0200 Commit: Brad King CommitDate: Mon Jul 9 07:39:39 2018 -0400 VS: extended OutputDeploymentDebuggerTool for AdditionalFiles The `OutputDeploymentDebuggerTool` function now also retrieves a target property that is used for setting the `AdditionalFiles` attribute of `DeploymentTool`. diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 2c1a95c..c90c5b8 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1245,30 +1245,44 @@ static std::string cmLocalVisualStudio7GeneratorEscapeForXML( return ret; } +static std::string GetEscapedPropertyIfValueNotNULL(const char* propertyValue) +{ + return propertyValue == nullptr + ? std::string() + : cmLocalVisualStudio7GeneratorEscapeForXML(propertyValue); +} + void cmLocalVisualStudio7Generator::OutputDeploymentDebuggerTool( std::ostream& fout, std::string const& config, cmGeneratorTarget* target) { if (this->WindowsCEProject) { - if (const char* dir = target->GetProperty("DEPLOYMENT_REMOTE_DIRECTORY")) { - /* clang-format off */ - fout << - "\t\t\tEscapeForXML(dir) << "\"\n" - "\t\t\t\tRegisterOutput=\"0\"\n" - "\t\t\t\tAdditionalFiles=\"\"/>\n" - ; - /* clang-format on */ + const char* dir = target->GetProperty("DEPLOYMENT_REMOTE_DIRECTORY"); + const char* additionalFiles = + target->GetProperty("DEPLOYMENT_ADDITIONAL_FILES"); + + if (dir == nullptr && additionalFiles == nullptr) { + return; + } + + fout << "\t\t\t\n"; + + if (dir != nullptr) { std::string const exe = dir + std::string("\\") + target->GetFullName(config); - /* clang-format off */ - fout << - "\t\t\tEscapeForXML(exe) << "\"\n" - "\t\t\t\tArguments=\"\"\n" - "\t\t\t/>\n" - ; - /* clang-format on */ + + fout << "\t\t\tEscapeForXML(exe) + << "\"\n" + "\t\t\t\tArguments=\"\"\n" + "\t\t\t/>\n"; } } } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=de5a4653d73aa601af9d08c91d4de2e09c430c1e commit de5a4653d73aa601af9d08c91d4de2e09c430c1e Author: Martin Storsj? AuthorDate: Sun Jul 1 23:16:00 2018 +0300 Commit: Martin Storsj? CommitDate: Sun Jul 8 00:06:37 2018 +0300 Add WindowsPhone and WindowsStore platform modules for Clang/GNU C/CXX Just like the existing WindowsPhone and WindowsStore platform modules for MSVC, just include the corresponding Windows platform modules. MinGW tools (both with GCC and Clang) can be used for building for Windows Store, even though it isn't a very common or simple setup. diff --git a/Modules/Platform/WindowsPhone-Clang-C.cmake b/Modules/Platform/WindowsPhone-Clang-C.cmake new file mode 100644 index 0000000..6e38572 --- /dev/null +++ b/Modules/Platform/WindowsPhone-Clang-C.cmake @@ -0,0 +1 @@ +include(Platform/Windows-Clang-C) diff --git a/Modules/Platform/WindowsPhone-Clang-CXX.cmake b/Modules/Platform/WindowsPhone-Clang-CXX.cmake new file mode 100644 index 0000000..bf47978 --- /dev/null +++ b/Modules/Platform/WindowsPhone-Clang-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Windows-Clang-CXX) diff --git a/Modules/Platform/WindowsPhone-GNU-C.cmake b/Modules/Platform/WindowsPhone-GNU-C.cmake new file mode 100644 index 0000000..ff6acd5 --- /dev/null +++ b/Modules/Platform/WindowsPhone-GNU-C.cmake @@ -0,0 +1 @@ +include(Platform/Windows-GNU-C) diff --git a/Modules/Platform/WindowsPhone-GNU-CXX.cmake b/Modules/Platform/WindowsPhone-GNU-CXX.cmake new file mode 100644 index 0000000..6adab6a --- /dev/null +++ b/Modules/Platform/WindowsPhone-GNU-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Windows-GNU-CXX) diff --git a/Modules/Platform/WindowsStore-Clang-C.cmake b/Modules/Platform/WindowsStore-Clang-C.cmake new file mode 100644 index 0000000..6e38572 --- /dev/null +++ b/Modules/Platform/WindowsStore-Clang-C.cmake @@ -0,0 +1 @@ +include(Platform/Windows-Clang-C) diff --git a/Modules/Platform/WindowsStore-Clang-CXX.cmake b/Modules/Platform/WindowsStore-Clang-CXX.cmake new file mode 100644 index 0000000..bf47978 --- /dev/null +++ b/Modules/Platform/WindowsStore-Clang-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Windows-Clang-CXX) diff --git a/Modules/Platform/WindowsStore-GNU-C.cmake b/Modules/Platform/WindowsStore-GNU-C.cmake new file mode 100644 index 0000000..ff6acd5 --- /dev/null +++ b/Modules/Platform/WindowsStore-GNU-C.cmake @@ -0,0 +1 @@ +include(Platform/Windows-GNU-C) diff --git a/Modules/Platform/WindowsStore-GNU-CXX.cmake b/Modules/Platform/WindowsStore-GNU-CXX.cmake new file mode 100644 index 0000000..6adab6a --- /dev/null +++ b/Modules/Platform/WindowsStore-GNU-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Windows-GNU-CXX) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2f4075fa45a180dce701295dbabb131518652221 commit 2f4075fa45a180dce701295dbabb131518652221 Author: Frank Goyens AuthorDate: Fri Jun 29 15:39:52 2018 +0200 Commit: Brad King CommitDate: Fri Jul 6 11:30:23 2018 -0400 VS: moved EscapeForXML function higher up and made static diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 4b0b66d..2c1a95c 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1233,6 +1233,18 @@ void cmLocalVisualStudio7Generator::OutputBuildTool( } } +static std::string cmLocalVisualStudio7GeneratorEscapeForXML( + const std::string& s) +{ + std::string ret = s; + cmSystemTools::ReplaceString(ret, "&", "&"); + cmSystemTools::ReplaceString(ret, "\"", """); + cmSystemTools::ReplaceString(ret, "<", "<"); + cmSystemTools::ReplaceString(ret, ">", ">"); + cmSystemTools::ReplaceString(ret, "\n", " "); + return ret; +} + void cmLocalVisualStudio7Generator::OutputDeploymentDebuggerTool( std::ostream& fout, std::string const& config, cmGeneratorTarget* target) { @@ -2056,17 +2068,6 @@ void cmLocalVisualStudio7Generator::WriteVCProjFooter( << "\n"; } -std::string cmLocalVisualStudio7GeneratorEscapeForXML(const std::string& s) -{ - std::string ret = s; - cmSystemTools::ReplaceString(ret, "&", "&"); - cmSystemTools::ReplaceString(ret, "\"", """); - cmSystemTools::ReplaceString(ret, "<", "<"); - cmSystemTools::ReplaceString(ret, ">", ">"); - cmSystemTools::ReplaceString(ret, "\n", " "); - return ret; -} - std::string cmLocalVisualStudio7Generator::EscapeForXML(const std::string& s) { return cmLocalVisualStudio7GeneratorEscapeForXML(s); ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-properties.7.rst | 1 + Help/prop_tgt/DEPLOYMENT_ADDITIONAL_FILES.rst | 18 +++++++ Help/release/dev/vs-deployment-files.rst | 7 +++ Modules/Platform/WindowsPhone-Clang-C.cmake | 1 + Modules/Platform/WindowsPhone-Clang-CXX.cmake | 1 + Modules/Platform/WindowsPhone-GNU-C.cmake | 1 + Modules/Platform/WindowsPhone-GNU-CXX.cmake | 1 + Modules/Platform/WindowsStore-Clang-C.cmake | 1 + Modules/Platform/WindowsStore-Clang-CXX.cmake | 1 + Modules/Platform/WindowsStore-GNU-C.cmake | 1 + Modules/Platform/WindowsStore-GNU-CXX.cmake | 1 + Source/cmLocalVisualStudio7Generator.cxx | 73 ++++++++++++++++----------- Tests/CMakeLists.txt | 4 ++ 13 files changed, 82 insertions(+), 29 deletions(-) create mode 100644 Help/prop_tgt/DEPLOYMENT_ADDITIONAL_FILES.rst create mode 100644 Help/release/dev/vs-deployment-files.rst create mode 100644 Modules/Platform/WindowsPhone-Clang-C.cmake create mode 100644 Modules/Platform/WindowsPhone-Clang-CXX.cmake create mode 100644 Modules/Platform/WindowsPhone-GNU-C.cmake create mode 100644 Modules/Platform/WindowsPhone-GNU-CXX.cmake create mode 100644 Modules/Platform/WindowsStore-Clang-C.cmake create mode 100644 Modules/Platform/WindowsStore-Clang-CXX.cmake create mode 100644 Modules/Platform/WindowsStore-GNU-C.cmake create mode 100644 Modules/Platform/WindowsStore-GNU-CXX.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jul 10 11:15:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 10 Jul 2018 11:15:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc3-179-g500dac1 Message-ID: <20180710151504.267A3112512@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 500dac1f252948eab9edb096c7537134a74b9c9b (commit) via 546757982841c889a3332623c17610f55a22397c (commit) via f974000d93798af1e3bd183985ec6f5159664f76 (commit) via 741fd1c773fc1208d4001669f737564a67a82c05 (commit) from d73ad4ed8b55cae3cd87bc06e7baefddce36944e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=500dac1f252948eab9edb096c7537134a74b9c9b commit 500dac1f252948eab9edb096c7537134a74b9c9b Merge: 5467579 f974000 Author: Brad King AuthorDate: Tue Jul 10 11:06:05 2018 -0400 Commit: Brad King CommitDate: Tue Jul 10 11:06:05 2018 -0400 Merge branch 'release-3.12' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=546757982841c889a3332623c17610f55a22397c commit 546757982841c889a3332623c17610f55a22397c Merge: d73ad4e 741fd1c Author: Brad King AuthorDate: Tue Jul 10 15:04:57 2018 +0000 Commit: Kitware Robot CommitDate: Tue Jul 10 11:05:13 2018 -0400 Merge topic 'document_object_library_as_a_property_type' 741fd1c773 Help: Add OBJECT_LIBRARY to TYPE target property documentation Acked-by: Kitware Robot Merge-request: !2199 ----------------------------------------------------------------------- Summary of changes: Help/prop_tgt/TYPE.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jul 10 11:15:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 10 Jul 2018 11:15:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.12.0-rc3-2-gf974000 Message-ID: <20180710151504.3829D11277E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via f974000d93798af1e3bd183985ec6f5159664f76 (commit) via 741fd1c773fc1208d4001669f737564a67a82c05 (commit) from 7f1569d2d8c1a647cf4d1b0696834952cf8f00fb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Help/prop_tgt/TYPE.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jul 11 00:05:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 11 Jul 2018 00:05:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc3-180-g0723ead Message-ID: <20180711040504.A20B211E3A1@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 0723eada4dcdb4332a63c56e1df6160f19cb9ff5 (commit) from 500dac1f252948eab9edb096c7537134a74b9c9b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0723eada4dcdb4332a63c56e1df6160f19cb9ff5 commit 0723eada4dcdb4332a63c56e1df6160f19cb9ff5 Author: Kitware Robot AuthorDate: Wed Jul 11 00:01:06 2018 -0400 Commit: Kitware Robot CommitDate: Wed Jul 11 00:01:06 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ceac5cb..da7125f 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 12) -set(CMake_VERSION_PATCH 20180710) +set(CMake_VERSION_PATCH 20180711) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jul 11 07:25:08 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 11 Jul 2018 07:25:08 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc3-187-gf2c651a Message-ID: <20180711112509.2444711DA7B@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 f2c651aec9782e5913db7ad21b88d2dcde5c359d (commit) via cd7fad9cf36af521191f59cc3a9fcf6916703ca8 (commit) via 7eb701d98b68768ffefc2f219896602368ea414a (commit) via b872f5b303efab154d740168fe9dd995850559d2 (commit) via a353d10a7549be2e40977cf239058902e5baf2d8 (commit) via 7c32432a8088298c6c7d8e40fb095fafc1f107c1 (commit) via 3599b314745aeb7abb109737536f573c2c310f6a (commit) from 0723eada4dcdb4332a63c56e1df6160f19cb9ff5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f2c651aec9782e5913db7ad21b88d2dcde5c359d commit f2c651aec9782e5913db7ad21b88d2dcde5c359d Merge: cd7fad9 b872f5b Author: Brad King AuthorDate: Wed Jul 11 11:22:25 2018 +0000 Commit: Kitware Robot CommitDate: Wed Jul 11 07:22:35 2018 -0400 Merge topic 'file-STRINGS-isprint' b872f5b303 file(STRINGS): Use isprint() to test character type Acked-by: Kitware Robot Merge-request: !2198 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cd7fad9cf36af521191f59cc3a9fcf6916703ca8 commit cd7fad9cf36af521191f59cc3a9fcf6916703ca8 Merge: 7eb701d a353d10 Author: Brad King AuthorDate: Wed Jul 11 11:21:44 2018 +0000 Commit: Kitware Robot CommitDate: Wed Jul 11 07:22:05 2018 -0400 Merge topic 'implicit-link-CMP0054' a353d10a75 Protect implicit link library extraction with policy CMP0054 Acked-by: Kitware Robot Merge-request: !2201 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7eb701d98b68768ffefc2f219896602368ea414a commit 7eb701d98b68768ffefc2f219896602368ea414a Merge: 0723ead 7c32432 Author: Brad King AuthorDate: Wed Jul 11 11:21:31 2018 +0000 Commit: Kitware Robot CommitDate: Wed Jul 11 07:21:37 2018 -0400 Merge topic 'update-kwsys' 7c32432a80 Merge branch 'upstream-KWSys' into update-kwsys 3599b31474 KWSys 2018-07-10 (51982681) Acked-by: Kitware Robot Merge-request: !2200 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b872f5b303efab154d740168fe9dd995850559d2 commit b872f5b303efab154d740168fe9dd995850559d2 Author: Devin Nakamura AuthorDate: Mon Jul 9 14:39:25 2018 -0400 Commit: Brad King CommitDate: Tue Jul 10 13:57:07 2018 -0400 file(STRINGS): Use isprint() to test character type Use the more portable `isprint()` function to test characters rather than using hard-coded hex values. The function is documented by the C++ standard to return non-zero for the exact range of hex values we previously hard-coded, so this should not change behavior. diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index e39630e..4c288f5 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -10,6 +10,7 @@ #include #include +#include #include // IWYU pragma: keep #include #include @@ -609,8 +610,8 @@ bool cmFileCommand::HandleStringsCommand(std::vector const& args) continue; } - if ((c >= 0x20 && c < 0x7F) || c == '\t' || - (c == '\n' && newline_consume)) { + if (c >= 0 && c <= 0xFF && + (isprint(c) || c == '\t' || (c == '\n' && newline_consume))) { // This is an ASCII character that may be part of a string. // Cast added to avoid compiler warning. Cast is ok because // c is guaranteed to fit in char by the above if... https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a353d10a7549be2e40977cf239058902e5baf2d8 commit a353d10a7549be2e40977cf239058902e5baf2d8 Author: Brad King AuthorDate: Tue Jul 10 09:25:10 2018 -0400 Commit: Brad King CommitDate: Tue Jul 10 09:31:24 2018 -0400 Protect implicit link library extraction with policy CMP0054 CMakeParseImplicitLinkInfo tests arbitrary content with `if(MATCHES)`. Set policy CMP0054 to ensure the line content is never interpreted as a variable reference (which may also produce a CMP0054 warning). While at it, also set policy CMP0053 to improve performance. diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake index 935f92d..30659eb 100644 --- a/Modules/CMakeParseImplicitLinkInfo.cmake +++ b/Modules/CMakeParseImplicitLinkInfo.cmake @@ -1,6 +1,9 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. +cmake_policy(PUSH) +cmake_policy(SET CMP0053 NEW) +cmake_policy(SET CMP0054 NEW) # Function parse implicit linker options. # This is used internally by CMake and should not be included by user @@ -185,3 +188,5 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj set(${fwk_var} "${implicit_fwks}" PARENT_SCOPE) set(${log_var} "${log}" PARENT_SCOPE) endfunction() + +cmake_policy(POP) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7c32432a8088298c6c7d8e40fb095fafc1f107c1 commit 7c32432a8088298c6c7d8e40fb095fafc1f107c1 Merge: be69317 3599b31 Author: Brad King AuthorDate: Tue Jul 10 08:46:37 2018 -0400 Commit: Brad King CommitDate: Tue Jul 10 08:46:37 2018 -0400 Merge branch 'upstream-KWSys' into update-kwsys * upstream-KWSys: KWSys 2018-07-10 (51982681) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3599b314745aeb7abb109737536f573c2c310f6a commit 3599b314745aeb7abb109737536f573c2c310f6a Author: KWSys Upstream AuthorDate: Tue Jul 10 08:37:49 2018 -0400 Commit: Brad King CommitDate: Tue Jul 10 08:46:35 2018 -0400 KWSys 2018-07-10 (51982681) Code extracted from: https://gitlab.kitware.com/utils/kwsys.git at commit 5198268138295f67c567c04f4cb0c0f3fdfebef4 (master). Upstream Shortlog ----------------- Brad King (1): aebe4597 XL: Restore suppression of infinite loop warning in process test diff --git a/CMakeLists.txt b/CMakeLists.txt index 96088c8..516104b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1193,13 +1193,17 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) # Some Apple compilers produce bad optimizations in this source. IF(APPLE AND CMAKE_C_COMPILER_ID MATCHES "^(GNU|LLVM)$") SET(testProcess_COMPILE_FLAGS "${testProcess_COMPILE_FLAGS} -O0") - ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "XL" AND - NOT (CMAKE_SYSTEM MATCHES "Linux.*ppc64le" AND - NOT CMAKE_C_COMPILER_VERSION VERSION_LESS "13.1.1")) + ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "XL") # Tell IBM XL not to warn about our test infinite loop - # v13.1.1 and newer on Linux ppc64le is clang based and does not accept - # the -qsuppress option - SET(testProcess_COMPILE_FLAGS "${testProcess_COMPILE_FLAGS} -qsuppress=1500-010") + IF(CMAKE_SYSTEM MATCHES "Linux.*ppc64le" + AND CMAKE_C_COMPILER_VERSION VERSION_LESS "16.1.0" + AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS "13.1.1") + # v13.1.[1-6] on Linux ppc64le is clang based and does not accept + # the -qsuppress option, so just suppress all warnings. + SET(testProcess_COMPILE_FLAGS "${testProcess_COMPILE_FLAGS} -w") + ELSE() + SET(testProcess_COMPILE_FLAGS "${testProcess_COMPILE_FLAGS} -qsuppress=1500-010") + ENDIF() ENDIF() IF(CMAKE_C_FLAGS MATCHES "-fsanitize=") SET(testProcess_COMPILE_FLAGS "${testProcess_COMPILE_FLAGS} -DCRASH_USING_ABORT") ----------------------------------------------------------------------- Summary of changes: Modules/CMakeParseImplicitLinkInfo.cmake | 5 +++++ Source/cmFileCommand.cxx | 5 +++-- Source/kwsys/CMakeLists.txt | 16 ++++++++++------ 3 files changed, 18 insertions(+), 8 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jul 12 00:05:03 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 12 Jul 2018 00:05:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc3-188-g05cd831 Message-ID: <20180712040503.6312D11E2B0@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 05cd8311ab52cf1e1ca40701c092602fe51cfbe4 (commit) from f2c651aec9782e5913db7ad21b88d2dcde5c359d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=05cd8311ab52cf1e1ca40701c092602fe51cfbe4 commit 05cd8311ab52cf1e1ca40701c092602fe51cfbe4 Author: Kitware Robot AuthorDate: Thu Jul 12 00:01:05 2018 -0400 Commit: Kitware Robot CommitDate: Thu Jul 12 00:01:05 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index da7125f..9086fb2 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 12) -set(CMake_VERSION_PATCH 20180711) +set(CMake_VERSION_PATCH 20180712) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jul 12 09:15:09 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 12 Jul 2018 09:15:09 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc3-190-g7b04ad6 Message-ID: <20180712131509.1AB19103369@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 7b04ad61cf925161c8b7f9abf6ef3db047118807 (commit) via f8a7cf85ad7ff9ed01987d5845dad46c395ac4fa (commit) from 05cd8311ab52cf1e1ca40701c092602fe51cfbe4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7b04ad61cf925161c8b7f9abf6ef3db047118807 commit 7b04ad61cf925161c8b7f9abf6ef3db047118807 Merge: 05cd831 f8a7cf8 Author: Brad King AuthorDate: Thu Jul 12 13:12:15 2018 +0000 Commit: Kitware Robot CommitDate: Thu Jul 12 09:12:26 2018 -0400 Merge topic 'option_respects_existing_stack_variable' f8a7cf85ad option: No CMP077 warnings when both cache and local variable exists Acked-by: Kitware Robot Merge-request: !2203 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f8a7cf85ad7ff9ed01987d5845dad46c395ac4fa commit f8a7cf85ad7ff9ed01987d5845dad46c395ac4fa Author: Robert Maynard AuthorDate: Tue Jul 10 13:56:15 2018 -0400 Commit: Robert Maynard CommitDate: Tue Jul 10 13:56:15 2018 -0400 option: No CMP077 warnings when both cache and local variable exists Previously we would warn when the local and cache version of a variable exists, but this use case doesn't need a warning as it maintains backwards compatibility. diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index 4ab0e96..239cd00 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -28,32 +28,28 @@ bool cmOptionCommand::InitialPass(std::vector const& args, } // Determine the state of the option policy - auto status = this->Makefile->GetPolicyStatus(cmPolicies::CMP0077); - const char* exists = - this->Makefile->GetStateSnapshot().GetDefinition(args[0]); - switch (status) { - case cmPolicies::WARN: - if (exists) { - std::ostringstream w; - w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0077) - << "\n" - "For compatibility with older versions of CMake, option " - "is clearing the normal variable '" - << args[0] << "'."; - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); - } - case cmPolicies::OLD: - // OLD behavior does not warn. - break; - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::REQUIRED_IF_USED: - case cmPolicies::NEW: { - // See if a local variable with this name already exists. - // If so we ignore the option command. - if (exists) { - return true; - } - } break; + bool checkAndWarn = false; + { + auto status = this->Makefile->GetPolicyStatus(cmPolicies::CMP0077); + const char* existsBeforeSet = + this->Makefile->GetStateSnapshot().GetDefinition(args[0]); + switch (status) { + case cmPolicies::WARN: + checkAndWarn = (existsBeforeSet != nullptr); + break; + case cmPolicies::OLD: + // OLD behavior does not warn. + break; + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::NEW: { + // See if a local variable with this name already exists. + // If so we ignore the option command. + if (existsBeforeSet) { + return true; + } + } break; + } } // See if a cache variable with this name already exists @@ -74,5 +70,19 @@ bool cmOptionCommand::InitialPass(std::vector const& args, bool init = cmSystemTools::IsOn(initialValue.c_str()); this->Makefile->AddCacheDefinition(args[0], init ? "ON" : "OFF", args[1].c_str(), cmStateEnums::BOOL); + + if (checkAndWarn) { + const char* existsAfterSet = + this->Makefile->GetStateSnapshot().GetDefinition(args[0]); + if (!existsAfterSet) { + std::ostringstream w; + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0077) + << "\n" + "For compatibility with older versions of CMake, option " + "is clearing the normal variable '" + << args[0] << "'."; + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + } + } return true; } diff --git a/Tests/RunCMake/option/CMP0077-SECOND-PASS.cmake b/Tests/RunCMake/option/CMP0077-SECOND-PASS.cmake new file mode 100644 index 0000000..f62a853 --- /dev/null +++ b/Tests/RunCMake/option/CMP0077-SECOND-PASS.cmake @@ -0,0 +1,14 @@ + +#Verify that when both a cache and local version of a value exist that CMake +#doesn't produce a CMP0077 warning and that we get the expected values. +option(OPT_LOCAL_VAR "TEST_VAR" ON) +set(OPT_LOCAL_VAR FALSE) +option(OPT_LOCAL_VAR "TEST_VAR" ON) +if(OPT_LOCAL_VAR) + message(FATAL_ERROR "option improperly set a cache variable that already exists") +endif() + +get_property(_exists_in_cache CACHE OPT_LOCAL_VAR PROPERTY VALUE SET) +if(NOT _exists_in_cache) + message(FATAL_ERROR "value should exist in cache") +endif() diff --git a/Tests/RunCMake/option/RunCMakeTest.cmake b/Tests/RunCMake/option/RunCMakeTest.cmake index 0501624..979afa1 100644 --- a/Tests/RunCMake/option/RunCMakeTest.cmake +++ b/Tests/RunCMake/option/RunCMakeTest.cmake @@ -3,3 +3,4 @@ include(RunCMake) run_cmake(CMP0077-OLD) run_cmake(CMP0077-NEW) run_cmake(CMP0077-WARN) +run_cmake(CMP0077-SECOND-PASS) ----------------------------------------------------------------------- Summary of changes: Source/cmOptionCommand.cxx | 62 ++++++++++++++----------- Tests/RunCMake/option/CMP0077-SECOND-PASS.cmake | 14 ++++++ Tests/RunCMake/option/RunCMakeTest.cmake | 1 + 3 files changed, 51 insertions(+), 26 deletions(-) create mode 100644 Tests/RunCMake/option/CMP0077-SECOND-PASS.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jul 12 09:25:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 12 Jul 2018 09:25:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc3-200-gf7f2b80 Message-ID: <20180712132505.307BD11DDD6@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 f7f2b8078e6181f0f3c476c55d7cab3d86ffdaae (commit) via f6f5f9f75f809a077ac3f451745904d9f3faaa85 (commit) via e014df762b41e61b423e56637667a050be3a78e7 (commit) via ce4f20ba62a3c7e0dd78cffc1669a400311f057e (commit) via 281c601024e7a82f85ef02ce00a0fc5686c5412d (commit) via 01c98c6cccc5a4d5c9faaf524da92590492e9976 (commit) via bb77dc0cee95b2606ab6715aa9babc89c09d176f (commit) via f80692cf600675bae4d12810c8119a62e76aa701 (commit) via a37a4a00c8b8982c89ffc99505de097d3b2d7300 (commit) via 5d40d2b44fe93e223bd7802797b4cd430656790e (commit) from 7b04ad61cf925161c8b7f9abf6ef3db047118807 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f7f2b8078e6181f0f3c476c55d7cab3d86ffdaae commit f7f2b8078e6181f0f3c476c55d7cab3d86ffdaae Merge: f6f5f9f e014df7 Author: Brad King AuthorDate: Thu Jul 12 13:15:15 2018 +0000 Commit: Kitware Robot CommitDate: Thu Jul 12 09:15:58 2018 -0400 Merge topic 'qnx_fix' e014df762b QNX: Fix autogen compiler predefines detection Acked-by: Kitware Robot Merge-request: !2205 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f6f5f9f75f809a077ac3f451745904d9f3faaa85 commit f6f5f9f75f809a077ac3f451745904d9f3faaa85 Merge: 7b04ad6 ce4f20b Author: Brad King AuthorDate: Thu Jul 12 13:14:58 2018 +0000 Commit: Kitware Robot CommitDate: Thu Jul 12 09:15:18 2018 -0400 Merge topic 'ghs' ce4f20ba62 GHS: Add release notes 281c601024 GHS: Update default BSP name 01c98c6ccc GHS: Update setting default OS location for Integrity platforms bb77dc0cee GHS: Set primary target using arch/platform values (or user specified value) f80692cf60 GHS: Add platform selection support a37a4a00c8 GHS: Add toolset selection support 5d40d2b44f GHS: Support ARM, PPC, 86 architectures Acked-by: Kitware Robot Acked-by: Matt Soucy Merge-request: !798 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e014df762b41e61b423e56637667a050be3a78e7 commit e014df762b41e61b423e56637667a050be3a78e7 Author: Cristian Adam AuthorDate: Wed Jul 11 15:45:40 2018 +0200 Commit: Brad King CommitDate: Wed Jul 11 09:54:49 2018 -0400 QNX: Fix autogen compiler predefines detection In commit v3.12.0-rc1~20^2 (Move GNU COMPILER_PREDEFINES_COMMAND from Platform to Compiler, 2018-06-01), `Compiler/GNU.cmake` introduced the `-dM` flag, which requires `-Wp` prefix for the QNX compiler wrapper. diff --git a/Modules/Compiler/QCC.cmake b/Modules/Compiler/QCC.cmake index 0da7050..a5e2b0b 100644 --- a/Modules/Compiler/QCC.cmake +++ b/Modules/Compiler/QCC.cmake @@ -16,6 +16,8 @@ macro(__compiler_qcc lang) set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE NO) set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER NO) + set(CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "${CMAKE_${lang}_COMPILER}" "-Wp,-dM" "-E" "-c" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp") + unset(CMAKE_${lang}_COMPILE_OPTIONS_IPO) unset(CMAKE_${lang}_ARCHIVE_CREATE_IPO) unset(CMAKE_${lang}_ARCHIVE_APPEND_IPO) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ce4f20ba62a3c7e0dd78cffc1669a400311f057e commit ce4f20ba62a3c7e0dd78cffc1669a400311f057e Author: Fred Baksik AuthorDate: Sat Jul 7 07:27:22 2018 -0400 Commit: Fred Baksik CommitDate: Wed Jul 11 08:48:25 2018 -0400 GHS: Add release notes diff --git a/Help/release/dev/ghs.rst b/Help/release/dev/ghs.rst new file mode 100644 index 0000000..d3bec95 --- /dev/null +++ b/Help/release/dev/ghs.rst @@ -0,0 +1,20 @@ +ghs +--- + +* The :generator:`Green Hills MULTI` generator is updated: + + - Added support for architecture selection through + :variable:`CMAKE_GENERATOR_PLATFORM`: + e.g. ``arm``, ``ppc``, and ``86``. + + - Added support for toolset selection through + :variable:`CMAKE_GENERATOR_TOOLSET`, + e.g. ``comp_201205``, ``comp_201510``, ``comp_201722_beta``. + + - Added support for platform selection through ``GHS_TARGET_PLATFORM``, + e.g. ``integrity``, ``linux``, ``standalone``, etc. + + - No longer checks that ``arm`` based compilers are installed but ensures + that the correct ``gbuild.exe`` exists. + + - No longer hard-codes ARM files, BSP, toolset, or OS locations. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=281c601024e7a82f85ef02ce00a0fc5686c5412d commit 281c601024e7a82f85ef02ce00a0fc5686c5412d Author: Fred Baksik AuthorDate: Sat Jul 7 07:27:22 2018 -0400 Commit: Fred Baksik CommitDate: Wed Jul 11 08:48:23 2018 -0400 GHS: Update default BSP name -- Use default value of sim if not user defined -- Also no reason to trim quotes or changes slashes; it is just a name not a path diff --git a/Help/generator/Green Hills MULTI.rst b/Help/generator/Green Hills MULTI.rst index f148b4f..1b4960d 100644 --- a/Help/generator/Green Hills MULTI.rst +++ b/Help/generator/Green Hills MULTI.rst @@ -37,9 +37,12 @@ Default to ``C:/ghs``. Root path for RTOS searches. Default to latest platform OS installation at ``GHS_OS_ROOT``. Set this value if a specific RTOS is to be used. +* ``GHS_BSP_NAME`` + +Defaults to ``sim`` if not set by user. + Customizations are available through the following cache variables: -* ``GHS_BSP_NAME`` * ``GHS_CUSTOMIZATION`` * ``GHS_GPJ_MACROS`` diff --git a/Modules/Platform/GHS-MULTI-Initialize.cmake b/Modules/Platform/GHS-MULTI-Initialize.cmake index 62a7e9f..9b384df 100644 --- a/Modules/Platform/GHS-MULTI-Initialize.cmake +++ b/Modules/Platform/GHS-MULTI-Initialize.cmake @@ -37,7 +37,8 @@ if ( NOT GHS_OS_DIR ) endif () endif () -set(GHS_BSP_NAME "simarm" CACHE STRING "BSP name") +set(GHS_BSP_NAME "IGNORE" CACHE STRING "BSP name") + set(GHS_CUSTOMIZATION "" CACHE FILEPATH "optional GHS customization") mark_as_advanced(GHS_CUSTOMIZATION) set(GHS_GPJ_MACROS "" CACHE STRING "optional GHS macros generated in the .gpjs for legacy reasons") diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 17fac41..a9742c5 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -236,25 +236,28 @@ void cmGlobalGhsMultiGenerator::OpenBuildFileStream() this->OSDirRelative = true; } - char const* bspName = + std::string bspName; + char const* bspCache = this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME"); - if (NULL == bspName) { - bspName = ""; - cmSystemTools::Error("GHS_BSP_NAME cache variable must be set"); - } else { + if (bspCache) { + bspName = bspCache; this->GetCMakeInstance()->MarkCliAsUsed("GHS_BSP_NAME"); } - std::string fBspName(this->trimQuotes(bspName)); - std::replace(fBspName.begin(), fBspName.end(), '\\', '/'); + if (bspName.empty() || bspName.compare("IGNORE") == 0) { + const char* a = + this->GetCMakeInstance()->GetCacheDefinition("CMAKE_GENERATOR_PLATFORM"); + bspName = "sim"; + bspName += (a ? a : ""); + } + this->WriteMacros(); this->WriteHighLevelDirectives(); GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, this->GetBuildFileStream()); this->WriteDisclaimer(this->GetBuildFileStream()); *this->GetBuildFileStream() << "# Top Level Project File" << std::endl; - if (!fBspName.empty()) { - *this->GetBuildFileStream() << " -bsp " << fBspName << std::endl; - } + *this->GetBuildFileStream() << " -bsp " << bspName << std::endl; + this->WriteCompilerOptions(fOSDir); } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=01c98c6cccc5a4d5c9faaf524da92590492e9976 commit 01c98c6cccc5a4d5c9faaf524da92590492e9976 Author: Fred Baksik AuthorDate: Sat Jul 7 07:27:21 2018 -0400 Commit: Fred Baksik CommitDate: Wed Jul 11 08:46:26 2018 -0400 GHS: Update setting default OS location for Integrity platforms -- Update how the latest OS is determined; scan the location GHS_OS_ROOT and sort it No longer use registry settings looking for installations The registry values are assigned in installation order for Green Hills tools not version order Filter out files from the list of directories (i.e if int1234.zip and int1234 are both in root folder) diff --git a/Help/generator/Green Hills MULTI.rst b/Help/generator/Green Hills MULTI.rst index 7c2e643..f148b4f 100644 --- a/Help/generator/Green Hills MULTI.rst +++ b/Help/generator/Green Hills MULTI.rst @@ -28,12 +28,20 @@ Defaults to ``_.tgt``. Default to ``C:/ghs``. Root path for ``toolset``. +* ``GHS_OS_ROOT`` + +Default to ``C:/ghs``. Root path for RTOS searches. + +* ``GHS_OS_DIR`` + +Default to latest platform OS installation at ``GHS_OS_ROOT``. Set this value if +a specific RTOS is to be used. + Customizations are available through the following cache variables: * ``GHS_BSP_NAME`` * ``GHS_CUSTOMIZATION`` * ``GHS_GPJ_MACROS`` -* ``GHS_OS_DIR`` .. note:: This generator is deemed experimental as of CMake |release| diff --git a/Modules/Platform/GHS-MULTI-Initialize.cmake b/Modules/Platform/GHS-MULTI-Initialize.cmake index 0b7422c..62a7e9f 100644 --- a/Modules/Platform/GHS-MULTI-Initialize.cmake +++ b/Modules/Platform/GHS-MULTI-Initialize.cmake @@ -1,38 +1,42 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. +#Setup Green Hills MULTI specific compilation information -#Setup Greenhills MULTI specific compilation information - -if (NOT GHS_INT_DIRECTORY) - #Assume the C:/ghs/int#### directory that is latest is preferred - set(GHS_EXPECTED_ROOT "C:/ghs") - if (EXISTS ${GHS_EXPECTED_ROOT}) - FILE(GLOB GHS_CANDIDATE_INT_DIRS RELATIVE - ${GHS_EXPECTED_ROOT} ${GHS_EXPECTED_ROOT}/*) - string(REGEX MATCHALL "int[0-9][0-9][0-9][0-9a-z]" GHS_CANDIDATE_INT_DIRS - ${GHS_CANDIDATE_INT_DIRS}) - if (GHS_CANDIDATE_INT_DIRS) - list(SORT GHS_CANDIDATE_INT_DIRS) - list(GET GHS_CANDIDATE_INT_DIRS -1 GHS_INT_DIRECTORY) - string(CONCAT GHS_INT_DIRECTORY ${GHS_EXPECTED_ROOT} "/" - ${GHS_INT_DIRECTORY}) +set(GHS_OS_ROOT "C:/ghs" CACHE PATH "GHS platform OS search root directory") +mark_as_advanced(GHS_OS_ROOT) + +set(GHS_OS_DIR "NOTFOUND" CACHE PATH "GHS platform OS directory") +mark_as_advanced(GHS_OS_DIR) + +#set GHS_OS_DIR if not set by user +if ( NOT GHS_OS_DIR ) + if (EXISTS ${GHS_OS_ROOT}) + + #get all directories in root directory + FILE(GLOB GHS_CANDIDATE_OS_DIRS + LIST_DIRECTORIES true RELATIVE ${GHS_OS_ROOT} ${GHS_OS_ROOT}/*) + FILE(GLOB GHS_CANDIDATE_OS_FILES + LIST_DIRECTORIES false RELATIVE ${GHS_OS_ROOT} ${GHS_OS_ROOT}/*) + if ( GHS_CANDIDATE_OS_FILES ) + list(REMOVE_ITEM GHS_CANDIDATE_OS_DIRS ${GHS_CANDIDATE_OS_FILES}) endif () - endif () - #Try to look for known registry values - if (NOT GHS_INT_DIRECTORY) - find_path(GHS_INT_DIRECTORY INTEGRITY.ld PATHS - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware6433c345;InstallLocation]" #int1122 - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware289b6625;InstallLocation]" #int1104 - ) - endif () + #filter based on platform name + if (GHS_TARGET_PLATFORM STREQUAL "integrity") + list(FILTER GHS_CANDIDATE_OS_DIRS INCLUDE REGEX "int[0-9][0-9][0-9][0-9a-z].*") + endif () - set(GHS_INT_DIRECTORY ${GHS_INT_DIRECTORY} CACHE PATH - "Path to integrity directory") + if (GHS_CANDIDATE_OS_DIRS) + list(SORT GHS_CANDIDATE_OS_DIRS) + list(GET GHS_CANDIDATE_OS_DIRS -1 GHS_OS_DIR) + string(CONCAT GHS_OS_DIR ${GHS_OS_ROOT} "/" ${GHS_OS_DIR}) + endif() + + set(GHS_OS_DIR "${GHS_OS_DIR}" CACHE PATH "GHS platform OS directory" FORCE) + endif () endif () -set(GHS_OS_DIR ${GHS_INT_DIRECTORY} CACHE PATH "OS directory") set(GHS_BSP_NAME "simarm" CACHE STRING "BSP name") set(GHS_CUSTOMIZATION "" CACHE FILEPATH "optional GHS customization") mark_as_advanced(GHS_CUSTOMIZATION) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bb77dc0cee95b2606ab6715aa9babc89c09d176f commit bb77dc0cee95b2606ab6715aa9babc89c09d176f Author: Fred Baksik AuthorDate: Sat Jul 7 07:27:21 2018 -0400 Commit: Fred Baksik CommitDate: Wed Jul 11 08:44:49 2018 -0400 GHS: Set primary target using arch/platform values (or user specified value) diff --git a/Help/generator/Green Hills MULTI.rst b/Help/generator/Green Hills MULTI.rst index 7da93dd..7c2e643 100644 --- a/Help/generator/Green Hills MULTI.rst +++ b/Help/generator/Green Hills MULTI.rst @@ -19,6 +19,11 @@ Default to ``integrity``. Usual values are ``integrity``, ``threadx``, ``uvelosity``, ``velosity``, ``vxworks``, ``standalone``. +* ``GHS_PRIMARY_TARGET`` + +Sets ``primaryTarget`` field in project file. +Defaults to ``_.tgt``. + * ``GHS_TOOLSET_ROOT`` Default to ``C:/ghs``. Root path for ``toolset``. diff --git a/Modules/Platform/GHS-MULTI-Initialize.cmake b/Modules/Platform/GHS-MULTI-Initialize.cmake index bf61d7b..0b7422c 100644 --- a/Modules/Platform/GHS-MULTI-Initialize.cmake +++ b/Modules/Platform/GHS-MULTI-Initialize.cmake @@ -33,7 +33,6 @@ if (NOT GHS_INT_DIRECTORY) endif () set(GHS_OS_DIR ${GHS_INT_DIRECTORY} CACHE PATH "OS directory") -set(GHS_PRIMARY_TARGET "arm_integrity.tgt" CACHE STRING "target for compilation") set(GHS_BSP_NAME "simarm" CACHE STRING "BSP name") set(GHS_CUSTOMIZATION "" CACHE FILEPATH "optional GHS customization") mark_as_advanced(GHS_CUSTOMIZATION) diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index ddf8147..17fac41 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -335,8 +335,26 @@ void cmGlobalGhsMultiGenerator::WriteMacros() void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives() { - *this->GetBuildFileStream() - << "primaryTarget=arm_integrity.tgt" << std::endl; + /* set primary target */ + std::string tgt; + const char* t = + this->GetCMakeInstance()->GetCacheDefinition("GHS_PRIMARY_TARGET"); + if (t) { + tgt = t; + this->GetCMakeInstance()->MarkCliAsUsed("GHS_PRIMARY_TARGET"); + } else { + const char* a = + this->GetCMakeInstance()->GetCacheDefinition("CMAKE_GENERATOR_PLATFORM"); + const char* p = + this->GetCMakeInstance()->GetCacheDefinition("GHS_TARGET_PLATFORM"); + tgt = (a ? a : ""); + tgt += "_"; + tgt += (p ? p : ""); + tgt += ".tgt"; + } + + *this->GetBuildFileStream() << "primaryTarget=" << tgt << std::endl; + char const* const customization = this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION"); if (NULL != customization && strlen(customization) > 0) { diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index b389a13..bd81a84 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2256,7 +2256,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release --build-generator "Green Hills MULTI" --build-project ReturnNum --build-config $ - --build-options -DGHS_PRIMARY_TARGET="arm_integrity.tgt" + --build-options -DGHS_PRIMARY_TARGET=arm_integrity.tgt -DGHS_BSP_NAME="simarm" ) endif () https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f80692cf600675bae4d12810c8119a62e76aa701 commit f80692cf600675bae4d12810c8119a62e76aa701 Author: Fred Baksik AuthorDate: Sat Jul 7 07:27:21 2018 -0400 Commit: Fred Baksik CommitDate: Wed Jul 11 08:33:21 2018 -0400 GHS: Add platform selection support diff --git a/Help/generator/Green Hills MULTI.rst b/Help/generator/Green Hills MULTI.rst index daebfcd..7da93dd 100644 --- a/Help/generator/Green Hills MULTI.rst +++ b/Help/generator/Green Hills MULTI.rst @@ -13,6 +13,11 @@ The ``-T `` can be supplied for setting the toolset to be used. All toolsets are expected to be located at ``GHS_TOOLSET_ROOT``. If the toolset is not specified then the latest toolset will be used. +* ``GHS_TARGET_PLATFORM`` + +Default to ``integrity``. +Usual values are ``integrity``, ``threadx``, ``uvelosity``, +``velosity``, ``vxworks``, ``standalone``. * ``GHS_TOOLSET_ROOT`` diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index c980746..ddf8147 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -127,6 +127,16 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p, cmStateEnums::INTERNAL); } + const char* tgtPlatform = mf->GetDefinition("GHS_TARGET_PLATFORM"); + if (tgtPlatform == nullptr) { + tgtPlatform = "integrity"; + } + + /* store the platform name for later use */ + mf->AddCacheDefinition("GHS_TARGET_PLATFORM", tgtPlatform, + "Name of GHS target platform.", + cmStateEnums::INTERNAL); + return true; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a37a4a00c8b8982c89ffc99505de097d3b2d7300 commit a37a4a00c8b8982c89ffc99505de097d3b2d7300 Author: Fred Baksik AuthorDate: Sat Jul 7 07:27:21 2018 -0400 Commit: Fred Baksik CommitDate: Wed Jul 11 08:28:36 2018 -0400 GHS: Add toolset selection support -- Use the specified toolset located within GHS_TOOLSET_ROOT -- Update how the latest toolset is determined; scan the location GHS_TOOLSET_ROOT and sort it No longer use registry settings looking for installations The registry values are assigned in installation order for Green Hills tools not version order -- Update to use gbuild.exe from the proper toolset -- Clarify that CMAKE_MAKE_PROGRAM should not be set by user. -- Detect some toolset changes when regenerating project files This could occur if GHS_TOOLSET_ROOT was changed by user after the initial project generation This could occur if CMAKE_MAKE_PROGRAM was changed at the command line -- Use placeholder values for CMAKE__COMPILER The MULTI build system only uses gbuild to build a project gbuild uses the project file to determine which set of compilers to use based on target platform and architecture because compiler detection is skipped, placeholder values are used so that CMake does not complain diff --git a/Help/generator/Green Hills MULTI.rst b/Help/generator/Green Hills MULTI.rst index 55fbab4..daebfcd 100644 --- a/Help/generator/Green Hills MULTI.rst +++ b/Help/generator/Green Hills MULTI.rst @@ -9,6 +9,15 @@ The ``-A `` can be supplied for setting the target architecture. ```` usually is one of "arm", "ppc", "86", etcetera. If the target architecture is not specified then the default architecture of "arm" will be used. +The ``-T `` can be supplied for setting the toolset to be used. +All toolsets are expected to be located at ``GHS_TOOLSET_ROOT``. +If the toolset is not specified then the latest toolset will be used. + + +* ``GHS_TOOLSET_ROOT`` + +Default to ``C:/ghs``. Root path for ``toolset``. + Customizations are available through the following cache variables: * ``GHS_BSP_NAME`` diff --git a/Help/variable/CMAKE_GENERATOR_TOOLSET.rst b/Help/variable/CMAKE_GENERATOR_TOOLSET.rst index 3220244..e9bc28b 100644 --- a/Help/variable/CMAKE_GENERATOR_TOOLSET.rst +++ b/Help/variable/CMAKE_GENERATOR_TOOLSET.rst @@ -18,6 +18,7 @@ Toolset specification is supported only on specific generators: * :ref:`Visual Studio Generators` for VS 2010 and above * The :generator:`Xcode` generator for Xcode 3.0 and above +* The :generator:`Green Hills MULTI` generator See native build system documentation for allowed toolset names. diff --git a/Help/variable/CMAKE_MAKE_PROGRAM.rst b/Help/variable/CMAKE_MAKE_PROGRAM.rst index a3b997a..4f5a50f 100644 --- a/Help/variable/CMAKE_MAKE_PROGRAM.rst +++ b/Help/variable/CMAKE_MAKE_PROGRAM.rst @@ -55,9 +55,11 @@ to configure the project: the CMake cache then CMake will use the specified value if possible. -* The :generator:`Green Hills MULTI` generator sets this to ``gbuild``. - If a user or project explicitly adds ``CMAKE_MAKE_PROGRAM`` to - the CMake cache then CMake will use the specified value. +* The :generator:`Green Hills MULTI` generator sets this to the full + path to ``gbuild.exe`` based upon the toolset being used. + + Once the generator has initialized a particular value for this + variable, changing the value has undefined behavior. The ``CMAKE_MAKE_PROGRAM`` variable is set for use by project code. The value is also used by the :manual:`cmake(1)` ``--build`` and diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 804a010..c980746 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -14,13 +14,13 @@ #include "cmVersion.h" const char* cmGlobalGhsMultiGenerator::FILE_EXTENSION = ".gpj"; -const char* cmGlobalGhsMultiGenerator::DEFAULT_MAKE_PROGRAM = "gbuild"; +const char* cmGlobalGhsMultiGenerator::DEFAULT_BUILD_PROGRAM = "gbuild.exe"; +const char* cmGlobalGhsMultiGenerator::DEFAULT_TOOLSET_ROOT = "C:/ghs"; cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator(cmake* cm) : cmGlobalGenerator(cm) , OSDirRelative(false) { - this->GhsBuildCommandInitialized = false; } cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator() @@ -41,6 +41,76 @@ void cmGlobalGhsMultiGenerator::GetDocumentation(cmDocumentationEntry& entry) "Generates Green Hills MULTI files (experimental, work-in-progress)."; } +bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts, + cmMakefile* mf) +{ + std::string tsp; /* toolset path */ + std::string tsn = ts; /* toolset name */ + + GetToolset(mf, tsp, tsn); + + /* no toolset was found */ + if (tsn.empty()) { + return false; + } else if (ts.empty()) { + std::string message; + message = + "Green Hills MULTI: -T not specified; defaulting to \""; + message += tsn; + message += "\""; + cmSystemTools::Message(message.c_str()); + + /* store the toolset for later use + * -- already done if -T was specified + */ + mf->AddCacheDefinition("CMAKE_GENERATOR_TOOLSET", tsn.c_str(), + "Name of generator toolset.", + cmStateEnums::INTERNAL); + } + + /* set the build tool to use */ + const char* prevTool = mf->GetDefinition("CMAKE_MAKE_PROGRAM"); + std::string gbuild(tsp + "/" + tsn + "/" + DEFAULT_BUILD_PROGRAM); + + /* check if the toolset changed from last generate */ + if (prevTool != NULL && (gbuild != prevTool)) { + std::string message = "generator toolset: "; + message += gbuild; + message += "\nDoes not match the toolset used previously: "; + message += prevTool; + message += "\nEither remove the CMakeCache.txt file and CMakeFiles " + "directory or choose a different binary directory."; + cmSystemTools::Error(message.c_str()); + } else { + /* store the toolset that is being used for this build */ + mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", gbuild.c_str(), + "build program to use", cmStateEnums::INTERNAL, + true); + } + + mf->AddDefinition("CMAKE_SYSTEM_VERSION", tsn.c_str()); + + // FIXME: compiler detection not implemented + // gbuild uses the primaryTarget setting in the top-level project + // file to determine which compiler to use. Because compiler + // detection is not implemented these variables must be + // set to skip past these tests. However cmake will verify that + // the executable pointed to by CMAKE__COMPILER exists. + // To pass this additional check gbuild is used as a place holder for the + // actual compiler. + mf->AddDefinition("CMAKE_C_COMPILER", gbuild.c_str()); + mf->AddDefinition("CMAKE_C_COMPILER_ID_RUN", "TRUE"); + mf->AddDefinition("CMAKE_C_COMPILER_ID", "GHS"); + mf->AddDefinition("CMAKE_C_COMPILER_FORCED", "TRUE"); + + mf->AddDefinition("CMAKE_CXX_COMPILER", gbuild.c_str()); + mf->AddDefinition("CMAKE_CXX_COMPILER_ID_RUN", "TRUE"); + mf->AddDefinition("CMAKE_CXX_COMPILER_ID", "GHS"); + mf->AddDefinition("CMAKE_CXX_COMPILER_FORCED", "TRUE"); + + return true; +} + bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p, cmMakefile* mf) { @@ -65,127 +135,49 @@ void cmGlobalGhsMultiGenerator::EnableLanguage( { mf->AddDefinition("CMAKE_SYSTEM_NAME", "GHS-MULTI"); - const std::string ghsCompRoot(GetCompRoot()); - mf->AddDefinition("GHS_COMP_ROOT", ghsCompRoot.c_str()); - std::string ghsCompRootStart = - 0 == ghsCompRootStart.size() ? "" : ghsCompRoot + "/"; - mf->AddDefinition("CMAKE_C_COMPILER", - std::string(ghsCompRootStart + "ccarm.exe").c_str()); - mf->AddDefinition("CMAKE_C_COMPILER_ID_RUN", "TRUE"); - mf->AddDefinition("CMAKE_C_COMPILER_ID", "GHS"); - mf->AddDefinition("CMAKE_C_COMPILER_FORCED", "TRUE"); - - mf->AddDefinition("CMAKE_CXX_COMPILER", - std::string(ghsCompRootStart + "cxarm.exe").c_str()); - mf->AddDefinition("CMAKE_CXX_COMPILER_ID_RUN", "TRUE"); - mf->AddDefinition("CMAKE_CXX_COMPILER_ID", "GHS"); - mf->AddDefinition("CMAKE_CXX_COMPILER_FORCED", "TRUE"); - - if (!ghsCompRoot.empty()) { - static const char* compPreFix = "comp_"; - std::string compFilename = - cmsys::SystemTools::FindLastString(ghsCompRoot.c_str(), compPreFix); - cmsys::SystemTools::ReplaceString(compFilename, compPreFix, ""); - mf->AddDefinition("CMAKE_SYSTEM_VERSION", compFilename.c_str()); - } - mf->AddDefinition("GHSMULTI", "1"); // identifier for user CMake files this->cmGlobalGenerator::EnableLanguage(l, mf, optional); } -bool cmGlobalGhsMultiGenerator::FindMakeProgram(cmMakefile* mf) +bool cmGlobalGhsMultiGenerator::FindMakeProgram(cmMakefile* /*mf*/) { - // The GHS generator knows how to lookup its build tool - // directly instead of needing a helper module to do it, so we - // do not actually need to put CMAKE_MAKE_PROGRAM into the cache. - if (cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) { - mf->AddDefinition("CMAKE_MAKE_PROGRAM", - this->GetGhsBuildCommand().c_str()); - } + // The GHS generator only knows how to lookup its build tool + // during generation of the project files, but this + // can only be done after the toolset is specified. + return true; } -std::string const& cmGlobalGhsMultiGenerator::GetGhsBuildCommand() +void cmGlobalGhsMultiGenerator::GetToolset(cmMakefile* mf, std::string& tsd, + std::string& ts) { - if (!this->GhsBuildCommandInitialized) { - this->GhsBuildCommandInitialized = true; - this->GhsBuildCommand = this->FindGhsBuildCommand(); - } - return this->GhsBuildCommand; -} + const char* ghsRoot = mf->GetDefinition("GHS_TOOLSET_ROOT"); -std::string cmGlobalGhsMultiGenerator::FindGhsBuildCommand() -{ - std::vector userPaths; - userPaths.push_back(this->GetCompRoot()); - std::string makeProgram = - cmSystemTools::FindProgram(DEFAULT_MAKE_PROGRAM, userPaths); - if (makeProgram.empty()) { - makeProgram = DEFAULT_MAKE_PROGRAM; + if (!ghsRoot) { + ghsRoot = DEFAULT_TOOLSET_ROOT; } - return makeProgram; -} + tsd = ghsRoot; -std::string cmGlobalGhsMultiGenerator::GetCompRoot() -{ - std::string output; - - const std::vector potentialDirsHardPaths( - GetCompRootHardPaths()); - const std::vector potentialDirsRegistry(GetCompRootRegistry()); - - std::vector potentialDirsComplete; - potentialDirsComplete.insert(potentialDirsComplete.end(), - potentialDirsHardPaths.begin(), - potentialDirsHardPaths.end()); - potentialDirsComplete.insert(potentialDirsComplete.end(), - potentialDirsRegistry.begin(), - potentialDirsRegistry.end()); - - // Use latest version - std::string outputDirName; - for (std::vector::const_iterator potentialDirsCompleteIt = - potentialDirsComplete.begin(); - potentialDirsCompleteIt != potentialDirsComplete.end(); - ++potentialDirsCompleteIt) { - const std::string dirName( - cmsys::SystemTools::GetFilenameName(*potentialDirsCompleteIt)); - if (dirName.compare(outputDirName) > 0) { - output = *potentialDirsCompleteIt; - outputDirName = dirName; - } - } + if (ts.empty()) { + std::vector output; - return output; -} + // Use latest? version + cmSystemTools::Glob(tsd, "comp_[^;]+", output); -std::vector cmGlobalGhsMultiGenerator::GetCompRootHardPaths() -{ - std::vector output; - cmSystemTools::Glob("C:/ghs", "comp_[^;]+", output); - for (std::vector::iterator outputIt = output.begin(); - outputIt != output.end(); ++outputIt) { - *outputIt = "C:/ghs/" + *outputIt; + if (output.empty()) { + cmSystemTools::Error("GHS toolset not found in ", tsd.c_str()); + ts = ""; + } else { + ts = output.back(); + } + } else { + std::string tryPath = tsd + std::string("/") + ts; + if (!cmSystemTools::FileExists(tryPath)) { + cmSystemTools::Error("GHS toolset \"", ts.c_str(), "\" not found in ", + tsd.c_str()); + ts = ""; + } } - return output; -} - -std::vector cmGlobalGhsMultiGenerator::GetCompRootRegistry() -{ - std::vector output(2); - cmsys::SystemTools::ReadRegistryValue( - "HKEY_LOCAL_" - "MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\" - "Windows\\CurrentVersion\\Uninstall\\" - "GreenHillsSoftwared771f1b4;InstallLocation", - output[0]); - cmsys::SystemTools::ReadRegistryValue( - "HKEY_LOCAL_" - "MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\" - "Windows\\CurrentVersion\\Uninstall\\" - "GreenHillsSoftware9881cef6;InstallLocation", - output[1]); - return output; } void cmGlobalGhsMultiGenerator::OpenBuildFileStream( @@ -293,8 +285,10 @@ void cmGlobalGhsMultiGenerator::GenerateBuildCommand( const std::string& targetName, const std::string& /*config*/, bool /*fast*/, int jobs, bool /*verbose*/, std::vector const& makeOptions) { + const char* gbuild = + this->CMakeInstance->GetCacheDefinition("CMAKE_MAKE_PROGRAM"); makeCommand.push_back( - this->SelectMakeProgram(makeProgram, this->GetGhsBuildCommand())); + this->SelectMakeProgram(makeProgram, (std::string)gbuild)); if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) { makeCommand.push_back("-parallel"); diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index dc98cdc..13c5113 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -49,6 +49,7 @@ public: static bool SupportsPlatform() { return true; } // Toolset / Platform Support + virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf); virtual bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf); /** @@ -96,11 +97,7 @@ protected: std::vector const& makeOptions = std::vector()); private: - std::string const& GetGhsBuildCommand(); - std::string FindGhsBuildCommand(); - std::string GetCompRoot(); - std::vector GetCompRootHardPaths(); - std::vector GetCompRootRegistry(); + void GetToolset(cmMakefile* mf, std::string& tsd, std::string& ts); void OpenBuildFileStream(); void WriteMacros(); @@ -127,9 +124,8 @@ private: std::vector LibDirs; bool OSDirRelative; - bool GhsBuildCommandInitialized; - std::string GhsBuildCommand; - static const char* DEFAULT_MAKE_PROGRAM; + static const char* DEFAULT_BUILD_PROGRAM; + static const char* DEFAULT_TOOLSET_ROOT; }; #endif https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5d40d2b44fe93e223bd7802797b4cd430656790e commit 5d40d2b44fe93e223bd7802797b4cd430656790e Author: Fred Baksik AuthorDate: Sat Jul 7 07:27:21 2018 -0400 Commit: Fred Baksik CommitDate: Sat Jul 7 07:27:21 2018 -0400 GHS: Support ARM, PPC, 86 architectures -- Update -A option to choose target architecture. -- Update commentary about which variables are used to control toolset and target settings -- Remove setting CMAKE_SYSTEM_PROCESSOR because the value is overwritten to be "" by subsequent CMAKE processing diff --git a/Help/generator/Green Hills MULTI.rst b/Help/generator/Green Hills MULTI.rst index 4d31690..55fbab4 100644 --- a/Help/generator/Green Hills MULTI.rst +++ b/Help/generator/Green Hills MULTI.rst @@ -3,6 +3,12 @@ Green Hills MULTI Generates Green Hills MULTI project files (experimental, work-in-progress). +Customizations that are used to pick toolset and target system: + +The ``-A `` can be supplied for setting the target architecture. +```` usually is one of "arm", "ppc", "86", etcetera. If the target architecture +is not specified then the default architecture of "arm" will be used. + Customizations are available through the following cache variables: * ``GHS_BSP_NAME`` diff --git a/Help/variable/CMAKE_GENERATOR_PLATFORM.rst b/Help/variable/CMAKE_GENERATOR_PLATFORM.rst index 50412ff..963f0a4 100644 --- a/Help/variable/CMAKE_GENERATOR_PLATFORM.rst +++ b/Help/variable/CMAKE_GENERATOR_PLATFORM.rst @@ -19,6 +19,8 @@ Platform specification is supported only on specific generators: * For :ref:`Visual Studio Generators` with VS 2005 and above this specifies the target architecture. +* For :generator:`Green Hills MULTI` this specifies the target architecture. + See native build system documentation for allowed platform names. Visual Studio Platform Selection diff --git a/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst b/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst index 09280de..8ad89f1 100644 --- a/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst +++ b/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst @@ -6,5 +6,3 @@ The name of the CPU CMake is building for. This variable is the same as :variable:`CMAKE_HOST_SYSTEM_PROCESSOR` if you build for the host system instead of the target system when cross compiling. - -* The :generator:`Green Hills MULTI` generator sets this to ``ARM`` by default. diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 1e104ee..804a010 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -41,11 +41,29 @@ void cmGlobalGhsMultiGenerator::GetDocumentation(cmDocumentationEntry& entry) "Generates Green Hills MULTI files (experimental, work-in-progress)."; } +bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p, + cmMakefile* mf) +{ + if (p == "") { + cmSystemTools::Message( + "Green Hills MULTI: -A not specified; defaulting to \"arm\""); + std::string arch = "arm"; + + /* store the platform name for later use + * -- already done if -A was specified + */ + mf->AddCacheDefinition("CMAKE_GENERATOR_PLATFORM", arch.c_str(), + "Name of generator platform.", + cmStateEnums::INTERNAL); + } + + return true; +} + void cmGlobalGhsMultiGenerator::EnableLanguage( std::vector const& l, cmMakefile* mf, bool optional) { mf->AddDefinition("CMAKE_SYSTEM_NAME", "GHS-MULTI"); - mf->AddDefinition("CMAKE_SYSTEM_PROCESSOR", "ARM"); const std::string ghsCompRoot(GetCompRoot()); mf->AddDefinition("GHS_COMP_ROOT", ghsCompRoot.c_str()); diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index ef1b66f..dc98cdc 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -40,13 +40,16 @@ public: * Utilized by the generator factory to determine if this generator * supports toolsets. */ - static bool SupportsToolset() { return false; } + static bool SupportsToolset() { return true; } /** * Utilized by the generator factory to determine if this generator * supports platforms. */ - static bool SupportsPlatform() { return false; } + static bool SupportsPlatform() { return true; } + + // Toolset / Platform Support + virtual bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf); /** * Try to determine system information such as shared library ----------------------------------------------------------------------- Summary of changes: Help/generator/Green Hills MULTI.rst | 40 +++- Help/release/dev/ghs.rst | 20 ++ Help/variable/CMAKE_GENERATOR_PLATFORM.rst | 2 + Help/variable/CMAKE_GENERATOR_TOOLSET.rst | 1 + Help/variable/CMAKE_MAKE_PROGRAM.rst | 8 +- Help/variable/CMAKE_SYSTEM_PROCESSOR.rst | 2 - Modules/Compiler/QCC.cmake | 2 + Modules/Platform/GHS-MULTI-Initialize.cmake | 60 +++--- Source/cmGlobalGhsMultiGenerator.cxx | 273 ++++++++++++++++------------ Source/cmGlobalGhsMultiGenerator.h | 19 +- Tests/CMakeLists.txt | 2 +- 11 files changed, 268 insertions(+), 161 deletions(-) create mode 100644 Help/release/dev/ghs.rst hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jul 12 09:45:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 12 Jul 2018 09:45:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.12.0-rc3-4-g730c8b8 Message-ID: <20180712134504.24C631137EE@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via 730c8b87275ca9a95f90cea745532f49d6fdd05d (commit) via e014df762b41e61b423e56637667a050be3a78e7 (commit) from f974000d93798af1e3bd183985ec6f5159664f76 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/QCC.cmake | 2 ++ 1 file changed, 2 insertions(+) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jul 12 09:45:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 12 Jul 2018 09:45:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc3-202-gbfb025f Message-ID: <20180712134504.1218C11298B@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 bfb025f04b3522ff0fee650e7c4c4fe808d739b3 (commit) via 730c8b87275ca9a95f90cea745532f49d6fdd05d (commit) from f7f2b8078e6181f0f3c476c55d7cab3d86ffdaae (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bfb025f04b3522ff0fee650e7c4c4fe808d739b3 commit bfb025f04b3522ff0fee650e7c4c4fe808d739b3 Merge: f7f2b80 730c8b8 Author: Brad King AuthorDate: Thu Jul 12 09:37:36 2018 -0400 Commit: Brad King CommitDate: Thu Jul 12 09:37:36 2018 -0400 Merge branch 'release-3.12' ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jul 13 00:05:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 13 Jul 2018 00:05:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc3-203-g4d9d674 Message-ID: <20180713040505.6F390113D00@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 4d9d674cf26be9a8bbfa59927f8540b88607bb91 (commit) from bfb025f04b3522ff0fee650e7c4c4fe808d739b3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4d9d674cf26be9a8bbfa59927f8540b88607bb91 commit 4d9d674cf26be9a8bbfa59927f8540b88607bb91 Author: Kitware Robot AuthorDate: Fri Jul 13 00:01:06 2018 -0400 Commit: Kitware Robot CommitDate: Fri Jul 13 00:01:06 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9086fb2..9eb3ade 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 12) -set(CMake_VERSION_PATCH 20180712) +set(CMake_VERSION_PATCH 20180713) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jul 13 08:55:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 13 Jul 2018 08:55:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc3-211-g0d72c50 Message-ID: <20180713125505.76DFE11222F@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 0d72c50d29e81789396cab9c515e90ba1e014150 (commit) via 718d2f8f1619e6c3a2ae3bd8796ac8dbb27f36c6 (commit) via 00afb11b072f0611cce9c6e778e4a5171182f7f7 (commit) via 735e69f4458850cc335710af36d1382b891cbb5e (commit) via c5a1491e900a60046a4f12c4be6ba892d675c3d2 (commit) via c454a1435ab8d1c167908abb918a756d2f0da058 (commit) via b76b93c728baa32c0740d36d33318a2aa394d119 (commit) via c8a7835ea9332e3097caeda0ea297f1332948f33 (commit) from 4d9d674cf26be9a8bbfa59927f8540b88607bb91 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0d72c50d29e81789396cab9c515e90ba1e014150 commit 0d72c50d29e81789396cab9c515e90ba1e014150 Merge: 718d2f8 735e69f Author: Brad King AuthorDate: Fri Jul 13 12:54:30 2018 +0000 Commit: Kitware Robot CommitDate: Fri Jul 13 08:54:47 2018 -0400 Merge topic 'intel-std-fix' 735e69f445 Intel: Fix incorrectly documented extension flags Acked-by: Kitware Robot Merge-request: !2206 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=718d2f8f1619e6c3a2ae3bd8796ac8dbb27f36c6 commit 718d2f8f1619e6c3a2ae3bd8796ac8dbb27f36c6 Merge: 00afb11 b76b93c Author: Brad King AuthorDate: Fri Jul 13 12:54:09 2018 +0000 Commit: Kitware Robot CommitDate: Fri Jul 13 08:54:16 2018 -0400 Merge topic 'boost-1.68-beta1' b76b93c728 FindBoost: Change context header used c8a7835ea9 FindBoost: Add support for Boost 1.68 beta1 Acked-by: Kitware Robot Acked-by: Alexander Grund Merge-request: !2204 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=00afb11b072f0611cce9c6e778e4a5171182f7f7 commit 00afb11b072f0611cce9c6e778e4a5171182f7f7 Merge: 4d9d674 c5a1491 Author: Brad King AuthorDate: Fri Jul 13 12:53:16 2018 +0000 Commit: Kitware Robot CommitDate: Fri Jul 13 08:53:21 2018 -0400 Merge topic 'update-kwsys' c5a1491e90 Merge branch 'upstream-KWSys' into update-kwsys c454a1435a KWSys 2018-07-12 (86ce4f37) Acked-by: Kitware Robot Merge-request: !2211 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=735e69f4458850cc335710af36d1382b891cbb5e commit 735e69f4458850cc335710af36d1382b891cbb5e Author: Christian Pfeiffer AuthorDate: Wed Jul 11 15:59:10 2018 +0200 Commit: Brad King CommitDate: Thu Jul 12 09:35:50 2018 -0400 Intel: Fix incorrectly documented extension flags Fixes: #18166 diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake index 3e0439f..4e4af29 100644 --- a/Modules/Compiler/Intel-C.cmake +++ b/Modules/Compiler/Intel-C.cmake @@ -25,8 +25,7 @@ else() if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") - # todo: there is no gnu11 value supported; figure out what to do - set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=c11") + set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") endif() if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.0) diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake index d9c5749..c115b6a 100644 --- a/Modules/Compiler/Intel-CXX.cmake +++ b/Modules/Compiler/Intel-CXX.cmake @@ -36,18 +36,21 @@ else() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0.0) set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17") - # todo: there is no gnu++17 value supported; figure out what to do - set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=c++17") + set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17") endif() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.2) set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14") - # todo: there is no gnu++14 value supported; figure out what to do - set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=c++14") elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.0) set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y") - # todo: there is no gnu++14 value supported; figure out what to do - set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=c++1y") + endif() + + # Intel 15.0.2 accepts c++14 instead of c++1y, but not gnu++14 + # instead of gnu++1y. Intel 17.0.0 accepts gnu++14 too. + if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17.0) + set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14") + elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.0) + set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") endif() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c5a1491e900a60046a4f12c4be6ba892d675c3d2 commit c5a1491e900a60046a4f12c4be6ba892d675c3d2 Merge: 05cd831 c454a14 Author: Brad King AuthorDate: Thu Jul 12 08:47:15 2018 -0400 Commit: Brad King CommitDate: Thu Jul 12 08:47:15 2018 -0400 Merge branch 'upstream-KWSys' into update-kwsys * upstream-KWSys: KWSys 2018-07-12 (86ce4f37) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c454a1435ab8d1c167908abb918a756d2f0da058 commit c454a1435ab8d1c167908abb918a756d2f0da058 Author: KWSys Upstream AuthorDate: Thu Jul 12 07:43:48 2018 -0400 Commit: Brad King CommitDate: Thu Jul 12 08:47:14 2018 -0400 KWSys 2018-07-12 (86ce4f37) Code extracted from: https://gitlab.kitware.com/utils/kwsys.git at commit 86ce4f37437685728662ab6edcf8cf7b6154d649 (master). Upstream Shortlog ----------------- Devin Nakamura (1): 2cbf13d2 Terminal: Add support for z/OS terminal diff --git a/Terminal.c b/Terminal.c index f0d9c64..1bcfd0c 100644 --- a/Terminal.c +++ b/Terminal.c @@ -209,27 +209,34 @@ static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100, } /* VT100 escape sequence strings. */ -#define KWSYS_TERMINAL_VT100_NORMAL "\33[0m" -#define KWSYS_TERMINAL_VT100_BOLD "\33[1m" -#define KWSYS_TERMINAL_VT100_UNDERLINE "\33[4m" -#define KWSYS_TERMINAL_VT100_BLINK "\33[5m" -#define KWSYS_TERMINAL_VT100_INVERSE "\33[7m" -#define KWSYS_TERMINAL_VT100_FOREGROUND_BLACK "\33[30m" -#define KWSYS_TERMINAL_VT100_FOREGROUND_RED "\33[31m" -#define KWSYS_TERMINAL_VT100_FOREGROUND_GREEN "\33[32m" -#define KWSYS_TERMINAL_VT100_FOREGROUND_YELLOW "\33[33m" -#define KWSYS_TERMINAL_VT100_FOREGROUND_BLUE "\33[34m" -#define KWSYS_TERMINAL_VT100_FOREGROUND_MAGENTA "\33[35m" -#define KWSYS_TERMINAL_VT100_FOREGROUND_CYAN "\33[36m" -#define KWSYS_TERMINAL_VT100_FOREGROUND_WHITE "\33[37m" -#define KWSYS_TERMINAL_VT100_BACKGROUND_BLACK "\33[40m" -#define KWSYS_TERMINAL_VT100_BACKGROUND_RED "\33[41m" -#define KWSYS_TERMINAL_VT100_BACKGROUND_GREEN "\33[42m" -#define KWSYS_TERMINAL_VT100_BACKGROUND_YELLOW "\33[43m" -#define KWSYS_TERMINAL_VT100_BACKGROUND_BLUE "\33[44m" -#define KWSYS_TERMINAL_VT100_BACKGROUND_MAGENTA "\33[45m" -#define KWSYS_TERMINAL_VT100_BACKGROUND_CYAN "\33[46m" -#define KWSYS_TERMINAL_VT100_BACKGROUND_WHITE "\33[47m" +#if defined(__MVS__) +/* if building on z/OS (aka MVS), assume we are using EBCDIC */ +# define ESCAPE_CHAR "\47" +#else +# define ESCAPE_CHAR "\33" +#endif + +#define KWSYS_TERMINAL_VT100_NORMAL ESCAPE_CHAR "[0m" +#define KWSYS_TERMINAL_VT100_BOLD ESCAPE_CHAR "[1m" +#define KWSYS_TERMINAL_VT100_UNDERLINE ESCAPE_CHAR "[4m" +#define KWSYS_TERMINAL_VT100_BLINK ESCAPE_CHAR "[5m" +#define KWSYS_TERMINAL_VT100_INVERSE ESCAPE_CHAR "[7m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_BLACK ESCAPE_CHAR "[30m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_RED ESCAPE_CHAR "[31m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_GREEN ESCAPE_CHAR "[32m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_YELLOW ESCAPE_CHAR "[33m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_BLUE ESCAPE_CHAR "[34m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_MAGENTA ESCAPE_CHAR "[35m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_CYAN ESCAPE_CHAR "[36m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_WHITE ESCAPE_CHAR "[37m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_BLACK ESCAPE_CHAR "[40m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_RED ESCAPE_CHAR "[41m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_GREEN ESCAPE_CHAR "[42m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_YELLOW ESCAPE_CHAR "[43m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_BLUE ESCAPE_CHAR "[44m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_MAGENTA ESCAPE_CHAR "[45m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_CYAN ESCAPE_CHAR "[46m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_WHITE ESCAPE_CHAR "[47m" /* Write VT100 escape sequences to the stream for the given color. */ static void kwsysTerminalSetVT100Color(FILE* stream, int color) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b76b93c728baa32c0740d36d33318a2aa394d119 commit b76b93c728baa32c0740d36d33318a2aa394d119 Author: Roger Leigh AuthorDate: Wed Jul 11 23:14:19 2018 +0100 Commit: Roger Leigh CommitDate: Wed Jul 11 23:14:21 2018 +0100 FindBoost: Change context header used boost/context/all.hpp is removed in Boost 1.68. boost/context/detail/fcontext.hpp is present in all Boost releases containing context (?1.61). diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 9a1301f..4e5c45d 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -881,7 +881,7 @@ function(_Boost_COMPONENT_HEADERS component _hdrs) set(_Boost_CHRONO_HEADERS "boost/chrono.hpp") set(_Boost_CONTAINER_HEADERS "boost/container/container_fwd.hpp") set(_Boost_CONTRACT_HEADERS "boost/contract.hpp") - set(_Boost_CONTEXT_HEADERS "boost/context/all.hpp") + set(_Boost_CONTEXT_HEADERS "boost/context/detail/fcontext.hpp") set(_Boost_COROUTINE_HEADERS "boost/coroutine/all.hpp") set(_Boost_DATE_TIME_HEADERS "boost/date_time/date.hpp") set(_Boost_EXCEPTION_HEADERS "boost/exception/exception.hpp") https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c8a7835ea9332e3097caeda0ea297f1332948f33 commit c8a7835ea9332e3097caeda0ea297f1332948f33 Author: Roger Leigh AuthorDate: Tue Jul 10 21:07:27 2018 +0100 Commit: Brad King CommitDate: Wed Jul 11 07:26:51 2018 -0400 FindBoost: Add support for Boost 1.68 beta1 This includes a new component, `Boost::contract`. Fixes: #18167 diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 08d9762..9a1301f 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -806,10 +806,28 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_TIMER_DEPENDENCIES chrono system) set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 106700 AND Boost_VERSION VERSION_LESS 106800) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) else() - if(NOT Boost_VERSION VERSION_LESS 106700) + if(NOT Boost_VERSION VERSION_LESS 106800) set(_Boost_CHRONO_DEPENDENCIES system) set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) + set(_Boost_CONTRACT_DEPENDENCIES thread chrono system date_time) set(_Boost_COROUTINE_DEPENDENCIES context system) set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) set(_Boost_FILESYSTEM_DEPENDENCIES system) @@ -825,7 +843,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) endif() - if(NOT Boost_VERSION VERSION_LESS 106800) + if(NOT Boost_VERSION VERSION_LESS 106900) message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets") endif() endif() @@ -862,6 +880,7 @@ function(_Boost_COMPONENT_HEADERS component _hdrs) set(_Boost_ATOMIC_HEADERS "boost/atomic.hpp") set(_Boost_CHRONO_HEADERS "boost/chrono.hpp") set(_Boost_CONTAINER_HEADERS "boost/container/container_fwd.hpp") + set(_Boost_CONTRACT_HEADERS "boost/contract.hpp") set(_Boost_CONTEXT_HEADERS "boost/context/all.hpp") set(_Boost_COROUTINE_HEADERS "boost/coroutine/all.hpp") set(_Boost_DATE_TIME_HEADERS "boost/date_time/date.hpp") @@ -1062,7 +1081,7 @@ else() # _Boost_COMPONENT_HEADERS. See the instructions at the top of # _Boost_COMPONENT_DEPENDENCIES. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65" + "1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65" "1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60" "1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55" "1.54.0" "1.54" "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51" ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/Intel-C.cmake | 3 +-- Modules/Compiler/Intel-CXX.cmake | 15 +++++++----- Modules/FindBoost.cmake | 27 ++++++++++++++++++---- Source/kwsys/Terminal.c | 49 +++++++++++++++++++++++----------------- 4 files changed, 61 insertions(+), 33 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jul 13 09:05:03 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 13 Jul 2018 09:05:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.12.0-rc3-9-ge109dc0 Message-ID: <20180713130503.D57B4114134@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via e109dc0b2a68999dec742689955b7b2701025d6f (commit) via 735e69f4458850cc335710af36d1382b891cbb5e (commit) via 384c3f9e9e743b1edb1e7b441d113b6e5e68085d (commit) via b76b93c728baa32c0740d36d33318a2aa394d119 (commit) via c8a7835ea9332e3097caeda0ea297f1332948f33 (commit) from 730c8b87275ca9a95f90cea745532f49d6fdd05d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/Intel-C.cmake | 3 +-- Modules/Compiler/Intel-CXX.cmake | 15 +++++++++------ Modules/FindBoost.cmake | 27 +++++++++++++++++++++++---- 3 files changed, 33 insertions(+), 12 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jul 13 09:05:03 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 13 Jul 2018 09:05:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc3-220-g102f51d Message-ID: <20180713130503.BA00C11410D@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 102f51d0aad6826864d6c6da6c2c2f9c6682b28d (commit) via f691dbc4858710708ec764a942c8f25425324a7f (commit) via 969ad5b33e365d447642d2bf114ca6bd5667e257 (commit) via e109dc0b2a68999dec742689955b7b2701025d6f (commit) via 384c3f9e9e743b1edb1e7b441d113b6e5e68085d (commit) via f2134169f61e12354c79cd818758d34257116b1c (commit) via 86b332c25d22f7050ed60c1604c2a188c5885619 (commit) via 189f723509a5077d044510e90b01775e2997302a (commit) via c6a8002827e0d23d27906ea5760a67981660f453 (commit) from 0d72c50d29e81789396cab9c515e90ba1e014150 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=102f51d0aad6826864d6c6da6c2c2f9c6682b28d commit 102f51d0aad6826864d6c6da6c2c2f9c6682b28d Merge: f691dbc 86b332c Author: Brad King AuthorDate: Fri Jul 13 12:57:28 2018 +0000 Commit: Kitware Robot CommitDate: Fri Jul 13 08:57:36 2018 -0400 Merge topic 'autogen_forward_errors' 86b332c25d Return std::string from cmGeneratorTarget::ImportedGetLocation 189f723509 Autogen: Wrap moc/uic/rcc related variables in structs c6a8002827 Autogen: Improve error detection during configuration Acked-by: Kitware Robot Merge-request: !2207 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f691dbc4858710708ec764a942c8f25425324a7f commit f691dbc4858710708ec764a942c8f25425324a7f Merge: 969ad5b f213416 Author: Brad King AuthorDate: Fri Jul 13 12:57:02 2018 +0000 Commit: Kitware Robot CommitDate: Fri Jul 13 08:57:09 2018 -0400 Merge topic 'cpack-wix-extra-sources' f2134169f6 WiX: Add the build directory to IncludeSearchPaths for candle.exe Acked-by: Kitware Robot Merge-request: !2194 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=969ad5b33e365d447642d2bf114ca6bd5667e257 commit 969ad5b33e365d447642d2bf114ca6bd5667e257 Merge: 0d72c50 e109dc0 Author: Brad King AuthorDate: Fri Jul 13 08:55:33 2018 -0400 Commit: Brad King CommitDate: Fri Jul 13 08:55:33 2018 -0400 Merge branch 'release-3.12' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f2134169f61e12354c79cd818758d34257116b1c commit f2134169f61e12354c79cd818758d34257116b1c Author: Lars Schmertmann AuthorDate: Fri Jul 6 12:52:04 2018 +0200 Commit: Lars Schmertmann CommitDate: Thu Jul 12 08:48:33 2018 +0200 WiX: Add the build directory to IncludeSearchPaths for candle.exe CPack creates cpack_variables.wxi in the build directory. In the WiX template it can be used by because the template is configured into main.wxs in the build directory. Because the extra source files are in the source directory it was necessary to use . This requires knowledge about the build directory structure and is avoided by this change by adding the build directory to the IncludeSearchPaths. diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 382b189..398ebd3 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -100,6 +100,10 @@ bool cmCPackWIXGenerator::RunCandleCommand(std::string const& sourceFile, command << " -ext " << QuotePath(ext); } + if (sourceFile.rfind(this->CPackTopLevel, 0) != 0) { + command << " " << QuotePath("-I" + this->CPackTopLevel); + } + AddCustomFlags("CPACK_WIX_CANDLE_EXTRA_FLAGS", command); command << " " << QuotePath(sourceFile); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=86b332c25d22f7050ed60c1604c2a188c5885619 commit 86b332c25d22f7050ed60c1604c2a188c5885619 Author: Sebastian Holtermann AuthorDate: Wed Jul 11 16:58:48 2018 +0200 Commit: Sebastian Holtermann CommitDate: Wed Jul 11 16:58:48 2018 +0200 Return std::string from cmGeneratorTarget::ImportedGetLocation diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 3989ebe..098c13a 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3358,14 +3358,12 @@ std::string cmGeneratorTarget::GetFullNameInternal( return prefix + base + suffix; } -const char* cmGeneratorTarget::ImportedGetLocation( +std::string cmGeneratorTarget::ImportedGetLocation( const std::string& config) const { - static std::string location; assert(this->IsImported()); - location = this->Target->ImportedGetFullPath( + return this->Target->ImportedGetFullPath( config, cmStateEnums::RuntimeBinaryArtifact); - return location.c_str(); } std::string cmGeneratorTarget::GetFullNameImported( diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 6a36116..6c1f931 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -658,7 +658,7 @@ public: no soname at all. */ bool IsImportedSharedLibWithoutSOName(const std::string& config) const; - const char* ImportedGetLocation(const std::string& config) const; + std::string ImportedGetLocation(const std::string& config) const; /** Get the target major and minor version numbers interpreted from the VERSION property. Version 0 is returned if the property is diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index a0fd1b1..fd9829f 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -37,11 +37,6 @@ #include #include -inline static const char* SafeString(const char* value) -{ - return (value != nullptr) ? value : ""; -} - static std::size_t GetParallelCPUCount() { static std::size_t count = 0; @@ -1268,7 +1263,7 @@ bool cmQtAutoGenInitializer::GetMocExecutable() cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName); if (tgt != nullptr) { - this->Moc.Executable = SafeString(tgt->ImportedGetLocation("")); + this->Moc.Executable = tgt->ImportedGetLocation(""); } else { err = "Could not find target " + targetName; } @@ -1329,7 +1324,7 @@ bool cmQtAutoGenInitializer::GetUicExecutable() cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName); if (tgt != nullptr) { - this->Uic.Executable = SafeString(tgt->ImportedGetLocation("")); + this->Uic.Executable = tgt->ImportedGetLocation(""); } else { if (this->QtVersionMajor == "5") { // Project does not use Qt5Widgets, but has AUTOUIC ON anyway @@ -1394,7 +1389,7 @@ bool cmQtAutoGenInitializer::GetRccExecutable() cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName); if (tgt != nullptr) { - this->Rcc.Executable = SafeString(tgt->ImportedGetLocation("")); + this->Rcc.Executable = tgt->ImportedGetLocation(""); } else { err = "Could not find target " + targetName; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=189f723509a5077d044510e90b01775e2997302a commit 189f723509a5077d044510e90b01775e2997302a Author: Sebastian Holtermann AuthorDate: Wed Jul 11 13:54:46 2018 +0200 Commit: Sebastian Holtermann CommitDate: Wed Jul 11 13:54:46 2018 +0200 Autogen: Wrap moc/uic/rcc related variables in structs diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 11ffe71..a0fd1b1 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -182,12 +182,13 @@ cmQtAutoGenInitializer::cmQtAutoGenInitializer( cmGeneratorTarget* target, bool mocEnabled, bool uicEnabled, bool rccEnabled, std::string const& qtVersionMajor) : Target(target) - , MocEnabled(mocEnabled) - , UicEnabled(uicEnabled) - , RccEnabled(rccEnabled) , MultiConfig(false) , QtVersionMajor(qtVersionMajor) { + Moc.Enabled = mocEnabled; + Uic.Enabled = uicEnabled; + Rcc.Enabled = rccEnabled; + this->QtVersionMinor = cmQtAutoGenInitializer::GetQtMinorVersion(target, this->QtVersionMajor); } @@ -300,15 +301,15 @@ bool cmQtAutoGenInitializer::InitCustomTargets() } // Add moc compilation to generated files list - if (this->MocEnabled) { + if (this->Moc.Enabled) { std::string mocsComp = this->DirBuild + "/mocs_compilation.cpp"; this->AddGeneratedSource(mocsComp, GeneratorT::MOC); autogenProvides.push_back(std::move(mocsComp)); } // Add autogen includes directory to the origin target INCLUDE_DIRECTORIES - if (this->MocEnabled || this->UicEnabled || - (this->RccEnabled && this->MultiConfig)) { + if (this->Moc.Enabled || this->Uic.Enabled || + (this->Rcc.Enabled && this->MultiConfig)) { std::string includeDir = this->DirBuild; includeDir += "/include"; if (this->MultiConfig) { @@ -318,7 +319,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets() } // Acquire rcc executable and features - if (this->RccEnabled) { + if (this->Rcc.Enabled) { if (!GetRccExecutable()) { return false; } @@ -339,14 +340,14 @@ bool cmQtAutoGenInitializer::InitCustomTargets() std::string const& fPath = sf->GetFullPath(); std::string const& ext = sf->GetExtension(); // Register generated files that will be scanned by moc or uic - if (this->MocEnabled || this->UicEnabled) { + if (this->Moc.Enabled || this->Uic.Enabled) { cmSystemTools::FileFormat const fileType = cmSystemTools::GetFileFormat(ext.c_str()); if ((fileType == cmSystemTools::CXX_FILE_FORMAT) || (fileType == cmSystemTools::HEADER_FILE_FORMAT)) { std::string const absPath = cmSystemTools::GetRealPath(fPath); - if ((this->MocEnabled && !sf->GetPropertyAsBool("SKIP_AUTOMOC")) || - (this->UicEnabled && !sf->GetPropertyAsBool("SKIP_AUTOUIC"))) { + if ((this->Moc.Enabled && !sf->GetPropertyAsBool("SKIP_AUTOMOC")) || + (this->Uic.Enabled && !sf->GetPropertyAsBool("SKIP_AUTOUIC"))) { // Register source const bool generated = sf->GetPropertyAsBool("GENERATED"); if (fileType == cmSystemTools::HEADER_FILE_FORMAT) { @@ -366,7 +367,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets() } } // Register rcc enabled files - if (this->RccEnabled && (ext == qrcExt) && + if (this->Rcc.Enabled && (ext == qrcExt) && !sf->GetPropertyAsBool("SKIP_AUTORCC")) { // Register qrc file { @@ -382,7 +383,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets() cmSystemTools::ExpandListArgument(opts, qrc.Options); } } - this->Qrcs.push_back(std::move(qrc)); + this->Rcc.Qrcs.push_back(std::move(qrc)); } } } @@ -393,7 +394,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets() this->Target->ClearSourcesCache(); } // Read skip files from makefile sources - if (this->MocEnabled || this->UicEnabled) { + if (this->Moc.Enabled || this->Uic.Enabled) { std::string pathError; for (cmSourceFile* sf : makefile->GetSourceFiles()) { // sf->GetExtension() is only valid after sf->GetFullPath() ... @@ -411,17 +412,17 @@ bool cmQtAutoGenInitializer::InitCustomTargets() continue; } const bool skipAll = sf->GetPropertyAsBool("SKIP_AUTOGEN"); - const bool mocSkip = - this->MocEnabled && (skipAll || sf->GetPropertyAsBool("SKIP_AUTOMOC")); - const bool uicSkip = - this->UicEnabled && (skipAll || sf->GetPropertyAsBool("SKIP_AUTOUIC")); + const bool mocSkip = this->Moc.Enabled && + (skipAll || sf->GetPropertyAsBool("SKIP_AUTOMOC")); + const bool uicSkip = this->Uic.Enabled && + (skipAll || sf->GetPropertyAsBool("SKIP_AUTOUIC")); if (mocSkip || uicSkip) { std::string const absFile = cmSystemTools::GetRealPath(fPath); if (mocSkip) { - this->MocSkip.insert(absFile); + this->Moc.Skip.insert(absFile); } if (uicSkip) { - this->UicSkip.insert(absFile); + this->Uic.Skip.insert(absFile); } } } @@ -466,13 +467,13 @@ bool cmQtAutoGenInitializer::InitCustomTargets() msg += "\n"; std::string tools; std::string property; - if (this->MocEnabled && this->UicEnabled) { + if (this->Moc.Enabled && this->Uic.Enabled) { tools = "AUTOMOC and AUTOUIC"; property = "SKIP_AUTOGEN"; - } else if (this->MocEnabled) { + } else if (this->Moc.Enabled) { tools = "AUTOMOC"; property = "SKIP_AUTOMOC"; - } else if (this->UicEnabled) { + } else if (this->Uic.Enabled) { tools = "AUTOUIC"; property = "SKIP_AUTOUIC"; } @@ -502,13 +503,13 @@ bool cmQtAutoGenInitializer::InitCustomTargets() generatedHeaders.clear(); } // Sort headers and sources - if (this->MocEnabled || this->UicEnabled) { + if (this->Moc.Enabled || this->Uic.Enabled) { std::sort(this->Headers.begin(), this->Headers.end()); std::sort(this->Sources.begin(), this->Sources.end()); } // Process qrc files - if (!this->Qrcs.empty()) { + if (!this->Rcc.Qrcs.empty()) { const bool QtV5 = (this->QtVersionMajor == "5"); // Target rcc options std::vector optionsTarget; @@ -516,9 +517,9 @@ bool cmQtAutoGenInitializer::InitCustomTargets() this->Target->GetSafeProperty("AUTORCC_OPTIONS"), optionsTarget); // Check if file name is unique - for (Qrc& qrc : this->Qrcs) { + for (Qrc& qrc : this->Rcc.Qrcs) { qrc.Unique = true; - for (Qrc const& qrc2 : this->Qrcs) { + for (Qrc const& qrc2 : this->Rcc.Qrcs) { if ((&qrc != &qrc2) && (qrc.QrcName == qrc2.QrcName)) { qrc.Unique = false; break; @@ -528,7 +529,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets() // Path checksum and file names { cmFilePathChecksum const fpathCheckSum(makefile); - for (Qrc& qrc : this->Qrcs) { + for (Qrc& qrc : this->Rcc.Qrcs) { qrc.PathChecksum = fpathCheckSum.getPart(qrc.QrcFile); // RCC output file name { @@ -559,7 +560,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets() } } // RCC options - for (Qrc& qrc : this->Qrcs) { + for (Qrc& qrc : this->Rcc.Qrcs) { // Target options std::vector opts = optionsTarget; // Merge computed "-name XYZ" option @@ -580,7 +581,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets() RccMergeOptions(opts, qrc.Options, QtV5); qrc.Options = std::move(opts); } - for (Qrc& qrc : this->Qrcs) { + for (Qrc& qrc : this->Rcc.Qrcs) { // Register file at target this->AddGeneratedSource(qrc.RccFile, GeneratorT::RCC); @@ -676,7 +677,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets() } // Create _autogen target - if (this->MocEnabled || this->UicEnabled) { + if (this->Moc.Enabled || this->Uic.Enabled) { // Add user defined autogen target dependencies { std::string const deps = @@ -700,10 +701,10 @@ bool cmQtAutoGenInitializer::InitCustomTargets() std::string autogenComment; { std::string tools; - if (this->MocEnabled) { + if (this->Moc.Enabled) { tools += "MOC"; } - if (this->UicEnabled) { + if (this->Uic.Enabled) { if (!tools.empty()) { tools += " and "; } @@ -847,11 +848,11 @@ bool cmQtAutoGenInitializer::SetupCustomTargets() } // Generate autogen target info file - if (this->MocEnabled || this->UicEnabled) { - if (this->MocEnabled) { + if (this->Moc.Enabled || this->Uic.Enabled) { + if (this->Moc.Enabled) { this->SetupCustomTargetsMoc(); } - if (this->UicEnabled) { + if (this->Uic.Enabled) { this->SetupCustomTargetsUic(); } @@ -938,16 +939,16 @@ bool cmQtAutoGenInitializer::SetupCustomTargets() ofs << "# Qt\n"; CWrite("AM_QT_VERSION_MAJOR", this->QtVersionMajor); - CWrite("AM_QT_MOC_EXECUTABLE", this->MocExecutable); - CWrite("AM_QT_UIC_EXECUTABLE", this->UicExecutable); + CWrite("AM_QT_MOC_EXECUTABLE", this->Moc.Executable); + CWrite("AM_QT_UIC_EXECUTABLE", this->Uic.Executable); - if (this->MocEnabled) { + if (this->Moc.Enabled) { ofs << "# MOC settings\n"; - CWriteSet("AM_MOC_SKIP", this->MocSkip); - CWrite("AM_MOC_DEFINITIONS", this->MocDefines); - CWriteMap("AM_MOC_DEFINITIONS", this->MocDefinesConfig); - CWrite("AM_MOC_INCLUDES", this->MocIncludes); - CWriteMap("AM_MOC_INCLUDES", this->MocIncludesConfig); + CWriteSet("AM_MOC_SKIP", this->Moc.Skip); + CWrite("AM_MOC_DEFINITIONS", this->Moc.Defines); + CWriteMap("AM_MOC_DEFINITIONS", this->Moc.ConfigDefines); + CWrite("AM_MOC_INCLUDES", this->Moc.Includes); + CWriteMap("AM_MOC_INCLUDES", this->Moc.ConfigIncludes); CWrite("AM_MOC_OPTIONS", this->Target->GetSafeProperty("AUTOMOC_MOC_OPTIONS")); CWrite("AM_MOC_RELAXED_MODE", MfDef("CMAKE_AUTOMOC_RELAXED_MODE")); @@ -955,17 +956,17 @@ bool cmQtAutoGenInitializer::SetupCustomTargets() this->Target->GetSafeProperty("AUTOMOC_MACRO_NAMES")); CWrite("AM_MOC_DEPEND_FILTERS", this->Target->GetSafeProperty("AUTOMOC_DEPEND_FILTERS")); - CWrite("AM_MOC_PREDEFS_CMD", this->MocPredefsCmd); + CWrite("AM_MOC_PREDEFS_CMD", this->Moc.PredefsCmd); } - if (this->UicEnabled) { + if (this->Uic.Enabled) { ofs << "# UIC settings\n"; - CWriteSet("AM_UIC_SKIP", this->UicSkip); - CWrite("AM_UIC_TARGET_OPTIONS", this->UicOptions); - CWriteMap("AM_UIC_TARGET_OPTIONS", this->UicOptionsConfig); - CWriteList("AM_UIC_OPTIONS_FILES", this->UicFileFiles); - CWriteNestedLists("AM_UIC_OPTIONS_OPTIONS", this->UicFileOptions); - CWriteList("AM_UIC_SEARCH_PATHS", this->UicSearchPaths); + CWriteSet("AM_UIC_SKIP", this->Uic.Skip); + CWrite("AM_UIC_TARGET_OPTIONS", this->Uic.Options); + CWriteMap("AM_UIC_TARGET_OPTIONS", this->Uic.ConfigOptions); + CWriteList("AM_UIC_OPTIONS_FILES", this->Uic.FileFiles); + CWriteNestedLists("AM_UIC_OPTIONS_OPTIONS", this->Uic.FileOptions); + CWriteList("AM_UIC_SEARCH_PATHS", this->Uic.SearchPaths); } } else { std::string err = "AutoGen: Could not write file "; @@ -976,8 +977,8 @@ bool cmQtAutoGenInitializer::SetupCustomTargets() } // Generate auto RCC info files - if (this->RccEnabled) { - for (Qrc const& qrc : this->Qrcs) { + if (this->Rcc.Enabled) { + for (Qrc const& qrc : this->Rcc.Qrcs) { // Register rcc info file as generated makefile->AddCMakeOutputFile(qrc.InfoFile); @@ -1024,8 +1025,8 @@ bool cmQtAutoGenInitializer::SetupCustomTargets() } ofs << "# Rcc executable\n"; - CWrite("ARCC_RCC_EXECUTABLE", this->RccExecutable); - CWrite("ARCC_RCC_LIST_OPTIONS", cmJoin(this->RccListOptions, ";")); + CWrite("ARCC_RCC_EXECUTABLE", this->Rcc.Executable); + CWrite("ARCC_RCC_LIST_OPTIONS", cmJoin(this->Rcc.ListOptions, ";")); ofs << "# Rcc job\n"; CWrite("ARCC_LOCK_FILE", qrc.LockFile); @@ -1055,7 +1056,7 @@ bool cmQtAutoGenInitializer::SetupCustomTargetsMoc() // Moc predefs command if (this->Target->GetPropertyAsBool("AUTOMOC_COMPILER_PREDEFINES") && this->QtVersionGreaterOrEqual(5, 8)) { - this->MocPredefsCmd = + this->Moc.PredefsCmd = makefile->GetSafeDefinition("CMAKE_CXX_COMPILER_PREDEFINES_COMMAND"); } @@ -1079,20 +1080,20 @@ bool cmQtAutoGenInitializer::SetupCustomTargetsMoc() }; // Default configuration settings - this->MocIncludes = GetIncludeDirs(this->ConfigDefault); - this->MocDefines = GetCompileDefinitions(this->ConfigDefault); + this->Moc.Includes = GetIncludeDirs(this->ConfigDefault); + this->Moc.Defines = GetCompileDefinitions(this->ConfigDefault); // Other configuration settings for (std::string const& cfg : this->ConfigsList) { { std::string const configIncludeDirs = GetIncludeDirs(cfg); - if (configIncludeDirs != this->MocIncludes) { - this->MocIncludesConfig[cfg] = configIncludeDirs; + if (configIncludeDirs != this->Moc.Includes) { + this->Moc.ConfigIncludes[cfg] = configIncludeDirs; } } { std::string const configCompileDefs = GetCompileDefinitions(cfg); - if (configCompileDefs != this->MocDefines) { - this->MocDefinesConfig[cfg] = configCompileDefs; + if (configCompileDefs != this->Moc.Defines) { + this->Moc.ConfigDefines[cfg] = configCompileDefs; } } } @@ -1114,9 +1115,9 @@ bool cmQtAutoGenInitializer::SetupCustomTargetsUic() std::string const usp = this->Target->GetSafeProperty("AUTOUIC_SEARCH_PATHS"); if (!usp.empty()) { - cmSystemTools::ExpandListArgument(usp, this->UicSearchPaths); + cmSystemTools::ExpandListArgument(usp, this->Uic.SearchPaths); std::string const srcDir = makefile->GetCurrentSourceDirectory(); - for (std::string& path : this->UicSearchPaths) { + for (std::string& path : this->Uic.SearchPaths) { path = cmSystemTools::CollapseFullPath(path, srcDir); } } @@ -1130,13 +1131,13 @@ bool cmQtAutoGenInitializer::SetupCustomTargetsUic() }; // Default settings - this->UicOptions = UicGetOpts(this->ConfigDefault); + this->Uic.Options = UicGetOpts(this->ConfigDefault); // Configuration specific settings for (std::string const& cfg : this->ConfigsList) { std::string const configUicOpts = UicGetOpts(cfg); - if (configUicOpts != this->UicOptions) { - this->UicOptionsConfig[cfg] = configUicOpts; + if (configUicOpts != this->Uic.Options) { + this->Uic.ConfigOptions[cfg] = configUicOpts; } } } @@ -1158,17 +1159,17 @@ bool cmQtAutoGenInitializer::SetupCustomTargetsUic() // Check if the .ui file should be skipped if (sf->GetPropertyAsBool("SKIP_AUTOUIC") || sf->GetPropertyAsBool("SKIP_AUTOGEN")) { - this->UicSkip.insert(absFile); + this->Uic.Skip.insert(absFile); } // Check if the .ui file has uic options std::string const uicOpts = sf->GetSafeProperty("AUTOUIC_OPTIONS"); if (!uicOpts.empty()) { // Check if file isn't skipped - if (this->UicSkip.count(absFile) == 0) { - this->UicFileFiles.push_back(absFile); + if (this->Uic.Skip.count(absFile) == 0) { + this->Uic.FileFiles.push_back(absFile); std::vector optsVec; cmSystemTools::ExpandListArgument(uicOpts, optsVec); - this->UicFileOptions.push_back(std::move(optsVec)); + this->Uic.FileOptions.push_back(std::move(optsVec)); } } } @@ -1267,7 +1268,7 @@ bool cmQtAutoGenInitializer::GetMocExecutable() cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName); if (tgt != nullptr) { - this->MocExecutable = SafeString(tgt->ImportedGetLocation("")); + this->Moc.Executable = SafeString(tgt->ImportedGetLocation("")); } else { err = "Could not find target " + targetName; } @@ -1276,9 +1277,9 @@ bool cmQtAutoGenInitializer::GetMocExecutable() // Test moc command if (err.empty()) { - if (cmSystemTools::FileExists(this->MocExecutable, true)) { + if (cmSystemTools::FileExists(this->Moc.Executable, true)) { std::vector command; - command.push_back(this->MocExecutable); + command.push_back(this->Moc.Executable); command.push_back("-h"); std::string stdOut; std::string stdErr; @@ -1292,7 +1293,7 @@ bool cmQtAutoGenInitializer::GetMocExecutable() } } else { err = "The moc executable "; - err += Quoted(this->MocExecutable); + err += Quoted(this->Moc.Executable); err += " does not exist"; } } @@ -1328,7 +1329,7 @@ bool cmQtAutoGenInitializer::GetUicExecutable() cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName); if (tgt != nullptr) { - this->UicExecutable = SafeString(tgt->ImportedGetLocation("")); + this->Uic.Executable = SafeString(tgt->ImportedGetLocation("")); } else { if (this->QtVersionMajor == "5") { // Project does not use Qt5Widgets, but has AUTOUIC ON anyway @@ -1341,9 +1342,9 @@ bool cmQtAutoGenInitializer::GetUicExecutable() // Test uic command if (err.empty()) { - if (cmSystemTools::FileExists(this->UicExecutable, true)) { + if (cmSystemTools::FileExists(this->Uic.Executable, true)) { std::vector command; - command.push_back(this->UicExecutable); + command.push_back(this->Uic.Executable); command.push_back("-h"); std::string stdOut; std::string stdErr; @@ -1357,7 +1358,7 @@ bool cmQtAutoGenInitializer::GetUicExecutable() } } else { err = "The uic executable "; - err += Quoted(this->UicExecutable); + err += Quoted(this->Uic.Executable); err += " does not exist"; } } @@ -1393,7 +1394,7 @@ bool cmQtAutoGenInitializer::GetRccExecutable() cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName); if (tgt != nullptr) { - this->RccExecutable = SafeString(tgt->ImportedGetLocation("")); + this->Rcc.Executable = SafeString(tgt->ImportedGetLocation("")); } else { err = "Could not find target " + targetName; } @@ -1402,9 +1403,9 @@ bool cmQtAutoGenInitializer::GetRccExecutable() // Test rcc command if (err.empty()) { - if (cmSystemTools::FileExists(this->RccExecutable, true)) { + if (cmSystemTools::FileExists(this->Rcc.Executable, true)) { std::vector command; - command.push_back(this->RccExecutable); + command.push_back(this->Rcc.Executable); command.push_back("-h"); std::string stdOut; std::string stdErr; @@ -1416,9 +1417,9 @@ bool cmQtAutoGenInitializer::GetRccExecutable() // Detect if rcc supports (-)-list if (this->QtVersionMajor == "5") { if (stdOut.find("--list") != std::string::npos) { - this->RccListOptions.push_back("--list"); + this->Rcc.ListOptions.push_back("--list"); } else { - this->RccListOptions.push_back("-list"); + this->Rcc.ListOptions.push_back("-list"); } } } else { @@ -1427,7 +1428,7 @@ bool cmQtAutoGenInitializer::GetRccExecutable() } } else { err = "The rcc executable "; - err += Quoted(this->RccExecutable); + err += Quoted(this->Rcc.Executable); err += " does not exist"; } } @@ -1458,9 +1459,9 @@ bool cmQtAutoGenInitializer::RccListInputs(std::string const& fileName, error += "\n"; return false; } - if (!RccListOptions.empty()) { + if (!this->Rcc.ListOptions.empty()) { // Use rcc for file listing - if (RccExecutable.empty()) { + if (this->Rcc.Executable.empty()) { error = "rcc executable not available"; return false; } @@ -1479,8 +1480,9 @@ bool cmQtAutoGenInitializer::RccListInputs(std::string const& fileName, std::string rccStdErr; { std::vector cmd; - cmd.push_back(RccExecutable); - cmd.insert(cmd.end(), RccListOptions.begin(), RccListOptions.end()); + cmd.push_back(this->Rcc.Executable); + cmd.insert(cmd.end(), this->Rcc.ListOptions.begin(), + this->Rcc.ListOptions.end()); cmd.push_back(fileNameName); result = cmSystemTools::RunSingleCommand( cmd, &rccStdOut, &rccStdErr, &retVal, fileDir.c_str(), diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index bc78a03..0999e0f 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -72,17 +72,10 @@ private: private: cmGeneratorTarget* Target; - bool MocEnabled; - bool UicEnabled; - bool RccEnabled; bool MultiConfig; // Qt std::string QtVersionMajor; std::string QtVersionMinor; - std::string MocExecutable; - std::string UicExecutable; - std::string RccExecutable; - std::vector RccListOptions; // Configurations std::string ConfigDefault; std::vector ConfigsList; @@ -101,21 +94,37 @@ private: std::vector Headers; std::vector Sources; // Moc - std::string MocPredefsCmd; - std::set MocSkip; - std::string MocIncludes; - std::map MocIncludesConfig; - std::string MocDefines; - std::map MocDefinesConfig; + struct + { + bool Enabled; + std::string Executable; + std::string PredefsCmd; + std::set Skip; + std::string Includes; + std::map ConfigIncludes; + std::string Defines; + std::map ConfigDefines; + } Moc; // Uic - std::set UicSkip; - std::vector UicSearchPaths; - std::string UicOptions; - std::map UicOptionsConfig; - std::vector UicFileFiles; - std::vector> UicFileOptions; + struct + { + bool Enabled; + std::string Executable; + std::set Skip; + std::vector SearchPaths; + std::string Options; + std::map ConfigOptions; + std::vector FileFiles; + std::vector> FileOptions; + } Uic; // Rcc - std::vector Qrcs; + struct + { + bool Enabled; + std::string Executable; + std::vector ListOptions; + std::vector Qrcs; + } Rcc; }; #endif https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c6a8002827e0d23d27906ea5760a67981660f453 commit c6a8002827e0d23d27906ea5760a67981660f453 Author: Sebastian Holtermann AuthorDate: Wed Jul 11 13:29:49 2018 +0200 Commit: Sebastian Holtermann CommitDate: Wed Jul 11 13:29:49 2018 +0200 Autogen: Improve error detection during configuration cmQtAutoGenInitializer::InitCustomTargets and cmQtAutoGenInitializer::SetupCustomTargets now return their success value which gets evaluated and passed on by the caller (cmGlobalGenerator). Checks for the existance of the moc/uic/rcc binaries have been introduces in cmQtAutoGenInitializer. Additionally they get called once with a "-h" argument to determine if they're functional. This way any binary-not-found problem is caught during the configuration phase. diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 2872831..c401844 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1318,7 +1318,9 @@ bool cmGlobalGenerator::Compute() // the AUTOMOC, AUTOUIC or AUTORCC property set auto autogenInits = this->CreateQtAutoGenInitializers(); for (auto& autoGen : autogenInits) { - autoGen->InitCustomTargets(); + if (!autoGen->InitCustomTargets()) { + return false; + } } #endif @@ -1341,7 +1343,9 @@ bool cmGlobalGenerator::Compute() #ifdef CMAKE_BUILD_WITH_CMAKE for (auto& autoGen : autogenInits) { - autoGen->SetupCustomTargets(); + if (!autoGen->SetupCustomTargets()) { + return false; + } autoGen.reset(nullptr); } autogenInits.clear(); diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 8ede960..11ffe71 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -192,7 +192,7 @@ cmQtAutoGenInitializer::cmQtAutoGenInitializer( cmQtAutoGenInitializer::GetQtMinorVersion(target, this->QtVersionMajor); } -void cmQtAutoGenInitializer::InitCustomTargets() +bool cmQtAutoGenInitializer::InitCustomTargets() { cmMakefile* makefile = this->Target->Target->GetMakefile(); cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); @@ -319,51 +319,8 @@ void cmQtAutoGenInitializer::InitCustomTargets() // Acquire rcc executable and features if (this->RccEnabled) { - { - std::string err; - if (this->QtVersionMajor == "5") { - cmGeneratorTarget* tgt = - localGen->FindGeneratorTargetToUse("Qt5::rcc"); - if (tgt != nullptr) { - this->RccExecutable = SafeString(tgt->ImportedGetLocation("")); - } else { - err = "AUTORCC: Qt5::rcc target not found"; - } - } else if (QtVersionMajor == "4") { - cmGeneratorTarget* tgt = - localGen->FindGeneratorTargetToUse("Qt4::rcc"); - if (tgt != nullptr) { - this->RccExecutable = SafeString(tgt->ImportedGetLocation("")); - } else { - err = "AUTORCC: Qt4::rcc target not found"; - } - } else { - err = "The AUTORCC feature supports only Qt 4 and Qt 5"; - } - if (!err.empty()) { - err += " ("; - err += this->Target->GetName(); - err += ")"; - cmSystemTools::Error(err.c_str()); - } - } - // Detect if rcc supports (-)-list - if (!this->RccExecutable.empty() && (this->QtVersionMajor == "5")) { - std::vector command; - command.push_back(this->RccExecutable); - command.push_back("--help"); - std::string rccStdOut; - std::string rccStdErr; - int retVal = 0; - bool result = cmSystemTools::RunSingleCommand( - command, &rccStdOut, &rccStdErr, &retVal, nullptr, - cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto); - if (result && retVal == 0 && - rccStdOut.find("--list") != std::string::npos) { - this->RccListOptions.push_back("--list"); - } else { - this->RccListOptions.push_back("-list"); - } + if (!GetRccExecutable()) { + return false; } } @@ -704,6 +661,7 @@ void cmQtAutoGenInitializer::InitCustomTargets() } } else { cmSystemTools::Error(error.c_str()); + return false; } } makefile->AddCustomCommandToOutput(ccOutput, ccByproducts, ccDepends, @@ -863,17 +821,20 @@ void cmQtAutoGenInitializer::InitCustomTargets() this->Target->Target->AddUtility(this->AutogenTargetName, makefile); } } + + return true; } -void cmQtAutoGenInitializer::SetupCustomTargets() +bool cmQtAutoGenInitializer::SetupCustomTargets() { cmMakefile* makefile = this->Target->Target->GetMakefile(); // Create info directory on demand if (!cmSystemTools::MakeDirectory(this->DirInfo)) { - std::string emsg = ("Could not create directory: "); + std::string emsg = ("AutoGen: Could not create directory: "); emsg += Quoted(this->DirInfo); cmSystemTools::Error(emsg.c_str()); + return false; } // Configuration include directories @@ -1007,7 +968,10 @@ void cmQtAutoGenInitializer::SetupCustomTargets() CWriteList("AM_UIC_SEARCH_PATHS", this->UicSearchPaths); } } else { - return; + std::string err = "AutoGen: Could not write file "; + err += this->AutogenInfoFile; + cmSystemTools::Error(err.c_str()); + return false; } } @@ -1072,13 +1036,18 @@ void cmQtAutoGenInitializer::SetupCustomTargets() CWrite("ARCC_OPTIONS", cmJoin(qrc.Options, ";")); CWrite("ARCC_INPUTS", cmJoin(qrc.Resources, ";")); } else { - return; + std::string err = "AutoRcc: Could not write file "; + err += qrc.InfoFile; + cmSystemTools::Error(err.c_str()); + return false; } } } + + return true; } -void cmQtAutoGenInitializer::SetupCustomTargetsMoc() +bool cmQtAutoGenInitializer::SetupCustomTargetsMoc() { cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); cmMakefile* makefile = this->Target->Target->GetMakefile(); @@ -1129,41 +1098,14 @@ void cmQtAutoGenInitializer::SetupCustomTargetsMoc() } } - // Moc executable - { - std::string mocExec; - std::string err; - - if (this->QtVersionMajor == "5") { - cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse("Qt5::moc"); - if (tgt != nullptr) { - mocExec = SafeString(tgt->ImportedGetLocation("")); - } else { - err = "AUTOMOC: Qt5::moc target not found"; - } - } else if (this->QtVersionMajor == "4") { - cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse("Qt4::moc"); - if (tgt != nullptr) { - mocExec = SafeString(tgt->ImportedGetLocation("")); - } else { - err = "AUTOMOC: Qt4::moc target not found"; - } - } else { - err = "The AUTOMOC feature supports only Qt 4 and Qt 5"; - } - - if (err.empty()) { - this->MocExecutable = mocExec; - } else { - err += " ("; - err += this->Target->GetName(); - err += ")"; - cmSystemTools::Error(err.c_str()); - } + if (!GetMocExecutable()) { + return false; } + + return true; } -void cmQtAutoGenInitializer::SetupCustomTargetsUic() +bool cmQtAutoGenInitializer::SetupCustomTargetsUic() { cmMakefile* makefile = this->Target->Target->GetMakefile(); @@ -1233,39 +1175,11 @@ void cmQtAutoGenInitializer::SetupCustomTargetsUic() } } - // Uic executable - { - std::string err; - std::string uicExec; - - cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); - if (this->QtVersionMajor == "5") { - cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse("Qt5::uic"); - if (tgt != nullptr) { - uicExec = SafeString(tgt->ImportedGetLocation("")); - } else { - // Project does not use Qt5Widgets, but has AUTOUIC ON anyway - } - } else if (this->QtVersionMajor == "4") { - cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse("Qt4::uic"); - if (tgt != nullptr) { - uicExec = SafeString(tgt->ImportedGetLocation("")); - } else { - err = "AUTOUIC: Qt4::uic target not found"; - } - } else { - err = "The AUTOUIC feature supports only Qt 4 and Qt 5"; - } - - if (err.empty()) { - this->UicExecutable = uicExec; - } else { - err += " ("; - err += this->Target->GetName(); - err += ")"; - cmSystemTools::Error(err.c_str()); - } + if (!GetUicExecutable()) { + return false; } + + return true; } void cmQtAutoGenInitializer::AddGeneratedSource(std::string const& filename, @@ -1335,6 +1249,202 @@ bool cmQtAutoGenInitializer::QtVersionGreaterOrEqual( return false; } +bool cmQtAutoGenInitializer::GetMocExecutable() +{ + std::string err; + + // Find moc executable + { + std::string targetName; + if (this->QtVersionMajor == "5") { + targetName = "Qt5::moc"; + } else if (QtVersionMajor == "4") { + targetName = "Qt4::moc"; + } else { + err = "The AUTOMOC feature supports only Qt 4 and Qt 5"; + } + if (!targetName.empty()) { + cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); + cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName); + if (tgt != nullptr) { + this->MocExecutable = SafeString(tgt->ImportedGetLocation("")); + } else { + err = "Could not find target " + targetName; + } + } + } + + // Test moc command + if (err.empty()) { + if (cmSystemTools::FileExists(this->MocExecutable, true)) { + std::vector command; + command.push_back(this->MocExecutable); + command.push_back("-h"); + std::string stdOut; + std::string stdErr; + int retVal = 0; + bool result = cmSystemTools::RunSingleCommand( + command, &stdOut, &stdErr, &retVal, nullptr, + cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto); + if (!result) { + err = "The moc test command failed: "; + err += QuotedCommand(command); + } + } else { + err = "The moc executable "; + err += Quoted(this->MocExecutable); + err += " does not exist"; + } + } + + // Print error + if (!err.empty()) { + std::string msg = "AutoMoc ("; + msg += this->Target->GetName(); + msg += "): "; + msg += err; + cmSystemTools::Error(msg.c_str()); + return false; + } + + return true; +} + +bool cmQtAutoGenInitializer::GetUicExecutable() +{ + std::string err; + + // Find uic executable + { + std::string targetName; + if (this->QtVersionMajor == "5") { + targetName = "Qt5::uic"; + } else if (QtVersionMajor == "4") { + targetName = "Qt4::uic"; + } else { + err = "The AUTOUIC feature supports only Qt 4 and Qt 5"; + } + if (!targetName.empty()) { + cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); + cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName); + if (tgt != nullptr) { + this->UicExecutable = SafeString(tgt->ImportedGetLocation("")); + } else { + if (this->QtVersionMajor == "5") { + // Project does not use Qt5Widgets, but has AUTOUIC ON anyway + } else { + err = "Could not find target " + targetName; + } + } + } + } + + // Test uic command + if (err.empty()) { + if (cmSystemTools::FileExists(this->UicExecutable, true)) { + std::vector command; + command.push_back(this->UicExecutable); + command.push_back("-h"); + std::string stdOut; + std::string stdErr; + int retVal = 0; + bool result = cmSystemTools::RunSingleCommand( + command, &stdOut, &stdErr, &retVal, nullptr, + cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto); + if (!result) { + err = "The uic test command failed: "; + err += QuotedCommand(command); + } + } else { + err = "The uic executable "; + err += Quoted(this->UicExecutable); + err += " does not exist"; + } + } + + // Print error + if (!err.empty()) { + std::string msg = "AutoUic ("; + msg += this->Target->GetName(); + msg += "): "; + msg += err; + cmSystemTools::Error(msg.c_str()); + return false; + } + + return true; +} + +bool cmQtAutoGenInitializer::GetRccExecutable() +{ + std::string err; + + // Find rcc executable + { + std::string targetName; + if (this->QtVersionMajor == "5") { + targetName = "Qt5::rcc"; + } else if (QtVersionMajor == "4") { + targetName = "Qt4::rcc"; + } else { + err = "The AUTORCC feature supports only Qt 4 and Qt 5"; + } + if (!targetName.empty()) { + cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); + cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName); + if (tgt != nullptr) { + this->RccExecutable = SafeString(tgt->ImportedGetLocation("")); + } else { + err = "Could not find target " + targetName; + } + } + } + + // Test rcc command + if (err.empty()) { + if (cmSystemTools::FileExists(this->RccExecutable, true)) { + std::vector command; + command.push_back(this->RccExecutable); + command.push_back("-h"); + std::string stdOut; + std::string stdErr; + int retVal = 0; + bool result = cmSystemTools::RunSingleCommand( + command, &stdOut, &stdErr, &retVal, nullptr, + cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto); + if (result) { + // Detect if rcc supports (-)-list + if (this->QtVersionMajor == "5") { + if (stdOut.find("--list") != std::string::npos) { + this->RccListOptions.push_back("--list"); + } else { + this->RccListOptions.push_back("-list"); + } + } + } else { + err = "The rcc test command failed: "; + err += QuotedCommand(command); + } + } else { + err = "The rcc executable "; + err += Quoted(this->RccExecutable); + err += " does not exist"; + } + } + + // Print error + if (!err.empty()) { + std::string msg = "AutoRcc ("; + msg += this->Target->GetName(); + msg += "): "; + msg += err; + cmSystemTools::Error(msg.c_str()); + return false; + } + + return true; +} + /// @brief Reads the resource files list from from a .qrc file /// @arg fileName Must be the absolute path of the .qrc file /// @return True if the rcc file was successfully read diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index 813c680..bc78a03 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -50,18 +50,22 @@ public: bool uicEnabled, bool rccEnabled, std::string const& qtVersionMajor); - void InitCustomTargets(); - void SetupCustomTargets(); + bool InitCustomTargets(); + bool SetupCustomTargets(); private: - void SetupCustomTargetsMoc(); - void SetupCustomTargetsUic(); + bool SetupCustomTargetsMoc(); + bool SetupCustomTargetsUic(); void AddGeneratedSource(std::string const& filename, GeneratorT genType); bool QtVersionGreaterOrEqual(unsigned long requestMajor, unsigned long requestMinor) const; + bool GetMocExecutable(); + bool GetUicExecutable(); + bool GetRccExecutable(); + bool RccListInputs(std::string const& fileName, std::vector& files, std::string& errorMessage); ----------------------------------------------------------------------- Summary of changes: Source/CPack/WiX/cmCPackWIXGenerator.cxx | 4 + Source/cmGeneratorTarget.cxx | 6 +- Source/cmGeneratorTarget.h | 2 +- Source/cmGlobalGenerator.cxx | 8 +- Source/cmQtAutoGenInitializer.cxx | 497 +++++++++++++++++++------------ Source/cmQtAutoGenInitializer.h | 61 ++-- 6 files changed, 352 insertions(+), 226 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sat Jul 14 00:05:12 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 14 Jul 2018 00:05:12 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc3-221-gc960907 Message-ID: <20180714040512.ACEBD11DB14@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 c96090710563d4dc464fddab70db3680c8099211 (commit) from 102f51d0aad6826864d6c6da6c2c2f9c6682b28d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c96090710563d4dc464fddab70db3680c8099211 commit c96090710563d4dc464fddab70db3680c8099211 Author: Kitware Robot AuthorDate: Sat Jul 14 00:01:13 2018 -0400 Commit: Kitware Robot CommitDate: Sat Jul 14 00:01:13 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9eb3ade..7ddb096 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 12) -set(CMake_VERSION_PATCH 20180713) +set(CMake_VERSION_PATCH 20180714) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sun Jul 15 00:05:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 15 Jul 2018 00:05:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc3-222-g1a1eeda Message-ID: <20180715040507.0040011D7F2@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 1a1eeda75a73f14e3e7f0b175f86679a410e1af4 (commit) from c96090710563d4dc464fddab70db3680c8099211 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1a1eeda75a73f14e3e7f0b175f86679a410e1af4 commit 1a1eeda75a73f14e3e7f0b175f86679a410e1af4 Author: Kitware Robot AuthorDate: Sun Jul 15 00:01:05 2018 -0400 Commit: Kitware Robot CommitDate: Sun Jul 15 00:01:05 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7ddb096..5fab9c9 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 12) -set(CMake_VERSION_PATCH 20180714) +set(CMake_VERSION_PATCH 20180715) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jul 16 00:05:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 16 Jul 2018 00:05:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc3-223-g992e9d1 Message-ID: <20180716040504.05E4B113E77@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 992e9d10f818ead64f08b435432a6c5b5a0f6916 (commit) from 1a1eeda75a73f14e3e7f0b175f86679a410e1af4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=992e9d10f818ead64f08b435432a6c5b5a0f6916 commit 992e9d10f818ead64f08b435432a6c5b5a0f6916 Author: Kitware Robot AuthorDate: Mon Jul 16 00:01:04 2018 -0400 Commit: Kitware Robot CommitDate: Mon Jul 16 00:01:04 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 5fab9c9..7d7ef46 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 12) -set(CMake_VERSION_PATCH 20180715) +set(CMake_VERSION_PATCH 20180716) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jul 16 08:25:03 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 16 Jul 2018 08:25:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc3-225-g4b00e57 Message-ID: <20180716122503.9A4F611DBDD@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 4b00e57de8aaed500de945411912b828892e84d3 (commit) via 82f39c9ce9e9ce9827b4a27abf3f6a1af427a5d2 (commit) from 992e9d10f818ead64f08b435432a6c5b5a0f6916 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4b00e57de8aaed500de945411912b828892e84d3 commit 4b00e57de8aaed500de945411912b828892e84d3 Merge: 992e9d1 82f39c9 Author: Brad King AuthorDate: Mon Jul 16 12:21:49 2018 +0000 Commit: Kitware Robot CommitDate: Mon Jul 16 08:21:55 2018 -0400 Merge topic 'FindXercesC-versioned-names' 82f39c9ce9 FindXercesC: Search for version-named library files Acked-by: Kitware Robot Acked-by: Roger Leigh Merge-request: !2210 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=82f39c9ce9e9ce9827b4a27abf3f6a1af427a5d2 commit 82f39c9ce9e9ce9827b4a27abf3f6a1af427a5d2 Author: Raul Metsma AuthorDate: Wed Jul 11 16:43:34 2018 -0400 Commit: Brad King CommitDate: Fri Jul 13 09:01:47 2018 -0400 FindXercesC: Search for version-named library files Use the version number extracted from the header file to construct versioned library names. This approach is already used by `FindXalanC`. Signed-off-by: Raul Metsma diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake index 51e68d5..267c164 100644 --- a/Modules/FindXercesC.cmake +++ b/Modules/FindXercesC.cmake @@ -59,6 +59,9 @@ function(_XercesC_GET_VERSION version_hdr) endif() set(XercesC_VERSION "${XercesC_MAJOR}.${XercesC_MINOR}.${XercesC_PATCH}" PARENT_SCOPE) + set(XercesC_VERSION_MAJOR "${XercesC_MAJOR}" PARENT_SCOPE) + set(XercesC_VERSION_MINOR "${XercesC_MINOR}" PARENT_SCOPE) + set(XercesC_VERSION_PATCH "${XercesC_PATCH}" PARENT_SCOPE) else() message(FATAL_ERROR "Include file ${version_hdr} does not exist or does not contain expected version information") endif() @@ -73,16 +76,20 @@ mark_as_advanced(XercesC_INCLUDE_DIR) if(NOT XercesC_LIBRARY) # Find all XercesC libraries find_library(XercesC_LIBRARY_RELEASE - NAMES "xerces-c" "xerces-c_3" + NAMES "xerces-c" "xerces-c_${XercesC_VERSION_MAJOR}" DOC "Xerces-C++ libraries (release)") find_library(XercesC_LIBRARY_DEBUG - NAMES "xerces-cd" "xerces-c_3D" "xerces-c_3_1D" + NAMES "xerces-cd" "xerces-c_${XercesC_VERSION_MAJOR}D" "xerces-c_${XercesC_VERSION_MAJOR}_${XercesC_VERSION_MINOR}D" DOC "Xerces-C++ libraries (debug)") include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) select_library_configurations(XercesC) mark_as_advanced(XercesC_LIBRARY_RELEASE XercesC_LIBRARY_DEBUG) endif() +unset(XercesC_VERSION_MAJOR) +unset(XercesC_VERSION_MINOR) +unset(XercesC_VERSION_PATCH) + if(XercesC_INCLUDE_DIR) _XercesC_GET_VERSION("${XercesC_INCLUDE_DIR}/xercesc/util/XercesVersion.hpp") endif() ----------------------------------------------------------------------- Summary of changes: Modules/FindXercesC.cmake | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jul 16 09:15:03 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 16 Jul 2018 09:15:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc3-229-gde34206 Message-ID: <20180716131503.751EE1124B4@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 de342066d342312e14aee767e6a1c2b573e80dc2 (commit) via 42065828c39a45737101add86f070ae83e6c61f1 (commit) via d240bb9a410b715ef8aae8a40a74bff5504b6dd4 (commit) via 62b4df1e84104f6c30492fdc12f25fb3cc72f736 (commit) from 4b00e57de8aaed500de945411912b828892e84d3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=de342066d342312e14aee767e6a1c2b573e80dc2 commit de342066d342312e14aee767e6a1c2b573e80dc2 Merge: 4206582 d240bb9 Author: Brad King AuthorDate: Mon Jul 16 09:07:38 2018 -0400 Commit: Brad King CommitDate: Mon Jul 16 09:07:38 2018 -0400 Merge branch 'release-3.12' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=42065828c39a45737101add86f070ae83e6c61f1 commit 42065828c39a45737101add86f070ae83e6c61f1 Merge: 4b00e57 62b4df1 Author: Brad King AuthorDate: Mon Jul 16 13:07:18 2018 +0000 Commit: Kitware Robot CommitDate: Mon Jul 16 09:07:23 2018 -0400 Merge topic 'doc-add_library-IMPORTED_OBJECTS' 62b4df1e84 Help: Mention IMPORTED_OBJECTS in add_library docs Acked-by: Kitware Robot Merge-request: !2216 ----------------------------------------------------------------------- Summary of changes: Help/command/add_library.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jul 16 09:15:03 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 16 Jul 2018 09:15:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.12.0-rc3-11-gd240bb9 Message-ID: <20180716131503.8AD7B1126B7@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via d240bb9a410b715ef8aae8a40a74bff5504b6dd4 (commit) via 62b4df1e84104f6c30492fdc12f25fb3cc72f736 (commit) from e109dc0b2a68999dec742689955b7b2701025d6f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Help/command/add_library.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jul 17 00:05:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 17 Jul 2018 00:05:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc3-230-g328410f Message-ID: <20180717040504.59D1D110790@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 328410f26b86a7446035fa922a1ffb066b53bcf8 (commit) from de342066d342312e14aee767e6a1c2b573e80dc2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=328410f26b86a7446035fa922a1ffb066b53bcf8 commit 328410f26b86a7446035fa922a1ffb066b53bcf8 Author: Kitware Robot AuthorDate: Tue Jul 17 00:01:08 2018 -0400 Commit: Kitware Robot CommitDate: Tue Jul 17 00:01:08 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7d7ef46..7504236 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 12) -set(CMake_VERSION_PATCH 20180716) +set(CMake_VERSION_PATCH 20180717) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jul 17 07:15:09 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 17 Jul 2018 07:15:09 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc3-243-g7ebc06f Message-ID: <20180717111509.E2AD4110658@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 7ebc06fb021353bde23a2ae858f9e3785ec5b720 (commit) via e78fc81d4a161c88ddd11366e261d18033dd9bf7 (commit) via e08f02b9282dc8e09bfb49955806f82e1d48415c (commit) via 689ce111a8bc20b3dfc60326b65fc03e918c9679 (commit) via 406f397e8b5524107457cc2d70bd22878350e9e1 (commit) via dd5c54600b6f651898925bfd9ec4406ccfc7be95 (commit) via 185bcface43d95b062c5be16321ae9aa59ed0057 (commit) via 71d99e156badae2e12eca56b2b2fa4059cf67cf9 (commit) via 2ae2d0bd3e01e6f8f02281d00a1df87f209fa6b5 (commit) via 1385b4b1138eeebd79b6dab940915b509a82cb5f (commit) via 1bcc0f3678daea6bb7f999ebded1eab471b32e28 (commit) via dee7bafb13c654a2d62196451f013ef40dd2120f (commit) via 5f431789a9b7dfcd3e350d08fb71521999d2be5c (commit) from 328410f26b86a7446035fa922a1ffb066b53bcf8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7ebc06fb021353bde23a2ae858f9e3785ec5b720 commit 7ebc06fb021353bde23a2ae858f9e3785ec5b720 Merge: e78fc81 406f397 Author: Brad King AuthorDate: Tue Jul 17 11:14:42 2018 +0000 Commit: Kitware Robot CommitDate: Tue Jul 17 07:14:48 2018 -0400 Merge topic 'math-err' 406f397e8b math: Restore toleration of unexpected characters in an expression dd5c54600b cmExprParserHelper: Simplify error state tracking 185bcface4 cmExprParserHelper: Remove some unused code Acked-by: Kitware Robot Merge-request: !2218 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e78fc81d4a161c88ddd11366e261d18033dd9bf7 commit e78fc81d4a161c88ddd11366e261d18033dd9bf7 Merge: e08f02b 71d99e1 Author: Brad King AuthorDate: Tue Jul 17 11:13:12 2018 +0000 Commit: Kitware Robot CommitDate: Tue Jul 17 07:13:18 2018 -0400 Merge topic 'FindProtobuf-upstream-impl' 71d99e156b Protobuf: restore previous output directory 2ae2d0bd3e Protobuf: restore 'DESCRIPTORS' support 1385b4b113 Protobuf: restore 'PROTOBUF_IMPORT_DIRS' check 1bcc0f3678 Protobuf: use upstream implementation to generate cpp and python files Acked-by: Kitware Robot Merge-request: !2212 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e08f02b9282dc8e09bfb49955806f82e1d48415c commit e08f02b9282dc8e09bfb49955806f82e1d48415c Merge: 689ce11 5f43178 Author: Brad King AuthorDate: Tue Jul 17 11:12:23 2018 +0000 Commit: Kitware Robot CommitDate: Tue Jul 17 07:12:29 2018 -0400 Merge topic 'hex_file' 5f431789a9 Use isxdigit() to determine if a character is a hex digit Acked-by: Kitware Robot Merge-request: !2213 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=689ce111a8bc20b3dfc60326b65fc03e918c9679 commit 689ce111a8bc20b3dfc60326b65fc03e918c9679 Merge: 328410f dee7baf Author: Brad King AuthorDate: Tue Jul 17 11:11:32 2018 +0000 Commit: Kitware Robot CommitDate: Tue Jul 17 07:11:38 2018 -0400 Merge topic 'FindOpenCL-arch-paths' dee7bafb13 FindOpenCL: Search per-architecture path suffixes on UNIX Acked-by: Kitware Robot Merge-request: !2215 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=406f397e8b5524107457cc2d70bd22878350e9e1 commit 406f397e8b5524107457cc2d70bd22878350e9e1 Author: Brad King AuthorDate: Mon Jul 16 13:06:29 2018 -0400 Commit: Brad King CommitDate: Mon Jul 16 14:46:43 2018 -0400 math: Restore toleration of unexpected characters in an expression Prior to commit 7c4c13ffef (math: Reject unexpected expression input explicitly, 2018-05-18) we ignored unexpected characters in an expression that otherwise can be parsed. In order to preserve compatibility with projects that accidentally used this, convert the error to a warning. diff --git a/Source/LexerParser/cmExprLexer.cxx b/Source/LexerParser/cmExprLexer.cxx index 1548daf..cb24687 100644 --- a/Source/LexerParser/cmExprLexer.cxx +++ b/Source/LexerParser/cmExprLexer.cxx @@ -1050,7 +1050,7 @@ YY_RULE_SETUP YY_BREAK case 17: YY_RULE_SETUP -{return exp_UNEXPECTED;} +{ yyextra->UnexpectedChar(yytext[0]); } YY_BREAK case 18: YY_RULE_SETUP diff --git a/Source/LexerParser/cmExprLexer.in.l b/Source/LexerParser/cmExprLexer.in.l index 87237d1..2197c2a 100644 --- a/Source/LexerParser/cmExprLexer.in.l +++ b/Source/LexerParser/cmExprLexer.in.l @@ -58,6 +58,6 @@ Modify cmExprLexer.cxx: ">>" { return exp_SHIFTRIGHT; } "(" { return exp_OPENPARENT; } ")" { return exp_CLOSEPARENT; } -. {return exp_UNEXPECTED;} +. { yyextra->UnexpectedChar(yytext[0]); } %% diff --git a/Source/LexerParser/cmExprParser.cxx b/Source/LexerParser/cmExprParser.cxx index cbb8078..fbc3628 100644 --- a/Source/LexerParser/cmExprParser.cxx +++ b/Source/LexerParser/cmExprParser.cxx @@ -157,8 +157,7 @@ extern int cmExpr_yydebug; exp_AND = 268, exp_XOR = 269, exp_NOT = 270, - exp_NUMBER = 271, - exp_UNEXPECTED = 272 + exp_NUMBER = 271 }; #endif /* Tokens. */ @@ -176,7 +175,6 @@ extern int cmExpr_yydebug; #define exp_XOR 269 #define exp_NOT 270 #define exp_NUMBER 271 -#define exp_UNEXPECTED 272 /* Value type. */ @@ -188,7 +186,7 @@ int cmExpr_yyparse (yyscan_t yyscanner); /* Copy the second part of user declarations. */ -#line 192 "cmExprParser.cxx" /* yacc.c:358 */ +#line 190 "cmExprParser.cxx" /* yacc.c:358 */ #ifdef short # undef short @@ -433,7 +431,7 @@ union yyalloc #define YYLAST 30 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 18 +#define YYNTOKENS 17 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 10 /* YYNRULES -- Number of rules. */ @@ -444,7 +442,7 @@ union yyalloc /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 272 +#define YYMAXUTOK 271 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -480,16 +478,16 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17 + 15, 16 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 75, 75, 80, 83, 88, 91, 96, 99, 104, - 107, 110, 115, 118, 121, 126, 129, 132, 138, 143, - 146, 149, 154, 157 + 0, 74, 74, 79, 82, 87, 90, 95, 98, 103, + 106, 109, 114, 117, 120, 125, 128, 131, 137, 142, + 145, 148, 153, 156 }; #endif @@ -501,9 +499,8 @@ static const char *const yytname[] = "$end", "error", "$undefined", "exp_PLUS", "exp_MINUS", "exp_TIMES", "exp_DIVIDE", "exp_MOD", "exp_SHIFTLEFT", "exp_SHIFTRIGHT", "exp_OPENPARENT", "exp_CLOSEPARENT", "exp_OR", "exp_AND", "exp_XOR", - "exp_NOT", "exp_NUMBER", "\"character\"", "$accept", "start", "exp", - "bitwiseor", "bitwisexor", "bitwiseand", "shift", "term", "unary", - "factor", YY_NULLPTR + "exp_NOT", "exp_NUMBER", "$accept", "start", "exp", "bitwiseor", + "bitwisexor", "bitwiseand", "shift", "term", "unary", "factor", YY_NULLPTR }; #endif @@ -513,7 +510,7 @@ static const char *const yytname[] = static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272 + 265, 266, 267, 268, 269, 270, 271 }; # endif @@ -583,18 +580,18 @@ static const yytype_int8 yycheck[] = symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 3, 4, 10, 16, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 26, 26, 20, 0, 12, 14, - 13, 8, 9, 3, 4, 5, 6, 7, 11, 21, - 22, 23, 24, 24, 25, 25, 26, 26, 26 + 0, 3, 4, 10, 16, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 25, 25, 19, 0, 12, 14, + 13, 8, 9, 3, 4, 5, 6, 7, 11, 20, + 21, 22, 23, 23, 24, 24, 25, 25, 25 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 18, 19, 20, 20, 21, 21, 22, 22, 23, - 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, - 26, 26, 27, 27 + 0, 17, 18, 19, 19, 20, 20, 21, 21, 22, + 22, 22, 23, 23, 23, 24, 24, 24, 24, 25, + 25, 25, 26, 26 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ @@ -1285,186 +1282,186 @@ yyreduce: switch (yyn) { case 2: -#line 75 "cmExprParser.y" /* yacc.c:1646 */ +#line 74 "cmExprParser.y" /* yacc.c:1646 */ { cmExpr_yyget_extra(yyscanner)->SetResult((yyvsp[0].Number)); } -#line 1293 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1290 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 3: -#line 80 "cmExprParser.y" /* yacc.c:1646 */ +#line 79 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1301 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1298 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 4: -#line 83 "cmExprParser.y" /* yacc.c:1646 */ +#line 82 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) | (yyvsp[0].Number); } -#line 1309 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1306 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 5: -#line 88 "cmExprParser.y" /* yacc.c:1646 */ +#line 87 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1317 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1314 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 6: -#line 91 "cmExprParser.y" /* yacc.c:1646 */ +#line 90 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) ^ (yyvsp[0].Number); } -#line 1325 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1322 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 7: -#line 96 "cmExprParser.y" /* yacc.c:1646 */ +#line 95 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1333 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1330 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 8: -#line 99 "cmExprParser.y" /* yacc.c:1646 */ +#line 98 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) & (yyvsp[0].Number); } -#line 1341 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1338 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 9: -#line 104 "cmExprParser.y" /* yacc.c:1646 */ +#line 103 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1349 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1346 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 10: -#line 107 "cmExprParser.y" /* yacc.c:1646 */ +#line 106 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) << (yyvsp[0].Number); } -#line 1357 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1354 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 11: -#line 110 "cmExprParser.y" /* yacc.c:1646 */ +#line 109 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) >> (yyvsp[0].Number); } -#line 1365 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1362 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 12: -#line 115 "cmExprParser.y" /* yacc.c:1646 */ +#line 114 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1373 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1370 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 13: -#line 118 "cmExprParser.y" /* yacc.c:1646 */ +#line 117 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) + (yyvsp[0].Number); } -#line 1381 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1378 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 14: -#line 121 "cmExprParser.y" /* yacc.c:1646 */ +#line 120 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) - (yyvsp[0].Number); } -#line 1389 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1386 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 15: -#line 126 "cmExprParser.y" /* yacc.c:1646 */ +#line 125 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1397 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1394 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 16: -#line 129 "cmExprParser.y" /* yacc.c:1646 */ +#line 128 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) * (yyvsp[0].Number); } -#line 1405 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1402 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 17: -#line 132 "cmExprParser.y" /* yacc.c:1646 */ +#line 131 "cmExprParser.y" /* yacc.c:1646 */ { if (yyvsp[0].Number == 0) { throw std::overflow_error("divide by zero"); } (yyval.Number) = (yyvsp[-2].Number) / (yyvsp[0].Number); } -#line 1416 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1413 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 18: -#line 138 "cmExprParser.y" /* yacc.c:1646 */ +#line 137 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) % (yyvsp[0].Number); } -#line 1424 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1421 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 19: -#line 143 "cmExprParser.y" /* yacc.c:1646 */ +#line 142 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1432 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1429 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 20: -#line 146 "cmExprParser.y" /* yacc.c:1646 */ +#line 145 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = + (yyvsp[0].Number); } -#line 1440 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1437 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 21: -#line 149 "cmExprParser.y" /* yacc.c:1646 */ +#line 148 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = - (yyvsp[0].Number); } -#line 1448 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1445 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 22: -#line 154 "cmExprParser.y" /* yacc.c:1646 */ +#line 153 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1456 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1453 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 23: -#line 157 "cmExprParser.y" /* yacc.c:1646 */ +#line 156 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-1].Number); } -#line 1464 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1461 "cmExprParser.cxx" /* yacc.c:1646 */ break; -#line 1468 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1465 "cmExprParser.cxx" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1694,7 +1691,7 @@ yyreturn: #endif return yyresult; } -#line 162 "cmExprParser.y" /* yacc.c:1906 */ +#line 161 "cmExprParser.y" /* yacc.c:1906 */ /* End of grammar */ diff --git a/Source/LexerParser/cmExprParser.y b/Source/LexerParser/cmExprParser.y index 510daaa..921b31d 100644 --- a/Source/LexerParser/cmExprParser.y +++ b/Source/LexerParser/cmExprParser.y @@ -64,7 +64,6 @@ static void cmExpr_yyerror(yyscan_t yyscanner, const char* message); %token exp_XOR; %token exp_NOT; %token exp_NUMBER; -%token exp_UNEXPECTED "character"; /*-------------------------------------------------------------------------*/ /* grammar */ diff --git a/Source/LexerParser/cmExprParserTokens.h b/Source/LexerParser/cmExprParserTokens.h index 00be4e9..84b2bbd 100644 --- a/Source/LexerParser/cmExprParserTokens.h +++ b/Source/LexerParser/cmExprParserTokens.h @@ -58,8 +58,7 @@ extern int cmExpr_yydebug; exp_AND = 268, exp_XOR = 269, exp_NOT = 270, - exp_NUMBER = 271, - exp_UNEXPECTED = 272 + exp_NUMBER = 271 }; #endif /* Tokens. */ @@ -77,7 +76,6 @@ extern int cmExpr_yydebug; #define exp_XOR 269 #define exp_NOT 270 #define exp_NUMBER 271 -#define exp_UNEXPECTED 272 /* Value type. */ diff --git a/Source/cmExprParserHelper.cxx b/Source/cmExprParserHelper.cxx index 821667b..8d3dad7 100644 --- a/Source/cmExprParserHelper.cxx +++ b/Source/cmExprParserHelper.cxx @@ -101,6 +101,15 @@ void cmExprParserHelper::Error(const char* str) this->ErrorString = ostr.str(); } +void cmExprParserHelper::UnexpectedChar(char c) +{ + unsigned long pos = static_cast(this->InputBufferPos); + std::ostringstream ostr; + ostr << "Unexpected character in expression at position " << pos << ": " << c + << "\n"; + this->WarningString += ostr.str(); +} + void cmExprParserHelper::SetResult(KWIML_INT_int64_t value) { this->Result = value; diff --git a/Source/cmExprParserHelper.h b/Source/cmExprParserHelper.h index 15e8f3e..42c460a 100644 --- a/Source/cmExprParserHelper.h +++ b/Source/cmExprParserHelper.h @@ -32,6 +32,10 @@ public: const char* GetError() { return this->ErrorString.c_str(); } + void UnexpectedChar(char c); + + std::string const& GetWarning() const { return this->WarningString; } + private: std::string::size_type InputBufferPos; std::string InputBuffer; @@ -47,6 +51,7 @@ private: const char* FileName; long FileLine; std::string ErrorString; + std::string WarningString; }; #define YYSTYPE cmExprParserHelper::ParserType diff --git a/Source/cmMathCommand.cxx b/Source/cmMathCommand.cxx index 5d1b099..a50e5fc 100644 --- a/Source/cmMathCommand.cxx +++ b/Source/cmMathCommand.cxx @@ -5,6 +5,7 @@ #include "cmExprParserHelper.h" #include "cmMakefile.h" #include "cm_kwiml.h" +#include "cmake.h" #include @@ -101,6 +102,11 @@ bool cmMathCommand::HandleExprCommand(std::vector const& args) } sprintf(buffer, fmt, helper.GetResult()); + std::string const& w = helper.GetWarning(); + if (!w.empty()) { + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w); + } + this->Makefile->AddDefinition(outputVariable, buffer); return true; } diff --git a/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt b/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt index 18ac9f7..9e73ed5 100644 --- a/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt +++ b/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt @@ -1,6 +1,5 @@ ^CMake Error at MATH-InvalidExpression.cmake:1 \(math\): - *math cannot parse the expression: "INVALID": syntax error, unexpected - *character, expecting exp_PLUS or exp_MINUS or exp_OPENPARENT or exp_NUMBER - *\(1\). + math cannot parse the expression: "INVALID": syntax error, unexpected \$end, + expecting exp_PLUS or exp_MINUS or exp_OPENPARENT or exp_NUMBER \(7\). Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt b/Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt new file mode 100644 index 0000000..732ce6f --- /dev/null +++ b/Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt @@ -0,0 +1,8 @@ +^CMake Warning \(dev\) at MATH-ToleratedExpression.cmake:1 \(math\): + Unexpected character in expression at position 1: ' + + Unexpected character in expression at position 7: ' + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/math/MATH-ToleratedExpression.cmake b/Tests/RunCMake/math/MATH-ToleratedExpression.cmake new file mode 100644 index 0000000..d1be218 --- /dev/null +++ b/Tests/RunCMake/math/MATH-ToleratedExpression.cmake @@ -0,0 +1,4 @@ +math(EXPR var "'2*1-1'") +if(NOT var EQUAL 1) + message(FATAL_ERROR "Expression did not evaluate to 1") +endif() diff --git a/Tests/RunCMake/math/RunCMakeTest.cmake b/Tests/RunCMake/math/RunCMakeTest.cmake index 494b813..a4d5c31 100644 --- a/Tests/RunCMake/math/RunCMakeTest.cmake +++ b/Tests/RunCMake/math/RunCMakeTest.cmake @@ -5,4 +5,5 @@ run_cmake(MATH-WrongArgument) run_cmake(MATH-DoubleOption) run_cmake(MATH-TooManyArguments) run_cmake(MATH-InvalidExpression) +run_cmake(MATH-ToleratedExpression) run_cmake(MATH-DivideByZero) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dd5c54600b6f651898925bfd9ec4406ccfc7be95 commit dd5c54600b6f651898925bfd9ec4406ccfc7be95 Author: Brad King AuthorDate: Mon Jul 16 13:04:06 2018 -0400 Commit: Brad King CommitDate: Mon Jul 16 13:04:06 2018 -0400 cmExprParserHelper: Simplify error state tracking Errors always have explanation strings, so use the presence of such a string to track whether an error has occurred. This avoids an extra variable. diff --git a/Source/cmExprParserHelper.cxx b/Source/cmExprParserHelper.cxx index 1f38d33..821667b 100644 --- a/Source/cmExprParserHelper.cxx +++ b/Source/cmExprParserHelper.cxx @@ -39,10 +39,9 @@ int cmExprParserHelper::ParseString(const char* str, int verb) yyscan_t yyscanner; cmExpr_yylex_init(&yyscanner); cmExpr_yyset_extra(this, yyscanner); - int res; try { - res = cmExpr_yyparse(yyscanner); + int res = cmExpr_yyparse(yyscanner); if (res != 0) { std::string e = "cannot parse the expression: \"" + InputBuffer + "\": "; e += ErrorString; @@ -55,19 +54,16 @@ int cmExprParserHelper::ParseString(const char* str, int verb) e += fail.what(); e += "."; this->SetError(std::move(e)); - res = 1; } catch (std::out_of_range const&) { std::string e = "cannot evaluate the expression: \"" + InputBuffer + "\": a numeric value is out of range."; this->SetError(std::move(e)); - res = 1; } catch (...) { std::string e = "cannot parse the expression: \"" + InputBuffer + "\"."; this->SetError(std::move(e)); - res = 1; } cmExpr_yylex_destroy(yyscanner); - if (res != 0) { + if (!this->ErrorString.empty()) { return 0; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=185bcface43d95b062c5be16321ae9aa59ed0057 commit 185bcface43d95b062c5be16321ae9aa59ed0057 Author: Brad King AuthorDate: Mon Jul 16 11:12:34 2018 -0400 Commit: Brad King CommitDate: Mon Jul 16 11:12:34 2018 -0400 cmExprParserHelper: Remove some unused code diff --git a/Source/cmExprParserHelper.cxx b/Source/cmExprParserHelper.cxx index d90d8b9..1f38d33 100644 --- a/Source/cmExprParserHelper.cxx +++ b/Source/cmExprParserHelper.cxx @@ -20,7 +20,6 @@ cmExprParserHelper::cmExprParserHelper() cmExprParserHelper::~cmExprParserHelper() { - this->CleanupParser(); } int cmExprParserHelper::ParseString(const char* str, int verb) @@ -69,13 +68,9 @@ int cmExprParserHelper::ParseString(const char* str, int verb) } cmExpr_yylex_destroy(yyscanner); if (res != 0) { - // str << "CAL_Parser returned: " << res << std::endl; - // std::cerr << "When parsing: [" << str << "]" << std::endl; return 0; } - this->CleanupParser(); - if (Verbose) { std::cerr << "Expanding [" << str << "] produced: [" << this->Result << "]" << std::endl; @@ -83,10 +78,6 @@ int cmExprParserHelper::ParseString(const char* str, int verb) return 1; } -void cmExprParserHelper::CleanupParser() -{ -} - int cmExprParserHelper::LexInput(char* buf, int maxlen) { // std::cout << "JPLexInput "; diff --git a/Source/cmExprParserHelper.h b/Source/cmExprParserHelper.h index d4d95b4..15e8f3e 100644 --- a/Source/cmExprParserHelper.h +++ b/Source/cmExprParserHelper.h @@ -41,7 +41,6 @@ private: void Print(const char* place, const char* str); - void CleanupParser(); void SetError(std::string errorString); KWIML_INT_int64_t Result; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=71d99e156badae2e12eca56b2b2fa4059cf67cf9 commit 71d99e156badae2e12eca56b2b2fa4059cf67cf9 Author: Andr? Apitzsch AuthorDate: Fri Jul 13 13:08:33 2018 +0200 Commit: Brad King CommitDate: Mon Jul 16 08:59:36 2018 -0400 Protobuf: restore previous output directory The protobuf upstream implementation has a different default output directory. Restore our original output directory for compatibility. diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index b02bc20..d6d1ec6 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -210,7 +210,7 @@ function(protobuf_generate) set(_generated_srcs) foreach(_ext ${protobuf_generate_GENERATE_EXTENSIONS}) - list(APPEND _generated_srcs "${protobuf_generate_PROTOC_OUT_DIR}/${_rel_dir}/${_basename}${_ext}") + list(APPEND _generated_srcs "${protobuf_generate_PROTOC_OUT_DIR}/${_basename}${_ext}") endforeach() if(protobuf_generate_DESCRIPTORS AND protobuf_generate_LANGUAGE STREQUAL cpp) @@ -223,7 +223,7 @@ function(protobuf_generate) add_custom_command( OUTPUT ${_generated_srcs} COMMAND protobuf::protoc - ARGS --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${protobuf_generate_PROTOC_OUT_DIR}/${_rel_dir} ${_dll_desc_out} ${_protobuf_include_path} ${_abs_file} + ARGS --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${protobuf_generate_PROTOC_OUT_DIR} ${_dll_desc_out} ${_protobuf_include_path} ${_abs_file} DEPENDS ${_abs_file} protobuf::protoc COMMENT "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}" VERBATIM ) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2ae2d0bd3e01e6f8f02281d00a1df87f209fa6b5 commit 2ae2d0bd3e01e6f8f02281d00a1df87f209fa6b5 Author: Andr? Apitzsch AuthorDate: Fri Jul 13 13:04:19 2018 +0200 Commit: Brad King CommitDate: Mon Jul 16 08:59:33 2018 -0400 Protobuf: restore 'DESCRIPTORS' support This was not present in the upstream code. diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index fdd7d48..b02bc20 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -122,7 +122,7 @@ function(protobuf_generate) include(CMakeParseArguments) - set(_options APPEND_PATH) + set(_options APPEND_PATH DESCRIPTORS) set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR) if(COMMAND target_sources) list(APPEND _singleargs TARGET) @@ -212,12 +212,18 @@ function(protobuf_generate) foreach(_ext ${protobuf_generate_GENERATE_EXTENSIONS}) list(APPEND _generated_srcs "${protobuf_generate_PROTOC_OUT_DIR}/${_rel_dir}/${_basename}${_ext}") endforeach() + + if(protobuf_generate_DESCRIPTORS AND protobuf_generate_LANGUAGE STREQUAL cpp) + set(_descriptor_file "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.desc") + set(_dll_desc_out "--descriptor_set_out=${_descriptor_file}") + list(APPEND _generated_srcs ${_descriptor_file}) + endif() list(APPEND _generated_srcs_all ${_generated_srcs}) add_custom_command( OUTPUT ${_generated_srcs} COMMAND protobuf::protoc - ARGS --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${protobuf_generate_PROTOC_OUT_DIR}/${_rel_dir} ${_protobuf_include_path} ${_abs_file} + ARGS --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${protobuf_generate_PROTOC_OUT_DIR}/${_rel_dir} ${_dll_desc_out} ${_protobuf_include_path} ${_abs_file} DEPENDS ${_abs_file} protobuf::protoc COMMENT "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}" VERBATIM ) @@ -233,7 +239,7 @@ function(protobuf_generate) endfunction() function(PROTOBUF_GENERATE_CPP SRCS HDRS) - cmake_parse_arguments(protobuf_generate_cpp "" "EXPORT_MACRO" "" ${ARGN}) + cmake_parse_arguments(protobuf_generate_cpp "" "EXPORT_MACRO;DESCRIPTORS" "" ${ARGN}) set(_proto_files "${protobuf_generate_cpp_UNPARSED_ARGUMENTS}") if(NOT _proto_files) @@ -245,6 +251,10 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) set(_append_arg APPEND_PATH) endif() + if(protobuf_generate_cpp_DESCRIPTORS) + set(_descriptors DESCRIPTORS) + endif() + if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS) set(Protobuf_IMPORT_DIRS "${PROTOBUF_IMPORT_DIRS}") endif() @@ -254,19 +264,28 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) endif() set(_outvar) - protobuf_generate(${_append_arg} LANGUAGE cpp EXPORT_MACRO ${protobuf_generate_cpp_EXPORT_MACRO} OUT_VAR _outvar ${_import_arg} PROTOS ${_proto_files}) + protobuf_generate(${_append_arg} ${_descriptors} LANGUAGE cpp EXPORT_MACRO ${protobuf_generate_cpp_EXPORT_MACRO} OUT_VAR _outvar ${_import_arg} PROTOS ${_proto_files}) set(${SRCS}) set(${HDRS}) + if(protobuf_generate_cpp_DESCRIPTORS) + set(${protobuf_generate_cpp_DESCRIPTORS}) + endif() + foreach(_file ${_outvar}) if(_file MATCHES "cc$") list(APPEND ${SRCS} ${_file}) + elseif(_file MATCHES "desc$") + list(APPEND ${protobuf_generate_cpp_DESCRIPTORS} ${_file}) else() list(APPEND ${HDRS} ${_file}) endif() endforeach() set(${SRCS} ${${SRCS}} PARENT_SCOPE) set(${HDRS} ${${HDRS}} PARENT_SCOPE) + if(protobuf_generate_cpp_DESCRIPTORS) + set(${protobuf_generate_cpp_DESCRIPTORS} "${${protobuf_generate_cpp_DESCRIPTORS}}" PARENT_SCOPE) + endif() endfunction() function(PROTOBUF_GENERATE_PYTHON SRCS) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1385b4b1138eeebd79b6dab940915b509a82cb5f commit 1385b4b1138eeebd79b6dab940915b509a82cb5f Author: Andr? Apitzsch AuthorDate: Thu Jul 12 14:27:04 2018 +0200 Commit: Brad King CommitDate: Mon Jul 16 08:59:21 2018 -0400 Protobuf: restore 'PROTOBUF_IMPORT_DIRS' check This was not present in the upstream code. diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 720e553..fdd7d48 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -245,6 +245,10 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) set(_append_arg APPEND_PATH) endif() + if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS) + set(Protobuf_IMPORT_DIRS "${PROTOBUF_IMPORT_DIRS}") + endif() + if(DEFINED Protobuf_IMPORT_DIRS) set(_import_arg IMPORT_DIRS ${Protobuf_IMPORT_DIRS}) endif() @@ -275,6 +279,10 @@ function(PROTOBUF_GENERATE_PYTHON SRCS) set(_append_arg APPEND_PATH) endif() + if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS) + set(Protobuf_IMPORT_DIRS "${PROTOBUF_IMPORT_DIRS}") + endif() + if(DEFINED Protobuf_IMPORT_DIRS) set(_import_arg IMPORT_DIRS ${Protobuf_IMPORT_DIRS}) endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1bcc0f3678daea6bb7f999ebded1eab471b32e28 commit 1bcc0f3678daea6bb7f999ebded1eab471b32e28 Author: Andr? Apitzsch AuthorDate: Thu Jul 12 14:24:48 2018 +0200 Commit: Brad King CommitDate: Mon Jul 16 08:57:08 2018 -0400 Protobuf: use upstream implementation to generate cpp and python files Generate functions are taken from [1] and [2]. The license [3] is already covered by our BSD-3 license for CMake and our inclusion of "Google Inc" in `Copyright.txt`. [1] https://github.com/google/protobuf/blob/93f6b67e/cmake/protobuf-config.cmake.in [2] https://github.com/google/protobuf/blob/93f6b67e/cmake/protobuf-module.cmake.in [3] https://github.com/google/protobuf/blob/93f6b67e/LICENSE diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index e1a715e..720e553 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -119,152 +119,169 @@ # ``ARGN`` # ``.proto`` filess -function(PROTOBUF_GENERATE_CPP SRCS HDRS) - cmake_parse_arguments(protobuf "" "EXPORT_MACRO;DESCRIPTORS" "" ${ARGN}) +function(protobuf_generate) + include(CMakeParseArguments) - set(PROTO_FILES "${protobuf_UNPARSED_ARGUMENTS}") - if(NOT PROTO_FILES) - message(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files") + set(_options APPEND_PATH) + set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR) + if(COMMAND target_sources) + list(APPEND _singleargs TARGET) + endif() + set(_multiargs PROTOS IMPORT_DIRS GENERATE_EXTENSIONS) + + cmake_parse_arguments(protobuf_generate "${_options}" "${_singleargs}" "${_multiargs}" "${ARGN}") + + if(NOT protobuf_generate_PROTOS AND NOT protobuf_generate_TARGET) + message(SEND_ERROR "Error: protobuf_generate called without any targets or source files") return() endif() - if(protobuf_EXPORT_MACRO) - set(DLL_EXPORT_DECL "dllexport_decl=${protobuf_EXPORT_MACRO}:") + if(NOT protobuf_generate_OUT_VAR AND NOT protobuf_generate_TARGET) + message(SEND_ERROR "Error: protobuf_generate called without a target or output variable") + return() endif() - if(PROTOBUF_GENERATE_CPP_APPEND_PATH) - # Create an include path for each file specified - foreach(FIL ${PROTO_FILES}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(ABS_PATH ${ABS_FIL} PATH) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) - endif() - endforeach() - else() - set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) + if(NOT protobuf_generate_LANGUAGE) + set(protobuf_generate_LANGUAGE cpp) endif() + string(TOLOWER ${protobuf_generate_LANGUAGE} protobuf_generate_LANGUAGE) - if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS) - set(Protobuf_IMPORT_DIRS "${PROTOBUF_IMPORT_DIRS}") + if(NOT protobuf_generate_PROTOC_OUT_DIR) + set(protobuf_generate_PROTOC_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) endif() - if(DEFINED Protobuf_IMPORT_DIRS) - foreach(DIR ${Protobuf_IMPORT_DIRS}) - get_filename_component(ABS_PATH ${DIR} ABSOLUTE) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) + if(protobuf_generate_EXPORT_MACRO AND protobuf_generate_LANGUAGE STREQUAL cpp) + set(_dll_export_decl "dllexport_decl=${protobuf_generate_EXPORT_MACRO}:") + endif() + + if(NOT protobuf_generate_GENERATE_EXTENSIONS) + if(protobuf_generate_LANGUAGE STREQUAL cpp) + set(protobuf_generate_GENERATE_EXTENSIONS .pb.h .pb.cc) + elseif(protobuf_generate_LANGUAGE STREQUAL python) + set(protobuf_generate_GENERATE_EXTENSIONS _pb2.py) + else() + message(SEND_ERROR "Error: protobuf_generate given unknown Language ${LANGUAGE}, please provide a value for GENERATE_EXTENSIONS") + return() + endif() + endif() + + if(protobuf_generate_TARGET) + get_target_property(_source_list ${protobuf_generate_TARGET} SOURCES) + foreach(_file ${_source_list}) + if(_file MATCHES "proto$") + list(APPEND protobuf_generate_PROTOS ${_file}) endif() endforeach() endif() - set(${SRCS}) - set(${HDRS}) - if (protobuf_DESCRIPTORS) - set(${protobuf_DESCRIPTORS}) + if(NOT protobuf_generate_PROTOS) + message(SEND_ERROR "Error: protobuf_generate could not find any .proto files") + return() endif() - foreach(FIL ${PROTO_FILES}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(FIL_WE ${FIL} NAME_WE) - if(NOT PROTOBUF_GENERATE_CPP_APPEND_PATH) - get_filename_component(FIL_DIR ${FIL} DIRECTORY) - if(FIL_DIR) - set(FIL_WE "${FIL_DIR}/${FIL_WE}") + if(protobuf_generate_APPEND_PATH) + # Create an include path for each file specified + foreach(_file ${protobuf_generate_PROTOS}) + get_filename_component(_abs_file ${_file} ABSOLUTE) + get_filename_component(_abs_path ${_abs_file} PATH) + list(FIND _protobuf_include_path ${_abs_path} _contains_already) + if(${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${_abs_path}) endif() + endforeach() + else() + set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + + foreach(DIR ${protobuf_generate_IMPORT_DIRS}) + get_filename_component(ABS_PATH ${DIR} ABSOLUTE) + list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) + if(${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${ABS_PATH}) endif() + endforeach() - set(_protobuf_protoc_src "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc") - set(_protobuf_protoc_hdr "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h") - list(APPEND ${SRCS} "${_protobuf_protoc_src}") - list(APPEND ${HDRS} "${_protobuf_protoc_hdr}") + set(_generated_srcs_all) + foreach(_proto ${protobuf_generate_PROTOS}) + get_filename_component(_abs_file ${_proto} ABSOLUTE) + get_filename_component(_abs_dir ${_abs_file} DIRECTORY) + get_filename_component(_basename ${_proto} NAME_WE) + file(RELATIVE_PATH _rel_dir ${CMAKE_CURRENT_SOURCE_DIR} ${_abs_dir}) - if(protobuf_DESCRIPTORS) - set(_protobuf_protoc_desc "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.desc") - set(_protobuf_protoc_flags "--descriptor_set_out=${_protobuf_protoc_desc}") - list(APPEND ${protobuf_DESCRIPTORS} "${_protobuf_protoc_desc}") - else() - set(_protobuf_protoc_desc "") - set(_protobuf_protoc_flags "") - endif() + set(_generated_srcs) + foreach(_ext ${protobuf_generate_GENERATE_EXTENSIONS}) + list(APPEND _generated_srcs "${protobuf_generate_PROTOC_OUT_DIR}/${_rel_dir}/${_basename}${_ext}") + endforeach() + list(APPEND _generated_srcs_all ${_generated_srcs}) add_custom_command( - OUTPUT "${_protobuf_protoc_src}" - "${_protobuf_protoc_hdr}" - ${_protobuf_protoc_desc} + OUTPUT ${_generated_srcs} COMMAND protobuf::protoc - "--cpp_out=${DLL_EXPORT_DECL}${CMAKE_CURRENT_BINARY_DIR}" - ${_protobuf_protoc_flags} - ${_protobuf_include_path} ${ABS_FIL} - DEPENDS ${ABS_FIL} protobuf::protoc - COMMENT "Running C++ protocol buffer compiler on ${FIL}" + ARGS --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${protobuf_generate_PROTOC_OUT_DIR}/${_rel_dir} ${_protobuf_include_path} ${_abs_file} + DEPENDS ${_abs_file} protobuf::protoc + COMMENT "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}" VERBATIM ) endforeach() - set(${SRCS} "${${SRCS}}" PARENT_SCOPE) - set(${HDRS} "${${HDRS}}" PARENT_SCOPE) - if(protobuf_DESCRIPTORS) - set(${protobuf_DESCRIPTORS} "${${protobuf_DESCRIPTORS}}" PARENT_SCOPE) + set_source_files_properties(${_generated_srcs_all} PROPERTIES GENERATED TRUE) + if(protobuf_generate_OUT_VAR) + set(${protobuf_generate_OUT_VAR} ${_generated_srcs_all} PARENT_SCOPE) + endif() + if(protobuf_generate_TARGET) + target_sources(${protobuf_generate_TARGET} PRIVATE ${_generated_srcs_all}) endif() endfunction() -function(PROTOBUF_GENERATE_PYTHON SRCS) - if(NOT ARGN) - message(SEND_ERROR "Error: PROTOBUF_GENERATE_PYTHON() called without any proto files") +function(PROTOBUF_GENERATE_CPP SRCS HDRS) + cmake_parse_arguments(protobuf_generate_cpp "" "EXPORT_MACRO" "" ${ARGN}) + + set(_proto_files "${protobuf_generate_cpp_UNPARSED_ARGUMENTS}") + if(NOT _proto_files) + message(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files") return() endif() if(PROTOBUF_GENERATE_CPP_APPEND_PATH) - # Create an include path for each file specified - foreach(FIL ${ARGN}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(ABS_PATH ${ABS_FIL} PATH) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) - endif() - endforeach() - else() - set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) - endif() - - if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS) - set(Protobuf_IMPORT_DIRS "${PROTOBUF_IMPORT_DIRS}") + set(_append_arg APPEND_PATH) endif() if(DEFINED Protobuf_IMPORT_DIRS) - foreach(DIR ${Protobuf_IMPORT_DIRS}) - get_filename_component(ABS_PATH ${DIR} ABSOLUTE) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) - endif() - endforeach() + set(_import_arg IMPORT_DIRS ${Protobuf_IMPORT_DIRS}) endif() + set(_outvar) + protobuf_generate(${_append_arg} LANGUAGE cpp EXPORT_MACRO ${protobuf_generate_cpp_EXPORT_MACRO} OUT_VAR _outvar ${_import_arg} PROTOS ${_proto_files}) + set(${SRCS}) - foreach(FIL ${ARGN}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(FIL_WE ${FIL} NAME_WE) - if(NOT PROTOBUF_GENERATE_CPP_APPEND_PATH) - get_filename_component(FIL_DIR ${FIL} DIRECTORY) - if(FIL_DIR) - set(FIL_WE "${FIL_DIR}/${FIL_WE}") - endif() + set(${HDRS}) + foreach(_file ${_outvar}) + if(_file MATCHES "cc$") + list(APPEND ${SRCS} ${_file}) + else() + list(APPEND ${HDRS} ${_file}) endif() - - list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py") - add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py" - COMMAND protobuf::protoc --python_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL} - DEPENDS ${ABS_FIL} protobuf::protoc - COMMENT "Running Python protocol buffer compiler on ${FIL}" - VERBATIM ) endforeach() - set(${SRCS} ${${SRCS}} PARENT_SCOPE) + set(${HDRS} ${${HDRS}} PARENT_SCOPE) +endfunction() + +function(PROTOBUF_GENERATE_PYTHON SRCS) + if(NOT ARGN) + message(SEND_ERROR "Error: PROTOBUF_GENERATE_PYTHON() called without any proto files") + return() + endif() + + if(PROTOBUF_GENERATE_CPP_APPEND_PATH) + set(_append_arg APPEND_PATH) + endif() + + if(DEFINED Protobuf_IMPORT_DIRS) + set(_import_arg IMPORT_DIRS ${Protobuf_IMPORT_DIRS}) + endif() + + set(_outvar) + protobuf_generate(${_append_arg} LANGUAGE python OUT_VAR _outvar ${_import_arg} PROTOS ${ARGN}) + set(${SRCS} ${_outvar} PARENT_SCOPE) endfunction() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dee7bafb13c654a2d62196451f013ef40dd2120f commit dee7bafb13c654a2d62196451f013ef40dd2120f Author: Anton Myagkov AuthorDate: Mon Jul 16 11:37:05 2018 +0300 Commit: Brad King CommitDate: Mon Jul 16 08:27:08 2018 -0400 FindOpenCL: Search per-architecture path suffixes on UNIX Use different path suffixes to find opencl for x86 and x86_64. We already do this on Windows. diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake index 297a5fb..fe162b4 100644 --- a/Modules/FindOpenCL.cmake +++ b/Modules/FindOpenCL.cmake @@ -119,16 +119,27 @@ if(WIN32) OpenCL/common/lib/x64) endif() else() - find_library(OpenCL_LIBRARY - NAMES OpenCL - PATHS - ENV AMDAPPSDKROOT - ENV CUDA_PATH - PATH_SUFFIXES - lib/x86_64 - lib/x64 - lib - lib64) + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + find_library(OpenCL_LIBRARY + NAMES OpenCL + PATHS + ENV AMDAPPSDKROOT + ENV CUDA_PATH + PATH_SUFFIXES + lib/x86 + lib) + elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) + find_library(OpenCL_LIBRARY + NAMES OpenCL + PATHS + ENV AMDAPPSDKROOT + ENV CUDA_PATH + PATH_SUFFIXES + lib/x86_64 + lib/x64 + lib + lib64) + endif() endif() set(OpenCL_LIBRARIES ${OpenCL_LIBRARY}) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5f431789a9b7dfcd3e350d08fb71521999d2be5c commit 5f431789a9b7dfcd3e350d08fb71521999d2be5c Author: Devin Nakamura AuthorDate: Fri Jul 13 13:55:39 2018 -0400 Commit: Devin Nakamura CommitDate: Fri Jul 13 13:55:39 2018 -0400 Use isxdigit() to determine if a character is a hex digit Replace custom cm_IsHexChar with isxdigit from the stdlib diff --git a/Source/cmHexFileConverter.cxx b/Source/cmHexFileConverter.cxx index 8deb8c1..4e29f39 100644 --- a/Source/cmHexFileConverter.cxx +++ b/Source/cmHexFileConverter.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmHexFileConverter.h" +#include #include #include @@ -12,13 +13,6 @@ #define MOTOROLA_SREC_MIN_LINE_LENGTH (2 + 2 + 4 + 2) #define MOTOROLA_SREC_MAX_LINE_LENGTH (2 + 2 + 8 + (256 * 2) + 2) -// might go to SystemTools ? -static bool cm_IsHexChar(char c) -{ - return (((c >= '0') && (c <= '9')) || ((c >= 'a') && (c <= 'f')) || - ((c >= 'A') && (c <= 'F'))); -} - static unsigned int ChompStrlen(const char* line) { if (line == nullptr) { @@ -169,7 +163,7 @@ cmHexFileConverter::FileType cmHexFileConverter::DetermineFileType( } for (unsigned int i = 1; i < slen; i++) { - if (!cm_IsHexChar(buf[i])) { + if (!isxdigit(buf[i])) { return Binary; } } ----------------------------------------------------------------------- Summary of changes: Modules/FindOpenCL.cmake | 31 ++- Modules/FindProtobuf.cmake | 242 ++++++++++++--------- Source/LexerParser/cmExprLexer.cxx | 2 +- Source/LexerParser/cmExprLexer.in.l | 2 +- Source/LexerParser/cmExprParser.cxx | 131 ++++++----- Source/LexerParser/cmExprParser.y | 1 - Source/LexerParser/cmExprParserTokens.h | 4 +- Source/cmExprParserHelper.cxx | 26 +-- Source/cmExprParserHelper.h | 6 +- Source/cmHexFileConverter.cxx | 10 +- Source/cmMathCommand.cxx | 6 + .../math/MATH-InvalidExpression-stderr.txt | 5 +- .../math/MATH-ToleratedExpression-stderr.txt | 8 + Tests/RunCMake/math/MATH-ToleratedExpression.cmake | 4 + Tests/RunCMake/math/RunCMakeTest.cmake | 1 + 15 files changed, 270 insertions(+), 209 deletions(-) create mode 100644 Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt create mode 100644 Tests/RunCMake/math/MATH-ToleratedExpression.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jul 17 08:45:07 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 17 Jul 2018 08:45:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-rc3-245-gf84bcc1 Message-ID: <20180717124507.367EB1106D5@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 f84bcc1bf5e591d4ed13174e1a937910709c9ff4 (commit) via f84c15ef2fa30dd074fcccafccec6b9b69266619 (commit) from 7ebc06fb021353bde23a2ae858f9e3785ec5b720 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f84bcc1bf5e591d4ed13174e1a937910709c9ff4 commit f84bcc1bf5e591d4ed13174e1a937910709c9ff4 Merge: 7ebc06f f84c15e Author: Brad King AuthorDate: Tue Jul 17 08:36:25 2018 -0400 Commit: Brad King CommitDate: Tue Jul 17 08:36:25 2018 -0400 Merge branch 'release-3.12' ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jul 17 08:45:07 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 17 Jul 2018 08:45:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.12.0-rc3-12-gf84c15e Message-ID: <20180717124507.54381F97C6@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via f84c15ef2fa30dd074fcccafccec6b9b69266619 (commit) from d240bb9a410b715ef8aae8a40a74bff5504b6dd4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jul 17 08:55:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 17 Jul 2018 08:55:04 -0400 (EDT) Subject: [Cmake-commits] CMake annotated tag, v3.12.0, created. v3.12.0 Message-ID: <20180717125504.0BE7211DDAB@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 annotated tag, v3.12.0 has been created at 8a76ef0ec578f25eaa9664b7e7366fe2cc7134ce (tag) tagging f84c15ef2fa30dd074fcccafccec6b9b69266619 (commit) replaces v3.12.0-rc3 tagged by Brad King on Tue Jul 17 08:35:38 2018 -0400 - Log ----------------------------------------------------------------- CMake 3.12.0 -----BEGIN PGP SIGNATURE----- iQJKBAABCgA0FiEExsJlMku+vcNQtRPQLSzvEDSSFoQFAltN4poWHGJyYWQua2lu Z0BraXR3YXJlLmNvbQAKCRAtLO8QNJIWhI/ZEACBvYaSmOxTlG7e249LXs0lbObI 69p6i4Gf6XVWAFrmQJA9DNSgyV3u7M5SKincxdCc43WgUou8pGb+cAkd6bTozhIH osyXronwjk0We/gz6c0RRLcF4GHsiX0oEH2+KUontl0N4i8xa1lTwRz5UQ2wxJRe KZbgHt6ReD5EtUFVkDsZuuDBdao7mLYpunJyDeKTtlCYM/TBHxkm6GQHNyaHcEih SMhbxc//Nja7A0KyPr9E0pCsyxjYH9WXWPnzy8p9eVpYaRUnXqtCDhRDmI4zzQgV WpxkBMamFSu5UO5EI+XPVB0rW8VmwX0aqipIa/a62DkIHRvLfNekJGeeXPHEKSoF dklND0Gzl/h1nUyW2nIsvUDDSERjDpJIPi0Ww+r9h9gjDKngvFz0inBOK/XFEI8B Z3tDF4ozIvByLXUPTQZCKEf7Bxi/E35WQ9v+sv3bL7UHlnf618cvB365KaJ8yf5N lJXe6RCoK2J2OJX5QYF7nDRPFLjxubq7mLk1ZbbXS1RVBs3/ZLj7mgNGI7kXhnhW 0klRZRN/odDnwTBWB5kJ9gYeAVL3sbZzlrOFoK2/Q0Gs5CQLefaUxUqYgqZ3nIjS N1YrRLH16F77sC54sScfUFPVPx6NuNDJtJDxAc7MTzg15jKl7TKyGEM7HZhNXpmT zTnczoB7nSamppqk0A== =fAEh -----END PGP SIGNATURE----- Brad King (7): Merge branch 'document_object_library_as_a_property_type' into release-3.12 Merge branch 'qnx_fix' into release-3.12 Merge branch 'boost-1.68-beta1' into release-3.12 Merge branch 'intel-std-fix' into release-3.12 Help: Mention IMPORTED_OBJECTS in add_library docs Merge branch 'doc-add_library-IMPORTED_OBJECTS' into release-3.12 CMake 3.12.0 Christian Pfeiffer (1): Intel: Fix incorrectly documented extension flags Cristian Adam (1): QNX: Fix autogen compiler predefines detection Robert Maynard (1): Help: Add OBJECT_LIBRARY to TYPE target property documentation Roger Leigh (2): FindBoost: Add support for Boost 1.68 beta1 FindBoost: Change context header used ----------------------------------------------------------------------- hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jul 18 00:05:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 18 Jul 2018 00:05:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-234-g5d550b2 Message-ID: <20180718040504.3B7CB11E481@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 5d550b2772d92d80d8c22475459f2789ab215079 (commit) from f84bcc1bf5e591d4ed13174e1a937910709c9ff4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5d550b2772d92d80d8c22475459f2789ab215079 commit 5d550b2772d92d80d8c22475459f2789ab215079 Author: Kitware Robot AuthorDate: Wed Jul 18 00:01:05 2018 -0400 Commit: Kitware Robot CommitDate: Wed Jul 18 00:01:05 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7504236..65a73ad 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 12) -set(CMake_VERSION_PATCH 20180717) +set(CMake_VERSION_PATCH 20180718) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jul 18 09:15:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 18 Jul 2018 09:15:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-254-g11d71e6 Message-ID: <20180718131505.EA55CFD38F@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 11d71e6cd0eedae224eca52d4f8bc6cb6baf46d8 (commit) via 0ab23b9a1ea335bdcfce33d6159cef0866bfc496 (commit) via fd0523a215c70b75d7830a18e050b79fcdf333aa (commit) via b07c71831c2ea42023dc27eb81e3099cefe35dd2 (commit) via 31e79050b218e7380c9fb854db111742dbe09c2a (commit) via 36ef57a9392fb5b3e688ff95547836d433db01c9 (commit) via 11ca374b284603278eded2548bbc9d7de88706e9 (commit) via 2201fb6f4369911f2260deb41dc70ac5c9c905d6 (commit) via 5a7a006fddfe0cbf00004dfb7352b9b83dca9d58 (commit) via 69ca768e7827c60b07914f248d7730fb7182ce4b (commit) via 25c3fb6c3512a76d45fd8a70d95fabe2777a4c2d (commit) via b5df4faa203bfac4bee9924520015f76f9692676 (commit) via 4108ab4be2307ef161467de46e4c35e8b086ce02 (commit) via bce8fa229ad7ea1c05e0206ed0c5bafe5fc32e2f (commit) via ae1c917f1aa6e544f27c5e73ede0edb10da0c3ad (commit) via 2c62a45a5a11c624f4b1bb882831f696c51818f1 (commit) via db4bc2fa1814a230a8f58293a48465cba9a22a36 (commit) via ec5c838fcb04f672e3ec03547fb571d40e789fdd (commit) via f6c7358c2aa8d53522c6459451ab079e0d4e3b8b (commit) via 1638ffa287e5032eecb1d8eaa1051a29379f6017 (commit) from 5d550b2772d92d80d8c22475459f2789ab215079 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=11d71e6cd0eedae224eca52d4f8bc6cb6baf46d8 commit 11d71e6cd0eedae224eca52d4f8bc6cb6baf46d8 Merge: 0ab23b9 31e7905 Author: Brad King AuthorDate: Wed Jul 18 13:12:25 2018 +0000 Commit: Kitware Robot CommitDate: Wed Jul 18 09:12:39 2018 -0400 Merge topic 'remove-simpleinstall' 31e79050b2 Tests: Remove the SimpleInstall test 36ef57a939 Tests: Add test for cmake --build . --target package 11ca374b28 Tests: Add test for install(SCRIPT ... COMPONENT) 2201fb6f43 Tests: Add test for InstallRequiredSystemLibraries 5a7a006fdd Tests: Add test for $<0:...> in ExportImport 69ca768e78 Tests: Add test for install(TARGETS) RPATH functionality 25c3fb6c35 Tests: Add test for install(FILES) with PERMISSIONS b5df4faa20 Tests: Add test for installing parts of targets in different directories ... Acked-by: Kitware Robot Merge-request: !2209 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0ab23b9a1ea335bdcfce33d6159cef0866bfc496 commit 0ab23b9a1ea335bdcfce33d6159cef0866bfc496 Merge: 5d550b2 fd0523a Author: Brad King AuthorDate: Wed Jul 18 13:07:45 2018 +0000 Commit: Kitware Robot CommitDate: Wed Jul 18 09:07:53 2018 -0400 Merge topic 'nvcc_dlink_dedup_static_libs' fd0523a215 CUDA: Properly de-duplicate libs when doing device linking b07c71831c CUDA: Add a test to verify device linking can handle circular deps Acked-by: Kitware Robot Merge-request: !2214 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fd0523a215c70b75d7830a18e050b79fcdf333aa commit fd0523a215c70b75d7830a18e050b79fcdf333aa Author: Robert Maynard AuthorDate: Fri Jul 13 14:44:16 2018 -0400 Commit: Brad King CommitDate: Tue Jul 17 10:42:57 2018 -0400 CUDA: Properly de-duplicate libs when doing device linking The nvcc device linker is designed so that each static library with device symbols only needs to be listed once as it doesn't care about link order. If you provide the same static library multiple times it will error out. To make sure this occurs we find the unique set of link items. diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx index 557fa41..c9bbde1 100644 --- a/Source/cmLinkLineDeviceComputer.cxx +++ b/Source/cmLinkLineDeviceComputer.cxx @@ -3,7 +3,9 @@ #include "cmLinkLineDeviceComputer.h" +#include #include +#include #include "cmAlgorithms.h" #include "cmComputeLinkInformation.h" @@ -28,6 +30,12 @@ std::string cmLinkLineDeviceComputer::ComputeLinkLibraries( { // Write the library flags to the build rule. std::ostringstream fout; + + // Generate the unique set of link items when device linking. + // The nvcc device linker is designed so that each static library + // with device symbols only needs to be listed once as it doesn't + // care about link order. + std::set emitted; typedef cmComputeLinkInformation::ItemVector ItemVector; ItemVector const& items = cli.GetItems(); std::string config = cli.GetConfig(); @@ -50,20 +58,24 @@ std::string cmLinkLineDeviceComputer::ComputeLinkLibraries( } } + std::string out; if (item.IsPath) { // nvcc understands absolute paths to libraries ending in '.a' should // be passed to nvlink. Other extensions like '.so' or '.dylib' are // rejected by the nvcc front-end even though nvlink knows to ignore // them. Bypass the front-end via '-Xnvlink'. if (!cmHasLiteralSuffix(item.Value, ".a")) { - fout << "-Xnvlink "; + out += "-Xnvlink "; } - fout << this->ConvertToOutputFormat( - this->ConvertToLinkReference(item.Value)); + out += + this->ConvertToOutputFormat(this->ConvertToLinkReference(item.Value)); } else { - fout << item.Value; + out += item.Value; + } + + if (emitted.insert(out).second) { + fout << out << " "; } - fout << " "; } if (!stdLibString.empty()) { diff --git a/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt b/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt index 8efbb0f..c978e51 100644 --- a/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt +++ b/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt @@ -16,8 +16,7 @@ add_executable(CudaOnlyCircularLinkLine main.cu) target_link_libraries(CUDACircularDeviceLinking1 PUBLIC CUDACircularDeviceLinking2) target_link_libraries(CUDACircularDeviceLinking2 PUBLIC CUDACircularDeviceLinking3) -#FIXME: complete the loop once supported -#target_link_libraries(CUDACircularDeviceLinking3 PUBLIC CUDACircularDeviceLinking1) +target_link_libraries(CUDACircularDeviceLinking3 PUBLIC CUDACircularDeviceLinking1) target_link_libraries(CudaOnlyCircularLinkLine PRIVATE CUDACircularDeviceLinking3) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b07c71831c2ea42023dc27eb81e3099cefe35dd2 commit b07c71831c2ea42023dc27eb81e3099cefe35dd2 Author: Robert Maynard AuthorDate: Fri Jul 13 14:43:49 2018 -0400 Commit: Brad King CommitDate: Tue Jul 17 10:04:39 2018 -0400 CUDA: Add a test to verify device linking can handle circular deps diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt index 59f3e84..5b7c0e6 100644 --- a/Tests/CudaOnly/CMakeLists.txt +++ b/Tests/CudaOnly/CMakeLists.txt @@ -1,4 +1,5 @@ +ADD_TEST_MACRO(CudaOnly.CircularLinkLine CudaOnlyCircularLinkLine) ADD_TEST_MACRO(CudaOnly.EnableStandard CudaOnlyEnableStandard) ADD_TEST_MACRO(CudaOnly.ExportPTX CudaOnlyExportPTX) ADD_TEST_MACRO(CudaOnly.GPUDebugFlag CudaOnlyGPUDebugFlag) diff --git a/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt b/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt new file mode 100644 index 0000000..8efbb0f --- /dev/null +++ b/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt @@ -0,0 +1,35 @@ +cmake_minimum_required(VERSION 3.7) +project (CudaOnlyCircularLinkLine CUDA) + +#Goal for this example: +# Verify that we de-duplicate the device link line +# Verify that a de-duplicated link line still works with circular static libraries + +string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=[compute_30]") +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CUDA_STANDARD 11) + +add_library(CUDACircularDeviceLinking1 STATIC file1.cu) +add_library(CUDACircularDeviceLinking2 STATIC file2.cu) +add_library(CUDACircularDeviceLinking3 STATIC file3.cu) +add_executable(CudaOnlyCircularLinkLine main.cu) + +target_link_libraries(CUDACircularDeviceLinking1 PUBLIC CUDACircularDeviceLinking2) +target_link_libraries(CUDACircularDeviceLinking2 PUBLIC CUDACircularDeviceLinking3) +#FIXME: complete the loop once supported +#target_link_libraries(CUDACircularDeviceLinking3 PUBLIC CUDACircularDeviceLinking1) + +target_link_libraries(CudaOnlyCircularLinkLine PRIVATE CUDACircularDeviceLinking3) + + +set_target_properties(CUDACircularDeviceLinking1 + PROPERTIES + CUDA_SEPARABLE_COMPILATION ON) + +set_target_properties(CUDACircularDeviceLinking2 + PROPERTIES + CUDA_SEPARABLE_COMPILATION ON) + +set_target_properties(CUDACircularDeviceLinking3 + PROPERTIES + CUDA_SEPARABLE_COMPILATION ON) diff --git a/Tests/CudaOnly/CircularLinkLine/file1.cu b/Tests/CudaOnly/CircularLinkLine/file1.cu new file mode 100644 index 0000000..88ac4e3 --- /dev/null +++ b/Tests/CudaOnly/CircularLinkLine/file1.cu @@ -0,0 +1,6 @@ + +extern __device__ int file2_func(int); +int __device__ file1_func(int x) +{ + return file2_func(x); +} diff --git a/Tests/CudaOnly/CircularLinkLine/file2.cu b/Tests/CudaOnly/CircularLinkLine/file2.cu new file mode 100644 index 0000000..b32dbff --- /dev/null +++ b/Tests/CudaOnly/CircularLinkLine/file2.cu @@ -0,0 +1,6 @@ + +extern __device__ int file3_func(int); +int __device__ file2_func(int x) +{ + return x + file3_func(x); +} diff --git a/Tests/CudaOnly/CircularLinkLine/file3.cu b/Tests/CudaOnly/CircularLinkLine/file3.cu new file mode 100644 index 0000000..7f67187 --- /dev/null +++ b/Tests/CudaOnly/CircularLinkLine/file3.cu @@ -0,0 +1,8 @@ + +extern __device__ int file1_func(int); +int __device__ file3_func(int x) +{ + if (x > 0) + return file1_func(-x); + return x; +} diff --git a/Tests/CudaOnly/CircularLinkLine/main.cu b/Tests/CudaOnly/CircularLinkLine/main.cu new file mode 100644 index 0000000..1c19e8d --- /dev/null +++ b/Tests/CudaOnly/CircularLinkLine/main.cu @@ -0,0 +1,5 @@ + +int main(int argc, char** argv) +{ + return 0; +} https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=31e79050b218e7380c9fb854db111742dbe09c2a commit 31e79050b218e7380c9fb854db111742dbe09c2a Author: Kyle Edwards AuthorDate: Thu Jul 12 11:36:38 2018 -0400 Commit: Kyle Edwards CommitDate: Tue Jul 17 09:07:10 2018 -0400 Tests: Remove the SimpleInstall test The cases that were covered by SimpleInstall have been moved into RunCMake.install. diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 7ea5c04..971d7ff 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -869,33 +869,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BuildDepends") - set(SimpleInstallInstallDir - "${CMake_BINARY_DIR}/Tests/SimpleInstall/InstallDirectory") - add_test(SimpleInstall ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/SimpleInstall" - "${CMake_BINARY_DIR}/Tests/SimpleInstall" - ${build_generator_args} - --build-project TestSimpleInstall - --build-two-config - --build-options ${build_options} - "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}" - "-DCTEST_TEST_CPACK:BOOL=${CTEST_TEST_CPACK}" - --test-command ${SimpleInstallInstallDir}/MyTest/bin/SimpleInstExe) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleInstall") - add_test(SimpleInstall-Stage2 ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/SimpleInstallS2" - "${CMake_BINARY_DIR}/Tests/SimpleInstallS2" - ${build_generator_args} - --build-project TestSimpleInstall - --build-two-config - --build-options ${build_options} - "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}" - "-DSTAGE2:BOOL=1" - --test-command ${SimpleInstallInstallDir}/MyTest/bin/SimpleInstExeS2) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleInstallS2") - set(MissingInstallInstallDir "${CMake_BINARY_DIR}/Tests/MissingInstall/InstallDirectory") add_test(MissingInstall ${CMAKE_CTEST_COMMAND} @@ -1821,7 +1794,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set_tests_properties ( testdriver2 PROPERTIES DEPENDS testdriver1) set_tests_properties ( testdriver3 PROPERTIES DEPENDS testdriver2) set_tests_properties ( linkorder2 PROPERTIES DEPENDS linkorder1) - set_tests_properties ( SimpleInstall-Stage2 PROPERTIES DEPENDS SimpleInstall) # Test static linking on toolchains known to support it. if(CMAKE_C_COMPILER_ID STREQUAL "GNU" diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt deleted file mode 100644 index a07f687..0000000 --- a/Tests/SimpleInstall/CMakeLists.txt +++ /dev/null @@ -1,398 +0,0 @@ -cmake_minimum_required (VERSION 3.9) -project (TestSimpleInstall) -set(CMAKE_VERBOSE_MAKEFILE 1) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY - "${TestSimpleInstall_BINARY_DIR}/bin") -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY - "${TestSimpleInstall_BINARY_DIR}/lib/static") -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY - "${TestSimpleInstall_BINARY_DIR}/lib") - -# Skip generating the rpath pointing at the build tree to make sure -# the executable is installed with the proper rpath in the install -# tree. -set(CMAKE_SKIP_BUILD_RPATH 1) - -# Make sure the executable can run from the install tree. -set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/MyTest/lib) - -# Skip the dependency that causes a build when installing. This -# avoids infinite loops when the post-build rule below installs. -set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1) -set(CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY 1) - -set(CMAKE_DEBUG_POSTFIX "_test_debug_postfix") - -set(EXTRA_INSTALL_FLAGS) -message("Extra install: ${EXTRA_INSTALL_FLAGS}") - -if(STAGE2) - set(LIBPATHS - ${CMAKE_INSTALL_PREFIX}/MyTest/lib/static - ${CMAKE_INSTALL_PREFIX}/MyTest/lib - ) - set(t1NAMES test1 test1${CMAKE_DEBUG_POSTFIX} test1rel) - set(t2NAMES test2 test2${CMAKE_DEBUG_POSTFIX}) - set(t4NAMES test4out test4out${CMAKE_DEBUG_POSTFIX}) - - # Make sure the install script ran. - set(CMAKE_INSTALL_SCRIPT_DID_RUN 0) - include(${CMAKE_INSTALL_PREFIX}/MyTest/InstallScriptOut.cmake OPTIONAL) - if(CMAKE_INSTALL_SCRIPT_DID_RUN) - message(STATUS "Stage 1 did run install script 2.") - else() - message(SEND_ERROR "Stage 1 did not run install script 2.") - endif() - - if(CYGWIN OR MINGW) - set(LIBPATHS ${LIBPATHS} "${CMAKE_INSTALL_PREFIX}/MyTest/bin") - endif() - message("Search for library in: ${LIBPATHS}") - - set(TEST1_LIBRARY "TEST1_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE) - set(TEST2_LIBRARY "TEST2_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE) - set(TEST4_LIBRARY "TEST4_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE) - - find_library(TEST1_LIBRARY - NAMES ${t1NAMES} - PATHS ${LIBPATHS} - DOC "First library") - find_library(TEST2_LIBRARY - NAMES ${t2NAMES} - PATHS ${LIBPATHS} - DOC "Second library") - find_library(TEST4_LIBRARY - NAMES ${t4NAMES} - PATHS ${LIBPATHS} - DOC "Fourth library") - - # Test importing a library found on disk. - add_library(lib_test4 UNKNOWN IMPORTED) - set_property(TARGET lib_test4 PROPERTY IMPORTED_LOCATION ${TEST4_LIBRARY}) - - include_directories(${CMAKE_INSTALL_PREFIX}/MyTest/include) - add_executable (SimpleInstExeS2 inst2.cxx foo.c foo.h) - target_link_libraries(SimpleInstExeS2 ${TEST1_LIBRARY} ${TEST2_LIBRARY} lib_test4) - set(install_target SimpleInstExeS2) - - if("${TEST1_LIBRARY}" MATCHES "static") - message(STATUS "test1 correctly found in lib/static") - else() - message(SEND_ERROR "test1 not found in lib/static!") - endif() - - # Check for failure of configuration-specific installation. - if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Release/lib1debug.h") - message(FATAL_ERROR "Debug-configuration file installed for Release!") - endif() - if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Debug/lib1release.h") - message(FATAL_ERROR "Release-configuration file installed for Debug!") - endif() - - # Check for failure of directory installation. - if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/TSD.h") - message(FATAL_ERROR "Directory installation did not install TSD.h") - endif() - if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS") - message(FATAL_ERROR "Directory installation installed CVS directory.") - endif() - if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS") - message(FATAL_ERROR "Directory installation installed CVS directory.") - endif() - if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CMakeLists.txt") - message(FATAL_ERROR "Directory installation installed CMakeLists.txt.") - endif() - if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.h") - message(FATAL_ERROR "Directory installation did not install alternate TSD.h") - endif() - if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.cxx") - message(FATAL_ERROR "Directory installation installed alternate TSD.cxx") - endif() - - # Check that scripts properly installed. - if(WIN32 AND NOT CYGWIN) - set(BAT .bat) - else() - set(BAT) - endif() - foreach(loc share share/old1 share/old2 share/old3 share/alt) - set(CUR_SCRIPT "${CMAKE_INSTALL_PREFIX}/MyTest/${loc}/sample_script${BAT}") - execute_process( - COMMAND ${CUR_SCRIPT} - RESULT_VARIABLE SAMPLE_SCRIPT_RESULT - OUTPUT_VARIABLE SAMPLE_SCRIPT_OUTPUT - ) - if(NOT "${SAMPLE_SCRIPT_RESULT}" STREQUAL "0") - message(FATAL_ERROR - "Sample script [${CUR_SCRIPT}] failed: [${SAMPLE_SCRIPT_RESULT}]") - endif() - if(NOT "${SAMPLE_SCRIPT_OUTPUT}" MATCHES "Sample Script Output") - message(FATAL_ERROR - "Bad sample script [${CUR_SCRIPT}] output: [${SAMPLE_SCRIPT_OUTPUT}]") - endif() - endforeach() - - # Check for failure of empty directory installation. - if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty") - message(FATAL_ERROR "Empty directory installation did not install.") - endif() - file(GLOB EMPTY_FILES "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty/*") - if(EMPTY_FILES) - message(FATAL_ERROR "Empty directory installed [${EMPTY_FILES}].") - endif() - - # Make sure the test executable can run from the install tree. - set_target_properties(SimpleInstExeS2 PROPERTIES - INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib) - - install_targets(/MyTest/bin SimpleInstExeS2) - -# try to import the exported targets again - set(SimpleInstallS1_DIR ${CMAKE_INSTALL_PREFIX}/MyTest/lib) - find_package(SimpleInstallS1 REQUIRED) - get_target_property(simpleInstallImported S1_SimpleInstall IMPORTED) - if(NOT simpleInstallImported) - message(FATAL_ERROR "Target S1_SimpleInstall could not be imported") - endif() - -else() - # Wipe out the install directory to do a fresh test. - file(REMOVE_RECURSE ${CMAKE_INSTALL_PREFIX}/MyTest) - - # this is stage 1, so create libraries and modules and install everything - add_library(test1 STATIC lib1.cxx) - add_library(test2 SHARED lib2.cxx) - add_library(test3 MODULE lib3.cxx) - add_library(test4 SHARED lib4.cxx) - - # Test _OUTPUT_NAME properties. - set_property(TARGET test4 PROPERTY ARCHIVE_OUTPUT_NAME test4out) - set_property(TARGET test4 PROPERTY LIBRARY_OUTPUT_NAME test4out) - - add_executable (SimpleInstall inst.cxx foo.c foo.h) - target_link_libraries(SimpleInstall test1 test2 test4) - set(install_target SimpleInstall) - - set_target_properties(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstExe) - # Disable VERSION test until it is implemented in the Xcode generator. - if(NOT XCODE) - set_target_properties(SimpleInstall PROPERTIES VERSION 1.2) - endif() - - # Make sure the test executable can run from the install tree. - set_target_properties(SimpleInstall PROPERTIES - INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib) - - # Test per-configuration output name. - set_target_properties(test1 PROPERTIES RELEASE_OUTPUT_NAME test1rel) - set_target_properties(test2 PROPERTIES PUBLIC_HEADER foo.h) - - if(CMAKE_GENERATOR MATCHES "Makefiles") - add_subdirectory(TestSubDir) - add_dependencies(SimpleInstall TSD) - endif() - - add_dependencies(SimpleInstall test3) - add_dependencies(test2 test3) - add_dependencies(test4 test2) - - install(TARGETS SimpleInstall test1 test2 test3 EXPORT SimpleInstallS1 - RUNTIME DESTINATION MyTest/bin COMPONENT Runtime # .exe, .dll - LIBRARY DESTINATION MyTest/lib COMPONENT Runtime # .so, mod.dll - ARCHIVE DESTINATION MyTest/lib/static COMPONENT Development # .a, .lib - PUBLIC_HEADER DESTINATION MyTest/include COMPONENT Development - ) - - install(TARGETS test4 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE - RUNTIME DESTINATION MyTest/bin - LIBRARY DESTINATION MyTest/lib - ARCHIVE DESTINATION MyTest/lib/static - OPTIONAL # for coverage...target should always exist - ) - install(FILES lib1.h DESTINATION MyTest/include/$<1:foo>$<0:/wrong>) - install(FILES lib2.h - DESTINATION $<1:MyTest/include/foo>$<0:/wrong> - COMPONENT Development - PERMISSIONS OWNER_READ OWNER_WRITE - RENAME lib2renamed.h - ) - - # Test old-style install commands. - install_files(/MyTest/include FILES lib3.h) - install_files(/MyTest/include/old .h lib3) - install_files(/MyTest/include/old "^lib2.h$") - install_programs(/MyTest/share/old1 FILES - scripts/sample_script scripts/sample_script.bat) - install_programs(/MyTest/share/old2 - scripts/sample_script scripts/sample_script.bat) - -# "export" the targets collected in "SimpleInstallS1" - install(EXPORT SimpleInstallS1 FILE SimpleInstallS1Config.cmake - DESTINATION MyTest/lib - NAMESPACE S1_ ) - - export(TARGETS SimpleInstall test1 test2 test3 - FILE "${CMAKE_CURRENT_BINARY_DIR}/SimpleInstallS1Config.cmake" - NAMESPACE S2_ ) - - add_subdirectory(scripts) - - # Test optional installation. - install(FILES does_not_exist.h DESTINATION MyTest/include/foo OPTIONAL) - - # Test configuration-specific installation. - install(FILES lib1.h RENAME lib1release.h CONFIGURATIONS Release - DESTINATION MyTest/include/Release - ) - install(FILES lib1.h RENAME lib1debug.h CONFIGURATIONS Debug - DESTINATION MyTest/include/Debug - ) - - # Test directory installation. - file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS") - file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS") - install( - DIRECTORY TestSubDir $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share>$<0:/wrong> - FILE_PERMISSIONS OWNER_READ OWNER_WRITE - DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE - GROUP_READ GROUP_EXECUTE - PATTERN "CVS" EXCLUDE - REGEX "\\.txt$" EXCLUDE - PATTERN "scripts/*" PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ - ) - - # Alternate directory installation for coverage. - install( - DIRECTORY $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share/alt>$<0:/wrong> - COMPONENT Development - USE_SOURCE_PERMISSIONS - PATTERN "CVS" EXCLUDE - REGEX "\\.txt$" EXCLUDE - ) - install( - DIRECTORY TestSubDir DESTINATION $<1:MyTest/share/alt>$<0:/wrong> - FILE_PERMISSIONS OWNER_READ OWNER_WRITE - DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE - GROUP_READ GROUP_EXECUTE - FILES_MATCHING PATTERN "*.h" - ) - - # Test empty directory installation. - install(DIRECTORY DESTINATION MyTest/share/empty) - - # Test optional directory installation. - install(DIRECTORY does-not-exist DESTINATION MyTest/share OPTIONAL) - - # Test user-specified install scripts, with and without COMPONENT. - install( - SCRIPT InstallScript1.cmake - CODE "set(INSTALL_CODE_DID_RUN 1)" - SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/InstallScript2.cmake - ) - install( - SCRIPT InstallScript3.cmake - CODE "set(INSTALL_CODE_WITH_COMPONENT_DID_RUN 1)" - SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/InstallScript4.cmake - COMPONENT Development - ) - set_directory_properties(PROPERTIES - ADDITIONAL_MAKE_CLEAN_FILES - "${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake;${CMAKE_INSTALL_PREFIX}/InstallScript4Out.cmake") - - set_target_properties(SimpleInstall PROPERTIES PRE_INSTALL_SCRIPT - ${CMAKE_CURRENT_SOURCE_DIR}/PreInstall.cmake) - set_target_properties(SimpleInstall PROPERTIES POST_INSTALL_SCRIPT - ${CMAKE_CURRENT_SOURCE_DIR}/PostInstall.cmake) - set_target_properties(test4 PROPERTIES VERSION 1.2 SOVERSION 3 - INSTALL_NAME_DIR @executable_path/../lib) -endif() - -get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) -if(_isMultiConfig) - set(SI_CONFIG --config $) -else() - set(SI_CONFIG) -endif() - -# Dummy test of CPack -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Test of packaging with cpack") -set(CPACK_PACKAGE_VENDOR "Kitware") -set(CPACK_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/PackageScript.cmake") - -if(WIN32 AND NOT UNIX) - find_program(NSIS_MAKENSIS NAMES makensis - PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS] - DOC "Where is makensis.exe located" - ) - if(NOT NSIS_MAKENSIS) - set(CPACK_GENERATOR TGZ) - endif() -endif() -if(UNIX AND NOT APPLE) - set(CPACK_GENERATOR "TGZ;STGZ;TZ") - # find_program(found_compress - # NAMES compress) - # if(found_compress) - # find_program(file_command NAMES file) - # if(NOT file_command) - # set(file_command file) - # endif() - # execute_process(COMMAND ${file_command} ${found_compress} - # OUTPUT_VARIABLE output) - # set(SKIP_TZ FALSE) - # if("${output}" MATCHES "script") - # set(SKIP_TZ TRUE) - # endif() - # if("${output}" MATCHES "dummy.sh") - # set(SKIP_TZ TRUE) - # endif() - # if(NOT SKIP_TZ) - # message("compress found and it was not a script") - # message("output from file command: [${output}]") - # list(APPEND CPACK_GENERATOR "TZ") - # else() - # message("compress found, but it was a script so don't use it") - # message("output from file command: [${output}]") - # endif() - # endif() - find_program(found_bz2 - NAMES bzip2) - if(found_bz2) - list(APPEND CPACK_GENERATOR "TBZ2") - endif() -endif() - -set(CPACK_PACKAGE_EXECUTABLES "SimpleInstall" "Simple Install") -set(CMAKE_INSTALL_MFC_LIBRARIES 1) -set(CMAKE_INSTALL_DEBUG_LIBRARIES 1) -set(CMAKE_INSTALL_UCRT_LIBRARIES 1) -set(CMAKE_INSTALL_OPENMP_LIBRARIES 1) -include(InstallRequiredSystemLibraries) - -if(CTEST_TEST_CPACK) - set(package_command COMMAND - ${CMAKE_COMMAND} --build . --target package ${SI_CONFIG} - ) - - # Avoid settings that require the .zip file command line tools... - # (just build an NSIS installer without component support) - # - set(CPACK_BINARY_ZIP OFF) - set(CPACK_MONOLITHIC_INSTALL ON) -else() - set(package_command) -endif() - -include(CPack) - -set(install_command COMMAND - ${CMAKE_COMMAND} --build . --target install ${SI_CONFIG} - ) - -add_custom_command( - TARGET ${install_target} - POST_BUILD - ${install_command} - ${package_command} - COMMENT "Install Project" - ) diff --git a/Tests/SimpleInstall/InstallScript1.cmake b/Tests/SimpleInstall/InstallScript1.cmake deleted file mode 100644 index ef9da57..0000000 --- a/Tests/SimpleInstall/InstallScript1.cmake +++ /dev/null @@ -1,5 +0,0 @@ -message("This is install script 1.") -set(INSTALL_SCRIPT_1_DID_RUN 1) -if(INSTALL_CODE_DID_RUN) - message(FATAL_ERROR "Install script 1 did not run before install code.") -endif() diff --git a/Tests/SimpleInstall/InstallScript2.cmake b/Tests/SimpleInstall/InstallScript2.cmake deleted file mode 100644 index c1d20a3..0000000 --- a/Tests/SimpleInstall/InstallScript2.cmake +++ /dev/null @@ -1,14 +0,0 @@ -message("This is install script 2.") -if(INSTALL_SCRIPT_1_DID_RUN) - message("Install script ordering works.") -else() - message(FATAL_ERROR "Install script 1 did not run before install script 2.") -endif() -if(INSTALL_CODE_DID_RUN) - message("Install code ordering works.") -else() - message(FATAL_ERROR "Install script 2 did not run after install code.") -endif() -file(WRITE "${CMAKE_INSTALL_PREFIX}/MyTest/InstallScriptOut.cmake" - "set(CMAKE_INSTALL_SCRIPT_DID_RUN 1)\n" - ) diff --git a/Tests/SimpleInstall/InstallScript3.cmake b/Tests/SimpleInstall/InstallScript3.cmake deleted file mode 100644 index 6485156..0000000 --- a/Tests/SimpleInstall/InstallScript3.cmake +++ /dev/null @@ -1,12 +0,0 @@ -message("This is install script 3.") -set(INSTALL_SCRIPT_3_DID_RUN 1) -if(INSTALL_CODE_WITH_COMPONENT_DID_RUN) - message(FATAL_ERROR "Install script 3 did not run before install code with component.") -endif() - -if(CMAKE_INSTALL_COMPONENT) -if(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development") - message("CMAKE_INSTALL_COMPONENT=\"${CMAKE_INSTALL_COMPONENT}\"") - message(FATAL_ERROR "Install script 3 should only run for \"Development\" INSTALL COMPONENT.") -endif() -endif() diff --git a/Tests/SimpleInstall/InstallScript4.cmake b/Tests/SimpleInstall/InstallScript4.cmake deleted file mode 100644 index 34d0a73..0000000 --- a/Tests/SimpleInstall/InstallScript4.cmake +++ /dev/null @@ -1,22 +0,0 @@ -message("This is install script 4.") -if(INSTALL_SCRIPT_3_DID_RUN) - message("Install script ordering works.") -else() - message(FATAL_ERROR "Install script 3 did not run before install script 4.") -endif() -if(INSTALL_CODE_WITH_COMPONENT_DID_RUN) - message("Install code ordering works.") -else() - message(FATAL_ERROR "Install script 4 did not run after install with component code.") -endif() - -if(CMAKE_INSTALL_COMPONENT) -if(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development") - message("CMAKE_INSTALL_COMPONENT=\"${CMAKE_INSTALL_COMPONENT}\"") - message(FATAL_ERROR "Install script 4 should only run for \"Development\" INSTALL COMPONENT.") -endif() -endif() - -file(WRITE "${CMAKE_INSTALL_PREFIX}/MyTest/InstallScript4Out.cmake" - "set(CMAKE_INSTALL_SCRIPT_4_DID_RUN 1)\n" - ) diff --git a/Tests/SimpleInstall/PackageScript.cmake b/Tests/SimpleInstall/PackageScript.cmake deleted file mode 100644 index 53b7909..0000000 --- a/Tests/SimpleInstall/PackageScript.cmake +++ /dev/null @@ -1,10 +0,0 @@ -message("This is packaging script") -message("It writes a file with all variables available in ${CMAKE_INSTALL_PREFIX}/AllVariables.txt") - -file(WRITE ${CMAKE_INSTALL_PREFIX}/AllVariables.txt "") -get_cmake_property(res VARIABLES) -foreach(var ${res}) - file(APPEND ${CMAKE_INSTALL_PREFIX}/AllVariables.txt - "${var} \"${${var}}\"\n") -endforeach() - diff --git a/Tests/SimpleInstall/PostInstall.cmake b/Tests/SimpleInstall/PostInstall.cmake deleted file mode 100644 index d616221..0000000 --- a/Tests/SimpleInstall/PostInstall.cmake +++ /dev/null @@ -1,6 +0,0 @@ -message("In post install") -if(PRE_INSTALL_DID_RUN) - message("Pre and post install work fine") -else() - message(FATAL_ERROR "Pre install did not run before post install") -endif() diff --git a/Tests/SimpleInstall/PreInstall.cmake b/Tests/SimpleInstall/PreInstall.cmake deleted file mode 100644 index 7a9851e..0000000 --- a/Tests/SimpleInstall/PreInstall.cmake +++ /dev/null @@ -1,2 +0,0 @@ -message("This is in pre install") -set(PRE_INSTALL_DID_RUN 1) diff --git a/Tests/SimpleInstall/TestSubDir/CMakeLists.txt b/Tests/SimpleInstall/TestSubDir/CMakeLists.txt deleted file mode 100644 index 860e104..0000000 --- a/Tests/SimpleInstall/TestSubDir/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_executable(TSD TSD.cxx TSD_utils.cxx) -install_files(/MyTest/include FILES TSD.h) -install_targets(/MyTest/bin TSD) diff --git a/Tests/SimpleInstall/TestSubDir/TSD.cxx b/Tests/SimpleInstall/TestSubDir/TSD.cxx deleted file mode 100644 index 8fc3878..0000000 --- a/Tests/SimpleInstall/TestSubDir/TSD.cxx +++ /dev/null @@ -1,10 +0,0 @@ -#include - -#include "TSD.h" - -int main() -{ - int res = TSD("TEST"); - printf("Hello from TSD\n"); - return res; -} diff --git a/Tests/SimpleInstall/TestSubDir/TSD.h b/Tests/SimpleInstall/TestSubDir/TSD.h deleted file mode 100644 index 6a3c1af..0000000 --- a/Tests/SimpleInstall/TestSubDir/TSD.h +++ /dev/null @@ -1 +0,0 @@ -int TSD(const char*); diff --git a/Tests/SimpleInstall/TestSubDir/TSD_utils.cxx b/Tests/SimpleInstall/TestSubDir/TSD_utils.cxx deleted file mode 100644 index 0f32894..0000000 --- a/Tests/SimpleInstall/TestSubDir/TSD_utils.cxx +++ /dev/null @@ -1,9 +0,0 @@ -#include - -int TSD(const char* foo) -{ - if (strcmp(foo, "TEST") == 0) { - return 0; - } - return 1; -} diff --git a/Tests/SimpleInstall/foo.c b/Tests/SimpleInstall/foo.c deleted file mode 100644 index 45d5b2b..0000000 --- a/Tests/SimpleInstall/foo.c +++ /dev/null @@ -1,6 +0,0 @@ -char* foo = "Foo"; - -int SomeFunctionInFoo() -{ - return 5; -} diff --git a/Tests/SimpleInstall/foo.h b/Tests/SimpleInstall/foo.h deleted file mode 100644 index 216cdf6..0000000 --- a/Tests/SimpleInstall/foo.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifdef __cplusplus -extern "C" { -#endif - -extern char* foo; -extern int SomeFunctionInFoo(); - -#ifdef __cplusplus -} -#endif diff --git a/Tests/SimpleInstall/inst.cxx b/Tests/SimpleInstall/inst.cxx deleted file mode 100644 index 7815f86..0000000 --- a/Tests/SimpleInstall/inst.cxx +++ /dev/null @@ -1,34 +0,0 @@ -#include "foo.h" - -#ifdef STAGE_2 -# include -# include -# include -# include -# include -#else -# include "lib1.h" -# include "lib2.h" -#endif - -#include "lib4.h" - -#include - -int main() -{ - if (Lib1Func() != 2.0) { - printf("Problem with lib1\n"); - return 1; - } - if (Lib2Func() != 1.0) { - printf("Problem with lib2\n"); - return 1; - } - if (Lib4Func() != 4.0) { - printf("Problem with lib4\n"); - return 1; - } - printf("The value of Foo: %s\n", foo); - return SomeFunctionInFoo() - 5; -} diff --git a/Tests/SimpleInstall/inst2.cxx b/Tests/SimpleInstall/inst2.cxx deleted file mode 100644 index c70b93a..0000000 --- a/Tests/SimpleInstall/inst2.cxx +++ /dev/null @@ -1,2 +0,0 @@ -#define STAGE_2 -#include "inst.cxx" diff --git a/Tests/SimpleInstall/lib1.cxx b/Tests/SimpleInstall/lib1.cxx deleted file mode 100644 index 7aa9052..0000000 --- a/Tests/SimpleInstall/lib1.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include "lib1.h" - -float Lib1Func() -{ - return 2.0; -} diff --git a/Tests/SimpleInstall/lib1.h b/Tests/SimpleInstall/lib1.h deleted file mode 100644 index 0d64e76..0000000 --- a/Tests/SimpleInstall/lib1.h +++ /dev/null @@ -1 +0,0 @@ -extern float Lib1Func(); diff --git a/Tests/SimpleInstall/lib2.cxx b/Tests/SimpleInstall/lib2.cxx deleted file mode 100644 index dccc48b..0000000 --- a/Tests/SimpleInstall/lib2.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include "lib2.h" - -float Lib2Func() -{ - return 1.0; -} diff --git a/Tests/SimpleInstall/lib2.h b/Tests/SimpleInstall/lib2.h deleted file mode 100644 index 044e775..0000000 --- a/Tests/SimpleInstall/lib2.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifdef _WIN32 -# ifdef test2_EXPORTS -# define CM_TEST_LIB_EXPORT __declspec(dllexport) -# else -# define CM_TEST_LIB_EXPORT __declspec(dllimport) -# endif -#else -# define CM_TEST_LIB_EXPORT -#endif - -CM_TEST_LIB_EXPORT float Lib2Func(); diff --git a/Tests/SimpleInstall/lib3.cxx b/Tests/SimpleInstall/lib3.cxx deleted file mode 100644 index da8dbf9..0000000 --- a/Tests/SimpleInstall/lib3.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include "lib3.h" - -float Lib3Func() -{ - return 2.0; -} diff --git a/Tests/SimpleInstall/lib3.h b/Tests/SimpleInstall/lib3.h deleted file mode 100644 index e02bbc4..0000000 --- a/Tests/SimpleInstall/lib3.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifdef _WIN32 -# ifdef test3_EXPORTS -# define CM_TEST_LIB_EXPORT __declspec(dllexport) -# else -# define CM_TEST_LIB_EXPORT __declspec(dllimport) -# endif -#else -# define CM_TEST_LIB_EXPORT -#endif - -CM_TEST_LIB_EXPORT float Lib3Func(); diff --git a/Tests/SimpleInstall/lib4.cxx b/Tests/SimpleInstall/lib4.cxx deleted file mode 100644 index fbede5c..0000000 --- a/Tests/SimpleInstall/lib4.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include "lib4.h" - -float Lib4Func() -{ - return 4.0; -} diff --git a/Tests/SimpleInstall/lib4.h b/Tests/SimpleInstall/lib4.h deleted file mode 100644 index e1a221e..0000000 --- a/Tests/SimpleInstall/lib4.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifdef _WIN32 -# ifdef test4_EXPORTS -# define CM_TEST_LIB_EXPORT __declspec(dllexport) -# else -# define CM_TEST_LIB_EXPORT __declspec(dllimport) -# endif -#else -# define CM_TEST_LIB_EXPORT -#endif - -CM_TEST_LIB_EXPORT float Lib4Func(); diff --git a/Tests/SimpleInstall/scripts/.gitattributes b/Tests/SimpleInstall/scripts/.gitattributes deleted file mode 100644 index 5e3db2f..0000000 --- a/Tests/SimpleInstall/scripts/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -sample_script crlf=input diff --git a/Tests/SimpleInstall/scripts/CMakeLists.txt b/Tests/SimpleInstall/scripts/CMakeLists.txt deleted file mode 100644 index ec34e8c..0000000 --- a/Tests/SimpleInstall/scripts/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -install_programs(/MyTest/share/old3 "^sample_script(\\.bat)?$") diff --git a/Tests/SimpleInstall/scripts/sample_script b/Tests/SimpleInstall/scripts/sample_script deleted file mode 100755 index 81f9f53..0000000 --- a/Tests/SimpleInstall/scripts/sample_script +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -echo "Sample Script Output" diff --git a/Tests/SimpleInstall/scripts/sample_script.bat b/Tests/SimpleInstall/scripts/sample_script.bat deleted file mode 100755 index a9af38c..0000000 --- a/Tests/SimpleInstall/scripts/sample_script.bat +++ /dev/null @@ -1 +0,0 @@ - at echo Sample Script Output diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt deleted file mode 100644 index 22150ca..0000000 --- a/Tests/SimpleInstallS2/CMakeLists.txt +++ /dev/null @@ -1,397 +0,0 @@ -cmake_minimum_required (VERSION 3.9) -project (TestSimpleInstall) -set(CMAKE_VERBOSE_MAKEFILE 1) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY - "${TestSimpleInstall_BINARY_DIR}/bin") -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY - "${TestSimpleInstall_BINARY_DIR}/lib/static") -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY - "${TestSimpleInstall_BINARY_DIR}/lib") - -# Skip generating the rpath pointing at the build tree to make sure -# the executable is installed with the proper rpath in the install -# tree. -set(CMAKE_SKIP_BUILD_RPATH 1) - -# Make sure the executable can run from the install tree. -set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/MyTest/lib) - -# Skip the dependency that causes a build when installing. This -# avoids infinite loops when the post-build rule below installs. -set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1) -set(CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY 1) - -set(CMAKE_DEBUG_POSTFIX "_test_debug_postfix") - -set(EXTRA_INSTALL_FLAGS) -message("Extra install: ${EXTRA_INSTALL_FLAGS}") - -if(STAGE2) - set(LIBPATHS - ${CMAKE_INSTALL_PREFIX}/MyTest/lib/static - ${CMAKE_INSTALL_PREFIX}/MyTest/lib - ) - set(t1NAMES test1 test1${CMAKE_DEBUG_POSTFIX} test1rel) - set(t2NAMES test2 test2${CMAKE_DEBUG_POSTFIX}) - set(t4NAMES test4out test4out${CMAKE_DEBUG_POSTFIX}) - - # Make sure the install script ran. - set(CMAKE_INSTALL_SCRIPT_DID_RUN 0) - include(${CMAKE_INSTALL_PREFIX}/MyTest/InstallScriptOut.cmake OPTIONAL) - if(CMAKE_INSTALL_SCRIPT_DID_RUN) - message(STATUS "Stage 1 did run install script 2.") - else() - message(SEND_ERROR "Stage 1 did not run install script 2.") - endif() - - if(CYGWIN OR MINGW) - set(LIBPATHS ${LIBPATHS} "${CMAKE_INSTALL_PREFIX}/MyTest/bin") - endif() - message("Search for library in: ${LIBPATHS}") - - set(TEST1_LIBRARY "TEST1_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE) - set(TEST2_LIBRARY "TEST2_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE) - set(TEST4_LIBRARY "TEST4_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE) - - find_library(TEST1_LIBRARY - NAMES ${t1NAMES} - PATHS ${LIBPATHS} - DOC "First library") - find_library(TEST2_LIBRARY - NAMES ${t2NAMES} - PATHS ${LIBPATHS} - DOC "Second library") - find_library(TEST4_LIBRARY - NAMES ${t4NAMES} - PATHS ${LIBPATHS} - DOC "Fourth library") - - # Test importing a library found on disk. - add_library(lib_test4 UNKNOWN IMPORTED) - set_property(TARGET lib_test4 PROPERTY IMPORTED_LOCATION ${TEST4_LIBRARY}) - - include_directories(${CMAKE_INSTALL_PREFIX}/MyTest/include) - add_executable (SimpleInstExeS2 inst2.cxx foo.c foo.h) - target_link_libraries(SimpleInstExeS2 ${TEST1_LIBRARY} ${TEST2_LIBRARY} lib_test4) - set(install_target SimpleInstExeS2) - - if("${TEST1_LIBRARY}" MATCHES "static") - message(STATUS "test1 correctly found in lib/static") - else() - message(SEND_ERROR "test1 not found in lib/static!") - endif() - - # Check for failure of configuration-specific installation. - if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Release/lib1debug.h") - message(FATAL_ERROR "Debug-configuration file installed for Release!") - endif() - if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Debug/lib1release.h") - message(FATAL_ERROR "Release-configuration file installed for Debug!") - endif() - - # Check for failure of directory installation. - if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/TSD.h") - message(FATAL_ERROR "Directory installation did not install TSD.h") - endif() - if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS") - message(FATAL_ERROR "Directory installation installed CVS directory.") - endif() - if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS") - message(FATAL_ERROR "Directory installation installed CVS directory.") - endif() - if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CMakeLists.txt") - message(FATAL_ERROR "Directory installation installed CMakeLists.txt.") - endif() - if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.h") - message(FATAL_ERROR "Directory installation did not install alternate TSD.h") - endif() - if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.cxx") - message(FATAL_ERROR "Directory installation installed alternate TSD.cxx") - endif() - - # Check that scripts properly installed. - if(WIN32 AND NOT CYGWIN) - set(BAT .bat) - else() - set(BAT) - endif() - foreach(loc share share/old1 share/old2 share/old3 share/alt) - set(CUR_SCRIPT "${CMAKE_INSTALL_PREFIX}/MyTest/${loc}/sample_script${BAT}") - execute_process( - COMMAND ${CUR_SCRIPT} - RESULT_VARIABLE SAMPLE_SCRIPT_RESULT - OUTPUT_VARIABLE SAMPLE_SCRIPT_OUTPUT - ) - if(NOT "${SAMPLE_SCRIPT_RESULT}" STREQUAL "0") - message(FATAL_ERROR - "Sample script [${CUR_SCRIPT}] failed: [${SAMPLE_SCRIPT_RESULT}]") - endif() - if(NOT "${SAMPLE_SCRIPT_OUTPUT}" MATCHES "Sample Script Output") - message(FATAL_ERROR - "Bad sample script [${CUR_SCRIPT}] output: [${SAMPLE_SCRIPT_OUTPUT}]") - endif() - endforeach() - - # Check for failure of empty directory installation. - if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty") - message(FATAL_ERROR "Empty directory installation did not install.") - endif() - file(GLOB EMPTY_FILES "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty/*") - if(EMPTY_FILES) - message(FATAL_ERROR "Empty directory installed [${EMPTY_FILES}].") - endif() - - # Make sure the test executable can run from the install tree. - set_target_properties(SimpleInstExeS2 PROPERTIES - INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib) - - install_targets(/MyTest/bin SimpleInstExeS2) - -# try to import the exported targets again - set(SimpleInstallS1_DIR ${CMAKE_INSTALL_PREFIX}/MyTest/lib) - find_package(SimpleInstallS1 REQUIRED) - get_target_property(simpleInstallImported S1_SimpleInstall IMPORTED) - if(NOT simpleInstallImported) - message(FATAL_ERROR "Target S1_SimpleInstall could not be imported") - endif() - -else() - # Wipe out the install directory to do a fresh test. - file(REMOVE_RECURSE ${CMAKE_INSTALL_PREFIX}/MyTest) - - # this is stage 1, so create libraries and modules and install everything - add_library(test1 STATIC lib1.cxx) - add_library(test2 SHARED lib2.cxx) - add_library(test3 MODULE lib3.cxx) - add_library(test4 SHARED lib4.cxx) - - # Test _OUTPUT_NAME properties. - set_property(TARGET test4 PROPERTY ARCHIVE_OUTPUT_NAME test4out) - set_property(TARGET test4 PROPERTY LIBRARY_OUTPUT_NAME test4out) - - add_executable (SimpleInstall inst.cxx foo.c foo.h) - target_link_libraries(SimpleInstall test1 test2 test4) - set(install_target SimpleInstall) - - set_target_properties(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstExe) - # Disable VERSION test until it is implemented in the Xcode generator. - if(NOT XCODE) - set_target_properties(SimpleInstall PROPERTIES VERSION 1.2) - endif() - - # Make sure the test executable can run from the install tree. - set_target_properties(SimpleInstall PROPERTIES - INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib) - - # Test per-configuration output name. - set_target_properties(test1 PROPERTIES RELEASE_OUTPUT_NAME test1rel) - set_target_properties(test2 PROPERTIES PUBLIC_HEADER foo.h) - - if(CMAKE_GENERATOR MATCHES "Makefiles") - add_subdirectory(TestSubDir) - add_dependencies(SimpleInstall TSD) - endif() - - add_dependencies(SimpleInstall test3) - add_dependencies(test2 test3) - add_dependencies(test4 test2) - - install(TARGETS SimpleInstall test1 test2 test3 EXPORT SimpleInstallS1 - RUNTIME DESTINATION MyTest/bin COMPONENT Runtime # .exe, .dll - LIBRARY DESTINATION MyTest/lib COMPONENT Runtime # .so, mod.dll - ARCHIVE DESTINATION MyTest/lib/static COMPONENT Development # .a, .lib - PUBLIC_HEADER DESTINATION MyTest/include COMPONENT Development - ) - - install(TARGETS test4 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE - RUNTIME DESTINATION MyTest/bin - LIBRARY DESTINATION MyTest/lib - ARCHIVE DESTINATION MyTest/lib/static - OPTIONAL # for coverage...target should always exist - ) - install(FILES lib1.h DESTINATION MyTest/include/$<1:foo>$<0:/wrong>) - install(FILES lib2.h - DESTINATION $<1:MyTest/include/foo>$<0:/wrong> - COMPONENT Development - PERMISSIONS OWNER_READ OWNER_WRITE - RENAME lib2renamed.h - ) - - # Test old-style install commands. - install_files(/MyTest/include FILES lib3.h) - install_files(/MyTest/include/old .h lib3) - install_files(/MyTest/include/old "^lib2.h$") - install_programs(/MyTest/share/old1 FILES - scripts/sample_script scripts/sample_script.bat) - install_programs(/MyTest/share/old2 - scripts/sample_script scripts/sample_script.bat) - -# "export" the targets collected in "SimpleInstallS1" - install(EXPORT SimpleInstallS1 FILE SimpleInstallS1Config.cmake - DESTINATION MyTest/lib - NAMESPACE S1_ ) - - export(TARGETS SimpleInstall test1 test2 test3 - FILE "${CMAKE_CURRENT_BINARY_DIR}/SimpleInstallS1Config.cmake" - NAMESPACE S2_ ) - - add_subdirectory(scripts) - - # Test optional installation. - install(FILES does_not_exist.h DESTINATION MyTest/include/foo OPTIONAL) - - # Test configuration-specific installation. - install(FILES lib1.h RENAME lib1release.h CONFIGURATIONS Release - DESTINATION MyTest/include/Release - ) - install(FILES lib1.h RENAME lib1debug.h CONFIGURATIONS Debug - DESTINATION MyTest/include/Debug - ) - - # Test directory installation. - file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS") - file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS") - install( - DIRECTORY TestSubDir $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share>$<0:/wrong> - FILE_PERMISSIONS OWNER_READ OWNER_WRITE - DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE - GROUP_READ GROUP_EXECUTE - PATTERN "CVS" EXCLUDE - REGEX "\\.txt$" EXCLUDE - PATTERN "scripts/*" PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ - ) - - # Alternate directory installation for coverage. - install( - DIRECTORY $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share/alt>$<0:/wrong> - COMPONENT Development - USE_SOURCE_PERMISSIONS - PATTERN "CVS" EXCLUDE - REGEX "\\.txt$" EXCLUDE - ) - install( - DIRECTORY TestSubDir DESTINATION $<1:MyTest/share/alt>$<0:/wrong> - FILE_PERMISSIONS OWNER_READ OWNER_WRITE - DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE - GROUP_READ GROUP_EXECUTE - FILES_MATCHING PATTERN "*.h" - ) - - # Test empty directory installation. - install(DIRECTORY DESTINATION MyTest/share/empty) - - # Test optional directory installation. - install(DIRECTORY does-not-exist DESTINATION MyTest/share OPTIONAL) - - # Test user-specified install scripts, with and without COMPONENT. - install( - SCRIPT InstallScript1.cmake - CODE "set(INSTALL_CODE_DID_RUN 1)" - SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/InstallScript2.cmake - ) - install( - SCRIPT InstallScript3.cmake - CODE "set(INSTALL_CODE_WITH_COMPONENT_DID_RUN 1)" - SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/InstallScript4.cmake - COMPONENT Development - ) - set_directory_properties(PROPERTIES - ADDITIONAL_MAKE_CLEAN_FILES - "${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake;${CMAKE_INSTALL_PREFIX}/InstallScript4Out.cmake") - - set_target_properties(SimpleInstall PROPERTIES PRE_INSTALL_SCRIPT - ${CMAKE_CURRENT_SOURCE_DIR}/PreInstall.cmake) - set_target_properties(SimpleInstall PROPERTIES POST_INSTALL_SCRIPT - ${CMAKE_CURRENT_SOURCE_DIR}/PostInstall.cmake) - set_target_properties(test4 PROPERTIES VERSION 1.2 SOVERSION 3 - INSTALL_NAME_DIR @executable_path/../lib) -endif() - -get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) -if(_isMultiConfig) - set(SI_CONFIG --config $) -else() - set(SI_CONFIG) -endif() - -# Dummy test of CPack -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Test of packaging with cpack") -set(CPACK_PACKAGE_VENDOR "Kitware") -set(CPACK_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/PackageScript.cmake") - -if(WIN32 AND NOT UNIX) - find_program(NSIS_MAKENSIS NAMES makensis - PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS] - DOC "Where is makensis.exe located" - ) - if(NOT NSIS_MAKENSIS) - set(CPACK_GENERATOR TGZ) - endif() -endif() -if(UNIX AND NOT APPLE) - set(CPACK_GENERATOR "TGZ;STGZ;TZ") - # find_program(found_compress - # NAMES compress) - # if(found_compress) - # find_program(file_command NAMES file) - # if(NOT file_command) - # set(file_command file) - # endif() - # execute_process(COMMAND ${file_command} ${found_compress} - # OUTPUT_VARIABLE output) - # set(SKIP_TZ FALSE) - # if("${output}" MATCHES "script") - # set(SKIP_TZ TRUE) - # endif() - # if("${output}" MATCHES "dummy.sh") - # set(SKIP_TZ TRUE) - # endif() - # if(NOT SKIP_TZ) - # message("compress found and it was not a script") - # message("output from file command: [${output}]") - # list(APPEND CPACK_GENERATOR "TZ") - # else() - # message("compress found, but it was a script so don't use it") - # message("output from file command: [${output}]") - # endif() - # endif() - find_program(found_bz2 - NAMES bzip2) - if(found_bz2) - list(APPEND CPACK_GENERATOR "TBZ2") - endif() -endif() - -set(CPACK_PACKAGE_EXECUTABLES "SimpleInstall" "Simple Install") -set(CMAKE_INSTALL_MFC_LIBRARIES 1) -set(CMAKE_INSTALL_DEBUG_LIBRARIES 1) -set(CMAKE_INSTALL_UCRT_LIBRARIES 1) -include(InstallRequiredSystemLibraries) - -if(CTEST_TEST_CPACK) - set(package_command COMMAND - ${CMAKE_COMMAND} --build . --target package ${SI_CONFIG} - ) - - # Avoid settings that require the .zip file command line tools... - # (just build an NSIS installer without component support) - # - set(CPACK_BINARY_ZIP OFF) - set(CPACK_MONOLITHIC_INSTALL ON) -else() - set(package_command) -endif() - -include(CPack) - -set(install_command COMMAND - ${CMAKE_COMMAND} --build . --target install ${SI_CONFIG} - ) - -add_custom_command( - TARGET ${install_target} - POST_BUILD - ${install_command} - ${package_command} - COMMENT "Install Project" - ) diff --git a/Tests/SimpleInstallS2/InstallScript1.cmake b/Tests/SimpleInstallS2/InstallScript1.cmake deleted file mode 100644 index ef9da57..0000000 --- a/Tests/SimpleInstallS2/InstallScript1.cmake +++ /dev/null @@ -1,5 +0,0 @@ -message("This is install script 1.") -set(INSTALL_SCRIPT_1_DID_RUN 1) -if(INSTALL_CODE_DID_RUN) - message(FATAL_ERROR "Install script 1 did not run before install code.") -endif() diff --git a/Tests/SimpleInstallS2/InstallScript2.cmake b/Tests/SimpleInstallS2/InstallScript2.cmake deleted file mode 100644 index c1d20a3..0000000 --- a/Tests/SimpleInstallS2/InstallScript2.cmake +++ /dev/null @@ -1,14 +0,0 @@ -message("This is install script 2.") -if(INSTALL_SCRIPT_1_DID_RUN) - message("Install script ordering works.") -else() - message(FATAL_ERROR "Install script 1 did not run before install script 2.") -endif() -if(INSTALL_CODE_DID_RUN) - message("Install code ordering works.") -else() - message(FATAL_ERROR "Install script 2 did not run after install code.") -endif() -file(WRITE "${CMAKE_INSTALL_PREFIX}/MyTest/InstallScriptOut.cmake" - "set(CMAKE_INSTALL_SCRIPT_DID_RUN 1)\n" - ) diff --git a/Tests/SimpleInstallS2/InstallScript3.cmake b/Tests/SimpleInstallS2/InstallScript3.cmake deleted file mode 100644 index 6485156..0000000 --- a/Tests/SimpleInstallS2/InstallScript3.cmake +++ /dev/null @@ -1,12 +0,0 @@ -message("This is install script 3.") -set(INSTALL_SCRIPT_3_DID_RUN 1) -if(INSTALL_CODE_WITH_COMPONENT_DID_RUN) - message(FATAL_ERROR "Install script 3 did not run before install code with component.") -endif() - -if(CMAKE_INSTALL_COMPONENT) -if(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development") - message("CMAKE_INSTALL_COMPONENT=\"${CMAKE_INSTALL_COMPONENT}\"") - message(FATAL_ERROR "Install script 3 should only run for \"Development\" INSTALL COMPONENT.") -endif() -endif() diff --git a/Tests/SimpleInstallS2/InstallScript4.cmake b/Tests/SimpleInstallS2/InstallScript4.cmake deleted file mode 100644 index 34d0a73..0000000 --- a/Tests/SimpleInstallS2/InstallScript4.cmake +++ /dev/null @@ -1,22 +0,0 @@ -message("This is install script 4.") -if(INSTALL_SCRIPT_3_DID_RUN) - message("Install script ordering works.") -else() - message(FATAL_ERROR "Install script 3 did not run before install script 4.") -endif() -if(INSTALL_CODE_WITH_COMPONENT_DID_RUN) - message("Install code ordering works.") -else() - message(FATAL_ERROR "Install script 4 did not run after install with component code.") -endif() - -if(CMAKE_INSTALL_COMPONENT) -if(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development") - message("CMAKE_INSTALL_COMPONENT=\"${CMAKE_INSTALL_COMPONENT}\"") - message(FATAL_ERROR "Install script 4 should only run for \"Development\" INSTALL COMPONENT.") -endif() -endif() - -file(WRITE "${CMAKE_INSTALL_PREFIX}/MyTest/InstallScript4Out.cmake" - "set(CMAKE_INSTALL_SCRIPT_4_DID_RUN 1)\n" - ) diff --git a/Tests/SimpleInstallS2/PackageScript.cmake b/Tests/SimpleInstallS2/PackageScript.cmake deleted file mode 100644 index 53b7909..0000000 --- a/Tests/SimpleInstallS2/PackageScript.cmake +++ /dev/null @@ -1,10 +0,0 @@ -message("This is packaging script") -message("It writes a file with all variables available in ${CMAKE_INSTALL_PREFIX}/AllVariables.txt") - -file(WRITE ${CMAKE_INSTALL_PREFIX}/AllVariables.txt "") -get_cmake_property(res VARIABLES) -foreach(var ${res}) - file(APPEND ${CMAKE_INSTALL_PREFIX}/AllVariables.txt - "${var} \"${${var}}\"\n") -endforeach() - diff --git a/Tests/SimpleInstallS2/PostInstall.cmake b/Tests/SimpleInstallS2/PostInstall.cmake deleted file mode 100644 index d616221..0000000 --- a/Tests/SimpleInstallS2/PostInstall.cmake +++ /dev/null @@ -1,6 +0,0 @@ -message("In post install") -if(PRE_INSTALL_DID_RUN) - message("Pre and post install work fine") -else() - message(FATAL_ERROR "Pre install did not run before post install") -endif() diff --git a/Tests/SimpleInstallS2/PreInstall.cmake b/Tests/SimpleInstallS2/PreInstall.cmake deleted file mode 100644 index 7a9851e..0000000 --- a/Tests/SimpleInstallS2/PreInstall.cmake +++ /dev/null @@ -1,2 +0,0 @@ -message("This is in pre install") -set(PRE_INSTALL_DID_RUN 1) diff --git a/Tests/SimpleInstallS2/TestSubDir/CMakeLists.txt b/Tests/SimpleInstallS2/TestSubDir/CMakeLists.txt deleted file mode 100644 index 860e104..0000000 --- a/Tests/SimpleInstallS2/TestSubDir/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_executable(TSD TSD.cxx TSD_utils.cxx) -install_files(/MyTest/include FILES TSD.h) -install_targets(/MyTest/bin TSD) diff --git a/Tests/SimpleInstallS2/TestSubDir/TSD.cxx b/Tests/SimpleInstallS2/TestSubDir/TSD.cxx deleted file mode 100644 index 8fc3878..0000000 --- a/Tests/SimpleInstallS2/TestSubDir/TSD.cxx +++ /dev/null @@ -1,10 +0,0 @@ -#include - -#include "TSD.h" - -int main() -{ - int res = TSD("TEST"); - printf("Hello from TSD\n"); - return res; -} diff --git a/Tests/SimpleInstallS2/TestSubDir/TSD.h b/Tests/SimpleInstallS2/TestSubDir/TSD.h deleted file mode 100644 index 6a3c1af..0000000 --- a/Tests/SimpleInstallS2/TestSubDir/TSD.h +++ /dev/null @@ -1 +0,0 @@ -int TSD(const char*); diff --git a/Tests/SimpleInstallS2/TestSubDir/TSD_utils.cxx b/Tests/SimpleInstallS2/TestSubDir/TSD_utils.cxx deleted file mode 100644 index 0f32894..0000000 --- a/Tests/SimpleInstallS2/TestSubDir/TSD_utils.cxx +++ /dev/null @@ -1,9 +0,0 @@ -#include - -int TSD(const char* foo) -{ - if (strcmp(foo, "TEST") == 0) { - return 0; - } - return 1; -} diff --git a/Tests/SimpleInstallS2/foo.c b/Tests/SimpleInstallS2/foo.c deleted file mode 100644 index 45d5b2b..0000000 --- a/Tests/SimpleInstallS2/foo.c +++ /dev/null @@ -1,6 +0,0 @@ -char* foo = "Foo"; - -int SomeFunctionInFoo() -{ - return 5; -} diff --git a/Tests/SimpleInstallS2/foo.h b/Tests/SimpleInstallS2/foo.h deleted file mode 100644 index 216cdf6..0000000 --- a/Tests/SimpleInstallS2/foo.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifdef __cplusplus -extern "C" { -#endif - -extern char* foo; -extern int SomeFunctionInFoo(); - -#ifdef __cplusplus -} -#endif diff --git a/Tests/SimpleInstallS2/inst.cxx b/Tests/SimpleInstallS2/inst.cxx deleted file mode 100644 index 7815f86..0000000 --- a/Tests/SimpleInstallS2/inst.cxx +++ /dev/null @@ -1,34 +0,0 @@ -#include "foo.h" - -#ifdef STAGE_2 -# include -# include -# include -# include -# include -#else -# include "lib1.h" -# include "lib2.h" -#endif - -#include "lib4.h" - -#include - -int main() -{ - if (Lib1Func() != 2.0) { - printf("Problem with lib1\n"); - return 1; - } - if (Lib2Func() != 1.0) { - printf("Problem with lib2\n"); - return 1; - } - if (Lib4Func() != 4.0) { - printf("Problem with lib4\n"); - return 1; - } - printf("The value of Foo: %s\n", foo); - return SomeFunctionInFoo() - 5; -} diff --git a/Tests/SimpleInstallS2/inst2.cxx b/Tests/SimpleInstallS2/inst2.cxx deleted file mode 100644 index c70b93a..0000000 --- a/Tests/SimpleInstallS2/inst2.cxx +++ /dev/null @@ -1,2 +0,0 @@ -#define STAGE_2 -#include "inst.cxx" diff --git a/Tests/SimpleInstallS2/lib1.cxx b/Tests/SimpleInstallS2/lib1.cxx deleted file mode 100644 index 7aa9052..0000000 --- a/Tests/SimpleInstallS2/lib1.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include "lib1.h" - -float Lib1Func() -{ - return 2.0; -} diff --git a/Tests/SimpleInstallS2/lib1.h b/Tests/SimpleInstallS2/lib1.h deleted file mode 100644 index 0d64e76..0000000 --- a/Tests/SimpleInstallS2/lib1.h +++ /dev/null @@ -1 +0,0 @@ -extern float Lib1Func(); diff --git a/Tests/SimpleInstallS2/lib2.cxx b/Tests/SimpleInstallS2/lib2.cxx deleted file mode 100644 index dccc48b..0000000 --- a/Tests/SimpleInstallS2/lib2.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include "lib2.h" - -float Lib2Func() -{ - return 1.0; -} diff --git a/Tests/SimpleInstallS2/lib2.h b/Tests/SimpleInstallS2/lib2.h deleted file mode 100644 index 044e775..0000000 --- a/Tests/SimpleInstallS2/lib2.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifdef _WIN32 -# ifdef test2_EXPORTS -# define CM_TEST_LIB_EXPORT __declspec(dllexport) -# else -# define CM_TEST_LIB_EXPORT __declspec(dllimport) -# endif -#else -# define CM_TEST_LIB_EXPORT -#endif - -CM_TEST_LIB_EXPORT float Lib2Func(); diff --git a/Tests/SimpleInstallS2/lib3.cxx b/Tests/SimpleInstallS2/lib3.cxx deleted file mode 100644 index da8dbf9..0000000 --- a/Tests/SimpleInstallS2/lib3.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include "lib3.h" - -float Lib3Func() -{ - return 2.0; -} diff --git a/Tests/SimpleInstallS2/lib3.h b/Tests/SimpleInstallS2/lib3.h deleted file mode 100644 index e02bbc4..0000000 --- a/Tests/SimpleInstallS2/lib3.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifdef _WIN32 -# ifdef test3_EXPORTS -# define CM_TEST_LIB_EXPORT __declspec(dllexport) -# else -# define CM_TEST_LIB_EXPORT __declspec(dllimport) -# endif -#else -# define CM_TEST_LIB_EXPORT -#endif - -CM_TEST_LIB_EXPORT float Lib3Func(); diff --git a/Tests/SimpleInstallS2/lib4.cxx b/Tests/SimpleInstallS2/lib4.cxx deleted file mode 100644 index fbede5c..0000000 --- a/Tests/SimpleInstallS2/lib4.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include "lib4.h" - -float Lib4Func() -{ - return 4.0; -} diff --git a/Tests/SimpleInstallS2/lib4.h b/Tests/SimpleInstallS2/lib4.h deleted file mode 100644 index e1a221e..0000000 --- a/Tests/SimpleInstallS2/lib4.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifdef _WIN32 -# ifdef test4_EXPORTS -# define CM_TEST_LIB_EXPORT __declspec(dllexport) -# else -# define CM_TEST_LIB_EXPORT __declspec(dllimport) -# endif -#else -# define CM_TEST_LIB_EXPORT -#endif - -CM_TEST_LIB_EXPORT float Lib4Func(); diff --git a/Tests/SimpleInstallS2/scripts/.gitattributes b/Tests/SimpleInstallS2/scripts/.gitattributes deleted file mode 100644 index 5e3db2f..0000000 --- a/Tests/SimpleInstallS2/scripts/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -sample_script crlf=input diff --git a/Tests/SimpleInstallS2/scripts/CMakeLists.txt b/Tests/SimpleInstallS2/scripts/CMakeLists.txt deleted file mode 100644 index ec34e8c..0000000 --- a/Tests/SimpleInstallS2/scripts/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -install_programs(/MyTest/share/old3 "^sample_script(\\.bat)?$") diff --git a/Tests/SimpleInstallS2/scripts/sample_script b/Tests/SimpleInstallS2/scripts/sample_script deleted file mode 100755 index 81f9f53..0000000 --- a/Tests/SimpleInstallS2/scripts/sample_script +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -echo "Sample Script Output" diff --git a/Tests/SimpleInstallS2/scripts/sample_script.bat b/Tests/SimpleInstallS2/scripts/sample_script.bat deleted file mode 100755 index a9af38c..0000000 --- a/Tests/SimpleInstallS2/scripts/sample_script.bat +++ /dev/null @@ -1 +0,0 @@ - at echo Sample Script Output https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=36ef57a9392fb5b3e688ff95547836d433db01c9 commit 36ef57a9392fb5b3e688ff95547836d433db01c9 Author: Kyle Edwards AuthorDate: Fri Jul 13 09:47:31 2018 -0400 Commit: Kyle Edwards CommitDate: Tue Jul 17 09:07:10 2018 -0400 Tests: Add test for cmake --build . --target package diff --git a/Tests/RunCMake/CPack/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake index 447b08b..8c9f4b4 100644 --- a/Tests/RunCMake/CPack/CPackTestHelpers.cmake +++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake @@ -1,10 +1,14 @@ cmake_policy(SET CMP0057 NEW) -function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACKAGING_TYPE) +function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACKAGING_TYPE package_target) if(TEST_TYPE IN_LIST types) set(RunCMake_TEST_NO_CLEAN TRUE) - set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${TEST_NAME}-build") - set(full_test_name_ "${TEST_NAME}") + if(package_target) + set(full_test_name_ "${TEST_NAME}-package-target") + else() + set(full_test_name_ "${TEST_NAME}") + endif() + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${full_test_name_}-build") if(SUBTEST_SUFFIX) set(RunCMake_TEST_BINARY_DIR "${RunCMake_TEST_BINARY_DIR}-${SUBTEST_SUFFIX}-subtest") @@ -67,9 +71,15 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK unset(pack_params_) endif() + if(package_target) + set(cpack_command_ ${CMAKE_COMMAND} --build "${RunCMake_TEST_BINARY_DIR}" --target package) + else() + set(cpack_command_ ${CMAKE_CPACK_COMMAND} ${pack_params_}) + endif() + # execute cpack execute_process( - COMMAND ${CMAKE_CPACK_COMMAND} ${pack_params_} + COMMAND ${cpack_command_} WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" RESULT_VARIABLE "result_" OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt" @@ -113,18 +123,24 @@ endfunction() function(run_cpack_test TEST_NAME types build PACKAGING_TYPES) foreach(packaging_type_ IN LISTS PACKAGING_TYPES) - run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" false "${packaging_type_}") + run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" false "${packaging_type_}" false) + endforeach() +endfunction() + +function(run_cpack_test_package_target TEST_NAME types build PACKAGING_TYPES) + foreach(packaging_type_ IN LISTS PACKAGING_TYPES) + run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" false "${packaging_type_}" true) endforeach() endfunction() function(run_cpack_test_subtests TEST_NAME SUBTEST_SUFFIXES types build PACKAGING_TYPES) foreach(suffix_ IN LISTS SUBTEST_SUFFIXES) foreach(packaging_type_ IN LISTS PACKAGING_TYPES) - run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "${suffix_}" false "${packaging_type_}") + run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "${suffix_}" false "${packaging_type_}" false) endforeach() endforeach() endfunction() function(run_cpack_source_test TEST_NAME types) - run_cpack_test_common_("${TEST_NAME}" "${types}" false "" true "") + run_cpack_test_common_("${TEST_NAME}" "${types}" false "" true "" false) endfunction() diff --git a/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt b/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt index 4a0e4e6..f02f9d6 100644 --- a/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt +++ b/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt @@ -1 +1 @@ -^(CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM/CPack/[^-]*-build((-[^-]*-subtest/)|/)_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec(\n|$))*$ +^(CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM/CPack/[^-]*(-package-target)?-build((-[^-]*-subtest/)|/)_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec(\n|$))*$ diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index bc25b12..33ffa14 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -19,6 +19,7 @@ run_cpack_test(INSTALL_SCRIPTS "RPM" false "COMPONENT") run_cpack_test(LONG_FILENAMES "DEB" false "MONOLITHIC") run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM" false "COMPONENT") run_cpack_test(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;Ext" false "MONOLITHIC;COMPONENT") +run_cpack_test_package_target(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;Ext" false "MONOLITHIC;COMPONENT") run_cpack_test_subtests(PACKAGE_CHECKSUM "invalid;MD5;SHA1;SHA224;SHA256;SHA384;SHA512" "TGZ" false "MONOLITHIC") run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM" false "COMPONENT") run_cpack_test(PER_COMPONENT_FIELDS "RPM;DEB" false "COMPONENT") https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=11ca374b284603278eded2548bbc9d7de88706e9 commit 11ca374b284603278eded2548bbc9d7de88706e9 Author: Kyle Edwards AuthorDate: Fri Jul 13 09:08:40 2018 -0400 Commit: Kyle Edwards CommitDate: Tue Jul 17 09:07:10 2018 -0400 Tests: Add test for install(SCRIPT ... COMPONENT) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index 2999951..91524a6 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -95,3 +95,4 @@ set(run_install_test_components 1) run_install_test(FILES-EXCLUDE_FROM_ALL) run_install_test(TARGETS-EXCLUDE_FROM_ALL) run_install_test(TARGETS-NAMELINK_COMPONENT) +run_install_test(SCRIPT-COMPONENT) diff --git a/Tests/RunCMake/install/SCRIPT-COMPONENT-all-check.cmake b/Tests/RunCMake/install/SCRIPT-COMPONENT-all-check.cmake new file mode 100644 index 0000000..48d8e1a --- /dev/null +++ b/Tests/RunCMake/install/SCRIPT-COMPONENT-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^empty1.txt;empty2.txt$]]) diff --git a/Tests/RunCMake/install/SCRIPT-COMPONENT-dev-check.cmake b/Tests/RunCMake/install/SCRIPT-COMPONENT-dev-check.cmake new file mode 100644 index 0000000..48d8e1a --- /dev/null +++ b/Tests/RunCMake/install/SCRIPT-COMPONENT-dev-check.cmake @@ -0,0 +1 @@ +check_installed([[^empty1.txt;empty2.txt$]]) diff --git a/Tests/RunCMake/install/SCRIPT-COMPONENT-uns-check.cmake b/Tests/RunCMake/install/SCRIPT-COMPONENT-uns-check.cmake new file mode 100644 index 0000000..e09a102 --- /dev/null +++ b/Tests/RunCMake/install/SCRIPT-COMPONENT-uns-check.cmake @@ -0,0 +1 @@ +check_installed([[^$]]) diff --git a/Tests/RunCMake/install/SCRIPT-COMPONENT.cmake b/Tests/RunCMake/install/SCRIPT-COMPONENT.cmake new file mode 100644 index 0000000..aaa9bd4 --- /dev/null +++ b/Tests/RunCMake/install/SCRIPT-COMPONENT.cmake @@ -0,0 +1,5 @@ +install( + SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/install_script.cmake" + CODE "write_empty_file(empty2.txt)" + COMPONENT dev + ) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2201fb6f4369911f2260deb41dc70ac5c9c905d6 commit 2201fb6f4369911f2260deb41dc70ac5c9c905d6 Author: Kyle Edwards AuthorDate: Fri Jul 13 09:01:09 2018 -0400 Commit: Kyle Edwards CommitDate: Tue Jul 17 09:07:10 2018 -0400 Tests: Add test for InstallRequiredSystemLibraries diff --git a/Tests/RunCMake/install/InstallRequiredSystemLibraries-stderr.txt b/Tests/RunCMake/install/InstallRequiredSystemLibraries-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/install/InstallRequiredSystemLibraries-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/install/InstallRequiredSystemLibraries.cmake b/Tests/RunCMake/install/InstallRequiredSystemLibraries.cmake new file mode 100644 index 0000000..27ff683 --- /dev/null +++ b/Tests/RunCMake/install/InstallRequiredSystemLibraries.cmake @@ -0,0 +1,10 @@ +enable_language(C) +set(CMAKE_INSTALL_MFC_LIBRARIES 1) +set(CMAKE_INSTALL_DEBUG_LIBRARIES 1) +set(CMAKE_INSTALL_UCRT_LIBRARIES 1) +set(CMAKE_INSTALL_OPENMP_LIBRARIES 1) +include(InstallRequiredSystemLibraries) + +# FIXME: This test emits warnings because InstallRequiredSystemLibraries +# doesn't currently work properly. The warnings have been suppressed in +# InstallRequiredSystemLibraries-stderr.txt. This needs to be fixed. diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index 6b5a251..2999951 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -89,6 +89,7 @@ run_install_test(DIRECTORY-PATTERN) run_install_test(TARGETS-Parts) run_install_test(FILES-PERMISSIONS) run_install_test(TARGETS-RPATH) +run_install_test(InstallRequiredSystemLibraries) set(run_install_test_components 1) run_install_test(FILES-EXCLUDE_FROM_ALL) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5a7a006fddfe0cbf00004dfb7352b9b83dca9d58 commit 5a7a006fddfe0cbf00004dfb7352b9b83dca9d58 Author: Kyle Edwards AuthorDate: Fri Jul 13 08:49:25 2018 -0400 Commit: Kyle Edwards CommitDate: Tue Jul 17 09:07:02 2018 -0400 Tests: Add test for $<0:...> in ExportImport This test case already includes test cases for $<1...> and $<0...>, but this commit adds a few $<0:...>'s in cases where it was missing. diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index 470a5bd..fdb2fa1 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -510,9 +510,9 @@ install( cmp0022NEW cmp0022OLD systemlib EXPORT exp - RUNTIME DESTINATION $<1:bin> - LIBRARY DESTINATION $<1:lib> NAMELINK_SKIP - ARCHIVE DESTINATION $<1:lib> + RUNTIME DESTINATION $<1:bin>$<0:/wrong> + LIBRARY DESTINATION $<1:lib>$<0:/wrong> NAMELINK_SKIP + ARCHIVE DESTINATION $<1:lib>$<0:/wrong> ${maybe_OBJECTS_DESTINATION} FRAMEWORK DESTINATION Frameworks BUNDLE DESTINATION Applications https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=69ca768e7827c60b07914f248d7730fb7182ce4b commit 69ca768e7827c60b07914f248d7730fb7182ce4b Author: Kyle Edwards AuthorDate: Thu Jul 12 11:17:38 2018 -0400 Commit: Kyle Edwards CommitDate: Tue Jul 17 09:07:01 2018 -0400 Tests: Add test for install(TARGETS) RPATH functionality diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index cfd0a02..6b5a251 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -88,6 +88,7 @@ run_install_test(TARGETS-CONFIGURATIONS) run_install_test(DIRECTORY-PATTERN) run_install_test(TARGETS-Parts) run_install_test(FILES-PERMISSIONS) +run_install_test(TARGETS-RPATH) set(run_install_test_components 1) run_install_test(FILES-EXCLUDE_FROM_ALL) diff --git a/Tests/RunCMake/install/TARGETS-RPATH-all-check.cmake b/Tests/RunCMake/install/TARGETS-RPATH-all-check.cmake new file mode 100644 index 0000000..fa52d65 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-RPATH-all-check.cmake @@ -0,0 +1,14 @@ +execute_process( + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/myexe" + RESULT_VARIABLE MYEXE_RESULT + OUTPUT_VARIABLE MYEXE_OUTPUT + ERROR_VARIABLE MYEXE_ERROR + ) + +if(NOT MYEXE_RESULT EQUAL "0") + set(RunCMake_TEST_FAILED "myexe returned [${MYEXE_RESULT}], was expecting [0]") +elseif(NOT MYEXE_OUTPUT STREQUAL "") + set(RunCMake_TEST_FAILED "myexe printed nonempty output:\n${MYEXE_OUTPUT}") +elseif(NOT MYEXE_ERROR STREQUAL "") + set(RunCMake_TEST_FAILED "myexe printed nonempty error:\n${MYEXE_ERROR}") +endif() diff --git a/Tests/RunCMake/install/TARGETS-RPATH.cmake b/Tests/RunCMake/install/TARGETS-RPATH.cmake new file mode 100644 index 0000000..b75deff --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-RPATH.cmake @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.9) + +enable_language(C) + +set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) +add_library(mylib SHARED obj1.c) +add_executable(myexe testobj1.c) +target_link_libraries(myexe mylib) +set_property(TARGET myexe PROPERTY INSTALL_RPATH "${CMAKE_CURRENT_BINARY_DIR}/root-all/bin") +set_target_properties(mylib PROPERTIES VERSION 1.0 SOVERSION 1) + +install(TARGETS mylib myexe + DESTINATION bin + ) diff --git a/Tests/RunCMake/install/obj1.c b/Tests/RunCMake/install/obj1.c index 2411aab..70007df 100644 --- a/Tests/RunCMake/install/obj1.c +++ b/Tests/RunCMake/install/obj1.c @@ -1,4 +1,7 @@ -int obj1(void) +#ifdef _WIN32 +__declspec(dllexport) +#endif + int obj1(void) { return 0; } diff --git a/Tests/RunCMake/install/testobj1.c b/Tests/RunCMake/install/testobj1.c new file mode 100644 index 0000000..081ef20 --- /dev/null +++ b/Tests/RunCMake/install/testobj1.c @@ -0,0 +1,9 @@ +#ifdef _WIN32 +__declspec(dllimport) +#endif + int obj1(void); + +int main(void) +{ + return obj1(); +} https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=25c3fb6c3512a76d45fd8a70d95fabe2777a4c2d commit 25c3fb6c3512a76d45fd8a70d95fabe2777a4c2d Author: Kyle Edwards AuthorDate: Thu Jul 12 10:53:38 2018 -0400 Commit: Kyle Edwards CommitDate: Tue Jul 17 09:07:01 2018 -0400 Tests: Add test for install(FILES) with PERMISSIONS diff --git a/Tests/RunCMake/install/FILES-PERMISSIONS-all-check.cmake b/Tests/RunCMake/install/FILES-PERMISSIONS-all-check.cmake new file mode 100644 index 0000000..b8ba6d0 --- /dev/null +++ b/Tests/RunCMake/install/FILES-PERMISSIONS-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^src;src/empty.c]]) diff --git a/Tests/RunCMake/install/FILES-PERMISSIONS.cmake b/Tests/RunCMake/install/FILES-PERMISSIONS.cmake new file mode 100644 index 0000000..999c271 --- /dev/null +++ b/Tests/RunCMake/install/FILES-PERMISSIONS.cmake @@ -0,0 +1,5 @@ +install( + FILES empty.c + DESTINATION src + PERMISSIONS OWNER_READ OWNER_WRITE + ) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index 27be9e2..cfd0a02 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -87,6 +87,7 @@ run_install_test(SCRIPT) run_install_test(TARGETS-CONFIGURATIONS) run_install_test(DIRECTORY-PATTERN) run_install_test(TARGETS-Parts) +run_install_test(FILES-PERMISSIONS) set(run_install_test_components 1) run_install_test(FILES-EXCLUDE_FROM_ALL) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b5df4faa203bfac4bee9924520015f76f9692676 commit b5df4faa203bfac4bee9924520015f76f9692676 Author: Kyle Edwards AuthorDate: Thu Jul 12 10:41:04 2018 -0400 Commit: Kyle Edwards CommitDate: Tue Jul 17 09:07:01 2018 -0400 Tests: Add test for installing parts of targets in different directories diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index e05a1c0..27be9e2 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -86,6 +86,7 @@ run_install_test(PRE_POST_INSTALL_SCRIPT) run_install_test(SCRIPT) run_install_test(TARGETS-CONFIGURATIONS) run_install_test(DIRECTORY-PATTERN) +run_install_test(TARGETS-Parts) set(run_install_test_components 1) run_install_test(FILES-EXCLUDE_FROM_ALL) diff --git a/Tests/RunCMake/install/TARGETS-Parts-all-check.cmake b/Tests/RunCMake/install/TARGETS-Parts-all-check.cmake new file mode 100644 index 0000000..6245839 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-Parts-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^include;include/obj1\.h;lib;lib/(mylib\.lib|(lib|cyg)mylib\.a)$]]) diff --git a/Tests/RunCMake/install/TARGETS-Parts.cmake b/Tests/RunCMake/install/TARGETS-Parts.cmake new file mode 100644 index 0000000..2a46ab9 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-Parts.cmake @@ -0,0 +1,7 @@ +enable_language(C) +add_library(mylib STATIC obj1.c) +set_property(TARGET mylib PROPERTY PUBLIC_HEADER obj1.h) +install(TARGETS mylib + ARCHIVE DESTINATION lib + PUBLIC_HEADER DESTINATION include + ) diff --git a/Tests/RunCMake/install/obj1.h b/Tests/RunCMake/install/obj1.h new file mode 100644 index 0000000..d88d5d2 --- /dev/null +++ b/Tests/RunCMake/install/obj1.h @@ -0,0 +1,6 @@ +#ifndef OBJ1_H +#define OBJ1_H + +int obj1(void); + +#endif /* OBJ1_H */ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4108ab4be2307ef161467de46e4c35e8b086ce02 commit 4108ab4be2307ef161467de46e4c35e8b086ce02 Author: Kyle Edwards AuthorDate: Thu Jul 12 10:04:37 2018 -0400 Commit: Kyle Edwards CommitDate: Tue Jul 17 09:07:01 2018 -0400 Tests: Add test for install(DIRECTORY) with PATTERN and REGEX diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN-all-check.cmake b/Tests/RunCMake/install/DIRECTORY-PATTERN-all-check.cmake new file mode 100644 index 0000000..7a20edc --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-PATTERN-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^dir1;dir1/empty\.c;dir1/empty\.h;dir2;dir2/pattern;dir2/pattern/empty\.txt;dir3;dir3/empty\.c;dir3/empty\.h;dir3/empty\.txt;dir4;dir4/empty\.c;dir4/empty\.h;dir4/empty\.txt;empty$]]) diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN.cmake b/Tests/RunCMake/install/DIRECTORY-PATTERN.cmake new file mode 100644 index 0000000..74d8043 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-PATTERN.cmake @@ -0,0 +1,36 @@ +install( + DIRECTORY pattern/ + DESTINATION dir1 + FILES_MATCHING + PATTERN "*.h" + REGEX "\\.c$" + ) + +# FIXME: If/when CMake gains a good way to read file permissions, we should +# check that these permissions were set correctly. +install( + DIRECTORY pattern + DESTINATION dir2 + FILE_PERMISSIONS OWNER_READ OWNER_WRITE + DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE + PATTERN "*.h" EXCLUDE + REGEX "\\.c$" EXCLUDE + ) + +install( + DIRECTORY pattern/ + DESTINATION dir3 + PATTERN "*.h" + PERMISSIONS OWNER_READ OWNER_WRITE + ) + +install( + DIRECTORY pattern/ + DESTINATION dir4 + USE_SOURCE_PERMISSIONS + ) + +install( + DIRECTORY + DESTINATION empty + ) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index 31287c8..e05a1c0 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -85,6 +85,7 @@ run_install_test(Deprecated) run_install_test(PRE_POST_INSTALL_SCRIPT) run_install_test(SCRIPT) run_install_test(TARGETS-CONFIGURATIONS) +run_install_test(DIRECTORY-PATTERN) set(run_install_test_components 1) run_install_test(FILES-EXCLUDE_FROM_ALL) diff --git a/Tests/RunCMake/install/pattern/empty.c b/Tests/RunCMake/install/pattern/empty.c new file mode 100644 index 0000000..e69de29 diff --git a/Tests/RunCMake/install/pattern/empty.h b/Tests/RunCMake/install/pattern/empty.h new file mode 100644 index 0000000..e69de29 diff --git a/Tests/RunCMake/install/pattern/empty.txt b/Tests/RunCMake/install/pattern/empty.txt new file mode 100644 index 0000000..e69de29 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bce8fa229ad7ea1c05e0206ed0c5bafe5fc32e2f commit bce8fa229ad7ea1c05e0206ed0c5bafe5fc32e2f Author: Kyle Edwards AuthorDate: Thu Jul 12 09:03:06 2018 -0400 Commit: Kyle Edwards CommitDate: Tue Jul 17 09:07:01 2018 -0400 Tests: Add test for CONFIGURATIONS parameter of install() diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index 8bd3c99..31287c8 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -84,6 +84,7 @@ unset(RunCMake_TEST_OPTIONS) run_install_test(Deprecated) run_install_test(PRE_POST_INSTALL_SCRIPT) run_install_test(SCRIPT) +run_install_test(TARGETS-CONFIGURATIONS) set(run_install_test_components 1) run_install_test(FILES-EXCLUDE_FROM_ALL) diff --git a/Tests/RunCMake/install/TARGETS-CONFIGURATIONS-all-check.cmake b/Tests/RunCMake/install/TARGETS-CONFIGURATIONS-all-check.cmake new file mode 100644 index 0000000..2866e7f --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-CONFIGURATIONS-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^src;src/main-d.c$]]) diff --git a/Tests/RunCMake/install/TARGETS-CONFIGURATIONS.cmake b/Tests/RunCMake/install/TARGETS-CONFIGURATIONS.cmake new file mode 100644 index 0000000..5531cd2 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-CONFIGURATIONS.cmake @@ -0,0 +1,2 @@ +install(FILES main.c DESTINATION src CONFIGURATIONS Debug RENAME main-d.c) +install(FILES main.c DESTINATION src CONFIGURATIONS Release RENAME main-r.c) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ae1c917f1aa6e544f27c5e73ede0edb10da0c3ad commit ae1c917f1aa6e544f27c5e73ede0edb10da0c3ad Author: Kyle Edwards AuthorDate: Wed Jul 11 17:03:30 2018 -0400 Commit: Kyle Edwards CommitDate: Tue Jul 17 09:07:01 2018 -0400 Tests: Add test for install() diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index 5495d56..8bd3c99 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -83,6 +83,7 @@ unset(RunCMake_TEST_OPTIONS) run_install_test(Deprecated) run_install_test(PRE_POST_INSTALL_SCRIPT) +run_install_test(SCRIPT) set(run_install_test_components 1) run_install_test(FILES-EXCLUDE_FROM_ALL) diff --git a/Tests/RunCMake/install/SCRIPT-all-check.cmake b/Tests/RunCMake/install/SCRIPT-all-check.cmake new file mode 100644 index 0000000..48d8e1a --- /dev/null +++ b/Tests/RunCMake/install/SCRIPT-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^empty1.txt;empty2.txt$]]) diff --git a/Tests/RunCMake/install/SCRIPT.cmake b/Tests/RunCMake/install/SCRIPT.cmake new file mode 100644 index 0000000..f857b54 --- /dev/null +++ b/Tests/RunCMake/install/SCRIPT.cmake @@ -0,0 +1,4 @@ +install( + SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/install_script.cmake" + CODE "write_empty_file(empty2.txt)" + ) diff --git a/Tests/RunCMake/install/install_script.cmake b/Tests/RunCMake/install/install_script.cmake new file mode 100644 index 0000000..1f8522c --- /dev/null +++ b/Tests/RunCMake/install/install_script.cmake @@ -0,0 +1,5 @@ +function(write_empty_file FILENAME) + file(WRITE "${CMAKE_INSTALL_PREFIX}/${FILENAME}" "") +endfunction() + +write_empty_file(empty1.txt) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2c62a45a5a11c624f4b1bb882831f696c51818f1 commit 2c62a45a5a11c624f4b1bb882831f696c51818f1 Author: Kyle Edwards AuthorDate: Wed Jul 11 16:42:24 2018 -0400 Commit: Kyle Edwards CommitDate: Tue Jul 17 09:07:01 2018 -0400 Tests: Add test for _INSTALL_SCRIPT diff --git a/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT-all-check.cmake b/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT-all-check.cmake new file mode 100644 index 0000000..16ff1e1 --- /dev/null +++ b/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^bin;bin/myexe(\.exe)?;postinstall;preinstall]]) diff --git a/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT.cmake b/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT.cmake new file mode 100644 index 0000000..357c688 --- /dev/null +++ b/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT.cmake @@ -0,0 +1,7 @@ +enable_language(C) + +add_executable(myexe main.c) +set_property(TARGET myexe PROPERTY PRE_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/preinstall.cmake") +set_property(TARGET myexe PROPERTY POST_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/postinstall.cmake") + +install(TARGETS myexe DESTINATION bin) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index 574bf1a..5495d56 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -82,6 +82,7 @@ run_install_test(TARGETS-OUTPUT_NAME) unset(RunCMake_TEST_OPTIONS) run_install_test(Deprecated) +run_install_test(PRE_POST_INSTALL_SCRIPT) set(run_install_test_components 1) run_install_test(FILES-EXCLUDE_FROM_ALL) diff --git a/Tests/RunCMake/install/postinstall.cmake b/Tests/RunCMake/install/postinstall.cmake new file mode 100644 index 0000000..7607f40 --- /dev/null +++ b/Tests/RunCMake/install/postinstall.cmake @@ -0,0 +1 @@ +file(WRITE "${CMAKE_INSTALL_PREFIX}/postinstall" "postinstall") diff --git a/Tests/RunCMake/install/preinstall.cmake b/Tests/RunCMake/install/preinstall.cmake new file mode 100644 index 0000000..4b28d16 --- /dev/null +++ b/Tests/RunCMake/install/preinstall.cmake @@ -0,0 +1 @@ +file(WRITE "${CMAKE_INSTALL_PREFIX}/preinstall" "preinstall") https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=db4bc2fa1814a230a8f58293a48465cba9a22a36 commit db4bc2fa1814a230a8f58293a48465cba9a22a36 Author: Kyle Edwards AuthorDate: Wed Jul 11 16:33:12 2018 -0400 Commit: Kyle Edwards CommitDate: Tue Jul 17 09:07:01 2018 -0400 Tests: Add test for deprecated install_*() commands diff --git a/Tests/RunCMake/install/Deprecated-all-check.cmake b/Tests/RunCMake/install/Deprecated-all-check.cmake new file mode 100644 index 0000000..9ea33a6 --- /dev/null +++ b/Tests/RunCMake/install/Deprecated-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^bin;bin/myexe(\.exe)?;scripts1;scripts1/script;scripts1/script\.bat;scripts2;scripts2/script;scripts2/script\.bat;scripts3;scripts3/script;scripts3/script\.bat;src;src/empty\.c;src/obj1\.c;src/obj\2.c$]]) diff --git a/Tests/RunCMake/install/Deprecated.cmake b/Tests/RunCMake/install/Deprecated.cmake new file mode 100644 index 0000000..c435cb5 --- /dev/null +++ b/Tests/RunCMake/install/Deprecated.cmake @@ -0,0 +1,13 @@ +enable_language(C) + +add_executable(myexe main.c) + +install_files(/src FILES empty.c) +install_files(/src .c obj1) +install_files(/src "^obj2.c$") + +install_targets(/bin myexe) + +install_programs(/scripts1 FILES script script.bat) +install_programs(/scripts2 script script.bat) +install_programs(/scripts3 "^script(\.bat)?$") diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index 5a15ee8..574bf1a 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -81,6 +81,8 @@ set(RunCMake_TEST_OPTIONS "-DCMAKE_BUILD_TYPE:STRING=Debug") run_install_test(TARGETS-OUTPUT_NAME) unset(RunCMake_TEST_OPTIONS) +run_install_test(Deprecated) + set(run_install_test_components 1) run_install_test(FILES-EXCLUDE_FROM_ALL) run_install_test(TARGETS-EXCLUDE_FROM_ALL) diff --git a/Tests/RunCMake/install/script b/Tests/RunCMake/install/script new file mode 100755 index 0000000..81f9f53 --- /dev/null +++ b/Tests/RunCMake/install/script @@ -0,0 +1,2 @@ +#!/bin/sh +echo "Sample Script Output" diff --git a/Tests/RunCMake/install/script.bat b/Tests/RunCMake/install/script.bat new file mode 100755 index 0000000..a9af38c --- /dev/null +++ b/Tests/RunCMake/install/script.bat @@ -0,0 +1 @@ + at echo Sample Script Output https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ec5c838fcb04f672e3ec03547fb571d40e789fdd commit ec5c838fcb04f672e3ec03547fb571d40e789fdd Author: Kyle Edwards AuthorDate: Wed Jul 11 16:08:27 2018 -0400 Commit: Kyle Edwards CommitDate: Tue Jul 17 09:07:00 2018 -0400 Tests: Add tests for *OUTPUT_NAME properties diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index 3c99d6f..5a15ee8 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -77,6 +77,10 @@ run_install_test(TARGETS-OPTIONAL) run_install_test(FILES-OPTIONAL) run_install_test(DIRECTORY-OPTIONAL) +set(RunCMake_TEST_OPTIONS "-DCMAKE_BUILD_TYPE:STRING=Debug") +run_install_test(TARGETS-OUTPUT_NAME) +unset(RunCMake_TEST_OPTIONS) + set(run_install_test_components 1) run_install_test(FILES-EXCLUDE_FROM_ALL) run_install_test(TARGETS-EXCLUDE_FROM_ALL) diff --git a/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake new file mode 100644 index 0000000..5daecc8 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake @@ -0,0 +1,13 @@ +if(WIN32) + set(test123 [[bin/test1out\.exe;bin/test2deb\.exe;bin/test3exc\.exe]]) + set(libtest45 [[bin/libtest4\.dll;bin/libtest4\.dll\.a;bin/libtest5ar\.a]]) + set(test45 [[bin/test4\.dll;bin/test4\.lib;bin/test5ar\.lib]]) + + check_installed("^bin;(${libtest45};${test123})|(${test123};${test45})\$") +elseif(CYGWIN) + check_installed([[^bin;bin/cygtest4\.dll;bin/libtest4\.dll\.a;bin/libtest5ar\.a;bin/test1out\.exe;bin/test2deb\.exe;bin/test3exc\.exe$]]) +elseif(APPLE) + check_installed([[^bin;bin/libtest4lib\.dylib;bin/libtest5ar\.a;bin/test1out;bin/test2deb;bin/test3exc$]]) +else() + check_installed([[^bin;bin/libtest4lib\.so;bin/libtest5ar\.a;bin/test1out;bin/test2deb;bin/test3exc$]]) +endif() diff --git a/Tests/RunCMake/install/TARGETS-OUTPUT_NAME.cmake b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME.cmake new file mode 100644 index 0000000..67e7069 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME.cmake @@ -0,0 +1,27 @@ +enable_language(C) + +add_executable(test1 main.c) +set_property(TARGET test1 PROPERTY OUTPUT_NAME test1out) +set_property(TARGET test1 PROPERTY RELEASE_OUTPUT_NAME test1rel) + +add_executable(test2 main.c) +set_property(TARGET test2 PROPERTY OUTPUT_NAME test2out) +set_property(TARGET test2 PROPERTY DEBUG_OUTPUT_NAME test2deb) + +add_executable(test3 main.c) +set_property(TARGET test3 PROPERTY RUNTIME_OUTPUT_NAME test3exc) + +add_library(test4 SHARED obj1.c) +set_property(TARGET test4 PROPERTY LIBRARY_OUTPUT_NAME test4lib) + +add_library(test5 STATIC obj1.c) +set_property(TARGET test5 PROPERTY ARCHIVE_OUTPUT_NAME test5ar) + +install(TARGETS + test1 + test2 + test3 + test4 + test5 + DESTINATION bin + ) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f6c7358c2aa8d53522c6459451ab079e0d4e3b8b commit f6c7358c2aa8d53522c6459451ab079e0d4e3b8b Author: Kyle Edwards AuthorDate: Wed Jul 11 14:43:45 2018 -0400 Commit: Kyle Edwards CommitDate: Tue Jul 17 09:07:00 2018 -0400 Tests: Add test for install(DIRECTORY ... OPTIONAL) diff --git a/Tests/RunCMake/install/DIRECTORY-OPTIONAL-all-check.cmake b/Tests/RunCMake/install/DIRECTORY-OPTIONAL-all-check.cmake new file mode 100644 index 0000000..c14998e --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-OPTIONAL-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^dir;dir/empty.txt$]]) diff --git a/Tests/RunCMake/install/DIRECTORY-OPTIONAL.cmake b/Tests/RunCMake/install/DIRECTORY-OPTIONAL.cmake new file mode 100644 index 0000000..e57aab0 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-OPTIONAL.cmake @@ -0,0 +1 @@ +install(DIRECTORY dir/ noexist/ DESTINATION dir OPTIONAL) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index 02dcc7d..3c99d6f 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -75,6 +75,7 @@ endif() run_install_test(TARGETS-InstallFromSubDir) run_install_test(TARGETS-OPTIONAL) run_install_test(FILES-OPTIONAL) +run_install_test(DIRECTORY-OPTIONAL) set(run_install_test_components 1) run_install_test(FILES-EXCLUDE_FROM_ALL) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1638ffa287e5032eecb1d8eaa1051a29379f6017 commit 1638ffa287e5032eecb1d8eaa1051a29379f6017 Author: Kyle Edwards AuthorDate: Wed Jul 11 14:32:00 2018 -0400 Commit: Kyle Edwards CommitDate: Tue Jul 17 09:07:00 2018 -0400 Tests: Add tests for install( ... OPTIONAL) diff --git a/Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake b/Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake new file mode 100644 index 0000000..2997a8d --- /dev/null +++ b/Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^src;src/main.c$]]) diff --git a/Tests/RunCMake/install/FILES-OPTIONAL.cmake b/Tests/RunCMake/install/FILES-OPTIONAL.cmake new file mode 100644 index 0000000..812bf4f --- /dev/null +++ b/Tests/RunCMake/install/FILES-OPTIONAL.cmake @@ -0,0 +1 @@ +install(FILES main.c noexist.c DESTINATION src OPTIONAL) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index b1add3a..02dcc7d 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -73,6 +73,8 @@ if(NOT RunCMake_GENERATOR STREQUAL "Xcode" OR NOT "$ENV{CMAKE_OSX_ARCHITECTURES} endif() run_install_test(TARGETS-InstallFromSubDir) +run_install_test(TARGETS-OPTIONAL) +run_install_test(FILES-OPTIONAL) set(run_install_test_components 1) run_install_test(FILES-EXCLUDE_FROM_ALL) diff --git a/Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake b/Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake new file mode 100644 index 0000000..bcf71dd --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^bin;bin/myexe(\.exe)?$]]) diff --git a/Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt b/Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt new file mode 100644 index 0000000..86e3ec0 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt @@ -0,0 +1 @@ +^WARNING: Target "notall" has EXCLUDE_FROM_ALL set and will not be built by default but an install rule has been provided for it\. CMake does not define behavior for this case\.$ diff --git a/Tests/RunCMake/install/TARGETS-OPTIONAL.cmake b/Tests/RunCMake/install/TARGETS-OPTIONAL.cmake new file mode 100644 index 0000000..d3c5cda --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-OPTIONAL.cmake @@ -0,0 +1,4 @@ +enable_language(C) +add_executable(myexe main.c) +add_executable(notall EXCLUDE_FROM_ALL main.c) +install(TARGETS myexe notall DESTINATION bin OPTIONAL) ----------------------------------------------------------------------- Summary of changes: Source/cmLinkLineDeviceComputer.cxx | 22 +- Tests/CMakeLists.txt | 28 -- Tests/CudaOnly/CMakeLists.txt | 1 + Tests/CudaOnly/CircularLinkLine/CMakeLists.txt | 34 ++ Tests/CudaOnly/CircularLinkLine/file1.cu | 6 + Tests/CudaOnly/CircularLinkLine/file2.cu | 6 + Tests/CudaOnly/CircularLinkLine/file3.cu | 8 + .../main.cpp => CudaOnly/CircularLinkLine/main.cu} | 0 Tests/ExportImport/Export/CMakeLists.txt | 6 +- Tests/RunCMake/CPack/CPackTestHelpers.cmake | 30 +- .../RunCMake/CPack/RPM/default_expected_stderr.txt | 2 +- Tests/RunCMake/CPack/RunCMakeTest.cmake | 1 + .../install/DIRECTORY-OPTIONAL-all-check.cmake | 1 + Tests/RunCMake/install/DIRECTORY-OPTIONAL.cmake | 1 + .../install/DIRECTORY-PATTERN-all-check.cmake | 1 + Tests/RunCMake/install/DIRECTORY-PATTERN.cmake | 36 ++ Tests/RunCMake/install/Deprecated-all-check.cmake | 1 + Tests/RunCMake/install/Deprecated.cmake | 13 + .../install/FILES-OPTIONAL-all-check.cmake | 1 + Tests/RunCMake/install/FILES-OPTIONAL.cmake | 1 + .../install/FILES-PERMISSIONS-all-check.cmake | 1 + Tests/RunCMake/install/FILES-PERMISSIONS.cmake | 5 + .../InstallRequiredSystemLibraries-stderr.txt} | 0 .../install/InstallRequiredSystemLibraries.cmake | 10 + .../PRE_POST_INSTALL_SCRIPT-all-check.cmake | 1 + .../RunCMake/install/PRE_POST_INSTALL_SCRIPT.cmake | 7 + Tests/RunCMake/install/RunCMakeTest.cmake | 18 + .../install/SCRIPT-COMPONENT-all-check.cmake | 1 + .../install/SCRIPT-COMPONENT-dev-check.cmake | 1 + .../install/SCRIPT-COMPONENT-uns-check.cmake | 1 + Tests/RunCMake/install/SCRIPT-COMPONENT.cmake | 5 + Tests/RunCMake/install/SCRIPT-all-check.cmake | 1 + Tests/RunCMake/install/SCRIPT.cmake | 4 + .../install/TARGETS-CONFIGURATIONS-all-check.cmake | 1 + .../RunCMake/install/TARGETS-CONFIGURATIONS.cmake | 2 + .../install/TARGETS-OPTIONAL-all-check.cmake | 1 + Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt | 1 + Tests/RunCMake/install/TARGETS-OPTIONAL.cmake | 4 + .../install/TARGETS-OUTPUT_NAME-all-check.cmake | 13 + Tests/RunCMake/install/TARGETS-OUTPUT_NAME.cmake | 27 ++ .../RunCMake/install/TARGETS-Parts-all-check.cmake | 1 + Tests/RunCMake/install/TARGETS-Parts.cmake | 7 + .../RunCMake/install/TARGETS-RPATH-all-check.cmake | 14 + Tests/RunCMake/install/TARGETS-RPATH.cmake | 14 + Tests/RunCMake/install/install_script.cmake | 5 + Tests/RunCMake/install/obj1.c | 5 +- Tests/RunCMake/install/obj1.h | 6 + .../pattern}/empty.c | 0 .../install/pattern/empty.h} | 0 Tests/RunCMake/install/{dir => pattern}/empty.txt | 0 Tests/RunCMake/install/postinstall.cmake | 1 + Tests/RunCMake/install/preinstall.cmake | 1 + .../sample_script => RunCMake/install/script} | 0 .../install/script.bat} | 0 Tests/RunCMake/install/testobj1.c | 9 + Tests/SimpleInstall/CMakeLists.txt | 398 --------------------- Tests/SimpleInstall/InstallScript1.cmake | 5 - Tests/SimpleInstall/InstallScript2.cmake | 14 - Tests/SimpleInstall/InstallScript3.cmake | 12 - Tests/SimpleInstall/InstallScript4.cmake | 22 -- Tests/SimpleInstall/PackageScript.cmake | 10 - Tests/SimpleInstall/PostInstall.cmake | 6 - Tests/SimpleInstall/PreInstall.cmake | 2 - Tests/SimpleInstall/TestSubDir/CMakeLists.txt | 3 - Tests/SimpleInstall/TestSubDir/TSD.cxx | 10 - Tests/SimpleInstall/TestSubDir/TSD.h | 1 - Tests/SimpleInstall/TestSubDir/TSD_utils.cxx | 9 - Tests/SimpleInstall/foo.c | 6 - Tests/SimpleInstall/foo.h | 10 - Tests/SimpleInstall/inst.cxx | 34 -- Tests/SimpleInstall/inst2.cxx | 2 - Tests/SimpleInstall/lib1.cxx | 6 - Tests/SimpleInstall/lib1.h | 1 - Tests/SimpleInstall/lib2.cxx | 6 - Tests/SimpleInstall/lib2.h | 11 - Tests/SimpleInstall/lib3.cxx | 6 - Tests/SimpleInstall/lib3.h | 11 - Tests/SimpleInstall/lib4.cxx | 6 - Tests/SimpleInstall/lib4.h | 11 - Tests/SimpleInstall/scripts/.gitattributes | 1 - Tests/SimpleInstall/scripts/CMakeLists.txt | 1 - Tests/SimpleInstall/scripts/sample_script | 2 - Tests/SimpleInstall/scripts/sample_script.bat | 1 - Tests/SimpleInstallS2/CMakeLists.txt | 397 -------------------- Tests/SimpleInstallS2/InstallScript1.cmake | 5 - Tests/SimpleInstallS2/InstallScript2.cmake | 14 - Tests/SimpleInstallS2/InstallScript3.cmake | 12 - Tests/SimpleInstallS2/InstallScript4.cmake | 22 -- Tests/SimpleInstallS2/PackageScript.cmake | 10 - Tests/SimpleInstallS2/PostInstall.cmake | 6 - Tests/SimpleInstallS2/PreInstall.cmake | 2 - Tests/SimpleInstallS2/TestSubDir/CMakeLists.txt | 3 - Tests/SimpleInstallS2/TestSubDir/TSD.cxx | 10 - Tests/SimpleInstallS2/TestSubDir/TSD.h | 1 - Tests/SimpleInstallS2/TestSubDir/TSD_utils.cxx | 9 - Tests/SimpleInstallS2/foo.c | 6 - Tests/SimpleInstallS2/foo.h | 10 - Tests/SimpleInstallS2/inst.cxx | 34 -- Tests/SimpleInstallS2/inst2.cxx | 2 - Tests/SimpleInstallS2/lib1.cxx | 6 - Tests/SimpleInstallS2/lib1.h | 1 - Tests/SimpleInstallS2/lib2.cxx | 6 - Tests/SimpleInstallS2/lib2.h | 11 - Tests/SimpleInstallS2/lib3.cxx | 6 - Tests/SimpleInstallS2/lib3.h | 11 - Tests/SimpleInstallS2/lib4.cxx | 6 - Tests/SimpleInstallS2/lib4.h | 11 - Tests/SimpleInstallS2/scripts/.gitattributes | 1 - Tests/SimpleInstallS2/scripts/CMakeLists.txt | 1 - 109 files changed, 321 insertions(+), 1255 deletions(-) create mode 100644 Tests/CudaOnly/CircularLinkLine/CMakeLists.txt create mode 100644 Tests/CudaOnly/CircularLinkLine/file1.cu create mode 100644 Tests/CudaOnly/CircularLinkLine/file2.cu create mode 100644 Tests/CudaOnly/CircularLinkLine/file3.cu copy Tests/{RunCMake/CompatibleInterface/main.cpp => CudaOnly/CircularLinkLine/main.cu} (100%) create mode 100644 Tests/RunCMake/install/DIRECTORY-OPTIONAL-all-check.cmake create mode 100644 Tests/RunCMake/install/DIRECTORY-OPTIONAL.cmake create mode 100644 Tests/RunCMake/install/DIRECTORY-PATTERN-all-check.cmake create mode 100644 Tests/RunCMake/install/DIRECTORY-PATTERN.cmake create mode 100644 Tests/RunCMake/install/Deprecated-all-check.cmake create mode 100644 Tests/RunCMake/install/Deprecated.cmake create mode 100644 Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake create mode 100644 Tests/RunCMake/install/FILES-OPTIONAL.cmake create mode 100644 Tests/RunCMake/install/FILES-PERMISSIONS-all-check.cmake create mode 100644 Tests/RunCMake/install/FILES-PERMISSIONS.cmake copy Tests/RunCMake/{target_link_options/LINK_OPTIONS-shared-result.txt => install/InstallRequiredSystemLibraries-stderr.txt} (100%) create mode 100644 Tests/RunCMake/install/InstallRequiredSystemLibraries.cmake create mode 100644 Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT-all-check.cmake create mode 100644 Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT.cmake create mode 100644 Tests/RunCMake/install/SCRIPT-COMPONENT-all-check.cmake create mode 100644 Tests/RunCMake/install/SCRIPT-COMPONENT-dev-check.cmake create mode 100644 Tests/RunCMake/install/SCRIPT-COMPONENT-uns-check.cmake create mode 100644 Tests/RunCMake/install/SCRIPT-COMPONENT.cmake create mode 100644 Tests/RunCMake/install/SCRIPT-all-check.cmake create mode 100644 Tests/RunCMake/install/SCRIPT.cmake create mode 100644 Tests/RunCMake/install/TARGETS-CONFIGURATIONS-all-check.cmake create mode 100644 Tests/RunCMake/install/TARGETS-CONFIGURATIONS.cmake create mode 100644 Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake create mode 100644 Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt create mode 100644 Tests/RunCMake/install/TARGETS-OPTIONAL.cmake create mode 100644 Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake create mode 100644 Tests/RunCMake/install/TARGETS-OUTPUT_NAME.cmake create mode 100644 Tests/RunCMake/install/TARGETS-Parts-all-check.cmake create mode 100644 Tests/RunCMake/install/TARGETS-Parts.cmake create mode 100644 Tests/RunCMake/install/TARGETS-RPATH-all-check.cmake create mode 100644 Tests/RunCMake/install/TARGETS-RPATH.cmake create mode 100644 Tests/RunCMake/install/install_script.cmake create mode 100644 Tests/RunCMake/install/obj1.h copy Tests/RunCMake/{target_link_libraries => install/pattern}/empty.c (100%) copy Tests/{Wrapping/vtkIncluded.cxx => RunCMake/install/pattern/empty.h} (100%) copy Tests/RunCMake/install/{dir => pattern}/empty.txt (100%) create mode 100644 Tests/RunCMake/install/postinstall.cmake create mode 100644 Tests/RunCMake/install/preinstall.cmake rename Tests/{SimpleInstallS2/scripts/sample_script => RunCMake/install/script} (100%) rename Tests/{SimpleInstallS2/scripts/sample_script.bat => RunCMake/install/script.bat} (100%) create mode 100644 Tests/RunCMake/install/testobj1.c delete mode 100644 Tests/SimpleInstall/CMakeLists.txt delete mode 100644 Tests/SimpleInstall/InstallScript1.cmake delete mode 100644 Tests/SimpleInstall/InstallScript2.cmake delete mode 100644 Tests/SimpleInstall/InstallScript3.cmake delete mode 100644 Tests/SimpleInstall/InstallScript4.cmake delete mode 100644 Tests/SimpleInstall/PackageScript.cmake delete mode 100644 Tests/SimpleInstall/PostInstall.cmake delete mode 100644 Tests/SimpleInstall/PreInstall.cmake delete mode 100644 Tests/SimpleInstall/TestSubDir/CMakeLists.txt delete mode 100644 Tests/SimpleInstall/TestSubDir/TSD.cxx delete mode 100644 Tests/SimpleInstall/TestSubDir/TSD.h delete mode 100644 Tests/SimpleInstall/TestSubDir/TSD_utils.cxx delete mode 100644 Tests/SimpleInstall/foo.c delete mode 100644 Tests/SimpleInstall/foo.h delete mode 100644 Tests/SimpleInstall/inst.cxx delete mode 100644 Tests/SimpleInstall/inst2.cxx delete mode 100644 Tests/SimpleInstall/lib1.cxx delete mode 100644 Tests/SimpleInstall/lib1.h delete mode 100644 Tests/SimpleInstall/lib2.cxx delete mode 100644 Tests/SimpleInstall/lib2.h delete mode 100644 Tests/SimpleInstall/lib3.cxx delete mode 100644 Tests/SimpleInstall/lib3.h delete mode 100644 Tests/SimpleInstall/lib4.cxx delete mode 100644 Tests/SimpleInstall/lib4.h delete mode 100644 Tests/SimpleInstall/scripts/.gitattributes delete mode 100644 Tests/SimpleInstall/scripts/CMakeLists.txt delete mode 100755 Tests/SimpleInstall/scripts/sample_script delete mode 100755 Tests/SimpleInstall/scripts/sample_script.bat delete mode 100644 Tests/SimpleInstallS2/CMakeLists.txt delete mode 100644 Tests/SimpleInstallS2/InstallScript1.cmake delete mode 100644 Tests/SimpleInstallS2/InstallScript2.cmake delete mode 100644 Tests/SimpleInstallS2/InstallScript3.cmake delete mode 100644 Tests/SimpleInstallS2/InstallScript4.cmake delete mode 100644 Tests/SimpleInstallS2/PackageScript.cmake delete mode 100644 Tests/SimpleInstallS2/PostInstall.cmake delete mode 100644 Tests/SimpleInstallS2/PreInstall.cmake delete mode 100644 Tests/SimpleInstallS2/TestSubDir/CMakeLists.txt delete mode 100644 Tests/SimpleInstallS2/TestSubDir/TSD.cxx delete mode 100644 Tests/SimpleInstallS2/TestSubDir/TSD.h delete mode 100644 Tests/SimpleInstallS2/TestSubDir/TSD_utils.cxx delete mode 100644 Tests/SimpleInstallS2/foo.c delete mode 100644 Tests/SimpleInstallS2/foo.h delete mode 100644 Tests/SimpleInstallS2/inst.cxx delete mode 100644 Tests/SimpleInstallS2/inst2.cxx delete mode 100644 Tests/SimpleInstallS2/lib1.cxx delete mode 100644 Tests/SimpleInstallS2/lib1.h delete mode 100644 Tests/SimpleInstallS2/lib2.cxx delete mode 100644 Tests/SimpleInstallS2/lib2.h delete mode 100644 Tests/SimpleInstallS2/lib3.cxx delete mode 100644 Tests/SimpleInstallS2/lib3.h delete mode 100644 Tests/SimpleInstallS2/lib4.cxx delete mode 100644 Tests/SimpleInstallS2/lib4.h delete mode 100644 Tests/SimpleInstallS2/scripts/.gitattributes delete mode 100644 Tests/SimpleInstallS2/scripts/CMakeLists.txt hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jul 18 11:15:03 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 18 Jul 2018 11:15:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-256-g19fac85 Message-ID: <20180718151503.5BD27ACB68@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 19fac8572a97e20376dea8d81fae594378cf0975 (commit) via 4b35dab8916b9c88336a776eaaadd8e6746a50b6 (commit) from 11d71e6cd0eedae224eca52d4f8bc6cb6baf46d8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=19fac8572a97e20376dea8d81fae594378cf0975 commit 19fac8572a97e20376dea8d81fae594378cf0975 Merge: 11d71e6 4b35dab Author: Brad King AuthorDate: Wed Jul 18 15:09:56 2018 +0000 Commit: Kitware Robot CommitDate: Wed Jul 18 11:10:02 2018 -0400 Merge topic 'doc-regex-notes' 4b35dab891 Help: Document how escape sequences work in a regex Acked-by: Kitware Robot Merge-request: !2221 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4b35dab8916b9c88336a776eaaadd8e6746a50b6 commit 4b35dab8916b9c88336a776eaaadd8e6746a50b6 Author: Brad King AuthorDate: Wed Jul 18 10:23:26 2018 -0400 Commit: Brad King CommitDate: Wed Jul 18 10:36:00 2018 -0400 Help: Document how escape sequences work in a regex Our regex engine doesn't interpret `\`-escapes but CMake language escape sequences may be used to pass literal whitespace characters to it. diff --git a/Help/command/string.rst b/Help/command/string.rst index efa923b..29a153a 100644 --- a/Help/command/string.rst +++ b/Help/command/string.rst @@ -151,6 +151,20 @@ has lower precedence than concatenation. This means that the regular expression ``^ab+d$`` matches ``abbd`` but not ``ababd``, and the regular expression ``^(ab|cd)$`` matches ``ab`` but not ``abd``. +Backslash (``\``) characters in regular expressions are interpreted +literally and do not escape anything or represent placeholders. +However, CMake language :ref:`Escape Sequences` such as ``\t``, +``\r``, ``\n``, and ``\\`` may be used to construct literal tabs, +carriage returns, newlines, and backslashes (respectively) to pass +in a regex. For example: + +* The quoted argument ``"[ \t\r\n]"`` specifies a regex that matches + any single whitespace character. +* The quoted argument ``"[/\\]"`` specifies a regex that matches + a single forward slash ``/`` or backslash ``\``. +* The quoted argument ``"[A-Za-z0-9_]"`` specifies a regex that matches + any single "word" character in the C locale. + Manipulation ^^^^^^^^^^^^ ----------------------------------------------------------------------- Summary of changes: Help/command/string.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jul 19 00:05:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 19 Jul 2018 00:05:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-257-gcadec7d Message-ID: <20180719040504.73A2311D86E@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 cadec7db374a5dd32dd851a6085ec66fa9daa6a1 (commit) from 19fac8572a97e20376dea8d81fae594378cf0975 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cadec7db374a5dd32dd851a6085ec66fa9daa6a1 commit cadec7db374a5dd32dd851a6085ec66fa9daa6a1 Author: Kitware Robot AuthorDate: Thu Jul 19 00:01:07 2018 -0400 Commit: Kitware Robot CommitDate: Thu Jul 19 00:01:07 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 65a73ad..d9f5396 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 12) -set(CMake_VERSION_PATCH 20180718) +set(CMake_VERSION_PATCH 20180719) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jul 19 07:15:09 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 19 Jul 2018 07:15:09 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-269-g8dc8697 Message-ID: <20180719111509.692B61121C0@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 8dc86970c86ec53513a17f4cdb28f2a0be3ee505 (commit) via 16879c3960affb2fffc649003096f9c91f8396ca (commit) via af041b71f7106d4bf46d820d51a51e2490661cb6 (commit) via 018c373f35501196af8d27bdcd23488ccf8feb9d (commit) via a35eafdb22a16255a73a8a5770dbab3b55d50d0e (commit) via 8cefa2cba414de0af8fb4ba28c9781dcdad1fc7e (commit) via bec3be11b9a5764e156deaf15c3f8cc1a2121da8 (commit) via 22fbf39d9ba968a4827cb1580dbbe11e4a8a0619 (commit) via 4436be337d6a1c54df4318a037a4f2ccf2e54f9b (commit) via 59af434946950ca7206551ab8c9867af6de9e1db (commit) via ed289e05772529051361fc2ee1cbe6e47c68f2f7 (commit) via c3ea50ede143d6a29f5d92745cd3a1964581a652 (commit) from cadec7db374a5dd32dd851a6085ec66fa9daa6a1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8dc86970c86ec53513a17f4cdb28f2a0be3ee505 commit 8dc86970c86ec53513a17f4cdb28f2a0be3ee505 Merge: 16879c3 22fbf39 Author: Brad King AuthorDate: Thu Jul 19 11:10:55 2018 +0000 Commit: Kitware Robot CommitDate: Thu Jul 19 07:11:02 2018 -0400 Merge topic 'cpack_archive_typo' 22fbf39d9b CPack: Fix log typos (spaces in the wrong places) Acked-by: Kitware Robot Merge-request: !2222 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=16879c3960affb2fffc649003096f9c91f8396ca commit 16879c3960affb2fffc649003096f9c91f8396ca Merge: af041b7 8cefa2c Author: Brad King AuthorDate: Thu Jul 19 07:09:47 2018 -0400 Commit: Brad King CommitDate: Thu Jul 19 07:09:47 2018 -0400 Merge branch 'release-3.12' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=af041b71f7106d4bf46d820d51a51e2490661cb6 commit af041b71f7106d4bf46d820d51a51e2490661cb6 Merge: 018c373 bec3be1 Author: Brad King AuthorDate: Thu Jul 19 11:08:53 2018 +0000 Commit: Kitware Robot CommitDate: Thu Jul 19 07:09:03 2018 -0400 Merge topic 'tcl-8.7' bec3be11b9 FindTCL: Add support for version 8.7 Acked-by: Kitware Robot Merge-request: !2223 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=018c373f35501196af8d27bdcd23488ccf8feb9d commit 018c373f35501196af8d27bdcd23488ccf8feb9d Merge: a35eafd ed289e0 Author: Brad King AuthorDate: Thu Jul 19 11:08:19 2018 +0000 Commit: Kitware Robot CommitDate: Thu Jul 19 07:08:31 2018 -0400 Merge topic 'UseSWIG-csharp-conditional' ed289e0577 UseSWIG: Use CSharp language only if it is enabled Acked-by: Kitware Robot Acked-by: Ram-Z Acked-by: Marc Chevrier Merge-request: !2219 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a35eafdb22a16255a73a8a5770dbab3b55d50d0e commit a35eafdb22a16255a73a8a5770dbab3b55d50d0e Merge: cadec7d c3ea50e Author: Brad King AuthorDate: Thu Jul 19 11:07:22 2018 +0000 Commit: Kitware Robot CommitDate: Thu Jul 19 07:07:53 2018 -0400 Merge topic 'csharp-compiler-loaded' c3ea50ede1 CSharp: Set CMAKE_CSharp_COMPILER_LOADED variable when language is enabled Acked-by: Kitware Robot Merge-request: !2220 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=22fbf39d9ba968a4827cb1580dbbe11e4a8a0619 commit 22fbf39d9ba968a4827cb1580dbbe11e4a8a0619 Author: Sylvain Joubert AuthorDate: Wed Jul 18 17:15:52 2018 +0200 Commit: Sylvain Joubert CommitDate: Wed Jul 18 17:15:52 2018 +0200 CPack: Fix log typos (spaces in the wrong places) diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index b734bb4..593b4bf 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -106,15 +106,15 @@ int cmCPackArchiveGenerator::addOneComponentToArchive( gf.Open((filename).c_str(), false, true); \ if (!GenerateHeader(&gf)) { \ cmCPackLogger(cmCPackLog::LOG_ERROR, \ - "Problem to generate Header for archive < " \ + "Problem to generate Header for archive <" \ << (filename) << ">." << std::endl); \ return 0; \ } \ cmArchiveWrite archive(gf, this->Compress, this->ArchiveFormat); \ if (!(archive)) { \ cmCPackLogger(cmCPackLog::LOG_ERROR, \ - "Problem to create archive < " \ - << (filename) << ">. ERROR =" << (archive).GetError() \ + "Problem to create archive <" \ + << (filename) << ">, ERROR = " << (archive).GetError() \ << std::endl); \ return 0; \ } @@ -262,9 +262,9 @@ int cmCPackArchiveGenerator::PackageFiles() archive.Add(rp, 0, nullptr, false); if (!archive) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem while adding file< " + "Problem while adding file <" << file << "> to archive <" << packageFileNames[0] - << "> .ERROR =" << archive.GetError() << std::endl); + << ">, ERROR = " << archive.GetError() << std::endl); return 0; } } ----------------------------------------------------------------------- Summary of changes: Modules/CMakeCSharpCompiler.cmake.in | 1 + Modules/FindTCL.cmake | 6 ++++++ Modules/FindTclStub.cmake | 2 ++ Modules/FindTclsh.cmake | 1 + Modules/UseSWIG.cmake | 2 +- Source/CPack/cmCPackArchiveGenerator.cxx | 10 +++++----- 6 files changed, 16 insertions(+), 6 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jul 19 07:15:09 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 19 Jul 2018 07:15:09 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.12.0-6-g8cefa2c Message-ID: <20180719111509.812C51124B4@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via 8cefa2cba414de0af8fb4ba28c9781dcdad1fc7e (commit) via bec3be11b9a5764e156deaf15c3f8cc1a2121da8 (commit) via 4436be337d6a1c54df4318a037a4f2ccf2e54f9b (commit) via 59af434946950ca7206551ab8c9867af6de9e1db (commit) via ed289e05772529051361fc2ee1cbe6e47c68f2f7 (commit) via c3ea50ede143d6a29f5d92745cd3a1964581a652 (commit) from f84c15ef2fa30dd074fcccafccec6b9b69266619 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Modules/CMakeCSharpCompiler.cmake.in | 1 + Modules/FindTCL.cmake | 6 ++++++ Modules/FindTclStub.cmake | 2 ++ Modules/FindTclsh.cmake | 1 + Modules/UseSWIG.cmake | 2 +- 5 files changed, 11 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jul 20 00:05:07 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 20 Jul 2018 00:05:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-270-g56148cb Message-ID: <20180720040507.CD34A11DADF@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 56148cb98f546a3a38bb6f9b191e753f8c8dd9df (commit) from 8dc86970c86ec53513a17f4cdb28f2a0be3ee505 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=56148cb98f546a3a38bb6f9b191e753f8c8dd9df commit 56148cb98f546a3a38bb6f9b191e753f8c8dd9df Author: Kitware Robot AuthorDate: Fri Jul 20 00:01:06 2018 -0400 Commit: Kitware Robot CommitDate: Fri Jul 20 00:01:06 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d9f5396..f4e59af 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 12) -set(CMake_VERSION_PATCH 20180719) +set(CMake_VERSION_PATCH 20180720) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jul 20 07:45:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 20 Jul 2018 07:45:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-276-g01c04e4 Message-ID: <20180720114506.1C34111E2B5@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 01c04e429717fb7a6a157ce1baeb2114724ec055 (commit) via fb45559e0924467523bd372a3c037861d8b11c51 (commit) via 0bad9eba46f6899a4c59431e7136a868d0003854 (commit) via d0de296e50c08a2abc4d5d108fb3030a150f0574 (commit) via 30e27b4110072c1e3ad0492f8115a52ff33f1c37 (commit) via e3469a5920b9b4c3175a3acec179492d4387890f (commit) from 56148cb98f546a3a38bb6f9b191e753f8c8dd9df (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=01c04e429717fb7a6a157ce1baeb2114724ec055 commit 01c04e429717fb7a6a157ce1baeb2114724ec055 Merge: 56148cb fb45559 Author: Brad King AuthorDate: Fri Jul 20 11:40:27 2018 +0000 Commit: Kitware Robot CommitDate: Fri Jul 20 07:40:35 2018 -0400 Merge topic 'xcode-target-order' fb45559e09 Xcode: Process targets in depth-first order during generation 0bad9eba46 Xcode: Refactor storage of ordered list of targets d0de296e50 Xcode: Factor target generation loop body into helper method 30e27b4110 Xcode: Compute global order index for targets e3469a5920 Xcode: Remove loop over local generators that has no effect Acked-by: Kitware Robot Merge-request: !2224 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fb45559e0924467523bd372a3c037861d8b11c51 commit fb45559e0924467523bd372a3c037861d8b11c51 Author: Brad King AuthorDate: Thu Jul 19 12:47:45 2018 -0400 Commit: Brad King CommitDate: Thu Jul 19 13:40:54 2018 -0400 Xcode: Process targets in depth-first order during generation The Xcode 10 "new build system" requires more strict handling of custom commands. It may need a fix similar to what commit v3.12.0-rc1~171^2 (VS: Generate a custom command only in the least dependent target, 2018-03-23) did for VS. Prepare for this by generating targets within each local generator in dependency order. Issue: #18070 diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index df4e507..042ce41 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1083,8 +1083,12 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets( cmLocalGenerator* gen, std::vector& targets) { this->SetCurrentLocalGenerator(gen); - std::vector const& gts = + std::vector gts = this->CurrentLocalGenerator->GetGeneratorTargets(); + std::sort(gts.begin(), gts.end(), + [this](cmGeneratorTarget const* l, cmGeneratorTarget const* r) { + return this->TargetOrderIndex[l] < this->TargetOrderIndex[r]; + }); for (auto gtgt : gts) { if (!this->CreateXCodeTarget(gtgt, targets)) { return false; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0bad9eba46f6899a4c59431e7136a868d0003854 commit 0bad9eba46f6899a4c59431e7136a868d0003854 Author: Brad King AuthorDate: Thu Jul 19 11:54:10 2018 -0400 Commit: Brad King CommitDate: Thu Jul 19 13:20:28 2018 -0400 Xcode: Refactor storage of ordered list of targets Sort the resulting Xcode object list so that the actual order of generation does not matter. diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 7d07860..df4e507 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1065,15 +1065,17 @@ struct cmSourceFilePathCompare struct cmCompareTargets { - bool operator()(std::string const& a, std::string const& b) const + bool operator()(cmXCodeObject* l, cmXCodeObject* r) const { + std::string const& a = l->GetTarget()->GetName(); + std::string const& b = r->GetTarget()->GetName(); if (a == "ALL_BUILD") { return true; } if (b == "ALL_BUILD") { return false; } - return strcmp(a.c_str(), b.c_str()) < 0; + return a < b; } }; @@ -1081,18 +1083,14 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets( cmLocalGenerator* gen, std::vector& targets) { this->SetCurrentLocalGenerator(gen); - typedef std::map - cmSortedTargets; - cmSortedTargets sortedTargets; - for (auto tgt : this->CurrentLocalGenerator->GetGeneratorTargets()) { - sortedTargets[tgt->GetName()] = tgt; - } - for (auto& sortedTarget : sortedTargets) { - cmGeneratorTarget* gtgt = sortedTarget.second; + std::vector const& gts = + this->CurrentLocalGenerator->GetGeneratorTargets(); + for (auto gtgt : gts) { if (!this->CreateXCodeTarget(gtgt, targets)) { return false; } } + std::sort(targets.begin(), targets.end(), cmCompareTargets()); return true; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d0de296e50c08a2abc4d5d108fb3030a150f0574 commit d0de296e50c08a2abc4d5d108fb3030a150f0574 Author: Brad King AuthorDate: Thu Jul 19 11:51:43 2018 -0400 Commit: Brad King CommitDate: Thu Jul 19 13:20:28 2018 -0400 Xcode: Factor target generation loop body into helper method diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 0c59374..7d07860 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1089,266 +1089,271 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets( } for (auto& sortedTarget : sortedTargets) { cmGeneratorTarget* gtgt = sortedTarget.second; - - std::string targetName = gtgt->GetName(); - - // make sure ALL_BUILD, INSTALL, etc are only done once - if (this->SpecialTargetEmitted(targetName)) { - continue; + if (!this->CreateXCodeTarget(gtgt, targets)) { + return false; } + } + return true; +} - if (gtgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) { - continue; - } +bool cmGlobalXCodeGenerator::CreateXCodeTarget( + cmGeneratorTarget* gtgt, std::vector& targets) +{ + std::string targetName = gtgt->GetName(); - if (gtgt->GetType() == cmStateEnums::UTILITY || - gtgt->GetType() == cmStateEnums::GLOBAL_TARGET) { - cmXCodeObject* t = this->CreateUtilityTarget(gtgt); - if (!t) { - return false; - } - targets.push_back(t); - continue; - } + // make sure ALL_BUILD, INSTALL, etc are only done once + if (this->SpecialTargetEmitted(targetName)) { + return true; + } + + if (gtgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) { + return true; + } - // organize the sources - std::vector classes; - if (!gtgt->GetConfigCommonSourceFiles(classes)) { + if (gtgt->GetType() == cmStateEnums::UTILITY || + gtgt->GetType() == cmStateEnums::GLOBAL_TARGET) { + cmXCodeObject* t = this->CreateUtilityTarget(gtgt); + if (!t) { return false; } + targets.push_back(t); + return true; + } - // Add CMakeLists.txt file for user convenience. - this->AddXCodeProjBuildRule(gtgt, classes); + // organize the sources + std::vector classes; + if (!gtgt->GetConfigCommonSourceFiles(classes)) { + return false; + } - std::sort(classes.begin(), classes.end(), cmSourceFilePathCompare()); + // Add CMakeLists.txt file for user convenience. + this->AddXCodeProjBuildRule(gtgt, classes); - gtgt->ComputeObjectMapping(); + std::sort(classes.begin(), classes.end(), cmSourceFilePathCompare()); - std::vector externalObjFiles; - std::vector headerFiles; - std::vector resourceFiles; - std::vector sourceFiles; - for (auto sourceFile : classes) { - cmXCodeObject* xsf = this->CreateXCodeSourceFile( - this->CurrentLocalGenerator, sourceFile, gtgt); - cmXCodeObject* fr = xsf->GetObject("fileRef"); - cmXCodeObject* filetype = fr->GetObject()->GetObject("explicitFileType"); + gtgt->ComputeObjectMapping(); - cmGeneratorTarget::SourceFileFlags tsFlags = - gtgt->GetTargetSourceFileFlags(sourceFile); + std::vector externalObjFiles; + std::vector headerFiles; + std::vector resourceFiles; + std::vector sourceFiles; + for (auto sourceFile : classes) { + cmXCodeObject* xsf = this->CreateXCodeSourceFile( + this->CurrentLocalGenerator, sourceFile, gtgt); + cmXCodeObject* fr = xsf->GetObject("fileRef"); + cmXCodeObject* filetype = fr->GetObject()->GetObject("explicitFileType"); - if (filetype && filetype->GetString() == "compiled.mach-o.objfile") { - if (sourceFile->GetObjectLibrary().empty()) { - externalObjFiles.push_back(xsf); - } - } else if (this->IsHeaderFile(sourceFile) || - (tsFlags.Type == - cmGeneratorTarget::SourceFileTypePrivateHeader) || - (tsFlags.Type == - cmGeneratorTarget::SourceFileTypePublicHeader)) { - headerFiles.push_back(xsf); - } else if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeResource) { - resourceFiles.push_back(xsf); - } else if (!sourceFile->GetPropertyAsBool("HEADER_FILE_ONLY")) { - // Include this file in the build if it has a known language - // and has not been listed as an ignored extension for this - // generator. - if (!this->CurrentLocalGenerator->GetSourceFileLanguage(*sourceFile) - .empty() && - !this->IgnoreFile(sourceFile->GetExtension().c_str())) { - sourceFiles.push_back(xsf); - } - } - } + cmGeneratorTarget::SourceFileFlags tsFlags = + gtgt->GetTargetSourceFileFlags(sourceFile); - if (this->XcodeVersion < 50) { - // Add object library contents as external objects. (Equivalent to - // the externalObjFiles above, except each one is not a cmSourceFile - // within the target.) - std::vector objs; - gtgt->GetExternalObjects(objs, ""); - for (auto sourceFile : objs) { - if (sourceFile->GetObjectLibrary().empty()) { - continue; - } - std::string const& obj = sourceFile->GetFullPath(); - cmXCodeObject* xsf = - this->CreateXCodeSourceFileFromPath(obj, gtgt, "", nullptr); + if (filetype && filetype->GetString() == "compiled.mach-o.objfile") { + if (sourceFile->GetObjectLibrary().empty()) { externalObjFiles.push_back(xsf); } - } - - // some build phases only apply to bundles and/or frameworks - bool isFrameworkTarget = gtgt->IsFrameworkOnApple(); - bool isBundleTarget = gtgt->GetPropertyAsBool("MACOSX_BUNDLE"); - bool isCFBundleTarget = gtgt->IsCFBundleOnApple(); - - cmXCodeObject* buildFiles = nullptr; - - // create source build phase - cmXCodeObject* sourceBuildPhase = nullptr; - if (!sourceFiles.empty()) { - sourceBuildPhase = - this->CreateObject(cmXCodeObject::PBXSourcesBuildPhase); - sourceBuildPhase->SetComment("Sources"); - sourceBuildPhase->AddAttribute("buildActionMask", - this->CreateString("2147483647")); - buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); - for (auto& sourceFile : sourceFiles) { - buildFiles->AddObject(sourceFile); + } else if (this->IsHeaderFile(sourceFile) || + (tsFlags.Type == + cmGeneratorTarget::SourceFileTypePrivateHeader) || + (tsFlags.Type == + cmGeneratorTarget::SourceFileTypePublicHeader)) { + headerFiles.push_back(xsf); + } else if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeResource) { + resourceFiles.push_back(xsf); + } else if (!sourceFile->GetPropertyAsBool("HEADER_FILE_ONLY")) { + // Include this file in the build if it has a known language + // and has not been listed as an ignored extension for this + // generator. + if (!this->CurrentLocalGenerator->GetSourceFileLanguage(*sourceFile) + .empty() && + !this->IgnoreFile(sourceFile->GetExtension().c_str())) { + sourceFiles.push_back(xsf); } - sourceBuildPhase->AddAttribute("files", buildFiles); - sourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", - this->CreateString("0")); } + } - // create header build phase - only for framework targets - cmXCodeObject* headerBuildPhase = nullptr; - if (!headerFiles.empty() && isFrameworkTarget) { - headerBuildPhase = - this->CreateObject(cmXCodeObject::PBXHeadersBuildPhase); - headerBuildPhase->SetComment("Headers"); - headerBuildPhase->AddAttribute("buildActionMask", - this->CreateString("2147483647")); - buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); - for (auto& headerFile : headerFiles) { - buildFiles->AddObject(headerFile); + if (this->XcodeVersion < 50) { + // Add object library contents as external objects. (Equivalent to + // the externalObjFiles above, except each one is not a cmSourceFile + // within the target.) + std::vector objs; + gtgt->GetExternalObjects(objs, ""); + for (auto sourceFile : objs) { + if (sourceFile->GetObjectLibrary().empty()) { + continue; } - headerBuildPhase->AddAttribute("files", buildFiles); - headerBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", - this->CreateString("0")); + std::string const& obj = sourceFile->GetFullPath(); + cmXCodeObject* xsf = + this->CreateXCodeSourceFileFromPath(obj, gtgt, "", nullptr); + externalObjFiles.push_back(xsf); + } + } + + // some build phases only apply to bundles and/or frameworks + bool isFrameworkTarget = gtgt->IsFrameworkOnApple(); + bool isBundleTarget = gtgt->GetPropertyAsBool("MACOSX_BUNDLE"); + bool isCFBundleTarget = gtgt->IsCFBundleOnApple(); + + cmXCodeObject* buildFiles = nullptr; + + // create source build phase + cmXCodeObject* sourceBuildPhase = nullptr; + if (!sourceFiles.empty()) { + sourceBuildPhase = this->CreateObject(cmXCodeObject::PBXSourcesBuildPhase); + sourceBuildPhase->SetComment("Sources"); + sourceBuildPhase->AddAttribute("buildActionMask", + this->CreateString("2147483647")); + buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); + for (auto& sourceFile : sourceFiles) { + buildFiles->AddObject(sourceFile); + } + sourceBuildPhase->AddAttribute("files", buildFiles); + sourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + this->CreateString("0")); + } + + // create header build phase - only for framework targets + cmXCodeObject* headerBuildPhase = nullptr; + if (!headerFiles.empty() && isFrameworkTarget) { + headerBuildPhase = this->CreateObject(cmXCodeObject::PBXHeadersBuildPhase); + headerBuildPhase->SetComment("Headers"); + headerBuildPhase->AddAttribute("buildActionMask", + this->CreateString("2147483647")); + buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); + for (auto& headerFile : headerFiles) { + buildFiles->AddObject(headerFile); + } + headerBuildPhase->AddAttribute("files", buildFiles); + headerBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + this->CreateString("0")); + } + + // create resource build phase - only for framework or bundle targets + cmXCodeObject* resourceBuildPhase = nullptr; + if (!resourceFiles.empty() && + (isFrameworkTarget || isBundleTarget || isCFBundleTarget)) { + resourceBuildPhase = + this->CreateObject(cmXCodeObject::PBXResourcesBuildPhase); + resourceBuildPhase->SetComment("Resources"); + resourceBuildPhase->AddAttribute("buildActionMask", + this->CreateString("2147483647")); + buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); + for (auto& resourceFile : resourceFiles) { + buildFiles->AddObject(resourceFile); } + resourceBuildPhase->AddAttribute("files", buildFiles); + resourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + this->CreateString("0")); + } - // create resource build phase - only for framework or bundle targets - cmXCodeObject* resourceBuildPhase = nullptr; - if (!resourceFiles.empty() && - (isFrameworkTarget || isBundleTarget || isCFBundleTarget)) { - resourceBuildPhase = - this->CreateObject(cmXCodeObject::PBXResourcesBuildPhase); - resourceBuildPhase->SetComment("Resources"); - resourceBuildPhase->AddAttribute("buildActionMask", - this->CreateString("2147483647")); - buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); - for (auto& resourceFile : resourceFiles) { - buildFiles->AddObject(resourceFile); - } - resourceBuildPhase->AddAttribute("files", buildFiles); - resourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", - this->CreateString("0")); - } - - // create vector of "non-resource content file" build phases - only for - // framework or bundle targets - std::vector contentBuildPhases; - if (isFrameworkTarget || isBundleTarget || isCFBundleTarget) { - typedef std::map> - mapOfVectorOfSourceFiles; - mapOfVectorOfSourceFiles bundleFiles; - for (auto sourceFile : classes) { - cmGeneratorTarget::SourceFileFlags tsFlags = - gtgt->GetTargetSourceFileFlags(sourceFile); - if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeMacContent) { - bundleFiles[tsFlags.MacFolder].push_back(sourceFile); - } + // create vector of "non-resource content file" build phases - only for + // framework or bundle targets + std::vector contentBuildPhases; + if (isFrameworkTarget || isBundleTarget || isCFBundleTarget) { + typedef std::map> + mapOfVectorOfSourceFiles; + mapOfVectorOfSourceFiles bundleFiles; + for (auto sourceFile : classes) { + cmGeneratorTarget::SourceFileFlags tsFlags = + gtgt->GetTargetSourceFileFlags(sourceFile); + if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeMacContent) { + bundleFiles[tsFlags.MacFolder].push_back(sourceFile); } - for (auto keySources : bundleFiles) { - cmXCodeObject* copyFilesBuildPhase = - this->CreateObject(cmXCodeObject::PBXCopyFilesBuildPhase); - copyFilesBuildPhase->SetComment("Copy files"); - copyFilesBuildPhase->AddAttribute("buildActionMask", - this->CreateString("2147483647")); - copyFilesBuildPhase->AddAttribute("dstSubfolderSpec", - this->CreateString("6")); - std::ostringstream ostr; - if (gtgt->IsFrameworkOnApple()) { - // dstPath in frameworks is relative to Versions/ + } + for (auto keySources : bundleFiles) { + cmXCodeObject* copyFilesBuildPhase = + this->CreateObject(cmXCodeObject::PBXCopyFilesBuildPhase); + copyFilesBuildPhase->SetComment("Copy files"); + copyFilesBuildPhase->AddAttribute("buildActionMask", + this->CreateString("2147483647")); + copyFilesBuildPhase->AddAttribute("dstSubfolderSpec", + this->CreateString("6")); + std::ostringstream ostr; + if (gtgt->IsFrameworkOnApple()) { + // dstPath in frameworks is relative to Versions/ + ostr << keySources.first; + } else if (keySources.first != "MacOS") { + if (gtgt->Target->GetMakefile()->PlatformIsAppleEmbedded()) { ostr << keySources.first; - } else if (keySources.first != "MacOS") { - if (gtgt->Target->GetMakefile()->PlatformIsAppleEmbedded()) { - ostr << keySources.first; - } else { - // dstPath in bundles is relative to Contents/MacOS - ostr << "../" << keySources.first; - } - } - copyFilesBuildPhase->AddAttribute("dstPath", - this->CreateString(ostr.str())); - copyFilesBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", - this->CreateString("0")); - buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); - copyFilesBuildPhase->AddAttribute("files", buildFiles); - for (auto sourceFile : keySources.second) { - cmXCodeObject* xsf = this->CreateXCodeSourceFile( - this->CurrentLocalGenerator, sourceFile, gtgt); - buildFiles->AddObject(xsf); + } else { + // dstPath in bundles is relative to Contents/MacOS + ostr << "../" << keySources.first; } - contentBuildPhases.push_back(copyFilesBuildPhase); } + copyFilesBuildPhase->AddAttribute("dstPath", + this->CreateString(ostr.str())); + copyFilesBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + this->CreateString("0")); + buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); + copyFilesBuildPhase->AddAttribute("files", buildFiles); + for (auto sourceFile : keySources.second) { + cmXCodeObject* xsf = this->CreateXCodeSourceFile( + this->CurrentLocalGenerator, sourceFile, gtgt); + buildFiles->AddObject(xsf); + } + contentBuildPhases.push_back(copyFilesBuildPhase); } + } - // create vector of "resource content file" build phases - only for - // framework or bundle targets - if (isFrameworkTarget || isBundleTarget || isCFBundleTarget) { - typedef std::map> - mapOfVectorOfSourceFiles; - mapOfVectorOfSourceFiles bundleFiles; - for (auto sourceFile : classes) { - cmGeneratorTarget::SourceFileFlags tsFlags = - gtgt->GetTargetSourceFileFlags(sourceFile); - if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeDeepResource) { - bundleFiles[tsFlags.MacFolder].push_back(sourceFile); - } - } - for (auto keySources : bundleFiles) { - cmXCodeObject* copyFilesBuildPhase = - this->CreateObject(cmXCodeObject::PBXCopyFilesBuildPhase); - copyFilesBuildPhase->SetComment("Copy files"); - copyFilesBuildPhase->AddAttribute("buildActionMask", - this->CreateString("2147483647")); - copyFilesBuildPhase->AddAttribute("dstSubfolderSpec", - this->CreateString("7")); - copyFilesBuildPhase->AddAttribute( - "dstPath", this->CreateString(keySources.first)); - copyFilesBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", - this->CreateString("0")); - buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); - copyFilesBuildPhase->AddAttribute("files", buildFiles); - for (auto sourceFile : keySources.second) { - cmXCodeObject* xsf = this->CreateXCodeSourceFile( - this->CurrentLocalGenerator, sourceFile, gtgt); - buildFiles->AddObject(xsf); - } - contentBuildPhases.push_back(copyFilesBuildPhase); + // create vector of "resource content file" build phases - only for + // framework or bundle targets + if (isFrameworkTarget || isBundleTarget || isCFBundleTarget) { + typedef std::map> + mapOfVectorOfSourceFiles; + mapOfVectorOfSourceFiles bundleFiles; + for (auto sourceFile : classes) { + cmGeneratorTarget::SourceFileFlags tsFlags = + gtgt->GetTargetSourceFileFlags(sourceFile); + if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeDeepResource) { + bundleFiles[tsFlags.MacFolder].push_back(sourceFile); } } - - // create framework build phase - cmXCodeObject* frameworkBuildPhase = nullptr; - if (!externalObjFiles.empty()) { - frameworkBuildPhase = - this->CreateObject(cmXCodeObject::PBXFrameworksBuildPhase); - frameworkBuildPhase->SetComment("Frameworks"); - frameworkBuildPhase->AddAttribute("buildActionMask", + for (auto keySources : bundleFiles) { + cmXCodeObject* copyFilesBuildPhase = + this->CreateObject(cmXCodeObject::PBXCopyFilesBuildPhase); + copyFilesBuildPhase->SetComment("Copy files"); + copyFilesBuildPhase->AddAttribute("buildActionMask", this->CreateString("2147483647")); + copyFilesBuildPhase->AddAttribute("dstSubfolderSpec", + this->CreateString("7")); + copyFilesBuildPhase->AddAttribute("dstPath", + this->CreateString(keySources.first)); + copyFilesBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + this->CreateString("0")); buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); - frameworkBuildPhase->AddAttribute("files", buildFiles); - for (auto& externalObjFile : externalObjFiles) { - buildFiles->AddObject(externalObjFile); + copyFilesBuildPhase->AddAttribute("files", buildFiles); + for (auto sourceFile : keySources.second) { + cmXCodeObject* xsf = this->CreateXCodeSourceFile( + this->CurrentLocalGenerator, sourceFile, gtgt); + buildFiles->AddObject(xsf); } - frameworkBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", - this->CreateString("0")); + contentBuildPhases.push_back(copyFilesBuildPhase); + } + } + + // create framework build phase + cmXCodeObject* frameworkBuildPhase = nullptr; + if (!externalObjFiles.empty()) { + frameworkBuildPhase = + this->CreateObject(cmXCodeObject::PBXFrameworksBuildPhase); + frameworkBuildPhase->SetComment("Frameworks"); + frameworkBuildPhase->AddAttribute("buildActionMask", + this->CreateString("2147483647")); + buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); + frameworkBuildPhase->AddAttribute("files", buildFiles); + for (auto& externalObjFile : externalObjFiles) { + buildFiles->AddObject(externalObjFile); } + frameworkBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + this->CreateString("0")); + } - // create list of build phases and create the Xcode target - cmXCodeObject* buildPhases = - this->CreateObject(cmXCodeObject::OBJECT_LIST); + // create list of build phases and create the Xcode target + cmXCodeObject* buildPhases = this->CreateObject(cmXCodeObject::OBJECT_LIST); - this->CreateCustomCommands(buildPhases, sourceBuildPhase, headerBuildPhase, - resourceBuildPhase, contentBuildPhases, - frameworkBuildPhase, gtgt); + this->CreateCustomCommands(buildPhases, sourceBuildPhase, headerBuildPhase, + resourceBuildPhase, contentBuildPhases, + frameworkBuildPhase, gtgt); - targets.push_back(this->CreateXCodeTarget(gtgt, buildPhases)); - } + targets.push_back(this->CreateXCodeTarget(gtgt, buildPhases)); return true; } diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 54e19d8..f7bca13 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -206,6 +206,8 @@ private: void AddXCodeProjBuildRule(cmGeneratorTarget* target, std::vector& sources) const; bool CreateXCodeTargets(cmLocalGenerator* gen, std::vector&); + bool CreateXCodeTarget(cmGeneratorTarget* gtgt, + std::vector&); bool IsHeaderFile(cmSourceFile*); void AddDependTarget(cmXCodeObject* target, cmXCodeObject* dependTarget); void CreateXCodeDependHackTarget(std::vector& targets); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=30e27b4110072c1e3ad0492f8115a52ff33f1c37 commit 30e27b4110072c1e3ad0492f8115a52ff33f1c37 Author: Brad King AuthorDate: Thu Jul 19 07:54:29 2018 -0400 Commit: Brad King CommitDate: Thu Jul 19 13:20:28 2018 -0400 Xcode: Compute global order index for targets Compute an index for each target in a global ordering such that no target comes before its dependencies. diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index ca73552..0c59374 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -386,12 +386,46 @@ void cmGlobalXCodeGenerator::AddExtraIDETargets() } } +void cmGlobalXCodeGenerator::ComputeTargetOrder() +{ + size_t index = 0; + auto const& lgens = this->GetLocalGenerators(); + for (cmLocalGenerator* lgen : lgens) { + auto const& targets = lgen->GetGeneratorTargets(); + for (cmGeneratorTarget const* gt : targets) { + this->ComputeTargetOrder(gt, index); + } + } + assert(index == this->TargetOrderIndex.size()); +} + +void cmGlobalXCodeGenerator::ComputeTargetOrder(cmGeneratorTarget const* gt, + size_t& index) +{ + std::map::value_type value(gt, 0); + auto insertion = this->TargetOrderIndex.insert(value); + if (!insertion.second) { + return; + } + auto entry = insertion.first; + + auto& deps = this->GetTargetDirectDepends(gt); + for (auto& d : deps) { + this->ComputeTargetOrder(d, index); + } + + entry->second = index++; +} + void cmGlobalXCodeGenerator::Generate() { this->cmGlobalGenerator::Generate(); if (cmSystemTools::GetErrorOccuredFlag()) { return; } + + this->ComputeTargetOrder(); + for (auto keyVal : this->ProjectMap) { cmLocalGenerator* root = keyVal.second[0]; diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index ccef6e2..54e19d8 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -109,6 +109,8 @@ public: protected: void AddExtraIDETargets() override; + void ComputeTargetOrder(); + void ComputeTargetOrder(cmGeneratorTarget const* gt, size_t& index); void Generate() override; private: @@ -286,6 +288,7 @@ private: std::string ObjectDirArchDefault; std::string ObjectDirArch; std::string GeneratorToolset; + std::map TargetOrderIndex; }; #endif https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e3469a5920b9b4c3175a3acec179492d4387890f commit e3469a5920b9b4c3175a3acec179492d4387890f Author: Brad King AuthorDate: Thu Jul 19 07:25:07 2018 -0400 Commit: Brad King CommitDate: Thu Jul 19 13:20:27 2018 -0400 Xcode: Remove loop over local generators that has no effect Remove a loop over local generators whose body was dropped long ago by commit v2.6.0~1677 (Remove unused build rules from Xcode, 2007-05-28). diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 02297d5..ca73552 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3319,13 +3319,6 @@ void cmGlobalXCodeGenerator::OutputXCodeProject( if (generators.empty()) { return; } - // Skip local generators that are excluded from this project. - for (auto generator : generators) { - if (this->IsExcluded(root, generator)) { - continue; - } - } - if (!this->CreateXCodeObjects(root, generators)) { return; } ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalXCodeGenerator.cxx | 514 ++++++++++++++++++++------------------ Source/cmGlobalXCodeGenerator.h | 5 + 2 files changed, 279 insertions(+), 240 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jul 20 19:05:08 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 20 Jul 2018 19:05:08 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-278-ge3664de Message-ID: <20180720230508.83F0B118A3F@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 e3664debd2d950de1b0d0a0c673ada05ae9a700d (commit) via 492ade276b9a54ad61ba5eed4eea77897fdb74c1 (commit) from 01c04e429717fb7a6a157ce1baeb2114724ec055 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e3664debd2d950de1b0d0a0c673ada05ae9a700d commit e3664debd2d950de1b0d0a0c673ada05ae9a700d Merge: 01c04e4 492ade2 Author: Craig Scott AuthorDate: Fri Jul 20 22:58:14 2018 +0000 Commit: Kitware Robot CommitDate: Fri Jul 20 18:58:43 2018 -0400 Merge topic 'doc-find_package-root' 492ade276b Help: Add explicit _ROOT variable documentation Acked-by: Kitware Robot Merge-request: !2225 diff --cc Source/cmPolicies.h index d0d9307,1ef1813..d6f7c54 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@@ -219,16 -219,11 +219,16 @@@ class cmMakefile SELECT(POLICY, CMP0073, \ "Do not produce legacy _LIB_DEPENDS cache entries.", 3, 12, 0, \ cmPolicies::WARN) \ - SELECT(POLICY, CMP0074, "find_package uses PackageName_ROOT variables.", 3, \ - 12, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0074, "find_package uses _ROOT variables.", \ + 3, 12, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0075, \ "Include file check macros honor CMAKE_REQUIRED_LIBRARIES.", 3, 12, \ - 0, cmPolicies::WARN) + 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0076, \ + "target_sources() command converts relative paths to absolute.", 3, \ + 13, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0077, "option() honors normal variables.", 3, 13, 0, \ + cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=492ade276b9a54ad61ba5eed4eea77897fdb74c1 commit 492ade276b9a54ad61ba5eed4eea77897fdb74c1 Author: Brad King AuthorDate: Thu Jul 19 14:19:42 2018 -0400 Commit: Brad King CommitDate: Fri Jul 20 09:43:08 2018 -0400 Help: Add explicit _ROOT variable documentation Add documentation for both the CMake variable and environment variable of this name pattern. Update references to these names to link to their documents. Clarify the pattern used to construct their names. diff --git a/Help/command/FIND_XXX.txt b/Help/command/FIND_XXX.txt index 48a1a71..38c231a 100644 --- a/Help/command/FIND_XXX.txt +++ b/Help/command/FIND_XXX.txt @@ -62,8 +62,11 @@ added to the search. If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows: .. |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX_SUBDIR| replace:: - |prefix_XXX_SUBDIR| for each ```` in ``PackageName_ROOT`` if called - from within a find module + |prefix_XXX_SUBDIR| for each ```` in the + :variable:`_ROOT` CMake variable and the + :envvar:`_ROOT` environment variable if + called from within a find module loaded by + :command:`find_package()` .. |CMAKE_PREFIX_PATH_XXX_SUBDIR| replace:: |prefix_XXX_SUBDIR| for each ```` in :variable:`CMAKE_PREFIX_PATH` @@ -76,13 +79,16 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows: |prefix_XXX_SUBDIR| for each ```` in :variable:`CMAKE_SYSTEM_PREFIX_PATH` -1. If called from within a find module, search prefix paths unique to the - current package being found. Specifically look in the ``PackageName_ROOT`` - CMake and environment variables. The package root variables are maintained - as a stack so if called from nested find modules, root paths from the - parent's find module will be searched after paths from the current module, - i.e. ``CurrentPackage_ROOT``, ``ENV{CurrentPackage_ROOT}``, - ``ParentPackage_ROOT``, ``ENV{ParentPackage_ROOT}``, etc. +1. If called from within a find module loaded by + :command:`find_package()`, search prefixes unique to the + current package being found. Specifically look in the + :variable:`_ROOT` CMake variable and the + :envvar:`_ROOT` environment variable. + The package root variables are maintained as a stack so if called from + nested find modules, root paths from the parent's find module will be + searched after paths from the current module, + i.e. ``_ROOT``, ``ENV{_ROOT}``, + ``_ROOT``, ``ENV{_ROOT}``, etc. This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed. See policy :policy:`CMP0074`. diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst index 53f3819..a4416ab 100644 --- a/Help/command/find_package.rst +++ b/Help/command/find_package.rst @@ -262,8 +262,10 @@ The set of installation prefixes is constructed using the following steps. If ``NO_DEFAULT_PATH`` is specified all ``NO_*`` options are enabled. -1. Search paths specified in the ``PackageName_ROOT`` CMake and environment - variables. The package root variables are maintained as a stack so if +1. Search paths specified in the :variable:`_ROOT` CMake + variable and the :envvar:`_ROOT` environment variable, + where ```` is the package to be found. + The package root variables are maintained as a stack so if called from within a find module, root paths from the parent's find module will also be searched after paths for the current package. This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed. diff --git a/Help/envvar/PackageName_ROOT.rst b/Help/envvar/PackageName_ROOT.rst new file mode 100644 index 0000000..e01009b --- /dev/null +++ b/Help/envvar/PackageName_ROOT.rst @@ -0,0 +1,15 @@ +_ROOT +------------------ + +Calls to :command:`find_package()` will search in prefixes +specified by the ``_ROOT`` environment variable, where +```` is the name given to the ``find_package`` call +and ``_ROOT`` is literal. For example, ``find_package(Foo)`` will search +prefixes specified in the ``Foo_ROOT`` environment variable (if set). +See policy :policy:`CMP0074`. + +This variable may hold a single prefix or a list of prefixes separated +by ``:`` on UNIX or ``;`` on Windows (the same as the ``PATH`` environment +variable convention on those platforms). + +See also the :variable:`_ROOT` CMake variable. diff --git a/Help/manual/cmake-env-variables.7.rst b/Help/manual/cmake-env-variables.7.rst index 2d17bb5..42aeabc 100644 --- a/Help/manual/cmake-env-variables.7.rst +++ b/Help/manual/cmake-env-variables.7.rst @@ -20,6 +20,7 @@ Environment Variables that Control the Build /envvar/DESTDIR /envvar/LDFLAGS /envvar/MACOSX_DEPLOYMENT_TARGET + /envvar/PackageName_ROOT Environment Variables for Languages =================================== diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index edfff6c..f6bf0bd 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -204,6 +204,7 @@ Variables that Change Behavior /variable/CMAKE_WARN_DEPRECATED /variable/CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION /variable/CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY + /variable/PackageName_ROOT Variables that Describe the System ================================== diff --git a/Help/policy/CMP0074.rst b/Help/policy/CMP0074.rst index ffac4a7..896936b 100644 --- a/Help/policy/CMP0074.rst +++ b/Help/policy/CMP0074.rst @@ -1,18 +1,19 @@ CMP0074 ------- -:command:`find_package` uses ``PackageName_ROOT`` variables. +:command:`find_package` uses ``_ROOT`` variables. -In CMake 3.12 and above the ``find_package(PackageName)`` command now searches -a prefix specified by a ``PackageName_ROOT`` CMake or environment variable. +In CMake 3.12 and above the :command:`find_package()` command now +searches prefixes specified by the :variable:`_ROOT` CMake +variable and the :envvar:`_ROOT` environment variable. Package roots are maintained as a stack so nested calls to all ``find_*`` commands inside find modules also search the roots as prefixes. This policy provides compatibility with projects that have not been updated to avoid using -``PackageName_ROOT`` variables for other purposes. +``_ROOT`` variables for other purposes. -The ``OLD`` behavior for this policy is to ignore ``PackageName_ROOT`` -variables. The ``NEW`` behavior for this policy is to use ``PackageName_ROOT`` -variables. +The ``OLD`` behavior for this policy is to ignore ``_ROOT`` +variables. The ``NEW`` behavior for this policy is to use +``_ROOT`` variables. This policy was introduced in CMake version 3.12. CMake version |release| warns when the policy is not set and uses ``OLD`` behavior. diff --git a/Help/release/3.12.rst b/Help/release/3.12.rst index f6fdb5a..f00be3e 100644 --- a/Help/release/3.12.rst +++ b/Help/release/3.12.rst @@ -46,8 +46,9 @@ Commands were added to expose ``TOUCH`` functionality without having to use CMake's command-line tool mode with :command:`execute_process`. -* The :command:`find_package` command now searches a prefix specified by - a ``PackageName_ROOT`` CMake or environment variable. Package roots are +* The :command:`find_package` command now searches prefixes specified by + the :variable:`_ROOT` CMake variable and the + :envvar:`_ROOT` environment variable. Package roots are maintained as a stack so nested calls to all ``find_*`` commands inside find modules also search the roots as prefixes. See policy :policy:`CMP0074`. diff --git a/Help/variable/PackageName_ROOT.rst b/Help/variable/PackageName_ROOT.rst new file mode 100644 index 0000000..4f6c25b --- /dev/null +++ b/Help/variable/PackageName_ROOT.rst @@ -0,0 +1,14 @@ +_ROOT +------------------ + +Calls to :command:`find_package()` will search in prefixes +specified by the ``_ROOT`` CMake variable, where +```` is the name given to the ``find_package`` call +and ``_ROOT`` is literal. For example, ``find_package(Foo)`` will search +prefixes specified in the ``Foo_ROOT`` CMake variable (if set). +See policy :policy:`CMP0074`. + +This variable may hold a single prefix or a +:ref:`;-list ` of multiple prefixes. + +See also the :envvar:`_ROOT` environment variable. diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 3fe0c84..1ef1813 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -219,8 +219,8 @@ class cmMakefile; SELECT(POLICY, CMP0073, \ "Do not produce legacy _LIB_DEPENDS cache entries.", 3, 12, 0, \ cmPolicies::WARN) \ - SELECT(POLICY, CMP0074, "find_package uses PackageName_ROOT variables.", 3, \ - 12, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0074, "find_package uses _ROOT variables.", \ + 3, 12, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0075, \ "Include file check macros honor CMAKE_REQUIRED_LIBRARIES.", 3, 12, \ 0, cmPolicies::WARN) diff --git a/Tests/RunCMake/find_package/CMP0074-WARN-stderr.txt b/Tests/RunCMake/find_package/CMP0074-WARN-stderr.txt index 27fbb86..fc08163 100644 --- a/Tests/RunCMake/find_package/CMP0074-WARN-stderr.txt +++ b/Tests/RunCMake/find_package/CMP0074-WARN-stderr.txt @@ -3,7 +3,7 @@ Foo_ROOT :/foo/cmake_root ENV{Foo_ROOT} :/foo/env_root + CMake Warning \(dev\) at CMP0074-common.cmake:[0-9]+ \(find_package\): - Policy CMP0074 is not set: find_package uses PackageName_ROOT variables. + Policy CMP0074 is not set: find_package uses _ROOT variables. Run "cmake --help-policy CMP0074" for policy details. Use the cmake_policy command to set the policy and suppress this warning. ----------------------------------------------------------------------- Summary of changes: Help/command/FIND_XXX.txt | 24 ++++++++++++++-------- Help/command/find_package.rst | 6 ++++-- Help/envvar/PackageName_ROOT.rst | 15 ++++++++++++++ Help/manual/cmake-env-variables.7.rst | 1 + Help/manual/cmake-variables.7.rst | 1 + Help/policy/CMP0074.rst | 15 +++++++------- Help/release/3.12.rst | 5 +++-- Help/variable/PackageName_ROOT.rst | 14 +++++++++++++ Source/cmPolicies.h | 4 ++-- .../RunCMake/find_package/CMP0074-WARN-stderr.txt | 2 +- 10 files changed, 64 insertions(+), 23 deletions(-) create mode 100644 Help/envvar/PackageName_ROOT.rst create mode 100644 Help/variable/PackageName_ROOT.rst hooks/post-receive -- CMake From kwrobot at kitware.com Sat Jul 21 00:05:14 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 21 Jul 2018 00:05:14 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-279-g71e0961 Message-ID: <20180721040514.6FFE511E2C7@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 71e0961a747e3918d762c29febe43deaf009090f (commit) from e3664debd2d950de1b0d0a0c673ada05ae9a700d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=71e0961a747e3918d762c29febe43deaf009090f commit 71e0961a747e3918d762c29febe43deaf009090f Author: Kitware Robot AuthorDate: Sat Jul 21 00:01:12 2018 -0400 Commit: Kitware Robot CommitDate: Sat Jul 21 00:01:12 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index f4e59af..44086ba 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 12) -set(CMake_VERSION_PATCH 20180720) +set(CMake_VERSION_PATCH 20180721) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sun Jul 22 00:05:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 22 Jul 2018 00:05:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-280-gc2d22dc Message-ID: <20180722040505.3DB8D11D86E@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 c2d22dc4b44c8a5115fbe6797bb44ae478971601 (commit) from 71e0961a747e3918d762c29febe43deaf009090f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c2d22dc4b44c8a5115fbe6797bb44ae478971601 commit c2d22dc4b44c8a5115fbe6797bb44ae478971601 Author: Kitware Robot AuthorDate: Sun Jul 22 00:01:05 2018 -0400 Commit: Kitware Robot CommitDate: Sun Jul 22 00:01:05 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 44086ba..4530d23 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 12) -set(CMake_VERSION_PATCH 20180721) +set(CMake_VERSION_PATCH 20180722) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jul 23 00:05:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 23 Jul 2018 00:05:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-281-g234cb4c Message-ID: <20180723040505.9E6D811D9A5@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 234cb4cebe775843bef6b8991384b601d2870490 (commit) from c2d22dc4b44c8a5115fbe6797bb44ae478971601 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=234cb4cebe775843bef6b8991384b601d2870490 commit 234cb4cebe775843bef6b8991384b601d2870490 Author: Kitware Robot AuthorDate: Mon Jul 23 00:01:06 2018 -0400 Commit: Kitware Robot CommitDate: Mon Jul 23 00:01:06 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4530d23..b6b5056 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 12) -set(CMake_VERSION_PATCH 20180722) +set(CMake_VERSION_PATCH 20180723) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jul 23 10:45:07 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 23 Jul 2018 10:45:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-283-g33dec05 Message-ID: <20180723144508.5AD4011143D@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 33dec05375558e99a6e2947e036f84a7a6315781 (commit) via f4781762363c0ae09705aae4ef5ff33df8bc4fb5 (commit) from 234cb4cebe775843bef6b8991384b601d2870490 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=33dec05375558e99a6e2947e036f84a7a6315781 commit 33dec05375558e99a6e2947e036f84a7a6315781 Merge: 234cb4c f478176 Author: Brad King AuthorDate: Mon Jul 23 10:42:03 2018 -0400 Commit: Brad King CommitDate: Mon Jul 23 10:42:03 2018 -0400 Merge branch 'release-3.12' ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jul 23 10:45:08 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 23 Jul 2018 10:45:08 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.12.0-8-gf478176 Message-ID: <20180723144508.B8779110790@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via f4781762363c0ae09705aae4ef5ff33df8bc4fb5 (commit) via 492ade276b9a54ad61ba5eed4eea77897fdb74c1 (commit) from 8cefa2cba414de0af8fb4ba28c9781dcdad1fc7e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Help/command/FIND_XXX.txt | 24 ++++++++++++++-------- Help/command/find_package.rst | 6 ++++-- Help/envvar/PackageName_ROOT.rst | 15 ++++++++++++++ Help/manual/cmake-env-variables.7.rst | 1 + Help/manual/cmake-variables.7.rst | 1 + Help/policy/CMP0074.rst | 15 +++++++------- Help/release/3.12.rst | 5 +++-- Help/variable/PackageName_ROOT.rst | 14 +++++++++++++ Source/cmPolicies.h | 4 ++-- .../RunCMake/find_package/CMP0074-WARN-stderr.txt | 2 +- 10 files changed, 64 insertions(+), 23 deletions(-) create mode 100644 Help/envvar/PackageName_ROOT.rst create mode 100644 Help/variable/PackageName_ROOT.rst hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jul 23 11:05:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 23 Jul 2018 11:05:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-285-g21835a2 Message-ID: <20180723150505.79AAC113905@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 21835a2cea52d5518762bab87d466387b8fb936b (commit) via 22554c3166aaf7feaebf02b0ddc1204f13b22e3c (commit) from 33dec05375558e99a6e2947e036f84a7a6315781 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=21835a2cea52d5518762bab87d466387b8fb936b commit 21835a2cea52d5518762bab87d466387b8fb936b Merge: 33dec05 22554c3 Author: Brad King AuthorDate: Mon Jul 23 15:02:42 2018 +0000 Commit: Kitware Robot CommitDate: Mon Jul 23 11:02:57 2018 -0400 Merge topic 'BundleUtilities-otool-l-error' 22554c3166 BundleUtilities: message(FATAL_ERROR) on otool -l error Acked-by: Kitware Robot Merge-request: !2227 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=22554c3166aaf7feaebf02b0ddc1204f13b22e3c commit 22554c3166aaf7feaebf02b0ddc1204f13b22e3c Author: Harry Mallon AuthorDate: Fri Jul 20 12:06:04 2018 +0100 Commit: Harry Mallon CommitDate: Fri Jul 20 12:06:04 2018 +0100 BundleUtilities: message(FATAL_ERROR) on otool -l error diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index 121a8f0..4727f03 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -421,7 +421,12 @@ function(get_item_rpaths item rpaths_var) execute_process( COMMAND "${otool_cmd}" -l "${item}" OUTPUT_VARIABLE load_cmds_ov + RESULT_VARIABLE otool_rv + ERROR_VARIABLE otool_ev ) + if(NOT otool_rv STREQUAL "0") + message(FATAL_ERROR "otool -l failed: ${otool_rv}\n${otool_ev}") + endif() string(REGEX REPLACE "[^\n]+cmd LC_RPATH\n[^\n]+\n[^\n]+path ([^\n]+) \\(offset[^\n]+\n" "rpath \\1\n" load_cmds_ov "${load_cmds_ov}") string(REGEX MATCHALL "rpath [^\n]+" load_cmds_ov "${load_cmds_ov}") string(REGEX REPLACE "rpath " "" load_cmds_ov "${load_cmds_ov}") ----------------------------------------------------------------------- Summary of changes: Modules/BundleUtilities.cmake | 5 +++++ 1 file changed, 5 insertions(+) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jul 23 11:15:10 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 23 Jul 2018 11:15:10 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-287-g949c621 Message-ID: <20180723151512.1B90D103367@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 949c62175ed726cc434bb069a15c7e772c0b0fab (commit) via 7aa26cf0e9319be3f7785763eb3699823453eb60 (commit) from 21835a2cea52d5518762bab87d466387b8fb936b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=949c62175ed726cc434bb069a15c7e772c0b0fab commit 949c62175ed726cc434bb069a15c7e772c0b0fab Merge: 21835a2 7aa26cf Author: Brad King AuthorDate: Mon Jul 23 15:06:13 2018 +0000 Commit: Kitware Robot CommitDate: Mon Jul 23 11:06:23 2018 -0400 Merge topic 'FindPkgConfig-global-target' 7aa26cf0e9 FindPkgConfig: allow to create global imported targets Acked-by: Kitware Robot Merge-request: !2193 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7aa26cf0e9319be3f7785763eb3699823453eb60 commit 7aa26cf0e9319be3f7785763eb3699823453eb60 Author: Rolf Eike Beer AuthorDate: Thu Jul 5 18:20:26 2018 +0200 Commit: Rolf Eike Beer CommitDate: Sun Jul 22 13:33:04 2018 +0200 FindPkgConfig: allow to create global imported targets diff --git a/Help/release/dev/pkgc-global.rst b/Help/release/dev/pkgc-global.rst new file mode 100644 index 0000000..0c07d9e --- /dev/null +++ b/Help/release/dev/pkgc-global.rst @@ -0,0 +1,5 @@ +pkgc-global +----------- + +* Module ``FindPkgConfig`` gains capability to create imported targets in + global scope. diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index 775a9d7..3934867 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -114,12 +114,13 @@ macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp) endmacro() # Splits given arguments into options and a package list -macro(_pkgconfig_parse_options _result _is_req _is_silent _no_cmake_path _no_cmake_environment_path _imp_target) +macro(_pkgconfig_parse_options _result _is_req _is_silent _no_cmake_path _no_cmake_environment_path _imp_target _imp_target_global) set(${_is_req} 0) set(${_is_silent} 0) set(${_no_cmake_path} 0) set(${_no_cmake_environment_path} 0) set(${_imp_target} 0) + set(${_imp_target_global} 0) if(DEFINED PKG_CONFIG_USE_CMAKE_PREFIX_PATH) if(NOT PKG_CONFIG_USE_CMAKE_PREFIX_PATH) set(${_no_cmake_path} 1) @@ -146,14 +147,22 @@ macro(_pkgconfig_parse_options _result _is_req _is_silent _no_cmake_path _no_cma if (_pkg STREQUAL "IMPORTED_TARGET") set(${_imp_target} 1) endif() + if (_pkg STREQUAL "GLOBAL") + set(${_imp_target_global} 1) + endif() endforeach() + if (${_imp_target_global} AND NOT ${_imp_target}) + message(SEND_ERROR "the argument GLOBAL may only be used together with IMPORTED_TARGET") + endif() + set(${_result} ${ARGN}) list(REMOVE_ITEM ${_result} "REQUIRED") list(REMOVE_ITEM ${_result} "QUIET") list(REMOVE_ITEM ${_result} "NO_CMAKE_PATH") list(REMOVE_ITEM ${_result} "NO_CMAKE_ENVIRONMENT_PATH") list(REMOVE_ITEM ${_result} "IMPORTED_TARGET") + list(REMOVE_ITEM ${_result} "GLOBAL") endmacro() # Add the content of a variable or an environment variable to a list of @@ -225,11 +234,16 @@ function(_pkg_find_libs _prefix _no_cmake_path _no_cmake_environment_path) endfunction() # create an imported target from all the information returned by pkg-config -function(_pkg_create_imp_target _prefix) +function(_pkg_create_imp_target _prefix _imp_target_global) # only create the target if it is linkable, i.e. no executables if (NOT TARGET PkgConfig::${_prefix} AND ( ${_prefix}_INCLUDE_DIRS OR ${_prefix}_LINK_LIBRARIES OR ${_prefix}_CFLAGS_OTHER )) - add_library(PkgConfig::${_prefix} INTERFACE IMPORTED) + if(${_imp_target_global}) + set(_global_opt "GLOBAL") + else() + unset(_global_opt) + endif() + add_library(PkgConfig::${_prefix} INTERFACE IMPORTED ${_global_opt}) if(${_prefix}_INCLUDE_DIRS) set_property(TARGET PkgConfig::${_prefix} PROPERTY @@ -248,15 +262,15 @@ endfunction() # recalculate the dynamic output # this is a macro and not a function so the result of _pkg_find_libs is automatically propagated -macro(_pkg_recalculate _prefix _no_cmake_path _no_cmake_environment_path _imp_target) +macro(_pkg_recalculate _prefix _no_cmake_path _no_cmake_environment_path _imp_target _imp_target_global) _pkg_find_libs(${_prefix} ${_no_cmake_path} ${_no_cmake_environment_path}) if(${_imp_target}) - _pkg_create_imp_target(${_prefix}) + _pkg_create_imp_target(${_prefix} ${_imp_target_global}) endif() endmacro() ### -macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cmake_environment_path _imp_target _prefix) +macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cmake_environment_path _imp_target _imp_target_global _prefix) _pkgconfig_unset(${_prefix}_FOUND) _pkgconfig_unset(${_prefix}_VERSION) _pkgconfig_unset(${_prefix}_PREFIX) @@ -474,7 +488,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags ) _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other ) - _pkg_recalculate("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target}) + _pkg_recalculate("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target} ${_imp_target_global}) endif() if(NOT "${_extra_paths}" STREQUAL "") @@ -502,7 +516,7 @@ endmacro() [REQUIRED] [QUIET] [NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH] - [IMPORTED_TARGET] + [IMPORTED_TARGET [GLOBAL]] [...]) When the ``REQUIRED`` argument is given, the command will fail with an error @@ -521,7 +535,8 @@ endmacro() The ``IMPORTED_TARGET`` argument will create an imported target named ``PkgConfig::`` that can be passed directly as an argument to - :command:`target_link_libraries`. + :command:`target_link_libraries`. The ``GLOBAL`` argument will make the + imported target available in global scope. Each ```` must be in one of the following formats:: @@ -594,12 +609,12 @@ endmacro() XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp #]========================================] macro(pkg_check_modules _prefix _module0) - _pkgconfig_parse_options(_pkg_modules _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path _imp_target "${_module0}" ${ARGN}) + _pkgconfig_parse_options(_pkg_modules _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path _imp_target _imp_target_global "${_module0}" ${ARGN}) # check cached value if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND OR (NOT "${ARGN}" STREQUAL "" AND NOT "${__pkg_config_arguments_${_prefix}}" STREQUAL "${_module0};${ARGN}") OR ( "${ARGN}" STREQUAL "" AND NOT "${__pkg_config_arguments_${_prefix}}" STREQUAL "${_module0}")) - _pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target} "${_prefix}" ${_pkg_modules}) + _pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target} ${_imp_target_global} "${_prefix}" ${_pkg_modules}) _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION}) if (${_prefix}_FOUND) @@ -607,7 +622,7 @@ macro(pkg_check_modules _prefix _module0) endif() else() if (${_prefix}_FOUND) - _pkg_recalculate("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target}) + _pkg_recalculate("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target} ${_imp_target_global}) endif() endif() endmacro() @@ -624,7 +639,7 @@ endmacro() [REQUIRED] [QUIET] [NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH] - [IMPORTED_TARGET] + [IMPORTED_TARGET [GLOBAL]] [...]) Examples @@ -634,7 +649,7 @@ endmacro() pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2) #]========================================] macro(pkg_search_module _prefix _module0) - _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path _imp_target "${_module0}" ${ARGN}) + _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path _imp_target _imp_target_global "${_module0}" ${ARGN}) # check cached value if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) set(_pkg_modules_found 0) @@ -646,7 +661,7 @@ macro(pkg_search_module _prefix _module0) # iterate through all modules and stop at the first working one. foreach(_pkg_alt ${_pkg_modules_alt}) if(NOT _pkg_modules_found) - _pkg_check_modules_internal(0 1 ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target} "${_prefix}" "${_pkg_alt}") + _pkg_check_modules_internal(0 1 ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target} ${_imp_target_global} "${_prefix}" "${_pkg_alt}") endif() if (${_prefix}_FOUND) @@ -662,7 +677,7 @@ macro(pkg_search_module _prefix _module0) _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION}) elseif (${_prefix}_FOUND) - _pkg_recalculate("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target}) + _pkg_recalculate("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target} ${_imp_target_global}) endif() endmacro() diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake index 1150568..24e7202 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake @@ -1,10 +1,12 @@ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.12) project(FindPkgConfig_IMPORTED_TARGET C) find_package(PkgConfig REQUIRED) pkg_check_modules(NCURSES IMPORTED_TARGET QUIET ncurses) +message(STATUS "source: ${CMAKE_CURRENT_SOURCE_DIR} bin ${CMAKE_CURRENT_BINARY_DIR}") + if (NCURSES_FOUND) set(tgt PkgConfig::NCURSES) if (NOT TARGET ${tgt}) @@ -66,6 +68,16 @@ if (NOT TARGET PkgConfig::FakePackage1) message(FATAL_ERROR "No import target for fake package 1 with prefix path") endif() +# find targets in subdir and check their visibility +add_subdirectory(target_subdir) +if (TARGET PkgConfig::FakePackage1_dir) + message(FATAL_ERROR "imported target PkgConfig::FakePackage1_dir is visible outside it's directory") +endif() + +if (NOT TARGET PkgConfig::FakePackage1_global) + message(FATAL_ERROR "imported target PkgConfig::FakePackage1_global is not visible outside it's directory") +endif() + # And now do the same for the NO_CMAKE_ENVIRONMENT_PATH - ENV{CMAKE_PREFIX_PATH} # combination unset(CMAKE_PREFIX_PATH) diff --git a/Tests/RunCMake/FindPkgConfig/target_subdir/CMakeLists.txt b/Tests/RunCMake/FindPkgConfig/target_subdir/CMakeLists.txt new file mode 100644 index 0000000..2171ef6 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/target_subdir/CMakeLists.txt @@ -0,0 +1,5 @@ +# a target with visibility only in this directory +pkg_check_modules(FakePackage1_dir REQUIRED QUIET IMPORTED_TARGET cmakeinternalfakepackage1) + +# the same with global visibility +pkg_check_modules(FakePackage1_global REQUIRED QUIET IMPORTED_TARGET GLOBAL cmakeinternalfakepackage1) ----------------------------------------------------------------------- Summary of changes: Help/release/dev/pkgc-global.rst | 5 +++ Modules/FindPkgConfig.cmake | 47 ++++++++++++++-------- .../FindPkgConfig_IMPORTED_TARGET.cmake | 14 ++++++- .../FindPkgConfig/target_subdir/CMakeLists.txt | 5 +++ 4 files changed, 54 insertions(+), 17 deletions(-) create mode 100644 Help/release/dev/pkgc-global.rst create mode 100644 Tests/RunCMake/FindPkgConfig/target_subdir/CMakeLists.txt hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jul 24 00:05:08 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 24 Jul 2018 00:05:08 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-288-g5df471c Message-ID: <20180724040508.A2BB611E22F@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 5df471c8a4001482cc0cad05deed73e57870aecb (commit) from 949c62175ed726cc434bb069a15c7e772c0b0fab (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5df471c8a4001482cc0cad05deed73e57870aecb commit 5df471c8a4001482cc0cad05deed73e57870aecb Author: Kitware Robot AuthorDate: Tue Jul 24 00:01:12 2018 -0400 Commit: Kitware Robot CommitDate: Tue Jul 24 00:01:12 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b6b5056..46e9fb9 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 12) -set(CMake_VERSION_PATCH 20180723) +set(CMake_VERSION_PATCH 20180724) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jul 24 11:05:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 24 Jul 2018 11:05:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-292-g4a749b2 Message-ID: <20180724150506.9C436113A0E@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 4a749b245929a65847413aed7ade80d4e5e24e5b (commit) via 07e223ad376170418efdd7fe3a6d61cd1905410f (commit) via b5061e02f86e8d003d2f8c59d7fac22207dcd860 (commit) via 50921cc04e1ae761a188d4df0cc3025719ace11c (commit) from 5df471c8a4001482cc0cad05deed73e57870aecb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4a749b245929a65847413aed7ade80d4e5e24e5b commit 4a749b245929a65847413aed7ade80d4e5e24e5b Merge: 07e223a b5061e0 Author: Brad King AuthorDate: Tue Jul 24 10:59:00 2018 -0400 Commit: Brad King CommitDate: Tue Jul 24 10:59:00 2018 -0400 Merge branch 'release-3.12' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=07e223ad376170418efdd7fe3a6d61cd1905410f commit 07e223ad376170418efdd7fe3a6d61cd1905410f Merge: 5df471c 50921cc Author: Brad King AuthorDate: Tue Jul 24 14:58:32 2018 +0000 Commit: Kitware Robot CommitDate: Tue Jul 24 10:58:42 2018 -0400 Merge topic 'FindPython-fix-multiple-calls' 50921cc04e FindPython*: fix erroneous behavior on multiple 'find_package' calls Acked-by: Kitware Robot Merge-request: !2228 ----------------------------------------------------------------------- Summary of changes: Modules/FindPython/Support.cmake | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jul 24 11:05:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 24 Jul 2018 11:05:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.12.0-10-gb5061e0 Message-ID: <20180724150506.AB3DB113A4E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via b5061e02f86e8d003d2f8c59d7fac22207dcd860 (commit) via 50921cc04e1ae761a188d4df0cc3025719ace11c (commit) from f4781762363c0ae09705aae4ef5ff33df8bc4fb5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Modules/FindPython/Support.cmake | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jul 25 00:05:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 25 Jul 2018 00:05:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-293-g873f40e Message-ID: <20180725040505.A77EB11DC38@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 873f40ecec50fbe6c8e98a0764c02a423dbfa05b (commit) from 4a749b245929a65847413aed7ade80d4e5e24e5b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=873f40ecec50fbe6c8e98a0764c02a423dbfa05b commit 873f40ecec50fbe6c8e98a0764c02a423dbfa05b Author: Kitware Robot AuthorDate: Wed Jul 25 00:01:10 2018 -0400 Commit: Kitware Robot CommitDate: Wed Jul 25 00:01:10 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 46e9fb9..5649c0b 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 12) -set(CMake_VERSION_PATCH 20180724) +set(CMake_VERSION_PATCH 20180725) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jul 25 08:25:09 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 25 Jul 2018 08:25:09 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-296-gae2b12a Message-ID: <20180725122509.3E28811DD34@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 ae2b12a95c346d710459657c3cce967bd590f678 (commit) via 6646771b0f4f6ec71a5717a68f74c987eb399b4e (commit) via 08eb157c032487b2793e625c554caae33267116d (commit) from 873f40ecec50fbe6c8e98a0764c02a423dbfa05b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ae2b12a95c346d710459657c3cce967bd590f678 commit ae2b12a95c346d710459657c3cce967bd590f678 Merge: 873f40e 6646771 Author: Craig Scott AuthorDate: Wed Jul 25 12:14:53 2018 +0000 Commit: Kitware Robot CommitDate: Wed Jul 25 08:15:02 2018 -0400 Merge topic 'project-injected-no-cmp0048' 6646771b0f project: Do not issue CMP0048 warnings on injected call 08eb157c03 Tests: Add case showing CMP0048 warning on injected project command Acked-by: Kitware Robot Merge-request: !2235 diff --cc Tests/RunCMake/CMakeLists.txt index 97c3178,637c5c2..c030cda --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@@ -238,10 -238,9 +238,11 @@@ add_RunCMake_test(include add_RunCMake_test(include_directories) add_RunCMake_test(include_guard) add_RunCMake_test(list) +add_RunCMake_test(math) add_RunCMake_test(message) +add_RunCMake_test(option) add_RunCMake_test(project -DCMake_TEST_RESOURCES=${CMake_TEST_RESOURCES}) + add_RunCMake_test(project_injected) add_RunCMake_test(return) add_RunCMake_test(separate_arguments) add_RunCMake_test(set_property) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6646771b0f4f6ec71a5717a68f74c987eb399b4e commit 6646771b0f4f6ec71a5717a68f74c987eb399b4e Author: Brad King AuthorDate: Tue Jul 24 13:10:14 2018 -0400 Commit: Brad King CommitDate: Tue Jul 24 13:14:10 2018 -0400 project: Do not issue CMP0048 warnings on injected call Fixes: #18202 diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 3c7a4cf..af97f80 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1511,6 +1511,8 @@ void cmMakefile::Configure() project.Name.Lower = "project"; project.Arguments.emplace_back("Project", cmListFileArgument::Unquoted, 0); + project.Arguments.emplace_back("__CMAKE_INJECTED_PROJECT_COMMAND__", + cmListFileArgument::Unquoted, 0); listFile.Functions.insert(listFile.Functions.begin(), project); } } diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index a25bd6b..ee44007 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -69,6 +69,7 @@ bool cmProjectCommand::InitialPass(std::vector const& args, bool haveLanguages = false; bool haveDescription = false; bool haveHomepage = false; + bool injectedProjectCommand = false; std::string version; std::string description; std::string homepage; @@ -160,6 +161,8 @@ bool cmProjectCommand::InitialPass(std::vector const& args, "by a value that expanded to nothing."); resetReporter(); }; + } else if (i == 1 && args[i] == "__CMAKE_INJECTED_PROJECT_COMMAND__") { + injectedProjectCommand = true; } else if (doing == DoingVersion) { doing = DoingLanguages; version = args[i]; @@ -280,8 +283,10 @@ bool cmProjectCommand::InitialPass(std::vector const& args, const char* v = this->Makefile->GetDefinition(i); if (v && *v) { if (cmp0048 == cmPolicies::WARN) { - vw += "\n "; - vw += i; + if (!injectedProjectCommand) { + vw += "\n "; + vw += i; + } } else { this->Makefile->AddDefinition(i, ""); } diff --git a/Tests/RunCMake/project_injected/CMP0048-WARN-stderr.txt b/Tests/RunCMake/project_injected/CMP0048-WARN-stderr.txt deleted file mode 100644 index aafa733..0000000 --- a/Tests/RunCMake/project_injected/CMP0048-WARN-stderr.txt +++ /dev/null @@ -1,12 +0,0 @@ -^CMake Warning \(dev\) in CMakeLists.txt: - Policy CMP0048 is not set: project\(\) command manages VERSION variables. - Run "cmake --help-policy CMP0048" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. - - The following variable\(s\) would be set to empty: - - CMAKE_PROJECT_VERSION - CMAKE_PROJECT_VERSION_MAJOR - CMAKE_PROJECT_VERSION_MINOR - CMAKE_PROJECT_VERSION_PATCH -This warning is for project developers. Use -Wno-dev to suppress it.$ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=08eb157c032487b2793e625c554caae33267116d commit 08eb157c032487b2793e625c554caae33267116d Author: Brad King AuthorDate: Tue Jul 24 13:05:22 2018 -0400 Commit: Brad King CommitDate: Tue Jul 24 13:14:09 2018 -0400 Tests: Add case showing CMP0048 warning on injected project command Issue: #18202 diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index bb46144..637c5c2 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -240,6 +240,7 @@ add_RunCMake_test(include_guard) add_RunCMake_test(list) add_RunCMake_test(message) add_RunCMake_test(project -DCMake_TEST_RESOURCES=${CMake_TEST_RESOURCES}) +add_RunCMake_test(project_injected) add_RunCMake_test(return) add_RunCMake_test(separate_arguments) add_RunCMake_test(set_property) diff --git a/Tests/RunCMake/project_injected/CMP0048-WARN-stderr.txt b/Tests/RunCMake/project_injected/CMP0048-WARN-stderr.txt new file mode 100644 index 0000000..aafa733 --- /dev/null +++ b/Tests/RunCMake/project_injected/CMP0048-WARN-stderr.txt @@ -0,0 +1,12 @@ +^CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0048 is not set: project\(\) command manages VERSION variables. + Run "cmake --help-policy CMP0048" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + The following variable\(s\) would be set to empty: + + CMAKE_PROJECT_VERSION + CMAKE_PROJECT_VERSION_MAJOR + CMAKE_PROJECT_VERSION_MINOR + CMAKE_PROJECT_VERSION_PATCH +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/project_injected/CMP0048-WARN.cmake b/Tests/RunCMake/project_injected/CMP0048-WARN.cmake new file mode 100644 index 0000000..e69de29 diff --git a/Tests/RunCMake/project_injected/CMakeLists.txt b/Tests/RunCMake/project_injected/CMakeLists.txt new file mode 100644 index 0000000..1b4931b --- /dev/null +++ b/Tests/RunCMake/project_injected/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12.2) # old enough to not set CMP0048 +# no project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/project_injected/RunCMakeTest.cmake b/Tests/RunCMake/project_injected/RunCMakeTest.cmake new file mode 100644 index 0000000..ba1a003 --- /dev/null +++ b/Tests/RunCMake/project_injected/RunCMakeTest.cmake @@ -0,0 +1,12 @@ +include(RunCMake) + +set(RunCMake_TEST_OPTIONS + # Simulate a previous CMake run that used `project(... VERSION ...)` + # in a non-injected call site. + -DCMAKE_PROJECT_VERSION:STATIC=1.2.3 + -DCMAKE_PROJECT_VERSION_MAJOR:STATIC=1 + -DCMAKE_PROJECT_VERSION_MINOR:STATIC=2 + -DCMAKE_PROJECT_VERSION_PATCH:STATIC=3 + ) +run_cmake(CMP0048-WARN) +unset(RunCMake_TEST_OPTIONS) ----------------------------------------------------------------------- Summary of changes: Source/cmMakefile.cxx | 2 ++ Source/cmProjectCommand.cxx | 9 +++++++-- Tests/RunCMake/CMakeLists.txt | 1 + .../project_injected/CMP0048-WARN.cmake} | 0 Tests/RunCMake/project_injected/CMakeLists.txt | 3 +++ Tests/RunCMake/project_injected/RunCMakeTest.cmake | 12 ++++++++++++ 6 files changed, 25 insertions(+), 2 deletions(-) copy Tests/{Wrapping/vtkIncluded.cxx => RunCMake/project_injected/CMP0048-WARN.cmake} (100%) create mode 100644 Tests/RunCMake/project_injected/CMakeLists.txt create mode 100644 Tests/RunCMake/project_injected/RunCMakeTest.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jul 25 08:35:02 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 25 Jul 2018 08:35:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-298-g3ab6f05 Message-ID: <20180725123502.3CD2711E062@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 3ab6f056dc8765c98e62a04a16fa24f23f201b7a (commit) via 504129889335fc7680a7894bc85eaf60bffc880c (commit) from ae2b12a95c346d710459657c3cce967bd590f678 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3ab6f056dc8765c98e62a04a16fa24f23f201b7a commit 3ab6f056dc8765c98e62a04a16fa24f23f201b7a Merge: ae2b12a 5041298 Author: Craig Scott AuthorDate: Wed Jul 25 22:25:11 2018 +1000 Commit: Craig Scott CommitDate: Wed Jul 25 22:25:11 2018 +1000 Merge branch 'release-3.12' ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jul 25 08:35:02 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 25 Jul 2018 08:35:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.12.0-13-g5041298 Message-ID: <20180725123502.83F1811DF26@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via 504129889335fc7680a7894bc85eaf60bffc880c (commit) via 6646771b0f4f6ec71a5717a68f74c987eb399b4e (commit) via 08eb157c032487b2793e625c554caae33267116d (commit) from b5061e02f86e8d003d2f8c59d7fac22207dcd860 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/cmMakefile.cxx | 2 ++ Source/cmProjectCommand.cxx | 9 +++++++-- Tests/RunCMake/CMakeLists.txt | 1 + .../project_injected/CMP0048-WARN.cmake} | 0 Tests/RunCMake/project_injected/CMakeLists.txt | 3 +++ Tests/RunCMake/project_injected/RunCMakeTest.cmake | 12 ++++++++++++ 6 files changed, 25 insertions(+), 2 deletions(-) copy Tests/{Wrapping/vtkIncluded.cxx => RunCMake/project_injected/CMP0048-WARN.cmake} (100%) create mode 100644 Tests/RunCMake/project_injected/CMakeLists.txt create mode 100644 Tests/RunCMake/project_injected/RunCMakeTest.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jul 25 10:25:03 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 25 Jul 2018 10:25:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-300-g946318a Message-ID: <20180725142503.6B564111251@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 946318a1ef16d1b69c388500638783b370590212 (commit) via dce77d9ad99f5f57f22cb9e259e685c12ca0281f (commit) from 3ab6f056dc8765c98e62a04a16fa24f23f201b7a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=946318a1ef16d1b69c388500638783b370590212 commit 946318a1ef16d1b69c388500638783b370590212 Merge: 3ab6f05 dce77d9 Author: Brad King AuthorDate: Wed Jul 25 14:24:04 2018 +0000 Commit: Kitware Robot CommitDate: Wed Jul 25 10:24:10 2018 -0400 Merge topic 'GetPrerequisites-dylibsframeworks' dce77d9ad9 GetPrerequisites: Move dylibs from MacOS to Frameworks folder in bundle Acked-by: Kitware Robot Merge-request: !2229 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dce77d9ad99f5f57f22cb9e259e685c12ca0281f commit dce77d9ad99f5f57f22cb9e259e685c12ca0281f Author: Harry Mallon AuthorDate: Sun Jul 22 12:05:14 2018 +0100 Commit: Brad King CommitDate: Tue Jul 24 14:07:22 2018 -0400 GetPrerequisites: Move dylibs from MacOS to Frameworks folder in bundle Fixes: #16828 diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index d397791..ca71009 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -275,7 +275,6 @@ function(gp_item_default_embedded_path item default_embedded_path_var) # as the executable by default: # set(path "@executable_path") - set(overridden 0) # On the Mac, relative to the executable depending on the type # of the thing we are embedding: @@ -294,20 +293,11 @@ function(gp_item_default_embedded_path item default_embedded_path_var) # set(path "@executable_path/../../Contents/MacOS") - # Embed .dylibs right next to the main bundle executable: + # Embed frameworks and .dylibs in the embedded "Frameworks" directory + # (sibling of MacOS): # - if(item MATCHES "\\.dylib$") - set(path "@executable_path/../MacOS") - set(overridden 1) - endif() - - # Embed frameworks in the embedded "Frameworks" directory (sibling of MacOS): - # - if(NOT overridden) - if(item MATCHES "[^/]+\\.framework/") - set(path "@executable_path/../Frameworks") - set(overridden 1) - endif() + if(item MATCHES "[^/]+\\.framework/" OR item MATCHES "\\.dylib$") + set(path "@executable_path/../Frameworks") endif() endif() ----------------------------------------------------------------------- Summary of changes: Modules/GetPrerequisites.cmake | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jul 26 00:05:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 26 Jul 2018 00:05:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-301-g4687de3 Message-ID: <20180726040504.0EDC011E822@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 4687de32a485ad682f426bf337cc1eb780a06fbc (commit) from 946318a1ef16d1b69c388500638783b370590212 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4687de32a485ad682f426bf337cc1eb780a06fbc commit 4687de32a485ad682f426bf337cc1eb780a06fbc Author: Kitware Robot AuthorDate: Thu Jul 26 00:01:10 2018 -0400 Commit: Kitware Robot CommitDate: Thu Jul 26 00:01:10 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 5649c0b..e2b022f 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 12) -set(CMake_VERSION_PATCH 20180725) +set(CMake_VERSION_PATCH 20180726) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jul 26 10:15:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 26 Jul 2018 10:15:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-311-g0ff961f Message-ID: <20180726141505.B1B8511DAE0@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 0ff961f1885e55b5f47c0d0d52c7dd5f88b082a3 (commit) via 2235244263618d264f8741278da3f97dab1c264a (commit) via c985c9743340b7f8be19981b241d13b72c1e716d (commit) via 8442d9fc3fe71c12dd613ba585b196da93d6d9f1 (commit) via 7ddc2a110c0e52ce6e2e360a69aadf9291edbb11 (commit) via b0b820ea39fe4edaf0672ba899a7042ef93a20d2 (commit) via 1f36652ef4062d784620caa59e3ddd5de06cd976 (commit) via db866d05deb1d345793aff4152211f7651451213 (commit) via 3713dc9b8e0662279e7f84133d5953998dcfe254 (commit) via d1077c1ce6310f02c93962cbb89e82dc57a6dd31 (commit) from 4687de32a485ad682f426bf337cc1eb780a06fbc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0ff961f1885e55b5f47c0d0d52c7dd5f88b082a3 commit 0ff961f1885e55b5f47c0d0d52c7dd5f88b082a3 Merge: 2235244 b0b820e Author: Brad King AuthorDate: Thu Jul 26 14:10:02 2018 +0000 Commit: Kitware Robot CommitDate: Thu Jul 26 10:10:08 2018 -0400 Merge topic 'get_include_directories' b0b820ea39 cmLocalGenerator: Extend the functionality of ``GetIncludeDirectories()`` 1f36652ef4 cmLocalGenerator: Style changes: Private local variable renames db866d05de cmLocalGenerator: Style change: Wrap temporary strings and code in braces 3713dc9b8e cmLocalGenerator: Style change: Wrap temporary strings and code in braces d1077c1ce6 cmLocalGenerator: Style change: Use return value of std::set::insert Acked-by: Kitware Robot Merge-request: !2234 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2235244263618d264f8741278da3f97dab1c264a commit 2235244263618d264f8741278da3f97dab1c264a Merge: c985c97 8442d9f Author: Brad King AuthorDate: Thu Jul 26 10:08:57 2018 -0400 Commit: Brad King CommitDate: Thu Jul 26 10:08:57 2018 -0400 Merge branch 'release-3.12' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c985c9743340b7f8be19981b241d13b72c1e716d commit c985c9743340b7f8be19981b241d13b72c1e716d Merge: 4687de3 7ddc2a1 Author: Brad King AuthorDate: Thu Jul 26 14:08:04 2018 +0000 Commit: Kitware Robot CommitDate: Thu Jul 26 10:08:11 2018 -0400 Merge topic 'googletest_policy_settings' 7ddc2a110c GoogleTest: Ensure policy settings allow use of IN_LIST Acked-by: Kitware Robot Merge-request: !2237 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b0b820ea39fe4edaf0672ba899a7042ef93a20d2 commit b0b820ea39fe4edaf0672ba899a7042ef93a20d2 Author: Sebastian Holtermann AuthorDate: Wed Jul 25 12:45:10 2018 +0200 Commit: Sebastian Holtermann CommitDate: Wed Jul 25 12:45:10 2018 +0200 cmLocalGenerator: Extend the functionality of ``GetIncludeDirectories()`` What ``cmLocalGenerator::GetIncludeDirectories`` does ----------------------------------------------------- In general it concatenates the 1. ``target->GetIncludeDirectories(LANG)`` and the 2. ``CMAKE__STANDARD_INCLUDE_DIRECTORIES``. Additionally it performs some sorting and special treatment of the - ``CMAKE__IMPLICIT_INCLUDE_DIRECTORIES``. By default all ``CMAKE__IMPLICIT_INCLUDE_DIRECTORIES`` are stripped from the result list. When explicitly requested (by setting ``stripImplicitInclDirs=false``) *some* implicit directories are appended to the result list. The implicit directories that *are* appended are those that were requested to be included by 1. ``target->GetIncludeDirectories(LANG)`` or 2. ``CMAKE__STANDARD_INCLUDE_DIRECTORIES``. All other implicit directories are still stripped from the result list. The reason to not simply append all implicit directories is that Qt4's moc has problems to parse some headers that might be found in the implicit system include directories (See commit d2536579d51e77827b8e55f39123316324314781 and [QTBUG-28045](https://bugreports.qt.io/browse/QTBUG-28045) ). That has been solved in Qt5's moc though. Extension request to ``cmLocalGenerator::GetIncludeDirectories`` ---------------------------------------------------------------- For Qt5's moc we like to have an option that allows to append *all* implict include directories to the result list, not just those that were user requested. Changes to ``cmLocalGenerator::GetIncludeDirectories`` ------------------------------------------------------ - Shorten the function parameter name ``stripImplicitInclDirs`` to ``stripImplicitDirs``. - Add new boolean function parameter ``appendAllImplicitDirs`` with a default value ``false``. The old default behavior of the function stays the same, but a specialized behavior can be requested by AUTOMOC for Qt4/Qt5 respectively. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 3df701e..647697a 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -844,7 +844,8 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, cmGeneratorTarget const* target, const std::string& lang, const std::string& config, - bool stripImplicitInclDirs) const + bool stripImplicitDirs, + bool appendAllImplicitDirs) const { // Do not repeat an include path. std::set emitted; @@ -898,12 +899,12 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, std::vector impDirVec; cmSystemTools::ExpandListArgument(value, impDirVec); for (std::string const& i : impDirVec) { - std::string d = rootPath + i; - cmSystemTools::ConvertToUnixSlashes(d); - emitted.insert(std::move(d)); - if (!stripImplicitInclDirs) { - implicitDirs.push_back(i); + { + std::string d = rootPath + i; + cmSystemTools::ConvertToUnixSlashes(d); + emitted.insert(std::move(d)); } + implicitDirs.push_back(i); } } } @@ -958,9 +959,21 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, } } - for (std::string const& i : implicitDirs) { - if (std::find(userDirs.begin(), userDirs.end(), i) != userDirs.end()) { - dirs.push_back(i); + if (!stripImplicitDirs) { + if (!appendAllImplicitDirs) { + // Append only those implicit directories that were requested by the user + for (std::string const& i : implicitDirs) { + if (std::find(userDirs.begin(), userDirs.end(), i) != userDirs.end()) { + dirs.push_back(i); + } + } + } else { + // Append all implicit directories + for (std::string const& i : implicitDirs) { + if (std::find(dirs.begin(), dirs.end(), i) == dirs.end()) { + dirs.push_back(i); + } + } } } } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 9ba62cc..52f0396 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -237,12 +237,18 @@ public: return true; } - /** Get the include flags for the current makefile and language. */ + /** @brief Get the include directories for the current makefile and language. + * @arg stripImplicitDirs Strip all directories found in + * CMAKE__IMPLICIT_INCLUDE_DIRECTORIES from the result. + * @arg appendAllImplicitDirs Append all directories found in + * CMAKE__IMPLICIT_INCLUDE_DIRECTORIES to the result. + */ void GetIncludeDirectories(std::vector& dirs, cmGeneratorTarget const* target, const std::string& lang = "C", const std::string& config = "", - bool stripImplicitInclDirs = true) const; + bool stripImplicitDirs = true, + bool appendAllImplicitDirs = false) const; void AddCompileOptions(std::string& flags, cmGeneratorTarget* target, const std::string& lang, const std::string& config); void AddCompileDefinitions(std::set& defines, https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1f36652ef4062d784620caa59e3ddd5de06cd976 commit 1f36652ef4062d784620caa59e3ddd5de06cd976 Author: Sebastian Holtermann AuthorDate: Wed Jul 25 12:26:25 2018 +0200 Commit: Sebastian Holtermann CommitDate: Wed Jul 25 12:26:25 2018 +0200 cmLocalGenerator: Style changes: Private local variable renames Code style change in ``cmLocalGenerator::GetIncludeDirectories``. Rename a variable to reflect its purpose a little bit better. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 826ff84..3df701e 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -909,7 +909,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, } // Get the target-specific include directories. - std::vector includes = + std::vector userDirs = target->GetIncludeDirectories(config, lang); // Support putting all the in-project include directories first if @@ -917,7 +917,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, if (this->Makefile->IsOn("CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE")) { std::string const &topSourceDir = this->GetState()->GetSourceDirectory(), &topBinaryDir = this->GetState()->GetBinaryDirectory(); - for (std::string const& i : includes) { + for (std::string const& i : userDirs) { // Emit this directory only if it is a subdirectory of the // top-level source or binary tree. if (cmSystemTools::ComparePath(i, topSourceDir) || @@ -932,7 +932,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, } // Construct the final ordered include directory list. - for (std::string const& i : includes) { + for (std::string const& i : userDirs) { if (emitted.insert(i).second) { dirs.push_back(i); } @@ -942,16 +942,16 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, // Add standard include directories for this language. { - std::vector::size_type const before = includes.size(); + std::vector::size_type const before = userDirs.size(); { std::string key = "CMAKE_"; key += lang; key += "_STANDARD_INCLUDE_DIRECTORIES"; std::string const value = this->Makefile->GetSafeDefinition(key); - cmSystemTools::ExpandListArgument(value, includes); + cmSystemTools::ExpandListArgument(value, userDirs); } - for (std::vector::iterator i = includes.begin() + before, - ie = includes.end(); + for (std::vector::iterator i = userDirs.begin() + before, + ie = userDirs.end(); i != ie; ++i) { cmSystemTools::ConvertToUnixSlashes(*i); dirs.push_back(*i); @@ -959,7 +959,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, } for (std::string const& i : implicitDirs) { - if (std::find(includes.begin(), includes.end(), i) != includes.end()) { + if (std::find(userDirs.begin(), userDirs.end(), i) != userDirs.end()) { dirs.push_back(i); } } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=db866d05deb1d345793aff4152211f7651451213 commit db866d05deb1d345793aff4152211f7651451213 Author: Sebastian Holtermann AuthorDate: Wed Jul 25 12:18:49 2018 +0200 Commit: Sebastian Holtermann CommitDate: Wed Jul 25 12:24:16 2018 +0200 cmLocalGenerator: Style change: Wrap temporary strings and code in braces Code style change in ``cmLocalGenerator::GetIncludeDirectories``. Embrace ``{}`` temporary strings and code that uses them to minimize their lifetime. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 0c50759..826ff84 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -909,9 +909,8 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, } // Get the target-specific include directories. - std::vector includes; - - includes = target->GetIncludeDirectories(config, lang); + std::vector includes = + target->GetIncludeDirectories(config, lang); // Support putting all the in-project include directories first if // it is requested by the project. @@ -942,17 +941,21 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, this->MoveSystemIncludesToEnd(dirs, config, lang, target); // Add standard include directories for this language. - // We do not filter out implicit directories here. - std::string const standardIncludesVar = - "CMAKE_" + lang + "_STANDARD_INCLUDE_DIRECTORIES"; - std::string const standardIncludes = - this->Makefile->GetSafeDefinition(standardIncludesVar); - std::vector::size_type const before = includes.size(); - cmSystemTools::ExpandListArgument(standardIncludes, includes); - for (std::vector::iterator i = includes.begin() + before; - i != includes.end(); ++i) { - cmSystemTools::ConvertToUnixSlashes(*i); - dirs.push_back(*i); + { + std::vector::size_type const before = includes.size(); + { + std::string key = "CMAKE_"; + key += lang; + key += "_STANDARD_INCLUDE_DIRECTORIES"; + std::string const value = this->Makefile->GetSafeDefinition(key); + cmSystemTools::ExpandListArgument(value, includes); + } + for (std::vector::iterator i = includes.begin() + before, + ie = includes.end(); + i != ie; ++i) { + cmSystemTools::ConvertToUnixSlashes(*i); + dirs.push_back(*i); + } } for (std::string const& i : implicitDirs) { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3713dc9b8e0662279e7f84133d5953998dcfe254 commit 3713dc9b8e0662279e7f84133d5953998dcfe254 Author: Sebastian Holtermann AuthorDate: Wed Jul 25 12:11:58 2018 +0200 Commit: Sebastian Holtermann CommitDate: Wed Jul 25 12:20:56 2018 +0200 cmLocalGenerator: Style change: Wrap temporary strings and code in braces Code style change in ``cmLocalGenerator::GetIncludeDirectories``. Embrace ``{}`` temporary strings and code that uses them to minimize their lifetime. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index f0db28d..0c50759 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -879,28 +879,31 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, return; } - std::string rootPath; - if (const char* sysrootCompile = - this->Makefile->GetDefinition("CMAKE_SYSROOT_COMPILE")) { - rootPath = sysrootCompile; - } else { - rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT"); - } - + // Implicit include directories std::vector implicitDirs; - // Load implicit include directories for this language. - std::string impDirVar = "CMAKE_"; - impDirVar += lang; - impDirVar += "_IMPLICIT_INCLUDE_DIRECTORIES"; - if (const char* value = this->Makefile->GetDefinition(impDirVar)) { - std::vector impDirVec; - cmSystemTools::ExpandListArgument(value, impDirVec); - for (std::string const& i : impDirVec) { - std::string d = rootPath + i; - cmSystemTools::ConvertToUnixSlashes(d); - emitted.insert(std::move(d)); - if (!stripImplicitInclDirs) { - implicitDirs.push_back(i); + { + std::string rootPath; + if (const char* sysrootCompile = + this->Makefile->GetDefinition("CMAKE_SYSROOT_COMPILE")) { + rootPath = sysrootCompile; + } else { + rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT"); + } + + // Load implicit include directories for this language. + std::string key = "CMAKE_"; + key += lang; + key += "_IMPLICIT_INCLUDE_DIRECTORIES"; + if (const char* value = this->Makefile->GetDefinition(key)) { + std::vector impDirVec; + cmSystemTools::ExpandListArgument(value, impDirVec); + for (std::string const& i : impDirVec) { + std::string d = rootPath + i; + cmSystemTools::ConvertToUnixSlashes(d); + emitted.insert(std::move(d)); + if (!stripImplicitInclDirs) { + implicitDirs.push_back(i); + } } } } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d1077c1ce6310f02c93962cbb89e82dc57a6dd31 commit d1077c1ce6310f02c93962cbb89e82dc57a6dd31 Author: Sebastian Holtermann AuthorDate: Wed Jul 25 12:08:19 2018 +0200 Commit: Sebastian Holtermann CommitDate: Wed Jul 25 12:08:19 2018 +0200 cmLocalGenerator: Style change: Use return value of std::set::insert Code style change in ``cmLocalGenerator::GetIncludeDirectories()``. Use the return value of ``std::set::insert`` instead of testing if the entry already exists in the set using ``std::find``. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 072b958..f0db28d 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -846,10 +846,8 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, const std::string& config, bool stripImplicitInclDirs) const { - // Need to decide whether to automatically include the source and - // binary directories at the beginning of the include path. - bool includeSourceDir = false; - bool includeBinaryDir = false; + // Do not repeat an include path. + std::set emitted; // When automatic include directories are requested for a build then // include the source and binary directories at the beginning of the @@ -859,26 +857,21 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, // cannot fix this because not all native build tools support // per-source-file include paths. if (this->Makefile->IsOn("CMAKE_INCLUDE_CURRENT_DIR")) { - includeSourceDir = true; - includeBinaryDir = true; - } - - // Do not repeat an include path. - std::set emitted; - - // Store the automatic include paths. - if (includeBinaryDir) { - std::string binDir = this->StateSnapshot.GetDirectory().GetCurrentBinary(); - if (emitted.find(binDir) == emitted.end()) { - dirs.push_back(binDir); - emitted.insert(binDir); + // Current binary directory + { + std::string binDir = + this->StateSnapshot.GetDirectory().GetCurrentBinary(); + if (emitted.insert(binDir).second) { + dirs.push_back(std::move(binDir)); + } } - } - if (includeSourceDir) { - std::string srcDir = this->StateSnapshot.GetDirectory().GetCurrentSource(); - if (emitted.find(srcDir) == emitted.end()) { - dirs.push_back(srcDir); - emitted.insert(srcDir); + // Current source directory + { + std::string srcDir = + this->StateSnapshot.GetDirectory().GetCurrentSource(); + if (emitted.insert(srcDir).second) { + dirs.push_back(std::move(srcDir)); + } } } ----------------------------------------------------------------------- Summary of changes: Modules/GoogleTest.cmake | 7 +++ Source/cmLocalGenerator.cxx | 142 ++++++++++++++++++++++++-------------------- Source/cmLocalGenerator.h | 10 +++- 3 files changed, 92 insertions(+), 67 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jul 26 10:15:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 26 Jul 2018 10:15:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.12.0-15-g8442d9f Message-ID: <20180726141505.BE8F911DB0A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via 8442d9fc3fe71c12dd613ba585b196da93d6d9f1 (commit) via 7ddc2a110c0e52ce6e2e360a69aadf9291edbb11 (commit) from 504129889335fc7680a7894bc85eaf60bffc880c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Modules/GoogleTest.cmake | 7 +++++++ 1 file changed, 7 insertions(+) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jul 26 10:25:03 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 26 Jul 2018 10:25:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-313-ge500d60 Message-ID: <20180726142503.8E8D911E5CB@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 e500d6074112c975c96678c0c5f38a2b7e9718b6 (commit) via 6161a64a529d8c7a5ba4e0d8a777605a0558f2ad (commit) from 0ff961f1885e55b5f47c0d0d52c7dd5f88b082a3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e500d6074112c975c96678c0c5f38a2b7e9718b6 commit e500d6074112c975c96678c0c5f38a2b7e9718b6 Merge: 0ff961f 6161a64 Author: Brad King AuthorDate: Thu Jul 26 14:20:34 2018 +0000 Commit: Kitware Robot CommitDate: Thu Jul 26 10:20:39 2018 -0400 Merge topic 'maint_clarify_merge_process' 6161a64a52 maint: Add further details about merging topics to release branch Acked-by: Kitware Robot Merge-request: !2238 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6161a64a529d8c7a5ba4e0d8a777605a0558f2ad commit 6161a64a529d8c7a5ba4e0d8a777605a0558f2ad Author: Craig Scott AuthorDate: Wed Jul 25 22:54:37 2018 +1000 Commit: Craig Scott CommitDate: Thu Jul 26 07:41:19 2018 +1000 maint: Add further details about merging topics to release branch The Maintain Current Release instructions previously assumed that the topic branch had been merged to master. Add text to make this explicit in the instructions as an initial verification step. The previous instructions also made no mention of the commit message for the merge to the release branch. This needs to include a footer that mentions the merge request number for tracking purposes. diff --git a/Help/dev/maint.rst b/Help/dev/maint.rst index ec76479..a8942cd7 100644 --- a/Help/dev/maint.rst +++ b/Help/dev/maint.rst @@ -51,15 +51,18 @@ using a local branch named ``release-$ver``, where ``$ver`` is the version number of the current release in the form ``$major.$minor``. It is always merged into ``master`` before publishing. -To merge some ``$topic`` branch into ``release``, first create the local -branch: +Before merging a ``$topic`` branch into ``release``, verify that the +``$topic`` branch has already been merged to ``master`` via the usual +``Do: merge`` process. Then, to merge the ``$topic`` branch into +``release``, start by creating the local branch: .. code-block:: shell git fetch origin git checkout -b release-$ver origin/release -Merge the ``$topic`` branch into the local ``release-$ver`` branch: +Merge the ``$topic`` branch into the local ``release-$ver`` branch, making +sure to include a ``Merge-request: !xxxx`` footer in the commit message: .. code-block:: shell ----------------------------------------------------------------------- Summary of changes: Help/dev/maint.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jul 27 00:05:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 27 Jul 2018 00:05:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-314-g131fcf6 Message-ID: <20180727040505.E581311E280@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 131fcf65f667ab23b3bcd31c6d82b5bd01a44683 (commit) from e500d6074112c975c96678c0c5f38a2b7e9718b6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=131fcf65f667ab23b3bcd31c6d82b5bd01a44683 commit 131fcf65f667ab23b3bcd31c6d82b5bd01a44683 Author: Kitware Robot AuthorDate: Fri Jul 27 00:01:08 2018 -0400 Commit: Kitware Robot CommitDate: Fri Jul 27 00:01:08 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e2b022f..8d037e4 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 12) -set(CMake_VERSION_PATCH 20180726) +set(CMake_VERSION_PATCH 20180727) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jul 27 10:15:07 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 27 Jul 2018 10:15:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-318-g5bbcf76 Message-ID: <20180727141507.03A95E54A1@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 5bbcf76399e107bbb1712ba8aeee27c160413d2d (commit) via bccbf9a737785c34e0b23b2b456fbb4e112d42fb (commit) via 548ac51d8ea319c65abefa0a771636893c45014c (commit) via a3a0c3aa71498f76cc0e9655038de7bbb5430a03 (commit) from 131fcf65f667ab23b3bcd31c6d82b5bd01a44683 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5bbcf76399e107bbb1712ba8aeee27c160413d2d commit 5bbcf76399e107bbb1712ba8aeee27c160413d2d Merge: bccbf9a a3a0c3a Author: Brad King AuthorDate: Fri Jul 27 14:08:47 2018 +0000 Commit: Kitware Robot CommitDate: Fri Jul 27 10:08:54 2018 -0400 Merge topic 'UseSWIG-target-name-policy' a3a0c3aa71 UseSWIG: add policy to manage target naming strategy. Acked-by: Kitware Robot Merge-request: !2232 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bccbf9a737785c34e0b23b2b456fbb4e112d42fb commit bccbf9a737785c34e0b23b2b456fbb4e112d42fb Merge: 131fcf6 548ac51 Author: Brad King AuthorDate: Fri Jul 27 14:06:35 2018 +0000 Commit: Kitware Robot CommitDate: Fri Jul 27 10:06:44 2018 -0400 Merge topic 'reproducible-tarballs' 548ac51d8e CPack/Deb: Support SOURCE_DATE_EPOCH when packaging files Acked-by: Kitware Robot Merge-request: !2226 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=548ac51d8ea319c65abefa0a771636893c45014c commit 548ac51d8ea319c65abefa0a771636893c45014c Author: Andrew Fuller AuthorDate: Thu Jul 19 18:14:40 2018 -0700 Commit: Andrew Fuller CommitDate: Wed Jul 25 13:39:07 2018 -0700 CPack/Deb: Support SOURCE_DATE_EPOCH when packaging files diff --git a/Help/cpack_gen/deb.rst b/Help/cpack_gen/deb.rst index c5923be..37d750d 100644 --- a/Help/cpack_gen/deb.rst +++ b/Help/cpack_gen/deb.rst @@ -527,3 +527,11 @@ alternate data stream (ADT) is used. When a filesystem without ADT support is used only owner read/write permissions can be preserved. + +Reproducible packages +^^^^^^^^^^^^^^^^^^^^^ + +The environment variable ``SOURCE_DATE_EPOCH`` may be set to a UNIX +timestamp, defined as the number of seconds, excluding leap seconds, +since 01 Jan 1970 00:00:00 UTC. If set, the CPack Deb generator will +use its value for timestamps in the package. diff --git a/Help/release/dev/cpack-deb-source-date-epoch.rst b/Help/release/dev/cpack-deb-source-date-epoch.rst new file mode 100644 index 0000000..b276569 --- /dev/null +++ b/Help/release/dev/cpack-deb-source-date-epoch.rst @@ -0,0 +1,6 @@ +cpack-deb-source-date-epoch +--------------------------- + +* The :cpack_gen:`CPack Deb Generator` learned to honor the ``SOURCE_DATE_EPOCH`` + environment variable when packaging files. This is useful for generating + reproducible packages. diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx index 1dd7734..6031781 100644 --- a/Source/cmArchiveWrite.cxx +++ b/Source/cmArchiveWrite.cxx @@ -10,6 +10,7 @@ #include "cmsys/Encoding.hxx" #include "cmsys/FStream.hxx" #include +#include #include #include @@ -94,13 +95,25 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c, return; } break; - case CompressGZip: + case CompressGZip: { if (archive_write_add_filter_gzip(this->Archive) != ARCHIVE_OK) { this->Error = "archive_write_add_filter_gzip: "; this->Error += cm_archive_error_string(this->Archive); return; } - break; + std::string source_date_epoch; + cmSystemTools::GetEnv("SOURCE_DATE_EPOCH", source_date_epoch); + if (!source_date_epoch.empty()) { + // We're not able to specify an arbitrary timestamp for gzip. + // The next best thing is to omit the timestamp entirely. + if (archive_write_set_filter_option(this->Archive, "gzip", "timestamp", + nullptr) != ARCHIVE_OK) { + this->Error = "archive_write_set_filter_option: "; + this->Error += cm_archive_error_string(this->Archive); + return; + } + } + } break; case CompressBZip2: if (archive_write_add_filter_bzip2(this->Archive) != ARCHIVE_OK) { this->Error = "archive_write_add_filter_bzip2: "; @@ -243,6 +256,17 @@ bool cmArchiveWrite::AddFile(const char* file, size_t skip, const char* prefix) return false; } archive_entry_set_mtime(e, t, 0); + } else { + std::string source_date_epoch; + cmSystemTools::GetEnv("SOURCE_DATE_EPOCH", source_date_epoch); + if (!source_date_epoch.empty()) { + std::istringstream iss(source_date_epoch); + time_t epochTime; + iss >> epochTime; + if (iss.eof() && !iss.fail()) { + archive_entry_set_mtime(e, epochTime, 0); + } + } } // manages the uid/guid of the entry (if any) diff --git a/Tests/RunCMake/CPack/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake index 8c9f4b4..d00ef3b 100644 --- a/Tests/RunCMake/CPack/CPackTestHelpers.cmake +++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake @@ -78,8 +78,12 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK endif() # execute cpack + set(SETENV) + if(ENVIRONMENT) + set(SETENV ${CMAKE_COMMAND} -E env "${ENVIRONMENT}") + endif() execute_process( - COMMAND ${cpack_command_} + COMMAND ${SETENV} ${cpack_command_} WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" RESULT_VARIABLE "result_" OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt" diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake index f7c5c84..e01f81d 100644 --- a/Tests/RunCMake/CPack/DEB/Helpers.cmake +++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake @@ -1,7 +1,7 @@ set(ALL_FILES_GLOB "*.deb") function(getPackageContent FILE RESULT_VAR) - execute_process(COMMAND ${DPKG_EXECUTABLE} -c "${FILE}" + execute_process(COMMAND ${CMAKE_COMMAND} -E env TZ=Etc/UTC ${DPKG_EXECUTABLE} -c "${FILE}" OUTPUT_VARIABLE package_content_ ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 33ffa14..b273c1e 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -28,6 +28,9 @@ run_cpack_test(EXTRA_SLASH_IN_PATH "RPM" true "COMPONENT") run_cpack_source_test(SOURCE_PACKAGE "RPM") run_cpack_test(SUGGESTS "RPM" false "MONOLITHIC") run_cpack_test(SYMLINKS "RPM;TGZ" false "MONOLITHIC;COMPONENT") +set(ENVIRONMENT "SOURCE_DATE_EPOCH=123456789") +run_cpack_test(TIMESTAMPS "DEB;TGZ" false "COMPONENT") +unset(ENVIRONMENT) run_cpack_test(USER_FILELIST "RPM" false "MONOLITHIC") run_cpack_test(MD5SUMS "DEB" false "MONOLITHIC;COMPONENT") run_cpack_test(CPACK_INSTALL_SCRIPT "ZIP" false "MONOLITHIC") diff --git a/Tests/RunCMake/CPack/tests/TIMESTAMPS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/TIMESTAMPS/ExpectedFiles.cmake new file mode 100644 index 0000000..d1a3a5f --- /dev/null +++ b/Tests/RunCMake/CPack/tests/TIMESTAMPS/ExpectedFiles.cmake @@ -0,0 +1,2 @@ +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/TIMESTAMPS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/TIMESTAMPS/VerifyResult.cmake new file mode 100644 index 0000000..e7e2645 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/TIMESTAMPS/VerifyResult.cmake @@ -0,0 +1,58 @@ +macro(getFileMetadata_ FILE RESULT_VAR) + if(GENERATOR_TYPE STREQUAL "TGZ") + # getPackageContent defined for archives omit the metadata (non-verbose) + execute_process(COMMAND ${CMAKE_COMMAND} -E env TZ=Etc/UTC ${CMAKE_COMMAND} -E tar -xtvf ${FILE} + OUTPUT_VARIABLE ${RESULT_VAR} + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + else() + getPackageContent("${FILE}" ${RESULT_VAR}) + endif() +endmacro() + +function(checkContentTimestamp FILE REGEX) + getFileMetadata_("${FILE}" METADATA_) + + if(NOT METADATA_ MATCHES "${REGEX}") + string(REPLACE "\n" "\n " metadata_indented "${METADATA_}") + message(FATAL_ERROR + "Wrong timestamps in file:\n" + " ${FILE}\n" + "Expected timestamps to match:\n" + " ${REGEX}\n" + "Actual timestamps:\n" + " ${metadata_indented}") + endif() +endfunction() + +function(checkTimestamp FILE_NAME) + file(READ ${FILE_NAME} ACTUAL_TIMESTAMP OFFSET 4 LIMIT 4 HEX) + + if(NOT ACTUAL_TIMESTAMP STREQUAL "00000000") + message(FATAL_ERROR "${FILE_NAME} contains a timestamp [0x${ACTUAL_TIMESTAMP}]") + endif() +endfunction() + +# Expected timestamp is UNIX time 123456789 +if(GENERATOR_TYPE STREQUAL "TGZ") + set(EXPECTED_TIMESTAMP "29 Nov +1973") + set(EXPECTED_FILES foo/ foo/CMakeLists.txt) +else() + set(EXPECTED_TIMESTAMP "1973-11-29 21:33") + set(EXPECTED_FILES ./usr/ ./usr/foo/ ./usr/foo/CMakeLists.txt) +endif() + +set(EXPECTED_METADATA) +foreach(FILE ${EXPECTED_FILES}) + list(APPEND EXPECTED_METADATA ".* ${EXPECTED_TIMESTAMP} ${FILE}") +endforeach() +list(JOIN EXPECTED_METADATA ".*" EXPECTED_REGEX) +checkContentTimestamp("${FOUND_FILE_1}" "${EXPECTED_REGEX}") + +if(GENERATOR_TYPE STREQUAL "TGZ") + checkTimestamp("${FOUND_FILE_1}") +else() + execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${FOUND_FILE_1}") + checkTimestamp("data.tar.gz") + checkTimestamp("control.tar.gz") +endif() diff --git a/Tests/RunCMake/CPack/tests/TIMESTAMPS/test.cmake b/Tests/RunCMake/CPack/tests/TIMESTAMPS/test.cmake new file mode 100644 index 0000000..a193852 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/TIMESTAMPS/test.cmake @@ -0,0 +1,3 @@ +install(FILES CMakeLists.txt DESTINATION foo COMPONENT test) + +set(CPACK_COMPONENTS_ALL test) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a3a0c3aa71498f76cc0e9655038de7bbb5430a03 commit a3a0c3aa71498f76cc0e9655038de7bbb5430a03 Author: Marc Chevrier AuthorDate: Mon Jul 23 10:38:08 2018 +0200 Commit: Marc Chevrier CommitDate: Wed Jul 25 18:00:52 2018 +0200 UseSWIG: add policy to manage target naming strategy. diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index b2eeb3a..32a0118 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -57,6 +57,7 @@ Policies Introduced by CMake 3.13 .. toctree:: :maxdepth: 1 + CMP0078: UseSWIG generates standard target names. CMP0077: option() honors normal variables. CMP0076: target_sources() command converts relative paths to absolute. diff --git a/Help/policy/CMP0078.rst b/Help/policy/CMP0078.rst new file mode 100644 index 0000000..54cdc9c --- /dev/null +++ b/Help/policy/CMP0078.rst @@ -0,0 +1,22 @@ +CMP0078 +------- + +Starting with CMake 3.13, :module:`UseSWIG` generates now standard target +names. This policy provides compatibility with projects that expect the legacy +behavior. + +The ``OLD`` behavior for this policy relies on +``UseSWIG_TARGET_NAME_PREFERENCE`` variable that can be used to specify an +explicit preference. The value may be one of: + +* ``LEGACY``: legacy strategy is applied. Variable + ``SWIG_MODULE__REAL_NAME`` must be used to get real target name. + This is the default if not specified. +* ``STANDARD``: target name matches specified name. + +This policy was introduced in CMake version 3.13. CMake version +|release| warns when the policy is not set and uses ``OLD`` behavior. +Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` +explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/release/dev/UseSWIG-target-name-policy.rst b/Help/release/dev/UseSWIG-target-name-policy.rst new file mode 100644 index 0000000..bb9011d --- /dev/null +++ b/Help/release/dev/UseSWIG-target-name-policy.rst @@ -0,0 +1,5 @@ +UseSWIG-target-name-policy +-------------------------- + +* The :module:`UseSWIG` module has changed strategy for target naming. + See policy :policy:`CMP0078`. diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index 7460932..e7aaf32 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -30,9 +30,10 @@ Defines the following command for use with ``SWIG``: .. note:: - The variable ``SWIG_MODULE__REAL_NAME`` will be set to the name - of the swig module target library. This variable is useless if variable - ``UseSWIG_TARGET_NAME_PREFERENCE`` is set to ``STANDARD``. + This command creates a target with the specified ```` when + policy :policy:`CMP0078` is set to ``NEW``. Otherwise, the legacy + behavior will choose a different target name and store it in the + ``SWIG_MODULE__REAL_NAME`` variable. .. note:: @@ -197,13 +198,6 @@ information about support files generated by ``SWIG`` interface compilation. Some variables can be set to customize the behavior of ``swig_add_library`` as well as ``SWIG``: -``UseSWIG_TARGET_NAME_PREFERENCE`` - Specify target name strategy. - - * Set to ``LEGACY`` or undefined: legacy strategy is applied. Variable - ``SWIG_MODULE__REAL_NAME`` must be used to get real target name. - * Set to ``STANDARD``: target name matches specified name. - ``UseSWIG_MODULE_VERSION`` Specify different behaviors for ``UseSWIG`` module. @@ -225,8 +219,13 @@ as well as ``SWIG``: Specify extra dependencies for the generated module for ````. #]=======================================================================] - +cmake_policy(GET CMP0078 target_name_policy) cmake_policy (VERSION 3.12) +if (target_name_policy) + # respect user choice regarding CMP0078 policy + cmake_policy(SET CMP0078 ${target_name_policy}) +endif() +unset(target_name_policy) set(SWIG_CXX_EXTENSION "cxx") set(SWIG_EXTRA_LIBRARIES "") @@ -545,10 +544,22 @@ function(SWIG_ADD_LIBRARY name) unset(_SAM_TYPE) endif() - if (NOT DEFINED UseSWIG_TARGET_NAME_PREFERENCE) - set (UseSWIG_TARGET_NAME_PREFERENCE LEGACY) - elseif (NOT UseSWIG_TARGET_NAME_PREFERENCE MATCHES "^(LEGACY|STANDARD)$") - message (FATAL_ERROR "UseSWIG_TARGET_NAME_PREFERENCE: ${UseSWIG_TARGET_NAME_PREFERENCE}: invalid value. 'LEGACY' or 'STANDARD' is expected.") + cmake_policy(GET CMP0078 target_name_policy) + if (target_name_policy STREQUAL "NEW") + set (UseSWIG_TARGET_NAME_PREFERENCE STANDARD) + else() + if (NOT target_name_policy) + message(AUTHOR_WARNING + "Policy CMP0078 is not set. " + "Run \"cmake --help-policy CMP0078\" for policy details. " + "Use the cmake_policy command to set the policy and suppress this warning." + ) + endif() + if (NOT DEFINED UseSWIG_TARGET_NAME_PREFERENCE) + set (UseSWIG_TARGET_NAME_PREFERENCE LEGACY) + elseif (NOT UseSWIG_TARGET_NAME_PREFERENCE MATCHES "^(LEGACY|STANDARD)$") + message (FATAL_ERROR "UseSWIG_TARGET_NAME_PREFERENCE: ${UseSWIG_TARGET_NAME_PREFERENCE}: invalid value. 'LEGACY' or 'STANDARD' is expected.") + endif() endif() if (NOT DEFINED UseSWIG_MODULE_VERSION) diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index d6f7c54..91ed924 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -228,7 +228,9 @@ class cmMakefile; "target_sources() command converts relative paths to absolute.", 3, \ 13, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0077, "option() honors normal variables.", 3, 13, 0, \ - cmPolicies::WARN) + cmPolicies::WARN) \ + SELECT(POLICY, CMP0078, "UseSWIG generates standard target names.", 3, 13, \ + 0, cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index c030cda..c6c90d0 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -154,6 +154,9 @@ add_RunCMake_test(FPHSA) add_RunCMake_test(FindBoost) add_RunCMake_test(FindLua) add_RunCMake_test(FindOpenGL) +if(CMake_TEST_UseSWIG) + add_RunCMake_test(UseSWIG) +endif() if(NOT CMAKE_C_COMPILER_ID MATCHES "Watcom") add_RunCMake_test(GenerateExportHeader) endif() diff --git a/Tests/RunCMake/UseSWIG/CMP0078-NEW-stdout.txt b/Tests/RunCMake/UseSWIG/CMP0078-NEW-stdout.txt new file mode 100644 index 0000000..d4fa6e4 --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0078-NEW-stdout.txt @@ -0,0 +1,2 @@ +-- PREFIX='_' +-- TARGET NAME='example' diff --git a/Tests/RunCMake/UseSWIG/CMP0078-NEW.cmake b/Tests/RunCMake/UseSWIG/CMP0078-NEW.cmake new file mode 100644 index 0000000..ce77218 --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0078-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0078 NEW) +include(CMP0078-common.cmake) diff --git a/Tests/RunCMake/UseSWIG/CMP0078-OLD-stdout.txt b/Tests/RunCMake/UseSWIG/CMP0078-OLD-stdout.txt new file mode 100644 index 0000000..62f5371 --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0078-OLD-stdout.txt @@ -0,0 +1,2 @@ +-- PREFIX='' +-- TARGET NAME='_example' diff --git a/Tests/RunCMake/UseSWIG/CMP0078-OLD.cmake b/Tests/RunCMake/UseSWIG/CMP0078-OLD.cmake new file mode 100644 index 0000000..2c4d142 --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0078-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0078 OLD) +include(CMP0078-common.cmake) diff --git a/Tests/RunCMake/UseSWIG/CMP0078-WARN-stderr.txt b/Tests/RunCMake/UseSWIG/CMP0078-WARN-stderr.txt new file mode 100644 index 0000000..bc8da4c --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0078-WARN-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) at .*/Modules/UseSWIG.cmake:[0-9]+ \(message\): + Policy CMP0078 is not set. Run "cmake --help-policy CMP0078" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. +Call Stack \(most recent call first\): + CMP0078-common.cmake:6 \(swig_add_library\) + CMP0078-WARN.cmake:1 \(include\) + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/UseSWIG/CMP0078-WARN-stdout.txt b/Tests/RunCMake/UseSWIG/CMP0078-WARN-stdout.txt new file mode 100644 index 0000000..62f5371 --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0078-WARN-stdout.txt @@ -0,0 +1,2 @@ +-- PREFIX='' +-- TARGET NAME='_example' diff --git a/Tests/RunCMake/UseSWIG/CMP0078-WARN.cmake b/Tests/RunCMake/UseSWIG/CMP0078-WARN.cmake new file mode 100644 index 0000000..86b21a5 --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0078-WARN.cmake @@ -0,0 +1 @@ +include(CMP0078-common.cmake) diff --git a/Tests/RunCMake/UseSWIG/CMP0078-common.cmake b/Tests/RunCMake/UseSWIG/CMP0078-common.cmake new file mode 100644 index 0000000..6cf39dc --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0078-common.cmake @@ -0,0 +1,10 @@ + +set(SWIG_EXECUTABLE "swig") +set(SWIG_DIR "/swig") +include(UseSWIG) + +swig_add_library(example LANGUAGE python TYPE MODULE SOURCES example.i) + +get_property(prefix TARGET ${SWIG_MODULE_example_REAL_NAME} PROPERTY PREFIX) +message(STATUS "PREFIX='${prefix}'") +message(STATUS "TARGET NAME='${SWIG_MODULE_example_REAL_NAME}'") diff --git a/Tests/RunCMake/UseSWIG/CMakeLists.txt b/Tests/RunCMake/UseSWIG/CMakeLists.txt new file mode 100644 index 0000000..d1b0d2c --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.10) +project(${RunCMake_TEST} C) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake b/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake new file mode 100644 index 0000000..b96622a --- /dev/null +++ b/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0078-WARN) +run_cmake(CMP0078-OLD) +run_cmake(CMP0078-NEW) diff --git a/Tests/RunCMake/UseSWIG/example.i b/Tests/RunCMake/UseSWIG/example.i new file mode 100644 index 0000000..86625aa --- /dev/null +++ b/Tests/RunCMake/UseSWIG/example.i @@ -0,0 +1,2 @@ +/* File : example.i */ +%module example diff --git a/Tests/UseSWIG/BasicConfiguration.cmake b/Tests/UseSWIG/BasicConfiguration.cmake index ad34d39..fd3ac40 100644 --- a/Tests/UseSWIG/BasicConfiguration.cmake +++ b/Tests/UseSWIG/BasicConfiguration.cmake @@ -58,7 +58,6 @@ if(${language} MATCHES lua) set(SWIG_LANG_LIBRARIES ${LUA_LIBRARIES}) endif() -set(UseSWIG_TARGET_NAME_PREFERENCE STANDARD) unset(CMAKE_SWIG_FLAGS) set (CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/Tests/UseSWIG/BasicCsharp/CMakeLists.txt b/Tests/UseSWIG/BasicCsharp/CMakeLists.txt index 84743ef..1a6c763 100644 --- a/Tests/UseSWIG/BasicCsharp/CMakeLists.txt +++ b/Tests/UseSWIG/BasicCsharp/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.12...3.13) project(TestBasicCsharp CXX CSharp) diff --git a/Tests/UseSWIG/BasicPerl/CMakeLists.txt b/Tests/UseSWIG/BasicPerl/CMakeLists.txt index 476ef0e..cf02de7 100644 --- a/Tests/UseSWIG/BasicPerl/CMakeLists.txt +++ b/Tests/UseSWIG/BasicPerl/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.1...3.13) project(TestBasicPerl CXX) diff --git a/Tests/UseSWIG/BasicPython/CMakeLists.txt b/Tests/UseSWIG/BasicPython/CMakeLists.txt index cf1d821..8bbd1cb 100644 --- a/Tests/UseSWIG/BasicPython/CMakeLists.txt +++ b/Tests/UseSWIG/BasicPython/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.1...3.13) project(TestBasicPython CXX) diff --git a/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt b/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt index 452f9e2..a7ee210 100644 --- a/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt +++ b/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.1...3.13) project(TestModuleVersion2 CXX) @@ -16,7 +16,6 @@ else() set (PS ":") endif() -set(UseSWIG_TARGET_NAME_PREFERENCE STANDARD) set (UseSWIG_MODULE_VERSION 2) unset(CMAKE_SWIG_FLAGS) diff --git a/Tests/UseSWIG/MultipleModules/CMakeLists.txt b/Tests/UseSWIG/MultipleModules/CMakeLists.txt index 25dd6b3..f1dc379 100644 --- a/Tests/UseSWIG/MultipleModules/CMakeLists.txt +++ b/Tests/UseSWIG/MultipleModules/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.1...3.13) project(TestMultipleModules CXX) @@ -19,7 +19,6 @@ else() set (PS ":") endif() -set(UseSWIG_TARGET_NAME_PREFERENCE STANDARD) unset(CMAKE_SWIG_FLAGS) set_property(SOURCE "../example.i" PROPERTY CPLUSPLUS ON) diff --git a/Tests/UseSWIG/MultiplePython/CMakeLists.txt b/Tests/UseSWIG/MultiplePython/CMakeLists.txt index a1651fb..8f87755 100644 --- a/Tests/UseSWIG/MultiplePython/CMakeLists.txt +++ b/Tests/UseSWIG/MultiplePython/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.1...3.13) project(TestMultiplePython CXX) @@ -17,7 +17,6 @@ else() set (PS ":") endif() -set(UseSWIG_TARGET_NAME_PREFERENCE STANDARD) unset(CMAKE_SWIG_FLAGS) set_property(SOURCE "../example.i" PROPERTY CPLUSPLUS ON) diff --git a/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt b/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt index d0855bf..fbb72d5 100644 --- a/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt +++ b/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.1...3.13) project(TestUseTargetINCLUDE_DIRECTORIES CXX) @@ -9,7 +9,6 @@ include(${SWIG_USE_FILE}) find_package(Python3 REQUIRED COMPONENTS Interpreter Development) -set(UseSWIG_TARGET_NAME_PREFERENCE STANDARD) unset(CMAKE_SWIG_FLAGS) set_property(SOURCE "example.i" PROPERTY CPLUSPLUS ON) ----------------------------------------------------------------------- Summary of changes: Help/cpack_gen/deb.rst | 8 +++ Help/manual/cmake-policies.7.rst | 1 + Help/policy/CMP0078.rst | 22 ++++++++ Help/release/dev/UseSWIG-target-name-policy.rst | 5 ++ Help/release/dev/cpack-deb-source-date-epoch.rst | 6 +++ Modules/UseSWIG.cmake | 41 +++++++++------ Source/cmArchiveWrite.cxx | 28 ++++++++++- Source/cmPolicies.h | 4 +- Tests/RunCMake/CMakeLists.txt | 3 ++ Tests/RunCMake/CPack/CPackTestHelpers.cmake | 6 ++- Tests/RunCMake/CPack/DEB/Helpers.cmake | 2 +- Tests/RunCMake/CPack/RunCMakeTest.cmake | 3 ++ .../{SUGGESTS => TIMESTAMPS}/ExpectedFiles.cmake | 0 .../CPack/tests/TIMESTAMPS/VerifyResult.cmake | 58 ++++++++++++++++++++++ Tests/RunCMake/CPack/tests/TIMESTAMPS/test.cmake | 3 ++ Tests/RunCMake/UseSWIG/CMP0078-NEW-stdout.txt | 2 + Tests/RunCMake/UseSWIG/CMP0078-NEW.cmake | 2 + Tests/RunCMake/UseSWIG/CMP0078-OLD-stdout.txt | 2 + Tests/RunCMake/UseSWIG/CMP0078-OLD.cmake | 2 + Tests/RunCMake/UseSWIG/CMP0078-WARN-stderr.txt | 9 ++++ Tests/RunCMake/UseSWIG/CMP0078-WARN-stdout.txt | 2 + Tests/RunCMake/UseSWIG/CMP0078-WARN.cmake | 1 + Tests/RunCMake/UseSWIG/CMP0078-common.cmake | 10 ++++ .../{ObjectLibrary => UseSWIG}/CMakeLists.txt | 0 Tests/RunCMake/UseSWIG/RunCMakeTest.cmake | 5 ++ Tests/RunCMake/UseSWIG/example.i | 2 + Tests/UseSWIG/BasicConfiguration.cmake | 1 - Tests/UseSWIG/BasicCsharp/CMakeLists.txt | 2 +- Tests/UseSWIG/BasicPerl/CMakeLists.txt | 2 +- Tests/UseSWIG/BasicPython/CMakeLists.txt | 2 +- Tests/UseSWIG/ModuleVersion2/CMakeLists.txt | 3 +- Tests/UseSWIG/MultipleModules/CMakeLists.txt | 3 +- Tests/UseSWIG/MultiplePython/CMakeLists.txt | 3 +- .../UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt | 3 +- 34 files changed, 214 insertions(+), 32 deletions(-) create mode 100644 Help/policy/CMP0078.rst create mode 100644 Help/release/dev/UseSWIG-target-name-policy.rst create mode 100644 Help/release/dev/cpack-deb-source-date-epoch.rst copy Tests/RunCMake/CPack/tests/{SUGGESTS => TIMESTAMPS}/ExpectedFiles.cmake (100%) create mode 100644 Tests/RunCMake/CPack/tests/TIMESTAMPS/VerifyResult.cmake create mode 100644 Tests/RunCMake/CPack/tests/TIMESTAMPS/test.cmake create mode 100644 Tests/RunCMake/UseSWIG/CMP0078-NEW-stdout.txt create mode 100644 Tests/RunCMake/UseSWIG/CMP0078-NEW.cmake create mode 100644 Tests/RunCMake/UseSWIG/CMP0078-OLD-stdout.txt create mode 100644 Tests/RunCMake/UseSWIG/CMP0078-OLD.cmake create mode 100644 Tests/RunCMake/UseSWIG/CMP0078-WARN-stderr.txt create mode 100644 Tests/RunCMake/UseSWIG/CMP0078-WARN-stdout.txt create mode 100644 Tests/RunCMake/UseSWIG/CMP0078-WARN.cmake create mode 100644 Tests/RunCMake/UseSWIG/CMP0078-common.cmake copy Tests/RunCMake/{ObjectLibrary => UseSWIG}/CMakeLists.txt (100%) create mode 100644 Tests/RunCMake/UseSWIG/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/UseSWIG/example.i hooks/post-receive -- CMake From kwrobot at kitware.com Sat Jul 28 00:05:12 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 28 Jul 2018 00:05:12 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-319-gcf0d0a2 Message-ID: <20180728040512.EBA7E11DE0F@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 cf0d0a2e6f26c604df9e1d64abac835317bc05ef (commit) from 5bbcf76399e107bbb1712ba8aeee27c160413d2d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cf0d0a2e6f26c604df9e1d64abac835317bc05ef commit cf0d0a2e6f26c604df9e1d64abac835317bc05ef Author: Kitware Robot AuthorDate: Sat Jul 28 00:01:17 2018 -0400 Commit: Kitware Robot CommitDate: Sat Jul 28 00:01:17 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8d037e4..b03b218 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 12) -set(CMake_VERSION_PATCH 20180727) +set(CMake_VERSION_PATCH 20180728) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sun Jul 29 00:05:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 29 Jul 2018 00:05:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-320-g7a7e4e9 Message-ID: <20180729040504.E85A3113B72@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 7a7e4e9ea323839263dc75cb87e80502a5447d7f (commit) from cf0d0a2e6f26c604df9e1d64abac835317bc05ef (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7a7e4e9ea323839263dc75cb87e80502a5447d7f commit 7a7e4e9ea323839263dc75cb87e80502a5447d7f Author: Kitware Robot AuthorDate: Sun Jul 29 00:01:07 2018 -0400 Commit: Kitware Robot CommitDate: Sun Jul 29 00:01:07 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b03b218..c5bb9ca 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 12) -set(CMake_VERSION_PATCH 20180728) +set(CMake_VERSION_PATCH 20180729) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sun Jul 29 05:45:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 29 Jul 2018 05:45:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-322-g50e40b7 Message-ID: <20180729094505.6CABFF72BD@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 50e40b7eecf2ca9aca73b6a907227e8191fffe56 (commit) via ed015bde2b6fe526f5f840f43c1c12ba45d5663f (commit) from 7a7e4e9ea323839263dc75cb87e80502a5447d7f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=50e40b7eecf2ca9aca73b6a907227e8191fffe56 commit 50e40b7eecf2ca9aca73b6a907227e8191fffe56 Merge: 7a7e4e9 ed015bd Author: Craig Scott AuthorDate: Sun Jul 29 09:40:31 2018 +0000 Commit: Kitware Robot CommitDate: Sun Jul 29 05:40:37 2018 -0400 Merge topic 'cpack-default-package-version-zero' ed015bde2b CPack: Restore support for 0-valued version components Acked-by: Kitware Robot Merge-request: !2239 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ed015bde2b6fe526f5f840f43c1c12ba45d5663f commit ed015bde2b6fe526f5f840f43c1c12ba45d5663f Author: Brad King AuthorDate: Thu Jul 26 10:28:54 2018 -0400 Commit: Brad King CommitDate: Fri Jul 27 10:01:29 2018 -0400 CPack: Restore support for 0-valued version components In commit v3.12.0-rc1~136^2 (CPack: Use project version as default for `CPACK_PACKAGE_VERSION`, 2018-04-29) we did not account for the value of `CMAKE_PROJECT_VERSION_{MAJOR,MINOR,PATCH}` having `0`. Fix the logic to distinguish between unprovided version components and `0` components. While at it, add a test case covering the behavior described in the documentation by the original commit. The number of version components in the package name should match those provided to the `project()` command `VERSION` option. Fixes: #18199 diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 8070869..cdc38a6 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -403,28 +403,31 @@ endfunction() # Set the package name _cpack_set_default(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}") -if(CMAKE_PROJECT_VERSION_MAJOR) + +# Set the package version +if(CMAKE_PROJECT_VERSION_MAJOR GREATER_EQUAL 0) _cpack_set_default(CPACK_PACKAGE_VERSION_MAJOR "${CMAKE_PROJECT_VERSION_MAJOR}") - if(CMAKE_PROJECT_VERSION_MINOR) + if(CMAKE_PROJECT_VERSION_MINOR GREATER_EQUAL 0) _cpack_set_default(CPACK_PACKAGE_VERSION_MINOR "${CMAKE_PROJECT_VERSION_MINOR}") - if(CMAKE_PROJECT_VERSION_PATCH) + if(CMAKE_PROJECT_VERSION_PATCH GREATER_EQUAL 0) _cpack_set_default(CPACK_PACKAGE_VERSION_PATCH "${CMAKE_PROJECT_VERSION_PATCH}") - _cpack_set_default(CPACK_PACKAGE_VERSION - "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") - else() - _cpack_set_default(CPACK_PACKAGE_VERSION - "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}") endif() - else() - _cpack_set_default(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}") endif() else() _cpack_set_default(CPACK_PACKAGE_VERSION_MAJOR "0") _cpack_set_default(CPACK_PACKAGE_VERSION_MINOR "1") _cpack_set_default(CPACK_PACKAGE_VERSION_PATCH "1") - _cpack_set_default(CPACK_PACKAGE_VERSION - "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") endif() +if(NOT DEFINED CPACK_PACKAGE_VERSION) + set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}") + if(CPACK_PACKAGE_VERSION_MINOR GREATER_EQUAL 0) + string(APPEND CPACK_PACKAGE_VERSION ".${CPACK_PACKAGE_VERSION_MINOR}") + if(CPACK_PACKAGE_VERSION_PATCH GREATER_EQUAL 0) + string(APPEND CPACK_PACKAGE_VERSION ".${CPACK_PACKAGE_VERSION_PATCH}") + endif() + endif() +endif() + _cpack_set_default(CPACK_PACKAGE_VENDOR "Humanity") if(CMAKE_PROJECT_DESCRIPTION) _cpack_set_default(CPACK_PACKAGE_DESCRIPTION_SUMMARY diff --git a/Tests/RunCMake/CPackConfig/RunCMakeTest.cmake b/Tests/RunCMake/CPackConfig/RunCMakeTest.cmake index 16d2cf3..8f2196d 100644 --- a/Tests/RunCMake/CPackConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPackConfig/RunCMakeTest.cmake @@ -4,3 +4,6 @@ run_cmake(Simple) run_cmake(Default) run_cmake(Special) run_cmake(Verbatim) +run_cmake(Version1) +run_cmake(Version2) +run_cmake(Version3) diff --git a/Tests/RunCMake/CPackConfig/Version1-check.cmake b/Tests/RunCMake/CPackConfig/Version1-check.cmake new file mode 100644 index 0000000..0f5347f --- /dev/null +++ b/Tests/RunCMake/CPackConfig/Version1-check.cmake @@ -0,0 +1,6 @@ +include(${RunCMake_SOURCE_DIR}/check.cmake) + +test_variable(CPACK_PACKAGE_VERSION "0") +test_variable(CPACK_PACKAGE_VERSION_MAJOR "0") +test_variable(CPACK_PACKAGE_VERSION_MINOR "") +test_variable(CPACK_PACKAGE_VERSION_PATCH "") diff --git a/Tests/RunCMake/CPackConfig/Version1.cmake b/Tests/RunCMake/CPackConfig/Version1.cmake new file mode 100644 index 0000000..703485c --- /dev/null +++ b/Tests/RunCMake/CPackConfig/Version1.cmake @@ -0,0 +1 @@ +project(Version LANGUAGES NONE VERSION 0) diff --git a/Tests/RunCMake/CPackConfig/Version2-check.cmake b/Tests/RunCMake/CPackConfig/Version2-check.cmake new file mode 100644 index 0000000..3a2d572 --- /dev/null +++ b/Tests/RunCMake/CPackConfig/Version2-check.cmake @@ -0,0 +1,6 @@ +include(${RunCMake_SOURCE_DIR}/check.cmake) + +test_variable(CPACK_PACKAGE_VERSION "1.0") +test_variable(CPACK_PACKAGE_VERSION_MAJOR "1") +test_variable(CPACK_PACKAGE_VERSION_MINOR "0") +test_variable(CPACK_PACKAGE_VERSION_PATCH "") diff --git a/Tests/RunCMake/CPackConfig/Version2.cmake b/Tests/RunCMake/CPackConfig/Version2.cmake new file mode 100644 index 0000000..c084137 --- /dev/null +++ b/Tests/RunCMake/CPackConfig/Version2.cmake @@ -0,0 +1 @@ +project(Version LANGUAGES NONE VERSION 1.0) diff --git a/Tests/RunCMake/CPackConfig/Version3-check.cmake b/Tests/RunCMake/CPackConfig/Version3-check.cmake new file mode 100644 index 0000000..d4a3983 --- /dev/null +++ b/Tests/RunCMake/CPackConfig/Version3-check.cmake @@ -0,0 +1,6 @@ +include(${RunCMake_SOURCE_DIR}/check.cmake) + +test_variable(CPACK_PACKAGE_VERSION "1.1.0") +test_variable(CPACK_PACKAGE_VERSION_MAJOR "1") +test_variable(CPACK_PACKAGE_VERSION_MINOR "1") +test_variable(CPACK_PACKAGE_VERSION_PATCH "0") diff --git a/Tests/RunCMake/CPackConfig/Version3.cmake b/Tests/RunCMake/CPackConfig/Version3.cmake new file mode 100644 index 0000000..4df28bb --- /dev/null +++ b/Tests/RunCMake/CPackConfig/Version3.cmake @@ -0,0 +1 @@ +project(Version LANGUAGES NONE VERSION 1.1.0) ----------------------------------------------------------------------- Summary of changes: Modules/CPack.cmake | 27 ++++++++++++++----------- Tests/RunCMake/CPackConfig/RunCMakeTest.cmake | 3 +++ Tests/RunCMake/CPackConfig/Version1-check.cmake | 6 ++++++ Tests/RunCMake/CPackConfig/Version1.cmake | 1 + Tests/RunCMake/CPackConfig/Version2-check.cmake | 6 ++++++ Tests/RunCMake/CPackConfig/Version2.cmake | 1 + Tests/RunCMake/CPackConfig/Version3-check.cmake | 6 ++++++ Tests/RunCMake/CPackConfig/Version3.cmake | 1 + 8 files changed, 39 insertions(+), 12 deletions(-) create mode 100644 Tests/RunCMake/CPackConfig/Version1-check.cmake create mode 100644 Tests/RunCMake/CPackConfig/Version1.cmake create mode 100644 Tests/RunCMake/CPackConfig/Version2-check.cmake create mode 100644 Tests/RunCMake/CPackConfig/Version2.cmake create mode 100644 Tests/RunCMake/CPackConfig/Version3-check.cmake create mode 100644 Tests/RunCMake/CPackConfig/Version3.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Sun Jul 29 05:55:02 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 29 Jul 2018 05:55:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-324-g0d8d6ee Message-ID: <20180729095502.5F96C118265@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 0d8d6eeef47e038d9732d3384ca1cc7dc81a746b (commit) via 2af530731707491c8da7c76cfe6ecd35d7c36e57 (commit) from 50e40b7eecf2ca9aca73b6a907227e8191fffe56 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0d8d6eeef47e038d9732d3384ca1cc7dc81a746b commit 0d8d6eeef47e038d9732d3384ca1cc7dc81a746b Merge: 50e40b7 2af5307 Author: Craig Scott AuthorDate: Sun Jul 29 19:46:45 2018 +1000 Commit: Craig Scott CommitDate: Sun Jul 29 19:46:45 2018 +1000 Merge branch 'release-3.12' ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Sun Jul 29 05:55:02 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 29 Jul 2018 05:55:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.12.0-17-g2af5307 Message-ID: <20180729095502.A25DF11D1E5@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via 2af530731707491c8da7c76cfe6ecd35d7c36e57 (commit) via ed015bde2b6fe526f5f840f43c1c12ba45d5663f (commit) from 8442d9fc3fe71c12dd613ba585b196da93d6d9f1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Modules/CPack.cmake | 27 ++++++++++++++----------- Tests/RunCMake/CPackConfig/RunCMakeTest.cmake | 3 +++ Tests/RunCMake/CPackConfig/Version1-check.cmake | 6 ++++++ Tests/RunCMake/CPackConfig/Version1.cmake | 1 + Tests/RunCMake/CPackConfig/Version2-check.cmake | 6 ++++++ Tests/RunCMake/CPackConfig/Version2.cmake | 1 + Tests/RunCMake/CPackConfig/Version3-check.cmake | 6 ++++++ Tests/RunCMake/CPackConfig/Version3.cmake | 1 + 8 files changed, 39 insertions(+), 12 deletions(-) create mode 100644 Tests/RunCMake/CPackConfig/Version1-check.cmake create mode 100644 Tests/RunCMake/CPackConfig/Version1.cmake create mode 100644 Tests/RunCMake/CPackConfig/Version2-check.cmake create mode 100644 Tests/RunCMake/CPackConfig/Version2.cmake create mode 100644 Tests/RunCMake/CPackConfig/Version3-check.cmake create mode 100644 Tests/RunCMake/CPackConfig/Version3.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jul 30 00:05:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 30 Jul 2018 00:05:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-325-g264012d Message-ID: <20180730040504.F3C6B110A76@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 264012dae0cdefac1c7f152ce6aefe5bb0dddf40 (commit) from 0d8d6eeef47e038d9732d3384ca1cc7dc81a746b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=264012dae0cdefac1c7f152ce6aefe5bb0dddf40 commit 264012dae0cdefac1c7f152ce6aefe5bb0dddf40 Author: Kitware Robot AuthorDate: Mon Jul 30 00:01:11 2018 -0400 Commit: Kitware Robot CommitDate: Mon Jul 30 00:01:11 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index c5bb9ca..0acb5fd 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 12) -set(CMake_VERSION_PATCH 20180729) +set(CMake_VERSION_PATCH 20180730) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jul 31 00:05:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 31 Jul 2018 00:05:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-326-g398ce17 Message-ID: <20180731040504.9FF4D11D8C4@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 398ce17faca27b146ebe6c161c435626f6e05674 (commit) from 264012dae0cdefac1c7f152ce6aefe5bb0dddf40 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=398ce17faca27b146ebe6c161c435626f6e05674 commit 398ce17faca27b146ebe6c161c435626f6e05674 Author: Kitware Robot AuthorDate: Tue Jul 31 00:01:05 2018 -0400 Commit: Kitware Robot CommitDate: Tue Jul 31 00:01:05 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0acb5fd..a7e64fc 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 12) -set(CMake_VERSION_PATCH 20180730) +set(CMake_VERSION_PATCH 20180731) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jul 31 08:15:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 31 Jul 2018 08:15:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.12.0-334-gc31d9f1 Message-ID: <20180731121504.AC9D41121BF@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 c31d9f1c30bddef091517a777936362a403b49b2 (commit) via 7bb70054e443813dfc21d1b4acc0e719b40f55d8 (commit) via f3451358456dc10169f56bfbd2de7d311df1eef3 (commit) via 2d6cfe26770d8062081061f9dbcc4e3e6eaa0091 (commit) via 84bdae88950584663702be1cab3adf5d8069c58c (commit) via 8e0d70272d9be5149608ed7441852f53c48c180f (commit) via 5776639fbfe5b8da5ca7a4fbae31936cdeff6660 (commit) via 2e9199b291879d9a47759faa178fb2f35b12bd64 (commit) from 398ce17faca27b146ebe6c161c435626f6e05674 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c31d9f1c30bddef091517a777936362a403b49b2 commit c31d9f1c30bddef091517a777936362a403b49b2 Merge: 398ce17 7bb7005 Author: Brad King AuthorDate: Tue Jul 31 12:07:54 2018 +0000 Commit: Kitware Robot CommitDate: Tue Jul 31 08:08:05 2018 -0400 Merge topic 'autogen_refactor_initialization' 7bb70054e4 Autogen: Add test for Q_OS_ macros f345135845 Autogen: For Qt5 pass all implicit include directories to moc 2d6cfe2677 Autogen: Split initializer main method 84bdae8895 Autogen: Compute variables in Init stage instead of Setup stage 8e0d70272d Autogen: Move info file write code into methods 5776639fbf Autogen: Pass absolute include path in info file 2e9199b291 cmLocalGenerator: Respect user requested implicit include directories order Acked-by: Kitware Robot Merge-request: !2230 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7bb70054e443813dfc21d1b4acc0e719b40f55d8 commit 7bb70054e443813dfc21d1b4acc0e719b40f55d8 Author: Sebastian Holtermann AuthorDate: Sun Jul 22 19:02:39 2018 +0200 Commit: Sebastian Holtermann CommitDate: Mon Jul 30 09:46:03 2018 +0200 Autogen: Add test for Q_OS_ macros diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index cd05aeb..55d36e6 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -23,6 +23,9 @@ endif() if(QT_TEST_ALLOW_QT_MACROS) ADD_AUTOGEN_TEST(MocCMP0071) endif() +if(NOT QT_TEST_VERSION STREQUAL 4) + ADD_AUTOGEN_TEST(MocOsMacros mocOsMacros) +endif() ADD_AUTOGEN_TEST(UicInclude uicInclude) ADD_AUTOGEN_TEST(UicInterface QtAutoUicInterface) ADD_AUTOGEN_TEST(ObjectLibrary someProgram) diff --git a/Tests/QtAutogen/MocOsMacros/CMakeLists.txt b/Tests/QtAutogen/MocOsMacros/CMakeLists.txt new file mode 100644 index 0000000..51a0ebd --- /dev/null +++ b/Tests/QtAutogen/MocOsMacros/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.11) +project(MocOsMacros) +include("../AutogenTest.cmake") + +# Tests if moc processes the macro Q_OS_MAC + +set(CMAKE_AUTOMOC True) + +add_executable(mocOsMacros + main.cpp + TestClass.cpp + TestClass.hpp +) +target_link_libraries(mocOsMacros PRIVATE ${QT_QTCORE_TARGET}) + +message ( "CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES: ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}" ) diff --git a/Tests/QtAutogen/MocOsMacros/TestClass.cpp b/Tests/QtAutogen/MocOsMacros/TestClass.cpp new file mode 100644 index 0000000..340d130 --- /dev/null +++ b/Tests/QtAutogen/MocOsMacros/TestClass.cpp @@ -0,0 +1,77 @@ +#include "TestClass.hpp" +#include + +// -- Mac +#ifndef Q_OS_MAC +void TestClass::MacNotDef() +{ + std::cout << "MacNotDef\n"; +} +#else +void TestClass::MacNotDefElse() +{ + std::cout << "MacNotDefElse\n"; +} +#endif + +#ifdef Q_OS_MAC +void TestClass::MacDef() +{ + std::cout << "MacDef\n"; +} +#else +void TestClass::MacDefElse() +{ + std::cout << "MacDefElse\n"; +} +#endif + +// -- Unix +#ifndef Q_OS_UNIX +void TestClass::UnixNotDef() +{ + std::cout << "UnixNotDef\n"; +} +#else +void TestClass::UnixNotDefElse() +{ + std::cout << "UnixNotDefElse\n"; +} +#endif + +#ifdef Q_OS_UNIX +void TestClass::UnixDef() +{ + std::cout << "UnixDef\n"; +} +#else +void TestClass::UnixDefElse() +{ + std::cout << "UnixDefElse\n"; +} +#endif + +// -- Windows +#ifndef Q_OS_WIN +void TestClass::WindowsNotDef() +{ + std::cout << "WindowsNotDef\n"; +} +#else +void TestClass::WindowsNotDefElse() +{ + std::cout << "WindowsNotDefElse\n"; +} +#endif + +#ifdef Q_OS_WIN +void TestClass::WindowsDef() +{ + std::cout << "WindowsDef\n"; +} +#else +void TestClass::WindowsDefElse() +{ + std::cout << "WindowsDefElse\n"; +} +#endif diff --git a/Tests/QtAutogen/MocOsMacros/TestClass.hpp b/Tests/QtAutogen/MocOsMacros/TestClass.hpp new file mode 100644 index 0000000..53000aa --- /dev/null +++ b/Tests/QtAutogen/MocOsMacros/TestClass.hpp @@ -0,0 +1,52 @@ +#ifndef TestClass_hpp +#define TestClass_hpp + +#include +#include + +class TestClass : public QObject +{ + Q_OBJECT +public Q_SLOTS: + +// -- Mac +#ifndef Q_OS_MAC + void MacNotDef(); +#else + void MacNotDefElse(); +#endif + +#ifdef Q_OS_MAC + void MacDef(); +#else + void MacDefElse(); +#endif + +// -- Unix +#ifndef Q_OS_UNIX + void UnixNotDef(); +#else + void UnixNotDefElse(); +#endif + +#ifdef Q_OS_UNIX + void UnixDef(); +#else + void UnixDefElse(); +#endif + +// -- Windows +#ifndef Q_OS_WIN + void WindowsNotDef(); +#else + void WindowsNotDefElse(); +#endif + +#ifdef Q_OS_WIN + void WindowsDef(); +#else + void WindowsDefElse(); +#endif +}; + +#endif /* TestClass_hpp */ diff --git a/Tests/QtAutogen/MocOsMacros/main.cpp b/Tests/QtAutogen/MocOsMacros/main.cpp new file mode 100644 index 0000000..f8eec3c --- /dev/null +++ b/Tests/QtAutogen/MocOsMacros/main.cpp @@ -0,0 +1,32 @@ +#include "TestClass.hpp" +#include + +int main() +{ + TestClass a; +#ifdef Q_OS_MAC + a.MacNotDefElse(); + a.MacDef(); +#else + a.MacNotDef(); + a.MacDefElse(); +#endif + +#ifdef Q_OS_UNIX + a.UnixNotDefElse(); + a.UnixDef(); +#else + a.UnixNotDef(); + a.UnixDefElse(); +#endif + +#ifdef Q_OS_WIN + a.WindowsNotDefElse(); + a.WindowsDef(); +#else + a.WindowsNotDef(); + a.WindowsDefElse(); +#endif + + return 0; +} https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f3451358456dc10169f56bfbd2de7d311df1eef3 commit f3451358456dc10169f56bfbd2de7d311df1eef3 Author: Sebastian Holtermann AuthorDate: Wed Jul 25 13:42:45 2018 +0200 Commit: Sebastian Holtermann CommitDate: Mon Jul 30 09:22:47 2018 +0200 Autogen: For Qt5 pass all implicit include directories to moc For Qt4 it was not possible to pass all compiler implicit include directories to moc because it couldn't handle some system headers. For reference see commit 753b905ec86ffe369d4f59a7a8ced5fedc42939f, commit d2536579d51e77827b8e55f39123316324314781 and [QTBUG-28045](https://bugreports.qt.io/browse/QTBUG-28045). For Qt5's moc the problem does not persist anymore so we can (and should) pass all implicit include directories to moc. Fixes #18041 diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 607afbf..7cfdeba 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -380,13 +380,15 @@ bool cmQtAutoGenInitializer::InitMoc() // Moc includes { - auto GetIncludeDirs = [this, - localGen](std::string const& cfg) -> std::string { + bool const appendImplicit = (this->QtVersionMajor == "5"); + auto GetIncludeDirs = + [this, localGen, appendImplicit](std::string const& cfg) -> std::string { // Get the include dirs for this target, without stripping the implicit // include dirs off, see // https://gitlab.kitware.com/cmake/cmake/issues/13667 std::vector dirs; - localGen->GetIncludeDirectories(dirs, this->Target, "CXX", cfg, false); + localGen->GetIncludeDirectories(dirs, this->Target, "CXX", cfg, false, + appendImplicit); return cmJoin(dirs, ";"); }; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2d6cfe26770d8062081061f9dbcc4e3e6eaa0091 commit 2d6cfe26770d8062081061f9dbcc4e3e6eaa0091 Author: Sebastian Holtermann AuthorDate: Sun Jul 22 16:09:18 2018 +0200 Commit: Sebastian Holtermann CommitDate: Mon Jul 30 09:22:47 2018 +0200 Autogen: Split initializer main method diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 22f9caf..607afbf 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -195,15 +195,13 @@ bool cmQtAutoGenInitializer::InitCustomTargets() cmGlobalGenerator* globalGen = localGen->GetGlobalGenerator(); // Verbosity - { - this->Verbosity = makefile->GetSafeDefinition("CMAKE_AUTOGEN_VERBOSE"); - if (!this->Verbosity.empty()) { - unsigned long iVerb = 0; - if (!cmSystemTools::StringToULong(this->Verbosity.c_str(), &iVerb)) { - // Non numeric verbosity - this->Verbosity = - cmSystemTools::IsOn(this->Verbosity.c_str()) ? "1" : "0"; - } + this->Verbosity = makefile->GetSafeDefinition("CMAKE_AUTOGEN_VERBOSE"); + if (!this->Verbosity.empty()) { + unsigned long iVerb = 0; + if (!cmSystemTools::StringToULong(this->Verbosity.c_str(), &iVerb)) { + // Non numeric verbosity + this->Verbosity = + cmSystemTools::IsOn(this->Verbosity.c_str()) ? "1" : "0"; } } @@ -247,6 +245,8 @@ bool cmQtAutoGenInitializer::InitCustomTargets() this->DirBuild += this->AutogenTargetName; } cmSystemTools::ConvertToUnixSlashes(this->DirBuild); + // Remove build directories on cleanup + AddCleanFile(makefile, this->DirBuild); // Working directory this->DirWork = cbd; @@ -268,13 +268,23 @@ bool cmQtAutoGenInitializer::InitCustomTargets() } } - // Autogen files + // Autogen info and settings files { this->AutogenInfoFile = this->DirInfo; this->AutogenInfoFile += "/AutogenInfo.cmake"; this->AutogenSettingsFile = this->DirInfo; this->AutogenSettingsFile += "/AutogenOldSettings.txt"; + + if (this->MultiConfig) { + for (std::string const& cfg : this->ConfigsList) { + std::string& filename = this->AutogenConfigSettingsFile[cfg]; + filename = AppendFilenameSuffix(this->AutogenSettingsFile, "_" + cfg); + AddCleanFile(makefile, filename); + } + } else { + AddCleanFile(makefile, this->AutogenSettingsFile); + } } // Autogen target FOLDER property @@ -294,60 +304,228 @@ bool cmQtAutoGenInitializer::InitCustomTargets() } } - std::set autogenDependFiles; - std::set autogenDependTargets; - std::vector autogenProvides; + if (this->Moc.Enabled || this->Uic.Enabled) { + // Init moc specific settings + if (this->Moc.Enabled && !InitMoc()) { + return false; + } + // Init uic specific settings + if (this->Uic.Enabled && !InitUic()) { + return false; + } + + // Autogen target: Compute user defined dependencies + { + std::string const deps = + this->Target->GetSafeProperty("AUTOGEN_TARGET_DEPENDS"); + if (!deps.empty()) { + std::vector extraDeps; + cmSystemTools::ExpandListArgument(deps, extraDeps); + for (std::string const& depName : extraDeps) { + // Allow target and file dependencies + auto* depTarget = makefile->FindTargetToUse(depName); + if (depTarget != nullptr) { + this->AutogenDependTargets.insert(depTarget); + } else { + this->AutogenDependFiles.insert(depName); + } + } + } + } + } + // Init rcc specific settings + if (this->Rcc.Enabled && !InitRcc()) { + return false; + } + + // Add autogen include directory to the origin target INCLUDE_DIRECTORIES + if (this->Moc.Enabled || this->Uic.Enabled || + (this->Rcc.Enabled && this->MultiConfig)) { + this->Target->AddIncludeDirectory(this->DirInclude, true); + } + + // Scan files + if (!this->InitScanFiles()) { + return false; + } + + // Create autogen target + if ((this->Moc.Enabled || this->Uic.Enabled) && !this->InitAutogenTarget()) { + return false; + } - // Remove build directories on cleanup - AddCleanFile(makefile, this->DirBuild); - // Remove old settings on cleanup + // Create rcc targets + if (this->Rcc.Enabled && !this->InitRccTargets()) { + return false; + } + + return true; +} + +bool cmQtAutoGenInitializer::InitMoc() +{ + cmMakefile* makefile = this->Target->Target->GetMakefile(); + cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); + + // Mocs compilation file + this->Moc.MocsCompilation = this->DirBuild; + this->Moc.MocsCompilation += "/mocs_compilation.cpp"; + + // Moc predefs command + if (this->Target->GetPropertyAsBool("AUTOMOC_COMPILER_PREDEFINES") && + this->QtVersionGreaterOrEqual(5, 8)) { + this->Moc.PredefsCmd = + makefile->GetSafeDefinition("CMAKE_CXX_COMPILER_PREDEFINES_COMMAND"); + } + + // Moc includes { - std::string base = this->DirInfo; - base += "/AutogenOldSettings"; + auto GetIncludeDirs = [this, + localGen](std::string const& cfg) -> std::string { + // Get the include dirs for this target, without stripping the implicit + // include dirs off, see + // https://gitlab.kitware.com/cmake/cmake/issues/13667 + std::vector dirs; + localGen->GetIncludeDirectories(dirs, this->Target, "CXX", cfg, false); + return cmJoin(dirs, ";"); + }; + + // Default configuration include directories + this->Moc.Includes = GetIncludeDirs(this->ConfigDefault); + // Other configuration settings if (this->MultiConfig) { for (std::string const& cfg : this->ConfigsList) { - std::string filename = base; - filename += '_'; - filename += cfg; - filename += ".cmake"; - AddCleanFile(makefile, filename); + std::string dirs = GetIncludeDirs(cfg); + if (dirs != this->Moc.Includes) { + this->Moc.ConfigIncludes[cfg] = std::move(dirs); + } } - } else { - AddCleanFile(makefile, base.append(".cmake")); } } - if (this->Moc.Enabled && !InitCustomTargetsMoc()) { - return false; + // Moc compile definitions + { + auto GetCompileDefinitions = + [this, localGen](std::string const& cfg) -> std::string { + std::set defines; + localGen->AddCompileDefinitions(defines, this->Target, cfg, "CXX"); + return cmJoin(defines, ";"); + }; + + // Default configuration defines + this->Moc.Defines = GetCompileDefinitions(this->ConfigDefault); + // Other configuration defines + if (this->MultiConfig) { + for (std::string const& cfg : this->ConfigsList) { + std::string defines = GetCompileDefinitions(cfg); + if (defines != this->Moc.Defines) { + this->Moc.ConfigDefines[cfg] = std::move(defines); + } + } + } } - if (this->Uic.Enabled && !InitCustomTargetsUic()) { + + // Moc executable + if (!GetMocExecutable()) { return false; } - if (this->Uic.Enabled && !InitCustomTargetsRcc()) { - return false; + + return true; +} + +bool cmQtAutoGenInitializer::InitUic() +{ + cmMakefile* makefile = this->Target->Target->GetMakefile(); + + // Uic search paths + { + std::string const usp = + this->Target->GetSafeProperty("AUTOUIC_SEARCH_PATHS"); + if (!usp.empty()) { + cmSystemTools::ExpandListArgument(usp, this->Uic.SearchPaths); + std::string const srcDir = makefile->GetCurrentSourceDirectory(); + for (std::string& path : this->Uic.SearchPaths) { + path = cmSystemTools::CollapseFullPath(path, srcDir); + } + } } + // Uic target options + { + auto UicGetOpts = [this](std::string const& cfg) -> std::string { + std::vector opts; + this->Target->GetAutoUicOptions(opts, cfg); + return cmJoin(opts, ";"); + }; - // Acquire rcc executable and features - if (this->Rcc.Enabled) { - if (!GetRccExecutable()) { - return false; + // Default settings + this->Uic.Options = UicGetOpts(this->ConfigDefault); + + // Configuration specific settings + if (this->MultiConfig) { + for (std::string const& cfg : this->ConfigsList) { + std::string options = UicGetOpts(cfg); + if (options != this->Uic.Options) { + this->Uic.ConfigOptions[cfg] = std::move(options); + } + } + } + } + // .ui files skip and options + { + std::string const uiExt = "ui"; + std::string pathError; + for (cmSourceFile* sf : makefile->GetSourceFiles()) { + // sf->GetExtension() is only valid after sf->GetFullPath() ... + // Since we're iterating over source files that might be not in the + // target we need to check for path errors (not existing files). + std::string const& fPath = sf->GetFullPath(&pathError); + if (!pathError.empty()) { + pathError.clear(); + continue; + } + if (sf->GetExtension() == uiExt) { + std::string const absFile = cmSystemTools::GetRealPath(fPath); + // Check if the .ui file should be skipped + if (sf->GetPropertyAsBool("SKIP_AUTOUIC") || + sf->GetPropertyAsBool("SKIP_AUTOGEN")) { + this->Uic.Skip.insert(absFile); + } + // Check if the .ui file has uic options + std::string const uicOpts = sf->GetSafeProperty("AUTOUIC_OPTIONS"); + if (!uicOpts.empty()) { + // Check if file isn't skipped + if (this->Uic.Skip.count(absFile) == 0) { + this->Uic.FileFiles.push_back(absFile); + std::vector optsVec; + cmSystemTools::ExpandListArgument(uicOpts, optsVec); + this->Uic.FileOptions.push_back(std::move(optsVec)); + } + } + } } } - // Add autogen includes directory to the origin target INCLUDE_DIRECTORIES - if (this->Moc.Enabled || this->Uic.Enabled || - (this->Rcc.Enabled && this->MultiConfig)) { - this->Target->AddIncludeDirectory(this->DirInclude, true); + // Uic executable + if (!GetUicExecutable()) { + return false; } - if (this->Moc.Enabled) { - this->AddGeneratedSource(this->Moc.MocsCompilation, GeneratorT::MOC); - autogenProvides.push_back(this->Moc.MocsCompilation); + return true; +} + +bool cmQtAutoGenInitializer::InitRcc() +{ + if (!GetRccExecutable()) { + return false; } + return true; +} + +bool cmQtAutoGenInitializer::InitScanFiles() +{ + cmMakefile* makefile = this->Target->Target->GetMakefile(); - // Extract relevant source files - std::vector generatedSources; - std::vector generatedHeaders; + // Scan through target files { std::string const qrcExt = "qrc"; std::vector srcFiles; @@ -372,15 +550,15 @@ bool cmQtAutoGenInitializer::InitCustomTargets() const bool generated = sf->GetPropertyAsBool("GENERATED"); if (fileType == cmSystemTools::HEADER_FILE_FORMAT) { if (generated) { - generatedHeaders.push_back(absPath); + this->MocUic.HeadersGenerated.push_back(absPath); } else { - this->Headers.push_back(absPath); + this->MocUic.Headers.push_back(absPath); } } else { if (generated) { - generatedSources.push_back(absPath); + this->MocUic.SourcesGenerated.push_back(absPath); } else { - this->Sources.push_back(absPath); + this->MocUic.Sources.push_back(absPath); } } } @@ -407,125 +585,126 @@ bool cmQtAutoGenInitializer::InitCustomTargets() } } } - // cmGeneratorTarget::GetConfigCommonSourceFiles computes the target's - // sources meta data cache. Clear it so that OBJECT library targets that - // are AUTOGEN initialized after this target get their added - // mocs_compilation.cpp source acknowledged by this target. - this->Target->ClearSourcesCache(); } - // Read skip files from makefile sources + // cmGeneratorTarget::GetConfigCommonSourceFiles computes the target's + // sources meta data cache. Clear it so that OBJECT library targets that + // are AUTOGEN initialized after this target get their added + // mocs_compilation.cpp source acknowledged by this target. + this->Target->ClearSourcesCache(); + if (this->Moc.Enabled || this->Uic.Enabled) { - std::string pathError; - for (cmSourceFile* sf : makefile->GetSourceFiles()) { - // sf->GetExtension() is only valid after sf->GetFullPath() ... - // Since we're iterating over source files that might be not in the - // target we need to check for path errors (not existing files). - std::string const& fPath = sf->GetFullPath(&pathError); - if (!pathError.empty()) { - pathError.clear(); - continue; - } - cmSystemTools::FileFormat const fileType = - cmSystemTools::GetFileFormat(sf->GetExtension().c_str()); - if (!(fileType == cmSystemTools::CXX_FILE_FORMAT) && - !(fileType == cmSystemTools::HEADER_FILE_FORMAT)) { - continue; - } - const bool skipAll = sf->GetPropertyAsBool("SKIP_AUTOGEN"); - const bool mocSkip = this->Moc.Enabled && - (skipAll || sf->GetPropertyAsBool("SKIP_AUTOMOC")); - const bool uicSkip = this->Uic.Enabled && - (skipAll || sf->GetPropertyAsBool("SKIP_AUTOUIC")); - if (mocSkip || uicSkip) { - std::string const absFile = cmSystemTools::GetRealPath(fPath); - if (mocSkip) { - this->Moc.Skip.insert(absFile); + // Read skip files from makefile sources + { + std::string pathError; + for (cmSourceFile* sf : makefile->GetSourceFiles()) { + // sf->GetExtension() is only valid after sf->GetFullPath() ... + // Since we're iterating over source files that might be not in the + // target we need to check for path errors (not existing files). + std::string const& fPath = sf->GetFullPath(&pathError); + if (!pathError.empty()) { + pathError.clear(); + continue; } - if (uicSkip) { - this->Uic.Skip.insert(absFile); + cmSystemTools::FileFormat const fileType = + cmSystemTools::GetFileFormat(sf->GetExtension().c_str()); + if (!(fileType == cmSystemTools::CXX_FILE_FORMAT) && + !(fileType == cmSystemTools::HEADER_FILE_FORMAT)) { + continue; + } + const bool skipAll = sf->GetPropertyAsBool("SKIP_AUTOGEN"); + const bool mocSkip = this->Moc.Enabled && + (skipAll || sf->GetPropertyAsBool("SKIP_AUTOMOC")); + const bool uicSkip = this->Uic.Enabled && + (skipAll || sf->GetPropertyAsBool("SKIP_AUTOUIC")); + if (mocSkip || uicSkip) { + std::string const absFile = cmSystemTools::GetRealPath(fPath); + if (mocSkip) { + this->Moc.Skip.insert(absFile); + } + if (uicSkip) { + this->Uic.Skip.insert(absFile); + } } } } - } - - // Process GENERATED sources and headers - if (!generatedSources.empty() || !generatedHeaders.empty()) { - // Check status of policy CMP0071 - bool policyAccept = false; - bool policyWarn = false; - cmPolicies::PolicyStatus const CMP0071_status = - makefile->GetPolicyStatus(cmPolicies::CMP0071); - switch (CMP0071_status) { - case cmPolicies::WARN: - policyWarn = true; - CM_FALLTHROUGH; - case cmPolicies::OLD: - // Ignore GENERATED file - break; - case cmPolicies::REQUIRED_IF_USED: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::NEW: - // Process GENERATED file - policyAccept = true; - break; - } - if (policyAccept) { - // Accept GENERATED sources - for (std::string const& absFile : generatedHeaders) { - this->Headers.push_back(absFile); - autogenDependFiles.insert(absFile); - } - for (std::string const& absFile : generatedSources) { - this->Sources.push_back(absFile); - autogenDependFiles.insert(absFile); + // Process GENERATED sources and headers + if (!this->MocUic.SourcesGenerated.empty() || + !this->MocUic.HeadersGenerated.empty()) { + // Check status of policy CMP0071 + bool policyAccept = false; + bool policyWarn = false; + cmPolicies::PolicyStatus const CMP0071_status = + makefile->GetPolicyStatus(cmPolicies::CMP0071); + switch (CMP0071_status) { + case cmPolicies::WARN: + policyWarn = true; + CM_FALLTHROUGH; + case cmPolicies::OLD: + // Ignore GENERATED file + break; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::NEW: + // Process GENERATED file + policyAccept = true; + break; } - } else { - if (policyWarn) { - std::string msg; - msg += cmPolicies::GetPolicyWarning(cmPolicies::CMP0071); - msg += "\n"; - std::string tools; - std::string property; - if (this->Moc.Enabled && this->Uic.Enabled) { - tools = "AUTOMOC and AUTOUIC"; - property = "SKIP_AUTOGEN"; - } else if (this->Moc.Enabled) { - tools = "AUTOMOC"; - property = "SKIP_AUTOMOC"; - } else if (this->Uic.Enabled) { - tools = "AUTOUIC"; - property = "SKIP_AUTOUIC"; + + if (policyAccept) { + // Accept GENERATED sources + for (std::string const& absFile : this->MocUic.HeadersGenerated) { + this->MocUic.Headers.push_back(absFile); + this->AutogenDependFiles.insert(absFile); } - msg += "For compatibility, CMake is excluding the GENERATED source " - "file(s):\n"; - for (const std::string& absFile : generatedHeaders) { - msg.append(" ").append(Quoted(absFile)).append("\n"); + for (std::string const& absFile : this->MocUic.SourcesGenerated) { + this->MocUic.Sources.push_back(absFile); + this->AutogenDependFiles.insert(absFile); } - for (const std::string& absFile : generatedSources) { - msg.append(" ").append(Quoted(absFile)).append("\n"); + } else { + if (policyWarn) { + std::string msg; + msg += cmPolicies::GetPolicyWarning(cmPolicies::CMP0071); + msg += "\n"; + std::string tools; + std::string property; + if (this->Moc.Enabled && this->Uic.Enabled) { + tools = "AUTOMOC and AUTOUIC"; + property = "SKIP_AUTOGEN"; + } else if (this->Moc.Enabled) { + tools = "AUTOMOC"; + property = "SKIP_AUTOMOC"; + } else if (this->Uic.Enabled) { + tools = "AUTOUIC"; + property = "SKIP_AUTOUIC"; + } + msg += "For compatibility, CMake is excluding the GENERATED source " + "file(s):\n"; + for (const std::string& absFile : this->MocUic.HeadersGenerated) { + msg.append(" ").append(Quoted(absFile)).append("\n"); + } + for (const std::string& absFile : this->MocUic.SourcesGenerated) { + msg.append(" ").append(Quoted(absFile)).append("\n"); + } + msg += "from processing by "; + msg += tools; + msg += + ". If any of the files should be processed, set CMP0071 to NEW. " + "If any of the files should not be processed, " + "explicitly exclude them by setting the source file property "; + msg += property; + msg += ":\n set_property(SOURCE file.h PROPERTY "; + msg += property; + msg += " ON)\n"; + makefile->IssueMessage(cmake::AUTHOR_WARNING, msg); } - msg += "from processing by "; - msg += tools; - msg += - ". If any of the files should be processed, set CMP0071 to NEW. " - "If any of the files should not be processed, " - "explicitly exclude them by setting the source file property "; - msg += property; - msg += ":\n set_property(SOURCE file.h PROPERTY "; - msg += property; - msg += " ON)\n"; - makefile->IssueMessage(cmake::AUTHOR_WARNING, msg); } } - // Clear lists - generatedSources.clear(); - generatedHeaders.clear(); - } - // Sort headers and sources - if (this->Moc.Enabled || this->Uic.Enabled) { - std::sort(this->Headers.begin(), this->Headers.end()); - std::sort(this->Sources.begin(), this->Sources.end()); + // Sort headers and sources + if (this->Moc.Enabled || this->Uic.Enabled) { + std::sort(this->MocUic.Headers.begin(), this->MocUic.Headers.end()); + std::sort(this->MocUic.Sources.begin(), this->MocUic.Sources.end()); + } } // Process qrc files @@ -576,6 +755,13 @@ bool cmQtAutoGenInitializer::InitCustomTargets() qrc.SettingsFile = base; qrc.SettingsFile += "Settings.txt"; + + if (this->MultiConfig) { + for (std::string const& cfg : this->ConfigsList) { + qrc.ConfigSettingsFile[cfg] = + AppendFilenameSuffix(qrc.SettingsFile, "_" + cfg); + } + } } } } @@ -601,401 +787,258 @@ bool cmQtAutoGenInitializer::InitCustomTargets() RccMergeOptions(opts, qrc.Options, QtV5); qrc.Options = std::move(opts); } + // RCC resources for (Qrc& qrc : this->Rcc.Qrcs) { - // Register file at target - this->AddGeneratedSource(qrc.RccFile, GeneratorT::RCC); - - std::vector ccOutput; - ccOutput.push_back(qrc.RccFile); - - cmCustomCommandLines commandLines; - if (this->MultiConfig) { - // Build for all configurations - for (std::string const& config : this->ConfigsList) { - cmCustomCommandLine currentLine; - currentLine.push_back(cmSystemTools::GetCMakeCommand()); - currentLine.push_back("-E"); - currentLine.push_back("cmake_autorcc"); - currentLine.push_back(qrc.InfoFile); - currentLine.push_back(config); - commandLines.push_back(std::move(currentLine)); + if (!qrc.Generated) { + std::string error; + if (!RccListInputs(qrc.QrcFile, qrc.Resources, error)) { + cmSystemTools::Error(error.c_str()); + return false; } - } else { - cmCustomCommandLine currentLine; - currentLine.push_back(cmSystemTools::GetCMakeCommand()); - currentLine.push_back("-E"); - currentLine.push_back("cmake_autorcc"); - currentLine.push_back(qrc.InfoFile); - currentLine.push_back("$"); - commandLines.push_back(std::move(currentLine)); } - std::string ccComment = "Automatic RCC for "; - ccComment += FileProjectRelativePath(makefile, qrc.QrcFile); + } + } - if (qrc.Generated) { - // Create custom rcc target - std::string ccName; - { - ccName = this->Target->GetName(); - ccName += "_arcc_"; - ccName += qrc.QrcName; - if (!qrc.Unique) { - ccName += "_"; - ccName += qrc.PathChecksum; - } - std::vector ccDepends; - // Add the .qrc and info file to the custom target dependencies - ccDepends.push_back(qrc.QrcFile); - ccDepends.push_back(qrc.InfoFile); - - cmTarget* autoRccTarget = makefile->AddUtilityCommand( - ccName, cmMakefile::TargetOrigin::Generator, true, - this->DirWork.c_str(), ccOutput, ccDepends, commandLines, false, - ccComment.c_str()); - // Create autogen generator target - localGen->AddGeneratorTarget( - new cmGeneratorTarget(autoRccTarget, localGen)); - - // Set FOLDER property in autogen target - if (!this->AutogenFolder.empty()) { - autoRccTarget->SetProperty("FOLDER", this->AutogenFolder.c_str()); - } - } - // Add autogen target to the origin target dependencies - this->Target->Target->AddUtility(ccName, makefile); - } else { - // Create custom rcc command - { - std::vector ccByproducts; - std::vector ccDepends; - // Add the .qrc and info file to the custom command dependencies - ccDepends.push_back(qrc.QrcFile); - ccDepends.push_back(qrc.InfoFile); + return true; +} - // Add the resource files to the dependencies - { - std::string error; - if (RccListInputs(qrc.QrcFile, qrc.Resources, error)) { - for (std::string const& fileName : qrc.Resources) { - // Add resource file to the custom command dependencies - ccDepends.push_back(fileName); - } - } else { - cmSystemTools::Error(error.c_str()); - return false; - } - } - makefile->AddCustomCommandToOutput(ccOutput, ccByproducts, ccDepends, - /*main_dependency*/ std::string(), - commandLines, ccComment.c_str(), - this->DirWork.c_str()); - } - // Reconfigure when .qrc file changes - makefile->AddCMakeDependFile(qrc.QrcFile); - } - } +bool cmQtAutoGenInitializer::InitAutogenTarget() +{ + cmMakefile* makefile = this->Target->Target->GetMakefile(); + cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); + cmGlobalGenerator* globalGen = localGen->GetGlobalGenerator(); + + // Register info file as generated by CMake + makefile->AddCMakeOutputFile(this->AutogenInfoFile); + + // Files provided by the autogen target + std::vector autogenProvides; + if (this->Moc.Enabled) { + this->AddGeneratedSource(this->Moc.MocsCompilation, GeneratorT::MOC); + autogenProvides.push_back(this->Moc.MocsCompilation); } - // Create _autogen target - if (this->Moc.Enabled || this->Uic.Enabled) { - // Add user defined autogen target dependencies - { - std::string const deps = - this->Target->GetSafeProperty("AUTOGEN_TARGET_DEPENDS"); - if (!deps.empty()) { - std::vector extraDeps; - cmSystemTools::ExpandListArgument(deps, extraDeps); - for (std::string const& depName : extraDeps) { - // Allow target and file dependencies - auto* depTarget = makefile->FindTargetToUse(depName); - if (depTarget != nullptr) { - autogenDependTargets.insert(depTarget); - } else { - autogenDependFiles.insert(depName); - } - } - } + // Compose target comment + std::string autogenComment; + { + std::string tools; + if (this->Moc.Enabled) { + tools += "MOC"; } - - // Compose target comment - std::string autogenComment; - { - std::string tools; - if (this->Moc.Enabled) { - tools += "MOC"; - } - if (this->Uic.Enabled) { - if (!tools.empty()) { - tools += " and "; - } - tools += "UIC"; + if (this->Uic.Enabled) { + if (!tools.empty()) { + tools += " and "; } - autogenComment = "Automatic "; - autogenComment += tools; - autogenComment += " for target "; - autogenComment += this->Target->GetName(); + tools += "UIC"; } + autogenComment = "Automatic "; + autogenComment += tools; + autogenComment += " for target "; + autogenComment += this->Target->GetName(); + } - // Compose command lines - cmCustomCommandLines commandLines; - { - cmCustomCommandLine currentLine; - currentLine.push_back(cmSystemTools::GetCMakeCommand()); - currentLine.push_back("-E"); - currentLine.push_back("cmake_autogen"); - currentLine.push_back(this->AutogenInfoFile); - currentLine.push_back("$"); - commandLines.push_back(std::move(currentLine)); - } + // Compose command lines + cmCustomCommandLines commandLines; + { + cmCustomCommandLine currentLine; + currentLine.push_back(cmSystemTools::GetCMakeCommand()); + currentLine.push_back("-E"); + currentLine.push_back("cmake_autogen"); + currentLine.push_back(this->AutogenInfoFile); + currentLine.push_back("$"); + commandLines.push_back(std::move(currentLine)); + } - // Use PRE_BUILD on demand - bool usePRE_BUILD = false; - if (globalGen->GetName().find("Visual Studio") != std::string::npos) { - // Under VS use a PRE_BUILD event instead of a separate target to - // reduce the number of targets loaded into the IDE. - // This also works around a VS 11 bug that may skip updating the target: - // https://connect.microsoft.com/VisualStudio/feedback/details/769495 - usePRE_BUILD = true; + // Use PRE_BUILD on demand + bool usePRE_BUILD = false; + if (globalGen->GetName().find("Visual Studio") != std::string::npos) { + // Under VS use a PRE_BUILD event instead of a separate target to + // reduce the number of targets loaded into the IDE. + // This also works around a VS 11 bug that may skip updating the target: + // https://connect.microsoft.com/VisualStudio/feedback/details/769495 + usePRE_BUILD = true; + } + // Disable PRE_BUILD in some cases + if (usePRE_BUILD) { + // Cannot use PRE_BUILD with file depends + if (!this->AutogenDependFiles.empty()) { + usePRE_BUILD = false; } - // Disable PRE_BUILD in some cases - if (usePRE_BUILD) { - // Cannot use PRE_BUILD with file depends - if (!autogenDependFiles.empty()) { - usePRE_BUILD = false; - } + } + // Create the autogen target/command + if (usePRE_BUILD) { + // Add additional autogen target dependencies to origin target + for (cmTarget* depTarget : this->AutogenDependTargets) { + this->Target->Target->AddUtility(depTarget->GetName(), makefile); } - // Create the autogen target/command - if (usePRE_BUILD) { - // Add additional autogen target dependencies to origin target - for (cmTarget* depTarget : autogenDependTargets) { - this->Target->Target->AddUtility(depTarget->GetName(), makefile); - } - // Add the pre-build command directly to bypass the OBJECT_LIBRARY - // rejection in cmMakefile::AddCustomCommandToTarget because we know - // PRE_BUILD will work for an OBJECT_LIBRARY in this specific case. - // - // PRE_BUILD does not support file dependencies! - const std::vector no_output; - const std::vector no_deps; - cmCustomCommand cc(makefile, no_output, autogenProvides, no_deps, - commandLines, autogenComment.c_str(), - this->DirWork.c_str()); - cc.SetEscapeOldStyle(false); - cc.SetEscapeAllowMakeVars(true); - this->Target->Target->AddPreBuildCommand(cc); - } else { + // Add the pre-build command directly to bypass the OBJECT_LIBRARY + // rejection in cmMakefile::AddCustomCommandToTarget because we know + // PRE_BUILD will work for an OBJECT_LIBRARY in this specific case. + // + // PRE_BUILD does not support file dependencies! + const std::vector no_output; + const std::vector no_deps; + cmCustomCommand cc(makefile, no_output, autogenProvides, no_deps, + commandLines, autogenComment.c_str(), + this->DirWork.c_str()); + cc.SetEscapeOldStyle(false); + cc.SetEscapeAllowMakeVars(true); + this->Target->Target->AddPreBuildCommand(cc); + } else { - // Add link library target dependencies to the autogen target - // dependencies - { - // add_dependencies/addUtility do not support generator expressions. - // We depend only on the libraries found in all configs therefore. - std::map commonTargets; - for (std::string const& config : this->ConfigsList) { - cmLinkImplementationLibraries const* libs = - this->Target->GetLinkImplementationLibraries(config); - if (libs != nullptr) { - for (cmLinkItem const& item : libs->Libraries) { - cmGeneratorTarget const* libTarget = item.Target; - if ((libTarget != nullptr) && - !StaticLibraryCycle(this->Target, libTarget, config)) { - // Increment target config count - commonTargets[libTarget]++; - } + // Add link library target dependencies to the autogen target + // dependencies + { + // add_dependencies/addUtility do not support generator expressions. + // We depend only on the libraries found in all configs therefore. + std::map commonTargets; + for (std::string const& config : this->ConfigsList) { + cmLinkImplementationLibraries const* libs = + this->Target->GetLinkImplementationLibraries(config); + if (libs != nullptr) { + for (cmLinkItem const& item : libs->Libraries) { + cmGeneratorTarget const* libTarget = item.Target; + if ((libTarget != nullptr) && + !StaticLibraryCycle(this->Target, libTarget, config)) { + // Increment target config count + commonTargets[libTarget]++; } } } - for (auto const& item : commonTargets) { - if (item.second == this->ConfigsList.size()) { - autogenDependTargets.insert(item.first->Target); - } - } - } - - // Create autogen target - cmTarget* autogenTarget = makefile->AddUtilityCommand( - this->AutogenTargetName, cmMakefile::TargetOrigin::Generator, true, - this->DirWork.c_str(), /*byproducts=*/autogenProvides, - std::vector(autogenDependFiles.begin(), - autogenDependFiles.end()), - commandLines, false, autogenComment.c_str()); - // Create autogen generator target - localGen->AddGeneratorTarget( - new cmGeneratorTarget(autogenTarget, localGen)); - - // Forward origin utilities to autogen target - for (std::string const& depName : this->Target->Target->GetUtilities()) { - autogenTarget->AddUtility(depName, makefile); } - // Add additional autogen target dependencies to autogen target - for (cmTarget* depTarget : autogenDependTargets) { - autogenTarget->AddUtility(depTarget->GetName(), makefile); - } - - // Set FOLDER property in autogen target - if (!this->AutogenFolder.empty()) { - autogenTarget->SetProperty("FOLDER", this->AutogenFolder.c_str()); + for (auto const& item : commonTargets) { + if (item.second == this->ConfigsList.size()) { + this->AutogenDependTargets.insert(item.first->Target); + } } - - // Add autogen target to the origin target dependencies - this->Target->Target->AddUtility(this->AutogenTargetName, makefile); } - } - return true; -} - -bool cmQtAutoGenInitializer::InitCustomTargetsMoc() -{ - cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); - cmMakefile* makefile = this->Target->Target->GetMakefile(); - - // Add moc compilation to generated files list - - this->Moc.MocsCompilation = this->DirBuild; - this->Moc.MocsCompilation += "/mocs_compilation.cpp"; - - // Moc predefs command - if (this->Target->GetPropertyAsBool("AUTOMOC_COMPILER_PREDEFINES") && - this->QtVersionGreaterOrEqual(5, 8)) { - this->Moc.PredefsCmd = - makefile->GetSafeDefinition("CMAKE_CXX_COMPILER_PREDEFINES_COMMAND"); - } - - // Moc includes and compile definitions - { - auto GetIncludeDirs = [this, - localGen](std::string const& cfg) -> std::string { - // Get the include dirs for this target, without stripping the implicit - // include dirs off, see - // https://gitlab.kitware.com/cmake/cmake/issues/13667 - std::vector dirs; - localGen->GetIncludeDirectories(dirs, this->Target, "CXX", cfg, false); - return cmJoin(dirs, ";"); - }; - - // Default configuration include directories - this->Moc.Includes = GetIncludeDirs(this->ConfigDefault); - // Other configuration settings - for (std::string const& cfg : this->ConfigsList) { - std::string configIncludeDirs = GetIncludeDirs(cfg); - if (configIncludeDirs != this->Moc.Includes) { - this->Moc.ConfigIncludes[cfg] = std::move(configIncludeDirs); - } + // Create autogen target + cmTarget* autogenTarget = makefile->AddUtilityCommand( + this->AutogenTargetName, cmMakefile::TargetOrigin::Generator, true, + this->DirWork.c_str(), /*byproducts=*/autogenProvides, + std::vector(this->AutogenDependFiles.begin(), + this->AutogenDependFiles.end()), + commandLines, false, autogenComment.c_str()); + // Create autogen generator target + localGen->AddGeneratorTarget( + new cmGeneratorTarget(autogenTarget, localGen)); + + // Forward origin utilities to autogen target + for (std::string const& depName : this->Target->Target->GetUtilities()) { + autogenTarget->AddUtility(depName, makefile); + } + // Add additional autogen target dependencies to autogen target + for (cmTarget* depTarget : this->AutogenDependTargets) { + autogenTarget->AddUtility(depTarget->GetName(), makefile); } - } - - // Moc compile definitions - { - auto GetCompileDefinitions = - [this, localGen](std::string const& cfg) -> std::string { - std::set defines; - localGen->AddCompileDefinitions(defines, this->Target, cfg, "CXX"); - return cmJoin(defines, ";"); - }; - // Default configuration defines - this->Moc.Defines = GetCompileDefinitions(this->ConfigDefault); - // Other configuration defines - for (std::string const& cfg : this->ConfigsList) { - std::string configCompileDefs = GetCompileDefinitions(cfg); - if (configCompileDefs != this->Moc.Defines) { - this->Moc.ConfigDefines[cfg] = std::move(configCompileDefs); - } + // Set FOLDER property in autogen target + if (!this->AutogenFolder.empty()) { + autogenTarget->SetProperty("FOLDER", this->AutogenFolder.c_str()); } - } - // Moc executable - if (!GetMocExecutable()) { - return false; + // Add autogen target to the origin target dependencies + this->Target->Target->AddUtility(this->AutogenTargetName, makefile); } return true; } -bool cmQtAutoGenInitializer::InitCustomTargetsUic() +bool cmQtAutoGenInitializer::InitRccTargets() { cmMakefile* makefile = this->Target->Target->GetMakefile(); + cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); - // Uic search paths - { - std::string const usp = - this->Target->GetSafeProperty("AUTOUIC_SEARCH_PATHS"); - if (!usp.empty()) { - cmSystemTools::ExpandListArgument(usp, this->Uic.SearchPaths); - std::string const srcDir = makefile->GetCurrentSourceDirectory(); - for (std::string& path : this->Uic.SearchPaths) { - path = cmSystemTools::CollapseFullPath(path, srcDir); - } - } - } - // Uic target options - { - auto UicGetOpts = [this](std::string const& cfg) -> std::string { - std::vector opts; - this->Target->GetAutoUicOptions(opts, cfg); - return cmJoin(opts, ";"); - }; + for (Qrc const& qrc : this->Rcc.Qrcs) { + // Register info file as generated by CMake + makefile->AddCMakeOutputFile(qrc.InfoFile); + // Register file at target + this->AddGeneratedSource(qrc.RccFile, GeneratorT::RCC); - // Default settings - this->Uic.Options = UicGetOpts(this->ConfigDefault); + std::vector ccOutput; + ccOutput.push_back(qrc.RccFile); - // Configuration specific settings - for (std::string const& cfg : this->ConfigsList) { - std::string const configUicOpts = UicGetOpts(cfg); - if (configUicOpts != this->Uic.Options) { - this->Uic.ConfigOptions[cfg] = configUicOpts; + cmCustomCommandLines commandLines; + if (this->MultiConfig) { + // Build for all configurations + for (std::string const& config : this->ConfigsList) { + cmCustomCommandLine currentLine; + currentLine.push_back(cmSystemTools::GetCMakeCommand()); + currentLine.push_back("-E"); + currentLine.push_back("cmake_autorcc"); + currentLine.push_back(qrc.InfoFile); + currentLine.push_back(config); + commandLines.push_back(std::move(currentLine)); } + } else { + cmCustomCommandLine currentLine; + currentLine.push_back(cmSystemTools::GetCMakeCommand()); + currentLine.push_back("-E"); + currentLine.push_back("cmake_autorcc"); + currentLine.push_back(qrc.InfoFile); + currentLine.push_back("$"); + commandLines.push_back(std::move(currentLine)); } - } - // .ui files skip and options - { - std::string const uiExt = "ui"; - std::string pathError; - for (cmSourceFile* sf : makefile->GetSourceFiles()) { - // sf->GetExtension() is only valid after sf->GetFullPath() ... - // Since we're iterating over source files that might be not in the - // target we need to check for path errors (not existing files). - std::string const& fPath = sf->GetFullPath(&pathError); - if (!pathError.empty()) { - pathError.clear(); - continue; - } - if (sf->GetExtension() == uiExt) { - std::string const absFile = cmSystemTools::GetRealPath(fPath); - // Check if the .ui file should be skipped - if (sf->GetPropertyAsBool("SKIP_AUTOUIC") || - sf->GetPropertyAsBool("SKIP_AUTOGEN")) { - this->Uic.Skip.insert(absFile); + std::string ccComment = "Automatic RCC for "; + ccComment += FileProjectRelativePath(makefile, qrc.QrcFile); + + if (qrc.Generated) { + // Create custom rcc target + std::string ccName; + { + ccName = this->Target->GetName(); + ccName += "_arcc_"; + ccName += qrc.QrcName; + if (!qrc.Unique) { + ccName += "_"; + ccName += qrc.PathChecksum; } - // Check if the .ui file has uic options - std::string const uicOpts = sf->GetSafeProperty("AUTOUIC_OPTIONS"); - if (!uicOpts.empty()) { - // Check if file isn't skipped - if (this->Uic.Skip.count(absFile) == 0) { - this->Uic.FileFiles.push_back(absFile); - std::vector optsVec; - cmSystemTools::ExpandListArgument(uicOpts, optsVec); - this->Uic.FileOptions.push_back(std::move(optsVec)); - } + std::vector ccDepends; + // Add the .qrc and info file to the custom target dependencies + ccDepends.push_back(qrc.QrcFile); + ccDepends.push_back(qrc.InfoFile); + + cmTarget* autoRccTarget = makefile->AddUtilityCommand( + ccName, cmMakefile::TargetOrigin::Generator, true, + this->DirWork.c_str(), ccOutput, ccDepends, commandLines, false, + ccComment.c_str()); + // Create autogen generator target + localGen->AddGeneratorTarget( + new cmGeneratorTarget(autoRccTarget, localGen)); + + // Set FOLDER property in autogen target + if (!this->AutogenFolder.empty()) { + autoRccTarget->SetProperty("FOLDER", this->AutogenFolder.c_str()); } } + // Add autogen target to the origin target dependencies + this->Target->Target->AddUtility(ccName, makefile); + } else { + // Create custom rcc command + { + std::vector ccByproducts; + std::vector ccDepends; + // Add the .qrc and info file to the custom command dependencies + ccDepends.push_back(qrc.QrcFile); + ccDepends.push_back(qrc.InfoFile); + + // Add the resource files to the dependencies + for (std::string const& fileName : qrc.Resources) { + // Add resource file to the custom command dependencies + ccDepends.push_back(fileName); + } + makefile->AddCustomCommandToOutput(ccOutput, ccByproducts, ccDepends, + /*main_dependency*/ std::string(), + commandLines, ccComment.c_str(), + this->DirWork.c_str()); + } + // Reconfigure when .qrc file changes + makefile->AddCMakeDependFile(qrc.QrcFile); } } - if (!GetUicExecutable()) { - return false; - } - - return true; -} - -bool cmQtAutoGenInitializer::InitCustomTargetsRcc() -{ - if (!GetRccExecutable()) { - return false; - } return true; } @@ -1083,25 +1126,14 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo() CWrite("AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE", MfDef("CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE")); CWrite("AM_BUILD_DIR", this->DirBuild); - if (this->MultiConfig) { - CWriteMap("AM_INCLUDE_DIR", this->DirConfigInclude); - } else { - CWrite("AM_INCLUDE_DIR", this->DirInclude); - } + CWrite("AM_INCLUDE_DIR", this->DirInclude); + CWriteMap("AM_INCLUDE_DIR", this->DirConfigInclude); ofs << "# Files\n"; - CWriteList("AM_SOURCES", this->Sources); - CWriteList("AM_HEADERS", this->Headers); - if (this->MultiConfig) { - std::map settingsFiles; - for (std::string const& cfg : this->ConfigsList) { - settingsFiles[cfg] = - AppendFilenameSuffix(this->AutogenSettingsFile, "_" + cfg); - } - CWriteMap("AM_SETTINGS_FILE", settingsFiles); - } else { - CWrite("AM_SETTINGS_FILE", this->AutogenSettingsFile); - } + CWriteList("AM_SOURCES", this->MocUic.Sources); + CWriteList("AM_HEADERS", this->MocUic.Headers); + CWrite("AM_SETTINGS_FILE", this->AutogenSettingsFile); + CWriteMap("AM_SETTINGS_FILE", this->AutogenConfigSettingsFile); ofs << "# Qt\n"; CWrite("AM_QT_VERSION_MAJOR", this->QtVersionMajor); @@ -1146,12 +1178,7 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo() bool cmQtAutoGenInitializer::SetupWriteRccInfo() { - cmMakefile* makefile = this->Target->Target->GetMakefile(); - for (Qrc const& qrc : this->Rcc.Qrcs) { - // Register rcc info file as generated - makefile->AddCMakeOutputFile(qrc.InfoFile); - cmGeneratedFileStream ofs; ofs.SetCopyIfDifferent(true); ofs.Open(qrc.InfoFile.c_str(), false, true); @@ -1174,24 +1201,13 @@ bool cmQtAutoGenInitializer::SetupWriteRccInfo() CWrite("ARCC_MULTI_CONFIG", this->MultiConfig ? "TRUE" : "FALSE"); CWrite("ARCC_VERBOSITY", this->Verbosity); ofs << "# Settings file\n"; - if (this->MultiConfig) { - std::map settingsFiles; - for (std::string const& cfg : this->ConfigsList) { - settingsFiles[cfg] = - AppendFilenameSuffix(qrc.SettingsFile, "_" + cfg); - } - CWriteMap("ARCC_SETTINGS_FILE", settingsFiles); - } else { - CWrite("ARCC_SETTINGS_FILE", qrc.SettingsFile); - } + CWrite("ARCC_SETTINGS_FILE", qrc.SettingsFile); + CWriteMap("ARCC_SETTINGS_FILE", qrc.ConfigSettingsFile); ofs << "# Directories\n"; CWrite("ARCC_BUILD_DIR", this->DirBuild); - if (this->MultiConfig) { - CWriteMap("ARCC_INCLUDE_DIR", this->DirConfigInclude); - } else { - CWrite("ARCC_INCLUDE_DIR", this->DirInclude); - } + CWrite("ARCC_INCLUDE_DIR", this->DirInclude); + CWriteMap("ARCC_INCLUDE_DIR", this->DirConfigInclude); ofs << "# Rcc executable\n"; CWrite("ARCC_RCC_EXECUTABLE", this->Rcc.Executable); diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index 6ade2ed..16f9cdd 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -12,6 +12,7 @@ #include class cmGeneratorTarget; +class cmTarget; /// @brief Initializes the QtAutoGen generators class cmQtAutoGenInitializer : public cmQtAutoGen @@ -38,6 +39,7 @@ public: std::string PathChecksum; std::string InfoFile; std::string SettingsFile; + std::map ConfigSettingsFile; std::string RccFile; bool Generated; bool Unique; @@ -54,9 +56,13 @@ public: bool SetupCustomTargets(); private: - bool InitCustomTargetsMoc(); - bool InitCustomTargetsUic(); - bool InitCustomTargetsRcc(); + bool InitMoc(); + bool InitUic(); + bool InitRcc(); + + bool InitScanFiles(); + bool InitAutogenTarget(); + bool InitRccTargets(); bool SetupWriteAutogenInfo(); bool SetupWriteRccInfo(); @@ -90,15 +96,24 @@ private: std::string AutogenFolder; std::string AutogenInfoFile; std::string AutogenSettingsFile; + std::map AutogenConfigSettingsFile; + std::set AutogenDependFiles; + std::set AutogenDependTargets; // Directories std::string DirInfo; std::string DirBuild; std::string DirWork; std::string DirInclude; std::map DirConfigInclude; - // Sources - std::vector Headers; - std::vector Sources; + // Moc and UIC + struct + { + // Sources + std::vector Headers; + std::vector Sources; + std::vector HeadersGenerated; + std::vector SourcesGenerated; + } MocUic; // Moc struct { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=84bdae88950584663702be1cab3adf5d8069c58c commit 84bdae88950584663702be1cab3adf5d8069c58c Author: Sebastian Holtermann AuthorDate: Sun Jul 22 15:11:38 2018 +0200 Commit: Sebastian Holtermann CommitDate: Mon Jul 30 09:22:46 2018 +0200 Autogen: Compute variables in Init stage instead of Setup stage diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 89eb5a6..22f9caf 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -317,17 +317,14 @@ bool cmQtAutoGenInitializer::InitCustomTargets() } } - // Add moc compilation to generated files list - if (this->Moc.Enabled) { - std::string mocsComp = this->DirBuild + "/mocs_compilation.cpp"; - this->AddGeneratedSource(mocsComp, GeneratorT::MOC); - autogenProvides.push_back(std::move(mocsComp)); + if (this->Moc.Enabled && !InitCustomTargetsMoc()) { + return false; } - - // Add autogen includes directory to the origin target INCLUDE_DIRECTORIES - if (this->Moc.Enabled || this->Uic.Enabled || - (this->Rcc.Enabled && this->MultiConfig)) { - this->Target->AddIncludeDirectory(this->DirInclude, true); + if (this->Uic.Enabled && !InitCustomTargetsUic()) { + return false; + } + if (this->Uic.Enabled && !InitCustomTargetsRcc()) { + return false; } // Acquire rcc executable and features @@ -337,6 +334,17 @@ bool cmQtAutoGenInitializer::InitCustomTargets() } } + // Add autogen includes directory to the origin target INCLUDE_DIRECTORIES + if (this->Moc.Enabled || this->Uic.Enabled || + (this->Rcc.Enabled && this->MultiConfig)) { + this->Target->AddIncludeDirectory(this->DirInclude, true); + } + + if (this->Moc.Enabled) { + this->AddGeneratedSource(this->Moc.MocsCompilation, GeneratorT::MOC); + autogenProvides.push_back(this->Moc.MocsCompilation); + } + // Extract relevant source files std::vector generatedSources; std::vector generatedHeaders; @@ -838,6 +846,159 @@ bool cmQtAutoGenInitializer::InitCustomTargets() return true; } +bool cmQtAutoGenInitializer::InitCustomTargetsMoc() +{ + cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); + cmMakefile* makefile = this->Target->Target->GetMakefile(); + + // Add moc compilation to generated files list + + this->Moc.MocsCompilation = this->DirBuild; + this->Moc.MocsCompilation += "/mocs_compilation.cpp"; + + // Moc predefs command + if (this->Target->GetPropertyAsBool("AUTOMOC_COMPILER_PREDEFINES") && + this->QtVersionGreaterOrEqual(5, 8)) { + this->Moc.PredefsCmd = + makefile->GetSafeDefinition("CMAKE_CXX_COMPILER_PREDEFINES_COMMAND"); + } + + // Moc includes and compile definitions + { + auto GetIncludeDirs = [this, + localGen](std::string const& cfg) -> std::string { + // Get the include dirs for this target, without stripping the implicit + // include dirs off, see + // https://gitlab.kitware.com/cmake/cmake/issues/13667 + std::vector dirs; + localGen->GetIncludeDirectories(dirs, this->Target, "CXX", cfg, false); + return cmJoin(dirs, ";"); + }; + + // Default configuration include directories + this->Moc.Includes = GetIncludeDirs(this->ConfigDefault); + // Other configuration settings + for (std::string const& cfg : this->ConfigsList) { + std::string configIncludeDirs = GetIncludeDirs(cfg); + if (configIncludeDirs != this->Moc.Includes) { + this->Moc.ConfigIncludes[cfg] = std::move(configIncludeDirs); + } + } + } + + // Moc compile definitions + { + auto GetCompileDefinitions = + [this, localGen](std::string const& cfg) -> std::string { + std::set defines; + localGen->AddCompileDefinitions(defines, this->Target, cfg, "CXX"); + return cmJoin(defines, ";"); + }; + + // Default configuration defines + this->Moc.Defines = GetCompileDefinitions(this->ConfigDefault); + // Other configuration defines + for (std::string const& cfg : this->ConfigsList) { + std::string configCompileDefs = GetCompileDefinitions(cfg); + if (configCompileDefs != this->Moc.Defines) { + this->Moc.ConfigDefines[cfg] = std::move(configCompileDefs); + } + } + } + + // Moc executable + if (!GetMocExecutable()) { + return false; + } + + return true; +} + +bool cmQtAutoGenInitializer::InitCustomTargetsUic() +{ + cmMakefile* makefile = this->Target->Target->GetMakefile(); + + // Uic search paths + { + std::string const usp = + this->Target->GetSafeProperty("AUTOUIC_SEARCH_PATHS"); + if (!usp.empty()) { + cmSystemTools::ExpandListArgument(usp, this->Uic.SearchPaths); + std::string const srcDir = makefile->GetCurrentSourceDirectory(); + for (std::string& path : this->Uic.SearchPaths) { + path = cmSystemTools::CollapseFullPath(path, srcDir); + } + } + } + // Uic target options + { + auto UicGetOpts = [this](std::string const& cfg) -> std::string { + std::vector opts; + this->Target->GetAutoUicOptions(opts, cfg); + return cmJoin(opts, ";"); + }; + + // Default settings + this->Uic.Options = UicGetOpts(this->ConfigDefault); + + // Configuration specific settings + for (std::string const& cfg : this->ConfigsList) { + std::string const configUicOpts = UicGetOpts(cfg); + if (configUicOpts != this->Uic.Options) { + this->Uic.ConfigOptions[cfg] = configUicOpts; + } + } + } + // .ui files skip and options + { + std::string const uiExt = "ui"; + std::string pathError; + for (cmSourceFile* sf : makefile->GetSourceFiles()) { + // sf->GetExtension() is only valid after sf->GetFullPath() ... + // Since we're iterating over source files that might be not in the + // target we need to check for path errors (not existing files). + std::string const& fPath = sf->GetFullPath(&pathError); + if (!pathError.empty()) { + pathError.clear(); + continue; + } + if (sf->GetExtension() == uiExt) { + std::string const absFile = cmSystemTools::GetRealPath(fPath); + // Check if the .ui file should be skipped + if (sf->GetPropertyAsBool("SKIP_AUTOUIC") || + sf->GetPropertyAsBool("SKIP_AUTOGEN")) { + this->Uic.Skip.insert(absFile); + } + // Check if the .ui file has uic options + std::string const uicOpts = sf->GetSafeProperty("AUTOUIC_OPTIONS"); + if (!uicOpts.empty()) { + // Check if file isn't skipped + if (this->Uic.Skip.count(absFile) == 0) { + this->Uic.FileFiles.push_back(absFile); + std::vector optsVec; + cmSystemTools::ExpandListArgument(uicOpts, optsVec); + this->Uic.FileOptions.push_back(std::move(optsVec)); + } + } + } + } + } + + if (!GetUicExecutable()) { + return false; + } + + return true; +} + +bool cmQtAutoGenInitializer::InitCustomTargetsRcc() +{ + if (!GetRccExecutable()) { + return false; + } + return true; +} + bool cmQtAutoGenInitializer::SetupCustomTargets() { // Create info directory on demand @@ -850,12 +1011,6 @@ bool cmQtAutoGenInitializer::SetupCustomTargets() // Generate autogen target info file if (this->Moc.Enabled || this->Uic.Enabled) { - if (this->Moc.Enabled) { - this->SetupCustomTargetsMoc(); - } - if (this->Uic.Enabled) { - this->SetupCustomTargetsUic(); - } // Write autogen target info files if (!this->SetupWriteAutogenInfo()) { return false; @@ -1060,146 +1215,6 @@ bool cmQtAutoGenInitializer::SetupWriteRccInfo() return true; } -bool cmQtAutoGenInitializer::SetupCustomTargetsMoc() -{ - cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); - cmMakefile* makefile = this->Target->Target->GetMakefile(); - - // Moc predefs command - if (this->Target->GetPropertyAsBool("AUTOMOC_COMPILER_PREDEFINES") && - this->QtVersionGreaterOrEqual(5, 8)) { - this->Moc.PredefsCmd = - makefile->GetSafeDefinition("CMAKE_CXX_COMPILER_PREDEFINES_COMMAND"); - } - - // Moc includes and compile definitions - { - auto GetIncludeDirs = [this, - localGen](std::string const& cfg) -> std::string { - // Get the include dirs for this target, without stripping the implicit - // include dirs off, see - // https://gitlab.kitware.com/cmake/cmake/issues/13667 - std::vector dirs; - localGen->GetIncludeDirectories(dirs, this->Target, "CXX", cfg, false); - return cmJoin(dirs, ";"); - }; - - // Default configuration include directories - this->Moc.Includes = GetIncludeDirs(this->ConfigDefault); - // Other configuration settings - for (std::string const& cfg : this->ConfigsList) { - std::string configIncludeDirs = GetIncludeDirs(cfg); - if (configIncludeDirs != this->Moc.Includes) { - this->Moc.ConfigIncludes[cfg] = std::move(configIncludeDirs); - } - } - } - - // Moc compile definitions - { - auto GetCompileDefinitions = - [this, localGen](std::string const& cfg) -> std::string { - std::set defines; - localGen->AddCompileDefinitions(defines, this->Target, cfg, "CXX"); - return cmJoin(defines, ";"); - }; - - // Default configuration defines - this->Moc.Defines = GetCompileDefinitions(this->ConfigDefault); - // Other configuration defines - for (std::string const& cfg : this->ConfigsList) { - std::string configCompileDefs = GetCompileDefinitions(cfg); - if (configCompileDefs != this->Moc.Defines) { - this->Moc.ConfigDefines[cfg] = std::move(configCompileDefs); - } - } - } - - // Moc executable - if (!GetMocExecutable()) { - return false; - } - - return true; -} - -bool cmQtAutoGenInitializer::SetupCustomTargetsUic() -{ - cmMakefile* makefile = this->Target->Target->GetMakefile(); - - // Uic search paths - { - std::string const usp = - this->Target->GetSafeProperty("AUTOUIC_SEARCH_PATHS"); - if (!usp.empty()) { - cmSystemTools::ExpandListArgument(usp, this->Uic.SearchPaths); - std::string const srcDir = makefile->GetCurrentSourceDirectory(); - for (std::string& path : this->Uic.SearchPaths) { - path = cmSystemTools::CollapseFullPath(path, srcDir); - } - } - } - // Uic target options - { - auto UicGetOpts = [this](std::string const& cfg) -> std::string { - std::vector opts; - this->Target->GetAutoUicOptions(opts, cfg); - return cmJoin(opts, ";"); - }; - - // Default settings - this->Uic.Options = UicGetOpts(this->ConfigDefault); - - // Configuration specific settings - for (std::string const& cfg : this->ConfigsList) { - std::string const configUicOpts = UicGetOpts(cfg); - if (configUicOpts != this->Uic.Options) { - this->Uic.ConfigOptions[cfg] = configUicOpts; - } - } - } - // .ui files skip and options - { - std::string const uiExt = "ui"; - std::string pathError; - for (cmSourceFile* sf : makefile->GetSourceFiles()) { - // sf->GetExtension() is only valid after sf->GetFullPath() ... - // Since we're iterating over source files that might be not in the - // target we need to check for path errors (not existing files). - std::string const& fPath = sf->GetFullPath(&pathError); - if (!pathError.empty()) { - pathError.clear(); - continue; - } - if (sf->GetExtension() == uiExt) { - std::string const absFile = cmSystemTools::GetRealPath(fPath); - // Check if the .ui file should be skipped - if (sf->GetPropertyAsBool("SKIP_AUTOUIC") || - sf->GetPropertyAsBool("SKIP_AUTOGEN")) { - this->Uic.Skip.insert(absFile); - } - // Check if the .ui file has uic options - std::string const uicOpts = sf->GetSafeProperty("AUTOUIC_OPTIONS"); - if (!uicOpts.empty()) { - // Check if file isn't skipped - if (this->Uic.Skip.count(absFile) == 0) { - this->Uic.FileFiles.push_back(absFile); - std::vector optsVec; - cmSystemTools::ExpandListArgument(uicOpts, optsVec); - this->Uic.FileOptions.push_back(std::move(optsVec)); - } - } - } - } - } - - if (!GetUicExecutable()) { - return false; - } - - return true; -} - void cmQtAutoGenInitializer::AddGeneratedSource(std::string const& filename, GeneratorT genType) { diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index bb2c920..6ade2ed 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -54,8 +54,9 @@ public: bool SetupCustomTargets(); private: - bool SetupCustomTargetsMoc(); - bool SetupCustomTargetsUic(); + bool InitCustomTargetsMoc(); + bool InitCustomTargetsUic(); + bool InitCustomTargetsRcc(); bool SetupWriteAutogenInfo(); bool SetupWriteRccInfo(); @@ -75,7 +76,7 @@ private: private: cmGeneratorTarget* Target; - bool MultiConfig; + bool MultiConfig = false; // Qt std::string QtVersionMajor; std::string QtVersionMinor; @@ -101,7 +102,7 @@ private: // Moc struct { - bool Enabled; + bool Enabled = false; std::string Executable; std::string PredefsCmd; std::set Skip; @@ -109,11 +110,12 @@ private: std::map ConfigIncludes; std::string Defines; std::map ConfigDefines; + std::string MocsCompilation; } Moc; // Uic struct { - bool Enabled; + bool Enabled = false; std::string Executable; std::set Skip; std::vector SearchPaths; @@ -125,7 +127,7 @@ private: // Rcc struct { - bool Enabled; + bool Enabled = false; std::string Executable; std::vector ListOptions; std::vector Qrcs; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8e0d70272d9be5149608ed7441852f53c48c180f commit 8e0d70272d9be5149608ed7441852f53c48c180f Author: Sebastian Holtermann AuthorDate: Sun Jul 22 14:52:02 2018 +0200 Commit: Sebastian Holtermann CommitDate: Mon Jul 30 09:22:46 2018 +0200 Autogen: Move info file write code into methods diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 19cdd39..89eb5a6 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -214,6 +214,13 @@ bool cmQtAutoGenInitializer::InitCustomTargets() this->ConfigsList.push_back(this->ConfigDefault); } + // Parallel processing + this->Parallel = this->Target->GetSafeProperty("AUTOGEN_PARALLEL"); + if (this->Parallel.empty() || (this->Parallel == "AUTO")) { + // Autodetect number of CPUs + this->Parallel = std::to_string(GetParallelCPUCount()); + } + // Autogen target name this->AutogenTargetName = this->Target->GetName(); this->AutogenTargetName += "_autogen"; @@ -833,8 +840,6 @@ bool cmQtAutoGenInitializer::InitCustomTargets() bool cmQtAutoGenInitializer::SetupCustomTargets() { - cmMakefile* makefile = this->Target->Target->GetMakefile(); - // Create info directory on demand if (!cmSystemTools::MakeDirectory(this->DirInfo)) { std::string emsg = ("AutoGen: Could not create directory: "); @@ -851,43 +856,156 @@ bool cmQtAutoGenInitializer::SetupCustomTargets() if (this->Uic.Enabled) { this->SetupCustomTargetsUic(); } + // Write autogen target info files + if (!this->SetupWriteAutogenInfo()) { + return false; + } + } + + // Write AUTORCC info files + if (this->Rcc.Enabled && !this->SetupWriteRccInfo()) { + return false; + } + + return true; +} + +bool cmQtAutoGenInitializer::SetupWriteAutogenInfo() +{ + cmMakefile* makefile = this->Target->Target->GetMakefile(); + + cmGeneratedFileStream ofs; + ofs.SetCopyIfDifferent(true); + ofs.Open(this->AutogenInfoFile.c_str(), false, true); + if (ofs) { + // Utility lambdas + auto CWrite = [&ofs](const char* key, std::string const& value) { + ofs << "set(" << key << " " << cmOutputConverter::EscapeForCMake(value) + << ")\n"; + }; + auto CWriteList = [&CWrite](const char* key, + std::vector const& list) { + CWrite(key, cmJoin(list, ";")); + }; + auto CWriteNestedLists = + [&CWrite](const char* key, + std::vector> const& lists) { + std::vector seplist; + for (const std::vector& list : lists) { + std::string blist = "{"; + blist += cmJoin(list, ";"); + blist += "}"; + seplist.push_back(std::move(blist)); + } + CWrite(key, cmJoin(seplist, cmQtAutoGen::ListSep)); + }; + auto CWriteSet = [&CWrite](const char* key, + std::set const& list) { + CWrite(key, cmJoin(list, ";")); + }; + auto CWriteMap = [&ofs](const char* key, + std::map const& map) { + for (auto const& item : map) { + ofs << "set(" << key << "_" << item.first << " " + << cmOutputConverter::EscapeForCMake(item.second) << ")\n"; + } + }; + auto MfDef = [makefile](const char* key) { + return std::string(makefile->GetSafeDefinition(key)); + }; - // Parallel processing - this->Parallel = this->Target->GetSafeProperty("AUTOGEN_PARALLEL"); - if (this->Parallel.empty() || (this->Parallel == "AUTO")) { - // Autodetect number of CPUs - this->Parallel = std::to_string(GetParallelCPUCount()); + // Write + ofs << "# Meta\n"; + CWrite("AM_MULTI_CONFIG", this->MultiConfig ? "TRUE" : "FALSE"); + CWrite("AM_PARALLEL", this->Parallel); + CWrite("AM_VERBOSITY", this->Verbosity); + + ofs << "# Directories\n"; + CWrite("AM_CMAKE_SOURCE_DIR", MfDef("CMAKE_SOURCE_DIR")); + CWrite("AM_CMAKE_BINARY_DIR", MfDef("CMAKE_BINARY_DIR")); + CWrite("AM_CMAKE_CURRENT_SOURCE_DIR", MfDef("CMAKE_CURRENT_SOURCE_DIR")); + CWrite("AM_CMAKE_CURRENT_BINARY_DIR", MfDef("CMAKE_CURRENT_BINARY_DIR")); + CWrite("AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE", + MfDef("CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE")); + CWrite("AM_BUILD_DIR", this->DirBuild); + if (this->MultiConfig) { + CWriteMap("AM_INCLUDE_DIR", this->DirConfigInclude); + } else { + CWrite("AM_INCLUDE_DIR", this->DirInclude); + } + + ofs << "# Files\n"; + CWriteList("AM_SOURCES", this->Sources); + CWriteList("AM_HEADERS", this->Headers); + if (this->MultiConfig) { + std::map settingsFiles; + for (std::string const& cfg : this->ConfigsList) { + settingsFiles[cfg] = + AppendFilenameSuffix(this->AutogenSettingsFile, "_" + cfg); + } + CWriteMap("AM_SETTINGS_FILE", settingsFiles); + } else { + CWrite("AM_SETTINGS_FILE", this->AutogenSettingsFile); + } + + ofs << "# Qt\n"; + CWrite("AM_QT_VERSION_MAJOR", this->QtVersionMajor); + CWrite("AM_QT_MOC_EXECUTABLE", this->Moc.Executable); + CWrite("AM_QT_UIC_EXECUTABLE", this->Uic.Executable); + + if (this->Moc.Enabled) { + ofs << "# MOC settings\n"; + CWriteSet("AM_MOC_SKIP", this->Moc.Skip); + CWrite("AM_MOC_DEFINITIONS", this->Moc.Defines); + CWriteMap("AM_MOC_DEFINITIONS", this->Moc.ConfigDefines); + CWrite("AM_MOC_INCLUDES", this->Moc.Includes); + CWriteMap("AM_MOC_INCLUDES", this->Moc.ConfigIncludes); + CWrite("AM_MOC_OPTIONS", + this->Target->GetSafeProperty("AUTOMOC_MOC_OPTIONS")); + CWrite("AM_MOC_RELAXED_MODE", MfDef("CMAKE_AUTOMOC_RELAXED_MODE")); + CWrite("AM_MOC_MACRO_NAMES", + this->Target->GetSafeProperty("AUTOMOC_MACRO_NAMES")); + CWrite("AM_MOC_DEPEND_FILTERS", + this->Target->GetSafeProperty("AUTOMOC_DEPEND_FILTERS")); + CWrite("AM_MOC_PREDEFS_CMD", this->Moc.PredefsCmd); } + if (this->Uic.Enabled) { + ofs << "# UIC settings\n"; + CWriteSet("AM_UIC_SKIP", this->Uic.Skip); + CWrite("AM_UIC_TARGET_OPTIONS", this->Uic.Options); + CWriteMap("AM_UIC_TARGET_OPTIONS", this->Uic.ConfigOptions); + CWriteList("AM_UIC_OPTIONS_FILES", this->Uic.FileFiles); + CWriteNestedLists("AM_UIC_OPTIONS_OPTIONS", this->Uic.FileOptions); + CWriteList("AM_UIC_SEARCH_PATHS", this->Uic.SearchPaths); + } + } else { + std::string err = "AutoGen: Could not write file "; + err += this->AutogenInfoFile; + cmSystemTools::Error(err.c_str()); + return false; + } + + return true; +} + +bool cmQtAutoGenInitializer::SetupWriteRccInfo() +{ + cmMakefile* makefile = this->Target->Target->GetMakefile(); + + for (Qrc const& qrc : this->Rcc.Qrcs) { + // Register rcc info file as generated + makefile->AddCMakeOutputFile(qrc.InfoFile); + cmGeneratedFileStream ofs; ofs.SetCopyIfDifferent(true); - ofs.Open(this->AutogenInfoFile.c_str(), false, true); + ofs.Open(qrc.InfoFile.c_str(), false, true); if (ofs) { // Utility lambdas auto CWrite = [&ofs](const char* key, std::string const& value) { ofs << "set(" << key << " " << cmOutputConverter::EscapeForCMake(value) << ")\n"; }; - auto CWriteList = [&CWrite](const char* key, - std::vector const& list) { - CWrite(key, cmJoin(list, ";")); - }; - auto CWriteNestedLists = - [&CWrite](const char* key, - std::vector> const& lists) { - std::vector seplist; - for (const std::vector& list : lists) { - std::string blist = "{"; - blist += cmJoin(list, ";"); - blist += "}"; - seplist.push_back(std::move(blist)); - } - CWrite(key, cmJoin(seplist, cmQtAutoGen::ListSep)); - }; - auto CWriteSet = [&CWrite](const char* key, - std::set const& list) { - CWrite(key, cmJoin(list, ";")); - }; auto CWriteMap = [&ofs](const char* key, std::map const& map) { for (auto const& item : map) { @@ -895,152 +1013,50 @@ bool cmQtAutoGenInitializer::SetupCustomTargets() << cmOutputConverter::EscapeForCMake(item.second) << ")\n"; } }; - auto MfDef = [makefile](const char* key) { - return std::string(makefile->GetSafeDefinition(key)); - }; // Write - ofs << "# Meta\n"; - CWrite("AM_MULTI_CONFIG", this->MultiConfig ? "TRUE" : "FALSE"); - CWrite("AM_PARALLEL", this->Parallel); - CWrite("AM_VERBOSITY", this->Verbosity); - - ofs << "# Directories\n"; - CWrite("AM_CMAKE_SOURCE_DIR", MfDef("CMAKE_SOURCE_DIR")); - CWrite("AM_CMAKE_BINARY_DIR", MfDef("CMAKE_BINARY_DIR")); - CWrite("AM_CMAKE_CURRENT_SOURCE_DIR", MfDef("CMAKE_CURRENT_SOURCE_DIR")); - CWrite("AM_CMAKE_CURRENT_BINARY_DIR", MfDef("CMAKE_CURRENT_BINARY_DIR")); - CWrite("AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE", - MfDef("CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE")); - CWrite("AM_BUILD_DIR", this->DirBuild); - if (this->MultiConfig) { - CWriteMap("AM_INCLUDE_DIR", this->DirConfigInclude); - } else { - CWrite("AM_INCLUDE_DIR", this->DirInclude); - } - - ofs << "# Files\n"; - CWriteList("AM_SOURCES", this->Sources); - CWriteList("AM_HEADERS", this->Headers); + ofs << "# Configurations\n"; + CWrite("ARCC_MULTI_CONFIG", this->MultiConfig ? "TRUE" : "FALSE"); + CWrite("ARCC_VERBOSITY", this->Verbosity); + ofs << "# Settings file\n"; if (this->MultiConfig) { std::map settingsFiles; for (std::string const& cfg : this->ConfigsList) { settingsFiles[cfg] = - AppendFilenameSuffix(this->AutogenSettingsFile, "_" + cfg); + AppendFilenameSuffix(qrc.SettingsFile, "_" + cfg); } - CWriteMap("AM_SETTINGS_FILE", settingsFiles); + CWriteMap("ARCC_SETTINGS_FILE", settingsFiles); } else { - CWrite("AM_SETTINGS_FILE", this->AutogenSettingsFile); + CWrite("ARCC_SETTINGS_FILE", qrc.SettingsFile); } - ofs << "# Qt\n"; - CWrite("AM_QT_VERSION_MAJOR", this->QtVersionMajor); - CWrite("AM_QT_MOC_EXECUTABLE", this->Moc.Executable); - CWrite("AM_QT_UIC_EXECUTABLE", this->Uic.Executable); - - if (this->Moc.Enabled) { - ofs << "# MOC settings\n"; - CWriteSet("AM_MOC_SKIP", this->Moc.Skip); - CWrite("AM_MOC_DEFINITIONS", this->Moc.Defines); - CWriteMap("AM_MOC_DEFINITIONS", this->Moc.ConfigDefines); - CWrite("AM_MOC_INCLUDES", this->Moc.Includes); - CWriteMap("AM_MOC_INCLUDES", this->Moc.ConfigIncludes); - CWrite("AM_MOC_OPTIONS", - this->Target->GetSafeProperty("AUTOMOC_MOC_OPTIONS")); - CWrite("AM_MOC_RELAXED_MODE", MfDef("CMAKE_AUTOMOC_RELAXED_MODE")); - CWrite("AM_MOC_MACRO_NAMES", - this->Target->GetSafeProperty("AUTOMOC_MACRO_NAMES")); - CWrite("AM_MOC_DEPEND_FILTERS", - this->Target->GetSafeProperty("AUTOMOC_DEPEND_FILTERS")); - CWrite("AM_MOC_PREDEFS_CMD", this->Moc.PredefsCmd); + ofs << "# Directories\n"; + CWrite("ARCC_BUILD_DIR", this->DirBuild); + if (this->MultiConfig) { + CWriteMap("ARCC_INCLUDE_DIR", this->DirConfigInclude); + } else { + CWrite("ARCC_INCLUDE_DIR", this->DirInclude); } - if (this->Uic.Enabled) { - ofs << "# UIC settings\n"; - CWriteSet("AM_UIC_SKIP", this->Uic.Skip); - CWrite("AM_UIC_TARGET_OPTIONS", this->Uic.Options); - CWriteMap("AM_UIC_TARGET_OPTIONS", this->Uic.ConfigOptions); - CWriteList("AM_UIC_OPTIONS_FILES", this->Uic.FileFiles); - CWriteNestedLists("AM_UIC_OPTIONS_OPTIONS", this->Uic.FileOptions); - CWriteList("AM_UIC_SEARCH_PATHS", this->Uic.SearchPaths); - } + ofs << "# Rcc executable\n"; + CWrite("ARCC_RCC_EXECUTABLE", this->Rcc.Executable); + CWrite("ARCC_RCC_LIST_OPTIONS", cmJoin(this->Rcc.ListOptions, ";")); + + ofs << "# Rcc job\n"; + CWrite("ARCC_LOCK_FILE", qrc.LockFile); + CWrite("ARCC_SOURCE", qrc.QrcFile); + CWrite("ARCC_OUTPUT_CHECKSUM", qrc.PathChecksum); + CWrite("ARCC_OUTPUT_NAME", cmSystemTools::GetFilenameName(qrc.RccFile)); + CWrite("ARCC_OPTIONS", cmJoin(qrc.Options, ";")); + CWrite("ARCC_INPUTS", cmJoin(qrc.Resources, ";")); } else { - std::string err = "AutoGen: Could not write file "; - err += this->AutogenInfoFile; + std::string err = "AutoRcc: Could not write file "; + err += qrc.InfoFile; cmSystemTools::Error(err.c_str()); return false; } } - // Generate auto RCC info files - if (this->Rcc.Enabled) { - for (Qrc const& qrc : this->Rcc.Qrcs) { - // Register rcc info file as generated - makefile->AddCMakeOutputFile(qrc.InfoFile); - - cmGeneratedFileStream ofs; - ofs.SetCopyIfDifferent(true); - ofs.Open(qrc.InfoFile.c_str(), false, true); - if (ofs) { - // Utility lambdas - auto CWrite = [&ofs](const char* key, std::string const& value) { - ofs << "set(" << key << " " - << cmOutputConverter::EscapeForCMake(value) << ")\n"; - }; - auto CWriteMap = - [&ofs](const char* key, - std::map const& map) { - for (auto const& item : map) { - ofs << "set(" << key << "_" << item.first << " " - << cmOutputConverter::EscapeForCMake(item.second) << ")\n"; - } - }; - - // Write - ofs << "# Configurations\n"; - CWrite("ARCC_MULTI_CONFIG", this->MultiConfig ? "TRUE" : "FALSE"); - CWrite("ARCC_VERBOSITY", this->Verbosity); - ofs << "# Settings file\n"; - if (this->MultiConfig) { - std::map settingsFiles; - for (std::string const& cfg : this->ConfigsList) { - settingsFiles[cfg] = - AppendFilenameSuffix(qrc.SettingsFile, "_" + cfg); - } - CWriteMap("ARCC_SETTINGS_FILE", settingsFiles); - } else { - CWrite("ARCC_SETTINGS_FILE", qrc.SettingsFile); - } - - ofs << "# Directories\n"; - CWrite("ARCC_BUILD_DIR", this->DirBuild); - if (this->MultiConfig) { - CWriteMap("ARCC_INCLUDE_DIR", this->DirConfigInclude); - } else { - CWrite("ARCC_INCLUDE_DIR", this->DirInclude); - } - - ofs << "# Rcc executable\n"; - CWrite("ARCC_RCC_EXECUTABLE", this->Rcc.Executable); - CWrite("ARCC_RCC_LIST_OPTIONS", cmJoin(this->Rcc.ListOptions, ";")); - - ofs << "# Rcc job\n"; - CWrite("ARCC_LOCK_FILE", qrc.LockFile); - CWrite("ARCC_SOURCE", qrc.QrcFile); - CWrite("ARCC_OUTPUT_CHECKSUM", qrc.PathChecksum); - CWrite("ARCC_OUTPUT_NAME", - cmSystemTools::GetFilenameName(qrc.RccFile)); - CWrite("ARCC_OPTIONS", cmJoin(qrc.Options, ";")); - CWrite("ARCC_INPUTS", cmJoin(qrc.Resources, ";")); - } else { - std::string err = "AutoRcc: Could not write file "; - err += qrc.InfoFile; - cmSystemTools::Error(err.c_str()); - return false; - } - } - } - return true; } @@ -1063,11 +1079,24 @@ bool cmQtAutoGenInitializer::SetupCustomTargetsMoc() // Get the include dirs for this target, without stripping the implicit // include dirs off, see // https://gitlab.kitware.com/cmake/cmake/issues/13667 - std::vector includeDirs; - localGen->GetIncludeDirectories(includeDirs, this->Target, "CXX", cfg, - false); - return cmJoin(includeDirs, ";"); + std::vector dirs; + localGen->GetIncludeDirectories(dirs, this->Target, "CXX", cfg, false); + return cmJoin(dirs, ";"); }; + + // Default configuration include directories + this->Moc.Includes = GetIncludeDirs(this->ConfigDefault); + // Other configuration settings + for (std::string const& cfg : this->ConfigsList) { + std::string configIncludeDirs = GetIncludeDirs(cfg); + if (configIncludeDirs != this->Moc.Includes) { + this->Moc.ConfigIncludes[cfg] = std::move(configIncludeDirs); + } + } + } + + // Moc compile definitions + { auto GetCompileDefinitions = [this, localGen](std::string const& cfg) -> std::string { std::set defines; @@ -1075,26 +1104,18 @@ bool cmQtAutoGenInitializer::SetupCustomTargetsMoc() return cmJoin(defines, ";"); }; - // Default configuration settings - this->Moc.Includes = GetIncludeDirs(this->ConfigDefault); + // Default configuration defines this->Moc.Defines = GetCompileDefinitions(this->ConfigDefault); - // Other configuration settings + // Other configuration defines for (std::string const& cfg : this->ConfigsList) { - { - std::string const configIncludeDirs = GetIncludeDirs(cfg); - if (configIncludeDirs != this->Moc.Includes) { - this->Moc.ConfigIncludes[cfg] = configIncludeDirs; - } - } - { - std::string const configCompileDefs = GetCompileDefinitions(cfg); - if (configCompileDefs != this->Moc.Defines) { - this->Moc.ConfigDefines[cfg] = configCompileDefs; - } + std::string configCompileDefs = GetCompileDefinitions(cfg); + if (configCompileDefs != this->Moc.Defines) { + this->Moc.ConfigDefines[cfg] = std::move(configCompileDefs); } } } + // Moc executable if (!GetMocExecutable()) { return false; } diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index 387b3bc..bb2c920 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -57,6 +57,9 @@ private: bool SetupCustomTargetsMoc(); bool SetupCustomTargetsUic(); + bool SetupWriteAutogenInfo(); + bool SetupWriteRccInfo(); + void AddGeneratedSource(std::string const& filename, GeneratorT genType); bool QtVersionGreaterOrEqual(unsigned long requestMajor, https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5776639fbfe5b8da5ca7a4fbae31936cdeff6660 commit 5776639fbfe5b8da5ca7a4fbae31936cdeff6660 Author: Sebastian Holtermann AuthorDate: Sun Jul 22 14:26:16 2018 +0200 Commit: Sebastian Holtermann CommitDate: Mon Jul 30 09:22:46 2018 +0200 Autogen: Pass absolute include path in info file diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index fd9829f..19cdd39 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -244,6 +244,21 @@ bool cmQtAutoGenInitializer::InitCustomTargets() // Working directory this->DirWork = cbd; cmSystemTools::ConvertToUnixSlashes(this->DirWork); + + // Include directory + this->DirInclude = this->DirBuild; + this->DirInclude += "/include"; + if (this->MultiConfig) { + this->DirInclude += "_$"; + } + if (this->MultiConfig) { + for (std::string const& cfg : this->ConfigsList) { + std::string& dir = this->DirConfigInclude[cfg]; + dir = this->DirBuild; + dir += "/include_"; + dir += cfg; + } + } } // Autogen files @@ -305,12 +320,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets() // Add autogen includes directory to the origin target INCLUDE_DIRECTORIES if (this->Moc.Enabled || this->Uic.Enabled || (this->Rcc.Enabled && this->MultiConfig)) { - std::string includeDir = this->DirBuild; - includeDir += "/include"; - if (this->MultiConfig) { - includeDir += "_$"; - } - this->Target->AddIncludeDirectory(includeDir, true); + this->Target->AddIncludeDirectory(this->DirInclude, true); } // Acquire rcc executable and features @@ -833,15 +843,6 @@ bool cmQtAutoGenInitializer::SetupCustomTargets() return false; } - // Configuration include directories - std::string includeDir = "include"; - std::map includeDirs; - for (std::string const& cfg : this->ConfigsList) { - std::string& dir = includeDirs[cfg]; - dir = "include_"; - dir += cfg; - } - // Generate autogen target info file if (this->Moc.Enabled || this->Uic.Enabled) { if (this->Moc.Enabled) { @@ -913,9 +914,9 @@ bool cmQtAutoGenInitializer::SetupCustomTargets() MfDef("CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE")); CWrite("AM_BUILD_DIR", this->DirBuild); if (this->MultiConfig) { - CWriteMap("AM_INCLUDE_DIR", includeDirs); + CWriteMap("AM_INCLUDE_DIR", this->DirConfigInclude); } else { - CWrite("AM_INCLUDE_DIR", includeDir); + CWrite("AM_INCLUDE_DIR", this->DirInclude); } ofs << "# Files\n"; @@ -1014,9 +1015,9 @@ bool cmQtAutoGenInitializer::SetupCustomTargets() ofs << "# Directories\n"; CWrite("ARCC_BUILD_DIR", this->DirBuild); if (this->MultiConfig) { - CWriteMap("ARCC_INCLUDE_DIR", includeDirs); + CWriteMap("ARCC_INCLUDE_DIR", this->DirConfigInclude); } else { - CWrite("ARCC_INCLUDE_DIR", includeDir); + CWrite("ARCC_INCLUDE_DIR", this->DirInclude); } ofs << "# Rcc executable\n"; diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index 0999e0f..387b3bc 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -90,6 +90,8 @@ private: std::string DirInfo; std::string DirBuild; std::string DirWork; + std::string DirInclude; + std::map DirConfigInclude; // Sources std::vector Headers; std::vector Sources; diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx index a6b0247..c364700 100644 --- a/Source/cmQtAutoGeneratorMocUic.cxx +++ b/Source/cmQtAutoGeneratorMocUic.cxx @@ -1247,14 +1247,11 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile) return false; } // include directory - { - std::string dirRel = InfoGetConfig("AM_INCLUDE_DIR"); - if (dirRel.empty()) { - Log().ErrorFile(GeneratorT::GEN, InfoFile(), - "Autogen include directory missing"); - return false; - } - Base_.AutogenIncludeDir = Base_.AbsoluteBuildPath(dirRel); + Base_.AutogenIncludeDir = InfoGetConfig("AM_INCLUDE_DIR"); + if (Base_.AutogenIncludeDir.empty()) { + Log().ErrorFile(GeneratorT::GEN, InfoFile(), + "Autogen include directory missing"); + return false; } // - Files diff --git a/Source/cmQtAutoGeneratorRcc.cxx b/Source/cmQtAutoGeneratorRcc.cxx index e49599f..6caa0d8 100644 --- a/Source/cmQtAutoGeneratorRcc.cxx +++ b/Source/cmQtAutoGeneratorRcc.cxx @@ -141,9 +141,7 @@ bool cmQtAutoGeneratorRcc::Init(cmMakefile* makefile) // Compute rcc output file name if (IsMultiConfig()) { - RccFileOutput_ = AutogenBuildDir_; - RccFileOutput_ += '/'; - RccFileOutput_ += IncludeDir_; + RccFileOutput_ = IncludeDir_; RccFileOutput_ += '/'; RccFileOutput_ += MultiConfigOutput(); } else { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2e9199b291879d9a47759faa178fb2f35b12bd64 commit 2e9199b291879d9a47759faa178fb2f35b12bd64 Author: Sebastian Holtermann AuthorDate: Mon Jul 30 09:18:13 2018 +0200 Commit: Sebastian Holtermann CommitDate: Mon Jul 30 09:22:46 2018 +0200 cmLocalGenerator: Respect user requested implicit include directories order In ``cmLocalGenerator::GetIncludeDirectories`` append the user requested implicit include directories first, then append the remaining implicit include directories. By By doing so we keep the user requested order of implicit include directories. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 647697a..a669477 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -960,15 +960,14 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, } if (!stripImplicitDirs) { - if (!appendAllImplicitDirs) { - // Append only those implicit directories that were requested by the user - for (std::string const& i : implicitDirs) { - if (std::find(userDirs.begin(), userDirs.end(), i) != userDirs.end()) { - dirs.push_back(i); - } + // Append only implicit directories that were requested by the user + for (std::string const& i : implicitDirs) { + if (std::find(userDirs.begin(), userDirs.end(), i) != userDirs.end()) { + dirs.push_back(i); } - } else { - // Append all implicit directories + } + // Append remaining implicit directories on demand + if (appendAllImplicitDirs) { for (std::string const& i : implicitDirs) { if (std::find(dirs.begin(), dirs.end(), i) == dirs.end()) { dirs.push_back(i); ----------------------------------------------------------------------- Summary of changes: Source/cmLocalGenerator.cxx | 15 +- Source/cmQtAutoGenInitializer.cxx | 1411 +++++++++++++++------------- Source/cmQtAutoGenInitializer.h | 40 +- Source/cmQtAutoGeneratorMocUic.cxx | 13 +- Source/cmQtAutoGeneratorRcc.cxx | 4 +- Tests/QtAutogen/CommonTests.cmake | 3 + Tests/QtAutogen/MocOsMacros/CMakeLists.txt | 16 + Tests/QtAutogen/MocOsMacros/TestClass.cpp | 77 ++ Tests/QtAutogen/MocOsMacros/TestClass.hpp | 52 + Tests/QtAutogen/MocOsMacros/main.cpp | 32 + 10 files changed, 957 insertions(+), 706 deletions(-) create mode 100644 Tests/QtAutogen/MocOsMacros/CMakeLists.txt create mode 100644 Tests/QtAutogen/MocOsMacros/TestClass.cpp create mode 100644 Tests/QtAutogen/MocOsMacros/TestClass.hpp create mode 100644 Tests/QtAutogen/MocOsMacros/main.cpp hooks/post-receive -- CMake