From kwrobot at kitware.com Mon Apr 1 00:03:13 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 1 Apr 2019 00:03:13 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-544-g5ad73b6 Message-ID: <20190401040313.2B42D10ED9C@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 5ad73b608d4fc7cc6b30017159b800802a503b0c (commit) from 11475cc5811e6d665cb41fcb1b7f68e6f1cb8af6 (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=5ad73b608d4fc7cc6b30017159b800802a503b0c commit 5ad73b608d4fc7cc6b30017159b800802a503b0c Author: Kitware Robot AuthorDate: Mon Apr 1 00:01:11 2019 -0400 Commit: Kitware Robot CommitDate: Mon Apr 1 00:01:11 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0d0ef6a..7906a0b 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 14) -set(CMake_VERSION_PATCH 20190331) +set(CMake_VERSION_PATCH 20190401) #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 Apr 1 09:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 1 Apr 2019 09:03:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-546-gc5eb01d Message-ID: <20190401130305.0A337FBB02@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 c5eb01d4d412610673c85ca1bf8b9d15c168ab5e (commit) via 99698ee351a6ec05ec1436299818e759a58bc0a3 (commit) from 5ad73b608d4fc7cc6b30017159b800802a503b0c (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=c5eb01d4d412610673c85ca1bf8b9d15c168ab5e commit c5eb01d4d412610673c85ca1bf8b9d15c168ab5e Merge: 5ad73b6 99698ee Author: Craig Scott AuthorDate: Mon Apr 1 12:57:02 2019 +0000 Commit: Kitware Robot CommitDate: Mon Apr 1 08:57:13 2019 -0400 Merge topic 'bug/missed-return-on-cli-errors' 99698ee351 cmake: Fix missed `return` statement when CLI errors found Acked-by: Kitware Robot Merge-request: !3171 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=99698ee351a6ec05ec1436299818e759a58bc0a3 commit 99698ee351a6ec05ec1436299818e759a58bc0a3 Author: Alex Turbov AuthorDate: Sun Mar 31 23:35:56 2019 +0800 Commit: Craig Scott CommitDate: Mon Apr 1 08:31:25 2019 +1100 cmake: Fix missed `return` statement when CLI errors found diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 8c1a359..fc24ac0 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -710,6 +710,7 @@ void cmake::SetArgs(const std::vector& args) this->GraphVizFile = path; if (this->GraphVizFile.empty()) { cmSystemTools::Error("No file specified for --graphviz"); + return; } } else if (arg.find("--debug-trycompile", 0) == 0) { std::cout << "debug trycompile on\n"; @@ -797,9 +798,9 @@ void cmake::SetArgs(const std::vector& args) cmSystemTools::Error("Could not create named generator " + value + kdevError); this->PrintGeneratorList(); - } else { - this->SetGlobalGenerator(gen); + return; } + this->SetGlobalGenerator(gen); } // no option assume it is the path to the source or an existing build else { ----------------------------------------------------------------------- Summary of changes: Source/cmake.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Apr 1 10:33:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 1 Apr 2019 10:33:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-548-g922480e Message-ID: <20190401143305.50C68111EF8@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 922480e6f14fa5b248475fb58ab07c3b2ef5befa (commit) via 6d5872a3969b75686ee7d67449581ab723559bf5 (commit) from c5eb01d4d412610673c85ca1bf8b9d15c168ab5e (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=922480e6f14fa5b248475fb58ab07c3b2ef5befa commit 922480e6f14fa5b248475fb58ab07c3b2ef5befa Merge: c5eb01d 6d5872a Author: Brad King AuthorDate: Mon Apr 1 14:31:00 2019 +0000 Commit: Kitware Robot CommitDate: Mon Apr 1 10:31:11 2019 -0400 Merge topic 'allow_aliasing_unkown_targets' 6d5872a396 add_library: Now support aliasing unknown import targets Acked-by: Kitware Robot Merge-request: !3148 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6d5872a3969b75686ee7d67449581ab723559bf5 commit 6d5872a3969b75686ee7d67449581ab723559bf5 Author: Robert Maynard AuthorDate: Tue Mar 26 08:25:00 2019 -0400 Commit: Robert Maynard CommitDate: Tue Mar 26 15:54:48 2019 -0400 add_library: Now support aliasing unknown import targets Fixes #18327 diff --git a/Help/release/dev/allow-aliasing-unkown-import-targets.rst b/Help/release/dev/allow-aliasing-unkown-import-targets.rst new file mode 100644 index 0000000..aa5da0c --- /dev/null +++ b/Help/release/dev/allow-aliasing-unkown-import-targets.rst @@ -0,0 +1,5 @@ +allow-aliasing-unkown-import-targets +------------------------------------ + +* :command:`add_library` command ``ALIAS`` option learned to support + import libraries of the ``UNKNOWN`` type. diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index 5149333..adf4464 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -222,7 +222,9 @@ bool cmAddLibraryCommand::InitialPass(std::vector const& args, aliasedType != cmStateEnums::STATIC_LIBRARY && aliasedType != cmStateEnums::MODULE_LIBRARY && aliasedType != cmStateEnums::OBJECT_LIBRARY && - aliasedType != cmStateEnums::INTERFACE_LIBRARY) { + aliasedType != cmStateEnums::INTERFACE_LIBRARY && + !(aliasedType == cmStateEnums::UNKNOWN_LIBRARY && + aliasedTarget->IsImported())) { std::ostringstream e; e << "cannot create ALIAS target \"" << libName << "\" because target \"" << aliasedName << "\" is not a library."; diff --git a/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt index 5b99ea7..a9edf9a 100644 --- a/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt +++ b/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt @@ -17,7 +17,8 @@ create_header(bing) create_header(bung) create_header(arguments) create_header(list) -create_header(target) +create_header(target1) +create_header(target2) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -69,14 +70,23 @@ set_property(TARGET lib4 APPEND PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BI set_property(TARGET lib4 APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/foh;$") add_library(somelib::withcolons UNKNOWN IMPORTED) -set_property(TARGET somelib::withcolons PROPERTY IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/target") -set_property(TARGET somelib::withcolons PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/target") +set_property(TARGET somelib::withcolons PROPERTY IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/target1") +set_property(TARGET somelib::withcolons PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/target1") set_property(TARGET TargetIncludeDirectories APPEND PROPERTY INCLUDE_DIRECTORIES "$" ) +add_library(somelib_aliased UNKNOWN IMPORTED GLOBAL) +set_property(TARGET somelib_aliased PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/target2") +add_library(somelib::withcolons2 ALIAS somelib_aliased) + +set_property(TARGET TargetIncludeDirectories + APPEND PROPERTY INCLUDE_DIRECTORIES + "$" +) + add_custom_target(test_custom_target "some_bogus_custom_tool" $ diff --git a/Tests/IncludeDirectories/TargetIncludeDirectories/main.cpp b/Tests/IncludeDirectories/TargetIncludeDirectories/main.cpp index 2ee05e2..541ef92 100644 --- a/Tests/IncludeDirectories/TargetIncludeDirectories/main.cpp +++ b/Tests/IncludeDirectories/TargetIncludeDirectories/main.cpp @@ -10,7 +10,8 @@ #include "foo.h" #include "list.h" #include "prefix_foo_bar_bat.h" -#include "target.h" +#include "target1.h" +#include "target2.h" #include "ting.h" int main(int, char**) ----------------------------------------------------------------------- Summary of changes: .../release/dev/allow-aliasing-unkown-import-targets.rst | 5 +++++ Source/cmAddLibraryCommand.cxx | 4 +++- .../TargetIncludeDirectories/CMakeLists.txt | 16 +++++++++++++--- .../IncludeDirectories/TargetIncludeDirectories/main.cpp | 3 ++- 4 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 Help/release/dev/allow-aliasing-unkown-import-targets.rst hooks/post-receive -- CMake From kwrobot at kitware.com Mon Apr 1 10:43:03 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 1 Apr 2019 10:43:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-551-gafa2614 Message-ID: <20190401144303.17D66F9ACA@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 afa2614eea6571c36be130805ff876d25f3edae5 (commit) via 983533a4b8cc3abbeaf11c1cadad4e14dccc5824 (commit) via f92ccbc306c20554af35709faf00f402a6c34978 (commit) from 922480e6f14fa5b248475fb58ab07c3b2ef5befa (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=afa2614eea6571c36be130805ff876d25f3edae5 commit afa2614eea6571c36be130805ff876d25f3edae5 Merge: 922480e 983533a Author: Brad King AuthorDate: Mon Apr 1 14:41:41 2019 +0000 Commit: Kitware Robot CommitDate: Mon Apr 1 10:41:49 2019 -0400 Merge topic 'memorize_c_compilers_with_full_standard_support' 983533a4b8 Record when C compilers have gained full support for 90,99,11 f92ccbc306 CompileFeatures: memoize C compilers with full language level support Acked-by: Kitware Robot Merge-request: !3146 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=983533a4b8cc3abbeaf11c1cadad4e14dccc5824 commit 983533a4b8cc3abbeaf11c1cadad4e14dccc5824 Author: Robert Maynard AuthorDate: Mon Mar 25 15:07:07 2019 -0400 Commit: Robert Maynard CommitDate: Wed Mar 27 15:45:11 2019 -0400 Record when C compilers have gained full support for 90,99,11 diff --git a/Modules/Compiler/AppleClang-C.cmake b/Modules/Compiler/AppleClang-C.cmake index a48adec..2794f52 100644 --- a/Modules/Compiler/AppleClang-C.cmake +++ b/Modules/Compiler/AppleClang-C.cmake @@ -4,12 +4,15 @@ __compiler_clang(C) if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90") + set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99") set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99") + set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") + set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) endif() __compiler_check_default_language_standard(C 4.0 99) diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake index a07ae40..ff51d30 100644 --- a/Modules/Compiler/Clang-C.cmake +++ b/Modules/Compiler/Clang-C.cmake @@ -10,12 +10,15 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90") + set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99") set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99") + set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") + set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) else() # clang-cl doesn't have any of these set(CMAKE_C90_STANDARD_COMPILE_OPTION "") diff --git a/Modules/Compiler/Cray-C.cmake b/Modules/Compiler/Cray-C.cmake index d34154c..9340948 100644 --- a/Modules/Compiler/Cray-C.cmake +++ b/Modules/Compiler/Cray-C.cmake @@ -10,11 +10,14 @@ string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG") if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1) set(CMAKE_C90_STANDARD_COMPILE_OPTION -h noc99,conform) set(CMAKE_C90_EXTENSION_COMPILE_OPTION -h noc99,gnu) + set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_C99_STANDARD_COMPILE_OPTION -h c99,conform) set(CMAKE_C99_EXTENSION_COMPILE_OPTION -h c99,gnu) + set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.5) set(CMAKE_C11_STANDARD_COMPILE_OPTION -h std=c11,conform) set(CMAKE_C11_EXTENSION_COMPILE_OPTION -h std=c11,gnu) + set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) endif () endif () diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake index f072c54..ca286b3 100644 --- a/Modules/Compiler/GNU-C.cmake +++ b/Modules/Compiler/GNU-C.cmake @@ -10,13 +10,16 @@ elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) endif() if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) + set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99") set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99") + set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) endif() if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") + set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c1x") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu1x") diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake index 4e4af29..e9e59a2 100644 --- a/Modules/Compiler/Intel-C.cmake +++ b/Modules/Compiler/Intel-C.cmake @@ -12,13 +12,16 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 16.0.0) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-Qstd=c11") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-Qstd=c11") + set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) endif() if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.0) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-Qstd=c89") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-Qstd=c89") + set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_C99_STANDARD_COMPILE_OPTION "-Qstd=c99") set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-Qstd=c99") + set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) endif() else() @@ -26,13 +29,16 @@ else() if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") + set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) endif() if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.0) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu89") + set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99") set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99") + set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) endif() endif() diff --git a/Modules/Compiler/PGI-C.cmake b/Modules/Compiler/PGI-C.cmake index 3b3848a..c39dbe5 100644 --- a/Modules/Compiler/PGI-C.cmake +++ b/Modules/Compiler/PGI-C.cmake @@ -6,11 +6,14 @@ string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG") if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12.10) set(CMAKE_C90_STANDARD_COMPILE_OPTION -c89) set(CMAKE_C90_EXTENSION_COMPILE_OPTION -c89) + set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_C99_STANDARD_COMPILE_OPTION -c99) set(CMAKE_C99_EXTENSION_COMPILE_OPTION -c99) + set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 15.3) set(CMAKE_C11_STANDARD_COMPILE_OPTION -c11) set(CMAKE_C11_EXTENSION_COMPILE_OPTION -c11) + set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) endif () endif () diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake index c4aba8e..7e962b8 100644 --- a/Modules/Compiler/SunPro-C.cmake +++ b/Modules/Compiler/SunPro-C.cmake @@ -39,10 +39,13 @@ set(CMAKE_C_LINKER_WRAPPER_FLAG_SEP ",") if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 5.13) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=c89") + set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99") set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=c99") + set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=c11") + set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) elseif (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 5.11) set(CMAKE_C90_STANDARD_COMPILE_OPTION "") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "") diff --git a/Modules/Compiler/XL-C.cmake b/Modules/Compiler/XL-C.cmake index 6fc9728..2077bda 100644 --- a/Modules/Compiler/XL-C.cmake +++ b/Modules/Compiler/XL-C.cmake @@ -9,11 +9,14 @@ string(APPEND CMAKE_C_FLAGS_INIT " -qthreaded") if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-qlanglvl=stdc89") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-qlanglvl=extc89") + set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_C99_STANDARD_COMPILE_OPTION "-qlanglvl=stdc99") set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-qlanglvl=extc99") + set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12.1) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-qlanglvl=extc1x") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-qlanglvl=extc1x") + set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) endif () endif() diff --git a/Modules/Compiler/XLClang-C.cmake b/Modules/Compiler/XLClang-C.cmake index 8e8fcf2..54c18a6 100644 --- a/Modules/Compiler/XLClang-C.cmake +++ b/Modules/Compiler/XLClang-C.cmake @@ -4,13 +4,16 @@ __compiler_xlclang(C) if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu89") + set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99") set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99") + set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-qlanglvl=extc1x") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-qlanglvl=extc1x") if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") + set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) endif () endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f92ccbc306c20554af35709faf00f402a6c34978 commit f92ccbc306c20554af35709faf00f402a6c34978 Author: Robert Maynard AuthorDate: Wed Mar 6 12:28:00 2019 -0500 Commit: Robert Maynard CommitDate: Wed Mar 27 15:45:11 2019 -0400 CompileFeatures: memoize C compilers with full language level support Previously compilers that had full support for a language standard level was forced to verify this every time a new build directory was created. Now we record this information and insert the correct granular compile features instead of doing a try_compile. diff --git a/Modules/Compiler/CMakeCommonCompilerMacros.cmake b/Modules/Compiler/CMakeCommonCompilerMacros.cmake index ad464c7..9c62e10 100644 --- a/Modules/Compiler/CMakeCommonCompilerMacros.cmake +++ b/Modules/Compiler/CMakeCommonCompilerMacros.cmake @@ -65,13 +65,28 @@ endmacro() macro(cmake_record_c_compile_features) set(_result 0) if(_result EQUAL 0 AND DEFINED CMAKE_C11_STANDARD_COMPILE_OPTION) - _record_compiler_features_c(11) + if(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT) + _has_compiler_features_c(11) + else() + _record_compiler_features_c(11) + endif() + unset(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT) endif() if(_result EQUAL 0 AND DEFINED CMAKE_C99_STANDARD_COMPILE_OPTION) - _record_compiler_features_c(99) + if(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT) + _has_compiler_features_c(99) + else() + _record_compiler_features_c(99) + endif() + unset(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT) endif() if(_result EQUAL 0 AND DEFINED CMAKE_C90_STANDARD_COMPILE_OPTION) - _record_compiler_features_c(90) + if(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT) + _has_compiler_features_c(90) + else() + _record_compiler_features_c(90) + endif() + unset(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT) endif() endmacro() diff --git a/Modules/Internal/FeatureTesting.cmake b/Modules/Internal/FeatureTesting.cmake index b9c20ec..f7b3e96 100644 --- a/Modules/Internal/FeatureTesting.cmake +++ b/Modules/Internal/FeatureTesting.cmake @@ -88,3 +88,14 @@ macro(_record_compiler_features_cxx std) endif() unset(lang_level_has_features) endmacro() + +macro(_has_compiler_features lang level compile_flags feature_list) + # presume all known features are supported + get_property(known_features GLOBAL PROPERTY CMAKE_${lang}${level}_KNOWN_FEATURES) + list(APPEND ${feature_list} ${known_features}) +endmacro() + +macro(_has_compiler_features_c std) + list(APPEND CMAKE_C${std}_COMPILE_FEATURES c_std_${std}) + _has_compiler_features(C ${std} "${CMAKE_C${std}_STANDARD_COMPILE_OPTION}" CMAKE_C${std}_COMPILE_FEATURES) +endmacro() ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/AppleClang-C.cmake | 3 +++ Modules/Compiler/CMakeCommonCompilerMacros.cmake | 21 ++++++++++++++++++--- Modules/Compiler/Clang-C.cmake | 3 +++ Modules/Compiler/Cray-C.cmake | 3 +++ Modules/Compiler/GNU-C.cmake | 3 +++ Modules/Compiler/Intel-C.cmake | 6 ++++++ Modules/Compiler/PGI-C.cmake | 3 +++ Modules/Compiler/SunPro-C.cmake | 3 +++ Modules/Compiler/XL-C.cmake | 3 +++ Modules/Compiler/XLClang-C.cmake | 3 +++ Modules/Internal/FeatureTesting.cmake | 11 +++++++++++ 11 files changed, 59 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Apr 1 10:53:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 1 Apr 2019 10:53:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-567-g3e129d7 Message-ID: <20190401145304.9CF28FBB02@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 3e129d71bc12a325c0548aaaea24470cd172470b (commit) via 29802ed27227fe91be1d531d6e894e4efbbb3d11 (commit) via fa2dbbbdde6c0861b2a950db1e5e2bb8476a8d19 (commit) via 6b5fb23e362d8e99e5fe78334d4bcec5e2ad8f29 (commit) via 249fb7f71d6ed5feaae0dfbfa48f9bf665b1f551 (commit) via 735c6f39d9bed0ee291ce20368028ae682756095 (commit) via 2d66567dca2a5a80e41493ec0a9d6d86f7d955f5 (commit) via f13aef4de57a74db72c258edb78108da60a030f1 (commit) via e9bbfdd9a115332deb40da10784d478f4930c68f (commit) via 7d19b3091d7d2982a0d6b2b4408011efbb56f167 (commit) via dda01904587627a3d2bda5b684f7bef1e62596bb (commit) via 390f14a24416f23801f5644eb51590f8317d35c7 (commit) via 87341d8328c7b3a1d50cfd534ff4cb44334a2561 (commit) via 5a15c9e7cb63fb5b884271a1184607a8fa87d442 (commit) via 5f6c236481da552dfdbfff6579dc9d833993adad (commit) via 18c30786a9a1444e726e23366dd9badb01f1d464 (commit) from afa2614eea6571c36be130805ff876d25f3edae5 (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=3e129d71bc12a325c0548aaaea24470cd172470b commit 3e129d71bc12a325c0548aaaea24470cd172470b Merge: 29802ed 7d19b30 Author: Brad King AuthorDate: Mon Apr 1 14:48:52 2019 +0000 Commit: Kitware Robot CommitDate: Mon Apr 1 10:49:02 2019 -0400 Merge topic 'project-include' 7d19b3091d Release note for CMAKE_PROJECT_INCLUDE variable dda0190458 project: Add variable CMAKE_PROJECT_INCLUDE 390f14a244 Test ProjectInclude: Add NONE to avoid enabling languages Acked-by: Kitware Robot Merge-request: !3155 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=29802ed27227fe91be1d531d6e894e4efbbb3d11 commit 29802ed27227fe91be1d531d6e894e4efbbb3d11 Merge: fa2dbbb f13aef4 Author: Brad King AuthorDate: Mon Apr 1 14:46:18 2019 +0000 Commit: Kitware Robot CommitDate: Mon Apr 1 10:47:13 2019 -0400 Merge topic 'refactor-cmcmd' f13aef4de5 cmcmd: Modernize for loops with cmMakeRange e9bbfdd9a1 cmcmd: Pass args vector by const& Acked-by: Kitware Robot Merge-request: !3168 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fa2dbbbdde6c0861b2a950db1e5e2bb8476a8d19 commit fa2dbbbdde6c0861b2a950db1e5e2bb8476a8d19 Merge: 6b5fb23 2d66567 Author: Brad King AuthorDate: Mon Apr 1 14:46:16 2019 +0000 Commit: Kitware Robot CommitDate: Mon Apr 1 10:46:24 2019 -0400 Merge topic 'utilize-substr' 2d66567dca Modernize: Prefer .substr in place of .c_str() + int Acked-by: Kitware Robot Acked-by: Sebastian Holtermann Merge-request: !3169 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6b5fb23e362d8e99e5fe78334d4bcec5e2ad8f29 commit 6b5fb23e362d8e99e5fe78334d4bcec5e2ad8f29 Merge: 249fb7f 735c6f3 Author: Brad King AuthorDate: Mon Apr 1 14:43:39 2019 +0000 Commit: Kitware Robot CommitDate: Mon Apr 1 10:43:48 2019 -0400 Merge topic 'fix_doxygen_comments' 735c6f39d9 Fix invalid ///! doxygen comment line starts Acked-by: Kitware Robot Merge-request: !3170 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=249fb7f71d6ed5feaae0dfbfa48f9bf665b1f551 commit 249fb7f71d6ed5feaae0dfbfa48f9bf665b1f551 Merge: afa2614 87341d8 Author: Brad King AuthorDate: Mon Apr 1 14:42:49 2019 +0000 Commit: Kitware Robot CommitDate: Mon Apr 1 10:42:58 2019 -0400 Merge topic 'cmDepends_tweaks' 87341d8328 cmDepends: Define DependencyMap instead of DependencyVector 5a15c9e7cb cmDepends: Refactor cmDepends::CheckDependencies method 5f6c236481 cmFiletimeCache: Add cmFiletimeCache::Remove method 18c30786a9 cmFileTime: Make cmFileTime::Compare method const Acked-by: Kitware Robot Merge-request: !3156 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=735c6f39d9bed0ee291ce20368028ae682756095 commit 735c6f39d9bed0ee291ce20368028ae682756095 Author: Sebastian Holtermann AuthorDate: Sun Mar 31 11:27:12 2019 +0200 Commit: Sebastian Holtermann CommitDate: Sun Mar 31 11:27:12 2019 +0200 Fix invalid ///! doxygen comment line starts In various places `///!` was used to start a comment line. This is not valid Doygen syntax. This patch replaces `///!` comment starts with `//!`. diff --git a/Source/CTest/cmCTestBuildAndTestHandler.h b/Source/CTest/cmCTestBuildAndTestHandler.h index 5e6d0aa..2d47b15 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.h +++ b/Source/CTest/cmCTestBuildAndTestHandler.h @@ -44,7 +44,7 @@ public: void Initialize() override; protected: - ///! Run CMake and build a test and then run it as a single test. + //! Run CMake and build a test and then run it as a single test. int RunCMakeAndTest(std::string* output); int RunCMake(std::string* outstring, std::ostringstream& out, std::string& cmakeOutString, cmake* cm); diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h index 8880dac..746d72c 100644 --- a/Source/CTest/cmCTestMemCheckHandler.h +++ b/Source/CTest/cmCTestMemCheckHandler.h @@ -114,7 +114,7 @@ private: // this type of checker void InitializeResultsVectors(); - ///! Initialize memory checking subsystem. + //! Initialize memory checking subsystem. bool InitializeMemoryChecking(); /** @@ -143,11 +143,11 @@ private: void PostProcessTest(cmCTestTestResult& res, int test); void PostProcessBoundsCheckerTest(cmCTestTestResult& res, int test); - ///! append MemoryTesterOutputFile to the test log + //! append MemoryTesterOutputFile to the test log void AppendMemTesterOutput(cmCTestTestHandler::cmCTestTestResult& res, std::string const& filename); - ///! generate the output filename for the given test index + //! generate the output filename for the given test index void TestOutputFileNames(int test, std::vector& files); }; diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 17d5f3f..7f3f5e4 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -59,7 +59,7 @@ public: */ void PopulateCustomVectors(cmMakefile* mf) override; - ///! Control the use of the regular expresisons, call these methods to turn + //! Control the use of the regular expresisons, call these methods to turn /// them on void UseIncludeRegExp(); void UseExcludeRegExp(); @@ -78,7 +78,7 @@ public: this->CustomMaximumFailedTestOutputSize = n; } - ///! pass the -I argument down + //! pass the -I argument down void SetTestsToRunInformation(const char*); cmCTestTestHandler(); diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 0c70ed2..65f22f7 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -93,33 +93,33 @@ public: CacheEntry& GetEntry() { return this->Position->second; } }; - ///! return an iterator to iterate through the cache map + //! return an iterator to iterate through the cache map cmCacheManager::CacheIterator NewIterator() { return CacheIterator(*this); } - ///! Load a cache for given makefile. Loads from path/CMakeCache.txt. + //! Load a cache for given makefile. Loads from path/CMakeCache.txt. bool LoadCache(const std::string& path, bool internal, std::set& excludes, std::set& includes); - ///! Save cache for given makefile. Saves to output path/CMakeCache.txt + //! Save cache for given makefile. Saves to output path/CMakeCache.txt bool SaveCache(const std::string& path, cmMessenger* messenger); - ///! Delete the cache given + //! Delete the cache given bool DeleteCache(const std::string& path); - ///! Print the cache to a stream + //! Print the cache to a stream void PrintCache(std::ostream&) const; - ///! Get the iterator for an entry with a given key. + //! Get the iterator for an entry with a given key. cmCacheManager::CacheIterator GetCacheIterator(const char* key = nullptr); - ///! Remove an entry from the cache + //! Remove an entry from the cache void RemoveCacheEntry(const std::string& key); - ///! Get the number of entries in the cache + //! Get the number of entries in the cache int GetSize() { return static_cast(this->Cache.size()); } - ///! Get a value from the cache given a key + //! Get a value from the cache given a key const std::string* GetInitializedCacheValue(const std::string& key) const; const char* GetCacheEntryValue(const std::string& key) @@ -197,14 +197,14 @@ public: unsigned int GetCacheMinorVersion() const { return this->CacheMinorVersion; } protected: - ///! Add an entry into the cache + //! Add an entry into the cache void AddCacheEntry(const std::string& key, const char* value, const char* helpString, cmStateEnums::CacheEntryType type); - ///! Get a cache entry object for a key + //! Get a cache entry object for a key CacheEntry* GetCacheEntry(const std::string& key); - ///! Clean out the CMakeFiles directory if no CMakeCache.txt + //! Clean out the CMakeFiles directory if no CMakeCache.txt void CleanCMakeFiles(const std::string& path); // Cache version info diff --git a/Source/cmCallVisualStudioMacro.cxx b/Source/cmCallVisualStudioMacro.cxx index ee5feee..2f6cf64 100644 --- a/Source/cmCallVisualStudioMacro.cxx +++ b/Source/cmCallVisualStudioMacro.cxx @@ -35,8 +35,8 @@ static bool LogErrorsAsMessages; # endif # endif -///! Use ReportHRESULT to make a cmSystemTools::Message after calling -///! a COM method that may have failed. +//! Use ReportHRESULT to make a cmSystemTools::Message after calling +//! a COM method that may have failed. # define ReportHRESULT(hr, context) \ if (FAILED(hr)) { \ if (LogErrorsAsMessages) { \ @@ -50,7 +50,7 @@ static bool LogErrorsAsMessages; } \ } -///! Using the given instance of Visual Studio, call the named macro +//! Using the given instance of Visual Studio, call the named macro HRESULT InstanceCallMacro(IDispatch* vsIDE, const std::string& macro, const std::string& args) { @@ -133,7 +133,7 @@ HRESULT InstanceCallMacro(IDispatch* vsIDE, const std::string& macro, return hr; } -///! Get the Solution object from the IDE object +//! Get the Solution object from the IDE object HRESULT GetSolutionObject(IDispatch* vsIDE, IDispatchPtr& vsSolution) { HRESULT hr = E_POINTER; @@ -176,7 +176,7 @@ HRESULT GetSolutionObject(IDispatch* vsIDE, IDispatchPtr& vsSolution) return hr; } -///! Get the FullName property from the Solution object +//! Get the FullName property from the Solution object HRESULT GetSolutionFullName(IDispatch* vsSolution, std::string& fullName) { HRESULT hr = E_POINTER; @@ -220,7 +220,7 @@ HRESULT GetSolutionFullName(IDispatch* vsSolution, std::string& fullName) return hr; } -///! Get the FullName property from the Solution object, given the IDE object +//! Get the FullName property from the Solution object, given the IDE object HRESULT GetIDESolutionFullName(IDispatch* vsIDE, std::string& fullName) { IDispatchPtr vsSolution; @@ -235,8 +235,8 @@ HRESULT GetIDESolutionFullName(IDispatch* vsIDE, std::string& fullName) return hr; } -///! Get all running objects from the Windows running object table. -///! Save them in a map by their display names. +//! Get all running objects from the Windows running object table. +//! Save them in a map by their display names. HRESULT GetRunningInstances(std::map& mrot) { // mrot == Map of the Running Object Table @@ -292,8 +292,8 @@ HRESULT GetRunningInstances(std::map& mrot) return hr; } -///! Do the two file names refer to the same Visual Studio solution? Or are -///! we perhaps looking for any and all solutions? +//! Do the two file names refer to the same Visual Studio solution? Or are +//! we perhaps looking for any and all solutions? bool FilesSameSolution(const std::string& slnFile, const std::string& slnName) { if (slnFile == "ALL" || slnName == "ALL") { @@ -310,9 +310,9 @@ bool FilesSameSolution(const std::string& slnFile, const std::string& slnName) return s1 == s2; } -///! Find instances of Visual Studio with the given solution file -///! open. Pass "ALL" for slnFile to gather all running instances -///! of Visual Studio. +//! Find instances of Visual Studio with the given solution file +//! open. Pass "ALL" for slnFile to gather all running instances +//! of Visual Studio. HRESULT FindVisualStudioInstances(const std::string& slnFile, std::vector& instances) { @@ -384,8 +384,8 @@ int cmCallVisualStudioMacro::GetNumberOfRunningVisualStudioInstances( return count; } -///! Get all running objects from the Windows running object table. -///! Save them in a map by their display names. +//! Get all running objects from the Windows running object table. +//! Save them in a map by their display names. int cmCallVisualStudioMacro::CallMacro(const std::string& slnFile, const std::string& macro, const std::string& args, diff --git a/Source/cmCallVisualStudioMacro.h b/Source/cmCallVisualStudioMacro.h index fdc9e66..9b5b3a8 100644 --- a/Source/cmCallVisualStudioMacro.h +++ b/Source/cmCallVisualStudioMacro.h @@ -16,16 +16,16 @@ class cmCallVisualStudioMacro { public: - ///! Call the named macro in instances of Visual Studio with the - ///! given solution file open. Pass "ALL" for slnFile to call the - ///! macro in each Visual Studio instance. + //! Call the named macro in instances of Visual Studio with the + //! given solution file open. Pass "ALL" for slnFile to call the + //! macro in each Visual Studio instance. static int CallMacro(const std::string& slnFile, const std::string& macro, const std::string& args, const bool logErrorsAsMessages); - ///! Count the number of running instances of Visual Studio with the - ///! given solution file open. Pass "ALL" for slnFile to count all - ///! running Visual Studio instances. + //! Count the number of running instances of Visual Studio with the + //! given solution file open. Pass "ALL" for slnFile to count all + //! running Visual Studio instances. static int GetNumberOfRunningVisualStudioInstances( const std::string& slnFile); diff --git a/Source/cmExternalMakefileProjectGenerator.h b/Source/cmExternalMakefileProjectGenerator.h index 4438f28..a472a06 100644 --- a/Source/cmExternalMakefileProjectGenerator.h +++ b/Source/cmExternalMakefileProjectGenerator.h @@ -31,13 +31,13 @@ public: virtual void EnableLanguage(std::vector const& languages, cmMakefile*, bool optional); - ///! set the global generator which will generate the makefiles + //! set the global generator which will generate the makefiles virtual void SetGlobalGenerator(cmGlobalGenerator* generator) { this->GlobalGenerator = generator; } - ///! Return the list of global generators supported by this extra generator + //! Return the list of global generators supported by this extra generator const std::vector& GetSupportedGlobalGenerators() const { return this->SupportedGlobalGenerators; @@ -49,7 +49,7 @@ public: static std::string CreateFullGeneratorName( const std::string& globalGenerator, const std::string& extraGenerator); - ///! Generate the project files, the Makefiles have already been generated + //! Generate the project files, the Makefiles have already been generated virtual void Generate() = 0; void SetName(const std::string& n) { Name = n; } @@ -59,9 +59,9 @@ public: bool dryRun); protected: - ///! Contains the names of the global generators support by this generator. + //! Contains the names of the global generators support by this generator. std::vector SupportedGlobalGenerators; - ///! the global generator which creates the makefiles + //! the global generator which creates the makefiles const cmGlobalGenerator* GlobalGenerator = nullptr; std::string Name; diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index bc966e1..3f2025e 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -69,9 +69,9 @@ public: std::string GetExportName() const; std::vector GetPropertyKeys() const; - ///! Might return a nullptr if the property is not set or invalid + //! 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 + //! 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, @@ -602,7 +602,7 @@ public: pdb output directory is given. */ std::string GetPDBDirectory(const std::string& config) const; - ///! Return the preferred linker language for this target + //! Return the preferred linker language for this target std::string GetLinkerLanguage(const std::string& config) const; /** Does this target have a GNU implib to convert to MS format? */ diff --git a/Source/cmGlobVerificationManager.h b/Source/cmGlobVerificationManager.h index f7146be..48606d3 100644 --- a/Source/cmGlobVerificationManager.h +++ b/Source/cmGlobVerificationManager.h @@ -22,11 +22,11 @@ class cmGlobVerificationManager { protected: - ///! Save verification script for given makefile. - ///! Saves to output //VerifyGlobs.cmake + //! Save verification script for given makefile. + //! Saves to output //VerifyGlobs.cmake bool SaveVerificationScript(const std::string& path); - ///! Add an entry into the glob cache + //! Add an entry into the glob cache void AddCacheEntry(bool recurse, bool listDirectories, bool followSymlinks, const std::string& relative, const std::string& expression, @@ -34,13 +34,13 @@ protected: const std::string& variable, const cmListFileBacktrace& bt); - ///! Clear the glob cache for state reset. + //! Clear the glob cache for state reset. void Reset(); - ///! Check targets should be written in generated build system. + //! Check targets should be written in generated build system. bool DoWriteVerifyTarget() const; - ///! Get the paths to the generated script and stamp files + //! Get the paths to the generated script and stamp files std::string const& GetVerifyScript() const { return this->VerifyScript; } std::string const& GetVerifyStamp() const { return this->VerifyStamp; } diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx index 281d371..51d681d 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.cxx +++ b/Source/cmGlobalBorlandMakefileGenerator.cxx @@ -34,7 +34,7 @@ void cmGlobalBorlandMakefileGenerator::EnableLanguage( this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); } -///! Create a local generator appropriate to this Global Generator +//! Create a local generator appropriate to this Global Generator cmLocalGenerator* cmGlobalBorlandMakefileGenerator::CreateLocalGenerator( cmMakefile* mf) { diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h index 02d0d5f..ee7de70 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.h +++ b/Source/cmGlobalBorlandMakefileGenerator.h @@ -22,7 +22,7 @@ public: cmGlobalBorlandMakefileGenerator>(); } - ///! Get the name for the generator. + //! Get the name for the generator. std::string GetName() const override { return cmGlobalBorlandMakefileGenerator::GetActualName(); @@ -32,7 +32,7 @@ public: /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); - ///! Create a local generator appropriate to this Global Generator + //! Create a local generator appropriate to this Global Generator cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) override; /** diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 17eb340..88c586a 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -86,13 +86,13 @@ struct GeneratedMakeCommand class cmGlobalGenerator { public: - ///! Free any memory allocated with the GlobalGenerator + //! Free any memory allocated with the GlobalGenerator cmGlobalGenerator(cmake* cm); virtual ~cmGlobalGenerator(); virtual cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf); - ///! Get the name for this generator + //! Get the name for this generator virtual std::string GetName() const { return "Generic"; } /** Check whether the given name matches the current generator. */ @@ -236,7 +236,7 @@ public: const std::string& native, bool ignoreErrors); - ///! Get the CMake instance + //! Get the CMake instance cmake* GetCMakeInstance() const { return this->CMakeInstance; } void SetConfiguredFilesPath(cmGlobalGenerator* gen); @@ -261,7 +261,7 @@ public: void AddMakefile(cmMakefile* mf); - ///! Set an generator for an "external makefile based project" + //! Set an generator for an "external makefile based project" void SetExternalMakefileProjectGenerator( cmExternalMakefileProjectGenerator* extraGenerator); @@ -290,19 +290,19 @@ public: bool GetForceUnixPaths() const { return this->ForceUnixPaths; } bool GetToolSupportsColor() const { return this->ToolSupportsColor; } - ///! return the language for the given extension + //! return the language for the given extension std::string GetLanguageFromExtension(const char* ext) const; - ///! is an extension to be ignored + //! is an extension to be ignored bool IgnoreFile(const char* ext) const; - ///! What is the preference for linkers and this language (None or Preferred) + //! What is the preference for linkers and this language (None or Preferred) int GetLinkerPreference(const std::string& lang) const; - ///! What is the object file extension for a given source file? + //! What is the object file extension for a given source file? std::string GetLanguageOutputExtension(cmSourceFile const&) const; - ///! What is the configurations directory variable called? + //! What is the configurations directory variable called? virtual const char* GetCMakeCFGIntDir() const { return "."; } - ///! expand CFGIntDir for a configuration + //! expand CFGIntDir for a configuration virtual std::string ExpandCFGIntDir(const std::string& str, const std::string& config) const; @@ -318,7 +318,7 @@ public: */ virtual bool FindMakeProgram(cmMakefile*); - ///! Find a target by name by searching the local generators. + //! Find a target by name by searching the local generators. cmTarget* FindTarget(const std::string& name, bool excludeAliases = false) const; diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index f8df6ef..ae27806 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -34,13 +34,13 @@ public: return new cmGlobalGeneratorSimpleFactory(); } - ///! create the correct local generator + //! create the correct local generator cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) override; /// @return the name of this generator. static std::string GetActualName() { return "Green Hills MULTI"; } - ///! Get the name for this generator + //! Get the name for this generator std::string GetName() const override { return GetActualName(); } /// Overloaded methods. @see cmGlobalGenerator::GetDocumentation() diff --git a/Source/cmGlobalJOMMakefileGenerator.h b/Source/cmGlobalJOMMakefileGenerator.h index 341b2dd..df3aec9 100644 --- a/Source/cmGlobalJOMMakefileGenerator.h +++ b/Source/cmGlobalJOMMakefileGenerator.h @@ -20,7 +20,7 @@ public: { return new cmGlobalGeneratorSimpleFactory(); } - ///! Get the name for the generator. + //! Get the name for the generator. std::string GetName() const override { return cmGlobalJOMMakefileGenerator::GetActualName(); diff --git a/Source/cmGlobalMSYSMakefileGenerator.h b/Source/cmGlobalMSYSMakefileGenerator.h index 23dbc5e..d6e4847 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.h +++ b/Source/cmGlobalMSYSMakefileGenerator.h @@ -19,7 +19,7 @@ public: return new cmGlobalGeneratorSimpleFactory(); } - ///! Get the name for the generator. + //! Get the name for the generator. virtual std::string GetName() const { return cmGlobalMSYSMakefileGenerator::GetActualName(); diff --git a/Source/cmGlobalMinGWMakefileGenerator.h b/Source/cmGlobalMinGWMakefileGenerator.h index a994c92..15297e3 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.h +++ b/Source/cmGlobalMinGWMakefileGenerator.h @@ -19,7 +19,7 @@ public: return new cmGlobalGeneratorSimpleFactory< cmGlobalMinGWMakefileGenerator>(); } - ///! Get the name for the generator. + //! Get the name for the generator. virtual std::string GetName() const { return cmGlobalMinGWMakefileGenerator::GetActualName(); diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h index 1fc2f9c..2fdf1ce 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.h +++ b/Source/cmGlobalNMakeMakefileGenerator.h @@ -21,7 +21,7 @@ public: return new cmGlobalGeneratorSimpleFactory< cmGlobalNMakeMakefileGenerator>(); } - ///! Get the name for the generator. + //! Get the name for the generator. std::string GetName() const override { return cmGlobalNMakeMakefileGenerator::GetActualName(); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 3381c81..9d64924 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -57,7 +57,7 @@ void cmGlobalUnixMakefileGenerator3::EnableLanguage( } } -///! Create a local generator appropriate to this Global Generator +//! Create a local generator appropriate to this Global Generator cmLocalGenerator* cmGlobalUnixMakefileGenerator3::CreateLocalGenerator( cmMakefile* mf) { diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 496104d..e919d38 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -67,7 +67,7 @@ public: cmGlobalUnixMakefileGenerator3>(); } - ///! Get the name for the generator. + //! Get the name for the generator. std::string GetName() const override { return cmGlobalUnixMakefileGenerator3::GetActualName(); diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 26fd62b..4fa89d0 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -509,7 +509,7 @@ std::string cmGlobalVisualStudio10Generator::SelectWindowsCEToolset() const return ""; } -///! Create a local generator appropriate to this Global Generator +//! Create a local generator appropriate to this Global Generator cmLocalGenerator* cmGlobalVisualStudio10Generator::CreateLocalGenerator( cmMakefile* mf) { diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 26db929..2f532a6 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -29,7 +29,7 @@ public: std::vector const& makeOptions = std::vector()) override; - ///! create the correct local generator + //! create the correct local generator cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) override; /** diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index c694902..d7630e4 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -248,7 +248,7 @@ cmGlobalVisualStudio7Generator::GenerateBuildCommand( return makeCommands; } -///! Create a local generator appropriate to this Global Generator +//! Create a local generator appropriate to this Global Generator cmLocalGenerator* cmGlobalVisualStudio7Generator::CreateLocalGenerator( cmMakefile* mf) { diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 954d1d3..1e76383 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -20,7 +20,7 @@ class cmGlobalVisualStudio7Generator : public cmGlobalVisualStudioGenerator public: ~cmGlobalVisualStudio7Generator(); - ///! Create a local generator appropriate to this Global Generator + //! Create a local generator appropriate to this Global Generator cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) override; #if defined(CMAKE_BUILD_WITH_CMAKE) @@ -64,7 +64,7 @@ public: */ virtual void OutputSLNFile(); - ///! Lookup a stored GUID or compute one deterministically. + //! Lookup a stored GUID or compute one deterministically. std::string GetGUID(std::string const& name); /** Append the subdirectory for the given configuration. */ @@ -73,7 +73,7 @@ public: const std::string& suffix, std::string& dir) override; - ///! What is the configurations directory variable called? + //! What is the configurations directory variable called? const char* GetCMakeCFGIntDir() const override { return "$(ConfigurationName)"; diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index 75f4778..352bc3c 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -13,7 +13,7 @@ class cmGlobalVisualStudio8Generator : public cmGlobalVisualStudio71Generator { public: - ///! Get the name for the generator. + //! Get the name for the generator. std::string GetName() const override { return this->Name; } /** Get the name of the main stamp list file. */ diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h index c96dc72..3ca5e7d 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.h +++ b/Source/cmGlobalWatcomWMakeGenerator.h @@ -29,7 +29,7 @@ public: { return new cmGlobalGeneratorSimpleFactory(); } - ///! Get the name for the generator. + //! Get the name for the generator. std::string GetName() const override { return cmGlobalWatcomWMakeGenerator::GetActualName(); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index ad1a636..af165f6 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -389,7 +389,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( return { std::move(makeCommand) }; } -///! Create a local generator appropriate to this Global Generator +//! Create a local generator appropriate to this Global Generator cmLocalGenerator* cmGlobalXCodeGenerator::CreateLocalGenerator(cmMakefile* mf) { return new cmLocalXCodeGenerator(this, mf); diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 8daa95b..71446f9 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -36,7 +36,7 @@ public: unsigned int version_number); static cmGlobalGeneratorFactory* NewFactory(); - ///! Get the name for the generator. + //! Get the name for the generator. std::string GetName() const override { return cmGlobalXCodeGenerator::GetActualName(); @@ -46,7 +46,7 @@ public: /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); - ///! Create a local generator appropriate to this Global Generator + //! Create a local generator appropriate to this Global Generator cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) override; /** @@ -81,9 +81,9 @@ public: bool FindMakeProgram(cmMakefile*) override; - ///! What is the configurations directory variable called? + //! What is the configurations directory variable called? const char* GetCMakeCFGIntDir() const override; - ///! expand CFGIntDir + //! expand CFGIntDir std::string ExpandCFGIntDir(const std::string& str, const std::string& config) const override; diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index cd71518..69751b6 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -33,7 +33,7 @@ public: this->info.CAPI = &cmStaticCAPI; } - ///! clean up any memory allocated by the plugin + //! clean up any memory allocated by the plugin ~cmLoadedCommand() override; /** diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index de12190..67e3c58 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -76,13 +76,13 @@ public: bool IsRootMakefile() const; - ///! Get the makefile for this generator + //! Get the makefile for this generator cmMakefile* GetMakefile() { return this->Makefile; } - ///! Get the makefile for this generator, const version + //! Get the makefile for this generator, const version const cmMakefile* GetMakefile() const { return this->Makefile; } - ///! Get the GlobalGenerator this is associated with + //! Get the GlobalGenerator this is associated with cmGlobalGenerator* GetGlobalGenerator() { return this->GlobalGenerator; } const cmGlobalGenerator* GetGlobalGenerator() const { @@ -118,7 +118,7 @@ public: void AddCompilerRequirementFlag(std::string& flags, cmGeneratorTarget const* target, const std::string& lang); - ///! Append flags to a string. + //! Append flags to a string. virtual void AppendFlags(std::string& flags, const std::string& newFlags) const; virtual void AppendFlags(std::string& flags, const char* newFlags) const; @@ -131,7 +131,7 @@ public: cmGeneratorTarget* target, const std::string& config, const std::string& lang); - ///! Get the include flags for the current makefile and language + //! Get the include flags for the current makefile and language std::string GetIncludeFlags(const std::vector& includes, cmGeneratorTarget* target, const std::string& lang, @@ -403,7 +403,7 @@ public: const std::string& prop); protected: - ///! put all the libraries for a target on into the given stream + //! put all the libraries for a target on into the given stream void OutputLinkLibraries(cmComputeLinkInformation* pcli, cmLinkLineComputer* linkLineComputer, std::string& linkLibraries, diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h index a4150b9..5c6400e 100644 --- a/Source/cmLocalVisualStudio10Generator.h +++ b/Source/cmLocalVisualStudio10Generator.h @@ -21,7 +21,7 @@ class cmMakefile; class cmLocalVisualStudio10Generator : public cmLocalVisualStudio7Generator { public: - ///! Set cache only and recurse to false by default. + //! Set cache only and recurse to false by default. cmLocalVisualStudio10Generator(cmGlobalGenerator* gg, cmMakefile* mf); virtual ~cmLocalVisualStudio10Generator(); diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index b093e6f..ce8eceb 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -43,7 +43,7 @@ public: class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator { public: - ///! Set cache only and recurse to false by default. + //! Set cache only and recurse to false by default. cmLocalVisualStudio7Generator(cmGlobalGenerator* gg, cmMakefile* mf); virtual ~cmLocalVisualStudio7Generator(); diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h index 5c22dcf..42de20b 100644 --- a/Source/cmLocalXCodeGenerator.h +++ b/Source/cmLocalXCodeGenerator.h @@ -24,7 +24,7 @@ class cmSourceFile; class cmLocalXCodeGenerator : public cmLocalGenerator { public: - ///! Set cache only and recurse to false by default. + //! Set cache only and recurse to false by default. cmLocalXCodeGenerator(cmGlobalGenerator* gg, cmMakefile* mf); ~cmLocalXCodeGenerator() override; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 88b4c2f..8cc14f3 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -257,7 +257,7 @@ public: * can be used in CMake to refer to lists, directories, etc. */ void AddDefinition(const std::string& name, const char* value); - ///! Add a definition to this makefile and the global cmake cache. + //! Add a definition to this makefile and the global cmake cache. void AddCacheDefinition(const std::string& name, const char* value, const char* doc, cmStateEnums::CacheEntryType type, bool force = false); @@ -272,7 +272,7 @@ public: * for cache entries, and will only affect the current makefile. */ void RemoveDefinition(const std::string& name); - ///! Remove a definition from the cache. + //! Remove a definition from the cache. void RemoveCacheDefinition(const std::string& name); /** @@ -548,7 +548,7 @@ public: { return this->ListFiles; } - ///! When the file changes cmake will be re-run from the build system. + //! When the file changes cmake will be re-run from the build system. void AddCMakeDependFile(const std::string& file) { this->ListFiles.push_back(file); @@ -626,7 +626,7 @@ public: bool ExecuteCommand(const cmListFileFunction& lff, cmExecutionStatus& status); - ///! Enable support for named language, if nil then all languages are + //! Enable support for named language, if nil then all languages are /// enabled. void EnableLanguage(std::vector const& languages, bool optional); @@ -641,7 +641,7 @@ public: cmVariableWatch* GetVariableWatch() const; #endif - ///! Display progress or status message. + //! Display progress or status message. void DisplayStatus(const std::string&, float) const; /** @@ -677,7 +677,7 @@ public: */ cmSourceFile* GetSourceFileWithOutput(const std::string& outName) const; - ///! Add a new cmTest to the list of tests for this makefile. + //! Add a new cmTest to the list of tests for this makefile. cmTest* CreateTest(const std::string& testName); /** Get a cmTest pointer for a given test name, if the name is @@ -701,7 +701,7 @@ public: std::string GetModulesFile(const std::string& name, bool& system) const; - ///! Set/Get a property of this directory + //! Set/Get a property of this directory void SetProperty(const std::string& prop, const char* value); void AppendProperty(const std::string& prop, const char* value, bool asString = false); @@ -710,7 +710,7 @@ public: bool GetPropertyAsBool(const std::string& prop) const; std::vector GetPropertyKeys() const; - ///! Initialize a makefile from its parent + //! Initialize a makefile from its parent void InitializeFromParent(cmMakefile* parent); void AddInstallGenerator(cmInstallGenerator* g) diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index 6438c7b..deca767 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -27,7 +27,7 @@ public: std::string ConvertDirectorySeparatorsForShell( const std::string& source) const; - ///! for existing files convert to output path and short path if spaces + //! for existing files convert to output path and short path if spaces std::string ConvertToOutputForExisting(const std::string& remote, OutputFormat format = SHELL) const; diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 0a234c5..61b2fda 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -299,7 +299,7 @@ bool cmPolicies::GetPolicyID(const char* id, cmPolicies::PolicyID& pid) return stringToId(id, pid); } -///! return a warning string for a given policy +//! return a warning string for a given policy std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id) { std::ostringstream msg; @@ -333,7 +333,7 @@ std::string cmPolicies::GetPolicyDeprecatedWarning(cmPolicies::PolicyID id) return msg.str(); } -///! return an error string for when a required policy is unspecified +//! return an error string for when a required policy is unspecified std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id) { std::ostringstream error; @@ -359,7 +359,7 @@ std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id) return error.str(); } -///! Get the default status for a policy +//! Get the default status for a policy cmPolicies::PolicyStatus cmPolicies::GetPolicyStatus( cmPolicies::PolicyID /*unused*/) { diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 7677186..02a6295 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -332,27 +332,27 @@ public: CMPCOUNT }; - ///! convert a string policy ID into a number + //! convert a string policy ID into a number static bool GetPolicyID(const char* id, /* out */ cmPolicies::PolicyID& pid); - ///! Get the default status for a policy + //! Get the default status for a policy static cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id); - ///! Set a policy level for this listfile + //! Set a policy level for this listfile static bool ApplyPolicyVersion(cmMakefile* mf, std::string const& version_min, std::string const& version_max); static bool ApplyPolicyVersion(cmMakefile* mf, unsigned int majorVer, unsigned int minorVer, unsigned int patchVer); - ///! return a warning string for a given policy + //! return a warning string for a given policy static std::string GetPolicyWarning(cmPolicies::PolicyID id); static std::string GetPolicyDeprecatedWarning(cmPolicies::PolicyID id); - ///! return an error string for when a required policy is unspecified + //! return an error string for when a required policy is unspecified static std::string GetRequiredPolicyError(cmPolicies::PolicyID id); - ///! return an error string for when a required policy is unspecified + //! return an error string for when a required policy is unspecified static std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id); /** Represent a set of policy values. */ diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index d579018..edad4c7 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -44,13 +44,13 @@ public: cmCustomCommand const* GetCustomCommand() const; void SetCustomCommand(cmCustomCommand* cc); - ///! Set/Get a property of this source file + //! Set/Get a property of this source file 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 + //! 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 + //! Always returns a valid pointer const char* GetSafeProperty(const std::string& prop) const; bool GetPropertyAsBool(const std::string& prop) const; @@ -58,7 +58,7 @@ public: command like get_property or get_source_file_property. */ const char* GetPropertyForUser(const std::string& prop); - ///! Checks is the GENERATED property is set and true + //! Checks is the GENERATED property is set and true /// @return Equivalent to GetPropertyAsBool("GENERATED") bool GetIsGenerated() const { return this->IsGenerated; } diff --git a/Source/cmState.h b/Source/cmState.h index 190eafc..6abe71c 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -107,7 +107,7 @@ public: void RemoveCacheEntryProperty(std::string const& key, std::string const& propertyName); - ///! Break up a line like VAR:type="value" into var, type and value + //! Break up a line like VAR:type="value" into var, type and value static bool ParseCacheEntry(const std::string& entry, std::string& var, std::string& value, cmStateEnums::CacheEntryType& type); diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 0b75025..a8b2d37 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -45,7 +45,7 @@ public: static void ExpandRegistryValues(std::string& source, KeyWOW64 view = KeyWOW64_Default); - ///! Escape quotes in a string. + //! Escape quotes in a string. static std::string EscapeQuotes(const std::string& str); /** Map help document name to file name. */ @@ -78,11 +78,11 @@ public: using OutputCallback = std::function; - ///! Send a string to stdout + //! Send a string to stdout static void Stdout(const std::string& s); static void SetStdoutCallback(OutputCallback f); - ///! Send a string to stderr + //! Send a string to stderr static void Stderr(const std::string& s); static void SetStderrCallback(OutputCallback f); @@ -90,25 +90,25 @@ public: static void SetInterruptCallback(InterruptCallback f); static bool GetInterruptFlag(); - ///! Return true if there was an error at any point. + //! Return true if there was an error at any point. static bool GetErrorOccuredFlag() { return cmSystemTools::s_ErrorOccured || cmSystemTools::s_FatalErrorOccured || GetInterruptFlag(); } - ///! If this is set to true, cmake stops processing commands. + //! If this is set to true, cmake stops processing commands. static void SetFatalErrorOccured() { cmSystemTools::s_FatalErrorOccured = true; } static void SetErrorOccured() { cmSystemTools::s_ErrorOccured = true; } - ///! Return true if there was an error at any point. + //! Return true if there was an error at any point. static bool GetFatalErrorOccured() { return cmSystemTools::s_FatalErrorOccured || GetInterruptFlag(); } - ///! Set the error occurred flag and fatal error back to false + //! Set the error occurred flag and fatal error back to false static void ResetErrorOccuredFlag() { cmSystemTools::s_FatalErrorOccured = false; @@ -138,9 +138,9 @@ public: static bool IsOff(const char* val); static bool IsOff(const std::string& val); - ///! Return true if value is NOTFOUND or ends in -NOTFOUND. + //! Return true if value is NOTFOUND or ends in -NOTFOUND. static bool IsNOTFOUND(const char* value); - ///! Return true if the path is a framework + //! Return true if the path is a framework static bool IsPathToFramework(const std::string& value); static bool DoesFileExistWithExtensions( @@ -177,14 +177,14 @@ public: static bool RenameFile(const std::string& oldname, const std::string& newname); - ///! Compute the hash of a file + //! Compute the hash of a file static std::string ComputeFileHash(const std::string& source, cmCryptoHash::Algo algo); /** Compute the md5sum of a string. */ static std::string ComputeStringMD5(const std::string& input); - ///! Get the SHA thumbprint for a certificate file + //! Get the SHA thumbprint for a certificate file static std::string ComputeCertificateThumbprint(const std::string& source); /** diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 38bff1b..dc9b6d2 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -34,7 +34,7 @@ #include "cmTargetPropertyComputer.h" #include "cmake.h" -///! Append all elements from the second container to the first container +//! Append all elements from the second container to the first container template static inline void CApp(C& container, R const& range) { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 5d90ba7..0ac5ca7 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -59,22 +59,22 @@ public: cmTarget& operator=(cmTarget const&) = delete; cmTarget& operator=(cmTarget&&) noexcept; - ///! Return the type of target. + //! Return the type of target. cmStateEnums::TargetType GetType() const; - ///! Get the cmMakefile that owns this target. + //! Get the cmMakefile that owns this target. cmMakefile* GetMakefile() const; - ///! Return the global generator. + //! Return the global generator. cmGlobalGenerator* GetGlobalGenerator() const; - ///! Set/Get the name of the target + //! Set/Get the name of the target const std::string& GetName() const; - ///! Get the policy map + //! Get the policy map cmPolicies::PolicyMap const& GetPolicyMap() const; - ///! Get policy status + //! Get policy status cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID policy) const; #define DECLARE_TARGET_POLICY(POLICY) \ @@ -87,30 +87,30 @@ public: #undef DECLARE_TARGET_POLICY - ///! Get the list of the PRE_BUILD custom commands for this target + //! Get the list of the PRE_BUILD custom commands for this target std::vector const& GetPreBuildCommands() const; void AddPreBuildCommand(cmCustomCommand const& cmd); - ///! Get the list of the PRE_LINK custom commands for this target + //! Get the list of the PRE_LINK custom commands for this target std::vector const& GetPreLinkCommands() const; void AddPreLinkCommand(cmCustomCommand const& cmd); - ///! Get the list of the POST_BUILD custom commands for this target + //! Get the list of the POST_BUILD custom commands for this target std::vector const& GetPostBuildCommands() const; void AddPostBuildCommand(cmCustomCommand const& cmd); - ///! Add sources to the target. + //! Add sources to the target. void AddSources(std::vector const& srcs); void AddTracedSources(std::vector const& srcs); cmSourceFile* AddSourceCMP0049(const std::string& src); cmSourceFile* AddSource(const std::string& src, bool before = false); - ///! how we identify a library, by name and type + //! how we identify a library, by name and type typedef std::pair LibraryID; typedef std::vector LinkLibraryVectorType; LinkLibraryVectorType const& GetOriginalLinkLibraries() const; - ///! Clear the dependency information recorded for this target, if any. + //! Clear the dependency information recorded for this target, if any. void ClearDependencyInformation(cmMakefile& mf); void AddLinkLibrary(cmMakefile& mf, const std::string& lib, @@ -159,23 +159,23 @@ public: * commands. It is not a full path nor does it have an extension. */ void AddUtility(std::string const& name, cmMakefile* mf = nullptr); - ///! Get the utilities used by this target + //! Get the utilities used by this target std::set> const& GetUtilities() const; - ///! Set/Get a property of this target file + //! Set/Get a property of this target file 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 + //! 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 + //! 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, cmMessenger* messenger, cmListFileBacktrace const& context) const; - ///! Get all properties + //! Get all properties cmPropertyMap const& GetProperties() const; bool IsImported() const; @@ -184,16 +184,16 @@ public: bool GetMappedConfig(std::string const& desired_config, const char** loc, const char** imp, std::string& suffix) const; - ///! Return whether this target is an executable with symbol exports enabled. + //! Return whether this target is an executable with symbol exports enabled. bool IsExecutableWithExports() const; - ///! Return whether this target is a shared library Framework on Apple. + //! Return whether this target is a shared library Framework on Apple. bool IsFrameworkOnApple() const; - ///! Return whether this target is an executable Bundle on Apple. + //! Return whether this target is an executable Bundle on Apple. bool IsAppBundleOnApple() const; - ///! Get a backtrace from the creation of the target. + //! Get a backtrace from the creation of the target. cmListFileBacktrace const& GetBacktrace() const; void InsertInclude(std::string const& entry, cmListFileBacktrace const& bt, diff --git a/Source/cmTest.h b/Source/cmTest.h index d4839d1..88dc730 100644 --- a/Source/cmTest.h +++ b/Source/cmTest.h @@ -26,14 +26,14 @@ public: cmTest(cmMakefile* mf); ~cmTest(); - ///! Set the test name + //! Set the test name void SetName(const std::string& name); std::string GetName() const { return this->Name; } void SetCommand(std::vector const& command); std::vector const& GetCommand() const { return this->Command; } - ///! Set/Get a property of this source file + //! Set/Get a property of this source file void SetProperty(const std::string& prop, const char* value); void AppendProperty(const std::string& prop, const char* value, bool asString = false); diff --git a/Source/cmake.h b/Source/cmake.h index 8d22f34..8b4b396 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -162,7 +162,7 @@ public: int Configure(); int ActualConfigure(); - ///! Break up a line like VAR:type="value" into var, type and value + //! Break up a line like VAR:type="value" into var, type and value static bool ParseCacheEntry(const std::string& entry, std::string& var, std::string& value, cmStateEnums::CacheEntryType& type); @@ -176,40 +176,40 @@ public: bool DeleteCache(const std::string& path); void PreLoadCMakeFiles(); - ///! Create a GlobalGenerator + //! Create a GlobalGenerator cmGlobalGenerator* CreateGlobalGenerator(const std::string& name); - ///! Return the global generator assigned to this instance of cmake + //! Return the global generator assigned to this instance of cmake cmGlobalGenerator* GetGlobalGenerator() { return this->GlobalGenerator; } - ///! Return the global generator assigned to this instance of cmake, const + //! Return the global generator assigned to this instance of cmake, const const cmGlobalGenerator* GetGlobalGenerator() const { return this->GlobalGenerator; } - ///! Return the full path to where the CMakeCache.txt file should be. + //! Return the full path to where the CMakeCache.txt file should be. static std::string FindCacheFile(const std::string& binaryDir); - ///! Return the global generator assigned to this instance of cmake + //! Return the global generator assigned to this instance of cmake void SetGlobalGenerator(cmGlobalGenerator*); - ///! Get the names of the current registered generators + //! Get the names of the current registered generators void GetRegisteredGenerators(std::vector& generators, bool includeNamesWithPlatform = true) const; - ///! Set the name of the selected generator-specific instance. + //! Set the name of the selected generator-specific instance. void SetGeneratorInstance(std::string const& instance) { this->GeneratorInstance = instance; } - ///! Set the name of the selected generator-specific platform. + //! Set the name of the selected generator-specific platform. void SetGeneratorPlatform(std::string const& ts) { this->GeneratorPlatform = ts; } - ///! Set the name of the selected generator-specific toolset. + //! Set the name of the selected generator-specific toolset. void SetGeneratorToolset(std::string const& ts) { this->GeneratorToolset = ts; @@ -244,7 +244,7 @@ public: * Given a variable name, return its value (as a string). */ const char* GetCacheDefinition(const std::string&) const; - ///! Add an entry into the cache + //! Add an entry into the cache void AddCacheEntry(const std::string& key, const char* value, const char* helpString, int type); @@ -263,14 +263,14 @@ public: */ int GetSystemInformation(std::vector&); - ///! Parse command line arguments + //! Parse command line arguments void SetArgs(const std::vector& args); - ///! Is this cmake running as a result of a TRY_COMPILE command + //! Is this cmake running as a result of a TRY_COMPILE command bool GetIsInTryCompile() const; void SetIsInTryCompile(bool b); - ///! Parse command line arguments that might set cache values + //! Parse command line arguments that might set cache values bool SetCacheArgs(const std::vector&); using ProgressCallbackType = std::function; @@ -283,24 +283,24 @@ public: */ void SetProgressCallback(ProgressCallbackType f); - ///! this is called by generators to update the progress + //! this is called by generators to update the progress void UpdateProgress(const std::string& msg, float prog); #if defined(CMAKE_BUILD_WITH_CMAKE) - ///! Get the variable watch object + //! Get the variable watch object cmVariableWatch* GetVariableWatch() { return this->VariableWatch; } #endif std::vector GetGeneratorsDocumentation(); - ///! Set/Get a property of this target file + //! Set/Get a property of this target file void SetProperty(const std::string& prop, const char* value); void AppendProperty(const std::string& prop, const char* value, bool asString = false); const char* GetProperty(const std::string& prop); bool GetPropertyAsBool(const std::string& prop); - ///! Get or create an cmInstalledFile instance and return a pointer to it + //! Get or create an cmInstalledFile instance and return a pointer to it cmInstalledFile* GetOrCreateInstalledFile(cmMakefile* mf, const std::string& name); @@ -311,13 +311,13 @@ public: return this->InstalledFiles; } - ///! Do all the checks before running configure + //! Do all the checks before running configure int DoPreConfigureChecks(); void SetWorkingMode(WorkingMode mode) { this->CurrentWorkingMode = mode; } WorkingMode GetWorkingMode() { return this->CurrentWorkingMode; } - ///! Debug the try compile stuff by not deleting the files + //! Debug the try compile stuff by not deleting the files bool GetDebugTryCompile() { return this->DebugTryCompile; } void DebugTryCompileOn() { this->DebugTryCompile = true; } @@ -423,13 +423,13 @@ public: MessageType t, std::string const& text, cmListFileBacktrace const& backtrace = cmListFileBacktrace()) const; - ///! run the --build option + //! run the --build option int Build(int jobs, const std::string& dir, const std::vector& targets, const std::string& config, const std::vector& nativeOptions, bool clean, bool verbose); - ///! run the --open option + //! run the --open option bool Open(const std::string& dir, bool dryRun); void UnwatchUnusedCli(const std::string& var); @@ -462,12 +462,12 @@ protected: std::string GeneratorPlatform; std::string GeneratorToolset; - ///! read in a cmake list file to initialize the cache + //! read in a cmake list file to initialize the cache void ReadListFile(const std::vector& args, const std::string& path); bool FindPackage(const std::vector& args); - ///! Check if CMAKE_CACHEFILE_DIR is set. If it is not, delete the log file. + //! Check if CMAKE_CACHEFILE_DIR is set. If it is not, delete the log file. /// If it is set, truncate it to 50kb void TruncateOutputLog(const char* fname); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2d66567dca2a5a80e41493ec0a9d6d86f7d955f5 commit 2d66567dca2a5a80e41493ec0a9d6d86f7d955f5 Author: Artur Ryt AuthorDate: Sat Mar 30 16:11:21 2019 +0100 Commit: Artur Ryt CommitDate: Sat Mar 30 16:15:05 2019 +0100 Modernize: Prefer .substr in place of .c_str() + int A lot of temporary/local strings were created out of C-strings substr can utilize current string size, so in theory be a little more efficient. diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index da9575b..3ceb824 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -82,7 +82,7 @@ int cpackDefinitionArgument(const char* argument, const char* cValue, return 0; } std::string key = value.substr(0, pos); - value = value.c_str() + pos + 1; + value = value.substr(pos + 1); def->Map[key] = value; cmCPack_Log(def->Log, cmCPackLog::LOG_DEBUG, "Set CPack variable: " << key << " to \"" << value << "\"" diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 8ea9a83..8480309 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -387,7 +387,7 @@ int cmCTestBuildHandler::ProcessHandler() std::string srcdirrep; for (cc = srcdir.size() - 2; cc > 0; cc--) { if (srcdir[cc] == '/') { - srcdirrep = srcdir.c_str() + cc; + srcdirrep = srcdir.substr(cc); srcdirrep = "/..." + srcdirrep; srcdir = srcdir.substr(0, cc + 1); break; @@ -401,7 +401,7 @@ int cmCTestBuildHandler::ProcessHandler() std::string bindirrep; for (cc = bindir.size() - 2; cc > 0; cc--) { if (bindir[cc] == '/') { - bindirrep = bindir.c_str() + cc; + bindirrep = bindir.substr(cc); bindirrep = "/..." + bindirrep; bindir = bindir.substr(0, cc + 1); break; diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 11cd005..9d9761c 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -547,7 +547,7 @@ private: { // Look for header fields that we need. if (cmHasLiteralPrefix(this->Line, "commit ")) { - this->Rev.Rev = this->Line.c_str() + 7; + this->Rev.Rev = this->Line.substr(7); } else if (cmHasLiteralPrefix(this->Line, "author ")) { Person author; this->ParsePerson(this->Line.c_str() + 7, author); diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index 5e66e05..a96513e 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -308,7 +308,7 @@ void cmCTestLaunch::LoadLabels() if (line[0] == ' ') { // Label lines appear indented by one space. if (inTarget || inSource) { - this->Labels.insert(line.c_str() + 1); + this->Labels.insert(line.substr(1)); } } else if (!this->OptionSource.empty() && !inSource) { // Non-indented lines specify a source file name. The first one diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index b7a4e4c..04749b7 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -515,7 +515,7 @@ private: if (path.size() > this->SVN->SourceDirectory.size() && strncmp(path.c_str(), this->SVN->SourceDirectory.c_str(), this->SVN->SourceDirectory.size()) == 0) { - local_path = path.c_str() + this->SVN->SourceDirectory.size() + 1; + local_path = path.substr(this->SVN->SourceDirectory.size() + 1); } else { local_path = path; } @@ -554,7 +554,7 @@ std::string cmCTestSVN::SVNInfo::BuildLocalPath(std::string const& path) const // Add path with base prefix removed if (path.size() > this->Base.size() && strncmp(path.c_str(), this->Base.c_str(), this->Base.size()) == 0) { - local_path += (path.c_str() + this->Base.size()); + local_path += path.substr(this->Base.size()); } else { local_path += path; } diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index c9783e4..0ed56c8 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -2265,8 +2265,8 @@ bool cmCTestTestHandler::SetTestsProperties( size_t pos = val.find_first_of('='); if (pos != std::string::npos) { std::string mKey = val.substr(0, pos); - const char* mVal = val.c_str() + pos + 1; - rt.Measurements[mKey] = mVal; + std::string mVal = val.substr(pos + 1); + rt.Measurements[mKey] = std::move(mVal); } else { rt.Measurements[val] = "1"; } diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 3f036a9..178e18b 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -295,7 +295,7 @@ void cmDependsFortran::MatchRemoteModules(std::istream& fin, // They do not include the ".mod" extension. mod += ".mod"; } - this->ConsiderModule(mod.c_str() + 1, stampDir); + this->ConsiderModule(mod.substr(1), stampDir); } } else if (line == "provides") { doing_provides = true; diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx index 792db48..12d875d 100644 --- a/Source/cmDependsJavaParserHelper.cxx +++ b/Source/cmDependsJavaParserHelper.cxx @@ -5,6 +5,7 @@ #include "cmDependsJavaLexer.h" #include "cmSystemTools.h" +#include "cm_string_view.hxx" #include "cmsys/FStream.hxx" #include #include @@ -298,14 +299,10 @@ void cmDependsJavaParserHelper::Error(const char* str) unsigned long pos = static_cast(this->InputBufferPos); fprintf(stderr, "JPError: %s (%lu / Line: %d)\n", str, pos, this->CurrentLine); - int cc; - std::cerr << "String: ["; - for (cc = 0; - cc < 30 && *(this->InputBuffer.c_str() + this->InputBufferPos + cc); - cc++) { - std::cerr << *(this->InputBuffer.c_str() + this->InputBufferPos + cc); - } - std::cerr << "]" << std::endl; + std::cerr << "String: [" + << cm::string_view{ this->InputBuffer }.substr( + this->InputBufferPos, 30) + << "]" << std::endl; } void cmDependsJavaParserHelper::UpdateCombine(const char* str1, diff --git a/Source/cmFileInstaller.cxx b/Source/cmFileInstaller.cxx index f3544c1..d4f76fd 100644 --- a/Source/cmFileInstaller.cxx +++ b/Source/cmFileInstaller.cxx @@ -319,7 +319,7 @@ bool cmFileInstaller::HandleInstallDestination() return false; } } - destination = sdestdir + (destination.c_str() + skip); + destination = sdestdir + destination.substr(skip); this->DestDirLength = int(sdestdir.size()); } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 2c145e0..40b8e19 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2266,7 +2266,7 @@ void cmLocalGenerator::JoinDefines(const std::set& defines, def += define.substr(0, eq); if (eq != std::string::npos) { def += "="; - def += this->EscapeForShell(define.c_str() + eq + 1, true); + def += this->EscapeForShell(define.substr(eq + 1), true); } } definesString += itemSeparator; diff --git a/Source/cmTargetPropertyComputer.h b/Source/cmTargetPropertyComputer.h index 97e4fba..efbf95f 100644 --- a/Source/cmTargetPropertyComputer.h +++ b/Source/cmTargetPropertyComputer.h @@ -81,7 +81,7 @@ private: context)) { return nullptr; } - const char* configName = prop.c_str() + 9; + std::string configName = prop.substr(9); return ComputeLocation(tgt, configName); } diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 8d63971..9b635ea 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -620,7 +620,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) std::string const& a = *ai; if (cmHasLiteralPrefix(a, "--unset=")) { // Unset environment variable. - cmSystemTools::UnPutEnv(a.c_str() + 8); + cmSystemTools::UnPutEnv(a.substr(8)); } else if (!a.empty() && a[0] == '-') { // Environment variable and command names cannot start in '-', // so this must be an unknown option. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f13aef4de57a74db72c258edb78108da60a030f1 commit f13aef4de57a74db72c258edb78108da60a030f1 Author: Artur Ryt AuthorDate: Sat Mar 30 15:37:36 2019 +0100 Commit: Artur Ryt CommitDate: Sat Mar 30 15:39:45 2019 +0100 cmcmd: Modernize for loops with cmMakeRange Also minor loop variable renaming diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 757a46c..da84738 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -381,8 +381,7 @@ int cmcmd::HandleCoCompileCommands(std::vector const& args) std::vector orig_cmd; bool doing_options = true; - for (std::string::size_type i = 2; i < args.size(); ++i) { - std::string const& arg = args[i]; + for (std::string const& arg : cmMakeRange(args).advance(2)) { // if the arg is -- then the rest of the args after // go into orig_cmd if (arg == "--") { @@ -482,9 +481,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector const& args) } // If error occurs we want to continue copying next files. bool return_value = false; - for (std::string::size_type cc = 2; cc < args.size() - 1; cc++) { - if (!cmsys::SystemTools::CopyFileAlways(args[cc], args.back())) { - std::cerr << "Error copying file \"" << args[cc] << "\" to \"" + for (auto const& arg : cmMakeRange(args).advance(2).retreat(1)) { + if (!cmsys::SystemTools::CopyFileAlways(arg, args.back())) { + std::cerr << "Error copying file \"" << arg << "\" to \"" << args.back() << "\".\n"; return_value = true; } @@ -504,9 +503,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector const& args) } // If error occurs we want to continue copying next files. bool return_value = false; - for (std::string::size_type cc = 2; cc < args.size() - 1; cc++) { - if (!cmSystemTools::CopyFileIfDifferent(args[cc], args.back())) { - std::cerr << "Error copying file (if different) from \"" << args[cc] + for (auto const& arg : cmMakeRange(args).advance(2).retreat(1)) { + if (!cmSystemTools::CopyFileIfDifferent(arg, args.back())) { + std::cerr << "Error copying file (if different) from \"" << arg << "\" to \"" << args.back() << "\".\n"; return_value = true; } @@ -518,10 +517,10 @@ int cmcmd::ExecuteCMakeCommand(std::vector const& args) if (args[1] == "copy_directory" && args.size() > 3) { // If error occurs we want to continue copying next files. bool return_value = false; - for (std::string::size_type cc = 2; cc < args.size() - 1; cc++) { - if (!cmSystemTools::CopyADirectory(args[cc], args.back())) { - std::cerr << "Error copying directory from \"" << args[cc] - << "\" to \"" << args.back() << "\".\n"; + for (auto const& arg : cmMakeRange(args).advance(2).retreat(1)) { + if (!cmSystemTools::CopyADirectory(arg, args.back())) { + std::cerr << "Error copying directory from \"" << arg << "\" to \"" + << args.back() << "\".\n"; return_value = true; } } @@ -614,8 +613,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector const& args) } if (args[1] == "env") { - std::vector::const_iterator ai = args.begin() + 2; - std::vector::const_iterator ae = args.end(); + auto ai = args.cbegin() + 2; + auto ae = args.cend(); for (; ai != ae; ++ai) { std::string const& a = *ai; if (cmHasLiteralPrefix(a, "--unset=")) { @@ -654,10 +653,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector const& args) #if defined(CMAKE_BUILD_WITH_CMAKE) if (args[1] == "environment") { - std::vector env = cmSystemTools::GetEnvironmentVariables(); - std::vector::iterator it; - for (it = env.begin(); it != env.end(); ++it) { - std::cout << *it << std::endl; + for (auto const& env : cmSystemTools::GetEnvironmentVariables()) { + std::cout << env << std::endl; } return 0; } @@ -666,9 +663,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector const& args) if (args[1] == "make_directory" && args.size() > 2) { // If error occurs we want to continue copying next files. bool return_value = false; - for (std::string::size_type cc = 2; cc < args.size(); cc++) { - if (!cmSystemTools::MakeDirectory(args[cc])) { - std::cerr << "Error creating directory \"" << args[cc] << "\".\n"; + for (auto const& arg : cmMakeRange(args).advance(2)) { + if (!cmSystemTools::MakeDirectory(arg)) { + std::cerr << "Error creating directory \"" << arg << "\".\n"; return_value = true; } } @@ -687,14 +684,14 @@ int cmcmd::ExecuteCMakeCommand(std::vector const& args) // Remove file if (args[1] == "remove" && args.size() > 2) { bool force = false; - for (std::string::size_type cc = 2; cc < args.size(); cc++) { - if (args[cc] == "\\-f" || args[cc] == "-f") { + for (auto const& arg : cmMakeRange(args).advance(2)) { + if (arg == "\\-f" || arg == "-f") { force = true; } else { // Complain if the file could not be removed, still exists, // and the -f option was not given. - if (!cmSystemTools::RemoveFile(args[cc]) && !force && - cmSystemTools::FileExists(args[cc])) { + if (!cmSystemTools::RemoveFile(arg) && !force && + cmSystemTools::FileExists(arg)) { return 1; } } @@ -704,10 +701,10 @@ int cmcmd::ExecuteCMakeCommand(std::vector const& args) // Touch file if (args[1] == "touch" && args.size() > 2) { - for (std::string::size_type cc = 2; cc < args.size(); cc++) { - if (!cmSystemTools::Touch(args[cc], true)) { + for (auto const& arg : cmMakeRange(args).advance(2)) { + if (!cmSystemTools::Touch(arg, true)) { std::cerr << "cmake -E touch: failed to update \""; - std::cerr << args[cc] << "\".\n"; + std::cerr << arg << "\".\n"; return 1; } } @@ -716,10 +713,10 @@ int cmcmd::ExecuteCMakeCommand(std::vector const& args) // Touch file if (args[1] == "touch_nocreate" && args.size() > 2) { - for (std::string::size_type cc = 2; cc < args.size(); cc++) { - if (!cmSystemTools::Touch(args[cc], false)) { + for (auto const& arg : cmMakeRange(args).advance(2)) { + if (!cmSystemTools::Touch(arg, false)) { std::cerr << "cmake -E touch_nocreate: failed to update \""; - std::cerr << args[cc] << "\".\n"; + std::cerr << arg << "\".\n"; return 1; } } @@ -744,15 +741,15 @@ int cmcmd::ExecuteCMakeCommand(std::vector const& args) // Sleep command if (args[1] == "sleep" && args.size() > 2) { double total = 0; - for (size_t i = 2; i < args.size(); ++i) { + for (auto const& arg : cmMakeRange(args).advance(2)) { double num = 0.0; char unit; char extra; - int n = sscanf(args[i].c_str(), "%lg%c%c", &num, &unit, &extra); + int n = sscanf(arg.c_str(), "%lg%c%c", &num, &unit, &extra); if ((n == 1 || (n == 2 && unit == 's')) && num >= 0) { total += num; } else { - std::cerr << "Unknown sleep time format \"" << args[i] << "\".\n"; + std::cerr << "Unknown sleep time format \"" << arg << "\".\n"; return 1; } } @@ -1047,8 +1044,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector const& args) std::string mtime; std::string format; bool doing_options = true; - for (std::string::size_type cc = 4; cc < args.size(); cc++) { - std::string const& arg = args[cc]; + for (auto const& arg : cmMakeRange(args).advance(4)) { if (doing_options && cmHasLiteralPrefix(arg, "--")) { if (arg == "--") { doing_options = false; @@ -1180,17 +1176,15 @@ int cmcmd::ExecuteCMakeCommand(std::vector const& args) bool isDebug = false; std::string pipe; - for (size_t i = 2; i < args.size(); ++i) { - const std::string& a = args[i]; - - if (a == "--experimental") { + for (auto const& arg : cmMakeRange(args).advance(2)) { + if (arg == "--experimental") { supportExperimental = true; - } else if (a == "--debug") { + } else if (arg == "--debug") { pipe.clear(); isDebug = true; - } else if (a.substr(0, pipePrefix.size()) == pipePrefix) { + } else if (arg.substr(0, pipePrefix.size()) == pipePrefix) { isDebug = false; - pipe = a.substr(pipePrefix.size()); + pipe = arg.substr(pipePrefix.size()); if (pipe.empty()) { cmSystemTools::Error("No pipe given after --pipe="); return 2; @@ -1270,8 +1264,7 @@ int cmcmd::HashSumFile(std::vector const& args, } int retval = 0; - for (std::string::size_type cc = 2; cc < args.size(); cc++) { - const char* filename = args[cc].c_str(); + for (auto const& filename : cmMakeRange(args).advance(2)) { // Cannot compute sum of a directory if (cmSystemTools::FileIsDirectory(filename)) { std::cerr << "Error: " << filename << " is a directory" << std::endl; @@ -1398,48 +1391,47 @@ int cmcmd::ExecuteEchoColor(std::vector const& args) int color = cmsysTerminal_Color_Normal; bool newline = true; std::string progressDir; - for (unsigned int i = 2; i < args.size(); ++i) { - if (args[i].find("--switch=") == 0) { + for (auto const& arg : cmMakeRange(args).advance(2)) { + if (arg.find("--switch=") == 0) { // Enable or disable color based on the switch value. - std::string value = args[i].substr(9); + std::string value = arg.substr(9); if (!value.empty()) { enabled = cmSystemTools::IsOn(value); } - } else if (cmHasLiteralPrefix(args[i], "--progress-dir=")) { - progressDir = args[i].substr(15); - } else if (cmHasLiteralPrefix(args[i], "--progress-num=")) { + } else if (cmHasLiteralPrefix(arg, "--progress-dir=")) { + progressDir = arg.substr(15); + } else if (cmHasLiteralPrefix(arg, "--progress-num=")) { if (!progressDir.empty()) { - std::string const& progressNum = args[i].substr(15); + std::string const& progressNum = arg.substr(15); cmcmdProgressReport(progressDir, progressNum); } - } else if (args[i] == "--normal") { + } else if (arg == "--normal") { color = cmsysTerminal_Color_Normal; - } else if (args[i] == "--black") { + } else if (arg == "--black") { color = cmsysTerminal_Color_ForegroundBlack; - } else if (args[i] == "--red") { + } else if (arg == "--red") { color = cmsysTerminal_Color_ForegroundRed; - } else if (args[i] == "--green") { + } else if (arg == "--green") { color = cmsysTerminal_Color_ForegroundGreen; - } else if (args[i] == "--yellow") { + } else if (arg == "--yellow") { color = cmsysTerminal_Color_ForegroundYellow; - } else if (args[i] == "--blue") { + } else if (arg == "--blue") { color = cmsysTerminal_Color_ForegroundBlue; - } else if (args[i] == "--magenta") { + } else if (arg == "--magenta") { color = cmsysTerminal_Color_ForegroundMagenta; - } else if (args[i] == "--cyan") { + } else if (arg == "--cyan") { color = cmsysTerminal_Color_ForegroundCyan; - } else if (args[i] == "--white") { + } else if (arg == "--white") { color = cmsysTerminal_Color_ForegroundWhite; - } else if (args[i] == "--bold") { + } else if (arg == "--bold") { color |= cmsysTerminal_Color_ForegroundBold; - } else if (args[i] == "--no-newline") { + } else if (arg == "--no-newline") { newline = false; - } else if (args[i] == "--newline") { + } else if (arg == "--newline") { newline = true; } else { // Color is enabled. Print with the current color. - cmSystemTools::MakefileColorEcho(color, args[i].c_str(), newline, - enabled); + cmSystemTools::MakefileColorEcho(color, arg.c_str(), newline, enabled); } } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e9bbfdd9a115332deb40da10784d478f4930c68f commit e9bbfdd9a115332deb40da10784d478f4930c68f Author: Artur Ryt AuthorDate: Sat Mar 30 15:34:59 2019 +0100 Commit: Artur Ryt CommitDate: Sat Mar 30 15:34:59 2019 +0100 cmcmd: Pass args vector by const& diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 8d63971..757a46c 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -368,7 +368,7 @@ struct CoCompileJob }; // called when args[0] == "__run_co_compile" -int cmcmd::HandleCoCompileCommands(std::vector& args) +int cmcmd::HandleCoCompileCommands(std::vector const& args) { std::vector jobs; std::string sourceFile; // store --source= @@ -466,7 +466,7 @@ int cmcmd::HandleCoCompileCommands(std::vector& args) return ret; } -int cmcmd::ExecuteCMakeCommand(std::vector& args) +int cmcmd::ExecuteCMakeCommand(std::vector const& args) { // IF YOU ADD A NEW COMMAND, DOCUMENT IT ABOVE and in cmakemain.cxx if (args.size() > 1) { @@ -1262,7 +1262,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) return 1; } -int cmcmd::HashSumFile(std::vector& args, cmCryptoHash::Algo algo) +int cmcmd::HashSumFile(std::vector const& args, + cmCryptoHash::Algo algo) { if (args.size() < 3) { return -1; @@ -1289,7 +1290,7 @@ int cmcmd::HashSumFile(std::vector& args, cmCryptoHash::Algo algo) return retval; } -int cmcmd::SymlinkLibrary(std::vector& args) +int cmcmd::SymlinkLibrary(std::vector const& args) { int result = 0; std::string realName = args[2]; @@ -1313,7 +1314,7 @@ int cmcmd::SymlinkLibrary(std::vector& args) return result; } -int cmcmd::SymlinkExecutable(std::vector& args) +int cmcmd::SymlinkExecutable(std::vector const& args) { int result = 0; std::string const& realName = args[2]; @@ -1387,7 +1388,7 @@ static void cmcmdProgressReport(std::string const& dir, std::string const& num) } } -int cmcmd::ExecuteEchoColor(std::vector& args) +int cmcmd::ExecuteEchoColor(std::vector const& args) { // The arguments are // args[0] == @@ -1445,7 +1446,7 @@ int cmcmd::ExecuteEchoColor(std::vector& args) return 0; } -int cmcmd::ExecuteLinkScript(std::vector& args) +int cmcmd::ExecuteLinkScript(std::vector const& args) { // The arguments are // args[0] == @@ -1658,9 +1659,9 @@ std::ostream& operator<<(std::ostream& stream, return stream; } -static bool RunCommand(const char* comment, std::vector& command, - bool verbose, NumberFormat exitFormat, - int* retCodeOut = nullptr, +static bool RunCommand(const char* comment, + std::vector const& command, bool verbose, + NumberFormat exitFormat, int* retCodeOut = nullptr, bool (*retCodeOkay)(int) = nullptr) { if (verbose) { diff --git a/Source/cmcmd.h b/Source/cmcmd.h index d1e03d0..69a7ecb 100644 --- a/Source/cmcmd.h +++ b/Source/cmcmd.h @@ -16,18 +16,18 @@ public: * Execute commands during the build process. Supports options such * as echo, remove file etc. */ - static int ExecuteCMakeCommand(std::vector&); + static int ExecuteCMakeCommand(std::vector const&); protected: - static int HandleCoCompileCommands(std::vector& args); - static int HashSumFile(std::vector& args, + static int HandleCoCompileCommands(std::vector const& args); + static int HashSumFile(std::vector const& args, cmCryptoHash::Algo algo); - static int SymlinkLibrary(std::vector& args); - static int SymlinkExecutable(std::vector& args); + static int SymlinkLibrary(std::vector const& args); + static int SymlinkExecutable(std::vector const& args); static bool SymlinkInternal(std::string const& file, std::string const& link); - static int ExecuteEchoColor(std::vector& args); - static int ExecuteLinkScript(std::vector& args); + static int ExecuteEchoColor(std::vector const& args); + static int ExecuteLinkScript(std::vector const& args); static int WindowsCEEnvironment(const char* version, const std::string& name); static int VisualStudioLink(std::vector const& args, int type); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7d19b3091d7d2982a0d6b2b4408011efbb56f167 commit 7d19b3091d7d2982a0d6b2b4408011efbb56f167 Author: Ruslan Baratov AuthorDate: Fri Mar 29 18:53:12 2019 +0300 Commit: Ruslan Baratov CommitDate: Fri Mar 29 18:53:12 2019 +0300 Release note for CMAKE_PROJECT_INCLUDE variable diff --git a/Help/release/dev/project-include.rst b/Help/release/dev/project-include.rst new file mode 100644 index 0000000..659e933 --- /dev/null +++ b/Help/release/dev/project-include.rst @@ -0,0 +1,5 @@ +cmake_project_include +--------------------- + +* A variable :variable:`CMAKE_PROJECT_INCLUDE` was added to allow injection + of custom code into the project without knowing the project name a priori. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dda01904587627a3d2bda5b684f7bef1e62596bb commit dda01904587627a3d2bda5b684f7bef1e62596bb Author: Ruslan Baratov AuthorDate: Wed Mar 27 22:36:51 2019 +0300 Commit: Ruslan Baratov CommitDate: Wed Mar 27 22:39:02 2019 +0300 project: Add variable CMAKE_PROJECT_INCLUDE diff --git a/Help/command/project.rst b/Help/command/project.rst index 688e56c..a95012d 100644 --- a/Help/command/project.rst +++ b/Help/command/project.rst @@ -31,9 +31,9 @@ Further variables are set by the optional arguments described in the following. If any of these arguments is not used, then the corresponding variables are set to the empty string. -If the variable :variable:`CMAKE_PROJECT__INCLUDE` exists, -the file pointed to by that variable will be included as the last step of the -project command. +If the variable :variable:`CMAKE_PROJECT__INCLUDE` +or :variable:`CMAKE_PROJECT_INCLUDE` exists, the file pointed to by that +variable will be included as the last step of the project command. Options ^^^^^^^ diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 48d7550..e1584ef 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -195,6 +195,7 @@ Variables that Change Behavior /variable/CMAKE_POLICY_WARNING_CMPNNNN /variable/CMAKE_PREFIX_PATH /variable/CMAKE_PROGRAM_PATH + /variable/CMAKE_PROJECT_INCLUDE /variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE /variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY /variable/CMAKE_STAGING_PREFIX diff --git a/Help/variable/CMAKE_PROJECT_INCLUDE.rst b/Help/variable/CMAKE_PROJECT_INCLUDE.rst new file mode 100644 index 0000000..7de767a --- /dev/null +++ b/Help/variable/CMAKE_PROJECT_INCLUDE.rst @@ -0,0 +1,6 @@ +CMAKE_PROJECT_INCLUDE +--------------------- + +A CMake language file or module to be included by the :command:`project` +command. This is intended for injecting custom code into project +builds without modifying their source. diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index 2fe9fe8..de5d1ed 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -319,21 +319,41 @@ bool cmProjectCommand::InitialPass(std::vector const& args, languages.emplace_back("CXX"); } this->Makefile->EnableLanguage(languages, false); - std::string extraInclude = "CMAKE_PROJECT_" + projectName + "_INCLUDE"; - const char* include = this->Makefile->GetDefinition(extraInclude); - if (include) { - bool readit = this->Makefile->ReadDependentFile(include); - if (!readit && !cmSystemTools::GetFatalErrorOccured()) { - std::string m = "could not find file:\n" - " "; - m += include; - this->SetError(m); - return false; - } + + if (!this->IncludeByVariable("CMAKE_PROJECT_INCLUDE")) { + return false; + } + + if (!this->IncludeByVariable("CMAKE_PROJECT_" + projectName + "_INCLUDE")) { + return false; } + return true; } +bool cmProjectCommand::IncludeByVariable(const std::string& variable) +{ + const char* include = this->Makefile->GetDefinition(variable); + if (!include) { + return true; + } + + const bool readit = this->Makefile->ReadDependentFile(include); + if (readit) { + return true; + } + + if (cmSystemTools::GetFatalErrorOccured()) { + return true; + } + + std::string m = "could not find file:\n" + " "; + m += include; + this->SetError(m); + return false; +} + void cmProjectCommand::TopLevelCMakeVarCondSet(const char* const name, const char* const value) { diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h index 365d448..f1d03e7 100644 --- a/Source/cmProjectCommand.h +++ b/Source/cmProjectCommand.h @@ -36,6 +36,7 @@ public: cmExecutionStatus& status) override; private: + bool IncludeByVariable(const std::string& variable); void TopLevelCMakeVarCondSet(const char* name, const char* value); }; diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt index f40524f..57f0cf8 100644 --- a/Tests/CMakeOnly/CMakeLists.txt +++ b/Tests/CMakeOnly/CMakeLists.txt @@ -56,6 +56,12 @@ add_test(CMakeOnly.ProjectInclude ${CMAKE_CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/Test.cmake ) +add_test(CMakeOnly.ProjectIncludeAny ${CMAKE_CMAKE_COMMAND} + -DTEST=ProjectIncludeAny + -DCMAKE_ARGS=-DCMAKE_PROJECT_INCLUDE=${CMAKE_CURRENT_SOURCE_DIR}/ProjectInclude/include.cmake + -P ${CMAKE_CURRENT_BINARY_DIR}/Test.cmake + ) + include(CMakeParseArguments) function(add_major_test module) diff --git a/Tests/CMakeOnly/ProjectIncludeAny/CMakeLists.txt b/Tests/CMakeOnly/ProjectIncludeAny/CMakeLists.txt new file mode 100644 index 0000000..ffce488 --- /dev/null +++ b/Tests/CMakeOnly/ProjectIncludeAny/CMakeLists.txt @@ -0,0 +1,4 @@ +project(ProjectInclude LANGUAGES NONE) +if(NOT AUTO_INCLUDE) + message(FATAL_ERROR "include file not found") +endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=390f14a24416f23801f5644eb51590f8317d35c7 commit 390f14a24416f23801f5644eb51590f8317d35c7 Author: Ruslan Baratov AuthorDate: Wed Mar 27 22:33:37 2019 +0300 Commit: Ruslan Baratov CommitDate: Wed Mar 27 22:33:37 2019 +0300 Test ProjectInclude: Add NONE to avoid enabling languages diff --git a/Tests/CMakeOnly/ProjectInclude/CMakeLists.txt b/Tests/CMakeOnly/ProjectInclude/CMakeLists.txt index a9abb4a..ffce488 100644 --- a/Tests/CMakeOnly/ProjectInclude/CMakeLists.txt +++ b/Tests/CMakeOnly/ProjectInclude/CMakeLists.txt @@ -1,4 +1,4 @@ -project(ProjectInclude) +project(ProjectInclude LANGUAGES NONE) if(NOT AUTO_INCLUDE) message(FATAL_ERROR "include file not found") endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=87341d8328c7b3a1d50cfd534ff4cb44334a2561 commit 87341d8328c7b3a1d50cfd534ff4cb44334a2561 Author: Sebastian Holtermann AuthorDate: Wed Mar 27 15:50:17 2019 +0100 Commit: Sebastian Holtermann CommitDate: Wed Mar 27 18:12:43 2019 +0100 cmDepends: Define DependencyMap instead of DependencyVector In `cmDepends` use `typedef std::map> DependencyMap` instead of defining a `class DependencyVector : public std::vector` and using it in `std::map`. Since `std::map>` is used in various other places, we now reuse all of it's auto generated methods. This doesn't happen when we use `DependencyVector` in a `std::map`, because it is a different class than `std::vector`. diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 334f1e5..ed76dbf 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -61,7 +61,7 @@ bool cmDepends::Finalize(std::ostream& /*unused*/, std::ostream& /*unused*/) bool cmDepends::Check(const std::string& makeFile, const std::string& internalFile, - std::map& validDeps) + DependencyMap& validDeps) { // Check whether dependencies must be regenerated. bool okay = true; @@ -101,9 +101,9 @@ bool cmDepends::WriteDependencies(const std::set& /*unused*/, return false; } -bool cmDepends::CheckDependencies( - std::istream& internalDepends, const std::string& internalDependsFileName, - std::map& validDeps) +bool cmDepends::CheckDependencies(std::istream& internalDepends, + const std::string& internalDependsFileName, + DependencyMap& validDeps) { // Read internal depends file time cmFileTime internalDependsTime; @@ -124,7 +124,7 @@ bool cmDepends::CheckDependencies( std::string dependee; cmFileTime dependerTime; cmFileTime dependeeTime; - DependencyVector* currentDependencies = nullptr; + std::vector* currentDependencies = nullptr; while (std::getline(internalDepends, line)) { // Check if this an empty or a comment line diff --git a/Source/cmDepends.h b/Source/cmDepends.h index d9d5c67..b7475f0 100644 --- a/Source/cmDepends.h +++ b/Source/cmDepends.h @@ -24,6 +24,9 @@ class cmLocalGenerator; class cmDepends { public: + typedef std::map> DependencyMap; + +public: /** Instances need to know the build directory name and the relative path from the build directory to the target file. */ cmDepends(cmLocalGenerator* lg = nullptr, std::string targetDir = ""); @@ -55,17 +58,13 @@ public: /** Write dependencies for the target file. */ bool Write(std::ostream& makeDepends, std::ostream& internalDepends); - class DependencyVector : public std::vector - { - }; - /** Check dependencies for the target file. Returns true if dependencies are okay and false if they must be generated. If they must be generated Clear has already been called to wipe out the old dependencies. Dependencies which are still valid will be stored in validDeps. */ bool Check(const std::string& makeFile, const std::string& internalFile, - std::map& validDeps); + DependencyMap& validDeps); /** Clear dependencies for the target file so they will be regenerated. */ void Clear(const std::string& file); @@ -84,9 +83,9 @@ protected: // Check dependencies for the target file in the given stream. // Return false if dependencies must be regenerated and true // otherwise. - virtual bool CheckDependencies( - std::istream& internalDepends, const std::string& internalDependsFileName, - std::map& validDeps); + virtual bool CheckDependencies(std::istream& internalDepends, + const std::string& internalDependsFileName, + DependencyMap& validDeps); // Finalize the dependency information for the target. virtual bool Finalize(std::ostream& makeDepends, diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 7b78767..dc49c18 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -21,9 +21,8 @@ cmDependsC::cmDependsC() = default; -cmDependsC::cmDependsC( - cmLocalGenerator* lg, const std::string& targetDir, const std::string& lang, - const std::map* validDeps) +cmDependsC::cmDependsC(cmLocalGenerator* lg, const std::string& targetDir, + const std::string& lang, const DependencyMap* validDeps) : cmDepends(lg, targetDir) , ValidDeps(validDeps) { @@ -102,8 +101,7 @@ bool cmDependsC::WriteDependencies(const std::set& sources, this->LocalGenerator->MaybeConvertToRelativePath(binDir, obj); if (this->ValidDeps != nullptr) { - std::map::const_iterator tmpIt = - this->ValidDeps->find(obj_i); + auto const tmpIt = this->ValidDeps->find(obj_i); if (tmpIt != this->ValidDeps->end()) { dependencies.insert(tmpIt->second.begin(), tmpIt->second.end()); haveDeps = true; diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h index eee5ae1..3fc839e 100644 --- a/Source/cmDependsC.h +++ b/Source/cmDependsC.h @@ -27,8 +27,7 @@ public: relative path from the build directory to the target file. */ cmDependsC(); cmDependsC(cmLocalGenerator* lg, const std::string& targetDir, - const std::string& lang, - const std::map* validDeps); + const std::string& lang, const DependencyMap* validDeps); /** Virtual destructor to cleanup subclasses properly. */ ~cmDependsC() override; @@ -81,7 +80,7 @@ public: }; protected: - const std::map* ValidDeps = nullptr; + const DependencyMap* ValidDeps = nullptr; std::set Encountered; std::queue Unscanned; diff --git a/Source/cmDependsJava.cxx b/Source/cmDependsJava.cxx index 2485e15..b17b2ba 100644 --- a/Source/cmDependsJava.cxx +++ b/Source/cmDependsJava.cxx @@ -24,8 +24,7 @@ bool cmDependsJava::WriteDependencies(const std::set& sources, bool cmDependsJava::CheckDependencies( std::istream& /*internalDepends*/, - const std::string& /*internalDependsFileName*/, - std::map& /*validDeps*/) + const std::string& /*internalDependsFileName*/, DependencyMap& /*validDeps*/) { return true; } diff --git a/Source/cmDependsJava.h b/Source/cmDependsJava.h index 109ef13..dd671a1 100644 --- a/Source/cmDependsJava.h +++ b/Source/cmDependsJava.h @@ -8,7 +8,6 @@ #include "cmDepends.h" #include -#include #include #include @@ -33,9 +32,9 @@ protected: bool WriteDependencies(const std::set& sources, const std::string& file, std::ostream& makeDepends, std::ostream& internalDepends) override; - bool CheckDependencies( - std::istream& internalDepends, const std::string& internalDependsFileName, - std::map& validDeps) override; + bool CheckDependencies(std::istream& internalDepends, + const std::string& internalDependsFileName, + DependencyMap& validDeps) override; }; #endif diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index f3d5a94..2857d39 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1312,7 +1312,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies( // The build.make file may have explicit dependencies for the object // files but these will not affect the scanning process so they need // not be considered. - std::map validDependencies; + cmDepends::DependencyMap validDependencies; bool needRescanDependencies = false; if (!needRescanDirInfo) { cmDependsC checker; @@ -1352,8 +1352,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies( bool cmLocalUnixMakefileGenerator3::ScanDependencies( std::string const& targetDir, std::string const& dependFile, - std::string const& internalDependFile, - std::map& validDeps) + std::string const& internalDependFile, cmDepends::DependencyMap& validDeps) { // Read the directory information file. cmMakefile* mf = this->Makefile; diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index ba882da..7a0ea98 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -143,8 +143,7 @@ public: // File pairs for implicit dependency scanning. The key of the map // is the depender and the value is the explicit dependee. - struct ImplicitDependFileMap - : public std::map + struct ImplicitDependFileMap : public cmDepends::DependencyMap { }; struct ImplicitDependLanguageMap @@ -230,10 +229,10 @@ protected: const char* filename = nullptr); // Helper methods for dependency updates. - bool ScanDependencies( - std::string const& targetDir, std::string const& dependFile, - std::string const& internalDependFile, - std::map& validDeps); + bool ScanDependencies(std::string const& targetDir, + std::string const& dependFile, + std::string const& internalDependFile, + cmDepends::DependencyMap& validDeps); void CheckMultipleOutputs(bool verbose); private: https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5a15c9e7cb63fb5b884271a1184607a8fa87d442 commit 5a15c9e7cb63fb5b884271a1184607a8fa87d442 Author: Sebastian Holtermann AuthorDate: Wed Mar 27 14:35:05 2019 +0100 Commit: Sebastian Holtermann CommitDate: Wed Mar 27 18:11:36 2019 +0100 cmDepends: Refactor cmDepends::CheckDependencies method This patch changes the following issues in `cmDepends::CheckDependencies`: - Use the `std::string` based `std::getline` interface to read lines from a file instead of using raw reads into raw buffers. - To reduce the file system access, we load file times only once from `cmFileTimeCache` and keep them on the stack for later comparison. - When a file is removed from the file system we remove it from the `cmFileTimeCache` as well. diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index efadaf1..334f1e5 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmDepends.h" +#include "cmFileTime.h" #include "cmFileTimeCache.h" #include "cmGeneratedFileStream.h" #include "cmLocalGenerator.h" @@ -10,22 +11,15 @@ #include "cmsys/FStream.hxx" #include -#include #include cmDepends::cmDepends(cmLocalGenerator* lg, std::string targetDir) : LocalGenerator(lg) , TargetDirectory(std::move(targetDir)) - , Dependee(new char[MaxPath]) - , Depender(new char[MaxPath]) { } -cmDepends::~cmDepends() -{ - delete[] this->Dependee; - delete[] this->Depender; -} +cmDepends::~cmDepends() = default; bool cmDepends::Write(std::ostream& makeDepends, std::ostream& internalDepends) { @@ -76,9 +70,9 @@ bool cmDepends::Check(const std::string& makeFile, // Clear all dependencies so they will be regenerated. this->Clear(makeFile); cmSystemTools::RemoveFile(internalFile); + this->FileTimeCache->Remove(internalFile); okay = false; } - return okay; } @@ -111,44 +105,58 @@ bool cmDepends::CheckDependencies( std::istream& internalDepends, const std::string& internalDependsFileName, std::map& validDeps) { + // Read internal depends file time + cmFileTime internalDependsTime; + if (!this->FileTimeCache->Load(internalDependsFileName, + internalDependsTime)) { + return false; + } + // Parse dependencies from the stream. If any dependee is missing // or newer than the depender then dependencies should be // regenerated. bool okay = true; bool dependerExists = false; + + std::string line; + line.reserve(1024); + std::string depender; + std::string dependee; + cmFileTime dependerTime; + cmFileTime dependeeTime; DependencyVector* currentDependencies = nullptr; - while (internalDepends.getline(this->Dependee, this->MaxPath)) { - if (this->Dependee[0] == 0 || this->Dependee[0] == '#' || - this->Dependee[0] == '\r') { + while (std::getline(internalDepends, line)) { + // Check if this an empty or a comment line + if (line.empty() || line.front() == '#') { continue; } - size_t len = internalDepends.gcount() - 1; - if (this->Dependee[len - 1] == '\r') { - len--; - this->Dependee[len] = 0; + // Drop carriage return character at the end + if (line.back() == '\r') { + line.pop_back(); + if (line.empty()) { + continue; + } } - if (this->Dependee[0] != ' ') { - memcpy(this->Depender, this->Dependee, len + 1); - // Calling FileExists() for the depender here saves in many cases 50% - // of the calls to FileExists() further down in the loop. E.g. for - // kdelibs/khtml this reduces the number of calls from 184k down to 92k, - // or the time for cmake -E cmake_depends from 0.3 s down to 0.21 s. - dependerExists = cmSystemTools::FileExists(this->Depender); + // Check if this a depender line + if (line.front() != ' ') { + depender = line; + dependerExists = this->FileTimeCache->Load(depender, dependerTime); // If we erase validDeps[this->Depender] by overwriting it with an empty // vector, we lose dependencies for dependers that have multiple // entries. No need to initialize the entry, std::map will do so on first // access. - currentDependencies = &validDeps[this->Depender]; + currentDependencies = &validDeps[depender]; continue; } - /* - // Parse the dependency line. - if(!this->ParseDependency(line.c_str())) - { - continue; - } - */ + + // This is a dependee line + dependee = line.substr(1); + + // Add dependee to depender's list + if (currentDependencies != nullptr) { + currentDependencies->push_back(dependee); + } // Dependencies must be regenerated // * if the dependee does not exist @@ -156,13 +164,8 @@ bool cmDepends::CheckDependencies( // * if the depender does not exist, but the dependee is newer than the // depends file bool regenerate = false; - const std::string dependee(this->Dependee + 1); - const std::string depender(this->Depender); - if (currentDependencies != nullptr) { - currentDependencies->push_back(dependee); - } - - if (!cmSystemTools::FileExists(dependee)) { + bool dependeeExists = this->FileTimeCache->Load(dependee, dependeeTime); + if (!dependeeExists) { // The dependee does not exist. regenerate = true; @@ -173,44 +176,38 @@ bool cmDepends::CheckDependencies( << depender << "\"." << std::endl; cmSystemTools::Stdout(msg.str()); } - } else { - if (dependerExists) { - // The dependee and depender both exist. Compare file times. - int result = 0; - if ((!this->FileTimeCache->Compare(depender, dependee, &result) || - result < 0)) { - // The depender is older than the dependee. - regenerate = true; - - // Print verbose output. - if (this->Verbose) { - std::ostringstream msg; - msg << "Dependee \"" << dependee << "\" is newer than depender \"" - << depender << "\"." << std::endl; - cmSystemTools::Stdout(msg.str()); - } + } else if (dependerExists) { + // The dependee and depender both exist. Compare file times. + if (dependerTime.Older(dependeeTime)) { + // The depender is older than the dependee. + regenerate = true; + + // Print verbose output. + if (this->Verbose) { + std::ostringstream msg; + msg << "Dependee \"" << dependee << "\" is newer than depender \"" + << depender << "\"." << std::endl; + cmSystemTools::Stdout(msg.str()); } - } else { - // The dependee exists, but the depender doesn't. Regenerate if the - // internalDepends file is older than the dependee. - int result = 0; - if ((!this->FileTimeCache->Compare(internalDependsFileName, dependee, - &result) || - result < 0)) { - // The depends-file is older than the dependee. - regenerate = true; - - // Print verbose output. - if (this->Verbose) { - std::ostringstream msg; - msg << "Dependee \"" << dependee - << "\" is newer than depends file \"" - << internalDependsFileName << "\"." << std::endl; - cmSystemTools::Stdout(msg.str()); - } + } + } else { + // The dependee exists, but the depender doesn't. Regenerate if the + // internalDepends file is older than the dependee. + if (internalDependsTime.Older(dependeeTime)) { + // The depends-file is older than the dependee. + regenerate = true; + + // Print verbose output. + if (this->Verbose) { + std::ostringstream msg; + msg << "Dependee \"" << dependee + << "\" is newer than depends file \"" << internalDependsFileName + << "\"." << std::endl; + cmSystemTools::Stdout(msg.str()); } } } + if (regenerate) { // Dependencies must be regenerated. okay = false; @@ -218,13 +215,14 @@ bool cmDepends::CheckDependencies( // Remove the information of this depender from the map, it needs // to be rescanned if (currentDependencies != nullptr) { - validDeps.erase(this->Depender); + validDeps.erase(depender); currentDependencies = nullptr; } // Remove the depender to be sure it is rebuilt. if (dependerExists) { cmSystemTools::RemoveFile(depender); + this->FileTimeCache->Remove(depender); dependerExists = false; } } diff --git a/Source/cmDepends.h b/Source/cmDepends.h index fc6571d..d9d5c67 100644 --- a/Source/cmDepends.h +++ b/Source/cmDepends.h @@ -8,7 +8,6 @@ #include #include #include -#include #include #include @@ -105,10 +104,6 @@ protected: // The full path to the target's build directory. std::string TargetDirectory; - size_t MaxPath = 16384; - char* Dependee; - char* Depender; - // The include file search path. std::vector IncludePath; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5f6c236481da552dfdbfff6579dc9d833993adad commit 5f6c236481da552dfdbfff6579dc9d833993adad Author: Sebastian Holtermann AuthorDate: Wed Mar 27 13:43:08 2019 +0100 Commit: Sebastian Holtermann CommitDate: Wed Mar 27 18:09:53 2019 +0100 cmFiletimeCache: Add cmFiletimeCache::Remove method diff --git a/Source/cmFileTimeCache.cxx b/Source/cmFileTimeCache.cxx index 1fff6a9..24d6bf6 100644 --- a/Source/cmFileTimeCache.cxx +++ b/Source/cmFileTimeCache.cxx @@ -14,8 +14,8 @@ bool cmFileTimeCache::Load(std::string const& fileName, cmFileTime& fileTime) { // Use the stored time if available. { - auto fit = this->FileTimes.find(fileName); - if (fit != this->FileTimes.end()) { + auto fit = this->Cache.find(fileName); + if (fit != this->Cache.end()) { fileTime = fit->second; return true; } @@ -25,10 +25,15 @@ bool cmFileTimeCache::Load(std::string const& fileName, cmFileTime& fileTime) return false; } // Store file time in cache - this->FileTimes[fileName] = fileTime; + this->Cache[fileName] = fileTime; return true; } +bool cmFileTimeCache::Remove(std::string const& fileName) +{ + return (this->Cache.erase(fileName) != 0); +} + bool cmFileTimeCache::Compare(std::string const& f1, std::string const& f2, int* result) { diff --git a/Source/cmFileTimeCache.h b/Source/cmFileTimeCache.h index a47904c..4f1a3a2 100644 --- a/Source/cmFileTimeCache.h +++ b/Source/cmFileTimeCache.h @@ -5,7 +5,7 @@ #include "cmConfigure.h" // IWYU pragma: keep -#include "cmFileTime.h" +#include "cmFileTime.h" // IWYU pragma: keep #include #include @@ -28,6 +28,12 @@ public: bool Load(std::string const& fileName, cmFileTime& fileTime); /** + * @brief Removes a file time from the cache + * @return true if the file was found in the cache and removed + */ + bool Remove(std::string const& fileName); + + /** * @brief Compare file modification times. * @return true for successful comparison and false for error. * @@ -44,8 +50,7 @@ public: bool DifferS(std::string const& f1, std::string const& f2); private: - typedef std::unordered_map FileTimeMap; - FileTimeMap FileTimes; + std::unordered_map Cache; }; #endif https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=18c30786a9a1444e726e23366dd9badb01f1d464 commit 18c30786a9a1444e726e23366dd9badb01f1d464 Author: Sebastian Holtermann AuthorDate: Wed Mar 27 15:19:28 2019 +0100 Commit: Sebastian Holtermann CommitDate: Wed Mar 27 18:09:53 2019 +0100 cmFileTime: Make cmFileTime::Compare method const diff --git a/Source/cmFileTime.h b/Source/cmFileTime.h index 4c8e556..d4de4e0 100644 --- a/Source/cmFileTime.h +++ b/Source/cmFileTime.h @@ -50,7 +50,7 @@ public: * @brief Compare file modification times. * @return -1, 0, +1 for this older, same, or newer than ftm. */ - int Compare(cmFileTime const& ftm) + int Compare(cmFileTime const& ftm) const { NSC const diff = this->NS - ftm.NS; if (diff == 0) { ----------------------------------------------------------------------- Summary of changes: Help/command/project.rst | 6 +- Help/manual/cmake-variables.7.rst | 1 + Help/release/dev/project-include.rst | 5 + ...-NAME_INCLUDE.rst => CMAKE_PROJECT_INCLUDE.rst} | 4 +- Source/CPack/cpack.cxx | 2 +- Source/CTest/cmCTestBuildAndTestHandler.h | 2 +- Source/CTest/cmCTestBuildHandler.cxx | 4 +- Source/CTest/cmCTestGIT.cxx | 2 +- Source/CTest/cmCTestLaunch.cxx | 2 +- Source/CTest/cmCTestMemCheckHandler.h | 6 +- Source/CTest/cmCTestSVN.cxx | 4 +- Source/CTest/cmCTestTestHandler.cxx | 4 +- Source/CTest/cmCTestTestHandler.h | 4 +- Source/cmCacheManager.h | 24 ++-- Source/cmCallVisualStudioMacro.cxx | 30 ++-- Source/cmCallVisualStudioMacro.h | 12 +- Source/cmDepends.cxx | 154 ++++++++++----------- Source/cmDepends.h | 20 +-- Source/cmDependsC.cxx | 8 +- Source/cmDependsC.h | 5 +- Source/cmDependsFortran.cxx | 2 +- Source/cmDependsJava.cxx | 3 +- Source/cmDependsJava.h | 7 +- Source/cmDependsJavaParserHelper.cxx | 13 +- Source/cmExternalMakefileProjectGenerator.h | 10 +- Source/cmFileInstaller.cxx | 2 +- Source/cmFileTime.h | 2 +- Source/cmFileTimeCache.cxx | 11 +- Source/cmFileTimeCache.h | 11 +- Source/cmGeneratorTarget.h | 6 +- Source/cmGlobVerificationManager.h | 12 +- Source/cmGlobalBorlandMakefileGenerator.cxx | 2 +- Source/cmGlobalBorlandMakefileGenerator.h | 4 +- Source/cmGlobalGenerator.h | 22 +-- Source/cmGlobalGhsMultiGenerator.h | 4 +- Source/cmGlobalJOMMakefileGenerator.h | 2 +- Source/cmGlobalMSYSMakefileGenerator.h | 2 +- Source/cmGlobalMinGWMakefileGenerator.h | 2 +- Source/cmGlobalNMakeMakefileGenerator.h | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- Source/cmGlobalUnixMakefileGenerator3.h | 2 +- Source/cmGlobalVisualStudio10Generator.cxx | 2 +- Source/cmGlobalVisualStudio10Generator.h | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 2 +- Source/cmGlobalVisualStudio7Generator.h | 6 +- Source/cmGlobalVisualStudio8Generator.h | 2 +- Source/cmGlobalWatcomWMakeGenerator.h | 2 +- Source/cmGlobalXCodeGenerator.cxx | 2 +- Source/cmGlobalXCodeGenerator.h | 8 +- Source/cmLoadCommandCommand.cxx | 2 +- Source/cmLocalGenerator.cxx | 2 +- Source/cmLocalGenerator.h | 12 +- Source/cmLocalUnixMakefileGenerator3.cxx | 5 +- Source/cmLocalUnixMakefileGenerator3.h | 11 +- Source/cmLocalVisualStudio10Generator.h | 2 +- Source/cmLocalVisualStudio7Generator.h | 2 +- Source/cmLocalXCodeGenerator.h | 2 +- Source/cmMakefile.h | 16 +-- Source/cmOutputConverter.h | 2 +- Source/cmPolicies.cxx | 6 +- Source/cmPolicies.h | 12 +- Source/cmProjectCommand.cxx | 42 ++++-- Source/cmProjectCommand.h | 1 + Source/cmSourceFile.h | 8 +- Source/cmState.h | 2 +- Source/cmSystemTools.h | 22 +-- Source/cmTarget.cxx | 2 +- Source/cmTarget.h | 42 +++--- Source/cmTargetPropertyComputer.h | 2 +- Source/cmTest.h | 4 +- Source/cmake.h | 48 +++---- Source/cmcmd.cxx | 147 ++++++++++---------- Source/cmcmd.h | 14 +- Tests/CMakeOnly/CMakeLists.txt | 6 + Tests/CMakeOnly/ProjectInclude/CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- 76 files changed, 442 insertions(+), 424 deletions(-) create mode 100644 Help/release/dev/project-include.rst copy Help/variable/{CMAKE_PROJECT_PROJECT-NAME_INCLUDE.rst => CMAKE_PROJECT_INCLUDE.rst} (70%) copy Tests/CMakeOnly/{ProjectInclude => ProjectIncludeAny}/CMakeLists.txt (66%) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Apr 2 00:03:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 2 Apr 2019 00:03:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-568-g56ae290 Message-ID: <20190402040304.86530FAE14@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 56ae290284a7f6f7298bf7410a361aaecb7ebbe9 (commit) from 3e129d71bc12a325c0548aaaea24470cd172470b (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=56ae290284a7f6f7298bf7410a361aaecb7ebbe9 commit 56ae290284a7f6f7298bf7410a361aaecb7ebbe9 Author: Kitware Robot AuthorDate: Tue Apr 2 00:01:09 2019 -0400 Commit: Kitware Robot CommitDate: Tue Apr 2 00:01:09 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7906a0b..a51864a 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 14) -set(CMake_VERSION_PATCH 20190401) +set(CMake_VERSION_PATCH 20190402) #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 Apr 2 14:23:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 2 Apr 2019 14:23:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-570-g81985b7 Message-ID: <20190402182305.7E136103471@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 81985b7c6c9a15ca7a59c54979d8371c783fb581 (commit) via 9e4de543d067586b0f74666f7b07717a3f3173e0 (commit) from 56ae290284a7f6f7298bf7410a361aaecb7ebbe9 (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=81985b7c6c9a15ca7a59c54979d8371c783fb581 commit 81985b7c6c9a15ca7a59c54979d8371c783fb581 Merge: 56ae290 9e4de54 Author: Brad King AuthorDate: Tue Apr 2 18:17:38 2019 +0000 Commit: Kitware Robot CommitDate: Tue Apr 2 14:17:57 2019 -0400 Merge topic 'nasm-fix' 9e4de543d0 Modules: Check nasm compile object variable Acked-by: Kitware Robot Merge-request: !3167 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9e4de543d067586b0f74666f7b07717a3f3173e0 commit 9e4de543d067586b0f74666f7b07717a3f3173e0 Author: Connor Davis AuthorDate: Fri Mar 29 21:57:28 2019 -0600 Commit: Connor Davis CommitDate: Fri Mar 29 21:57:28 2019 -0600 Modules: Check nasm compile object variable Check if the CMAKE_ASM_NASM_COMPILE_OBJECT variable is set before modifying it. Only modify if not previously set. diff --git a/Modules/CMakeASM_NASMInformation.cmake b/Modules/CMakeASM_NASMInformation.cmake index 1e3c608..cb793e7 100644 --- a/Modules/CMakeASM_NASMInformation.cmake +++ b/Modules/CMakeASM_NASMInformation.cmake @@ -28,7 +28,9 @@ if(NOT CMAKE_ASM_NASM_OBJECT_FORMAT) endif() endif() -set(CMAKE_ASM_NASM_COMPILE_OBJECT " -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o ") +if(NOT CMAKE_ASM_NASM_COMPILE_OBJECT) + set(CMAKE_ASM_NASM_COMPILE_OBJECT " -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o ") +endif() # Load the generic ASMInformation file: set(ASM_DIALECT "_NASM") ----------------------------------------------------------------------- Summary of changes: Modules/CMakeASM_NASMInformation.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Apr 3 00:03:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 3 Apr 2019 00:03:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-571-gd724060 Message-ID: <20190403040304.35F2A11E5BD@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 d724060459f6adb5e7d99efde08c8fbacc4fdb5d (commit) from 81985b7c6c9a15ca7a59c54979d8371c783fb581 (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=d724060459f6adb5e7d99efde08c8fbacc4fdb5d commit d724060459f6adb5e7d99efde08c8fbacc4fdb5d Author: Kitware Robot AuthorDate: Wed Apr 3 00:01:10 2019 -0400 Commit: Kitware Robot CommitDate: Wed Apr 3 00:01:10 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a51864a..f7c65f5 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 14) -set(CMake_VERSION_PATCH 20190402) +set(CMake_VERSION_PATCH 20190403) #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 Apr 3 14:13:10 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 3 Apr 2019 14:13:10 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-576-g6fdba8b Message-ID: <20190403181310.12068A812E@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 6fdba8b8beb6d971a3c2efe8973cdee970dfd40a (commit) via 058217669fdb089f652c68b9eb0a3231a7172c91 (commit) via 707283981fd455bf0bf3ec62a669cf1c0a2e1edb (commit) via 8ca1b262863d8a5cbb8306a52873101c2e940f78 (commit) via 37da6af17d0d2cc8b499dc58f74866351e06c288 (commit) from d724060459f6adb5e7d99efde08c8fbacc4fdb5d (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=6fdba8b8beb6d971a3c2efe8973cdee970dfd40a commit 6fdba8b8beb6d971a3c2efe8973cdee970dfd40a Merge: 0582176 7072839 Author: Brad King AuthorDate: Wed Apr 3 18:06:38 2019 +0000 Commit: Kitware Robot CommitDate: Wed Apr 3 14:07:11 2019 -0400 Merge topic 'refactor-lang-flags' 707283981f VS: Use AddLanguageFlags to de-duplicate CMAKE__FLAGS* lookup 8ca1b26286 cmLocalGenerator: Factor IPO logic out of AddLanguageFlags Acked-by: Kitware Robot Merge-request: !3177 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=058217669fdb089f652c68b9eb0a3231a7172c91 commit 058217669fdb089f652c68b9eb0a3231a7172c91 Merge: d724060 37da6af Author: Brad King AuthorDate: Wed Apr 3 18:05:32 2019 +0000 Commit: Kitware Robot CommitDate: Wed Apr 3 14:05:57 2019 -0400 Merge topic 'find-dependency-fix-17583' 37da6af17d find_dependency: Always search dependencies Acked-by: Kitware Robot Merge-request: !3161 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=707283981fd455bf0bf3ec62a669cf1c0a2e1edb commit 707283981fd455bf0bf3ec62a669cf1c0a2e1edb Author: Brad King AuthorDate: Mon Apr 1 13:38:55 2019 -0400 Commit: Brad King CommitDate: Tue Apr 2 14:23:46 2019 -0400 VS: Use AddLanguageFlags to de-duplicate CMAKE__FLAGS* lookup diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index e519d78..7ba3471 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -662,14 +662,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration( langForClCompile = linkLanguage; if (langForClCompile == "C" || langForClCompile == "CXX" || langForClCompile == "Fortran") { - std::string baseFlagVar = "CMAKE_"; - baseFlagVar += langForClCompile; - baseFlagVar += "_FLAGS"; - flags = this->Makefile->GetRequiredDefinition(baseFlagVar); - std::string flagVar = - baseFlagVar + std::string("_") + cmSystemTools::UpperCase(configName); - flags += " "; - flags += this->Makefile->GetRequiredDefinition(flagVar); + this->AddLanguageFlags(flags, target, langForClCompile, configName); } // set the correct language if (linkLanguage == "C") { diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 8804e6c..5195957 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2540,14 +2540,8 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( } this->LangForClCompile = langForClCompile; if (!langForClCompile.empty()) { - std::string baseFlagVar = "CMAKE_"; - baseFlagVar += langForClCompile; - baseFlagVar += "_FLAGS"; - flags = this->Makefile->GetRequiredDefinition(baseFlagVar); - std::string flagVar = - baseFlagVar + "_" + cmSystemTools::UpperCase(configName); - flags += " "; - flags += this->Makefile->GetRequiredDefinition(flagVar); + this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget, + langForClCompile, configName); this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget, langForClCompile, configName); } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8ca1b262863d8a5cbb8306a52873101c2e940f78 commit 8ca1b262863d8a5cbb8306a52873101c2e940f78 Author: Brad King AuthorDate: Mon Apr 1 13:37:02 2019 -0400 Commit: Brad King CommitDate: Tue Apr 2 14:23:32 2019 -0400 cmLocalGenerator: Factor IPO logic out of AddLanguageFlags The IPO flag logic was added to `AddLanguageFlags` based on my advice. However, this method should really only be about `CMAKE__FLAGS*` variables. Move the IPO logic out to its call sites. diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index af165f6..2fc6121 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1800,6 +1800,10 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, this->CurrentLocalGenerator->AddLanguageFlags(flags, gtgt, lang, configName); + if (gtgt->IsIPOEnabled(lang, configName)) { + this->CurrentLocalGenerator->AppendFeatureOptions(flags, lang, "IPO"); + } + // Add shared-library flags if needed. this->CurrentLocalGenerator->AddCMP0018Flags(flags, gtgt, lang, configName); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 40b8e19..6337f07 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1258,6 +1258,10 @@ void cmLocalGenerator::GetTargetCompileFlags(cmGeneratorTarget* target, // Add language-specific flags. this->AddLanguageFlags(flags, target, lang, config); + if (target->IsIPOEnabled(lang, config)) { + this->AppendFeatureOptions(flags, lang, "IPO"); + } + this->AddArchitectureFlags(flags, target, lang, config); if (lang == "Fortran") { @@ -1515,9 +1519,8 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags, flagsVar += "_FLAGS"; this->AddConfigVariableFlags(flags, flagsVar, config); - if (target->IsIPOEnabled(lang, config)) { - this->AppendFeatureOptions(flags, lang, "IPO"); - } + // Placeholder for possible future per-target flags. + static_cast(target); } void cmLocalGenerator::AddLanguageFlagsForLinking( @@ -1534,6 +1537,10 @@ void cmLocalGenerator::AddLanguageFlagsForLinking( } this->AddLanguageFlags(flags, target, lang, config); + + if (target->IsIPOEnabled(lang, config)) { + this->AppendFeatureOptions(flags, lang, "IPO"); + } } cmGeneratorTarget* cmLocalGenerator::FindGeneratorTargetToUse( https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=37da6af17d0d2cc8b499dc58f74866351e06c288 commit 37da6af17d0d2cc8b499dc58f74866351e06c288 Author: Damien R <9464-damienrg at users.noreply.gitlab.kitware.com> AuthorDate: Fri Mar 29 00:47:23 2019 +0100 Commit: Damien R <9464-damienrg at users.noreply.gitlab.kitware.com> CommitDate: Fri Mar 29 22:03:21 2019 +0100 find_dependency: Always search dependencies When a dependency was already found, find_dependency did not search it again. While this works in basic case, it does not when there are components as the check does not take components into account. Given the fact that there is no documentation about this optimization and that the correct implementation is not trivial as it would require changes in find_package to have the list of components already found we always search dependencies. Fix #17583. diff --git a/Modules/CMakeFindDependencyMacro.cmake b/Modules/CMakeFindDependencyMacro.cmake index ab22701..bcdfbeb 100644 --- a/Modules/CMakeFindDependencyMacro.cmake +++ b/Modules/CMakeFindDependencyMacro.cmake @@ -31,35 +31,33 @@ CMakeFindDependencyMacro #]=======================================================================] macro(find_dependency dep) - if (NOT ${dep}_FOUND) - set(cmake_fd_quiet_arg) - if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) - set(cmake_fd_quiet_arg QUIET) - endif() - set(cmake_fd_required_arg) - if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) - set(cmake_fd_required_arg REQUIRED) - endif() + set(cmake_fd_quiet_arg) + if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) + set(cmake_fd_quiet_arg QUIET) + endif() + set(cmake_fd_required_arg) + if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) + set(cmake_fd_required_arg REQUIRED) + endif() - get_property(cmake_fd_alreadyTransitive GLOBAL PROPERTY - _CMAKE_${dep}_TRANSITIVE_DEPENDENCY - ) + get_property(cmake_fd_alreadyTransitive GLOBAL PROPERTY + _CMAKE_${dep}_TRANSITIVE_DEPENDENCY + ) - find_package(${dep} ${ARGN} - ${cmake_fd_quiet_arg} - ${cmake_fd_required_arg} - ) + find_package(${dep} ${ARGN} + ${cmake_fd_quiet_arg} + ${cmake_fd_required_arg} + ) - if(NOT DEFINED cmake_fd_alreadyTransitive OR cmake_fd_alreadyTransitive) - set_property(GLOBAL PROPERTY _CMAKE_${dep}_TRANSITIVE_DEPENDENCY TRUE) - endif() + if(NOT DEFINED cmake_fd_alreadyTransitive OR cmake_fd_alreadyTransitive) + set_property(GLOBAL PROPERTY _CMAKE_${dep}_TRANSITIVE_DEPENDENCY TRUE) + endif() - if (NOT ${dep}_FOUND) - set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency ${dep} could not be found.") - set(${CMAKE_FIND_PACKAGE_NAME}_FOUND False) - return() - endif() - set(cmake_fd_required_arg) - set(cmake_fd_quiet_arg) + if (NOT ${dep}_FOUND) + set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency ${dep} could not be found.") + set(${CMAKE_FIND_PACKAGE_NAME}_FOUND False) + return() endif() + set(cmake_fd_required_arg) + set(cmake_fd_quiet_arg) endmacro() diff --git a/Tests/Module/FindDependency/CMakeLists.txt b/Tests/Module/FindDependency/CMakeLists.txt index dcb998a..06d7dce 100644 --- a/Tests/Module/FindDependency/CMakeLists.txt +++ b/Tests/Module/FindDependency/CMakeLists.txt @@ -6,6 +6,8 @@ set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/packages") find_package(Pack1 REQUIRED) find_package(Pack4 4.3 EXACT REQUIRED) +find_package(Pack7 REQUIRED) +find_package(Pack8 REQUIRED) add_executable(FindDependency main.cpp) -target_link_libraries(FindDependency Pack1::Lib Pack4::Lib) +target_link_libraries(FindDependency Pack1::Lib Pack4::Lib Pack8::Lib) diff --git a/Tests/Module/FindDependency/main.cpp b/Tests/Module/FindDependency/main.cpp index 1df4cb5..4ee460f 100644 --- a/Tests/Module/FindDependency/main.cpp +++ b/Tests/Module/FindDependency/main.cpp @@ -23,6 +23,18 @@ # error Expected HAVE_PACK6 #endif +#ifndef HAVE_PACK7 +# error Expected HAVE_PACK7 +#endif + +#ifndef HAVE_PACK7_COMP1 +# error Expected HAVE_PACK7_COMP1 +#endif + +#ifndef HAVE_PACK8 +# error Expected HAVE_PACK8 +#endif + int main(int argc, char** argv) { return 0; diff --git a/Tests/Module/FindDependency/packages/Pack7/Pack7Config.cmake b/Tests/Module/FindDependency/packages/Pack7/Pack7Config.cmake new file mode 100644 index 0000000..9df1345 --- /dev/null +++ b/Tests/Module/FindDependency/packages/Pack7/Pack7Config.cmake @@ -0,0 +1,14 @@ +if(NOT Pack7_FOUND) + set(Pack7_FOUND 1) + add_library(Pack7::Pack7 INTERFACE IMPORTED) + set_property(TARGET Pack7::Pack7 PROPERTY INTERFACE_COMPILE_DEFINITIONS HAVE_PACK7) +endif() + +foreach(module ${Pack7_FIND_COMPONENTS}) + if(module STREQUAL "Comp1") + add_library(Pack7::Comp1 INTERFACE IMPORTED) + set_property(TARGET Pack7::Comp1 PROPERTY INTERFACE_COMPILE_DEFINITIONS HAVE_PACK7_COMP1) + set_property(TARGET Pack7::Comp1 PROPERTY INTERFACE_LINK_LIBRARIES Pack7::Pack7) + set(Pack7_Comp1_FOUND 1) + endif() +endforeach() diff --git a/Tests/Module/FindDependency/packages/Pack8/Pack8Config.cmake b/Tests/Module/FindDependency/packages/Pack8/Pack8Config.cmake new file mode 100644 index 0000000..d7ca054 --- /dev/null +++ b/Tests/Module/FindDependency/packages/Pack8/Pack8Config.cmake @@ -0,0 +1,7 @@ +include(CMakeFindDependencyMacro) + +find_dependency(Pack7 REQUIRED COMPONENTS Comp1) + +add_library(Pack8::Lib INTERFACE IMPORTED) +set_property(TARGET Pack8::Lib PROPERTY INTERFACE_COMPILE_DEFINITIONS HAVE_PACK8) +set_property(TARGET Pack8::Lib PROPERTY INTERFACE_LINK_LIBRARIES Pack7::Comp1) ----------------------------------------------------------------------- Summary of changes: Modules/CMakeFindDependencyMacro.cmake | 50 +++++++++++----------- Source/cmGlobalXCodeGenerator.cxx | 4 ++ Source/cmLocalGenerator.cxx | 13 ++++-- Source/cmLocalVisualStudio7Generator.cxx | 9 +--- Source/cmVisualStudio10TargetGenerator.cxx | 10 +---- Tests/Module/FindDependency/CMakeLists.txt | 4 +- Tests/Module/FindDependency/main.cpp | 12 ++++++ .../packages/Pack7/Pack7Config.cmake | 14 ++++++ .../packages/Pack8/Pack8Config.cmake | 7 +++ 9 files changed, 77 insertions(+), 46 deletions(-) create mode 100644 Tests/Module/FindDependency/packages/Pack7/Pack7Config.cmake create mode 100644 Tests/Module/FindDependency/packages/Pack8/Pack8Config.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Thu Apr 4 00:03:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 4 Apr 2019 00:03:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-577-g3d6d7c1 Message-ID: <20190404040304.EFECD11F063@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 3d6d7c170ca9ad291a0deedd125b8f9ce82d15bb (commit) from 6fdba8b8beb6d971a3c2efe8973cdee970dfd40a (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=3d6d7c170ca9ad291a0deedd125b8f9ce82d15bb commit 3d6d7c170ca9ad291a0deedd125b8f9ce82d15bb Author: Kitware Robot AuthorDate: Thu Apr 4 00:01:07 2019 -0400 Commit: Kitware Robot CommitDate: Thu Apr 4 00:01:07 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index f7c65f5..3ba392e 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 14) -set(CMake_VERSION_PATCH 20190403) +set(CMake_VERSION_PATCH 20190404) #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 Apr 4 11:33:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 4 Apr 2019 11:33:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-592-g0dfb056 Message-ID: <20190404153304.B25D61121F8@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 0dfb056cd3fa655ddf3cabb6b3ce0309b3037ca1 (commit) via 7795b3f2bfe3dbab35a494ceee37745eaff110f4 (commit) via dc6b76d1e751224c60aba5489fb62228cd8a6bad (commit) via d1c2f8787ceb0cb5e30d433e05f774bbdd910ef9 (commit) via a63a50c77af65092d82b9c3a6de3ea34c63605d4 (commit) via 8a2f62cc18ece0ebfed0ff6abf53d419d43d2fa1 (commit) via 18f7b2ed2111ff9dac5ef83d8bbf20b826b8bbe9 (commit) via 5fb122ff75f0fac2c421a6cba6c78a2123e3fd49 (commit) via b32e18fb88434d3f9d58447212ee33a51430c144 (commit) via 5431395d68a44d42149fb93692636f4138ddf6ed (commit) via 78eccc7836e068652ea772ec65614bc446f23b14 (commit) via 30bb14c65777bad02b3360797bf9c7b0fbe3280e (commit) via abbb8a7b1d40b98fb1841a76efb676eea7771cf0 (commit) via 11338389e5f89a58b18d63e29e21c099cfbf407e (commit) via 076118694995c19de7637156322818f3994de76a (commit) from 3d6d7c170ca9ad291a0deedd125b8f9ce82d15bb (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=0dfb056cd3fa655ddf3cabb6b3ce0309b3037ca1 commit 0dfb056cd3fa655ddf3cabb6b3ce0309b3037ca1 Merge: 7795b3f 0761186 Author: Brad King AuthorDate: Thu Apr 4 15:31:48 2019 +0000 Commit: Kitware Robot CommitDate: Thu Apr 4 11:32:41 2019 -0400 Merge topic 'pr.projectbefore' 0761186949 project: Add variable CMAKE_PROJECT_INCLUDE_BEFORE Acked-by: Kitware Robot Merge-request: !3175 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7795b3f2bfe3dbab35a494ceee37745eaff110f4 commit 7795b3f2bfe3dbab35a494ceee37745eaff110f4 Merge: dc6b76d 30bb14c Author: Brad King AuthorDate: Thu Apr 4 15:30:15 2019 +0000 Commit: Kitware Robot CommitDate: Thu Apr 4 11:30:54 2019 -0400 Merge topic 'modernize-raw-string-literal' 30bb14c657 Modernize: Enable modernize-raw-string-literal in clang-tidy Acked-by: Kitware Robot Merge-request: !3184 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dc6b76d1e751224c60aba5489fb62228cd8a6bad commit dc6b76d1e751224c60aba5489fb62228cd8a6bad Merge: d1c2f87 18f7b2e Author: Brad King AuthorDate: Thu Apr 4 15:29:22 2019 +0000 Commit: Kitware Robot CommitDate: Thu Apr 4 11:29:51 2019 -0400 Merge topic 'autogen_keywords_class' 18f7b2ed21 Autogen: Add more frequently used keywords to Keywords class 5fb122ff75 Autogen: Add `AUTO*_EXECUTABLE` strings to Keywords class b32e18fb88 Autogen: Remove static const generator name strings from cmQtAutoGen 5431395d68 Autogen: Add cmQtAutogenGlobalInitializer::Keywords class 78eccc7836 Autogen: Remove lowercase generator name from generator variables class Acked-by: Kitware Robot Merge-request: !3182 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d1c2f8787ceb0cb5e30d433e05f774bbdd910ef9 commit d1c2f8787ceb0cb5e30d433e05f774bbdd910ef9 Merge: a63a50c 8a2f62c Author: Brad King AuthorDate: Thu Apr 4 15:28:41 2019 +0000 Commit: Kitware Robot CommitDate: Thu Apr 4 11:28:49 2019 -0400 Merge topic 'FindPython-handle-virtual-env' 8a2f62cc18 FindPython*: Add capability to control virtual env handling. Acked-by: Kitware Robot Merge-request: !3173 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a63a50c77af65092d82b9c3a6de3ea34c63605d4 commit a63a50c77af65092d82b9c3a6de3ea34c63605d4 Merge: 3d6d7c1 abbb8a7 Author: Brad King AuthorDate: Thu Apr 4 15:27:18 2019 +0000 Commit: Kitware Robot CommitDate: Thu Apr 4 11:27:28 2019 -0400 Merge topic 'remove_duplicates' abbb8a7b1d Genex: Add $ 11338389e5 Help: Fix description in cmake-generator-expressions(7) manual Acked-by: Kitware Robot Merge-request: !3154 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8a2f62cc18ece0ebfed0ff6abf53d419d43d2fa1 commit 8a2f62cc18ece0ebfed0ff6abf53d419d43d2fa1 Author: Marc Chevrier AuthorDate: Mon Apr 1 11:19:54 2019 +0200 Commit: Marc Chevrier CommitDate: Wed Apr 3 09:16:17 2019 +0200 FindPython*: Add capability to control virtual env handling. Fixes: #19097 diff --git a/Help/release/dev/FindPython-virtual-env.rst b/Help/release/dev/FindPython-virtual-env.rst new file mode 100644 index 0000000..5489dc2 --- /dev/null +++ b/Help/release/dev/FindPython-virtual-env.rst @@ -0,0 +1,5 @@ +FindPython-virtual-env +---------------------- + +* Modules :module:`FindPython3`, :module:`FindPython2` and :module:`FindPython` + gain capability to control how virtual environments are handled. diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake index 1c134e2..c5074e8 100644 --- a/Modules/FindPython.cmake +++ b/Modules/FindPython.cmake @@ -145,18 +145,30 @@ Hints * ``NEVER``: Never try to use registry. ``CMAKE_FIND_FRAMEWORK`` - On OS X the :variable:`CMAKE_FIND_FRAMEWORK` variable determine the order of + On macOS the :variable:`CMAKE_FIND_FRAMEWORK` variable determine the order of preference between Apple-style and unix-style package components. .. note:: Value ``ONLY`` is not supported so ``FIRST`` will be used instead. -.. note:: +``Python_FIND_VIRTUALENV`` + This variable defines the handling of virtual environments. It is meaningfull + only when a virtual environment is active (i.e. the ``activate`` script has + been evaluated). In this case, it takes precedence over + ``Python_FIND_REGISTRY`` and ``CMAKE_FIND_FRAMEWORK`` variables. + The ``Python_FIND_VIRTUALENV`` variable can be set to empty or one of the + following: - If a Python virtual environment is configured, set variable - ``Python_FIND_REGISTRY`` (Windows) or ``CMAKE_FIND_FRAMEWORK`` (macOS) with - value ``LAST`` or ``NEVER`` to select it preferably. + * ``FIRST``: The virtual environment is used before any other standard + paths to look-up for the interpreter. This is the default. + * ``ONLY``: Only the virtual environment is used to look-up for the + interpreter. + * ``STANDARD``: The virtual environment is not used to look-up for the + interpreter. In this case, variable ``Python_FIND_REGISTRY`` (Windows) + or ``CMAKE_FIND_FRAMEWORK`` (macOS) can be set with value ``LAST`` or + ``NEVER`` to select preferably the interpreter from the virtual + environment. Commands ^^^^^^^^ diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake index 1236bf8..0868989 100644 --- a/Modules/FindPython/Support.cmake +++ b/Modules/FindPython/Support.cmake @@ -298,6 +298,22 @@ else() set (_${_PYTHON_PREFIX}_FIND_REGISTRY "FIRST") endif() +# virtual environments handling +if (DEFINED ENV{VIRTUAL_ENV}) + if (DEFINED ${_PYTHON_PREFIX}_FIND_VIRTUALENV) + if (NOT ${_PYTHON_PREFIX}_FIND_VIRTUALENV MATCHES "^(FIRST|ONLY|STANDARD)$") + message (AUTHOR_WARNING "Find${_PYTHON_PREFIX}: ${${_PYTHON_PREFIX}_FIND_VIRTUALENV}: invalid value for '${_PYTHON_PREFIX}_FIND_VIRTUALENV'. 'FIRST', 'ONLY' or 'IGNORE' expected.") + set (_${_PYTHON_PREFIX}_FIND_VIRTUALENV "FIRST") + else() + set (_${_PYTHON_PREFIX}_FIND_VIRTUALENV ${${_PYTHON_PREFIX}_FIND_VIRTUALENV}) + endif() + else() + set (_${_PYTHON_PREFIX}_FIND_VIRTUALENV FIRST) + endif() +else() + set (_${_PYTHON_PREFIX}_FIND_VIRTUALENV STANDARD) +endif() + unset (_${_PYTHON_PREFIX}_REQUIRED_VARS) unset (_${_PYTHON_PREFIX}_CACHED_VARS) @@ -318,6 +334,30 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) _python_get_frameworks (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS ${_${_PYTHON_PREFIX}_VERSION}) + # Virtual environments handling + if (_${_PYTHON_PREFIX}_FIND_VIRTUALENV MATCHES "^(FIRST|ONLY)$") + find_program (${_PYTHON_PREFIX}_EXECUTABLE + NAMES python${_${_PYTHON_PREFIX}_VERSION} + python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR} + python + NAMES_PER_DIR + HINTS ${_${_PYTHON_PREFIX}_HINTS} + PATHS ENV VIRTUAL_ENV + PATH_SUFFIXES bin Scripts + NO_CMAKE_PATH + NO_CMAKE_ENVIRONMENT_PATH + NO_SYSTEM_ENVIRONMENT_PATH + NO_CMAKE_SYSTEM_PATH) + + _python_validate_interpreter (${_${_PYTHON_PREFIX}_VERSION}) + if (${_PYTHON_PREFIX}_EXECUTABLE) + break() + endif() + if (_${_PYTHON_PREFIX}_FIND_VIRTUALENV STREQUAL "ONLY") + continue() + endif() + endif() + # Apple frameworks handling if (APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "FIRST") find_program (${_PYTHON_PREFIX}_EXECUTABLE @@ -423,7 +463,8 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) endif() endforeach() - if (NOT ${_PYTHON_PREFIX}_EXECUTABLE) + if (NOT ${_PYTHON_PREFIX}_EXECUTABLE AND + NOT _${_PYTHON_PREFIX}_FIND_VIRTUALENV STREQUAL "ONLY") # No specific version found. Retry with generic names # try using HINTS find_program (${_PYTHON_PREFIX}_EXECUTABLE @@ -685,18 +726,32 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS # if python interpreter is found, use its location and version to ensure consistency # between interpreter and development environment unset (_${_PYTHON_PREFIX}_PREFIX) + unset (_${_PYTHON_PREFIX}_EXEC_PREFIX) + unset (_${_PYTHON_PREFIX}_BASE_EXEC_PREFIX) if (${_PYTHON_PREFIX}_Interpreter_FOUND) execute_process (COMMAND "${${_PYTHON_PREFIX}_EXECUTABLE}" -c - "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.PREFIX)" + "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.EXEC_PREFIX)" RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT - OUTPUT_VARIABLE _${_PYTHON_PREFIX}_PREFIX + OUTPUT_VARIABLE _${_PYTHON_PREFIX}_EXEC_PREFIX ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) if (_${_PYTHON_PREFIX}_RESULT) - unset (_${_PYTHON_PREFIX}_PREFIX) + unset (_${_PYTHON_PREFIX}_EXEC_PREFIX) + endif() + + if (NOT ${_PYTHON_PREFIX}_FIND_VIRTUALENV STREQUAL "STANDARD") + execute_process (COMMAND "${${_PYTHON_PREFIX}_EXECUTABLE}" -c + "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.BASE_EXEC_PREFIX)" + RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT + OUTPUT_VARIABLE _${_PYTHON_PREFIX}_BASE_EXEC_PREFIX + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (_${_PYTHON_PREFIX}_RESULT) + unset (_${_PYTHON_PREFIX}_BASE_EXEC_PREFIX) + endif() endif() endif() - set (_${_PYTHON_PREFIX}_HINTS "${_${_PYTHON_PREFIX}_PREFIX}" "${${_PYTHON_PREFIX}_ROOT_DIR}" ENV ${_PYTHON_PREFIX}_ROOT_DIR) + set (_${_PYTHON_PREFIX}_HINTS "${_${_PYTHON_PREFIX}_EXEC_PREFIX}" "${_${_PYTHON_PREFIX}_BASE_EXEC_PREFIX}" "${${_PYTHON_PREFIX}_ROOT_DIR}" ENV ${_PYTHON_PREFIX}_ROOT_DIR) foreach (_${_PYTHON_PREFIX}_VERSION IN LISTS _${_PYTHON_PREFIX}_FIND_VERSIONS) string (REPLACE "." "" _${_PYTHON_PREFIX}_VERSION_NO_DOTS ${_${_PYTHON_PREFIX}_VERSION}) diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake index b9c0b6b..a2be84f 100644 --- a/Modules/FindPython2.cmake +++ b/Modules/FindPython2.cmake @@ -153,11 +153,23 @@ Hints Value ``ONLY`` is not supported so ``FIRST`` will be used instead. -.. note:: +``Python2_FIND_VIRTUALENV`` + This variable defines the handling of virtual environments. It is meaningfull + only when a virtual environment is active (i.e. the ``activate`` script has + been evaluated). In this case, it takes precedence over + ``Python2_FIND_REGISTRY`` and ``CMAKE_FIND_FRAMEWORK`` variables. + The ``Python2_FIND_VIRTUALENV`` variable can be set to empty or one of the + following: - If a Python virtual environment is configured, set variable - ``Python_FIND_REGISTRY`` (Windows) or ``CMAKE_FIND_FRAMEWORK`` (macOS) with - value ``LAST`` or ``NEVER`` to select it preferably. + * ``FIRST``: The virtual environment is used before any other standard + paths to look-up for the interpreter. This is the default. + * ``ONLY``: Only the virtual environment is used to look-up for the + interpreter. + * ``STANDARD``: The virtual environment is not used to look-up for the + interpreter. In this case, variable ``Python2_FIND_REGISTRY`` (Windows) + or ``CMAKE_FIND_FRAMEWORK`` (macOS) can be set with value ``LAST`` or + ``NEVER`` to select preferably the interpreter from the virtual + environment. Commands ^^^^^^^^ diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake index c2f3384..3409554 100644 --- a/Modules/FindPython3.cmake +++ b/Modules/FindPython3.cmake @@ -137,7 +137,7 @@ Hints ``Python3_FIND_REGISTRY`` On Windows the ``Python3_FIND_REGISTRY`` variable determine the order of preference between registry and environment variables. - the ``Python3_FIND_REGISTRY`` variable can be set to empty or one of the + The ``Python3_FIND_REGISTRY`` variable can be set to empty or one of the following: * ``FIRST``: Try to use registry before environment variables. @@ -146,18 +146,30 @@ Hints * ``NEVER``: Never try to use registry. ``CMAKE_FIND_FRAMEWORK`` - On OS X the :variable:`CMAKE_FIND_FRAMEWORK` variable determine the order of + On macOS the :variable:`CMAKE_FIND_FRAMEWORK` variable determine the order of preference between Apple-style and unix-style package components. .. note:: Value ``ONLY`` is not supported so ``FIRST`` will be used instead. -.. note:: +``Python3_FIND_VIRTUALENV`` + This variable defines the handling of virtual environments. It is meaningfull + only when a virtual environment is active (i.e. the ``activate`` script has + been evaluated). In this case, it takes precedence over + ``Python3_FIND_REGISTRY`` and ``CMAKE_FIND_FRAMEWORK`` variables. + The ``Python3_FIND_VIRTUALENV`` variable can be set to empty or one of the + following: - If a Python virtual environment is configured, set variable - ``Python_FIND_REGISTRY`` (Windows) or ``CMAKE_FIND_FRAMEWORK`` (macOS) with - value ``LAST`` or ``NEVER`` to select it preferably. + * ``FIRST``: The virtual environment is used before any other standard + paths to look-up for the interpreter. This is the default. + * ``ONLY``: Only the virtual environment is used to look-up for the + interpreter. + * ``STANDARD``: The virtual environment is not used to look-up for the + interpreter. In this case, variable ``Python3_FIND_REGISTRY`` (Windows) + or ``CMAKE_FIND_FRAMEWORK`` (macOS) can be set with value ``LAST`` or + ``NEVER`` to select preferably the interpreter from the virtual + environment. Commands ^^^^^^^^ diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt index 38211a4..d6f50e7 100644 --- a/Tests/FindPython/CMakeLists.txt +++ b/Tests/FindPython/CMakeLists.txt @@ -68,6 +68,17 @@ if(CMake_TEST_FindPython) --build-options ${build_options} --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) + + add_test(NAME FindPython.VirtualEnv COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/VirtualEnv" + "${CMake_BINARY_DIR}/Tests/FindPython/VirtualEnv" + ${build_generator_args} + --build-project TestVirtualEnv + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) endif() if(CMake_TEST_FindPython_NumPy) diff --git a/Tests/FindPython/VirtualEnv/CMakeLists.txt b/Tests/FindPython/VirtualEnv/CMakeLists.txt new file mode 100644 index 0000000..64ba201 --- /dev/null +++ b/Tests/FindPython/VirtualEnv/CMakeLists.txt @@ -0,0 +1,42 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestVirtualEnv LANGUAGES NONE) + +include(CTest) + +find_package(Python3 REQUIRED COMPONENTS Interpreter) +if (NOT Python3_FOUND) + message (FATAL_ERROR "Fail to found Python 3") +endif() + +set (Python3_VIRTUAL_ENV "${CMAKE_CURRENT_BINARY_DIR}/py3venv") + +execute_process (COMMAND "${Python3_EXECUTABLE}" -m venv "${Python3_VIRTUAL_ENV}" + RESULT_VARIABLE result + OUTPUT_VARIABLE outputs + ERROR_VARIABLE outputs) +if (result) + message (FATAL_ERROR "Fail to create virtual environment: ${outputs}") +endif() + +add_test(NAME FindPython3.VirtualEnvDefault + COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME + "VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" + "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" + -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvDefault.cmake") + +add_test(NAME FindPython3.VirtualEnvOnly + COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME + "VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" + "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" + -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake") +add_test(NAME FindPython3.UnsetVirtualEnvOnly + COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME + --unset=VIRTUAL_ENV + "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake") + +add_test(NAME FindPython3.VirtualEnvStandard + COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME + "VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" + "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" + -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvStandard.cmake") diff --git a/Tests/FindPython/VirtualEnv/VirtualEnvDefault.cmake b/Tests/FindPython/VirtualEnv/VirtualEnvDefault.cmake new file mode 100644 index 0000000..020ecac --- /dev/null +++ b/Tests/FindPython/VirtualEnv/VirtualEnvDefault.cmake @@ -0,0 +1,6 @@ + +find_package (Python3 REQUIRED) + +if (NOT Python3_EXECUTABLE MATCHES "^${PYTHON3_VIRTUAL_ENV}/.+") + message (FATAL_ERROR "Fail to use virtual environment") +endif() diff --git a/Tests/FindPython/VirtualEnv/VirtualEnvOnly.cmake b/Tests/FindPython/VirtualEnv/VirtualEnvOnly.cmake new file mode 100644 index 0000000..29a4924 --- /dev/null +++ b/Tests/FindPython/VirtualEnv/VirtualEnvOnly.cmake @@ -0,0 +1,16 @@ + +# +# Virtual environment is defined for python3 +# Trying to find a python2 using only virtual environment +# It is expecting to fail if a virtual environment is active and to success otherwise. +# +set (Python2_FIND_VIRTUALENV ONLY) +find_package (Python2 QUIET) + +if (PYTHON3_VIRTUAL_ENV AND Python2_FOUND) + message (FATAL_ERROR "Python2 unexpectedly found.") +endif() + +if (NOT PYTHON3_VIRTUAL_ENV AND NOT Python2_FOUND) + message (FATAL_ERROR "Fail to find Python2.") +endif() diff --git a/Tests/FindPython/VirtualEnv/VirtualEnvStandard.cmake b/Tests/FindPython/VirtualEnv/VirtualEnvStandard.cmake new file mode 100644 index 0000000..89f27d8 --- /dev/null +++ b/Tests/FindPython/VirtualEnv/VirtualEnvStandard.cmake @@ -0,0 +1,7 @@ + +set (Python3_FIND_VIRTUALENV STANDARD) +find_package (Python3 REQUIRED) + +if (Python3_EXECUTABLE MATCHES "^${PYTHON3_VIRTUAL_ENV}/.+") + message (FATAL_ERROR "Python3 virtual env unexpectedly found.") +endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=18f7b2ed2111ff9dac5ef83d8bbf20b826b8bbe9 commit 18f7b2ed2111ff9dac5ef83d8bbf20b826b8bbe9 Author: Sebastian Holtermann AuthorDate: Tue Apr 2 19:22:35 2019 +0200 Commit: Sebastian Holtermann CommitDate: Tue Apr 2 20:12:52 2019 +0200 Autogen: Add more frequently used keywords to Keywords class diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index 45a21f5..59e17d7 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -27,6 +27,14 @@ cmQtAutoGenGlobalInitializer::Keywords::Keywords() , AUTOMOC_EXECUTABLE("AUTOMOC_EXECUTABLE") , AUTOUIC_EXECUTABLE("AUTOUIC_EXECUTABLE") , AUTORCC_EXECUTABLE("AUTORCC_EXECUTABLE") + , SKIP_AUTOGEN("SKIP_AUTOGEN") + , SKIP_AUTOMOC("SKIP_AUTOMOC") + , SKIP_AUTOUIC("SKIP_AUTOUIC") + , SKIP_AUTORCC("SKIP_AUTORCC") + , AUTOUIC_OPTIONS("AUTOUIC_OPTIONS") + , AUTORCC_OPTIONS("AUTORCC_OPTIONS") + , qrc("qrc") + , ui("ui") { } diff --git a/Source/cmQtAutoGenGlobalInitializer.h b/Source/cmQtAutoGenGlobalInitializer.h index abff589..77429b7 100644 --- a/Source/cmQtAutoGenGlobalInitializer.h +++ b/Source/cmQtAutoGenGlobalInitializer.h @@ -31,6 +31,17 @@ public: std::string AUTOMOC_EXECUTABLE; std::string AUTOUIC_EXECUTABLE; std::string AUTORCC_EXECUTABLE; + + std::string SKIP_AUTOGEN; + std::string SKIP_AUTOMOC; + std::string SKIP_AUTOUIC; + std::string SKIP_AUTORCC; + + std::string AUTOUIC_OPTIONS; + std::string AUTORCC_OPTIONS; + + std::string qrc; + std::string ui; }; public: diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index ef8fe73..d80aaa2 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -606,28 +606,19 @@ bool cmQtAutoGenInitializer::InitRcc() bool cmQtAutoGenInitializer::InitScanFiles() { cmMakefile* makefile = this->Target->Target->GetMakefile(); + auto const& kw = this->GlobalInitializer->kw(); - // String constants - std::string const SKIP_AUTOGEN_str = "SKIP_AUTOGEN"; - std::string const SKIP_AUTOMOC_str = "SKIP_AUTOMOC"; - std::string const SKIP_AUTOUIC_str = "SKIP_AUTOUIC"; - std::string const SKIP_AUTORCC_str = "SKIP_AUTORCC"; - std::string const AUTOUIC_OPTIONS_str = "AUTOUIC_OPTIONS"; - std::string const AUTORCC_OPTIONS_str = "AUTORCC_OPTIONS"; - std::string const qrc_str = "qrc"; - std::string const ui_str = "ui"; - - auto makeMUFile = [&](cmSourceFile* sf, std::string const& fullPath, - bool muIt) -> MUFileHandle { + auto makeMUFile = [this, &kw](cmSourceFile* sf, std::string const& fullPath, + bool muIt) -> MUFileHandle { MUFileHandle muf = cm::make_unique(); muf->RealPath = cmSystemTools::GetRealPath(fullPath); muf->SF = sf; muf->Generated = sf->GetIsGenerated(); - bool const skipAutogen = sf->GetPropertyAsBool(SKIP_AUTOGEN_str); + bool const skipAutogen = sf->GetPropertyAsBool(kw.SKIP_AUTOGEN); muf->SkipMoc = this->Moc.Enabled && - (skipAutogen || sf->GetPropertyAsBool(SKIP_AUTOMOC_str)); + (skipAutogen || sf->GetPropertyAsBool(kw.SKIP_AUTOMOC)); muf->SkipUic = this->Uic.Enabled && - (skipAutogen || sf->GetPropertyAsBool(SKIP_AUTOUIC_str)); + (skipAutogen || sf->GetPropertyAsBool(kw.SKIP_AUTOUIC)); if (muIt) { muf->MocIt = this->Moc.Enabled && !muf->SkipMoc; muf->UicIt = this->Uic.Enabled && !muf->SkipUic; @@ -678,8 +669,8 @@ bool cmQtAutoGenInitializer::InitScanFiles() // Register rcc enabled files if (this->Rcc.Enabled) { - if ((ext == qrc_str) && !sf->GetPropertyAsBool(SKIP_AUTOGEN_str) && - !sf->GetPropertyAsBool(SKIP_AUTORCC_str)) { + if ((ext == kw.qrc) && !sf->GetPropertyAsBool(kw.SKIP_AUTOGEN) && + !sf->GetPropertyAsBool(kw.SKIP_AUTORCC)) { // Register qrc file Qrc qrc; qrc.QrcFile = cmSystemTools::GetRealPath(fullPath); @@ -688,7 +679,7 @@ bool cmQtAutoGenInitializer::InitScanFiles() qrc.Generated = sf->GetIsGenerated(); // RCC options { - std::string const opts = sf->GetSafeProperty(AUTORCC_OPTIONS_str); + std::string const opts = sf->GetSafeProperty(kw.AUTORCC_OPTIONS); if (!opts.empty()) { cmSystemTools::ExpandListArgument(opts, qrc.Options); } @@ -798,15 +789,15 @@ bool cmQtAutoGenInitializer::InitScanFiles() this->AutogenTarget.Sources.emplace(sf, std::move(muf)); } } - } else if (this->Uic.Enabled && (ext == ui_str)) { + } else if (this->Uic.Enabled && (ext == kw.ui)) { // .ui file std::string realPath = cmSystemTools::GetRealPath(fullPath); - bool const skipAutogen = sf->GetPropertyAsBool(SKIP_AUTOGEN_str); + bool const skipAutogen = sf->GetPropertyAsBool(kw.SKIP_AUTOGEN); bool const skipUic = - (skipAutogen || sf->GetPropertyAsBool(SKIP_AUTOUIC_str)); + (skipAutogen || sf->GetPropertyAsBool(kw.SKIP_AUTOUIC)); if (!skipUic) { // Check if the .ui file has uic options - std::string const uicOpts = sf->GetSafeProperty(AUTOUIC_OPTIONS_str); + std::string const uicOpts = sf->GetSafeProperty(kw.AUTOUIC_OPTIONS); if (!uicOpts.empty()) { this->Uic.FileFiles.push_back(std::move(realPath)); std::vector optsVec; @@ -834,11 +825,11 @@ bool cmQtAutoGenInitializer::InitScanFiles() msg += '\n'; std::string property; if (this->Moc.Enabled && this->Uic.Enabled) { - property = "SKIP_AUTOGEN"; + property = kw.SKIP_AUTOGEN; } else if (this->Moc.Enabled) { - property = "SKIP_AUTOMOC"; + property = kw.SKIP_AUTOMOC; } else if (this->Uic.Enabled) { - property = "SKIP_AUTOUIC"; + property = kw.SKIP_AUTOUIC; } msg += "For compatibility, CMake is excluding the GENERATED source " "file(s):\n"; @@ -866,7 +857,7 @@ bool cmQtAutoGenInitializer::InitScanFiles() // Target rcc options std::vector optionsTarget; cmSystemTools::ExpandListArgument( - this->Target->GetSafeProperty("AUTORCC_OPTIONS"), optionsTarget); + this->Target->GetSafeProperty(kw.AUTORCC_OPTIONS), optionsTarget); // Check if file name is unique for (Qrc& qrc : this->Rcc.Qrcs) { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5fb122ff75f0fac2c421a6cba6c78a2123e3fd49 commit 5fb122ff75f0fac2c421a6cba6c78a2123e3fd49 Author: Sebastian Holtermann AuthorDate: Tue Apr 2 19:14:27 2019 +0200 Commit: Sebastian Holtermann CommitDate: Tue Apr 2 20:12:52 2019 +0200 Autogen: Add `AUTO*_EXECUTABLE` strings to Keywords class diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index ab51570..45a21f5 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -24,6 +24,9 @@ cmQtAutoGenGlobalInitializer::Keywords::Keywords() : AUTOMOC("AUTOMOC") , AUTOUIC("AUTOUIC") , AUTORCC("AUTORCC") + , AUTOMOC_EXECUTABLE("AUTOMOC_EXECUTABLE") + , AUTOUIC_EXECUTABLE("AUTOUIC_EXECUTABLE") + , AUTORCC_EXECUTABLE("AUTORCC_EXECUTABLE") { } @@ -86,11 +89,11 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( bool const rcc = target->GetPropertyAsBool(kw().AUTORCC); if (moc || uic || rcc) { std::string const mocExec = - target->GetSafeProperty("AUTOMOC_EXECUTABLE"); + target->GetSafeProperty(kw().AUTOMOC_EXECUTABLE); std::string const uicExec = - target->GetSafeProperty("AUTOUIC_EXECUTABLE"); + target->GetSafeProperty(kw().AUTOUIC_EXECUTABLE); std::string const rccExec = - target->GetSafeProperty("AUTORCC_EXECUTABLE"); + target->GetSafeProperty(kw().AUTORCC_EXECUTABLE); // We support Qt4, Qt5 and Qt6 auto qtVersion = cmQtAutoGenInitializer::GetQtVersion(target); diff --git a/Source/cmQtAutoGenGlobalInitializer.h b/Source/cmQtAutoGenGlobalInitializer.h index 76ed76b..abff589 100644 --- a/Source/cmQtAutoGenGlobalInitializer.h +++ b/Source/cmQtAutoGenGlobalInitializer.h @@ -27,6 +27,10 @@ public: std::string AUTOMOC; std::string AUTOUIC; std::string AUTORCC; + + std::string AUTOMOC_EXECUTABLE; + std::string AUTOUIC_EXECUTABLE; + std::string AUTORCC_EXECUTABLE; }; public: https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b32e18fb88434d3f9d58447212ee33a51430c144 commit b32e18fb88434d3f9d58447212ee33a51430c144 Author: Sebastian Holtermann AuthorDate: Tue Apr 2 19:11:19 2019 +0200 Commit: Sebastian Holtermann CommitDate: Tue Apr 2 20:12:43 2019 +0200 Autogen: Remove static const generator name strings from cmQtAutoGen diff --git a/Source/cmQtAutoGen.cxx b/Source/cmQtAutoGen.cxx index 87ef112..d71d82f 100644 --- a/Source/cmQtAutoGen.cxx +++ b/Source/cmQtAutoGen.cxx @@ -73,44 +73,44 @@ void MergeOptions(std::vector& baseOpts, unsigned int const cmQtAutoGen::ParallelMax = 64; std::string const cmQtAutoGen::ListSep = "<<>>"; -std::string const cmQtAutoGen::GenAutoGen = "AutoGen"; -std::string const cmQtAutoGen::GenAutoMoc = "AutoMoc"; -std::string const cmQtAutoGen::GenAutoUic = "AutoUic"; -std::string const cmQtAutoGen::GenAutoRcc = "AutoRcc"; - -std::string const cmQtAutoGen::GenAUTOGEN = "AUTOGEN"; -std::string const cmQtAutoGen::GenAUTOMOC = "AUTOMOC"; -std::string const cmQtAutoGen::GenAUTOUIC = "AUTOUIC"; -std::string const cmQtAutoGen::GenAUTORCC = "AUTORCC"; - std::string const& cmQtAutoGen::GeneratorName(GenT genType) { + static const std::string AutoGen("AutoGen"); + static const std::string AutoMoc("AutoMoc"); + static const std::string AutoUic("AutoUic"); + static const std::string AutoRcc("AutoRcc"); + switch (genType) { case GenT::GEN: - return GenAutoGen; + return AutoGen; case GenT::MOC: - return GenAutoMoc; + return AutoMoc; case GenT::UIC: - return GenAutoUic; + return AutoUic; case GenT::RCC: - return GenAutoRcc; + return AutoRcc; } - return GenAutoGen; + return AutoGen; } std::string const& cmQtAutoGen::GeneratorNameUpper(GenT genType) { + static const std::string AUTOGEN("AUTOGEN"); + static const std::string AUTOMOC("AUTOMOC"); + static const std::string AUTOUIC("AUTOUIC"); + static const std::string AUTORCC("AUTORCC"); + switch (genType) { case GenT::GEN: - return GenAUTOGEN; + return AUTOGEN; case GenT::MOC: - return GenAUTOMOC; + return AUTOMOC; case GenT::UIC: - return GenAUTOUIC; + return AUTOUIC; case GenT::RCC: - return GenAUTORCC; + return AUTORCC; } - return GenAUTOGEN; + return AUTOGEN; } std::string cmQtAutoGen::Tools(bool moc, bool uic, bool rcc) @@ -118,13 +118,13 @@ std::string cmQtAutoGen::Tools(bool moc, bool uic, bool rcc) std::string res; std::vector lst; if (moc) { - lst.emplace_back(GenAUTOMOC); + lst.emplace_back("AUTOMOC"); } if (uic) { - lst.emplace_back(GenAUTOUIC); + lst.emplace_back("AUTOUIC"); } if (rcc) { - lst.emplace_back(GenAUTORCC); + lst.emplace_back("AUTORCC"); } switch (lst.size()) { case 1: diff --git a/Source/cmQtAutoGen.h b/Source/cmQtAutoGen.h index 6cc8df1..d127a71 100644 --- a/Source/cmQtAutoGen.h +++ b/Source/cmQtAutoGen.h @@ -51,15 +51,6 @@ public: /// @brief Nested lists separator static std::string const ListSep; - // Generator names - static std::string const GenAutoGen; - static std::string const GenAutoMoc; - static std::string const GenAutoUic; - static std::string const GenAutoRcc; - static std::string const GenAUTOGEN; - static std::string const GenAUTOMOC; - static std::string const GenAUTOUIC; - static std::string const GenAUTORCC; /// @brief Maximum number of parallel threads/processes in a generator static unsigned int const ParallelMax; diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index 994cfc8..ab51570 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -81,9 +81,9 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( continue; } - bool const moc = target->GetPropertyAsBool(cmQtAutoGen::GenAUTOMOC); - bool const uic = target->GetPropertyAsBool(cmQtAutoGen::GenAUTOUIC); - bool const rcc = target->GetPropertyAsBool(cmQtAutoGen::GenAUTORCC); + bool const moc = target->GetPropertyAsBool(kw().AUTOMOC); + bool const uic = target->GetPropertyAsBool(kw().AUTOUIC); + bool const rcc = target->GetPropertyAsBool(kw().AUTORCC); if (moc || uic || rcc) { std::string const mocExec = target->GetSafeProperty("AUTOMOC_EXECUTABLE"); diff --git a/Source/cmQtAutoGenGlobalInitializer.h b/Source/cmQtAutoGenGlobalInitializer.h index 6cddf16..76ed76b 100644 --- a/Source/cmQtAutoGenGlobalInitializer.h +++ b/Source/cmQtAutoGenGlobalInitializer.h @@ -34,7 +34,7 @@ public: std::vector const& localGenerators); ~cmQtAutoGenGlobalInitializer(); - Keywords const* kw() const { return Keywords_.get(); }; + Keywords const& kw() const { return Keywords_; }; bool generate(); @@ -62,7 +62,7 @@ private: std::map GlobalAutoGenTargets_; std::map GlobalAutoRccTargets_; std::unordered_map ExecutableTestOutputs_; - std::unique_ptr Keywords_; + Keywords const Keywords_; }; #endif https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5431395d68a44d42149fb93692636f4138ddf6ed commit 5431395d68a44d42149fb93692636f4138ddf6ed Author: Sebastian Holtermann AuthorDate: Tue Apr 2 18:53:34 2019 +0200 Commit: Sebastian Holtermann CommitDate: Tue Apr 2 20:11:50 2019 +0200 Autogen: Add cmQtAutogenGlobalInitializer::Keywords class The new `cmQtAutogenGlobalInitializer::Keywords` class instance is bound to the lifetime of the `cmQtAutogenGlobalInitializer` instance. Global static const strings would be allocated at program start and deallocated at program end. Keeping keyword strings alive only in the context where they're needed helps to reduce the memory footprint. diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index 7bd0e52..994cfc8 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -20,6 +20,13 @@ #include #include +cmQtAutoGenGlobalInitializer::Keywords::Keywords() + : AUTOMOC("AUTOMOC") + , AUTOUIC("AUTOUIC") + , AUTORCC("AUTORCC") +{ +} + cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( std::vector const& localGenerators) { diff --git a/Source/cmQtAutoGenGlobalInitializer.h b/Source/cmQtAutoGenGlobalInitializer.h index 74184a0..6cddf16 100644 --- a/Source/cmQtAutoGenGlobalInitializer.h +++ b/Source/cmQtAutoGenGlobalInitializer.h @@ -18,10 +18,24 @@ class cmQtAutoGenInitializer; class cmQtAutoGenGlobalInitializer { public: + /// @brief Collection of QtAutogen related keywords + class Keywords + { + public: + Keywords(); + + std::string AUTOMOC; + std::string AUTOUIC; + std::string AUTORCC; + }; + +public: cmQtAutoGenGlobalInitializer( std::vector const& localGenerators); ~cmQtAutoGenGlobalInitializer(); + Keywords const* kw() const { return Keywords_.get(); }; + bool generate(); private: @@ -48,6 +62,7 @@ private: std::map GlobalAutoGenTargets_; std::map GlobalAutoRccTargets_; std::unordered_map ExecutableTestOutputs_; + std::unique_ptr Keywords_; }; #endif https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=78eccc7836e068652ea772ec65614bc446f23b14 commit 78eccc7836e068652ea772ec65614bc446f23b14 Author: Sebastian Holtermann AuthorDate: Tue Apr 2 18:58:58 2019 +0200 Commit: Sebastian Holtermann CommitDate: Tue Apr 2 20:11:29 2019 +0200 Autogen: Remove lowercase generator name from generator variables class The lowercase `Auto*` generator name in `cmQtAutoGenInitializer::GenVarsT` is never user. Remove it from the class. diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index 1f4087f..e7e5db2 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -62,7 +62,6 @@ public: bool Enabled = false; // Generator type/name GenT Gen; - std::string const& GenName; std::string const& GenNameUpper; // Executable std::string ExecutableTargetName; @@ -71,11 +70,9 @@ public: bool ExecutableExists = false; /// @brief Constructor - GenVarsT(GenT gen, std::string const& genName, - std::string const& genNameUpper) + GenVarsT(GenT gen) : Gen(gen) - , GenName(genName) - , GenNameUpper(genNameUpper){}; + , GenNameUpper(cmQtAutoGen::GeneratorNameUpper(gen)){}; }; /// @brief Writes a CMake info file @@ -213,8 +210,7 @@ private: /// @brief Constructor MocT() - : GenVarsT(cmQtAutoGen::GenT::MOC, cmQtAutoGen::GenAutoMoc, - cmQtAutoGen::GenAUTOMOC){}; + : GenVarsT(GenT::MOC){}; } Moc; /// @brief Uic only variables @@ -229,8 +225,7 @@ private: /// @brief Constructor UicT() - : GenVarsT(cmQtAutoGen::GenT::UIC, cmQtAutoGen::GenAutoUic, - cmQtAutoGen::GenAUTOUIC){}; + : GenVarsT(GenT::UIC){}; } Uic; /// @brief Rcc only variables @@ -242,8 +237,7 @@ private: /// @brief Constructor RccT() - : GenVarsT(cmQtAutoGen::GenT::RCC, cmQtAutoGen::GenAutoRcc, - cmQtAutoGen::GenAUTORCC){}; + : GenVarsT(GenT::RCC){}; } Rcc; }; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=30bb14c65777bad02b3360797bf9c7b0fbe3280e commit 30bb14c65777bad02b3360797bf9c7b0fbe3280e Author: Artur Ryt AuthorDate: Tue Apr 2 19:59:00 2019 +0200 Commit: Artur Ryt CommitDate: Tue Apr 2 19:59:54 2019 +0200 Modernize: Enable modernize-raw-string-literal in clang-tidy diff --git a/.clang-tidy b/.clang-tidy index 520b1a9..b87ca4b 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -11,7 +11,6 @@ misc-*,\ -misc-static-assert,\ modernize-*,\ -modernize-deprecated-headers,\ --modernize-raw-string-literal,\ -modernize-return-braced-init-list,\ -modernize-use-auto,\ -modernize-use-noexcept,\ diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 6afd7d5..e2020c5 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -182,7 +182,7 @@ int cmCPackNSISGenerator::PackageFiles() this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC", ""); this->SetOptionIfNotSet("CPACK_NSIS_PAGE_COMPONENTS", ""); this->SetOptionIfNotSet("CPACK_NSIS_FULL_INSTALL", - "File /r \"${INST_DIR}\\*.*\""); + R"(File /r "${INST_DIR}\*.*")"); this->SetOptionIfNotSet("CPACK_NSIS_COMPONENT_SECTIONS", ""); this->SetOptionIfNotSet("CPACK_NSIS_COMPONENT_SECTION_LIST", ""); this->SetOptionIfNotSet("CPACK_NSIS_SECTION_SELECTED_VARS", ""); @@ -242,7 +242,7 @@ int cmCPackNSISGenerator::PackageFiles() } // Add this component to the various section lists. - sectionList += " !insertmacro \"${MacroName}\" \""; + sectionList += R"( !insertmacro "${MacroName}" ")"; sectionList += comp.first; sectionList += "\"\n"; selectedVarsList += "Var " + comp.first + "_selected\n"; @@ -494,10 +494,10 @@ int cmCPackNSISGenerator::InitializeInternal() std::string execName = *it; ++it; std::string linkName = *it; - str << " CreateShortCut \"$SMPROGRAMS\\$STARTMENU_FOLDER\\" << linkName - << ".lnk\" \"$INSTDIR\\" << cpackNsisExecutablesDirectory << "\\" + str << R"( CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\)" << linkName + << R"(.lnk" "$INSTDIR\)" << cpackNsisExecutablesDirectory << "\\" << execName << ".exe\"" << std::endl; - deleteStr << " Delete \"$SMPROGRAMS\\$MUI_TEMP\\" << linkName + deleteStr << R"( Delete "$SMPROGRAMS\$MUI_TEMP\)" << linkName << ".lnk\"" << std::endl; // see if CPACK_CREATE_DESKTOP_LINK_ExeName is on // if so add a desktop link @@ -507,7 +507,7 @@ int cmCPackNSISGenerator::InitializeInternal() execName) != cpackPackageDesktopLinksVector.end()) { str << " StrCmp \"$INSTALL_DESKTOP\" \"1\" 0 +2\n"; str << " CreateShortCut \"$DESKTOP\\" << linkName - << ".lnk\" \"$INSTDIR\\" << cpackNsisExecutablesDirectory << "\\" + << R"(.lnk" "$INSTDIR\)" << cpackNsisExecutablesDirectory << "\\" << execName << ".exe\"" << std::endl; deleteStr << " StrCmp \"$INSTALL_DESKTOP\" \"1\" 0 +2\n"; deleteStr << " Delete \"$DESKTOP\\" << linkName << ".lnk\"" @@ -563,15 +563,15 @@ void cmCPackNSISGenerator::CreateMenuLinks(std::ostream& str, ++it; std::string linkName = *it; if (!url) { - str << " CreateShortCut \"$SMPROGRAMS\\$STARTMENU_FOLDER\\" << linkName - << ".lnk\" \"$INSTDIR\\" << sourceName << "\"" << std::endl; - deleteStr << " Delete \"$SMPROGRAMS\\$MUI_TEMP\\" << linkName + str << R"( CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\)" << linkName + << R"(.lnk" "$INSTDIR\)" << sourceName << "\"" << std::endl; + deleteStr << R"( Delete "$SMPROGRAMS\$MUI_TEMP\)" << linkName << ".lnk\"" << std::endl; } else { - str << " WriteINIStr \"$SMPROGRAMS\\$STARTMENU_FOLDER\\" << linkName - << ".url\" \"InternetShortcut\" \"URL\" \"" << sourceName << "\"" + str << R"( WriteINIStr "$SMPROGRAMS\$STARTMENU_FOLDER\)" << linkName + << R"(.url" "InternetShortcut" "URL" ")" << sourceName << "\"" << std::endl; - deleteStr << " Delete \"$SMPROGRAMS\\$MUI_TEMP\\" << linkName + deleteStr << R"( Delete "$SMPROGRAMS\$MUI_TEMP\)" << linkName << ".url\"" << std::endl; } // see if CPACK_CREATE_DESKTOP_LINK_ExeName is on @@ -581,7 +581,7 @@ void cmCPackNSISGenerator::CreateMenuLinks(std::ostream& str, if (this->IsSet(desktop)) { str << " StrCmp \"$INSTALL_DESKTOP\" \"1\" 0 +2\n"; str << " CreateShortCut \"$DESKTOP\\" << linkName - << ".lnk\" \"$INSTDIR\\" << sourceName << "\"" << std::endl; + << R"(.lnk" "$INSTDIR\)" << sourceName << "\"" << std::endl; deleteStr << " StrCmp \"$INSTALL_DESKTOP\" \"1\" 0 +2\n"; deleteStr << " Delete \"$DESKTOP\\" << linkName << ".lnk\"" << std::endl; diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 8480309..1e17e1c 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -32,13 +32,13 @@ static const char* cmCTestErrorMatches[] = { "^Error: ", "^Error ", "[0-9] ERROR: ", - "^\"[^\"]+\", line [0-9]+: [^Ww]", + R"(^"[^"]+", line [0-9]+: [^Ww])", "^cc[^C]*CC: ERROR File = ([^,]+), Line = ([0-9]+)", "^ld([^:])*:([ \\t])*ERROR([^:])*:", - "^ild:([ \\t])*\\(undefined symbol\\)", + R"(^ild:([ \t])*\(undefined symbol\))", "([^ :]+) : (error|fatal error|catastrophic error)", "([^:]+): (Error:|error|undefined reference|multiply defined)", - "([^:]+)\\(([^\\)]+)\\) ?: (error|fatal error|catastrophic error)", + R"(([^:]+)\(([^\)]+)\) ?: (error|fatal error|catastrophic error))", "^fatal error C[0-9]+:", ": syntax error ", "^collect2: ld returned 1 exit status", @@ -50,14 +50,14 @@ static const char* cmCTestErrorMatches[] = { "^CMake Error.*:", ":[ \\t]cannot find", ":[ \\t]can't find", - ": \\*\\*\\* No rule to make target [`'].*\\'. Stop", - ": \\*\\*\\* No targets specified and no makefile found", + R"(: \*\*\* No rule to make target [`'].*\'. Stop)", + R"(: \*\*\* No targets specified and no makefile found)", ": Invalid loader fixup for symbol", ": Invalid fixups exist", ": Can't find library for", ": internal link edit command failed", ": Unrecognized option [`'].*\\'", - "\", line [0-9]+\\.[0-9]+: [0-9]+-[0-9]+ \\([^WI]\\)", + R"(", line [0-9]+\.[0-9]+: [0-9]+-[0-9]+ \([^WI]\))", "ld: 0706-006 Cannot find or open library file: -l ", "ild: \\(argument error\\) can't find library argument ::", "^could not be found and will not be loaded.", @@ -66,11 +66,11 @@ static const char* cmCTestErrorMatches[] = { "ld: 0711-993 Error occurred while writing to the output file:", "ld: fatal: ", "final link failed:", - "make: \\*\\*\\*.*Error", - "make\\[.*\\]: \\*\\*\\*.*Error", - "\\*\\*\\* Error code", + R"(make: \*\*\*.*Error)", + R"(make\[.*\]: \*\*\*.*Error)", + R"(\*\*\* Error code)", "nternal error:", - "Makefile:[0-9]+: \\*\\*\\* .* Stop\\.", + R"(Makefile:[0-9]+: \*\*\* .* Stop\.)", ": No such file or directory", ": Invalid argument", "^The project cannot be built\\.", @@ -101,19 +101,19 @@ static const char* cmCTestWarningMatches[] = { "^cc[^C]*CC: WARNING File = ([^,]+), Line = ([0-9]+)", "^ld([^:])*:([ \\t])*WARNING([^:])*:", "([^:]+): warning ([0-9]+):", - "^\"[^\"]+\", line [0-9]+: [Ww](arning|arnung)", + R"(^"[^"]+", line [0-9]+: [Ww](arning|arnung))", "([^:]+): warning[ \\t]*[0-9]+[ \\t]*:", "^(Warning|Warnung) ([0-9]+):", "^(Warning|Warnung)[ :]", "WARNING: ", "([^ :]+) : warning", "([^:]+): warning", - "\", line [0-9]+\\.[0-9]+: [0-9]+-[0-9]+ \\([WI]\\)", + R"(", line [0-9]+\.[0-9]+: [0-9]+-[0-9]+ \([WI]\))", "^cxx: Warning:", ".*file: .* has no symbols", "([^ :]+):([0-9]+): (Warning|Warnung)", "\\([0-9]*\\): remark #[0-9]*", - "\".*\", line [0-9]+: remark\\([0-9]*\\):", + R"(".*", line [0-9]+: remark\([0-9]*\):)", "cc-[0-9]* CC: REMARK File = .*, Line = [0-9]*", "^CMake Warning.*:", "^\\[WARNING\\]", @@ -121,9 +121,9 @@ static const char* cmCTestWarningMatches[] = { }; static const char* cmCTestWarningExceptions[] = { - "/usr/.*/X11/Xlib\\.h:[0-9]+: war.*: ANSI C\\+\\+ forbids declaration", - "/usr/.*/X11/Xutil\\.h:[0-9]+: war.*: ANSI C\\+\\+ forbids declaration", - "/usr/.*/X11/XResource\\.h:[0-9]+: war.*: ANSI C\\+\\+ forbids declaration", + R"(/usr/.*/X11/Xlib\.h:[0-9]+: war.*: ANSI C\+\+ forbids declaration)", + R"(/usr/.*/X11/Xutil\.h:[0-9]+: war.*: ANSI C\+\+ forbids declaration)", + R"(/usr/.*/X11/XResource\.h:[0-9]+: war.*: ANSI C\+\+ forbids declaration)", "WARNING 84 :", "WARNING 47 :", "makefile:", @@ -150,8 +150,8 @@ struct cmCTestBuildCompileErrorWarningRex static cmCTestBuildCompileErrorWarningRex cmCTestWarningErrorFileLine[] = { { "^Warning W[0-9]+ ([a-zA-Z.\\:/0-9_+ ~-]+) ([0-9]+):", 1, 2 }, { "^([a-zA-Z./0-9_+ ~-]+):([0-9]+):", 1, 2 }, - { "^([a-zA-Z.\\:/0-9_+ ~-]+)\\(([0-9]+)\\)", 1, 2 }, - { "^[0-9]+>([a-zA-Z.\\:/0-9_+ ~-]+)\\(([0-9]+)\\)", 1, 2 }, + { R"(^([a-zA-Z.\:/0-9_+ ~-]+)\(([0-9]+)\))", 1, 2 }, + { R"(^[0-9]+>([a-zA-Z.\:/0-9_+ ~-]+)\(([0-9]+)\))", 1, 2 }, { "^([a-zA-Z./0-9_+ ~-]+)\\(([0-9]+)\\)", 1, 2 }, { "\"([a-zA-Z./0-9_+ ~-]+)\", line ([0-9]+)", 1, 2 }, { "File = ([a-zA-Z./0-9_+ ~-]+), Line = ([0-9]+)", 1, 2 }, diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 22c8469..b09e7bb 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -815,9 +815,9 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( cmsys::RegularExpression valgrindLine("^==[0-9][0-9]*=="); cmsys::RegularExpression vgFIM( - "== .*Invalid free\\(\\) / delete / delete\\[\\]"); + R"(== .*Invalid free\(\) / delete / delete\[\])"); cmsys::RegularExpression vgFMM( - "== .*Mismatched free\\(\\) / delete / delete \\[\\]"); + R"(== .*Mismatched free\(\) / delete / delete \[\])"); cmsys::RegularExpression vgMLK1( "== .*[0-9,]+ bytes in [0-9,]+ blocks are definitely lost" " in loss record [0-9,]+ of [0-9,]+"); diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index 7adf640..aa42810 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -194,7 +194,7 @@ public: { this->SetLog(&P4->Log, prefix); this->RegexHeader.compile("^Change ([0-9]+) by (.+)@(.+) on (.*)$"); - this->RegexDiff.compile("^\\.\\.\\. (.*)#[0-9]+ ([^ ]+)$"); + this->RegexDiff.compile(R"(^\.\.\. (.*)#[0-9]+ ([^ ]+)$)"); } private: diff --git a/Source/LexerParser/cmCommandArgumentParser.cxx b/Source/LexerParser/cmCommandArgumentParser.cxx index 68b9e6c..b965b32 100644 --- a/Source/LexerParser/cmCommandArgumentParser.cxx +++ b/Source/LexerParser/cmCommandArgumentParser.cxx @@ -513,7 +513,7 @@ static const yytype_uint8 yyrline[] = static const char *const yytname[] = { "$end", "error", "$undefined", "cal_ENVCURLY", "cal_NCURLY", - "cal_DCURLY", "\"$\"", "\"{\"", "\"}\"", "cal_NAME", "\"\\\\\"", + "cal_DCURLY", "\"$\"", "\"{\"", "\"}\"", "cal_NAME", R"("\\")", "cal_SYMBOL", "\"@\"", "cal_ERROR", "cal_ATNAME", "$accept", "Start", "GoalWithOptionalBackSlash", "Goal", "String", "OuterText", "Variable", "EnvVarName", "MultipleIds", "ID", YY_NULLPTR diff --git a/Source/cmCMakeMinimumRequired.cxx b/Source/cmCMakeMinimumRequired.cxx index 4218d81..4b4bca2 100644 --- a/Source/cmCMakeMinimumRequired.cxx +++ b/Source/cmCMakeMinimumRequired.cxx @@ -55,7 +55,7 @@ bool cmCMakeMinimumRequired::InitialPass(std::vector const& args, (version_min.empty() || version_max.empty())) { std::ostringstream e; e << "VERSION \"" << version_string - << "\" does not have a version on both sides of \"...\"."; + << R"(" does not have a version on both sides of "...".)"; this->SetError(e.str()); return false; } diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx index ac30e1a..8da5ef7 100644 --- a/Source/cmCMakePolicyCommand.cxx +++ b/Source/cmCMakePolicyCommand.cxx @@ -176,7 +176,7 @@ bool cmCMakePolicyCommand::HandleVersionMode( (version_min.empty() || version_max.empty())) { std::ostringstream e; e << "VERSION \"" << version_string - << "\" does not have a version on both sides of \"...\"."; + << R"(" does not have a version on both sides of "...".)"; this->SetError(e.str()); return false; } diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index 76de75d..877f109 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -196,7 +196,7 @@ void cmExtraKateGenerator::AppendTarget(cmGeneratedFileStream& fout, { static char JsonSep = ' '; - fout << "\t\t\t" << JsonSep << "{\"name\":\"" << target + fout << "\t\t\t" << JsonSep << R"({"name":")" << target << "\", " "\"build_cmd\":\"" << make << " -C \\\"" << (this->UseNinja ? homeOutputDir : path) diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 59cfdca..71c8fcd 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -263,7 +263,7 @@ void cmExtraSublimeTextGenerator::AppendTarget( // Regular expression to extract compiler flags from a string // https://gist.github.com/3944250 const char* regexString = - "(^|[ ])-[DIOUWfgs][^= ]+(=\\\"[^\"]+\\\"|=[^\"][^ ]+)?"; + R"((^|[ ])-[DIOUWfgs][^= ]+(=\"[^"]+\"|=[^"][^ ]+)?)"; flagRegex.compile(regexString); std::string workString = flagsString + " " + definesString + " " + includesString; @@ -315,12 +315,12 @@ std::string cmExtraSublimeTextGenerator::BuildMakeCommand( std::string generator = this->GlobalGenerator->GetName(); if (generator == "NMake Makefiles") { std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile); - command += ", \"/NOLOGO\", \"/f\", \""; + command += R"(, "/NOLOGO", "/f", ")"; command += makefileName + "\""; command += ", \"" + target + "\""; } else if (generator == "Ninja") { std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile); - command += ", \"-f\", \""; + command += R"(, "-f", ")"; command += makefileName + "\""; command += ", \"" + target + "\""; } else { @@ -332,7 +332,7 @@ std::string cmExtraSublimeTextGenerator::BuildMakeCommand( } else { makefileName = cmSystemTools::ConvertToOutputPath(makefile); } - command += ", \"-f\", \""; + command += R"(, "-f", ")"; command += makefileName + "\""; command += ", \"" + target + "\""; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index d5ea924..8223dd1 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -895,7 +895,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility( /* clang-format off */ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0025) << "\n" "Converting " << lang << - " compiler id \"AppleClang\" to \"Clang\" for compatibility." + R"( compiler id "AppleClang" to "Clang" for compatibility.)" ; /* clang-format on */ mf->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); @@ -925,7 +925,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility( /* clang-format off */ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0047) << "\n" "Converting " << lang << - " compiler id \"QCC\" to \"GNU\" for compatibility." + R"( compiler id "QCC" to "GNU" for compatibility.)" ; /* clang-format on */ mf->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); @@ -961,7 +961,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility( /* clang-format off */ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0089) << "\n" "Converting " << lang << - " compiler id \"XLClang\" to \"XL\" for compatibility." + R"( compiler id "XLClang" to "XL" for compatibility.)" ; /* clang-format on */ mf->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index e443678..4fa6ee6 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -906,11 +906,11 @@ void cmGlobalNinjaGenerator::AddCXXCompileCommand( /* clang-format off */ *this->CompileCommandsStream << "\n{\n" - << " \"directory\": \"" + << R"( "directory": ")" << cmGlobalGenerator::EscapeJSON(buildFileDir) << "\",\n" - << " \"command\": \"" + << R"( "command": ")" << cmGlobalGenerator::EscapeJSON(commandLine) << "\",\n" - << " \"file\": \"" + << R"( "file": ")" << cmGlobalGenerator::EscapeJSON(sourceFileName) << "\"\n" << "}"; /* clang-format on */ diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 9d64924..65d816e 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -177,13 +177,13 @@ void cmGlobalUnixMakefileGenerator3::AddCXXCompileCommand( *this->CommandDatabase << "," << std::endl; } *this->CommandDatabase << "{" << std::endl - << " \"directory\": \"" + << R"( "directory": ")" << cmGlobalGenerator::EscapeJSON(workingDirectory) << "\"," << std::endl - << " \"command\": \"" + << R"( "command": ")" << cmGlobalGenerator::EscapeJSON(compileCommand) << "\"," << std::endl - << " \"file\": \"" + << R"( "file": ")" << cmGlobalGenerator::EscapeJSON(sourceFile) << "\"" << std::endl << "}"; diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 47b9785..73a37cb 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -202,7 +202,7 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os, os << indentNN << "file(GLOB OLD_CONFIG_FILES \"" << installedDir << this->EFGen->GetConfigImportFileGlob() << "\")\n"; os << indentNN << "if(OLD_CONFIG_FILES)\n"; - os << indentNNN << "message(STATUS \"Old export file \\\"" << installedFile + os << indentNNN << R"(message(STATUS "Old export file \")" << installedFile << "\\\" will be replaced. Removing files [${OLD_CONFIG_FILES}].\")\n"; os << indentNNN << "file(REMOVE ${OLD_CONFIG_FILES})\n"; os << indentNN << "endif()\n"; diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx index bb4eb3e..2ffca30 100644 --- a/Source/cmInstallGenerator.cxx +++ b/Source/cmInstallGenerator.cxx @@ -142,7 +142,7 @@ void cmInstallGenerator::AddInstallRule( std::string cmInstallGenerator::CreateComponentTest(const char* component, bool exclude_from_all) { - std::string result = "\"x${CMAKE_INSTALL_COMPONENT}x\" STREQUAL \"x"; + std::string result = R"("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "x)"; result += component; result += "x\""; if (!exclude_from_all) { diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 40b8e19..2ed742f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -457,7 +457,7 @@ void cmLocalGenerator::GenerateInstallRules() << "if(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl << " set(CMAKE_INSTALL_PREFIX \"" << prefix << "\")" << std::endl << "endif()" << std::endl - << "string(REGEX REPLACE \"/$\" \"\" CMAKE_INSTALL_PREFIX " + << R"(string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX )" << "\"${CMAKE_INSTALL_PREFIX}\")" << std::endl << std::endl; diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 61b2fda..ec40136 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -145,7 +145,7 @@ static bool GetPolicyDefault(cmMakefile* mf, std::string const& policy, } else { std::ostringstream e; e << defaultVar << " has value \"" << defaultValue - << "\" but must be \"OLD\", \"NEW\", or \"\" (empty)."; + << R"(" but must be "OLD", "NEW", or "" (empty).)"; mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index de5d1ed..1165026 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -214,7 +214,7 @@ bool cmProjectCommand::InitialPass(std::vector const& args, } cmsys::RegularExpression vx( - "^([0-9]+(\\.[0-9]+(\\.[0-9]+(\\.[0-9]+)?)?)?)?$"); + R"(^([0-9]+(\.[0-9]+(\.[0-9]+(\.[0-9]+)?)?)?)?$)"); if (!vx.find(version)) { std::string e = "VERSION \"" + version + "\" format invalid."; this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e); diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index 5917e27..b7216b0 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -33,7 +33,7 @@ cmRST::cmRST(std::ostream& os, std::string docroot) , TocTreeDirective("^.. toctree::[ \t]*(.*)$") , ProductionListDirective("^.. productionlist::[ \t]*(.*)$") , NoteDirective("^.. note::[ \t]*(.*)$") - , ModuleRST("^#\\[(=*)\\[\\.rst:$") + , ModuleRST(R"(^#\[(=*)\[\.rst:$)") , CMakeRole("(:cmake)?:(" "command|cpack_gen|generator|variable|envvar|module|policy|" "prop_cache|prop_dir|prop_gbl|prop_inst|prop_sf|" diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index 0d8f1cc..e9343c7 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -335,7 +335,7 @@ bool cmSetPropertyCommand::HandleCacheMode() !cmSystemTools::IsOff(this->PropertyValue)) { std::ostringstream e; e << "given non-boolean value \"" << this->PropertyValue - << "\" for CACHE property \"ADVANCED\". "; + << R"(" for CACHE property "ADVANCED". )"; this->SetError(e.str()); return false; } diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx index e4a1b5f..88e415a 100644 --- a/Source/cmUseMangledMesaCommand.cxx +++ b/Source/cmUseMangledMesaCommand.cxx @@ -78,7 +78,7 @@ void cmUseMangledMesaCommand::CopyAndFullPathMesaHeader(const char* source, cmsys::RegularExpression includeLine( "^[ \t]*#[ \t]*include[ \t]*[<\"]([^\">]+)[\">]"); // regular expression for gl/ or GL/ in a file (match(1) of above) - cmsys::RegularExpression glDirLine("(gl|GL)(/|\\\\)([^<\"]+)"); + cmsys::RegularExpression glDirLine(R"((gl|GL)(/|\\)([^<"]+))"); // regular expression for gl GL or xmesa in a file (match(1) of above) cmsys::RegularExpression glLine("(gl|GL|xmesa)"); while (cmSystemTools::GetLineFromStream(fin, inLine)) { diff --git a/Source/cmXMLWriter.cxx b/Source/cmXMLWriter.cxx index 9d2a3c4..f1ce608 100644 --- a/Source/cmXMLWriter.cxx +++ b/Source/cmXMLWriter.cxx @@ -23,7 +23,7 @@ cmXMLWriter::~cmXMLWriter() void cmXMLWriter::StartDocument(const char* encoding) { - this->Output << ""; + this->Output << R"("; } void cmXMLWriter::EndDocument() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=abbb8a7b1d40b98fb1841a76efb676eea7771cf0 commit abbb8a7b1d40b98fb1841a76efb676eea7771cf0 Author: Sebastian Lipponer AuthorDate: Mon Apr 1 21:47:12 2019 +0200 Commit: Sebastian Lipponer CommitDate: Mon Apr 1 21:52:17 2019 +0200 Genex: Add $ diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index bba98d6..f93de53 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -88,6 +88,8 @@ String Comparisons ``$`` ``1`` if ``string`` is member of the semicolon-separated ``list``, else ``0``. Uses case-sensitive comparisons. +``$`` + Removes duplicated items in the given ``list``. ``$`` ``1`` if ``v1`` is a version less than ``v2``, else ``0``. ``$`` diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 50413c8..19d2b3a 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -15,6 +15,7 @@ #include "cmMessageType.h" #include "cmOutputConverter.h" #include "cmPolicies.h" +#include "cmRange.h" #include "cmState.h" #include "cmStateSnapshot.h" #include "cmStateTypes.h" @@ -326,6 +327,34 @@ static const struct InListNode : public cmGeneratorExpressionNode } } inListNode; +static const struct RemoveDuplicatesNode : public cmGeneratorExpressionNode +{ + RemoveDuplicatesNode() {} // NOLINT(modernize-use-equals-default) + + int NumExpectedParameters() const override { return 1; } + + std::string Evaluate( + const std::vector& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override + { + if (parameters.size() != 1) { + reportError( + context, content->GetOriginalExpression(), + "$ expression requires one parameter"); + } + + std::vector values; + cmSystemTools::ExpandListArgument(parameters.front(), values, true); + + auto valuesEnd = cmRemoveDuplicates(values); + auto valuesBegin = values.cbegin(); + return cmJoin(cmMakeRange(valuesBegin, valuesEnd), ";"); + } + +} removeDuplicatesNode; + static const struct TargetExistsNode : public cmGeneratorExpressionNode { TargetExistsNode() {} // NOLINT(modernize-use-equals-default) @@ -2158,6 +2187,7 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode( { "STREQUAL", &strEqualNode }, { "EQUAL", &equalNode }, { "IN_LIST", &inListNode }, + { "REMOVE_DUPLICATES", &removeDuplicatesNode }, { "LOWER_CASE", &lowerCaseNode }, { "UPPER_CASE", &upperCaseNode }, { "MAKE_C_IDENTIFIER", &makeCIdentifierNode }, diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-1-check.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-1-check.cmake new file mode 100644 index 0000000..e127711 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-1-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/REMOVE_DUPLICATES-generated.txt" content) + +set(expected "1") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-1.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-1.cmake new file mode 100644 index 0000000..53934af --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-1.cmake @@ -0,0 +1,3 @@ +cmake_policy(VERSION 3.11) + +file(GENERATE OUTPUT "REMOVE_DUPLICATES-generated.txt" CONTENT "$") diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-2-check.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-2-check.cmake new file mode 100644 index 0000000..e127711 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-2-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/REMOVE_DUPLICATES-generated.txt" content) + +set(expected "1") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-2.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-2.cmake new file mode 100644 index 0000000..a8aca6e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-2.cmake @@ -0,0 +1,3 @@ +cmake_policy(VERSION 3.11) + +file(GENERATE OUTPUT "REMOVE_DUPLICATES-generated.txt" CONTENT "$1>") diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-3-check.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-3-check.cmake new file mode 100644 index 0000000..e3055ce --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-3-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/REMOVE_DUPLICATES-generated.txt" content) + +set(expected "2;1") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-3.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-3.cmake new file mode 100644 index 0000000..ee2dd3e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-3.cmake @@ -0,0 +1,3 @@ +cmake_policy(VERSION 3.11) + +file(GENERATE OUTPUT "REMOVE_DUPLICATES-generated.txt" CONTENT "$1>") diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-4-check.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-4-check.cmake new file mode 100644 index 0000000..e3055ce --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-4-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/REMOVE_DUPLICATES-generated.txt" content) + +set(expected "2;1") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-4.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-4.cmake new file mode 100644 index 0000000..557bc28 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-4.cmake @@ -0,0 +1,3 @@ +cmake_policy(VERSION 3.11) + +file(GENERATE OUTPUT "REMOVE_DUPLICATES-generated.txt" CONTENT "$1$2>") diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-check.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-check.cmake new file mode 100644 index 0000000..f779d48 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/REMOVE_DUPLICATES-generated.txt" content) + +set(expected "") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty.cmake new file mode 100644 index 0000000..3b9d674 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty.cmake @@ -0,0 +1,3 @@ +cmake_policy(VERSION 3.11) + +file(GENERATE OUTPUT "REMOVE_DUPLICATES-generated.txt" CONTENT "$") diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 8a5604c..63c12a9 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -53,6 +53,11 @@ run_cmake(TARGET_GENEX_EVAL) run_cmake(GENEX_EVAL-recursion1) run_cmake(GENEX_EVAL-recursion2) run_cmake(GENEX_EVAL) +run_cmake(REMOVE_DUPLICATES-empty) +run_cmake(REMOVE_DUPLICATES-1) +run_cmake(REMOVE_DUPLICATES-2) +run_cmake(REMOVE_DUPLICATES-3) +run_cmake(REMOVE_DUPLICATES-4) run_cmake(ImportedTarget-TARGET_BUNDLE_DIR) run_cmake(ImportedTarget-TARGET_BUNDLE_CONTENT_DIR) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=11338389e5f89a58b18d63e29e21c099cfbf407e commit 11338389e5f89a58b18d63e29e21c099cfbf407e Author: Sebastian Lipponer AuthorDate: Mon Apr 1 21:45:21 2019 +0200 Commit: Sebastian Lipponer CommitDate: Mon Apr 1 21:50:18 2019 +0200 Help: Fix description in cmake-generator-expressions(7) manual diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 8cb0fe7..bba98d6 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -86,7 +86,7 @@ String Comparisons ``$`` ``1`` if ``value1`` and ``value2`` are numerically equal, else ``0``. ``$`` - ``1`` if ``string`` is member of the comma-separated ``list``, else ``0``. + ``1`` if ``string`` is member of the semicolon-separated ``list``, else ``0``. Uses case-sensitive comparisons. ``$`` ``1`` if ``v1`` is a version less than ``v2``, else ``0``. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=076118694995c19de7637156322818f3994de76a commit 076118694995c19de7637156322818f3994de76a Author: Ruslan Baratov AuthorDate: Thu Mar 28 22:43:40 2019 +0300 Commit: Ruslan Baratov CommitDate: Mon Apr 1 20:30:19 2019 +0300 project: Add variable CMAKE_PROJECT_INCLUDE_BEFORE diff --git a/Help/command/project.rst b/Help/command/project.rst index a95012d..7e33ccd 100644 --- a/Help/command/project.rst +++ b/Help/command/project.rst @@ -31,6 +31,10 @@ Further variables are set by the optional arguments described in the following. If any of these arguments is not used, then the corresponding variables are set to the empty string. +If the variable :variable:`CMAKE_PROJECT_INCLUDE_BEFORE` exists, the file +pointed to by that variable will be included as the first step of the project +command. + If the variable :variable:`CMAKE_PROJECT__INCLUDE` or :variable:`CMAKE_PROJECT_INCLUDE` exists, the file pointed to by that variable will be included as the last step of the project command. diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index e1584ef..e9dca47 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -196,6 +196,7 @@ Variables that Change Behavior /variable/CMAKE_PREFIX_PATH /variable/CMAKE_PROGRAM_PATH /variable/CMAKE_PROJECT_INCLUDE + /variable/CMAKE_PROJECT_INCLUDE_BEFORE /variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE /variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY /variable/CMAKE_STAGING_PREFIX diff --git a/Help/release/dev/project-include-before.rst b/Help/release/dev/project-include-before.rst new file mode 100644 index 0000000..3f16cd7 --- /dev/null +++ b/Help/release/dev/project-include-before.rst @@ -0,0 +1,5 @@ +cmake_project_include_before +---------------------------- + +* A variable :variable:`CMAKE_PROJECT_INCLUDE_BEFORE` was added to allow + injection of custom code into the project. diff --git a/Help/variable/CMAKE_PROJECT_INCLUDE_BEFORE.rst b/Help/variable/CMAKE_PROJECT_INCLUDE_BEFORE.rst new file mode 100644 index 0000000..12a5263 --- /dev/null +++ b/Help/variable/CMAKE_PROJECT_INCLUDE_BEFORE.rst @@ -0,0 +1,6 @@ +CMAKE_PROJECT_INCLUDE_BEFORE +---------------------------- + +A CMake language file or module to be included before processing the +:command:`project` command. This is intended for injecting custom code into +project builds without modifying their source. diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index de5d1ed..0bf63d4 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -25,6 +25,10 @@ bool cmProjectCommand::InitialPass(std::vector const& args, return false; } + if (!this->IncludeByVariable("CMAKE_PROJECT_INCLUDE_BEFORE")) { + return false; + } + std::string const& projectName = args[0]; this->Makefile->SetProjectName(projectName); diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt index 57f0cf8..1aeab8b 100644 --- a/Tests/CMakeOnly/CMakeLists.txt +++ b/Tests/CMakeOnly/CMakeLists.txt @@ -62,6 +62,12 @@ add_test(CMakeOnly.ProjectIncludeAny ${CMAKE_CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/Test.cmake ) +add_test(CMakeOnly.ProjectIncludeBefore ${CMAKE_CMAKE_COMMAND} + -DTEST=ProjectIncludeBefore + -DCMAKE_ARGS=-DCMAKE_PROJECT_INCLUDE_BEFORE=${CMAKE_CURRENT_SOURCE_DIR}/ProjectIncludeBefore/include.cmake + -P ${CMAKE_CURRENT_BINARY_DIR}/Test.cmake + ) + include(CMakeParseArguments) function(add_major_test module) diff --git a/Tests/CMakeOnly/ProjectIncludeBefore/CMakeLists.txt b/Tests/CMakeOnly/ProjectIncludeBefore/CMakeLists.txt new file mode 100644 index 0000000..5cd9cba --- /dev/null +++ b/Tests/CMakeOnly/ProjectIncludeBefore/CMakeLists.txt @@ -0,0 +1,5 @@ +set(FOO TRUE) +project(ProjectInclude LANGUAGES NONE) +if(NOT AUTO_INCLUDE) + message(FATAL_ERROR "include file not found") +endif() diff --git a/Tests/CMakeOnly/ProjectIncludeBefore/include.cmake b/Tests/CMakeOnly/ProjectIncludeBefore/include.cmake new file mode 100644 index 0000000..0a4799d --- /dev/null +++ b/Tests/CMakeOnly/ProjectIncludeBefore/include.cmake @@ -0,0 +1,9 @@ +if(NOT FOO) + message(FATAL_ERROR "FOO is not set") +endif() + +if(NOT "${PROJECT_NAME}" STREQUAL "") + message(FATAL_ERROR "PROJECT_NAME should be empty") +endif() + +set(AUTO_INCLUDE TRUE) ----------------------------------------------------------------------- Summary of changes: .clang-tidy | 1 - Help/command/project.rst | 4 ++ Help/manual/cmake-generator-expressions.7.rst | 4 +- Help/manual/cmake-variables.7.rst | 1 + Help/release/dev/FindPython-virtual-env.rst | 5 ++ Help/release/dev/project-include-before.rst | 5 ++ Help/variable/CMAKE_PROJECT_INCLUDE_BEFORE.rst | 6 ++ Modules/FindPython.cmake | 22 ++++++-- Modules/FindPython/Support.cmake | 65 ++++++++++++++++++++-- Modules/FindPython2.cmake | 20 +++++-- Modules/FindPython3.cmake | 24 ++++++-- Source/CPack/cmCPackNSISGenerator.cxx | 26 ++++----- Source/CTest/cmCTestBuildHandler.cxx | 36 ++++++------ Source/CTest/cmCTestMemCheckHandler.cxx | 4 +- Source/CTest/cmCTestP4.cxx | 2 +- Source/LexerParser/cmCommandArgumentParser.cxx | 2 +- Source/cmCMakeMinimumRequired.cxx | 2 +- Source/cmCMakePolicyCommand.cxx | 2 +- Source/cmExtraKateGenerator.cxx | 2 +- Source/cmExtraSublimeTextGenerator.cxx | 8 +-- Source/cmGeneratorExpressionNode.cxx | 30 ++++++++++ Source/cmGlobalGenerator.cxx | 6 +- Source/cmGlobalNinjaGenerator.cxx | 6 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 6 +- Source/cmInstallExportGenerator.cxx | 2 +- Source/cmInstallGenerator.cxx | 2 +- Source/cmLocalGenerator.cxx | 2 +- Source/cmPolicies.cxx | 2 +- Source/cmProjectCommand.cxx | 6 +- Source/cmQtAutoGen.cxx | 46 +++++++-------- Source/cmQtAutoGen.h | 9 --- Source/cmQtAutoGenGlobalInitializer.cxx | 30 ++++++++-- Source/cmQtAutoGenGlobalInitializer.h | 30 ++++++++++ Source/cmQtAutoGenInitializer.cxx | 43 ++++++-------- Source/cmQtAutoGenInitializer.h | 16 ++---- Source/cmRST.cxx | 2 +- Source/cmSetPropertyCommand.cxx | 2 +- Source/cmUseMangledMesaCommand.cxx | 2 +- Source/cmXMLWriter.cxx | 2 +- Tests/CMakeOnly/CMakeLists.txt | 6 ++ .../CMakeOnly/ProjectIncludeBefore/CMakeLists.txt | 5 ++ Tests/CMakeOnly/ProjectIncludeBefore/include.cmake | 9 +++ Tests/FindPython/CMakeLists.txt | 11 ++++ Tests/FindPython/VirtualEnv/CMakeLists.txt | 42 ++++++++++++++ .../FindPython/VirtualEnv/VirtualEnvDefault.cmake | 6 ++ Tests/FindPython/VirtualEnv/VirtualEnvOnly.cmake | 16 ++++++ .../FindPython/VirtualEnv/VirtualEnvStandard.cmake | 7 +++ .../REMOVE_DUPLICATES-1-check.cmake | 6 ++ .../GeneratorExpression/REMOVE_DUPLICATES-1.cmake | 3 + .../REMOVE_DUPLICATES-2-check.cmake | 6 ++ .../GeneratorExpression/REMOVE_DUPLICATES-2.cmake | 3 + .../REMOVE_DUPLICATES-3-check.cmake | 6 ++ .../GeneratorExpression/REMOVE_DUPLICATES-3.cmake | 3 + .../REMOVE_DUPLICATES-4-check.cmake | 6 ++ .../GeneratorExpression/REMOVE_DUPLICATES-4.cmake | 3 + .../REMOVE_DUPLICATES-empty-check.cmake | 6 ++ .../REMOVE_DUPLICATES-empty.cmake | 3 + .../GeneratorExpression/RunCMakeTest.cmake | 5 ++ 58 files changed, 480 insertions(+), 157 deletions(-) create mode 100644 Help/release/dev/FindPython-virtual-env.rst create mode 100644 Help/release/dev/project-include-before.rst create mode 100644 Help/variable/CMAKE_PROJECT_INCLUDE_BEFORE.rst create mode 100644 Tests/CMakeOnly/ProjectIncludeBefore/CMakeLists.txt create mode 100644 Tests/CMakeOnly/ProjectIncludeBefore/include.cmake create mode 100644 Tests/FindPython/VirtualEnv/CMakeLists.txt create mode 100644 Tests/FindPython/VirtualEnv/VirtualEnvDefault.cmake create mode 100644 Tests/FindPython/VirtualEnv/VirtualEnvOnly.cmake create mode 100644 Tests/FindPython/VirtualEnv/VirtualEnvStandard.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-1-check.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-1.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-2-check.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-2.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-3-check.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-3.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-4-check.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-4.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-check.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Thu Apr 4 11:43:03 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 4 Apr 2019 11:43:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-596-g85b26a7 Message-ID: <20190404154303.4E89D10F42F@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 85b26a7254ce66404227f2b715fd4e29c64668f6 (commit) via a15ed54dca5ebd2535a737b7200677c945c5c082 (commit) via d48bf97fd3ec9c6cc818d32978122f019e35f638 (commit) via 14c7396fb940d04f2afd3e9a7230fa6d4fac8145 (commit) from 0dfb056cd3fa655ddf3cabb6b3ce0309b3037ca1 (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=85b26a7254ce66404227f2b715fd4e29c64668f6 commit 85b26a7254ce66404227f2b715fd4e29c64668f6 Merge: a15ed54 14c7396 Author: Brad King AuthorDate: Thu Apr 4 15:33:19 2019 +0000 Commit: Kitware Robot CommitDate: Thu Apr 4 11:34:43 2019 -0400 Merge topic 'FindGLEW-lib-suffixes' 14c7396fb9 FindGLEW: fix CMAKE_FIND_LIBRARY_SUFFIXES Acked-by: Kitware Robot Merge-request: !3179 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a15ed54dca5ebd2535a737b7200677c945c5c082 commit a15ed54dca5ebd2535a737b7200677c945c5c082 Merge: 0dfb056 d48bf97 Author: Brad King AuthorDate: Thu Apr 4 15:32:46 2019 +0000 Commit: Kitware Robot CommitDate: Thu Apr 4 11:33:37 2019 -0400 Merge topic 'FindBoost-clang-cl' d48bf97fd3 FindBoost: Consider boost suffixes suitable for clang-cl Acked-by: Kitware Robot Merge-request: !3164 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d48bf97fd3ec9c6cc818d32978122f019e35f638 commit d48bf97fd3ec9c6cc818d32978122f019e35f638 Author: Douman AuthorDate: Fri Mar 29 22:45:47 2019 +0300 Commit: Brad King CommitDate: Wed Apr 3 14:30:11 2019 -0400 FindBoost: Consider boost suffixes suitable for clang-cl When compiling with `clang-cl` we can use either the MSVC- or Clang-built boost libraries. diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 6e7d3db..1231ff1 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -465,7 +465,7 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret) endif() elseif (GHSMULTI) set(_boost_COMPILER "-ghs") - elseif("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC") + elseif("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC" OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") if(MSVC_TOOLSET_VERSION GREATER_EQUAL 141) set(_boost_COMPILER "-vc141;-vc140") elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 80) @@ -477,6 +477,12 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret) else() # VS 6.0 Good luck! set(_boost_COMPILER "-vc6") # yes, this is correct endif() + + if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang") + string(REPLACE "." ";" VERSION_LIST "${CMAKE_CXX_COMPILER_VERSION}") + list(GET VERSION_LIST 0 CLANG_VERSION_MAJOR) + set(_boost_COMPILER "-clangw${CLANG_VERSION_MAJOR};${_boost_COMPILER}") + endif() elseif (BORLAND) set(_boost_COMPILER "-bcb") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=14c7396fb940d04f2afd3e9a7230fa6d4fac8145 commit 14c7396fb940d04f2afd3e9a7230fa6d4fac8145 Author: Claudio Fantacci AuthorDate: Tue Apr 2 09:43:34 2019 +0200 Commit: Claudio Fantacci CommitDate: Wed Apr 3 09:06:16 2019 +0200 FindGLEW: fix CMAKE_FIND_LIBRARY_SUFFIXES FindGLEW temporarily changes the content of CMAKE_FIND_LIBRARY_SUFFIXES to look for static and dynamic GLEW library. However, it wasn't storing and restoring the initial content of such variable, causing possible issues in user project. diff --git a/Modules/FindGLEW.cmake b/Modules/FindGLEW.cmake index 34ee873..2e9a052 100644 --- a/Modules/FindGLEW.cmake +++ b/Modules/FindGLEW.cmake @@ -117,6 +117,8 @@ else() endif() +set(__GLEW_CURRENT_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + __glew_set_find_library_suffix(SHARED) find_library(GLEW_SHARED_LIBRARY_RELEASE @@ -142,6 +144,9 @@ find_library(GLEW_STATIC_LIBRARY_DEBUG PATH_SUFFIXES lib lib64 PATHS ENV GLEW_ROOT) +set(CMAKE_FIND_LIBRARY_SUFFIXES ${__GLEW_CURRENT_FIND_LIBRARY_SUFFIXES}) +unset(__GLEW_CURRENT_FIND_LIBRARY_SUFFIXES) + include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) select_library_configurations(GLEW_SHARED) ----------------------------------------------------------------------- Summary of changes: Modules/FindBoost.cmake | 8 +++++++- Modules/FindGLEW.cmake | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Apr 4 11:53:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 4 Apr 2019 11:53:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-606-g56abc31 Message-ID: <20190404155304.5811B11344A@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 56abc31270cbe60845021107383f1cede0ed075e (commit) via a6324490e501154dba620a2495afd6f09eea8167 (commit) via cf70b871438f1ae8a40a4d3822376f75151af258 (commit) via 5c1ead795d3fc003908a515565842cf1815eb111 (commit) via 192aa506c66d5269e10d87f1a67df5397325a9af (commit) via d2473769e77f9cf9802c71effadb5e1469fcd625 (commit) via 33ee7793300f6ef9f5206e5a0539c192affa3d23 (commit) via 456e0fb64f5c70191145c34104d6f25bd24b7b37 (commit) via f28e7fc1a51d5dfa81e2844c51eb811835e99583 (commit) via d8cf8380fb9a539b3b2b6876f2eb34fc9bddbdac (commit) from 85b26a7254ce66404227f2b715fd4e29c64668f6 (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=56abc31270cbe60845021107383f1cede0ed075e commit 56abc31270cbe60845021107383f1cede0ed075e Merge: a632449 456e0fb Author: Brad King AuthorDate: Thu Apr 4 15:48:44 2019 +0000 Commit: Kitware Robot CommitDate: Thu Apr 4 11:48:55 2019 -0400 Merge topic 'improve-documentation' 456e0fb64f Help: Improve documentation formating Acked-by: Kitware Robot Merge-request: !3174 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a6324490e501154dba620a2495afd6f09eea8167 commit a6324490e501154dba620a2495afd6f09eea8167 Merge: cf70b87 192aa50 Author: Brad King AuthorDate: Thu Apr 4 11:46:03 2019 -0400 Commit: Brad King CommitDate: Thu Apr 4 11:46:03 2019 -0400 Merge branch 'release-3.14' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cf70b871438f1ae8a40a4d3822376f75151af258 commit cf70b871438f1ae8a40a4d3822376f75151af258 Merge: 5c1ead7 f28e7fc Author: Brad King AuthorDate: Thu Apr 4 15:43:24 2019 +0000 Commit: Kitware Robot CommitDate: Thu Apr 4 11:44:02 2019 -0400 Merge topic 'armcc-compiler-id' f28e7fc1a5 ARMCC: Do not identify ARMClang as ARMCC Acked-by: Kitware Robot Merge-request: !3187 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5c1ead795d3fc003908a515565842cf1815eb111 commit 5c1ead795d3fc003908a515565842cf1815eb111 Merge: 85b26a7 33ee779 Author: Brad King AuthorDate: Thu Apr 4 15:43:09 2019 +0000 Commit: Kitware Robot CommitDate: Thu Apr 4 11:43:18 2019 -0400 Merge topic 'vs2019-redist' 33ee779330 IRSL: Fix discovery of VS 2019 v142 toolset redistributables d8cf8380fb MSVC: Fix MSVC_TOOLSET_VERSION for VS 2019 v142 toolset Acked-by: Kitware Robot Merge-request: !3186 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=456e0fb64f5c70191145c34104d6f25bd24b7b37 commit 456e0fb64f5c70191145c34104d6f25bd24b7b37 Author: Bartosz Kosiorek AuthorDate: Mon Apr 1 15:14:27 2019 +0200 Commit: Bartosz Kosiorek CommitDate: Thu Apr 4 15:13:58 2019 +0200 Help: Improve documentation formating diff --git a/Help/command/get_cmake_property.rst b/Help/command/get_cmake_property.rst index 58bf741..96764a3 100644 --- a/Help/command/get_cmake_property.rst +++ b/Help/command/get_cmake_property.rst @@ -9,7 +9,7 @@ Get a global property of the CMake instance. Gets a global property from the CMake instance. The value of the ```` is stored in the variable ````. -If the property is not found, ```` will be set to ``"NOTFOUND"``. +If the property is not found, ```` will be set to ``NOTFOUND``. See the :manual:`cmake-properties(7)` manual for available properties. See also the :command:`get_property` command ``GLOBAL`` option. diff --git a/Help/command/get_target_property.rst b/Help/command/get_target_property.rst index 4327681..11e07ea 100644 --- a/Help/command/get_target_property.rst +++ b/Help/command/get_target_property.rst @@ -11,7 +11,7 @@ Get a property from a target. The value of the property is stored in the variable ``VAR``. If the target property is not found, the behavior depends on whether it has been defined to be an ``INHERITED`` property or not (see :command:`define_property`). Non-inherited properties will -set ``VAR`` to "NOTFOUND", whereas inherited properties will search the +set ``VAR`` to ``NOTFOUND``, whereas inherited properties will search the relevant parent scope as described for the :command:`define_property` command and if still unable to find the property, ``VAR`` will be set to an empty string. diff --git a/Help/command/if.rst b/Help/command/if.rst index a48a0fa..f377f2c 100644 --- a/Help/command/if.rst +++ b/Help/command/if.rst @@ -227,7 +227,7 @@ above. The result is ``OFF`` which is false. However, if we remove the if(var2) -which is true because ``var2`` is defined to "var1" which is not a false +which is true because ``var2`` is defined to ``var1`` which is not a false constant. Automatic evaluation applies in the other cases whenever the diff --git a/Help/command/include_external_msproject.rst b/Help/command/include_external_msproject.rst index 375baf2..88bb2c6 100644 --- a/Help/command/include_external_msproject.rst +++ b/Help/command/include_external_msproject.rst @@ -13,7 +13,7 @@ Include an external Microsoft project file in a workspace. Includes an external Microsoft project in the generated workspace file. Currently does nothing on UNIX. This will create a target -named [projectname]. This can be used in the :command:`add_dependencies` +named ``[projectname]``. This can be used in the :command:`add_dependencies` command to make things depend on the external project. ``TYPE``, ``GUID`` and ``PLATFORM`` are optional parameters that allow one to diff --git a/Help/command/install_files.rst b/Help/command/install_files.rst index f5fb46d..ff074a8 100644 --- a/Help/command/install_files.rst +++ b/Help/command/install_files.rst @@ -21,7 +21,7 @@ or its corresponding location in the binary tree may be listed. If a file specified already has an extension, that extension will be removed first. This is useful for providing lists of source files such as foo.cxx when you want the corresponding foo.h to be installed. -A typical extension is '.h'. +A typical extension is ``.h``. :: diff --git a/Help/command/math.rst b/Help/command/math.rst index 4fa55f6..3cbe719 100644 --- a/Help/command/math.rst +++ b/Help/command/math.rst @@ -16,7 +16,7 @@ Supported operators are ``+``, ``-``, ``*``, ``/``, ``%``, ``|``, ``&``, ``^``, ``~``, ``<<``, ``>>``, and ``(...)``; they have the same meaning as in C code. -Hexadecimal numbers are recognized when prefixed with "0x", as in C code. +Hexadecimal numbers are recognized when prefixed with ``0x``, as in C code. The result is formatted according to the option ``OUTPUT_FORMAT``, where ```` is one of diff --git a/Help/command/output_required_files.rst b/Help/command/output_required_files.rst index 8bc6a73..b3a6e86 100644 --- a/Help/command/output_required_files.rst +++ b/Help/command/output_required_files.rst @@ -14,6 +14,6 @@ more advanced scanner. output_required_files(srcfile outputfile) Outputs a list of all the source files that are required by the -specified srcfile. This list is written into outputfile. This is -similar to writing out the dependencies for srcfile except that it -jumps from .h files into .cxx, .c and .cpp files if possible. +specified ``srcfile``. This list is written into ``outputfile``. This is +similar to writing out the dependencies for ``srcfile`` except that it +jumps from ``.h`` files into ``.cxx``, ``.c`` and ``.cpp`` files if possible. diff --git a/Help/command/target_link_libraries.rst b/Help/command/target_link_libraries.rst index c5e4f9f..c2e7e8a 100644 --- a/Help/command/target_link_libraries.rst +++ b/Help/command/target_link_libraries.rst @@ -57,7 +57,7 @@ Each ```` may be: as when a shared library is detected to have no ``SONAME`` field. See policy :policy:`CMP0060` for discussion of another case. - If the library file is in a Mac OSX framework, the ``Headers`` directory + If the library file is in a macOS framework, the ``Headers`` directory of the framework will also be processed as a :ref:`usage requirement `. This has the same effect as passing the framework directory as an include directory. diff --git a/Help/cpack_gen/bundle.rst b/Help/cpack_gen/bundle.rst index 29727e2..b16dbda 100644 --- a/Help/cpack_gen/bundle.rst +++ b/Help/cpack_gen/bundle.rst @@ -12,26 +12,27 @@ Bundle-specific parameters (``CPACK_BUNDLE_xxx``). .. variable:: CPACK_BUNDLE_NAME - The name of the generated bundle. This appears in the OSX finder as the + The name of the generated bundle. This appears in the macOS Finder as the bundle name. Required. .. variable:: CPACK_BUNDLE_PLIST - Path to an OSX plist file that will be used for the generated bundle. This - assumes that the caller has generated or specified their own Info.plist + Path to an macOS Property List (``.plist``) file that will be used + for the generated bundle. This + assumes that the caller has generated or specified their own ``Info.plist`` file. Required. .. variable:: CPACK_BUNDLE_ICON - Path to an OSX icon file that will be used as the icon for the generated - bundle. This is the icon that appears in the OSX finder for the bundle, and - in the OSX dock when the bundle is opened. Required. + Path to an macOS icon file that will be used as the icon for the generated + bundle. This is the icon that appears in the macOS Finder for the bundle, and + in the macOS dock when the bundle is opened. Required. .. variable:: CPACK_BUNDLE_STARTUP_COMMAND Path to a startup script. This is a path to an executable or script that will be run whenever an end-user double-clicks the generated bundle in the - OSX Finder. Optional. + macOS Finder. Optional. .. variable:: CPACK_BUNDLE_APPLE_CERT_APP @@ -42,8 +43,9 @@ Bundle-specific parameters (``CPACK_BUNDLE_xxx``). .. variable:: CPACK_BUNDLE_APPLE_ENTITLEMENTS - The name of the ``Plist`` file that contains your apple entitlements for sandboxing - your application. This file is required for submission to the Mac App Store. + The name of the Property List (``.plist``) file that contains your Apple + entitlements for sandboxing your application. This file is required + for submission to the macOS App Store. .. variable:: CPACK_BUNDLE_APPLE_CODESIGN_FILES diff --git a/Help/cpack_gen/external.rst b/Help/cpack_gen/external.rst index e4912a4..406f6be 100644 --- a/Help/cpack_gen/external.rst +++ b/Help/cpack_gen/external.rst @@ -13,7 +13,7 @@ provided by CPack, such as component installation and the dependency graph. Integration with External Packaging Tools ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The CPack External generator generates a .json file containing the +The CPack External generator generates a ``.json`` file containing the CPack internal metadata, which gives external software information on how to package the software. External packaging software may itself invoke CPack, consume the generated metadata, diff --git a/Help/cpack_gen/rpm.rst b/Help/cpack_gen/rpm.rst index 65009db..2693c7b 100644 --- a/Help/cpack_gen/rpm.rst +++ b/Help/cpack_gen/rpm.rst @@ -22,19 +22,19 @@ http://www.rpm.org/wiki/Docs .. note:: - `` part of variables is preferred to be in upper case (for e.g. if - component is named `foo` then use `CPACK_RPM_FOO_XXXX` variable name format) - as is with other `CPACK__XXXX` variables. + `` part of variables is preferred to be in upper case (e.g. if + component is named ``foo`` then use ``CPACK_RPM_FOO_XXXX`` variable name format) + as is with other ``CPACK__XXXX`` variables. For the purposes of back compatibility (CMake/CPack version 3.5 and lower) - support for same cased component (e.g. `fOo` would be used as - `CPACK_RPM_fOo_XXXX`) is still supported for variables defined in older + support for same cased component (e.g. ``fOo`` would be used as + ``CPACK_RPM_fOo_XXXX``) is still supported for variables defined in older versions of CMake/CPack but is not guaranteed for variables that will be added in the future. For the sake of back compatibility same cased component variables also override upper cased versions where both are present. -Here are some CPack RPM generator wiki resources that are here for historic reasons and -are no longer maintained but may still prove useful: +Here are some CPack RPM generator wiki resources that are here for historic +reasons and are no longer maintained but may still prove useful: - https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/Configuration - https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/PackageGenerators#rpm-unix-only @@ -48,8 +48,8 @@ List of CPack RPM generator specific variables: * Mandatory : NO * Default : OFF - If enabled (ON) multiple packages are generated. By default a single package - containing files of all components is generated. + If enabled (``ON``) multiple packages are generated. By default + a single package containing files of all components is generated. .. variable:: CPACK_RPM_PACKAGE_SUMMARY CPACK_RPM__PACKAGE_SUMMARY @@ -76,14 +76,14 @@ List of CPack RPM generator specific variables: * Default : ``[-].rpm`` with spaces replaced by '-' - This may be set to ``RPM-DEFAULT`` to allow rpmbuild tool to generate package + This may be set to ``RPM-DEFAULT`` to allow ``rpmbuild`` tool to generate package file name by itself. Alternatively provided package file name must end with ``.rpm`` suffix. .. note:: By using user provided spec file, rpm macro extensions such as for - generating debuginfo packages or by simply using multiple components more + generating ``debuginfo`` packages or by simply using multiple components more than one rpm file may be generated, either from a single spec file or from multiple spec files (each component execution produces its own spec file). In such cases duplicate file names may occur as a result of this variable @@ -127,7 +127,7 @@ List of CPack RPM generator specific variables: * Mandatory : YES * Default : Native architecture output by ``uname -m`` - This may be set to ``noarch`` if you know you are building a noarch package. + This may be set to ``noarch`` if you know you are building a ``noarch`` package. .. variable:: CPACK_RPM_PACKAGE_RELEASE @@ -207,7 +207,7 @@ List of CPack RPM generator specific variables: * Default : - May be used to override RPM compression type to be used to build the - RPM. For example some Linux distribution now default to lzma or xz + RPM. For example some Linux distribution now default to ``lzma`` or ``xz`` compression whereas older cannot use such RPM. Using this one can enforce compression type to be used. @@ -226,8 +226,8 @@ List of CPack RPM generator specific variables: * Mandatory : NO * Default : - - May be used to enable (1, yes) or disable (0, no) automatic shared libraries - dependency detection. Dependencies are added to requires list. + May be used to enable (``1``, ``yes``) or disable (``0``, ``no``) automatic + shared libraries dependency detection. Dependencies are added to requires list. .. note:: @@ -241,9 +241,9 @@ List of CPack RPM generator specific variables: * Mandatory : NO * Default : - - May be used to enable (1, yes) or disable (0, no) automatic listing of shared - libraries that are provided by the package. Shared libraries are added to - provides list. + May be used to enable (``1``, ``yes``) or disable (``0``, ``no``) + automatic listing of shared libraries that are provided by the package. + Shared libraries are added to provides list. .. note:: @@ -258,8 +258,8 @@ List of CPack RPM generator specific variables: * Default : - Variable enables/disables autoreq and autoprov at the same time. - See :variable:`CPACK_RPM_PACKAGE_AUTOREQ` and :variable:`CPACK_RPM_PACKAGE_AUTOPROV` - for more details. + See :variable:`CPACK_RPM_PACKAGE_AUTOREQ` and + :variable:`CPACK_RPM_PACKAGE_AUTOPROV` for more details. .. note:: diff --git a/Help/generator/CodeBlocks.rst b/Help/generator/CodeBlocks.rst index 06cc746..d830542 100644 --- a/Help/generator/CodeBlocks.rst +++ b/Help/generator/CodeBlocks.rst @@ -4,14 +4,14 @@ CodeBlocks Generates CodeBlocks project files. Project files for CodeBlocks will be created in the top directory and -in every subdirectory which features a CMakeLists.txt file containing -a PROJECT() call. Additionally a hierarchy of makefiles is generated +in every subdirectory which features a ``CMakeLists.txt`` file containing +a :command:`project` call. Additionally a hierarchy of makefiles is generated into the build tree. The :variable:`CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES` variable may be set to ``ON`` to exclude any files which are located outside of the project root directory. The appropriate make program can build the -project through the default make target. A "make install" target is +project through the default ``all`` target. An ``install`` target is also provided. This "extra" generator may be specified as: diff --git a/Help/generator/CodeLite.rst b/Help/generator/CodeLite.rst index 3e60aa6..46fa5be 100644 --- a/Help/generator/CodeLite.rst +++ b/Help/generator/CodeLite.rst @@ -7,11 +7,11 @@ Project files for CodeLite will be created in the top directory and in every subdirectory which features a CMakeLists.txt file containing a :command:`project` call. The :variable:`CMAKE_CODELITE_USE_TARGETS` variable may be set to ``ON`` -to change the default behaviour from projects to targets as the basis +to change the default behavior from projects to targets as the basis for project files. The appropriate make program can build the -project through the default make target. A "make install" target is -also provided. +project through the default ``all`` target. An ``install`` target +is also provided. This "extra" generator may be specified as: diff --git a/Help/generator/Eclipse CDT4.rst b/Help/generator/Eclipse CDT4.rst index eb68bf0..634e2b6 100644 --- a/Help/generator/Eclipse CDT4.rst +++ b/Help/generator/Eclipse CDT4.rst @@ -7,7 +7,7 @@ Project files for Eclipse will be created in the top directory. In out of source builds, a linked resource to the top level source directory will be created. Additionally a hierarchy of makefiles is generated into the build tree. The appropriate make program can build -the project through the default make target. A "make install" target +the project through the default ``all`` target. An ``install`` target is also provided. This "extra" generator may be specified as: diff --git a/Help/generator/Green Hills MULTI.rst b/Help/generator/Green Hills MULTI.rst index 09c5b15..6626770 100644 --- a/Help/generator/Green Hills MULTI.rst +++ b/Help/generator/Green Hills MULTI.rst @@ -9,8 +9,9 @@ via the :variable:`CMAKE_BUILD_TYPE` variable. 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. +```` 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 `` option can be used to set the directory location of the toolset. Both absolute and relative paths are valid. Relative paths use ``GHS_TOOLSET_ROOT`` diff --git a/Help/generator/Kate.rst b/Help/generator/Kate.rst index 9b61a93..129bf63 100644 --- a/Help/generator/Kate.rst +++ b/Help/generator/Kate.rst @@ -5,10 +5,10 @@ Generates Kate project files. A project file for Kate will be created in the top directory in the top level build directory. -To use it in kate, the Project plugin must be enabled. -The project file is loaded in kate simply by opening the -ProjectName.kateproject file in the editor. -If the kate Build-plugin is enabled, all targets generated by CMake are +To use it in Kate, the Project plugin must be enabled. +The project file is loaded in Kate by opening the +``ProjectName.kateproject`` file in the editor. +If the Kate Build-plugin is enabled, all targets generated by CMake are available for building. This "extra" generator may be specified as: diff --git a/Help/generator/MSYS Makefiles.rst b/Help/generator/MSYS Makefiles.rst index f7cfa44..75b9fe5 100644 --- a/Help/generator/MSYS Makefiles.rst +++ b/Help/generator/MSYS Makefiles.rst @@ -1,7 +1,8 @@ MSYS Makefiles -------------- -Generates makefiles for use with MSYS ``make`` under the MSYS shell. +Generates makefiles for use with MSYS (Minimal SYStem) +``make`` under the MSYS shell. Use this generator in a MSYS shell prompt and using ``make`` as the build tool. The generated makefiles use ``/bin/sh`` as the shell to launch build diff --git a/Help/generator/MinGW Makefiles.rst b/Help/generator/MinGW Makefiles.rst index 9fe5fe3..134ea70 100644 --- a/Help/generator/MinGW Makefiles.rst +++ b/Help/generator/MinGW Makefiles.rst @@ -4,7 +4,8 @@ MinGW Makefiles Generates makefiles for use with ``mingw32-make`` under a Windows command prompt. -Use this generator under a Windows command prompt with MinGW in the ``PATH`` +Use this generator under a Windows command prompt with +MinGW (Minimalist GNU for Windows) in the ``PATH`` and using ``mingw32-make`` as the build tool. The generated makefiles use ``cmd.exe`` as the shell to launch build rules. They are not compatible with MSYS or a unix shell. diff --git a/Help/generator/Ninja.rst b/Help/generator/Ninja.rst index 3bbd9dc..51ef49b 100644 --- a/Help/generator/Ninja.rst +++ b/Help/generator/Ninja.rst @@ -4,8 +4,8 @@ Ninja Generates build.ninja files. A build.ninja file is generated into the build tree. Recent versions -of the ninja program can build the project through the "all" target. -An "install" target is also provided. +of the ninja program can build the project through the ``all`` target. +An ``install`` target is also provided. For each subdirectory ``sub/dir`` of the project, additional targets are generated: diff --git a/Help/generator/Sublime Text 2.rst b/Help/generator/Sublime Text 2.rst index 0597a95..0a07ea9 100644 --- a/Help/generator/Sublime Text 2.rst +++ b/Help/generator/Sublime Text 2.rst @@ -4,11 +4,11 @@ Sublime Text 2 Generates Sublime Text 2 project files. Project files for Sublime Text 2 will be created in the top directory -and in every subdirectory which features a CMakeLists.txt file -containing a PROJECT() call. Additionally Makefiles (or build.ninja -files) are generated into the build tree. The appropriate make -program can build the project through the default make target. A -"make install" target is also provided. +and in every subdirectory which features a ``CMakeLists.txt`` file +containing a :command:`project` call. Additionally ``Makefiles`` +(or ``build.ninja`` files) are generated into the build tree. +The appropriate make program can build the project through the default ``all`` +target. An ``install`` target is also provided. This "extra" generator may be specified as: diff --git a/Help/generator/Unix Makefiles.rst b/Help/generator/Unix Makefiles.rst index 97d74a8..1e65ee1 100644 --- a/Help/generator/Unix Makefiles.rst +++ b/Help/generator/Unix Makefiles.rst @@ -5,4 +5,4 @@ Generates standard UNIX makefiles. A hierarchy of UNIX makefiles is generated into the build tree. Any standard UNIX-style make program can build the project through the -default make target. A "make install" target is also provided. +default ``all`` target. An ``install`` target is also provided. diff --git a/Help/generator/VS_TOOLSET_HOST_ARCH.txt b/Help/generator/VS_TOOLSET_HOST_ARCH.txt index 4eb900f..0293631 100644 --- a/Help/generator/VS_TOOLSET_HOST_ARCH.txt +++ b/Help/generator/VS_TOOLSET_HOST_ARCH.txt @@ -1,6 +1,6 @@ For each toolset that comes with this version of Visual Studio, there are -variants that are themselves compiled for 32-bit (x86) and 64-bit (x64) hosts -(independent of the architecture they target). +variants that are themselves compiled for 32-bit (``x86``) and +64-bit (``x64``) hosts (independent of the architecture they target). |VS_TOOLSET_HOST_ARCH_DEFAULT| One may explicitly request use of either the 32-bit or 64-bit host tools by adding either ``host=x86`` or ``host=x64`` to the toolset specification. diff --git a/Help/module/CPackWIX.rst b/Help/module/CPackWIX.rst index c88c723..fd378b8 100644 --- a/Help/module/CPackWIX.rst +++ b/Help/module/CPackWIX.rst @@ -1,4 +1,5 @@ CPackWIX -------- -The documentation for the CPack WIX generator has moved here: :cpack_gen:`CPack WIX Generator` +The documentation for the CPack WIX generator has moved here: +:cpack_gen:`CPack WIX Generator` diff --git a/Help/policy/CMP0008.rst b/Help/policy/CMP0008.rst index 654a90f..18ede82 100644 --- a/Help/policy/CMP0008.rst +++ b/Help/policy/CMP0008.rst @@ -12,11 +12,12 @@ In CMake 2.4 and below it is possible to write code like where ``somelib`` is supposed to be a valid library file name such as ``libsomelib.a`` or ``somelib.lib``. For Makefile generators this produces an error at build time because the dependency on the full -path cannot be found. For VS IDE and Xcode generators this used to +path cannot be found. For :ref:`Visual Studio Generators` IDE +and :generator:`Xcode` generators this used to work by accident because CMake would always split off the library directory and ask the linker to search for the library by name (``-lsomelib`` or ``somelib.lib``). Despite the failure with Makefiles, some -projects have code like this and build only with VS and/or Xcode. +projects have code like this and build only with Visual Studio and/or Xcode. This version of CMake prefers to pass the full path directly to the native build tool, which will fail in this case because it does not name a valid library file. diff --git a/Help/policy/CMP0014.rst b/Help/policy/CMP0014.rst index 5d7add2..331dde5 100644 --- a/Help/policy/CMP0014.rst +++ b/Help/policy/CMP0014.rst @@ -4,11 +4,11 @@ CMP0014 Input directories must have ``CMakeLists.txt``. CMake versions before 2.8 silently ignored missing ``CMakeLists.txt`` -files in directories referenced by add_subdirectory() or subdirs(), +files in directories referenced by :command:`add_subdirectory` or :command:`subdirs`, treating them as if present but empty. In CMake 2.8.0 and above this -policy determines whether or not the case is an error. The ``OLD`` -behavior for this policy is to silently ignore the problem. The ``NEW`` -behavior for this policy is to report an error. +:command:`cmake_policy` determines whether or not the case is an error. +The ``OLD`` behavior for this policy is to silently ignore the problem. +The ``NEW`` behavior for this policy is to report an error. This policy was introduced in CMake version 2.8.0. CMake version |release| warns when the policy is not set and uses ``OLD`` behavior. Use diff --git a/Help/policy/CMP0015.rst b/Help/policy/CMP0015.rst index b90c679..90d5203 100644 --- a/Help/policy/CMP0015.rst +++ b/Help/policy/CMP0015.rst @@ -1,16 +1,16 @@ CMP0015 ------- -link_directories() treats paths relative to the source dir. + :command:`link_directories` treats paths relative to the source dir. -In CMake 2.8.0 and lower the link_directories() command passed +In CMake 2.8.0 and lower the :command:`link_directories` command passed relative paths unchanged to the linker. In CMake 2.8.1 and above the -link_directories() command prefers to interpret relative paths with -respect to CMAKE_CURRENT_SOURCE_DIR, which is consistent with -include_directories() and other commands. The ``OLD`` behavior for this -policy is to use relative paths verbatim in the linker command. The +:command:`link_directories` command prefers to interpret relative paths with +respect to ``CMAKE_CURRENT_SOURCE_DIR``, which is consistent with +:command:`include_directories` and other commands. The ``OLD`` behavior for +this policy is to use relative paths verbatim in the linker command. The ``NEW`` behavior for this policy is to convert relative paths to absolute -paths by appending the relative path to CMAKE_CURRENT_SOURCE_DIR. +paths by appending the relative path to ``CMAKE_CURRENT_SOURCE_DIR``. This policy was introduced in CMake version 2.8.1. CMake version |release| warns when the policy is not set and uses ``OLD`` behavior. Use diff --git a/Help/policy/CMP0017.rst b/Help/policy/CMP0017.rst index 99bd090..ca4664e 100644 --- a/Help/policy/CMP0017.rst +++ b/Help/policy/CMP0017.rst @@ -5,12 +5,12 @@ Prefer files from the CMake module directory when including from there. Starting with CMake 2.8.4, if a cmake-module shipped with CMake (i.e. located in the CMake module directory) calls :command:`include` or -find_package(), the files located in the CMake module directory are +:command:`find_package`, the files located in the CMake module directory are preferred over the files in :variable:`CMAKE_MODULE_PATH`. This makes sure that the modules belonging to CMake always get those files included which they expect, and against which they were developed and tested. In all other cases, the files found in :variable:`CMAKE_MODULE_PATH` still take -precedence over the ones in the CMake module directory. The OLD +precedence over the ones in the CMake module directory. The ``OLD`` behavior is to always prefer files from CMAKE_MODULE_PATH over files from the CMake modules directory. diff --git a/Help/policy/CMP0037.rst b/Help/policy/CMP0037.rst index c028b41..9895fb0 100644 --- a/Help/policy/CMP0037.rst +++ b/Help/policy/CMP0037.rst @@ -10,8 +10,9 @@ as :manual:`cmake-generator-expressions(7)` and some diagnostics expect target names to match a restricted pattern. Target names may contain upper and lower case letters, numbers, the underscore -character (_), dot(.), plus(+) and minus(-). As a special case, ALIAS -targets and ``IMPORTED`` targets may contain two consecutive colons. +character (``_``), dot(``.``), plus(``+``) and minus(``-``). +As a special case, ``ALIAS`` and ``IMPORTED`` targets may contain +two consecutive colons. Target names reserved by one or more CMake generators are not allowed. Among others these include ``all``, ``clean``, ``help``, and ``install``. diff --git a/Help/prop_dir/ADDITIONAL_MAKE_CLEAN_FILES.rst b/Help/prop_dir/ADDITIONAL_MAKE_CLEAN_FILES.rst index e32eed3..986ea5b 100644 --- a/Help/prop_dir/ADDITIONAL_MAKE_CLEAN_FILES.rst +++ b/Help/prop_dir/ADDITIONAL_MAKE_CLEAN_FILES.rst @@ -3,5 +3,5 @@ ADDITIONAL_MAKE_CLEAN_FILES Additional files to clean during the make clean stage. -A list of files that will be cleaned as a part of the "make clean" +A list of files that will be cleaned as a part of the ``make clean`` stage. diff --git a/Help/prop_dir/IMPLICIT_DEPENDS_INCLUDE_TRANSFORM.rst b/Help/prop_dir/IMPLICIT_DEPENDS_INCLUDE_TRANSFORM.rst index 993f620..f534976 100644 --- a/Help/prop_dir/IMPLICIT_DEPENDS_INCLUDE_TRANSFORM.rst +++ b/Help/prop_dir/IMPLICIT_DEPENDS_INCLUDE_TRANSFORM.rst @@ -1,15 +1,15 @@ IMPLICIT_DEPENDS_INCLUDE_TRANSFORM ---------------------------------- -Specify #include line transforms for dependencies in a directory. +Specify ``#include`` line transforms for dependencies in a directory. -This property specifies rules to transform macro-like #include lines +This property specifies rules to transform macro-like ``#include`` lines during implicit dependency scanning of C and C++ source files. The list of rules must be semicolon-separated with each entry of the form -"A_MACRO(%)=value-with-%" (the % must be literal). During dependency -scanning occurrences of A_MACRO(...) on #include lines will be +``A_MACRO(%)=value-with-%`` (the ``%`` must be literal). During dependency +scanning occurrences of ``A_MACRO(...)`` on ``#include`` lines will be replaced by the value given with the macro argument substituted for -'%'. For example, the entry +``%``. For example, the entry :: diff --git a/Help/prop_dir/INTERPROCEDURAL_OPTIMIZATION_CONFIG.rst b/Help/prop_dir/INTERPROCEDURAL_OPTIMIZATION_CONFIG.rst index 32520865..840a1db 100644 --- a/Help/prop_dir/INTERPROCEDURAL_OPTIMIZATION_CONFIG.rst +++ b/Help/prop_dir/INTERPROCEDURAL_OPTIMIZATION_CONFIG.rst @@ -3,6 +3,6 @@ INTERPROCEDURAL_OPTIMIZATION_ Per-configuration interprocedural optimization for a directory. -This is a per-configuration version of INTERPROCEDURAL_OPTIMIZATION. +This is a per-configuration version of ``INTERPROCEDURAL_OPTIMIZATION``. If set, this property overrides the generic property for the named configuration. diff --git a/Help/prop_dir/MACROS.rst b/Help/prop_dir/MACROS.rst index e4feada..245cc1b 100644 --- a/Help/prop_dir/MACROS.rst +++ b/Help/prop_dir/MACROS.rst @@ -4,5 +4,5 @@ MACROS List of macro commands available in the current directory. This read-only property specifies the list of CMake macros currently -defined. It is intended for debugging purposes. See the macro +defined. It is intended for debugging purposes. See the :command:`macro` command. diff --git a/Help/prop_dir/TESTS.rst b/Help/prop_dir/TESTS.rst index 56e230e..1c9f6e5 100644 --- a/Help/prop_dir/TESTS.rst +++ b/Help/prop_dir/TESTS.rst @@ -3,5 +3,6 @@ TESTS List of tests. -This read-only property holds a :ref:`semicolon-separated list ` of tests +This read-only property holds a +:ref:`semicolon-separated list ` of tests defined so far, in the current directory, by the :command:`add_test` command. diff --git a/Help/prop_dir/VS_GLOBAL_SECTION_POST_section.rst b/Help/prop_dir/VS_GLOBAL_SECTION_POST_section.rst index 814bd5f..b65db99 100644 --- a/Help/prop_dir/VS_GLOBAL_SECTION_POST_section.rst +++ b/Help/prop_dir/VS_GLOBAL_SECTION_POST_section.rst @@ -12,20 +12,20 @@ in the solution file: EndGlobalSection -The property must be set to a semicolon-separated list of key=value +The property must be set to a semicolon-separated list of ``key=value`` pairs. Each such pair will be transformed into an entry in the solution global section. Whitespace around key and value is ignored. List elements which do not contain an equal sign are skipped. This property only works for Visual Studio 9 and above; it is ignored on other generators. The property only applies when set on a -directory whose CMakeLists.txt contains a project() command. +directory whose ``CMakeLists.txt`` contains a :command:`project` command. -Note that CMake generates postSolution sections ExtensibilityGlobals -and ExtensibilityAddIns by default. If you set the corresponding +Note that CMake generates postSolution sections ``ExtensibilityGlobals`` +and ``ExtensibilityAddIns`` by default. If you set the corresponding property, it will override the default section. For example, setting -VS_GLOBAL_SECTION_POST_ExtensibilityGlobals will override the default -contents of the ExtensibilityGlobals section, while keeping +``VS_GLOBAL_SECTION_POST_ExtensibilityGlobals`` will override the default +contents of the ``ExtensibilityGlobals`` section, while keeping ExtensibilityAddIns on its default. However, CMake will always add a ``SolutionGuid`` to the ``ExtensibilityGlobals`` section if it is not specified explicitly. diff --git a/Help/prop_dir/VS_GLOBAL_SECTION_PRE_section.rst b/Help/prop_dir/VS_GLOBAL_SECTION_PRE_section.rst index f70e9f1..7f8bf61 100644 --- a/Help/prop_dir/VS_GLOBAL_SECTION_PRE_section.rst +++ b/Help/prop_dir/VS_GLOBAL_SECTION_PRE_section.rst @@ -12,11 +12,11 @@ in the solution file: EndGlobalSection -The property must be set to a semicolon-separated list of key=value +The property must be set to a semicolon-separated list of ``key=value`` pairs. Each such pair will be transformed into an entry in the solution global section. Whitespace around key and value is ignored. List elements which do not contain an equal sign are skipped. This property only works for Visual Studio 9 and above; it is ignored on other generators. The property only applies when set on a -directory whose CMakeLists.txt contains a project() command. +directory whose ``CMakeLists.txt`` contains a :command:`project` command. diff --git a/Help/prop_dir/VS_STARTUP_PROJECT.rst b/Help/prop_dir/VS_STARTUP_PROJECT.rst index 04441b6..2680dfa 100644 --- a/Help/prop_dir/VS_STARTUP_PROJECT.rst +++ b/Help/prop_dir/VS_STARTUP_PROJECT.rst @@ -7,7 +7,7 @@ The :ref:`Visual Studio Generators` create a ``.sln`` file for each directory whose ``CMakeLists.txt`` file calls the :command:`project` command. Set this property in the same directory as a :command:`project` command call (e.g. in the top-level ``CMakeLists.txt`` file) to specify the default startup project -for the correpsonding solution file. +for the corresponding solution file. The property must be set to the name of an existing target. This will cause that project to be listed first in the generated solution diff --git a/Help/prop_gbl/ALLOW_DUPLICATE_CUSTOM_TARGETS.rst b/Help/prop_gbl/ALLOW_DUPLICATE_CUSTOM_TARGETS.rst index 8fab503..19775ff 100644 --- a/Help/prop_gbl/ALLOW_DUPLICATE_CUSTOM_TARGETS.rst +++ b/Help/prop_gbl/ALLOW_DUPLICATE_CUSTOM_TARGETS.rst @@ -4,16 +4,18 @@ ALLOW_DUPLICATE_CUSTOM_TARGETS Allow duplicate custom targets to be created. Normally CMake requires that all targets built in a project have -globally unique logical names (see policy CMP0002). This is necessary -to generate meaningful project file names in Xcode and VS IDE +globally unique logical names (see policy :policy:`CMP0002`). +This is necessary to generate meaningful project file names in +:generator:`Xcode` and :ref:`Visual Studio Generators` IDE generators. It also allows the target names to be referenced unambiguously. -Makefile generators are capable of supporting duplicate custom target -names. For projects that care only about Makefile generators and do -not wish to support Xcode or VS IDE generators, one may set this -property to true to allow duplicate custom targets. The property -allows multiple add_custom_target command calls in different +Makefile generators are capable of supporting duplicate :command:`add_custom_target` +names. For projects that care only about :ref:`Makefile Generators` and do +not wish to support :generator:`Xcode` or :ref:`Visual Studio Generators` IDE +generators, one may set this property to ``True`` +to allow duplicate custom targets. The property +allows multiple :command:`add_custom_target` command calls in different directories to specify the same target name. However, setting this property will cause non-Makefile generators to produce an error and refuse to generate the project. diff --git a/Help/prop_gbl/DISABLED_FEATURES.rst b/Help/prop_gbl/DISABLED_FEATURES.rst index 111cdf6..882bbfa 100644 --- a/Help/prop_gbl/DISABLED_FEATURES.rst +++ b/Help/prop_gbl/DISABLED_FEATURES.rst @@ -5,7 +5,7 @@ List of features which are disabled during the CMake run. List of features which are disabled during the CMake run. By default it contains the names of all packages which were not found. This is -determined using the _FOUND variables. Packages which are -searched QUIET are not listed. A project can add its own features to +determined using the ``_FOUND`` variables. Packages which are +searched ``QUIET`` are not listed. A project can add its own features to this list. This property is used by the macros in -FeatureSummary.cmake. +``FeatureSummary.cmake``. diff --git a/Help/prop_gbl/ENABLED_FEATURES.rst b/Help/prop_gbl/ENABLED_FEATURES.rst index b03da5a..acbb3d0 100644 --- a/Help/prop_gbl/ENABLED_FEATURES.rst +++ b/Help/prop_gbl/ENABLED_FEATURES.rst @@ -5,7 +5,7 @@ List of features which are enabled during the CMake run. List of features which are enabled during the CMake run. By default it contains the names of all packages which were found. This is -determined using the _FOUND variables. Packages which are -searched QUIET are not listed. A project can add its own features to +determined using the ``_FOUND`` variables. Packages which are +searched ``QUIET`` are not listed. A project can add its own features to this list. This property is used by the macros in -FeatureSummary.cmake. +``FeatureSummary.cmake``. diff --git a/Help/prop_gbl/USE_FOLDERS.rst b/Help/prop_gbl/USE_FOLDERS.rst index a1b4ccb..5919723 100644 --- a/Help/prop_gbl/USE_FOLDERS.rst +++ b/Help/prop_gbl/USE_FOLDERS.rst @@ -4,7 +4,7 @@ USE_FOLDERS Use the :prop_tgt:`FOLDER` target property to organize targets into folders. -If not set, CMake treats this property as OFF by default. CMake +If not set, CMake treats this property as ``OFF`` by default. CMake generators that are capable of organizing into a hierarchy of folders use the values of the :prop_tgt:`FOLDER` target property to name those -folders. See also the documentation for the FOLDER target property. +folders. See also the documentation for the :prop_tgt:`FOLDER` target property. diff --git a/Help/prop_gbl/XCODE_EMIT_EFFECTIVE_PLATFORM_NAME.rst b/Help/prop_gbl/XCODE_EMIT_EFFECTIVE_PLATFORM_NAME.rst index 9a6086e..9500443 100644 --- a/Help/prop_gbl/XCODE_EMIT_EFFECTIVE_PLATFORM_NAME.rst +++ b/Help/prop_gbl/XCODE_EMIT_EFFECTIVE_PLATFORM_NAME.rst @@ -1,14 +1,15 @@ XCODE_EMIT_EFFECTIVE_PLATFORM_NAME ---------------------------------- -Control emission of ``EFFECTIVE_PLATFORM_NAME`` by the Xcode generator. +Control emission of ``EFFECTIVE_PLATFORM_NAME`` by the :generator:`Xcode` +generator. It is required for building the same target with multiple SDKs. A common use case is the parallel use of ``iphoneos`` and ``iphonesimulator`` SDKs. -Three different states possible that control when the Xcode generator -emits the ``EFFECTIVE_PLATFORM_NAME`` variable: +Three different states possible that control when the :generator:`Xcode` +generator emits the ``EFFECTIVE_PLATFORM_NAME`` variable: - If set to ``ON`` it will always be emitted - If set to ``OFF`` it will never be emitted diff --git a/Help/prop_inst/CPACK_DESKTOP_SHORTCUTS.rst b/Help/prop_inst/CPACK_DESKTOP_SHORTCUTS.rst index 11f2c03..729ab60 100644 --- a/Help/prop_inst/CPACK_DESKTOP_SHORTCUTS.rst +++ b/Help/prop_inst/CPACK_DESKTOP_SHORTCUTS.rst @@ -1,7 +1,7 @@ CPACK_DESKTOP_SHORTCUTS ----------------------- -Species a list of shortcut names that should be created on the Desktop +Species a list of shortcut names that should be created on the `Desktop` for this file. -The property is currently only supported by the WIX generator. +The property is currently only supported by the :cpack_gen:`CPack WIX Generator`. diff --git a/Help/prop_inst/CPACK_NEVER_OVERWRITE.rst b/Help/prop_inst/CPACK_NEVER_OVERWRITE.rst index 11f44d0..4789e25 100644 --- a/Help/prop_inst/CPACK_NEVER_OVERWRITE.rst +++ b/Help/prop_inst/CPACK_NEVER_OVERWRITE.rst @@ -3,4 +3,4 @@ CPACK_NEVER_OVERWRITE Request that this file not be overwritten on install or reinstall. -The property is currently only supported by the WIX generator. +The property is currently only supported by the :cpack_gen:`CPack WIX Generator`. diff --git a/Help/prop_inst/CPACK_PERMANENT.rst b/Help/prop_inst/CPACK_PERMANENT.rst index 5e191d0..985de0d 100644 --- a/Help/prop_inst/CPACK_PERMANENT.rst +++ b/Help/prop_inst/CPACK_PERMANENT.rst @@ -3,4 +3,4 @@ CPACK_PERMANENT Request that this file not be removed on uninstall. -The property is currently only supported by the WIX generator. +The property is currently only supported by the :cpack_gen:`CPack WIX Generator`. diff --git a/Help/prop_inst/CPACK_STARTUP_SHORTCUTS.rst b/Help/prop_inst/CPACK_STARTUP_SHORTCUTS.rst index 8a16022..d9208b9 100644 --- a/Help/prop_inst/CPACK_STARTUP_SHORTCUTS.rst +++ b/Help/prop_inst/CPACK_STARTUP_SHORTCUTS.rst @@ -1,7 +1,7 @@ CPACK_STARTUP_SHORTCUTS ----------------------- -Species a list of shortcut names that should be created in the Startup folder +Species a list of shortcut names that should be created in the `Startup` folder for this file. -The property is currently only supported by the WIX generator. +The property is currently only supported by the :cpack_gen:`CPack WIX Generator`. diff --git a/Help/prop_inst/CPACK_START_MENU_SHORTCUTS.rst b/Help/prop_inst/CPACK_START_MENU_SHORTCUTS.rst index d30ea39..092334a 100644 --- a/Help/prop_inst/CPACK_START_MENU_SHORTCUTS.rst +++ b/Help/prop_inst/CPACK_START_MENU_SHORTCUTS.rst @@ -1,7 +1,7 @@ CPACK_START_MENU_SHORTCUTS -------------------------- -Species a list of shortcut names that should be created in the Start Menu +Species a list of shortcut names that should be created in the `Start Menu` for this file. -The property is currently only supported by the WIX generator. +The property is currently only supported by the :cpack_gen:`CPack WIX Generator`. diff --git a/Help/prop_inst/CPACK_WIX_ACL.rst b/Help/prop_inst/CPACK_WIX_ACL.rst index 4e13ec4..c88f426 100644 --- a/Help/prop_inst/CPACK_WIX_ACL.rst +++ b/Help/prop_inst/CPACK_WIX_ACL.rst @@ -17,3 +17,5 @@ each of which has to match the following format. ```` is any of the YesNoType attributes listed here:: http://wixtoolset.org/documentation/manual/v3/xsd/wix/permission.html + +The property is currently only supported by the :cpack_gen:`CPack WIX Generator`. diff --git a/Help/prop_sf/COMPILE_DEFINITIONS.rst b/Help/prop_sf/COMPILE_DEFINITIONS.rst index 8d2108c..6317690 100644 --- a/Help/prop_sf/COMPILE_DEFINITIONS.rst +++ b/Help/prop_sf/COMPILE_DEFINITIONS.rst @@ -3,14 +3,14 @@ COMPILE_DEFINITIONS Preprocessor definitions for compiling a source file. -The COMPILE_DEFINITIONS property may be set to a semicolon-separated -list of preprocessor definitions using the syntax VAR or VAR=value. +The ``COMPILE_DEFINITIONS`` property may be set to a semicolon-separated +list of preprocessor definitions using the syntax ``VAR`` or ``VAR=value``. Function-style definitions are not supported. CMake will automatically escape the value correctly for the native build system (note that CMake language syntax may require escapes to specify some values). This property may be set on a per-configuration basis using -the name COMPILE_DEFINITIONS_ where is an upper-case -name (ex. "COMPILE_DEFINITIONS_DEBUG"). +the name ``COMPILE_DEFINITIONS_`` where ```` is an upper-case +name (ex. ``COMPILE_DEFINITIONS_DEBUG``). CMake will automatically drop some definitions that are not supported by the native build tool. Xcode does not support per-configuration @@ -18,7 +18,7 @@ definitions on source files. .. include:: /include/COMPILE_DEFINITIONS_DISCLAIMER.txt -Contents of ``COMPILE_DEFINITIONS`` may use "generator expressions" +Contents of ``COMPILE_DEFINITIONS`` may use :manual:`cmake-generator-expressions(7)` with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. However, :generator:`Xcode` does not support per-config per-source settings, so expressions diff --git a/Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst b/Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst index 8487076..ec867b6 100644 --- a/Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst +++ b/Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst @@ -5,6 +5,6 @@ Ignored. See CMake Policy :policy:`CMP0043`. Per-configuration preprocessor definitions on a source file. -This is the configuration-specific version of COMPILE_DEFINITIONS. -Note that Xcode does not support per-configuration source file flags -so this property will be ignored by the Xcode generator. +This is the configuration-specific version of :prop_tgt:`COMPILE_DEFINITIONS`. +Note that :generator:`Xcode` does not support per-configuration source +file flags so this property will be ignored by the :generator:`Xcode` generator. diff --git a/Help/prop_sf/EXTERNAL_OBJECT.rst b/Help/prop_sf/EXTERNAL_OBJECT.rst index efa0e9b..351c04d 100644 --- a/Help/prop_sf/EXTERNAL_OBJECT.rst +++ b/Help/prop_sf/EXTERNAL_OBJECT.rst @@ -3,6 +3,6 @@ EXTERNAL_OBJECT If set to true then this is an object file. -If this property is set to true then the source file is really an +If this property is set to ``True`` then the source file is really an object file and should not be compiled. It will still be linked into the target though. diff --git a/Help/prop_sf/Fortran_FORMAT.rst b/Help/prop_sf/Fortran_FORMAT.rst index 69e34aa..1cbbf48 100644 --- a/Help/prop_sf/Fortran_FORMAT.rst +++ b/Help/prop_sf/Fortran_FORMAT.rst @@ -1,9 +1,10 @@ Fortran_FORMAT -------------- -Set to FIXED or FREE to indicate the Fortran source layout. +Set to ``FIXED`` or ``FREE`` to indicate the Fortran source layout. This property tells CMake whether a given Fortran source file uses fixed-format or free-format. CMake will pass the corresponding format -flag to the compiler. Consider using the target-wide Fortran_FORMAT -property if all source files in a target share the same format. +flag to the compiler. Consider using the target-wide +:prop_tgt:`Fortran_FORMAT` property if all source files in a target +share the same format. diff --git a/Help/prop_sf/KEEP_EXTENSION.rst b/Help/prop_sf/KEEP_EXTENSION.rst index d6167e5..a32f968 100644 --- a/Help/prop_sf/KEEP_EXTENSION.rst +++ b/Help/prop_sf/KEEP_EXTENSION.rst @@ -6,4 +6,4 @@ Make the output file have the same extension as the source file. If this property is set then the file extension of the output file will be the same as that of the source file. Normally the output file extension is computed based on the language of the source file, for -example .cxx will go to a .o extension. +example ``.cxx`` will go to a ``.o`` extension. diff --git a/Help/prop_sf/LABELS.rst b/Help/prop_sf/LABELS.rst index e1c1069..d0d2a0a 100644 --- a/Help/prop_sf/LABELS.rst +++ b/Help/prop_sf/LABELS.rst @@ -4,5 +4,5 @@ LABELS Specify a list of text labels associated with a source file. This property has meaning only when the source file is listed in a -target whose LABELS property is also set. No other semantics are +target whose ``LABELS`` property is also set. No other semantics are currently specified. diff --git a/Help/prop_sf/LANGUAGE.rst b/Help/prop_sf/LANGUAGE.rst index 97bfa20..88d438e 100644 --- a/Help/prop_sf/LANGUAGE.rst +++ b/Help/prop_sf/LANGUAGE.rst @@ -5,6 +5,7 @@ What programming language is the file. A property that can be set to indicate what programming language the source file is. If it is not set the language is determined based on -the file extension. Typical values are CXX C etc. Setting this +the file extension. Typical values are ``CXX`` (i.e. C++), ``C``, +``CSharp``, ``CUDA``, ``Fortran``, and ``ASM``. Setting this property for a file means this file will be compiled. Do not set this for headers or files that should not be compiled. diff --git a/Help/prop_sf/OBJECT_OUTPUTS.rst b/Help/prop_sf/OBJECT_OUTPUTS.rst index 1ce4866..e7e880b 100644 --- a/Help/prop_sf/OBJECT_OUTPUTS.rst +++ b/Help/prop_sf/OBJECT_OUTPUTS.rst @@ -1,9 +1,9 @@ OBJECT_OUTPUTS -------------- -Additional outputs for a Ninja or Makefile rule. +Additional outputs for a :generator:`Ninja` or :ref:`Makefile Generators` rule. Additional outputs created by compilation of this source file. If any of these outputs is missing the object will be recompiled. This is -supported only on the Ninja and Makefile generators and will be ignored on -other generators. +supported only on the :generator:`Ninja` and :ref:`Makefile Generators` +and will be ignored on other generators. diff --git a/Help/prop_sf/SYMBOLIC.rst b/Help/prop_sf/SYMBOLIC.rst index c7d0b26..8bebe30 100644 --- a/Help/prop_sf/SYMBOLIC.rst +++ b/Help/prop_sf/SYMBOLIC.rst @@ -3,6 +3,6 @@ SYMBOLIC Is this just a name for a rule. -If SYMBOLIC (boolean) is set to true the build system will be informed +If ``SYMBOLIC`` (boolean) is set to ``True`` the build system will be informed that the source file is not actually created on disk but instead used as a symbolic name for a build rule. diff --git a/Help/prop_sf/VS_XAML_TYPE.rst b/Help/prop_sf/VS_XAML_TYPE.rst index e92191d..190a639 100644 --- a/Help/prop_sf/VS_XAML_TYPE.rst +++ b/Help/prop_sf/VS_XAML_TYPE.rst @@ -2,5 +2,5 @@ VS_XAML_TYPE ------------ Mark a XAML source file as a different type than the default ``Page``. -The most common usage would be to set the default App.xaml file as -ApplicationDefinition. +The most common usage would be to set the default ``App.xaml`` file as +``ApplicationDefinition``. diff --git a/Help/prop_sf/WRAP_EXCLUDE.rst b/Help/prop_sf/WRAP_EXCLUDE.rst index 2c79f72..5f41c28 100644 --- a/Help/prop_sf/WRAP_EXCLUDE.rst +++ b/Help/prop_sf/WRAP_EXCLUDE.rst @@ -5,6 +5,6 @@ Exclude this source file from any code wrapping techniques. Some packages can wrap source files into alternate languages to provide additional functionality. For example, C++ code can be -wrapped into Java or Python etc using SWIG etc. If WRAP_EXCLUDE is -set to true (1 etc) that indicates that this source file should not be +wrapped into Java or Python etc using SWIG etc. If ``WRAP_EXCLUDE`` is +set to ``True``, that indicates that this source file should not be wrapped. diff --git a/Help/prop_sf/XCODE_EXPLICIT_FILE_TYPE.rst b/Help/prop_sf/XCODE_EXPLICIT_FILE_TYPE.rst index 1b24701..b8cf946 100644 --- a/Help/prop_sf/XCODE_EXPLICIT_FILE_TYPE.rst +++ b/Help/prop_sf/XCODE_EXPLICIT_FILE_TYPE.rst @@ -1,7 +1,7 @@ XCODE_EXPLICIT_FILE_TYPE ------------------------ -Set the Xcode ``explicitFileType`` attribute on its reference to a +Set the :generator:`Xcode` ``explicitFileType`` attribute on its reference to a source file. CMake computes a default based on file extension but can be told explicitly with this property. diff --git a/Help/prop_sf/XCODE_FILE_ATTRIBUTES.rst b/Help/prop_sf/XCODE_FILE_ATTRIBUTES.rst index 39e6966..4c93f44 100644 --- a/Help/prop_sf/XCODE_FILE_ATTRIBUTES.rst +++ b/Help/prop_sf/XCODE_FILE_ATTRIBUTES.rst @@ -1,9 +1,9 @@ XCODE_FILE_ATTRIBUTES --------------------- -Add values to the Xcode ``ATTRIBUTES`` setting on its reference to a +Add values to the :generator:`Xcode` ``ATTRIBUTES`` setting on its reference to a source file. Among other things, this can be used to set the role on -a mig file:: +a ``.mig`` file:: set_source_files_properties(defs.mig PROPERTIES diff --git a/Help/prop_sf/XCODE_LAST_KNOWN_FILE_TYPE.rst b/Help/prop_sf/XCODE_LAST_KNOWN_FILE_TYPE.rst index 42e3757..b21891f 100644 --- a/Help/prop_sf/XCODE_LAST_KNOWN_FILE_TYPE.rst +++ b/Help/prop_sf/XCODE_LAST_KNOWN_FILE_TYPE.rst @@ -1,8 +1,8 @@ XCODE_LAST_KNOWN_FILE_TYPE -------------------------- -Set the Xcode ``lastKnownFileType`` attribute on its reference to a -source file. CMake computes a default based on file extension but +Set the :generator:`Xcode` ``lastKnownFileType`` attribute on its reference to +a source file. CMake computes a default based on file extension but can be told explicitly with this property. See also :prop_sf:`XCODE_EXPLICIT_FILE_TYPE`, which is preferred diff --git a/Help/prop_test/COST.rst b/Help/prop_test/COST.rst index 3236a02..0c0fca7 100644 --- a/Help/prop_test/COST.rst +++ b/Help/prop_test/COST.rst @@ -1,7 +1,8 @@ COST ---- -Set this to a floating point value. Tests in a test set will be run in descending order of cost. +Set this to a floating point value. Tests in a test set will be run +in descending order of cost. This property describes the cost of a test. You can explicitly set -this value; tests with higher COST values will run first. +this value; tests with higher ``COST`` values will run first. diff --git a/Help/prop_test/DISABLED.rst b/Help/prop_test/DISABLED.rst index c18ae7f..1d469e8 100644 --- a/Help/prop_test/DISABLED.rst +++ b/Help/prop_test/DISABLED.rst @@ -1,15 +1,15 @@ DISABLED -------- -If set to true, the test will be skipped and its status will be 'Not Run'. A -DISABLED test will not be counted in the total number of tests and its -completion status will be reported to CDash as 'Disabled'. +If set to ``True``, the test will be skipped and its status will be 'Not Run'. A +``DISABLED`` test will not be counted in the total number of tests and its +completion status will be reported to CDash as ``Disabled``. -A DISABLED test does not participate in test fixture dependency resolution. -If a DISABLED test has fixture requirements defined in its +A ``DISABLED`` test does not participate in test fixture dependency resolution. +If a ``DISABLED`` test has fixture requirements defined in its :prop_test:`FIXTURES_REQUIRED` property, it will not cause setup or cleanup tests for those fixtures to be added to the test set. -If a test with the :prop_test:`FIXTURES_SETUP` property set is DISABLED, the -fixture behavior will be as though that setup test was passing and any test +If a test with the :prop_test:`FIXTURES_SETUP` property set is ``DISABLED``, +the fixture behavior will be as though that setup test was passing and any test case requiring that fixture will still run. diff --git a/Help/prop_test/ENVIRONMENT.rst b/Help/prop_test/ENVIRONMENT.rst index df9bc9e..102c792 100644 --- a/Help/prop_test/ENVIRONMENT.rst +++ b/Help/prop_test/ENVIRONMENT.rst @@ -4,6 +4,6 @@ ENVIRONMENT Specify environment variables that should be defined for running a test. If set to a list of environment variables and values of the form -MYVAR=value those environment variables will be defined while running +``MYVAR=value`` those environment variables will be defined while running the test. The environment is restored to its previous state after the test is done. diff --git a/Help/prop_test/MEASUREMENT.rst b/Help/prop_test/MEASUREMENT.rst index bc4936e..de459ed 100644 --- a/Help/prop_test/MEASUREMENT.rst +++ b/Help/prop_test/MEASUREMENT.rst @@ -1,8 +1,8 @@ MEASUREMENT ----------- -Specify a CDASH measurement and value to be reported for a test. +Specify a ``CDASH`` measurement and value to be reported for a test. -If set to a name then that name will be reported to CDASH as a named -measurement with a value of 1. You may also specify a value by -setting MEASUREMENT to "measurement=value". +If set to a name then that name will be reported to ``CDASH`` as a named +measurement with a value of ``1``. You may also specify a value by +setting ``MEASUREMENT`` to ``measurement=value``. diff --git a/Help/prop_test/RUN_SERIAL.rst b/Help/prop_test/RUN_SERIAL.rst index 8f65ae1..ab4c542 100644 --- a/Help/prop_test/RUN_SERIAL.rst +++ b/Help/prop_test/RUN_SERIAL.rst @@ -3,6 +3,6 @@ RUN_SERIAL Do not run this test in parallel with any other test. -Use this option in conjunction with the ctest_test PARALLEL_LEVEL +Use this option in conjunction with the ctest_test ``PARALLEL_LEVEL`` option to specify that this test should not be run in parallel with any other tests. diff --git a/Help/prop_test/SKIP_RETURN_CODE.rst b/Help/prop_test/SKIP_RETURN_CODE.rst index c61273c..a05fbf3 100644 --- a/Help/prop_test/SKIP_RETURN_CODE.rst +++ b/Help/prop_test/SKIP_RETURN_CODE.rst @@ -6,4 +6,4 @@ Return code to mark a test as skipped. Sometimes only a test itself can determine if all requirements for the test are met. If such a situation should not be considered a hard failure a return code of the process can be specified that will mark the test as -"Not Run" if it is encountered. +``Not Run`` if it is encountered. diff --git a/Help/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst b/Help/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst index 52ef013..f261756 100644 --- a/Help/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst +++ b/Help/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst @@ -6,7 +6,7 @@ generated by the compiler while building source files. This is a per-configuration version of :prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY`, -but multi-configuration generators (VS, Xcode) do NOT append a +but multi-configuration generators (Visual Studio, Xcode) do NOT append a per-configuration subdirectory to the specified directory. This property is initialized by the value of the :variable:`CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_` variable diff --git a/Help/prop_tgt/DEBUG_POSTFIX.rst b/Help/prop_tgt/DEBUG_POSTFIX.rst index 1487656..04e312e 100644 --- a/Help/prop_tgt/DEBUG_POSTFIX.rst +++ b/Help/prop_tgt/DEBUG_POSTFIX.rst @@ -1,7 +1,7 @@ DEBUG_POSTFIX ------------- -See target property _POSTFIX. +See target property ``_POSTFIX``. -This property is a special case of the more-general _POSTFIX -property for the DEBUG configuration. +This property is a special case of the more-general ``_POSTFIX`` +property for the ``DEBUG`` configuration. diff --git a/Help/prop_tgt/DEFINE_SYMBOL.rst b/Help/prop_tgt/DEFINE_SYMBOL.rst index f47f135..eb7f937 100644 --- a/Help/prop_tgt/DEFINE_SYMBOL.rst +++ b/Help/prop_tgt/DEFINE_SYMBOL.rst @@ -3,9 +3,9 @@ DEFINE_SYMBOL Define a symbol when compiling this target's sources. -DEFINE_SYMBOL sets the name of the preprocessor symbol defined when +``DEFINE_SYMBOL`` sets the name of the preprocessor symbol defined when compiling sources in a shared library. If not set here then it is set -to target_EXPORTS by default (with some substitutions if the target is +to ``target_EXPORTS`` by default (with some substitutions if the target is not a valid C identifier). This is useful for headers to know whether they are being included from inside their library or outside to properly setup dllexport/dllimport decorations. diff --git a/Help/prop_tgt/DOTNET_TARGET_FRAMEWORK_VERSION.rst b/Help/prop_tgt/DOTNET_TARGET_FRAMEWORK_VERSION.rst index a2f7d7d..c100326 100644 --- a/Help/prop_tgt/DOTNET_TARGET_FRAMEWORK_VERSION.rst +++ b/Help/prop_tgt/DOTNET_TARGET_FRAMEWORK_VERSION.rst @@ -4,7 +4,7 @@ DOTNET_TARGET_FRAMEWORK_VERSION Specify the .NET target framework version. Used to specify the .NET target framework version for C++/CLI. For -example, "v4.5". +example: ``v4.5``. This property is only evaluated for :ref:`Visual Studio Generators` VS 2010 and above. diff --git a/Help/prop_tgt/EXCLUDE_FROM_DEFAULT_BUILD.rst b/Help/prop_tgt/EXCLUDE_FROM_DEFAULT_BUILD.rst index a14e48c..664704b 100644 --- a/Help/prop_tgt/EXCLUDE_FROM_DEFAULT_BUILD.rst +++ b/Help/prop_tgt/EXCLUDE_FROM_DEFAULT_BUILD.rst @@ -1,8 +1,8 @@ EXCLUDE_FROM_DEFAULT_BUILD -------------------------- -Exclude target from "Build Solution". +Exclude target from ``Build Solution``. This property is only used by Visual Studio generators. -When set to TRUE, the target will not be built when you press "Build -Solution". +When set to ``TRUE``, the target will not be built when you press +``Build Solution``. diff --git a/Help/prop_tgt/EXCLUDE_FROM_DEFAULT_BUILD_CONFIG.rst b/Help/prop_tgt/EXCLUDE_FROM_DEFAULT_BUILD_CONFIG.rst index 655a9de..ad1021a 100644 --- a/Help/prop_tgt/EXCLUDE_FROM_DEFAULT_BUILD_CONFIG.rst +++ b/Help/prop_tgt/EXCLUDE_FROM_DEFAULT_BUILD_CONFIG.rst @@ -1,9 +1,10 @@ EXCLUDE_FROM_DEFAULT_BUILD_ ----------------------------------- -Per-configuration version of target exclusion from "Build Solution". +Per-configuration version of target exclusion from ``Build Solution``. This is the configuration-specific version of -EXCLUDE_FROM_DEFAULT_BUILD. If the generic EXCLUDE_FROM_DEFAULT_BUILD -is also set on a target, EXCLUDE_FROM_DEFAULT_BUILD_ takes +:prop_tgt:`EXCLUDE_FROM_DEFAULT_BUILD`. If the generic +:prop_tgt:`EXCLUDE_FROM_DEFAULT_BUILD` is also set on a target, +``EXCLUDE_FROM_DEFAULT_BUILD_`` takes precedence in configurations for which it has a value. diff --git a/Help/prop_tgt/EXPORT_NAME.rst b/Help/prop_tgt/EXPORT_NAME.rst index 043c57a..0e021d0 100644 --- a/Help/prop_tgt/EXPORT_NAME.rst +++ b/Help/prop_tgt/EXPORT_NAME.rst @@ -3,6 +3,6 @@ EXPORT_NAME Exported name for target files. -This sets the name for the IMPORTED target generated by the +This sets the name for the ``IMPORTED`` target generated by the :command:`install(EXPORT)` and :command:`export` commands. If not set, the logical target name is used by default. diff --git a/Help/prop_tgt/EchoString.rst b/Help/prop_tgt/EchoString.rst index 32ae2aa..352d062 100644 --- a/Help/prop_tgt/EchoString.rst +++ b/Help/prop_tgt/EchoString.rst @@ -3,5 +3,5 @@ EchoString A message to be displayed when the target is built. -A message to display on some generators (such as makefiles) when the -target is built. +A message to display on some generators (such as :ref:`Makefile Generators`) +when the target is built. diff --git a/Help/prop_tgt/FOLDER.rst b/Help/prop_tgt/FOLDER.rst index 0121125..f6be9e6 100644 --- a/Help/prop_tgt/FOLDER.rst +++ b/Help/prop_tgt/FOLDER.rst @@ -3,10 +3,10 @@ FOLDER Set the folder name. Use to organize targets in an IDE. -Targets with no FOLDER property will appear as top level entities in -IDEs like Visual Studio. Targets with the same FOLDER property value +Targets with no ``FOLDER`` property will appear as top level entities in +IDEs like Visual Studio. Targets with the same ``FOLDER`` property value will appear next to each other in a folder of that name. To nest -folders, use FOLDER values such as 'GUI/Dialogs' with '/' characters +folders, use ``FOLDER`` values such as 'GUI/Dialogs' with '/' characters separating folder levels. This property is initialized by the value of the variable diff --git a/Help/prop_tgt/Fortran_FORMAT.rst b/Help/prop_tgt/Fortran_FORMAT.rst index 0a11d91..8704e5f 100644 --- a/Help/prop_tgt/Fortran_FORMAT.rst +++ b/Help/prop_tgt/Fortran_FORMAT.rst @@ -1,11 +1,11 @@ Fortran_FORMAT -------------- -Set to FIXED or FREE to indicate the Fortran source layout. +Set to ``FIXED`` or ``FREE`` to indicate the Fortran source layout. This property tells CMake whether the Fortran source files in a target use fixed-format or free-format. CMake will pass the corresponding -format flag to the compiler. Use the source-specific Fortran_FORMAT +format flag to the compiler. Use the source-specific ``Fortran_FORMAT`` property to change the format of a specific source file. If the -variable CMAKE_Fortran_FORMAT is set when a target is created its +variable :variable:`CMAKE_Fortran_FORMAT` is set when a target is created its value is used to initialize this property. diff --git a/Help/prop_tgt/Fortran_MODULE_DIRECTORY.rst b/Help/prop_tgt/Fortran_MODULE_DIRECTORY.rst index 9c86437..e061863 100644 --- a/Help/prop_tgt/Fortran_MODULE_DIRECTORY.rst +++ b/Help/prop_tgt/Fortran_MODULE_DIRECTORY.rst @@ -8,10 +8,10 @@ the compiler supports a module output directory this specifies the directory in which the modules will be placed. When this property is not set the modules will be placed in the build directory corresponding to the target's source directory. If the variable -CMAKE_Fortran_MODULE_DIRECTORY is set when a target is created its +:variable:`CMAKE_Fortran_MODULE_DIRECTORY` is set when a target is created its value is used to initialize this property. Note that some compilers will automatically search the module output directory for modules USEd during compilation but others will not. If your sources USE modules their location must be specified by -INCLUDE_DIRECTORIES regardless of this property. +:prop_tgt:`INCLUDE_DIRECTORIES` regardless of this property. diff --git a/Help/prop_tgt/GENERATOR_FILE_NAME.rst b/Help/prop_tgt/GENERATOR_FILE_NAME.rst index 032b22a..a486105 100644 --- a/Help/prop_tgt/GENERATOR_FILE_NAME.rst +++ b/Help/prop_tgt/GENERATOR_FILE_NAME.rst @@ -6,4 +6,4 @@ Generator's file for this target. An internal property used by some generators to record the name of the project or dsp file associated with this target. Note that at configure time, this property is only set for targets created by -include_external_msproject(). +:command:`include_external_msproject`. diff --git a/Help/prop_tgt/GHS_INTEGRITY_APP.rst b/Help/prop_tgt/GHS_INTEGRITY_APP.rst index 7643038..b669781 100644 --- a/Help/prop_tgt/GHS_INTEGRITY_APP.rst +++ b/Help/prop_tgt/GHS_INTEGRITY_APP.rst @@ -4,7 +4,7 @@ GHS_INTEGRITY_APP ``ON`` / ``OFF`` boolean to determine if an executable target should be treated as an `Integrity Application`. -If no value is set and if a `.int` file is added as a source file to the +If no value is set and if a ``.int`` file is added as a source file to the executable target it will be treated as an `Integrity Application`. Supported on :generator:`Green Hills MULTI`. diff --git a/Help/prop_tgt/GNUtoMS.rst b/Help/prop_tgt/GNUtoMS.rst index cf34da9..a09ebbf 100644 --- a/Help/prop_tgt/GNUtoMS.rst +++ b/Help/prop_tgt/GNUtoMS.rst @@ -1,17 +1,17 @@ GNUtoMS ------- -Convert GNU import library (.dll.a) to MS format (.lib). +Convert GNU import library (``.dll.a``) to MS format (``.lib``). When linking a shared library or executable that exports symbols using GNU tools on Windows (MinGW/MSYS) with Visual Studio installed convert -the import library (.dll.a) from GNU to MS format (.lib). Both import -libraries will be installed by install(TARGETS) and exported by -install(EXPORT) and export() to be linked by applications with either -GNU- or MS-compatible tools. +the import library (``.dll.a``) from GNU to MS format (``.lib``). Both import +libraries will be installed by :command:`install(TARGETS)` and exported by +:command:`install(EXPORT)` and :command:`export` to be linked +by applications with either GNU- or MS-compatible tools. -If the variable CMAKE_GNUtoMS is set when a target is created its +If the variable ``CMAKE_GNUtoMS`` is set when a target is created its value is used to initialize this property. The variable must be set -prior to the first command that enables a language such as project() -or enable_language(). CMake provides the variable as an option to the +prior to the first command that enables a language such as :command:`project` +or :command:`enable_language`. CMake provides the variable as an option to the user automatically when configuring on Windows with GNU tools. diff --git a/Help/prop_tgt/HAS_CXX.rst b/Help/prop_tgt/HAS_CXX.rst index 7790932..15199b1 100644 --- a/Help/prop_tgt/HAS_CXX.rst +++ b/Help/prop_tgt/HAS_CXX.rst @@ -3,5 +3,5 @@ HAS_CXX Link the target using the C++ linker tool (obsolete). -This is equivalent to setting the LINKER_LANGUAGE property to CXX. -See that property's documentation for details. +This is equivalent to setting the :prop_tgt:`LINKER_LANGUAGE` +property to ``CXX``. diff --git a/Help/prop_tgt/IMPORTED.rst b/Help/prop_tgt/IMPORTED.rst index 605c1ce..22d28aa 100644 --- a/Help/prop_tgt/IMPORTED.rst +++ b/Help/prop_tgt/IMPORTED.rst @@ -1,8 +1,8 @@ IMPORTED -------- -Read-only indication of whether a target is IMPORTED. +Read-only indication of whether a target is ``IMPORTED``. The boolean value of this property is ``True`` for targets created with -the IMPORTED option to :command:`add_executable` or :command:`add_library`. +the ``IMPORTED`` option to :command:`add_executable` or :command:`add_library`. It is ``False`` for targets built within the project. diff --git a/Help/prop_tgt/IMPORTED_IMPLIB.rst b/Help/prop_tgt/IMPORTED_IMPLIB.rst index acf4b32..77fb552 100644 --- a/Help/prop_tgt/IMPORTED_IMPLIB.rst +++ b/Help/prop_tgt/IMPORTED_IMPLIB.rst @@ -1,7 +1,7 @@ IMPORTED_IMPLIB --------------- -Full path to the import library for an IMPORTED target. +Full path to the import library for an ``IMPORTED`` target. -Set this to the location of the ".lib" part of a windows DLL. Ignored +Set this to the location of the ``.lib`` part of a Windows DLL. Ignored for non-imported targets. diff --git a/Help/prop_tgt/IMPORTED_IMPLIB_CONFIG.rst b/Help/prop_tgt/IMPORTED_IMPLIB_CONFIG.rst index b4b3f02..5debabc 100644 --- a/Help/prop_tgt/IMPORTED_IMPLIB_CONFIG.rst +++ b/Help/prop_tgt/IMPORTED_IMPLIB_CONFIG.rst @@ -1,7 +1,7 @@ IMPORTED_IMPLIB_ ------------------------ --specific version of IMPORTED_IMPLIB property. +-specific version of :prop_tgt:`IMPORTED_IMPLIB` property. Configuration names correspond to those provided by the project from which the target is imported. diff --git a/Help/prop_tgt/IMPORTED_LINK_DEPENDENT_LIBRARIES.rst b/Help/prop_tgt/IMPORTED_LINK_DEPENDENT_LIBRARIES.rst index 2db2b0e..f7e2165 100644 --- a/Help/prop_tgt/IMPORTED_LINK_DEPENDENT_LIBRARIES.rst +++ b/Help/prop_tgt/IMPORTED_LINK_DEPENDENT_LIBRARIES.rst @@ -8,7 +8,7 @@ their implementation. On some platforms the linker searches for the dependent libraries of shared libraries they are including in the link. Set this property to the list of dependent shared libraries of an imported library. The list should be disjoint from the list of -interface libraries in the INTERFACE_LINK_LIBRARIES property. On +interface libraries in the :prop_tgt:`INTERFACE_LINK_LIBRARIES` property. On platforms requiring dependent shared libraries to be found at link time CMake uses this list to add appropriate files or paths to the link command line. Ignored for non-imported targets. diff --git a/Help/prop_tgt/IMPORTED_LINK_DEPENDENT_LIBRARIES_CONFIG.rst b/Help/prop_tgt/IMPORTED_LINK_DEPENDENT_LIBRARIES_CONFIG.rst index ee243c7..5b9c513 100644 --- a/Help/prop_tgt/IMPORTED_LINK_DEPENDENT_LIBRARIES_CONFIG.rst +++ b/Help/prop_tgt/IMPORTED_LINK_DEPENDENT_LIBRARIES_CONFIG.rst @@ -1,7 +1,7 @@ IMPORTED_LINK_DEPENDENT_LIBRARIES_ ------------------------------------------ --specific version of IMPORTED_LINK_DEPENDENT_LIBRARIES. +-specific version of :prop_tgt:`IMPORTED_LINK_DEPENDENT_LIBRARIES`. Configuration names correspond to those provided by the project from which the target is imported. If set, this property completely diff --git a/Help/prop_tgt/IMPORTED_LINK_INTERFACE_LANGUAGES.rst b/Help/prop_tgt/IMPORTED_LINK_INTERFACE_LANGUAGES.rst index 5ca9c8b..4ed4281 100644 --- a/Help/prop_tgt/IMPORTED_LINK_INTERFACE_LANGUAGES.rst +++ b/Help/prop_tgt/IMPORTED_LINK_INTERFACE_LANGUAGES.rst @@ -1,14 +1,14 @@ IMPORTED_LINK_INTERFACE_LANGUAGES --------------------------------- -Languages compiled into an IMPORTED static library. +Languages compiled into an ``IMPORTED`` static library. Set this to the list of languages of source files compiled to produce -a STATIC IMPORTED library (such as "C" or "CXX"). CMake accounts for +a ``STATIC IMPORTED`` library (such as ``C`` or ``CXX``). CMake accounts for these languages when computing how to link a target to the imported library. For example, when a C executable links to an imported C++ static library CMake chooses the C++ linker to satisfy language runtime dependencies of the static library. -This property is ignored for targets that are not STATIC libraries. +This property is ignored for targets that are not ``STATIC`` libraries. This property is ignored for non-imported targets. diff --git a/Help/prop_tgt/IMPORTED_LINK_INTERFACE_LANGUAGES_CONFIG.rst b/Help/prop_tgt/IMPORTED_LINK_INTERFACE_LANGUAGES_CONFIG.rst index d4a10fb..40fcf7f 100644 --- a/Help/prop_tgt/IMPORTED_LINK_INTERFACE_LANGUAGES_CONFIG.rst +++ b/Help/prop_tgt/IMPORTED_LINK_INTERFACE_LANGUAGES_CONFIG.rst @@ -1,7 +1,7 @@ IMPORTED_LINK_INTERFACE_LANGUAGES_ ------------------------------------------ --specific version of IMPORTED_LINK_INTERFACE_LANGUAGES. +-specific version of :prop_tgt:`IMPORTED_LINK_INTERFACE_LANGUAGES`. Configuration names correspond to those provided by the project from which the target is imported. If set, this property completely diff --git a/Help/prop_tgt/IMPORTED_LINK_INTERFACE_LIBRARIES.rst b/Help/prop_tgt/IMPORTED_LINK_INTERFACE_LIBRARIES.rst index 61134a4..527cf2e 100644 --- a/Help/prop_tgt/IMPORTED_LINK_INTERFACE_LIBRARIES.rst +++ b/Help/prop_tgt/IMPORTED_LINK_INTERFACE_LIBRARIES.rst @@ -1,16 +1,16 @@ IMPORTED_LINK_INTERFACE_LIBRARIES --------------------------------- -Transitive link interface of an IMPORTED target. +Transitive link interface of an ``IMPORTED`` target. Set this to the list of libraries whose interface is included when an -IMPORTED library target is linked to another target. The libraries +``IMPORTED`` library target is linked to another target. The libraries will be included on the link line for the target. Unlike the -LINK_INTERFACE_LIBRARIES property, this property applies to all -imported target types, including STATIC libraries. This property is +:prop_tgt:`LINK_INTERFACE_LIBRARIES` property, this property applies to all +imported target types, including ``STATIC`` libraries. This property is ignored for non-imported targets. This property is ignored if the target also has a non-empty -INTERFACE_LINK_LIBRARIES property. +:prop_tgt:`INTERFACE_LINK_LIBRARIES` property. -This property is deprecated. Use INTERFACE_LINK_LIBRARIES instead. +This property is deprecated. Use :prop_tgt:`INTERFACE_LINK_LIBRARIES` instead. diff --git a/Help/prop_tgt/IMPORTED_LINK_INTERFACE_LIBRARIES_CONFIG.rst b/Help/prop_tgt/IMPORTED_LINK_INTERFACE_LIBRARIES_CONFIG.rst index 13b93ba..050fb1d 100644 --- a/Help/prop_tgt/IMPORTED_LINK_INTERFACE_LIBRARIES_CONFIG.rst +++ b/Help/prop_tgt/IMPORTED_LINK_INTERFACE_LIBRARIES_CONFIG.rst @@ -1,13 +1,13 @@ IMPORTED_LINK_INTERFACE_LIBRARIES_ ------------------------------------------ --specific version of IMPORTED_LINK_INTERFACE_LIBRARIES. +-specific version of :prop_tgt:`IMPORTED_LINK_INTERFACE_LIBRARIES`. Configuration names correspond to those provided by the project from which the target is imported. If set, this property completely overrides the generic property for the named configuration. This property is ignored if the target also has a non-empty -INTERFACE_LINK_LIBRARIES property. +:prop_tgt:`INTERFACE_LINK_LIBRARIES` property. -This property is deprecated. Use INTERFACE_LINK_LIBRARIES instead. +This property is deprecated. Use :prop_tgt:`INTERFACE_LINK_LIBRARIES` instead. diff --git a/Help/prop_tgt/IMPORTED_LINK_INTERFACE_MULTIPLICITY.rst b/Help/prop_tgt/IMPORTED_LINK_INTERFACE_MULTIPLICITY.rst index 3a86b99..7a92d96 100644 --- a/Help/prop_tgt/IMPORTED_LINK_INTERFACE_MULTIPLICITY.rst +++ b/Help/prop_tgt/IMPORTED_LINK_INTERFACE_MULTIPLICITY.rst @@ -1,6 +1,6 @@ IMPORTED_LINK_INTERFACE_MULTIPLICITY ------------------------------------ -Repetition count for cycles of IMPORTED static libraries. +Repetition count for cycles of ``IMPORTED`` static libraries. -This is LINK_INTERFACE_MULTIPLICITY for IMPORTED targets. +This is :prop_tgt:`LINK_INTERFACE_MULTIPLICITY` for ``IMPORTED`` targets. diff --git a/Help/prop_tgt/IMPORTED_LINK_INTERFACE_MULTIPLICITY_CONFIG.rst b/Help/prop_tgt/IMPORTED_LINK_INTERFACE_MULTIPLICITY_CONFIG.rst index 33b9b84..758237b 100644 --- a/Help/prop_tgt/IMPORTED_LINK_INTERFACE_MULTIPLICITY_CONFIG.rst +++ b/Help/prop_tgt/IMPORTED_LINK_INTERFACE_MULTIPLICITY_CONFIG.rst @@ -1,7 +1,7 @@ IMPORTED_LINK_INTERFACE_MULTIPLICITY_ --------------------------------------------- --specific version of IMPORTED_LINK_INTERFACE_MULTIPLICITY. +-specific version of :prop_tgt:`IMPORTED_LINK_INTERFACE_MULTIPLICITY`. If set, this property completely overrides the generic property for the named configuration. diff --git a/Help/prop_tgt/IMPORTED_LOCATION.rst b/Help/prop_tgt/IMPORTED_LOCATION.rst index 2d07aad..d674f29 100644 --- a/Help/prop_tgt/IMPORTED_LOCATION.rst +++ b/Help/prop_tgt/IMPORTED_LOCATION.rst @@ -1,21 +1,21 @@ IMPORTED_LOCATION ----------------- -Full path to the main file on disk for an IMPORTED target. +Full path to the main file on disk for an ``IMPORTED`` target. -Set this to the location of an IMPORTED target file on disk. For +Set this to the location of an ``IMPORTED`` target file on disk. For executables this is the location of the executable file. For bundles on macOS this is the location of the executable file inside -Contents/MacOS under the application bundle folder. For static +``Contents/MacOS`` under the application bundle folder. For ``STATIC`` libraries and modules this is the location of the library or module. -For shared libraries on non-DLL platforms this is the location of the +For ``SHARED`` libraries on non-DLL platforms this is the location of the shared library. For frameworks on macOS this is the location of the library file symlink just inside the framework folder. For DLLs this -is the location of the ".dll" part of the library. For UNKNOWN +is the location of the ``.dll`` part of the library. For ``UNKNOWN`` libraries this is the location of the file to be linked. Ignored for non-imported targets. -Projects may skip IMPORTED_LOCATION if the configuration-specific -property IMPORTED_LOCATION_ is set. To get the location of an -imported target read one of the LOCATION or LOCATION_ -properties. +Projects may skip ``IMPORTED_LOCATION`` if the configuration-specific +property :prop_tgt:`IMPORTED_LOCATION_` is set. To get the location +of an imported target read one of the :prop_tgt:`LOCATION` or +``LOCATION_`` properties. diff --git a/Help/prop_tgt/IMPORTED_LOCATION_CONFIG.rst b/Help/prop_tgt/IMPORTED_LOCATION_CONFIG.rst index f85bb19..c5f5f04 100644 --- a/Help/prop_tgt/IMPORTED_LOCATION_CONFIG.rst +++ b/Help/prop_tgt/IMPORTED_LOCATION_CONFIG.rst @@ -1,7 +1,7 @@ IMPORTED_LOCATION_ -------------------------- --specific version of IMPORTED_LOCATION property. +-specific version of :prop_tgt:`IMPORTED_LOCATION` property. Configuration names correspond to those provided by the project from which the target is imported. diff --git a/Help/prop_tgt/IMPORTED_NO_SONAME.rst b/Help/prop_tgt/IMPORTED_NO_SONAME.rst index 4a1bb44..cbb7642 100644 --- a/Help/prop_tgt/IMPORTED_NO_SONAME.rst +++ b/Help/prop_tgt/IMPORTED_NO_SONAME.rst @@ -1,9 +1,9 @@ IMPORTED_NO_SONAME ------------------ -Specifies that an IMPORTED shared library target has no "soname". +Specifies that an ``IMPORTED`` shared library target has no ``soname``. Set this property to true for an imported shared library file that has -no "soname" field. CMake may adjust generated link commands for some +no ``soname`` field. CMake may adjust generated link commands for some platforms to prevent the linker from using the path to the library in -place of its missing soname. Ignored for non-imported targets. +place of its missing ``soname``. Ignored for non-imported targets. diff --git a/Help/prop_tgt/IMPORTED_NO_SONAME_CONFIG.rst b/Help/prop_tgt/IMPORTED_NO_SONAME_CONFIG.rst index 22d6822..76fe471 100644 --- a/Help/prop_tgt/IMPORTED_NO_SONAME_CONFIG.rst +++ b/Help/prop_tgt/IMPORTED_NO_SONAME_CONFIG.rst @@ -1,7 +1,7 @@ IMPORTED_NO_SONAME_ --------------------------- --specific version of IMPORTED_NO_SONAME property. +-specific version of :prop_tgt:`IMPORTED_NO_SONAME` property. Configuration names correspond to those provided by the project from which the target is imported. diff --git a/Help/prop_tgt/IMPORTED_SONAME.rst b/Help/prop_tgt/IMPORTED_SONAME.rst index d80907e..bf0c3cb 100644 --- a/Help/prop_tgt/IMPORTED_SONAME.rst +++ b/Help/prop_tgt/IMPORTED_SONAME.rst @@ -1,8 +1,8 @@ IMPORTED_SONAME --------------- -The "soname" of an IMPORTED target of shared library type. +The ``soname`` of an ``IMPORTED`` target of shared library type. -Set this to the "soname" embedded in an imported shared library. This +Set this to the ``soname`` embedded in an imported shared library. This is meaningful only on platforms supporting the feature. Ignored for non-imported targets. diff --git a/Help/prop_tgt/IMPORTED_SONAME_CONFIG.rst b/Help/prop_tgt/IMPORTED_SONAME_CONFIG.rst index 6ec9af3..59a9d1a 100644 --- a/Help/prop_tgt/IMPORTED_SONAME_CONFIG.rst +++ b/Help/prop_tgt/IMPORTED_SONAME_CONFIG.rst @@ -1,7 +1,7 @@ IMPORTED_SONAME_ ------------------------ --specific version of IMPORTED_SONAME property. +-specific version of :prop_tgt:`IMPORTED_SONAME` property. Configuration names correspond to those provided by the project from which the target is imported. diff --git a/Help/prop_tgt/IMPORT_PREFIX.rst b/Help/prop_tgt/IMPORT_PREFIX.rst index deede97..17e381b 100644 --- a/Help/prop_tgt/IMPORT_PREFIX.rst +++ b/Help/prop_tgt/IMPORT_PREFIX.rst @@ -3,7 +3,7 @@ IMPORT_PREFIX What comes before the import library name. -Similar to the target property PREFIX, but used for import libraries -(typically corresponding to a DLL) instead of regular libraries. A -target property that can be set to override the prefix (such as "lib") +Similar to the target property :prop_tgt:`PREFIX`, but used for import libraries +(typically corresponding to a ``DLL``) instead of regular libraries. A +target property that can be set to override the prefix (such as ``lib``) on an import library name. diff --git a/Help/prop_tgt/IMPORT_SUFFIX.rst b/Help/prop_tgt/IMPORT_SUFFIX.rst index bd01250..9307115 100644 --- a/Help/prop_tgt/IMPORT_SUFFIX.rst +++ b/Help/prop_tgt/IMPORT_SUFFIX.rst @@ -3,7 +3,7 @@ IMPORT_SUFFIX What comes after the import library name. -Similar to the target property SUFFIX, but used for import libraries -(typically corresponding to a DLL) instead of regular libraries. A -target property that can be set to override the suffix (such as -".lib") on an import library name. +Similar to the target property :prop_tgt:`SUFFIX`, but used +for import libraries (typically corresponding to a ``DLL``) instead of +regular libraries. A target property that can be set to override +the suffix (such as ``.lib``) on an import library name. diff --git a/Help/prop_tgt/INCLUDE_DIRECTORIES.rst b/Help/prop_tgt/INCLUDE_DIRECTORIES.rst index 8b40d9c..b381d1d 100644 --- a/Help/prop_tgt/INCLUDE_DIRECTORIES.rst +++ b/Help/prop_tgt/INCLUDE_DIRECTORIES.rst @@ -18,7 +18,7 @@ paths for the compiler. Relative paths should not be added to this property directly. Use one of the commands above instead to handle relative paths. -Contents of ``INCLUDE_DIRECTORIES`` may use "generator expressions" with +Contents of ``INCLUDE_DIRECTORIES`` may use :manual:`cmake-generator-expressions(7)` 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/prop_tgt/INSTALL_NAME_DIR.rst b/Help/prop_tgt/INSTALL_NAME_DIR.rst index 34348bb..2216072 100644 --- a/Help/prop_tgt/INSTALL_NAME_DIR.rst +++ b/Help/prop_tgt/INSTALL_NAME_DIR.rst @@ -1,10 +1,10 @@ INSTALL_NAME_DIR ---------------- -Mac OSX directory name for installed targets. +macOS directory name for installed targets. -INSTALL_NAME_DIR is a string specifying the directory portion of the -"install_name" field of shared libraries on Mac OSX to use in the +``INSTALL_NAME_DIR`` is a string specifying the directory portion of the +"install_name" field of shared libraries on macOS to use in the installed targets. This property is initialized by the value of the variable diff --git a/Help/prop_tgt/INSTALL_RPATH.rst b/Help/prop_tgt/INSTALL_RPATH.rst index 6206b68..6403f4c 100644 --- a/Help/prop_tgt/INSTALL_RPATH.rst +++ b/Help/prop_tgt/INSTALL_RPATH.rst @@ -5,5 +5,5 @@ The rpath to use for installed targets. A semicolon-separated list specifying the rpath to use in installed targets (for platforms that support it). This property is initialized -by the value of the variable CMAKE_INSTALL_RPATH if it is set when a -target is created. +by the value of the variable :variable:`CMAKE_INSTALL_RPATH` if it is set when +a target is created. diff --git a/Help/prop_tgt/INSTALL_RPATH_USE_LINK_PATH.rst b/Help/prop_tgt/INSTALL_RPATH_USE_LINK_PATH.rst index f0006f8..d8be954 100644 --- a/Help/prop_tgt/INSTALL_RPATH_USE_LINK_PATH.rst +++ b/Help/prop_tgt/INSTALL_RPATH_USE_LINK_PATH.rst @@ -3,8 +3,8 @@ INSTALL_RPATH_USE_LINK_PATH Add paths to linker search and installed rpath. -INSTALL_RPATH_USE_LINK_PATH is a boolean that if set to true will +``INSTALL_RPATH_USE_LINK_PATH`` is a boolean that if set to ``True`` will append directories in the linker search path and outside the project -to the INSTALL_RPATH. This property is initialized by the value of -the variable CMAKE_INSTALL_RPATH_USE_LINK_PATH if it is set when a +to the :prop_tgt:`INSTALL_RPATH`. This property is initialized by the value of +the variable ``CMAKE_INSTALL_RPATH_USE_LINK_PATH`` if it is set when a target is created. diff --git a/Help/prop_tgt/INTERFACE_LINK_DEPENDS.rst b/Help/prop_tgt/INTERFACE_LINK_DEPENDS.rst index d07f8ea..790554d 100644 --- a/Help/prop_tgt/INTERFACE_LINK_DEPENDS.rst +++ b/Help/prop_tgt/INTERFACE_LINK_DEPENDS.rst @@ -3,9 +3,10 @@ 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. +This property is supported only by :generator:`Ninja` and +:ref:`Makefile 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 diff --git a/Help/prop_tgt/INTERPROCEDURAL_OPTIMIZATION_CONFIG.rst b/Help/prop_tgt/INTERPROCEDURAL_OPTIMIZATION_CONFIG.rst index 782b0f0..79d4604 100644 --- a/Help/prop_tgt/INTERPROCEDURAL_OPTIMIZATION_CONFIG.rst +++ b/Help/prop_tgt/INTERPROCEDURAL_OPTIMIZATION_CONFIG.rst @@ -3,7 +3,7 @@ INTERPROCEDURAL_OPTIMIZATION_ Per-configuration interprocedural optimization for a target. -This is a per-configuration version of INTERPROCEDURAL_OPTIMIZATION. +This is a per-configuration version of :prop_tgt:`INTERPROCEDURAL_OPTIMIZATION`. If set, this property overrides the generic property for the named configuration. diff --git a/Help/prop_tgt/LIBRARY_OUTPUT_DIRECTORY_CONFIG.rst b/Help/prop_tgt/LIBRARY_OUTPUT_DIRECTORY_CONFIG.rst index 28dd404..5cefc38 100644 --- a/Help/prop_tgt/LIBRARY_OUTPUT_DIRECTORY_CONFIG.rst +++ b/Help/prop_tgt/LIBRARY_OUTPUT_DIRECTORY_CONFIG.rst @@ -6,7 +6,8 @@ Per-configuration output directory for This is a per-configuration version of the :prop_tgt:`LIBRARY_OUTPUT_DIRECTORY` target property, but -multi-configuration generators (VS, Xcode) do NOT append a +multi-configuration generators (:ref:`Visual Studio Generators`, +:generator:`Xcode`) do NOT append a per-configuration subdirectory to the specified directory. This property is initialized by the value of the :variable:`CMAKE_LIBRARY_OUTPUT_DIRECTORY_` variable if diff --git a/Help/prop_tgt/LINKER_LANGUAGE.rst b/Help/prop_tgt/LINKER_LANGUAGE.rst index b1ca867..b0a572b 100644 --- a/Help/prop_tgt/LINKER_LANGUAGE.rst +++ b/Help/prop_tgt/LINKER_LANGUAGE.rst @@ -8,7 +8,7 @@ whose compiler is used to link the target (such as "C" or "CXX"). A typical value for an executable is the language of the source file providing the program entry point (main). If not set, the language with the highest linker preference value is the default. See -documentation of CMAKE__LINKER_PREFERENCE variables. +documentation of :variable:`CMAKE__LINKER_PREFERENCE` variables. If this property is not set by the user, it will be calculated at generate-time by CMake. diff --git a/Help/prop_tgt/LINK_DEPENDS.rst b/Help/prop_tgt/LINK_DEPENDS.rst index 3ab8658..e59d4c0 100644 --- a/Help/prop_tgt/LINK_DEPENDS.rst +++ b/Help/prop_tgt/LINK_DEPENDS.rst @@ -7,7 +7,8 @@ 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 supported only by Makefile and Ninja generators. It is +This property is supported only by :generator:`Ninja` and +:ref:`Makefile Generators`. It is intended to specify dependencies on "linker scripts" for custom Makefile link rules. diff --git a/Help/prop_tgt/LINK_FLAGS_CONFIG.rst b/Help/prop_tgt/LINK_FLAGS_CONFIG.rst index e3918ca..68c3129 100644 --- a/Help/prop_tgt/LINK_FLAGS_CONFIG.rst +++ b/Help/prop_tgt/LINK_FLAGS_CONFIG.rst @@ -1,8 +1,8 @@ LINK_FLAGS_ ------------------- -Per-configuration linker flags for a shared library, module or executable -target. +Per-configuration linker flags for a ``SHARED`` library, ``MODULE`` or +``EXECUTABLE`` target. This is the configuration-specific version of :prop_tgt:`LINK_FLAGS`. diff --git a/Help/prop_tgt/LINK_INTERFACE_MULTIPLICITY.rst b/Help/prop_tgt/LINK_INTERFACE_MULTIPLICITY.rst index 4e26388..b798af9 100644 --- a/Help/prop_tgt/LINK_INTERFACE_MULTIPLICITY.rst +++ b/Help/prop_tgt/LINK_INTERFACE_MULTIPLICITY.rst @@ -1,9 +1,9 @@ LINK_INTERFACE_MULTIPLICITY --------------------------- -Repetition count for STATIC libraries with cyclic dependencies. +Repetition count for ``STATIC`` libraries with cyclic dependencies. -When linking to a STATIC library target with cyclic dependencies the +When linking to a ``STATIC`` library target with cyclic dependencies the linker may need to scan more than once through the archives in the strongly connected component of the dependency graph. CMake by default constructs the link line so that the linker will scan through diff --git a/Help/prop_tgt/LINK_INTERFACE_MULTIPLICITY_CONFIG.rst b/Help/prop_tgt/LINK_INTERFACE_MULTIPLICITY_CONFIG.rst index 5ea4a45..7c9461f 100644 --- a/Help/prop_tgt/LINK_INTERFACE_MULTIPLICITY_CONFIG.rst +++ b/Help/prop_tgt/LINK_INTERFACE_MULTIPLICITY_CONFIG.rst @@ -1,8 +1,8 @@ LINK_INTERFACE_MULTIPLICITY_ ------------------------------------ -Per-configuration repetition count for cycles of STATIC libraries. +Per-configuration repetition count for cycles of ``STATIC`` libraries. This is the configuration-specific version of -LINK_INTERFACE_MULTIPLICITY. If set, this property completely +:prop_tgt:`LINK_INTERFACE_MULTIPLICITY`. If set, this property completely overrides the generic property for the named configuration. diff --git a/Help/prop_tgt/LINK_SEARCH_END_STATIC.rst b/Help/prop_tgt/LINK_SEARCH_END_STATIC.rst index cf9c871..fecbb14 100644 --- a/Help/prop_tgt/LINK_SEARCH_END_STATIC.rst +++ b/Help/prop_tgt/LINK_SEARCH_END_STATIC.rst @@ -3,16 +3,17 @@ LINK_SEARCH_END_STATIC End a link line such that static system libraries are used. -Some linkers support switches such as -Bstatic and -Bdynamic to -determine whether to use static or shared libraries for -lXXX options. +Some linkers support switches such as ``-Bstatic`` and ``-Bdynamic`` to +determine whether to use static or shared libraries for ``-lXXX`` options. CMake uses these options to set the link type for libraries whose full paths are not known or (in some cases) are in implicit link directories for the platform. By default CMake adds an option at the end of the library list (if necessary) to set the linker search type back to its starting type. This property switches the final linker -search type to -Bstatic regardless of how it started. +search type to ``-Bstatic`` regardless of how it started. This property is initialized by the value of the variable -CMAKE_LINK_SEARCH_END_STATIC if it is set when a target is created. +:variable:`CMAKE_LINK_SEARCH_END_STATIC` if it is set +when a target is created. -See also LINK_SEARCH_START_STATIC. +See also :prop_tgt:`LINK_SEARCH_START_STATIC`. diff --git a/Help/prop_tgt/LINK_SEARCH_START_STATIC.rst b/Help/prop_tgt/LINK_SEARCH_START_STATIC.rst index 2e0f9bd..83cf231 100644 --- a/Help/prop_tgt/LINK_SEARCH_START_STATIC.rst +++ b/Help/prop_tgt/LINK_SEARCH_START_STATIC.rst @@ -3,17 +3,18 @@ LINK_SEARCH_START_STATIC Assume the linker looks for static libraries by default. -Some linkers support switches such as -Bstatic and -Bdynamic to -determine whether to use static or shared libraries for -lXXX options. +Some linkers support switches such as ``-Bstatic`` and ``-Bdynamic`` to +determine whether to use static or shared libraries for ``-lXXX`` options. CMake uses these options to set the link type for libraries whose full paths are not known or (in some cases) are in implicit link directories for the platform. By default the linker search type is -assumed to be -Bdynamic at the beginning of the library list. This -property switches the assumption to -Bstatic. It is intended for use -when linking an executable statically (e.g. with the GNU -static +assumed to be ``-Bdynamic`` at the beginning of the library list. This +property switches the assumption to ``-Bstatic``. It is intended for use +when linking an executable statically (e.g. with the GNU ``-static`` option). This property is initialized by the value of the variable -CMAKE_LINK_SEARCH_START_STATIC if it is set when a target is created. + :variable:`CMAKE_LINK_SEARCH_START_STATIC` if it is set + when a target is created. -See also LINK_SEARCH_END_STATIC. +See also :prop_tgt:`LINK_SEARCH_END_STATIC`. diff --git a/Help/prop_tgt/LOCATION.rst b/Help/prop_tgt/LOCATION.rst index 16d5696..d058064 100644 --- a/Help/prop_tgt/LOCATION.rst +++ b/Help/prop_tgt/LOCATION.rst @@ -4,24 +4,25 @@ LOCATION Read-only location of a target on disk. For an imported target, this read-only property returns the value of -the LOCATION_ property for an unspecified configuration - provided by the target. +the ``LOCATION_`` property for an unspecified configuration +```` provided by the target. For a non-imported target, this property is provided for compatibility with CMake 2.4 and below. It was meant to get the location of an -executable target's output file for use in add_custom_command. The +executable target's output file for use in :command:`add_custom_command`. The path may contain a build-system-specific portion that is replaced at build time with the configuration getting built (such as -"$(ConfigurationName)" in VS). In CMake 2.6 and above -add_custom_command automatically recognizes a target name in its -COMMAND and DEPENDS options and computes the target location. In -CMake 2.8.4 and above add_custom_command recognizes generator -expressions to refer to target locations anywhere in the command. +``$(ConfigurationName)`` in VS). In CMake 2.6 and above +:command:`add_custom_command` automatically recognizes a target name in its +``COMMAND`` and ``DEPENDS`` options and computes the target location. In +CMake 2.8.4 and above :command:`add_custom_command` recognizes +:manual:`generator expressions ` +to refer to target locations anywhere in the command. Therefore this property is not needed for creating custom commands. Do not set properties that affect the location of a target after reading this property. These include properties whose names match -"(RUNTIME|LIBRARY|ARCHIVE)_OUTPUT_(NAME|DIRECTORY)(_)?", +``(RUNTIME|LIBRARY|ARCHIVE)_OUTPUT_(NAME|DIRECTORY)(_)?``, ``(IMPLIB_)?(PREFIX|SUFFIX)``, or "LINKER_LANGUAGE". Failure to follow this rule is not diagnosed and leaves the location of the target undefined. diff --git a/Help/prop_tgt/LOCATION_CONFIG.rst b/Help/prop_tgt/LOCATION_CONFIG.rst index ac6bdb7..67de8ed 100644 --- a/Help/prop_tgt/LOCATION_CONFIG.rst +++ b/Help/prop_tgt/LOCATION_CONFIG.rst @@ -4,17 +4,17 @@ LOCATION_ Read-only property providing a target location on disk. A read-only property that indicates where a target's main file is -located on disk for the configuration . The property is +located on disk for the configuration ````. The property is defined only for library and executable targets. An imported target may provide a set of configurations different from that of the importing project. By default CMake looks for an exact-match but otherwise uses an arbitrary available configuration. Use the -MAP_IMPORTED_CONFIG_ property to map imported configurations -explicitly. +:prop_tgt:`MAP_IMPORTED_CONFIG_` property to map imported +configurations explicitly. Do not set properties that affect the location of a target after reading this property. These include properties whose names match -"(RUNTIME|LIBRARY|ARCHIVE)_OUTPUT_(NAME|DIRECTORY)(_)?", -``(IMPLIB_)?(PREFIX|SUFFIX)``, or "LINKER_LANGUAGE". Failure to follow -this rule is not diagnosed and leaves the location of the target -undefined. +``(RUNTIME|LIBRARY|ARCHIVE)_OUTPUT_(NAME|DIRECTORY)(_)?``, +``(IMPLIB_)?(PREFIX|SUFFIX)``, or :prop_tgt:`LINKER_LANGUAGE`. +Failure to follow this rule is not diagnosed and leaves +the location of the target undefined. diff --git a/Help/prop_tgt/NO_SONAME.rst b/Help/prop_tgt/NO_SONAME.rst index ee45ed8..d381a9c 100644 --- a/Help/prop_tgt/NO_SONAME.rst +++ b/Help/prop_tgt/NO_SONAME.rst @@ -1,10 +1,10 @@ NO_SONAME --------- -Whether to set "soname" when linking a shared library. +Whether to set ``soname`` when linking a shared library. -Enable this boolean property if a generated shared library -should not have "soname" set. Default is to set "soname" on all +Enable this boolean property if a generated ``SHARED`` library +should not have ``soname`` set. Default is to set ``soname`` on all shared libraries as long as the platform supports it. Generally, use this property only for leaf private libraries or plugins. If you use it on normal shared libraries which other targets diff --git a/Help/prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG.rst b/Help/prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG.rst index 77fda90..6c55083 100644 --- a/Help/prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG.rst +++ b/Help/prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG.rst @@ -5,7 +5,8 @@ Per-configuration output directory for the MS debug symbol ``.pdb`` file generated by the linker for an executable or shared library target. This is a per-configuration version of :prop_tgt:`PDB_OUTPUT_DIRECTORY`, -but multi-configuration generators (VS, Xcode) do NOT append a +but multi-configuration generators (:ref:`Visual Studio Generators`, +:generator:`Xcode`) do NOT append a per-configuration subdirectory to the specified directory. This property is initialized by the value of the :variable:`CMAKE_PDB_OUTPUT_DIRECTORY_` variable if it is diff --git a/Help/prop_tgt/POST_INSTALL_SCRIPT.rst b/Help/prop_tgt/POST_INSTALL_SCRIPT.rst index f1adb40..23935bc 100644 --- a/Help/prop_tgt/POST_INSTALL_SCRIPT.rst +++ b/Help/prop_tgt/POST_INSTALL_SCRIPT.rst @@ -3,7 +3,7 @@ POST_INSTALL_SCRIPT Deprecated install support. -The PRE_INSTALL_SCRIPT and POST_INSTALL_SCRIPT properties are the old -way to specify CMake scripts to run before and after installing a -target. They are used only when the old INSTALL_TARGETS command is -used to install the target. Use the INSTALL command instead. +The :prop_tgt:`PRE_INSTALL_SCRIPT` and ``POST_INSTALL_SCRIPT`` properties are +the old way to specify CMake scripts to run before and after installing a +target. They are used only when the old ``INSTALL_TARGETS`` command is +used to install the target. Use the :command:`install` command instead. diff --git a/Help/prop_tgt/PREFIX.rst b/Help/prop_tgt/PREFIX.rst index a165104..a401292 100644 --- a/Help/prop_tgt/PREFIX.rst +++ b/Help/prop_tgt/PREFIX.rst @@ -4,4 +4,4 @@ PREFIX What comes before the library name. A target property that can be set to override the prefix (such as -"lib") on a library name. +``lib``) on a library name. diff --git a/Help/prop_tgt/PRE_INSTALL_SCRIPT.rst b/Help/prop_tgt/PRE_INSTALL_SCRIPT.rst index 113d7c5..43432f4 100644 --- a/Help/prop_tgt/PRE_INSTALL_SCRIPT.rst +++ b/Help/prop_tgt/PRE_INSTALL_SCRIPT.rst @@ -3,7 +3,7 @@ PRE_INSTALL_SCRIPT Deprecated install support. -The PRE_INSTALL_SCRIPT and POST_INSTALL_SCRIPT properties are the old -way to specify CMake scripts to run before and after installing a -target. They are used only when the old INSTALL_TARGETS command is -used to install the target. Use the INSTALL command instead. +The ``PRE_INSTALL_SCRIPT`` and :prop_tgt:`POST_INSTALL_SCRIPT` properties are +the old way to specify CMake scripts to run before and after installing a +target. They are used only when the old ``INSTALL_TARGETS`` command is +used to install the target. Use the :command:`install` command instead. diff --git a/Help/prop_tgt/PRIVATE_HEADER.rst b/Help/prop_tgt/PRIVATE_HEADER.rst index 2bd4079..23e1f8e 100644 --- a/Help/prop_tgt/PRIVATE_HEADER.rst +++ b/Help/prop_tgt/PRIVATE_HEADER.rst @@ -8,4 +8,4 @@ frameworks on macOS, iOS and normal shared libraries on other platforms. This property may be set to a list of header files to be placed in the PrivateHeaders directory inside the framework folder. On non-Apple platforms these headers may be installed using the ``PRIVATE_HEADER`` -option to the ``install(TARGETS)`` command. +option to the :command:`install(TARGETS)` command. diff --git a/Help/prop_tgt/PUBLIC_HEADER.rst b/Help/prop_tgt/PUBLIC_HEADER.rst index 549ac7c..915e39c 100644 --- a/Help/prop_tgt/PUBLIC_HEADER.rst +++ b/Help/prop_tgt/PUBLIC_HEADER.rst @@ -8,4 +8,4 @@ frameworks on macOS, iOS and normal shared libraries on other platforms. This property may be set to a list of header files to be placed in the ``Headers`` directory inside the framework folder. On non-Apple platforms these headers may be installed using the ``PUBLIC_HEADER`` option to the -``install(TARGETS)`` command. +:command:`install(TARGETS)` command. diff --git a/Help/prop_tgt/RESOURCE.rst b/Help/prop_tgt/RESOURCE.rst index 55ae774..6ada637 100644 --- a/Help/prop_tgt/RESOURCE.rst +++ b/Help/prop_tgt/RESOURCE.rst @@ -9,30 +9,27 @@ or normal shared libraries on other platforms. This property may be set to a list of files to be placed in the corresponding directory (eg. ``Resources`` directory for macOS) inside the bundle. On non-Apple platforms these files may be installed using the ``RESOURCE`` -option to the ``install(TARGETS)`` command. +option to the :command:`install(TARGETS)` command. -Following example of Application Bundle: +Following example of Application Bundle:: .. code-block:: cmake add_executable(ExecutableTarget addDemo.c resourcefile.txt - appresourcedir/appres.txt - ) + appresourcedir/appres.txt) target_link_libraries(ExecutableTarget heymath mul) set(RESOURCE_FILES resourcefile.txt - appresourcedir/appres.txt - ) + appresourcedir/appres.txt) set_target_properties(ExecutableTarget PROPERTIES MACOSX_BUNDLE TRUE MACOSX_FRAMEWORK_IDENTIFIER org.cmake.ExecutableTarget - RESOURCE "${RESOURCE_FILES}" - ) + RESOURCE "${RESOURCE_FILES}") will produce flat structure for iOS systems:: @@ -53,7 +50,7 @@ For macOS systems it will produce following directory structure:: appres.txt resourcefile.txt -For Linux, such cmake script produce following files:: +For Linux, such CMake script produce following files:: ExecutableTarget Resources diff --git a/Help/prop_tgt/RUNTIME_OUTPUT_DIRECTORY_CONFIG.rst b/Help/prop_tgt/RUNTIME_OUTPUT_DIRECTORY_CONFIG.rst index 94fb277..6727754 100644 --- a/Help/prop_tgt/RUNTIME_OUTPUT_DIRECTORY_CONFIG.rst +++ b/Help/prop_tgt/RUNTIME_OUTPUT_DIRECTORY_CONFIG.rst @@ -6,7 +6,8 @@ Per-configuration output directory for This is a per-configuration version of the :prop_tgt:`RUNTIME_OUTPUT_DIRECTORY` target property, but -multi-configuration generators (VS, Xcode) do NOT append a +multi-configuration generators (:ref:`Visual Studio Generators`, +:generator:`Xcode`) do NOT append a per-configuration subdirectory to the specified directory. This property is initialized by the value of the :variable:`CMAKE_RUNTIME_OUTPUT_DIRECTORY_` variable if diff --git a/Help/prop_tgt/SKIP_BUILD_RPATH.rst b/Help/prop_tgt/SKIP_BUILD_RPATH.rst index a91fa9c..7086b1b 100644 --- a/Help/prop_tgt/SKIP_BUILD_RPATH.rst +++ b/Help/prop_tgt/SKIP_BUILD_RPATH.rst @@ -3,7 +3,7 @@ SKIP_BUILD_RPATH Should rpaths be used for the build tree. -SKIP_BUILD_RPATH is a boolean specifying whether to skip automatic +``SKIP_BUILD_RPATH`` is a boolean specifying whether to skip automatic generation of an rpath allowing the target to run from the build tree. This property is initialized by the value of the variable -CMAKE_SKIP_BUILD_RPATH if it is set when a target is created. +:variable:`CMAKE_SKIP_BUILD_RPATH` if it is set when a target is created. diff --git a/Help/prop_tgt/SUFFIX.rst b/Help/prop_tgt/SUFFIX.rst index 70844be..32ec429 100644 --- a/Help/prop_tgt/SUFFIX.rst +++ b/Help/prop_tgt/SUFFIX.rst @@ -4,4 +4,4 @@ SUFFIX What comes after the target name. A target property that can be set to override the suffix (such as -".so" or ".exe") on the name of a library, module or executable. +``.so`` or ``.exe``) on the name of a library, module or executable. diff --git a/Help/prop_tgt/TYPE.rst b/Help/prop_tgt/TYPE.rst index 1cd9db4..3136d11 100644 --- a/Help/prop_tgt/TYPE.rst +++ b/Help/prop_tgt/TYPE.rst @@ -4,6 +4,6 @@ TYPE The type of the target. This read-only property can be used to test the type of the given -target. It will be one of STATIC_LIBRARY, MODULE_LIBRARY, -SHARED_LIBRARY, OBJECT_LIBRARY, INTERFACE_LIBRARY, EXECUTABLE or one -of the internal target types. +target. It will be one of ``STATIC_LIBRARY``, ``MODULE_LIBRARY``, +``SHARED_LIBRARY``, ``OBJECT_LIBRARY``, ``INTERFACE_LIBRARY``, ``EXECUTABLE`` +or one of the internal target types. diff --git a/Help/prop_tgt/XCODE_ATTRIBUTE_an-attribute.rst b/Help/prop_tgt/XCODE_ATTRIBUTE_an-attribute.rst index 7e00ac4..71858c5 100644 --- a/Help/prop_tgt/XCODE_ATTRIBUTE_an-attribute.rst +++ b/Help/prop_tgt/XCODE_ATTRIBUTE_an-attribute.rst @@ -3,8 +3,8 @@ XCODE_ATTRIBUTE_ Set Xcode target attributes directly. -Tell the Xcode generator to set '' to a given value in -the generated Xcode project. Ignored on other generators. +Tell the :generator:`Xcode` generator to set '' to a given +value in the generated Xcode project. Ignored on other generators. See the :variable:`CMAKE_XCODE_ATTRIBUTE_` variable to set attributes on all targets in a directory tree. diff --git a/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst b/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst index a56a210..0adb5db 100644 --- a/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst +++ b/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst @@ -1,7 +1,7 @@ XCODE_GENERATE_SCHEME --------------------- -If enabled, the Xcode generator will generate schema files. These +If enabled, the :generator:`Xcode` generator will generate schema files. These are useful to invoke analyze, archive, build-for-testing and test actions from the command line. diff --git a/Help/variable/CMAKE_CROSSCOMPILING.rst b/Help/variable/CMAKE_CROSSCOMPILING.rst index 9e96769..7e6ec33 100644 --- a/Help/variable/CMAKE_CROSSCOMPILING.rst +++ b/Help/variable/CMAKE_CROSSCOMPILING.rst @@ -19,8 +19,9 @@ macOS are handled differently to other cross compiling scenarios. Rather than relying on :variable:`CMAKE_SYSTEM_NAME` to select the target platform, Apple device builds use :variable:`CMAKE_OSX_SYSROOT` to select the appropriate SDK, which indirectly determines the target platform. Furthermore, when using the -Xcode generator, developers can switch between device and simulator builds at -build time rather than having a single choice at configure time, so the concept +:generator:`Xcode` generator, developers can switch between device and +simulator builds at build time rather than having a single +choice at configure time, so the concept of whether the build is cross compiling or not is more complex. Therefore, the use of ``CMAKE_CROSSCOMPILING`` is not recommended for projects targeting Apple devices. diff --git a/Help/variable/CMAKE_XCODE_GENERATE_SCHEME.rst b/Help/variable/CMAKE_XCODE_GENERATE_SCHEME.rst index 1fb84d7..5b1a003 100644 --- a/Help/variable/CMAKE_XCODE_GENERATE_SCHEME.rst +++ b/Help/variable/CMAKE_XCODE_GENERATE_SCHEME.rst @@ -1,7 +1,7 @@ CMAKE_XCODE_GENERATE_SCHEME --------------------------- -If enabled, the Xcode generator will generate schema files. These +If enabled, the :generator:`Xcode` generator will generate schema files. These are useful to invoke analyze, archive, build-for-testing and test actions from the command line. diff --git a/Help/variable/XCODE_VERSION.rst b/Help/variable/XCODE_VERSION.rst index b85d41e..9caf19a 100644 --- a/Help/variable/XCODE_VERSION.rst +++ b/Help/variable/XCODE_VERSION.rst @@ -3,5 +3,5 @@ XCODE_VERSION Version of Xcode (:generator:`Xcode` generator only). -Under the Xcode generator, this is the version of Xcode as specified -in ``Xcode.app/Contents/version.plist`` (such as ``3.1.2``). +Under the :generator:`Xcode` generator, this is the version of Xcode +as specified in ``Xcode.app/Contents/version.plist`` (such as ``3.1.2``). ----------------------------------------------------------------------- Summary of changes: Help/command/get_cmake_property.rst | 2 +- Help/command/get_target_property.rst | 2 +- Help/command/if.rst | 2 +- Help/command/include_external_msproject.rst | 2 +- Help/command/install_files.rst | 2 +- Help/command/math.rst | 2 +- Help/command/output_required_files.rst | 6 ++-- Help/command/target_link_libraries.rst | 2 +- Help/cpack_gen/bundle.rst | 20 ++++++----- Help/cpack_gen/external.rst | 2 +- Help/cpack_gen/rpm.rst | 40 +++++++++++----------- Help/generator/CodeBlocks.rst | 6 ++-- Help/generator/CodeLite.rst | 6 ++-- Help/generator/Eclipse CDT4.rst | 2 +- Help/generator/Green Hills MULTI.rst | 5 +-- Help/generator/Kate.rst | 8 ++--- Help/generator/MSYS Makefiles.rst | 3 +- Help/generator/MinGW Makefiles.rst | 3 +- Help/generator/Ninja.rst | 4 +-- Help/generator/Sublime Text 2.rst | 10 +++--- Help/generator/Unix Makefiles.rst | 2 +- Help/generator/VS_TOOLSET_HOST_ARCH.txt | 4 +-- Help/module/CPackWIX.rst | 3 +- Help/policy/CMP0008.rst | 5 +-- Help/policy/CMP0014.rst | 8 ++--- Help/policy/CMP0015.rst | 14 ++++---- Help/policy/CMP0017.rst | 4 +-- Help/policy/CMP0037.rst | 5 +-- Help/prop_dir/ADDITIONAL_MAKE_CLEAN_FILES.rst | 2 +- .../IMPLICIT_DEPENDS_INCLUDE_TRANSFORM.rst | 10 +++--- .../INTERPROCEDURAL_OPTIMIZATION_CONFIG.rst | 2 +- Help/prop_dir/MACROS.rst | 2 +- Help/prop_dir/TESTS.rst | 3 +- Help/prop_dir/VS_GLOBAL_SECTION_POST_section.rst | 12 +++---- Help/prop_dir/VS_GLOBAL_SECTION_PRE_section.rst | 4 +-- Help/prop_dir/VS_STARTUP_PROJECT.rst | 2 +- Help/prop_gbl/ALLOW_DUPLICATE_CUSTOM_TARGETS.rst | 16 +++++---- Help/prop_gbl/DISABLED_FEATURES.rst | 6 ++-- Help/prop_gbl/ENABLED_FEATURES.rst | 6 ++-- Help/prop_gbl/USE_FOLDERS.rst | 4 +-- .../XCODE_EMIT_EFFECTIVE_PLATFORM_NAME.rst | 7 ++-- Help/prop_inst/CPACK_DESKTOP_SHORTCUTS.rst | 4 +-- Help/prop_inst/CPACK_NEVER_OVERWRITE.rst | 2 +- Help/prop_inst/CPACK_PERMANENT.rst | 2 +- Help/prop_inst/CPACK_STARTUP_SHORTCUTS.rst | 4 +-- Help/prop_inst/CPACK_START_MENU_SHORTCUTS.rst | 4 +-- Help/prop_inst/CPACK_WIX_ACL.rst | 2 ++ Help/prop_sf/COMPILE_DEFINITIONS.rst | 10 +++--- Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst | 6 ++-- Help/prop_sf/EXTERNAL_OBJECT.rst | 2 +- Help/prop_sf/Fortran_FORMAT.rst | 7 ++-- Help/prop_sf/KEEP_EXTENSION.rst | 2 +- Help/prop_sf/LABELS.rst | 2 +- Help/prop_sf/LANGUAGE.rst | 3 +- Help/prop_sf/OBJECT_OUTPUTS.rst | 6 ++-- Help/prop_sf/SYMBOLIC.rst | 2 +- Help/prop_sf/VS_XAML_TYPE.rst | 4 +-- Help/prop_sf/WRAP_EXCLUDE.rst | 4 +-- Help/prop_sf/XCODE_EXPLICIT_FILE_TYPE.rst | 2 +- Help/prop_sf/XCODE_FILE_ATTRIBUTES.rst | 4 +-- Help/prop_sf/XCODE_LAST_KNOWN_FILE_TYPE.rst | 4 +-- Help/prop_test/COST.rst | 5 +-- Help/prop_test/DISABLED.rst | 14 ++++---- Help/prop_test/ENVIRONMENT.rst | 2 +- Help/prop_test/MEASUREMENT.rst | 8 ++--- Help/prop_test/RUN_SERIAL.rst | 2 +- Help/prop_test/SKIP_RETURN_CODE.rst | 2 +- .../COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst | 2 +- Help/prop_tgt/DEBUG_POSTFIX.rst | 6 ++-- Help/prop_tgt/DEFINE_SYMBOL.rst | 4 +-- Help/prop_tgt/DOTNET_TARGET_FRAMEWORK_VERSION.rst | 2 +- Help/prop_tgt/EXCLUDE_FROM_DEFAULT_BUILD.rst | 6 ++-- .../prop_tgt/EXCLUDE_FROM_DEFAULT_BUILD_CONFIG.rst | 7 ++-- Help/prop_tgt/EXPORT_NAME.rst | 2 +- Help/prop_tgt/EchoString.rst | 4 +-- Help/prop_tgt/FOLDER.rst | 6 ++-- Help/prop_tgt/Fortran_FORMAT.rst | 6 ++-- Help/prop_tgt/Fortran_MODULE_DIRECTORY.rst | 4 +-- Help/prop_tgt/GENERATOR_FILE_NAME.rst | 2 +- Help/prop_tgt/GHS_INTEGRITY_APP.rst | 2 +- Help/prop_tgt/GNUtoMS.rst | 16 ++++----- Help/prop_tgt/HAS_CXX.rst | 4 +-- Help/prop_tgt/IMPORTED.rst | 4 +-- Help/prop_tgt/IMPORTED_IMPLIB.rst | 4 +-- Help/prop_tgt/IMPORTED_IMPLIB_CONFIG.rst | 2 +- .../prop_tgt/IMPORTED_LINK_DEPENDENT_LIBRARIES.rst | 2 +- .../IMPORTED_LINK_DEPENDENT_LIBRARIES_CONFIG.rst | 2 +- .../prop_tgt/IMPORTED_LINK_INTERFACE_LANGUAGES.rst | 6 ++-- .../IMPORTED_LINK_INTERFACE_LANGUAGES_CONFIG.rst | 2 +- .../prop_tgt/IMPORTED_LINK_INTERFACE_LIBRARIES.rst | 12 +++---- .../IMPORTED_LINK_INTERFACE_LIBRARIES_CONFIG.rst | 6 ++-- .../IMPORTED_LINK_INTERFACE_MULTIPLICITY.rst | 4 +-- ...IMPORTED_LINK_INTERFACE_MULTIPLICITY_CONFIG.rst | 2 +- Help/prop_tgt/IMPORTED_LOCATION.rst | 18 +++++----- Help/prop_tgt/IMPORTED_LOCATION_CONFIG.rst | 2 +- Help/prop_tgt/IMPORTED_NO_SONAME.rst | 6 ++-- Help/prop_tgt/IMPORTED_NO_SONAME_CONFIG.rst | 2 +- Help/prop_tgt/IMPORTED_SONAME.rst | 4 +-- Help/prop_tgt/IMPORTED_SONAME_CONFIG.rst | 2 +- Help/prop_tgt/IMPORT_PREFIX.rst | 6 ++-- Help/prop_tgt/IMPORT_SUFFIX.rst | 8 ++--- Help/prop_tgt/INCLUDE_DIRECTORIES.rst | 2 +- Help/prop_tgt/INSTALL_NAME_DIR.rst | 6 ++-- Help/prop_tgt/INSTALL_RPATH.rst | 4 +-- Help/prop_tgt/INSTALL_RPATH_USE_LINK_PATH.rst | 6 ++-- Help/prop_tgt/INTERFACE_LINK_DEPENDS.rst | 7 ++-- .../INTERPROCEDURAL_OPTIMIZATION_CONFIG.rst | 2 +- Help/prop_tgt/LIBRARY_OUTPUT_DIRECTORY_CONFIG.rst | 3 +- Help/prop_tgt/LINKER_LANGUAGE.rst | 2 +- Help/prop_tgt/LINK_DEPENDS.rst | 3 +- Help/prop_tgt/LINK_FLAGS_CONFIG.rst | 4 +-- Help/prop_tgt/LINK_INTERFACE_MULTIPLICITY.rst | 4 +-- .../LINK_INTERFACE_MULTIPLICITY_CONFIG.rst | 4 +-- Help/prop_tgt/LINK_SEARCH_END_STATIC.rst | 11 +++--- Help/prop_tgt/LINK_SEARCH_START_STATIC.rst | 15 ++++---- Help/prop_tgt/LOCATION.rst | 19 +++++----- Help/prop_tgt/LOCATION_CONFIG.rst | 14 ++++---- Help/prop_tgt/NO_SONAME.rst | 6 ++-- Help/prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG.rst | 3 +- Help/prop_tgt/POST_INSTALL_SCRIPT.rst | 8 ++--- Help/prop_tgt/PREFIX.rst | 2 +- Help/prop_tgt/PRE_INSTALL_SCRIPT.rst | 8 ++--- Help/prop_tgt/PRIVATE_HEADER.rst | 2 +- Help/prop_tgt/PUBLIC_HEADER.rst | 2 +- Help/prop_tgt/RESOURCE.rst | 15 ++++---- Help/prop_tgt/RUNTIME_OUTPUT_DIRECTORY_CONFIG.rst | 3 +- Help/prop_tgt/SKIP_BUILD_RPATH.rst | 4 +-- Help/prop_tgt/SUFFIX.rst | 2 +- Help/prop_tgt/TYPE.rst | 6 ++-- Help/prop_tgt/XCODE_ATTRIBUTE_an-attribute.rst | 4 +-- Help/prop_tgt/XCODE_GENERATE_SCHEME.rst | 2 +- Help/variable/CMAKE_CROSSCOMPILING.rst | 5 +-- Help/variable/CMAKE_XCODE_GENERATE_SCHEME.rst | 2 +- Help/variable/XCODE_VERSION.rst | 4 +-- Modules/Compiler/ARMCC-DetermineCompiler.cmake | 2 +- Modules/InstallRequiredSystemLibraries.cmake | 23 ++++++++----- Modules/Platform/Windows-MSVC.cmake | 5 ++- 137 files changed, 386 insertions(+), 354 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Apr 4 11:53:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 4 Apr 2019 11:53:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.14.1-5-g192aa50 Message-ID: <20190404155304.6B11A11DDAC@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 192aa506c66d5269e10d87f1a67df5397325a9af (commit) via d2473769e77f9cf9802c71effadb5e1469fcd625 (commit) via 33ee7793300f6ef9f5206e5a0539c192affa3d23 (commit) via f28e7fc1a51d5dfa81e2844c51eb811835e99583 (commit) via d8cf8380fb9a539b3b2b6876f2eb34fc9bddbdac (commit) from 3c9dec0bdc11a69afcbaa93a0e61dc71cddd5491 (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/ARMCC-DetermineCompiler.cmake | 2 +- Modules/InstallRequiredSystemLibraries.cmake | 23 ++++++++++++++--------- Modules/Platform/Windows-MSVC.cmake | 5 ++++- 3 files changed, 19 insertions(+), 11 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Apr 4 12:53:02 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 4 Apr 2019 12:53:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-608-g8c28e63 Message-ID: <20190404165302.93EF61033A6@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 8c28e63cb4da99dbb894573a996c27e260b5baeb (commit) via 78ac8cb04a0723b10a9225e97a9e04c126a38a99 (commit) from 56abc31270cbe60845021107383f1cede0ed075e (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=8c28e63cb4da99dbb894573a996c27e260b5baeb commit 8c28e63cb4da99dbb894573a996c27e260b5baeb Merge: 56abc31 78ac8cb Author: Brad King AuthorDate: Thu Apr 4 16:51:34 2019 +0000 Commit: Kitware Robot CommitDate: Thu Apr 4 12:51:41 2019 -0400 Merge topic 'if-EXISTS-doc' 78ac8cb04a Help: clarify if(EXISTS) operation for symlinks Acked-by: Kitware Robot Merge-request: !3189 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=78ac8cb04a0723b10a9225e97a9e04c126a38a99 commit 78ac8cb04a0723b10a9225e97a9e04c126a38a99 Author: Shoaib Meenai AuthorDate: Wed Apr 3 17:25:52 2019 -0700 Commit: Shoaib Meenai CommitDate: Wed Apr 3 17:25:52 2019 -0700 Help: clarify if(EXISTS) operation for symlinks if(EXISTS) resolves symlinks; note this explicitly in its documentation. diff --git a/Help/command/if.rst b/Help/command/if.rst index a48a0fa..b79fd6c 100644 --- a/Help/command/if.rst +++ b/Help/command/if.rst @@ -88,7 +88,9 @@ Possible conditions are: ``if(EXISTS path-to-file-or-directory)`` True if the named file or directory exists. Behavior is well-defined - only for full paths. + only for full paths. Resolves symbolic links, i.e. if the named file or + directory is a symbolic link, returns true if the target of the + symbolic link exists. ``if(file1 IS_NEWER_THAN file2)`` True if ``file1`` is newer than ``file2`` or if one of the two files doesn't ----------------------------------------------------------------------- Summary of changes: Help/command/if.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Apr 5 00:03:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 5 Apr 2019 00:03:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-609-g52fb35b Message-ID: <20190405040306.45D8E1035DA@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 52fb35bd69ec2fa1a5307695cb22c3f125debf4f (commit) from 8c28e63cb4da99dbb894573a996c27e260b5baeb (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=52fb35bd69ec2fa1a5307695cb22c3f125debf4f commit 52fb35bd69ec2fa1a5307695cb22c3f125debf4f Author: Kitware Robot AuthorDate: Fri Apr 5 00:01:07 2019 -0400 Commit: Kitware Robot CommitDate: Fri Apr 5 00:01:07 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 3ba392e..f4dacb4 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 14) -set(CMake_VERSION_PATCH 20190404) +set(CMake_VERSION_PATCH 20190405) #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 Apr 5 08:53:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 5 Apr 2019 08:53:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-612-gffcb4f7 Message-ID: <20190405125305.9BFFA10ED9F@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 ffcb4f7ec5789fb62812b88f3909100a29277e44 (commit) via a9b38a17571bca0801594adf85fef59fac51d6ba (commit) via 2024327746747989f47dec3859e2ca4bc66267c3 (commit) from 52fb35bd69ec2fa1a5307695cb22c3f125debf4f (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=ffcb4f7ec5789fb62812b88f3909100a29277e44 commit ffcb4f7ec5789fb62812b88f3909100a29277e44 Merge: 52fb35b a9b38a1 Author: Brad King AuthorDate: Fri Apr 5 12:51:18 2019 +0000 Commit: Kitware Robot CommitDate: Fri Apr 5 08:51:25 2019 -0400 Merge topic 'rst-bad-markup-block' a9b38a1757 cmRST: Fix crash on empty markup block 2024327746 Help: Remove empty literal block markup in RESOURCE target property Acked-by: Kitware Robot Merge-request: !3197 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a9b38a17571bca0801594adf85fef59fac51d6ba commit a9b38a17571bca0801594adf85fef59fac51d6ba Author: Brad King AuthorDate: Fri Apr 5 08:13:43 2019 -0400 Commit: Brad King CommitDate: Fri Apr 5 08:18:14 2019 -0400 cmRST: Fix crash on empty markup block diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index b7216b0..2064275 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -457,6 +457,12 @@ void cmRST::UnindentLines(std::vector& lines) size_t trailingEmpty = std::distance(rit, cmFindNot(cmReverseRange(lines), std::string())); + if ((leadingEmpty + trailingEmpty) >= lines.size()) { + // All lines are empty. The markup block is empty. Leave only one. + lines.resize(1); + return; + } + std::vector::iterator contentEnd = cmRotate( lines.begin(), lines.begin() + leadingEmpty, lines.end() - trailingEmpty); lines.erase(contentEnd, lines.end()); diff --git a/Tests/CMakeLib/testRST.expect b/Tests/CMakeLib/testRST.expect index d7b91d1..c19ee94 100644 --- a/Tests/CMakeLib/testRST.expect +++ b/Tests/CMakeLib/testRST.expect @@ -83,6 +83,10 @@ or after a paragraph ending in two colons:: but not after a line ending in two colons:: in the middle of a paragraph. +A literal block can be empty:: + + + .. productionlist:: grammar: `production` production: "content rendered" diff --git a/Tests/CMakeLib/testRST.rst b/Tests/CMakeLib/testRST.rst index 633219f..d2d1140 100644 --- a/Tests/CMakeLib/testRST.rst +++ b/Tests/CMakeLib/testRST.rst @@ -90,6 +90,10 @@ or after a paragraph ending in two colons:: but not after a line ending in two colons:: in the middle of a paragraph. +A literal block can be empty:: + + + .. productionlist:: grammar: `production` production: "content rendered" https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2024327746747989f47dec3859e2ca4bc66267c3 commit 2024327746747989f47dec3859e2ca4bc66267c3 Author: Brad King AuthorDate: Fri Apr 5 08:12:39 2019 -0400 Commit: Brad King CommitDate: Fri Apr 5 08:18:14 2019 -0400 Help: Remove empty literal block markup in RESOURCE target property This was added accidentally by commit 456e0fb64f (Help: Improve documentation formating, 2019-04-01). diff --git a/Help/prop_tgt/RESOURCE.rst b/Help/prop_tgt/RESOURCE.rst index 6ada637..e5a1cb6 100644 --- a/Help/prop_tgt/RESOURCE.rst +++ b/Help/prop_tgt/RESOURCE.rst @@ -11,7 +11,7 @@ directory (eg. ``Resources`` directory for macOS) inside the bundle. On non-Apple platforms these files may be installed using the ``RESOURCE`` option to the :command:`install(TARGETS)` command. -Following example of Application Bundle:: +Following example of Application Bundle: .. code-block:: cmake ----------------------------------------------------------------------- Summary of changes: Help/prop_tgt/RESOURCE.rst | 2 +- Source/cmRST.cxx | 6 ++++++ Tests/CMakeLib/testRST.expect | 4 ++++ Tests/CMakeLib/testRST.rst | 4 ++++ 4 files changed, 15 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sat Apr 6 00:03:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 6 Apr 2019 00:03:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-613-g7a5adae Message-ID: <20190406040304.C212DFAE36@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 7a5adae94dc8ca38fb2323742c6e4164682a876f (commit) from ffcb4f7ec5789fb62812b88f3909100a29277e44 (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=7a5adae94dc8ca38fb2323742c6e4164682a876f commit 7a5adae94dc8ca38fb2323742c6e4164682a876f Author: Kitware Robot AuthorDate: Sat Apr 6 00:01:08 2019 -0400 Commit: Kitware Robot CommitDate: Sat Apr 6 00:01:08 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index f4dacb4..31c3ba8 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 14) -set(CMake_VERSION_PATCH 20190405) +set(CMake_VERSION_PATCH 20190406) #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 Apr 7 00:03:03 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 7 Apr 2019 00:03:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-614-g2f01090 Message-ID: <20190407040303.DBC60102E27@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 2f01090d81c086cffd6d4dc048a635343d7a4528 (commit) from 7a5adae94dc8ca38fb2323742c6e4164682a876f (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=2f01090d81c086cffd6d4dc048a635343d7a4528 commit 2f01090d81c086cffd6d4dc048a635343d7a4528 Author: Kitware Robot AuthorDate: Sun Apr 7 00:01:07 2019 -0400 Commit: Kitware Robot CommitDate: Sun Apr 7 00:01:07 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 31c3ba8..2050b97 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 14) -set(CMake_VERSION_PATCH 20190406) +set(CMake_VERSION_PATCH 20190407) #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 Apr 8 00:03:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 8 Apr 2019 00:03:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-615-g52aa682 Message-ID: <20190408040304.67DB4E36D1@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 52aa68228401c62dbe79c54b2b8346bdb8621dfc (commit) from 2f01090d81c086cffd6d4dc048a635343d7a4528 (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=52aa68228401c62dbe79c54b2b8346bdb8621dfc commit 52aa68228401c62dbe79c54b2b8346bdb8621dfc Author: Kitware Robot AuthorDate: Mon Apr 8 00:01:07 2019 -0400 Commit: Kitware Robot CommitDate: Mon Apr 8 00:01:07 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2050b97..9ff8d5c 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 14) -set(CMake_VERSION_PATCH 20190407) +set(CMake_VERSION_PATCH 20190408) #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 Apr 8 07:53:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 8 Apr 2019 07:53:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-622-gc756fbc Message-ID: <20190408115306.DEA6B11E231@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 c756fbce9ba94e2d7f1b787d595df24dbe99c9c1 (commit) via 99ce35ab9cbdac4a7cc626590f5e86c36ae29070 (commit) via 658efb4c1ab309646f0a29f806315f805de477a4 (commit) via 0090907e86d5e837f23fea9823664ceff6b3832f (commit) via c1d1027ac1bf922972ebb121f369ff59be27103d (commit) via a1e6b414b9ade99a8f4e6bbe9bbff43ee1a05e88 (commit) via 266dadf8683c9c0081368604c4ccae12e8ffc9f7 (commit) from 52aa68228401c62dbe79c54b2b8346bdb8621dfc (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=c756fbce9ba94e2d7f1b787d595df24dbe99c9c1 commit c756fbce9ba94e2d7f1b787d595df24dbe99c9c1 Merge: 99ce35a a1e6b41 Author: Brad King AuthorDate: Mon Apr 8 11:43:22 2019 +0000 Commit: Kitware Robot CommitDate: Mon Apr 8 07:45:13 2019 -0400 Merge topic 'ghs_os_dir' a1e6b414b9 GHS: Update GHS_BSP_NAME processing 266dadf868 GHS: Print status message regarding GHS_OS_DIR Acked-by: Kitware Robot Merge-request: !3123 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=99ce35ab9cbdac4a7cc626590f5e86c36ae29070 commit 99ce35ab9cbdac4a7cc626590f5e86c36ae29070 Merge: 658efb4 c1d1027 Author: Brad King AuthorDate: Mon Apr 8 11:42:59 2019 +0000 Commit: Kitware Robot CommitDate: Mon Apr 8 07:44:10 2019 -0400 Merge topic 'tidy-fixes' c1d1027ac1 Enabled performance-inefficient-vector-operation check in clang-tidy Acked-by: Kitware Robot Merge-request: !3185 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=658efb4c1ab309646f0a29f806315f805de477a4 commit 658efb4c1ab309646f0a29f806315f805de477a4 Merge: 52aa682 0090907 Author: Brad King AuthorDate: Mon Apr 8 11:42:47 2019 +0000 Commit: Kitware Robot CommitDate: Mon Apr 8 07:42:56 2019 -0400 Merge topic 'modernize-raw-string-literal' 0090907e86 tidy: Fix modernize-raw-string-literal in FreeBSD CPack generator Acked-by: Kitware Robot Merge-request: !3198 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0090907e86d5e837f23fea9823664ceff6b3832f commit 0090907e86d5e837f23fea9823664ceff6b3832f Author: Brad King AuthorDate: Fri Apr 5 08:32:39 2019 -0400 Commit: Brad King CommitDate: Fri Apr 5 08:32:39 2019 -0400 tidy: Fix modernize-raw-string-literal in FreeBSD CPack generator diff --git a/Source/CPack/cmCPackFreeBSDGenerator.cxx b/Source/CPack/cmCPackFreeBSDGenerator.cxx index dd8127d..9fdafa4 100644 --- a/Source/CPack/cmCPackFreeBSDGenerator.cxx +++ b/Source/CPack/cmCPackFreeBSDGenerator.cxx @@ -181,7 +181,7 @@ public: { s << "{\n"; for (std::string const& elem : value) { - s << " \"" << elem << "\": {\"origin\": \"" << elem << "\"},\n"; + s << " \"" << elem << R"(": {"origin": ")" << elem << "\"},\n"; } s << '}'; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c1d1027ac1bf922972ebb121f369ff59be27103d commit c1d1027ac1bf922972ebb121f369ff59be27103d Author: Jakub Kalinski AuthorDate: Tue Apr 2 22:04:02 2019 +0200 Commit: Jakub Kalinski CommitDate: Tue Apr 2 22:17:24 2019 +0200 Enabled performance-inefficient-vector-operation check in clang-tidy diff --git a/.clang-tidy b/.clang-tidy index 520b1a9..f51c8fc 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -19,7 +19,6 @@ modernize-*,\ -modernize-use-using,\ performance-*,\ -performance-inefficient-string-concatenation,\ --performance-inefficient-vector-operation,\ readability-*,\ -readability-function-size,\ -readability-identifier-naming,\ diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx index 34ded38..2bc4c39 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/Source/cmSourceGroupCommand.cxx @@ -77,6 +77,7 @@ std::vector prepareFilesPathsForTree( const std::string& currentSourceDir) { std::vector prepared; + prepared.reserve(filesPaths.size()); for (auto const& filePath : filesPaths) { prepared.push_back(prepareFilePathForTree(filePath, currentSourceDir)); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a1e6b414b9ade99a8f4e6bbe9bbff43ee1a05e88 commit a1e6b414b9ade99a8f4e6bbe9bbff43ee1a05e88 Author: Fred Baksik AuthorDate: Fri Mar 22 17:06:33 2019 -0400 Commit: Brad King CommitDate: Fri Mar 29 12:38:34 2019 -0400 GHS: Update GHS_BSP_NAME processing -- Set name earlier so that the initial project() compiler checks run correctly when GHS_BSP_NAME is not specified on command line. diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 4379b34..9f361f6 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -119,10 +119,11 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts, bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p, cmMakefile* mf) { + std::string arch; if (p.empty()) { cmSystemTools::Message( "Green Hills MULTI: -A not specified; defaulting to \"arm\""); - std::string arch = "arm"; + arch = "arm"; /* store the platform name for later use * -- already done if -A was specified @@ -130,6 +131,8 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p, mf->AddCacheDefinition("CMAKE_GENERATOR_PLATFORM", arch.c_str(), "Name of generator platform.", cmStateEnums::INTERNAL); + } else { + arch = p; } /* check if OS location has been updated by platform scripts */ @@ -157,6 +160,23 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p, } this->OsDir = osdir; + // Determine GHS_BSP_NAME + std::string bspName = mf->GetSafeDefinition("GHS_BSP_NAME"); + + if (cmSystemTools::IsOff(bspName.c_str()) && + platform.find("integrity") != std::string::npos) { + bspName = "sim" + arch; + /* write back the calculate name for next time */ + mf->AddCacheDefinition("GHS_BSP_NAME", bspName.c_str(), + "Name of GHS target platform.", + cmStateEnums::STRING, true); + std::string m = + "Green Hills MULTI: GHS_BSP_NAME not specified; defaulting to \""; + m += bspName; + m += "\""; + cmSystemTools::Message(m); + } + return true; } @@ -258,32 +278,9 @@ void cmGlobalGhsMultiGenerator::WriteTopLevelProject( fout << "# Top Level Project File" << std::endl; // Specify BSP option if supplied by user - // -- not all platforms require this entry in the project file - // integrity platforms require this field; use default if needed - std::string platform; - if (const char* p = - this->GetCMakeInstance()->GetCacheDefinition("GHS_TARGET_PLATFORM")) { - platform = p; - } - - std::string bspName; - if (char const* bspCache = - this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME")) { - bspName = bspCache; - this->GetCMakeInstance()->MarkCliAsUsed("GHS_BSP_NAME"); - } else { - bspName = "IGNORE"; - } - - if (platform.find("integrity") != std::string::npos && - cmSystemTools::IsOff(bspName.c_str())) { - const char* a = - this->GetCMakeInstance()->GetCacheDefinition("CMAKE_GENERATOR_PLATFORM"); - bspName = "sim"; - bspName += (a ? a : ""); - } - - if (!cmSystemTools::IsOff(bspName.c_str())) { + const char* bspName = + this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME"); + if (!cmSystemTools::IsOff(bspName)) { fout << " -bsp " << bspName << std::endl; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=266dadf8683c9c0081368604c4ccae12e8ffc9f7 commit 266dadf8683c9c0081368604c4ccae12e8ffc9f7 Author: Fred Baksik AuthorDate: Tue Mar 19 20:56:30 2019 -0400 Commit: Brad King CommitDate: Fri Mar 29 12:38:12 2019 -0400 GHS: Print status message regarding GHS_OS_DIR -- Rename platform script so it runs before initial try_compile() in project() command. -- Fix incorrect variable name GHS_OS_DIR_OPTION -- Remove unnecessary ".*" from REGEX expression for GHS_CANDIDATE_OS_DIRS -- Forward GHS_OS_DIR_OPTION to try_compile() and preserve trailing whitespace of the variable. diff --git a/Help/generator/Green Hills MULTI.rst b/Help/generator/Green Hills MULTI.rst index 09c5b15..138e214 100644 --- a/Help/generator/Green Hills MULTI.rst +++ b/Help/generator/Green Hills MULTI.rst @@ -40,11 +40,12 @@ Cache variables that are used for toolset and target system customization: | Root path for RTOS searches. | Defaults to ``C:/ghs`` in Windows or ``/usr/ghs`` in Linux. -* ``GHS_OS_DIR`` +* ``GHS_OS_DIR`` and ``GHS_OS_DIR_OPTION`` | Sets ``-os_dir`` entry in project file. | Defaults to latest platform OS installation at ``GHS_OS_ROOT``. Set this value if a specific RTOS is to be used. + | ``GHS_OS_DIR_OPTION`` default value is ``-os_dir``. * ``GHS_BSP_NAME`` diff --git a/Modules/Platform/GHS-MULTI-Initialize.cmake b/Modules/Platform/GHS-MULTI-Determine.cmake similarity index 83% rename from Modules/Platform/GHS-MULTI-Initialize.cmake rename to Modules/Platform/GHS-MULTI-Determine.cmake index db65d14..349d906 100644 --- a/Modules/Platform/GHS-MULTI-Initialize.cmake +++ b/Modules/Platform/GHS-MULTI-Determine.cmake @@ -13,39 +13,40 @@ 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_OPTION "-os_dir " CACHE STRING "GHS compiler os option") -mark_as_advanced(GHS_OS_DIR) +set(GHS_OS_DIR_OPTION "-os_dir " CACHE STRING "GHS compiler OS option") +mark_as_advanced(GHS_OS_DIR_OPTION) #set GHS_OS_DIR if not set by user -if ( NOT GHS_OS_DIR ) - if (EXISTS ${GHS_OS_ROOT}) +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 ) + if(GHS_CANDIDATE_OS_FILES) list(REMOVE_ITEM GHS_CANDIDATE_OS_DIRS ${GHS_CANDIDATE_OS_FILES}) endif () #filter based on platform name - if (GHS_TARGET_PLATFORM MATCHES "integrity") - list(FILTER GHS_CANDIDATE_OS_DIRS INCLUDE REGEX "int[0-9][0-9][0-9][0-9a-z].*") + if(GHS_TARGET_PLATFORM MATCHES "integrity") + list(FILTER GHS_CANDIDATE_OS_DIRS INCLUDE REGEX "int[0-9][0-9][0-9][0-9a-z]") else() #fall-back for standalone unset(GHS_CANDIDATE_OS_DIRS) set(GHS_OS_DIR "IGNORE") - endif () + endif() - if (GHS_CANDIDATE_OS_DIRS) + 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() + #update cache with new value set(GHS_OS_DIR "${GHS_OS_DIR}" CACHE PATH "GHS platform OS directory" FORCE) - endif () -endif () + endif() +endif() set(GHS_BSP_NAME "IGNORE" CACHE STRING "BSP name") diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 69d4374..62fba74 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -60,7 +60,8 @@ static std::string const kCMAKE_WARN_DEPRECATED = "CMAKE_WARN_DEPRECATED"; /* GHS Multi platform variables */ static std::set ghs_platform_vars{ "GHS_TARGET_PLATFORM", "GHS_PRIMARY_TARGET", "GHS_TOOLSET_ROOT", - "GHS_OS_ROOT", "GHS_OS_DIR", "GHS_BSP_NAME" + "GHS_OS_ROOT", "GHS_OS_DIR", "GHS_BSP_NAME", + "GHS_OS_DIR_OPTION" }; static void writeProperty(FILE* fout, std::string const& targetName, @@ -881,7 +882,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, // Forward the GHS variables to the inner project cache. for (std::string const& var : ghs_platform_vars) { if (const char* val = this->Makefile->GetDefinition(var)) { - std::string flag = "-D" + var + "=" + val; + std::string flag = "-D" + var + "=" + "'" + val + "'"; cmakeFlags.push_back(std::move(flag)); } } diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index e6a1d78..4379b34 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -132,17 +132,30 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p, cmStateEnums::INTERNAL); } - const char* tgtPlatform = mf->GetDefinition("GHS_TARGET_PLATFORM"); - if (tgtPlatform == nullptr) { - cmSystemTools::Message("Green Hills MULTI: GHS_TARGET_PLATFORM not " - "specified; defaulting to \"integrity\""); - tgtPlatform = "integrity"; + /* check if OS location has been updated by platform scripts */ + std::string platform = mf->GetSafeDefinition("GHS_TARGET_PLATFORM"); + std::string osdir = mf->GetSafeDefinition("GHS_OS_DIR"); + if (cmSystemTools::IsOff(osdir.c_str()) && + platform.find("integrity") != std::string::npos) { + if (!this->CMakeInstance->GetIsInTryCompile()) { + /* required OS location is not found */ + std::string m = + "Green Hills MULTI: GHS_OS_DIR not specified; No OS found in \""; + m += mf->GetSafeDefinition("GHS_OS_ROOT"); + m += "\""; + cmSystemTools::Message(m); + } + osdir = "GHS_OS_DIR-NOT-SPECIFIED"; + } else if (!this->CMakeInstance->GetIsInTryCompile() && + cmSystemTools::IsOff(this->OsDir) && + !cmSystemTools::IsOff(osdir)) { + /* OS location was updated by auto-selection */ + std::string m = "Green Hills MULTI: GHS_OS_DIR not specified; found \""; + m += osdir; + m += "\""; + cmSystemTools::Message(m); } - - /* store the platform name for later use */ - mf->AddCacheDefinition("GHS_TARGET_PLATFORM", tgtPlatform, - "Name of GHS target platform.", - cmStateEnums::INTERNAL); + this->OsDir = osdir; return true; } @@ -153,6 +166,21 @@ void cmGlobalGhsMultiGenerator::EnableLanguage( mf->AddDefinition("CMAKE_SYSTEM_NAME", "GHS-MULTI"); mf->AddDefinition("GHSMULTI", "1"); // identifier for user CMake files + + const char* tgtPlatform = mf->GetDefinition("GHS_TARGET_PLATFORM"); + if (!tgtPlatform) { + cmSystemTools::Message("Green Hills MULTI: GHS_TARGET_PLATFORM not " + "specified; defaulting to \"integrity\""); + tgtPlatform = "integrity"; + } + + /* store the platform name for later use */ + mf->AddCacheDefinition("GHS_TARGET_PLATFORM", tgtPlatform, + "Name of GHS target platform.", cmStateEnums::STRING); + + /* store original OS location */ + this->OsDir = mf->GetSafeDefinition("GHS_OS_DIR"); + this->cmGlobalGenerator::EnableLanguage(l, mf, optional); } @@ -261,22 +289,17 @@ void cmGlobalGhsMultiGenerator::WriteTopLevelProject( // Specify OS DIR if supplied by user // -- not all platforms require this entry in the project file - std::string osDir; - std::string osDirOption; - if (char const* osDirCache = - this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR")) { - osDir = osDirCache; - } - - if (char const* osDirOptionCache = - this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR_OPTION")) { - osDirOption = osDirOptionCache; - } - - if (!cmSystemTools::IsOff(osDir.c_str()) || - platform.find("integrity") != std::string::npos) { - std::replace(osDir.begin(), osDir.end(), '\\', '/'); - fout << " " << osDirOption << "\"" << osDir << "\"" << std::endl; + if (!cmSystemTools::IsOff(this->OsDir.c_str())) { + const char* osDirOption = + this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR_OPTION"); + std::replace(this->OsDir.begin(), this->OsDir.end(), '\\', '/'); + fout << " "; + if (cmSystemTools::IsOff(osDirOption)) { + fout << ""; + } else { + fout << osDirOption; + } + fout << "\"" << this->OsDir << "\"" << std::endl; } WriteSubProjects(fout, root, generators); diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index f8df6ef..3dcf077 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -120,6 +120,7 @@ private: std::string trimQuotes(std::string const& str); + std::string OsDir; static const char* DEFAULT_BUILD_PROGRAM; static const char* DEFAULT_TOOLSET_ROOT; }; ----------------------------------------------------------------------- Summary of changes: .clang-tidy | 1 - Help/generator/Green Hills MULTI.rst | 3 +- ...-Initialize.cmake => GHS-MULTI-Determine.cmake} | 23 ++-- Source/CPack/cmCPackFreeBSDGenerator.cxx | 2 +- Source/cmCoreTryCompile.cxx | 5 +- Source/cmGlobalGhsMultiGenerator.cxx | 124 ++++++++++++--------- Source/cmGlobalGhsMultiGenerator.h | 1 + Source/cmSourceGroupCommand.cxx | 1 + 8 files changed, 92 insertions(+), 68 deletions(-) rename Modules/Platform/{GHS-MULTI-Initialize.cmake => GHS-MULTI-Determine.cmake} (83%) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Apr 8 08:03:03 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 8 Apr 2019 08:03:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-635-g7e60e77 Message-ID: <20190408120303.27A59FB77E@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 7e60e77c3c2a09eb11750616db50d2dc149a9c54 (commit) via 14270eab369c3b700d89ef385af2cb94a6497b1e (commit) via 1889ed923ea8c2dd204ca38b8109efdf1963c578 (commit) via 26b6d2aff0076b44fac605de0d3dbfc3f55e64fb (commit) via 7b98a6eb68e6a2c9a422e42c8eeb78dfa4038364 (commit) via 9710d4aacf801d3dc7ab243bc2c8e051a65871a6 (commit) via 95e72c0157ecd9c603fc541fa7e9fa246b777969 (commit) via f161cfe5a8fa00d6d203885e9c1985ec53d7d625 (commit) via 7baec5e94b372cfc21e777488ecf993e4bce368e (commit) via 191269d247827a4c1de739165c0555b4c9ea9d79 (commit) via 95de172b68b23124d8dfa3fb238876b8f2ecd3e7 (commit) via 521475b41b06d6f99edeeb9a36edb2bde8b55579 (commit) via 7cbde5c503f15bcc568a64239977b8e1f6f501cb (commit) from c756fbce9ba94e2d7f1b787d595df24dbe99c9c1 (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=7e60e77c3c2a09eb11750616db50d2dc149a9c54 commit 7e60e77c3c2a09eb11750616db50d2dc149a9c54 Merge: 14270ea 7b98a6e Author: Brad King AuthorDate: Mon Apr 8 11:58:48 2019 +0000 Commit: Kitware Robot CommitDate: Mon Apr 8 07:58:58 2019 -0400 Merge topic 'autogen_autorcc_no_libuv' 7b98a6eb68 Autogen: Rename cmQtAutoGeneratorRcc to cmQtAutoRcc 9710d4aacf Autogen: Move libuv loop from cmQtAutoGenerator to cmQtAutoGeneratorMocUic 95e72c0157 Autogen: Make cmQtAutoGenerator::FileSystem Logger free f161cfe5a8 Autogen: Move Logger and FileSystem member variables to generator classes 7baec5e94b AutoRcc: Don't use cmQtAutoGenerator::FileSystem methods 191269d247 AutoRcc: Remove libuv event loop from cmQtAutoGeneratorRcc 95de172b68 AutoRcc: Make rcc parsing function private 521475b41b AutoRcc: Use cmQtAutoGen::RccLister in initializer and generator ... Acked-by: Kitware Robot Merge-request: !3202 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=14270eab369c3b700d89ef385af2cb94a6497b1e commit 14270eab369c3b700d89ef385af2cb94a6497b1e Merge: c756fbc 1889ed9 Author: Brad King AuthorDate: Mon Apr 8 11:52:50 2019 +0000 Commit: Kitware Robot CommitDate: Mon Apr 8 07:52:58 2019 -0400 Merge topic 'genex-output_name' 1889ed923e Genex: Add capability to retrieve base name for various target artifacts 26b6d2aff0 Refactor struct TargetFileSystemArtifact Acked-by: Kitware Robot Merge-request: !3190 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1889ed923ea8c2dd204ca38b8109efdf1963c578 commit 1889ed923ea8c2dd204ca38b8109efdf1963c578 Author: Marc Chevrier AuthorDate: Wed Apr 3 17:27:39 2019 +0200 Commit: Brad King CommitDate: Mon Apr 8 07:49:08 2019 -0400 Genex: Add capability to retrieve base name for various target artifacts This new capability is required to solve efficiently issue #18771 diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index f93de53..011631c 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -385,12 +385,22 @@ Target-Dependent Queries ``$`` Expands to the ``tgt`` if the given target exists, an empty string otherwise. +``$`` + Base name of main file where ``tgt`` is the name of a target. + + Note that ``tgt`` is not added as a dependency of the target this + expression is evaluated on. ``$`` Full path to main file (.exe, .so.1.2, .a) where ``tgt`` is the name of a target. ``$`` Name of main file (.exe, .so.1.2, .a). ``$`` Directory of main file (.exe, .so.1.2, .a). +``$`` + Base name of file used to link where ``tgt`` is the name of a target. + + Note that ``tgt`` is not added as a dependency of the target this + expression is evaluated on. ``$`` File used to link (.a, .lib, .so) where ``tgt`` is the name of a target. ``$`` @@ -403,6 +413,15 @@ Target-Dependent Queries Name of file with soname (.so.3). ``$`` Directory of with soname (.so.3). +``$`` + Base name of the linker generated program database file (.pdb) + where ``tgt`` is the name of a target. + + See also the :prop_tgt:`PDB_NAME` target property and its configuration + specific variant :prop_tgt:`PDB_NAME_`. + + Note that ``tgt`` is not added as a dependency of the target this + expression is evaluated on. ``$`` Full path to the linker generated program database file (.pdb) where ``tgt`` is the name of a target. diff --git a/Help/release/dev/genex-TARGET_OUTPUT_NAME.rst b/Help/release/dev/genex-TARGET_OUTPUT_NAME.rst new file mode 100644 index 0000000..e3ffe57 --- /dev/null +++ b/Help/release/dev/genex-TARGET_OUTPUT_NAME.rst @@ -0,0 +1,7 @@ +genex-TARGET_OUTPUT_NAME +------------------------ + +* New ``$``, ``$`` and + ``$`` + :manual:`generator expressions ` have been + added to retrieve the base name of various artifacts. diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 481ea9e..cef36fc 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -2131,6 +2131,126 @@ static const TargetFilesystemArtifact targetBundleContentDirNode; +// +// To retrieve base name for various artifacts +// +template +struct TargetOutputNameArtifactResultGetter +{ + static std::string Get(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content); +}; + +template <> +struct TargetOutputNameArtifactResultGetter +{ + static std::string Get(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* /*unused*/) + { + return target->GetOutputName(context->Config, + cmStateEnums::RuntimeBinaryArtifact); + } +}; + +template <> +struct TargetOutputNameArtifactResultGetter +{ + static std::string Get(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content) + { + // The file used to link to the target (.so, .lib, .a). + if (!target->IsLinkable()) { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_LINKER_OUTPUT_NAME is allowed only for libraries " + "and executables with ENABLE_EXPORTS."); + return std::string(); + } + cmStateEnums::ArtifactType artifact = + target->HasImportLibrary(context->Config) + ? cmStateEnums::ImportLibraryArtifact + : cmStateEnums::RuntimeBinaryArtifact; + return target->GetOutputName(context->Config, artifact); + } +}; + +template <> +struct TargetOutputNameArtifactResultGetter +{ + static std::string Get(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content) + { + if (target->IsImported()) { + ::reportError( + context, content->GetOriginalExpression(), + "TARGET_PDB_OUTPUT_NAME not allowed for IMPORTED targets."); + return std::string(); + } + + std::string language = target->GetLinkerLanguage(context->Config); + + std::string pdbSupportVar = "CMAKE_" + language + "_LINKER_SUPPORTS_PDB"; + + if (!context->LG->GetMakefile()->IsOn(pdbSupportVar)) { + ::reportError( + context, content->GetOriginalExpression(), + "TARGET_PDB_OUTPUT_NAME is not supported by the target linker."); + return std::string(); + } + + cmStateEnums::TargetType targetType = target->GetType(); + + if (targetType != cmStateEnums::SHARED_LIBRARY && + targetType != cmStateEnums::MODULE_LIBRARY && + targetType != cmStateEnums::EXECUTABLE) { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_PDB_OUTPUT_NAME is allowed only for " + "targets with linker created artifacts."); + return std::string(); + } + + return target->GetPDBOutputName(context->Config); + } +}; + +template +struct TargetOutputNameArtifact : public TargetArtifactBase +{ + TargetOutputNameArtifact() {} // NOLINT(modernize-use-equals-default) + + int NumExpectedParameters() const override { return 1; } + + std::string Evaluate( + const std::vector& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* dagChecker) const override + { + cmGeneratorTarget* target = + this->GetTarget(parameters, context, content, dagChecker); + if (!target) { + return std::string(); + } + + std::string result = TargetOutputNameArtifactResultGetter::Get( + target, context, content); + if (context->HadError) { + return std::string(); + } + return result; + } +}; + +static const TargetOutputNameArtifact targetOutputNameNode; + +static const TargetOutputNameArtifact + targetLinkerOutputNameNode; + +static const TargetOutputNameArtifact targetPdbOutputNameNode; + static const struct ShellPathNode : public cmGeneratorExpressionNode { ShellPathNode() {} // NOLINT(modernize-use-equals-default) @@ -2205,6 +2325,9 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode( { "TARGET_PDB_FILE_DIR", &targetPdbNodeGroup.FileDir }, { "TARGET_BUNDLE_DIR", &targetBundleDirNode }, { "TARGET_BUNDLE_CONTENT_DIR", &targetBundleContentDirNode }, + { "TARGET_OUTPUT_NAME", &targetOutputNameNode }, + { "TARGET_LINKER_OUTPUT_NAME", &targetLinkerOutputNameNode }, + { "TARGET_PDB_OUTPUT_NAME", &targetPdbOutputNameNode }, { "STREQUAL", &strEqualNode }, { "EQUAL", &equalNode }, { "IN_LIST", &inListNode }, diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 23b5bcb..f8c16cc 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3884,6 +3884,31 @@ std::string cmGeneratorTarget::GetLinkerLanguage( return this->GetLinkClosure(config)->LinkerLanguage; } +std::string cmGeneratorTarget::GetPDBOutputName( + const std::string& config) const +{ + std::string base = + this->GetOutputName(config, cmStateEnums::RuntimeBinaryArtifact); + + std::vector props; + std::string configUpper = cmSystemTools::UpperCase(config); + if (!configUpper.empty()) { + // PDB_NAME_ + props.push_back("PDB_NAME_" + configUpper); + } + + // PDB_NAME + props.emplace_back("PDB_NAME"); + + for (std::string const& p : props) { + if (const char* outName = this->GetProperty(p)) { + base = outName; + break; + } + } + return base; +} + std::string cmGeneratorTarget::GetPDBName(const std::string& config) const { std::string prefix; diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 3f2025e..065b457 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -503,6 +503,9 @@ public: OutputInfo const* GetOutputInfo(const std::string& config) const; + // Get the target PDB base name. + std::string GetPDBOutputName(const std::string& config) const; + /** Get the name of the pdb file for the target. */ std::string GetPDBName(const std::string& config = "") const; diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-result.txt b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt new file mode 100644 index 0000000..783bfb3 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at ImportedTarget-TARGET_PDB_OUTPUT_NAME.cmake:2 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + TARGET_PDB_OUTPUT_NAME not allowed for IMPORTED targets. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME.cmake b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME.cmake new file mode 100644 index 0000000..010b38e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME.cmake @@ -0,0 +1,2 @@ +add_library(empty UNKNOWN IMPORTED) +add_custom_target(custom COMMAND echo $) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-stderr.txt new file mode 100644 index 0000000..00ec496 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at NonValidCompiler-TARGET_PDB_OUTPUT_NAME.cmake:6 \(file\): + Error evaluating generator expression: + + \$ + + TARGET_PDB_OUTPUT_NAME is not supported by the target linker. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME.cmake b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME.cmake new file mode 100644 index 0000000..07951de --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(empty STATIC empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$]" +) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt new file mode 100644 index 0000000..8ac349e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at NonValidTarget-TARGET_PDB_OUTPUT_NAME.cmake:6 \(file\): + Error evaluating generator expression: + + \$ + + TARGET_PDB_OUTPUT_NAME is allowed only for targets with linker created + artifacts. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME.cmake new file mode 100644 index 0000000..07951de --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(empty STATIC empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$]" +) diff --git a/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion-stderr.txt b/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion-stderr.txt index bf592e7..013c4f2 100644 --- a/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion-stderr.txt @@ -1,4 +1,10 @@ CMake Error at OUTPUT_NAME-recursion.cmake:[0-9]+ \(add_executable\): - Target 'empty1' OUTPUT_NAME depends on itself. + Target 'empty2' OUTPUT_NAME depends on itself. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error at OUTPUT_NAME-recursion.cmake:[0-9]+ \(add_executable\): + Target 'empty2' OUTPUT_NAME depends on itself. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion.cmake b/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion.cmake index 5cb8050..775f68a 100644 --- a/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion.cmake +++ b/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion.cmake @@ -1,3 +1,6 @@ enable_language(C) add_executable(empty1 empty.c) set_property(TARGET empty1 PROPERTY OUTPUT_NAME $) + +add_executable(empty2 empty.c) +set_property(TARGET empty2 PROPERTY OUTPUT_NAME $) diff --git a/Tests/RunCMake/GeneratorExpression/ResultValidator.cmake b/Tests/RunCMake/GeneratorExpression/ResultValidator.cmake new file mode 100644 index 0000000..722ae05 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ResultValidator.cmake @@ -0,0 +1,6 @@ + +function (CHECK_VALUE test_msg value expected) + if (NOT value STREQUAL expected) + string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [[${value}]]\nbut expected:\n [[${expected}]]\n") + endif() +endfunction() diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 63c12a9..68bffa7 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -33,6 +33,10 @@ run_cmake(COMPILE_LANGUAGE-add_test) run_cmake(COMPILE_LANGUAGE-unknown-lang) run_cmake(TARGET_FILE-recursion) run_cmake(OUTPUT_NAME-recursion) +run_cmake(TARGET_OUTPUT_NAME) +run_cmake(TARGET_OUTPUT_NAME-imported-target) +run_cmake(TARGET_OUTPUT_NAME-non-valid-target) +run_cmake(TARGET_LINKER_OUTPUT_NAME-non-valid-target) run_cmake(TARGET_PROPERTY-LOCATION) run_cmake(TARGET_PROPERTY-SOURCES) run_cmake(LINK_ONLY-not-linking) @@ -62,11 +66,15 @@ run_cmake(REMOVE_DUPLICATES-4) run_cmake(ImportedTarget-TARGET_BUNDLE_DIR) run_cmake(ImportedTarget-TARGET_BUNDLE_CONTENT_DIR) run_cmake(ImportedTarget-TARGET_PDB_FILE) +run_cmake(ImportedTarget-TARGET_PDB_OUTPUT_NAME) if(LINKER_SUPPORTS_PDB) run_cmake(NonValidTarget-TARGET_PDB_FILE) run_cmake(ValidTarget-TARGET_PDB_FILE) + run_cmake(NonValidTarget-TARGET_PDB_OUTPUT_NAME) + run_cmake(ValidTarget-TARGET_PDB_OUTPUT_NAME) else() run_cmake(NonValidCompiler-TARGET_PDB_FILE) + run_cmake(NonValidCompiler-TARGET_PDB_OUTPUT_NAME) endif() set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0085:STRING=OLD) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-stderr.txt new file mode 100644 index 0000000..29f6211 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake:6 \(file\): + Error evaluating generator expression: + + \$ + + Target "empty" is not an executable or library\. diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake new file mode 100644 index 0000000..e1496b4 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_custom_target(empty) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$]" +) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-check.cmake new file mode 100644 index 0000000..fa4f2b9 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-check.cmake @@ -0,0 +1,2 @@ + +include ("${RunCMake_TEST_BINARY_DIR}/TARGET_OUTPUT_NAME-generated.cmake") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target-check.cmake new file mode 100644 index 0000000..fa4f2b9 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target-check.cmake @@ -0,0 +1,2 @@ + +include ("${RunCMake_TEST_BINARY_DIR}/TARGET_OUTPUT_NAME-generated.cmake") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target.cmake new file mode 100644 index 0000000..548a2d7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target.cmake @@ -0,0 +1,79 @@ + +cmake_minimum_required(VERSION 3.14) + +enable_language (C) + +set (GENERATE_CONTENT [[ +macro (CHECK_VALUE test_msg value expected) + if (NOT "${value}" STREQUAL "${expected}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [${value}]\nbut expected:\n [${expected}]\n") + endif() +endmacro() +]]) + +add_executable(exec1 IMPORTED) +add_library (shared1 SHARED IMPORTED) +add_library (static1 STATIC IMPORTED) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_OUTPUT_NAME executable default" "$" "exec1") +check_value ("TARGET_OUTPUT_NAME shared default" "$" "shared1") +check_value ("TARGET_LINKER_OUTPUT_NAME shared linker default" "$" "shared1") +check_value ("TARGET_OUTPUT_NAME static default" "$" "static1") +check_value ("TARGET_LINKER_OUTPUT_NAME static linker default" "$" "static1") +]]) + + +add_executable (exec2 IMPORTED) +set_property (TARGET exec2 PROPERTY OUTPUT_NAME exec2_custom) +add_library (shared2 SHARED IMPORTED) +set_property (TARGET shared2 PROPERTY OUTPUT_NAME shared2_custom) +add_library (static2 STATIC IMPORTED) +set_property (TARGET static2 PROPERTY OUTPUT_NAME static2_custom) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_OUTPUT_NAME executable custom" "$" "exec2_custom") +check_value ("TARGET_OUTPUT_NAME shared custom" "$" "shared2_custom") +check_value ("TARGET_LINKER_OUTPUT_NAME shared linker custom" "$" "shared2_custom") +check_value ("TARGET_OUTPUT_NAME static custom" "$" "static2_custom") +check_value ("TARGET_LINKER_OUTPUT_NAME static linker custom" "$" "static2_custom") +]]) + + +add_executable (exec3 IMPORTED) +set_property (TARGET exec3 PROPERTY RUNTIME_OUTPUT_NAME exec3_runtime) +set_property (TARGET exec3 PROPERTY LIBRARY_OUTPUT_NAME exec3_library) +set_property (TARGET exec3 PROPERTY ARCHIVE_OUTPUT_NAME exec3_archive) +set_property (TARGET exec3 PROPERTY PDB_NAME exec3_pdb) +add_library (shared3 SHARED IMPORTED) +set_property (TARGET shared3 PROPERTY RUNTIME_OUTPUT_NAME shared3_runtime) +set_property (TARGET shared3 PROPERTY LIBRARY_OUTPUT_NAME shared3_library) +set_property (TARGET shared3 PROPERTY ARCHIVE_OUTPUT_NAME shared3_archive) +set_property (TARGET shared3 PROPERTY PDB_NAME shared3_pdb) +add_library (static3 STATIC IMPORTED) +set_property (TARGET static3 PROPERTY RUNTIME_OUTPUT_NAME static3_runtime) +set_property (TARGET static3 PROPERTY LIBRARY_OUTPUT_NAME static3_library) +set_property (TARGET static3 PROPERTY ARCHIVE_OUTPUT_NAME static3_archive) +set_property (TARGET static3 PROPERTY PDB_NAME static3_pdb) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_OUTPUT_NAME executable all properties" "$" "exec3_runtime") +check_value ("TARGET_OUTPUT_NAME shared all properties" "$" "$,Windows$CYGWIN>,shared3_runtime,shared3_library>") +check_value ("TARGET_LINKER_OUTPUT_NAME shared linker all properties" "$" "$,Windows$CYGWIN>,shared3_archive,shared3_library>") +check_value ("TARGET_OUTPUT_NAME static all properties" "$" "static3_archive") +check_value ("TARGET_LINKER_OUTPUT_NAME static linker all properties" "$" "static3_archive") +]]) + + +unset(GENERATE_CONDITION) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) + list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG) + set(GENERATE_CONDITION CONDITION $) +endif() + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_OUTPUT_NAME-generated.cmake" + CONTENT "${GENERATE_CONTENT}" ${GENERATE_CONDITION}) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-stderr.txt new file mode 100644 index 0000000..e78ec01 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at TARGET_OUTPUT_NAME-non-valid-target.cmake:6 \(file\): + Error evaluating generator expression: + + \$ + + Target "empty" is not an executable or library\. diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake new file mode 100644 index 0000000..2ff733c --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_custom_target(empty) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$]" +) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME.cmake new file mode 100644 index 0000000..b7bae15 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME.cmake @@ -0,0 +1,96 @@ + +cmake_minimum_required(VERSION 3.14) + +enable_language (C) + +set (GENERATE_CONTENT [[ +macro (CHECK_VALUE test_msg value expected) + if (NOT "${value}" STREQUAL "${expected}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [${value}]\nbut expected:\n [${expected}]\n") + endif() +endmacro() +]]) + +add_executable (exec1 empty.c) +add_library (shared1 SHARED empty.c) +add_library (static1 STATIC empty.c) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_OUTPUT_NAME executable default" "$" "exec1") +check_value ("TARGET_OUTPUT_NAME shared default" "$" "shared1") +check_value ("TARGET_LINKER_OUTPUT_NAME shared linker default" "$" "shared1") +check_value ("TARGET_OUTPUT_NAME static default" "$" "static1") +check_value ("TARGET_LINKER_OUTPUT_NAME static linker default" "$" "static1") +]]) +if (CMAKE_C_LINKER_SUPPORTS_PDB) + string(APPEND GENERATE_CONTENT [[ +check_value ("TARGET_PDB_OUTPUT_NAME executable PDB default" "$" "exec1") +check_value ("TARGET_PDB_OUTPUT_NAME shared PDB default" "$" "shared1") +]]) +endif() + + +add_executable (exec2 empty.c) +set_property (TARGET exec2 PROPERTY OUTPUT_NAME exec2_custom) +add_library (shared2 SHARED empty.c) +set_property (TARGET shared2 PROPERTY OUTPUT_NAME shared2_custom) +add_library (static2 STATIC empty.c) +set_property (TARGET static2 PROPERTY OUTPUT_NAME static2_custom) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_OUTPUT_NAME executable custom" "$" "exec2_custom") +check_value ("TARGET_OUTPUT_NAME shared custom" "$" "shared2_custom") +check_value ("TARGET_LINKER_OUTPUT_NAME shared linker custom" "$" "shared2_custom") +check_value ("TARGET_OUTPUT_NAME static custom" "$" "static2_custom") +check_value ("TARGET_LINKER_OUTPUT_NAME static linker custom" "$" "static2_custom") +]]) +if (CMAKE_C_LINKER_SUPPORTS_PDB) + string (APPEND GENERATE_CONTENT [[ +check_value ("TARGET_PDB_OUTPUT_NAME executable PDB custom" "$" "exec2_custom") +check_value ("TARGET_PDB_OUTPUT_NAME shared PDB custom" "$" "shared2_custom") + ]]) +endif() + +add_executable (exec3 empty.c) +set_property (TARGET exec3 PROPERTY RUNTIME_OUTPUT_NAME exec3_runtime) +set_property (TARGET exec3 PROPERTY LIBRARY_OUTPUT_NAME exec3_library) +set_property (TARGET exec3 PROPERTY ARCHIVE_OUTPUT_NAME exec3_archive) +set_property (TARGET exec3 PROPERTY PDB_NAME exec3_pdb) +add_library (shared3 SHARED empty.c) +set_property (TARGET shared3 PROPERTY RUNTIME_OUTPUT_NAME shared3_runtime) +set_property (TARGET shared3 PROPERTY LIBRARY_OUTPUT_NAME shared3_library) +set_property (TARGET shared3 PROPERTY ARCHIVE_OUTPUT_NAME shared3_archive) +set_property (TARGET shared3 PROPERTY PDB_NAME shared3_pdb) +add_library (static3 STATIC empty.c) +set_property (TARGET static3 PROPERTY RUNTIME_OUTPUT_NAME static3_runtime) +set_property (TARGET static3 PROPERTY LIBRARY_OUTPUT_NAME static3_library) +set_property (TARGET static3 PROPERTY ARCHIVE_OUTPUT_NAME static3_archive) +set_property (TARGET static3 PROPERTY PDB_NAME static3_pdb) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_OUTPUT_NAME executable all properties" "$" "exec3_runtime") +check_value ("TARGET_OUTPUT_NAME shared all properties" "$" "$,Windows$CYGWIN>,shared3_runtime,shared3_library>") +check_value ("TARGET_LINKER_OUTPUT_NAME shared linker all properties" "$" "$,Windows$CYGWIN>,shared3_archive,shared3_library>") +check_value ("TARGET_OUTPUT_NAME static all properties" "$" "static3_archive") +check_value ("TARGET_LINKER_OUTPUT_NAME static linker all properties" "$" "static3_archive") +]]) +if (CMAKE_C_LINKER_SUPPORTS_PDB) + string (APPEND GENERATE_CONTENT [[ +check_value ("TARGET_PDB_OUTPUT_NAME executable PDB all properties" "$" "exec3_pdb") +check_value ("TARGET_PDB_OUTPUT_NAME shared PDB all properties" "$" "shared3_pdb") +]]) +endif() + + +unset(GENERATE_CONDITION) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) + list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG) + set(GENERATE_CONDITION CONDITION $) +endif() + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_OUTPUT_NAME-generated.cmake" + CONTENT "${GENERATE_CONTENT}" ${GENERATE_CONDITION}) diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME-check.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME-check.cmake new file mode 100644 index 0000000..8d1103e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME-check.cmake @@ -0,0 +1,7 @@ +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/test.txt TEST_TXT ENCODING UTF-8) + +list(GET TEST_TXT 0 PDB_OUTPUT_NAME) + +if(NOT PDB_OUTPUT_NAME MATCHES "empty") + set(RunCMake_TEST_FAILED "unexpected PDB_OUTPUT_NAME [${PDB_OUTPUT_NAME}]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME.cmake new file mode 100644 index 0000000..ba70b43 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME.cmake @@ -0,0 +1,16 @@ + +enable_language(C) + +add_library(empty SHARED empty.c) + +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) + list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG) + set(GENERATE_CONDITION CONDITION $) +endif() + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "$" + ${GENERATE_CONDITION} +) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=26b6d2aff0076b44fac605de0d3dbfc3f55e64fb commit 26b6d2aff0076b44fac605de0d3dbfc3f55e64fb Author: Marc Chevrier AuthorDate: Thu Apr 4 18:27:29 2019 +0200 Commit: Brad King CommitDate: Mon Apr 8 07:48:20 2019 -0400 Refactor struct TargetFileSystemArtifact Creates base class TargetArtifactBase which enable to share code with future new functionalities. diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 19d2b3a..481ea9e 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -2023,18 +2023,16 @@ struct TargetFilesystemArtifactResultGetter static std::string Get(const std::string& result) { return result; } }; -template -struct TargetFilesystemArtifact : public cmGeneratorExpressionNode +struct TargetArtifactBase : public cmGeneratorExpressionNode { - TargetFilesystemArtifact() {} // NOLINT(modernize-use-equals-default) - - int NumExpectedParameters() const override { return 1; } + TargetArtifactBase() {} // NOLINT(modernize-use-equals-default) - std::string Evaluate( +protected: + cmGeneratorTarget* GetTarget( const std::vector& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker* dagChecker) const override + cmGeneratorExpressionDAGChecker* dagChecker) const { // Lookup the referenced target. std::string name = parameters.front(); @@ -2042,20 +2040,20 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode if (!cmGeneratorExpression::IsValidTargetName(name)) { ::reportError(context, content->GetOriginalExpression(), "Expression syntax not recognized."); - return std::string(); + return nullptr; } cmGeneratorTarget* target = context->LG->FindGeneratorTargetToUse(name); if (!target) { ::reportError(context, content->GetOriginalExpression(), "No target \"" + name + "\""); - return std::string(); + return nullptr; } if (target->GetType() >= cmStateEnums::OBJECT_LIBRARY && target->GetType() != cmStateEnums::UNKNOWN_LIBRARY) { ::reportError(context, content->GetOriginalExpression(), "Target \"" + name + "\" is not an executable or library."); - return std::string(); + return nullptr; } if (dagChecker && (dagChecker->EvaluatingLinkLibraries(target) || @@ -2064,6 +2062,29 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode ::reportError(context, content->GetOriginalExpression(), "Expressions which require the linker language may not " "be used while evaluating link libraries"); + return nullptr; + } + + return target; + } +}; + +template +struct TargetFilesystemArtifact : public TargetArtifactBase +{ + TargetFilesystemArtifact() {} // NOLINT(modernize-use-equals-default) + + int NumExpectedParameters() const override { return 1; } + + std::string Evaluate( + const std::vector& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* dagChecker) const override + { + cmGeneratorTarget* target = + this->GetTarget(parameters, context, content, dagChecker); + if (!target) { return std::string(); } context->DependTargets.insert(target); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7b98a6eb68e6a2c9a422e42c8eeb78dfa4038364 commit 7b98a6eb68e6a2c9a422e42c8eeb78dfa4038364 Author: Sebastian Holtermann AuthorDate: Sat Apr 6 12:42:56 2019 +0200 Commit: Sebastian Holtermann CommitDate: Sat Apr 6 17:37:12 2019 +0200 Autogen: Rename cmQtAutoGeneratorRcc to cmQtAutoRcc The class name `cmQtAutoGeneratorRcc` is long and cumbersome. This shortens it to `cmQtAutoRcc`. diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 52f6742..3a12120 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -350,8 +350,8 @@ set(SRCS cmQtAutoGenInitializer.h cmQtAutoGeneratorMocUic.cxx cmQtAutoGeneratorMocUic.h - cmQtAutoGeneratorRcc.cxx - cmQtAutoGeneratorRcc.h + cmQtAutoRcc.cxx + cmQtAutoRcc.h cmRST.cxx cmRST.h cmScriptGenerator.h diff --git a/Source/cmQtAutoGeneratorRcc.cxx b/Source/cmQtAutoRcc.cxx similarity index 95% rename from Source/cmQtAutoGeneratorRcc.cxx rename to Source/cmQtAutoRcc.cxx index add84de..e58324d 100644 --- a/Source/cmQtAutoGeneratorRcc.cxx +++ b/Source/cmQtAutoRcc.cxx @@ -1,6 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmQtAutoGeneratorRcc.h" +#include "cmQtAutoRcc.h" #include "cmQtAutoGen.h" #include "cmAlgorithms.h" @@ -13,11 +13,11 @@ // -- Class methods -cmQtAutoGeneratorRcc::cmQtAutoGeneratorRcc() = default; +cmQtAutoRcc::cmQtAutoRcc() = default; -cmQtAutoGeneratorRcc::~cmQtAutoGeneratorRcc() = default; +cmQtAutoRcc::~cmQtAutoRcc() = default; -bool cmQtAutoGeneratorRcc::Init(cmMakefile* makefile) +bool cmQtAutoRcc::Init(cmMakefile* makefile) { // -- Utility lambdas auto InfoGet = [makefile](std::string const& key) { @@ -137,7 +137,7 @@ bool cmQtAutoGeneratorRcc::Init(cmMakefile* makefile) return true; } -bool cmQtAutoGeneratorRcc::Process() +bool cmQtAutoRcc::Process() { if (!SettingsFileRead()) { return false; @@ -170,7 +170,7 @@ bool cmQtAutoGeneratorRcc::Process() return SettingsFileWrite(); } -std::string cmQtAutoGeneratorRcc::MultiConfigOutput() const +std::string cmQtAutoRcc::MultiConfigOutput() const { static std::string const suffix = "_CMAKE_"; std::string res; @@ -180,7 +180,7 @@ std::string cmQtAutoGeneratorRcc::MultiConfigOutput() const return res; } -bool cmQtAutoGeneratorRcc::SettingsFileRead() +bool cmQtAutoRcc::SettingsFileRead() { // Compose current settings strings { @@ -259,7 +259,7 @@ bool cmQtAutoGeneratorRcc::SettingsFileRead() return true; } -bool cmQtAutoGeneratorRcc::SettingsFileWrite() +bool cmQtAutoRcc::SettingsFileWrite() { // Only write if any setting changed if (SettingsChanged_) { @@ -286,7 +286,7 @@ bool cmQtAutoGeneratorRcc::SettingsFileWrite() } /// Do basic checks if rcc generation is required -bool cmQtAutoGeneratorRcc::TestQrcRccFiles(bool& generate) +bool cmQtAutoRcc::TestQrcRccFiles(bool& generate) { // Test if the rcc input file exists if (!QrcFileTime_.Load(QrcFile_)) { @@ -342,7 +342,7 @@ bool cmQtAutoGeneratorRcc::TestQrcRccFiles(bool& generate) return true; } -bool cmQtAutoGeneratorRcc::TestResources(bool& generate) +bool cmQtAutoRcc::TestResources(bool& generate) { // Read resource files list if (Inputs_.empty()) { @@ -383,7 +383,7 @@ bool cmQtAutoGeneratorRcc::TestResources(bool& generate) return true; } -bool cmQtAutoGeneratorRcc::TestInfoFile() +bool cmQtAutoRcc::TestInfoFile() { // Test if the rcc output file is older than the info file @@ -415,7 +415,7 @@ bool cmQtAutoGeneratorRcc::TestInfoFile() return true; } -bool cmQtAutoGeneratorRcc::GenerateRcc() +bool cmQtAutoRcc::GenerateRcc() { // Make parent directory if (!MakeParentDirectory(RccFileOutput_)) { @@ -469,7 +469,7 @@ bool cmQtAutoGeneratorRcc::GenerateRcc() return true; } -bool cmQtAutoGeneratorRcc::GenerateWrapper() +bool cmQtAutoRcc::GenerateWrapper() { // Generate a wrapper source file on demand if (IsMultiConfig()) { diff --git a/Source/cmQtAutoGeneratorRcc.h b/Source/cmQtAutoRcc.h similarity index 84% rename from Source/cmQtAutoGeneratorRcc.h rename to Source/cmQtAutoRcc.h index ff7a02a..8dc9179 100644 --- a/Source/cmQtAutoGeneratorRcc.h +++ b/Source/cmQtAutoRcc.h @@ -1,7 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmQtAutoGeneratorRcc_h -#define cmQtAutoGeneratorRcc_h +#ifndef cmQtAutoRcc_h +#define cmQtAutoRcc_h #include "cmConfigure.h" // IWYU pragma: keep @@ -15,14 +15,14 @@ class cmMakefile; // @brief AUTORCC generator -class cmQtAutoGeneratorRcc : public cmQtAutoGenerator +class cmQtAutoRcc : public cmQtAutoGenerator { public: - cmQtAutoGeneratorRcc(); - ~cmQtAutoGeneratorRcc() override; + cmQtAutoRcc(); + ~cmQtAutoRcc() override; - cmQtAutoGeneratorRcc(cmQtAutoGeneratorRcc const&) = delete; - cmQtAutoGeneratorRcc& operator=(cmQtAutoGeneratorRcc const&) = delete; + cmQtAutoRcc(cmQtAutoRcc const&) = delete; + cmQtAutoRcc& operator=(cmQtAutoRcc const&) = delete; private: // -- Utility diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index cf9f064..c18c256 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -8,7 +8,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmQtAutoGeneratorMocUic.h" -#include "cmQtAutoGeneratorRcc.h" +#include "cmQtAutoRcc.h" #include "cmRange.h" #include "cmState.h" #include "cmStateDirectory.h" @@ -1024,7 +1024,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector const& args) return autoGen.Run(infoDir, config) ? 0 : 1; } if ((args[1] == "cmake_autorcc") && (args.size() >= 3)) { - cmQtAutoGeneratorRcc autoGen; + cmQtAutoRcc autoGen; std::string const& infoFile = args[2]; std::string config; if (args.size() > 3) { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9710d4aacf801d3dc7ab243bc2c8e051a65871a6 commit 9710d4aacf801d3dc7ab243bc2c8e051a65871a6 Author: Sebastian Holtermann AuthorDate: Sat Apr 6 12:39:33 2019 +0200 Commit: Sebastian Holtermann CommitDate: Sat Apr 6 17:37:12 2019 +0200 Autogen: Move libuv loop from cmQtAutoGenerator to cmQtAutoGeneratorMocUic `cmQtAutoGenerator` automatically started a libuv loop in the constructor. The loop is needed in `cmQtAutoGeneratorMocUic`, but not in `cmQtAutoGeneratorRcc` (anymore). To avoid starting the loop in `cmQtAutoGeneratorRcc`, this patch moves the loop variables and startup code from `cmQtAutoGenerator` to `cmQtAutoGeneratorMocUic`. diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx index 83a00cf..f115016 100644 --- a/Source/cmQtAutoGenerator.cxx +++ b/Source/cmQtAutoGenerator.cxx @@ -657,22 +657,9 @@ void cmQtAutoGenerator::ReadOnlyProcessT::UVTryFinish() } } -cmQtAutoGenerator::cmQtAutoGenerator() -{ - // Initialize libuv loop - uv_disable_stdio_inheritance(); -#ifdef CMAKE_UV_SIGNAL_HACK - UVHackRAII_ = cm::make_unique(); -#endif - UVLoop_ = cm::make_unique(); - uv_loop_init(UVLoop()); -} +cmQtAutoGenerator::cmQtAutoGenerator() = default; -cmQtAutoGenerator::~cmQtAutoGenerator() -{ - // Close libuv loop - uv_loop_close(UVLoop()); -} +cmQtAutoGenerator::~cmQtAutoGenerator() = default; bool cmQtAutoGenerator::Run(std::string const& infoFile, std::string const& config) diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h index 862b18d..479d357 100644 --- a/Source/cmQtAutoGenerator.h +++ b/Source/cmQtAutoGenerator.h @@ -8,7 +8,6 @@ #include "cmFilePathChecksum.h" #include "cmQtAutoGen.h" #include "cmUVHandlePtr.h" -#include "cmUVSignalHackRAII.h" // IWYU pragma: keep #include "cm_uv.h" #include @@ -249,9 +248,6 @@ public: std::string const& InfoFile() const { return InfoFile_; } std::string const& InfoDir() const { return InfoDir_; } std::string const& InfoConfig() const { return InfoConfig_; } - // libuv loop - uv_loop_t* UVLoop() { return UVLoop_.get(); } - cm::uv_async_ptr& UVRequest() { return UVRequest_; } // -- Utility static std::string SettingsFind(std::string const& content, const char* key); @@ -266,12 +262,6 @@ private: std::string InfoFile_; std::string InfoDir_; std::string InfoConfig_; -// -- libuv loop -#ifdef CMAKE_UV_SIGNAL_HACK - std::unique_ptr UVHackRAII_; -#endif - std::unique_ptr UVLoop_; - cm::uv_async_ptr UVRequest_; }; #endif diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx index 32e5067..ec1a1aa 100644 --- a/Source/cmQtAutoGeneratorMocUic.cxx +++ b/Source/cmQtAutoGeneratorMocUic.cxx @@ -1148,11 +1148,23 @@ cmQtAutoGeneratorMocUic::cmQtAutoGeneratorMocUic() Uic_.RegExpInclude.compile("(^|\n)[ \t]*#[ \t]*include[ \t]+" "[\"<](([^ \">]+/)?ui_[^ \">/]+\\.h)[\">]"); + // Initialize libuv loop + uv_disable_stdio_inheritance(); +#ifdef CMAKE_UV_SIGNAL_HACK + UVHackRAII_ = cm::make_unique(); +#endif + UVLoop_ = cm::make_unique(); + uv_loop_init(UVLoop()); + // Initialize libuv asynchronous iteration request UVRequest().init(*UVLoop(), &cmQtAutoGeneratorMocUic::UVPollStage, this); } -cmQtAutoGeneratorMocUic::~cmQtAutoGeneratorMocUic() = default; +cmQtAutoGeneratorMocUic::~cmQtAutoGeneratorMocUic() +{ + // Close libuv loop + uv_loop_close(UVLoop()); +} bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile) { diff --git a/Source/cmQtAutoGeneratorMocUic.h b/Source/cmQtAutoGeneratorMocUic.h index cc785a7..27d73a7 100644 --- a/Source/cmQtAutoGeneratorMocUic.h +++ b/Source/cmQtAutoGeneratorMocUic.h @@ -8,6 +8,7 @@ #include "cmQtAutoGen.h" #include "cmQtAutoGenerator.h" #include "cmUVHandlePtr.h" +#include "cmUVSignalHackRAII.h" // IWYU pragma: keep #include "cm_uv.h" #include "cmsys/RegularExpression.hxx" @@ -390,6 +391,9 @@ private: // -- Utility accessors Logger& Log() { return Logger_; } FileSystem& FileSys() { return FileSys_; } + // -- libuv loop accessors + uv_loop_t* UVLoop() { return UVLoop_.get(); } + cm::uv_async_ptr& UVRequest() { return UVRequest_; } // -- Abstract processing interface bool Init(cmMakefile* makefile) override; bool Process() override; @@ -417,7 +421,12 @@ private: BaseSettingsT Base_; MocSettingsT Moc_; UicSettingsT Uic_; - // -- Progress + // -- libuv loop +#ifdef CMAKE_UV_SIGNAL_HACK + std::unique_ptr UVHackRAII_; +#endif + std::unique_ptr UVLoop_; + cm::uv_async_ptr UVRequest_; StageT Stage_ = StageT::SETTINGS_READ; // -- Job queues std::mutex JobsMutex_; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=95e72c0157ecd9c603fc541fa7e9fa246b777969 commit 95e72c0157ecd9c603fc541fa7e9fa246b777969 Author: Sebastian Holtermann AuthorDate: Sat Apr 6 12:27:08 2019 +0200 Commit: Sebastian Holtermann CommitDate: Sat Apr 6 17:37:12 2019 +0200 Autogen: Make cmQtAutoGenerator::FileSystem Logger free `cmQtAutoGenerator::FileSystem` used to have a reference to a `cmQtAutoGenerator::Logger` instances. This was used for utility methods that automatically generated an error message on demand. Unfortunately this resulted in double error messages in some places. To fix these and with the additional purpose of removing the dependency of `cmQtAutoGenerator::FileSystem` to `cmQtAutoGenerator::Logger`, this patch removes the `Logger` reference in `cmQtAutoGenerator::FileSystem`. In the process some silent error conditions gained error messages and some existing error messages were extended. diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx index c1e6aab..83a00cf 100644 --- a/Source/cmQtAutoGenerator.cxx +++ b/Source/cmQtAutoGenerator.cxx @@ -261,6 +261,10 @@ bool cmQtAutoGenerator::FileWrite(std::string const& filename, }(); } +cmQtAutoGenerator::FileSystem::FileSystem() = default; + +cmQtAutoGenerator::FileSystem::~FileSystem() = default; + std::string cmQtAutoGenerator::FileSystem::GetRealPath( std::string const& filename) { @@ -380,18 +384,6 @@ bool cmQtAutoGenerator::FileSystem::FileRead(std::string& content, return cmQtAutoGenerator::FileRead(content, filename, error); } -bool cmQtAutoGenerator::FileSystem::FileRead(GenT genType, - std::string& content, - std::string const& filename) -{ - std::string error; - if (!FileRead(content, filename, &error)) { - Log()->ErrorFile(genType, filename, error); - return false; - } - return true; -} - bool cmQtAutoGenerator::FileSystem::FileWrite(std::string const& filename, std::string const& content, std::string* error) @@ -400,18 +392,6 @@ bool cmQtAutoGenerator::FileSystem::FileWrite(std::string const& filename, return cmQtAutoGenerator::FileWrite(filename, content, error); } -bool cmQtAutoGenerator::FileSystem::FileWrite(GenT genType, - std::string const& filename, - std::string const& content) -{ - std::string error; - if (!FileWrite(filename, content, &error)) { - Log()->ErrorFile(genType, filename, error); - return false; - } - return true; -} - bool cmQtAutoGenerator::FileSystem::FileDiffers(std::string const& filename, std::string const& content) { @@ -444,16 +424,6 @@ bool cmQtAutoGenerator::FileSystem::MakeDirectory(std::string const& dirname) return cmSystemTools::MakeDirectory(dirname); } -bool cmQtAutoGenerator::FileSystem::MakeDirectory(GenT genType, - std::string const& dirname) -{ - if (!MakeDirectory(dirname)) { - Log()->ErrorFile(genType, dirname, "Could not create directory"); - return false; - } - return true; -} - bool cmQtAutoGenerator::FileSystem::MakeParentDirectory( std::string const& filename) { @@ -461,16 +431,6 @@ bool cmQtAutoGenerator::FileSystem::MakeParentDirectory( return cmQtAutoGenerator::MakeParentDirectory(filename); } -bool cmQtAutoGenerator::FileSystem::MakeParentDirectory( - GenT genType, std::string const& filename) -{ - if (!MakeParentDirectory(filename)) { - Log()->ErrorFile(genType, filename, "Could not create parent directory"); - return false; - } - return true; -} - int cmQtAutoGenerator::ReadOnlyProcessT::PipeT::init(uv_loop_t* uv_loop, ReadOnlyProcessT* process) { diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h index 2993946..862b18d 100644 --- a/Source/cmQtAutoGenerator.h +++ b/Source/cmQtAutoGenerator.h @@ -78,13 +78,8 @@ public: class FileSystem { public: - FileSystem(Logger* log) - : Log_(log) - { - } - - /// @brief Logger - Logger* Log() const { return Log_; } + FileSystem(); + ~FileSystem(); // -- Paths /// @brief Wrapper for cmSystemTools::GetRealPath @@ -125,15 +120,9 @@ public: bool FileRead(std::string& content, std::string const& filename, std::string* error = nullptr); - /// @brief Error logging version - bool FileRead(GenT genType, std::string& content, - std::string const& filename); bool FileWrite(std::string const& filename, std::string const& content, std::string* error = nullptr); - /// @brief Error logging version - bool FileWrite(GenT genType, std::string const& filename, - std::string const& content); bool FileDiffers(std::string const& filename, std::string const& content); @@ -142,17 +131,11 @@ public: // -- Directory access bool MakeDirectory(std::string const& dirname); - /// @brief Error logging version - bool MakeDirectory(GenT genType, std::string const& dirname); - bool MakeParentDirectory(std::string const& filename); - /// @brief Error logging version - bool MakeParentDirectory(GenT genType, std::string const& filename); private: std::mutex Mutex_; cmFilePathChecksum FilePathChecksum_; - Logger* Log_; }; /// @brief Return value and output of an external process diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx index 607576f..32e5067 100644 --- a/Source/cmQtAutoGeneratorMocUic.cxx +++ b/Source/cmQtAutoGeneratorMocUic.cxx @@ -638,13 +638,15 @@ void cmQtAutoGeneratorMocUic::JobMocPredefsT::Process(WorkerT& wrk) if (!result.error()) { if (!fileExists || wrk.FileSys().FileDiffers(wrk.Moc().PredefsFileAbs, result.StdOut)) { - if (wrk.FileSys().FileWrite(GenT::MOC, wrk.Moc().PredefsFileAbs, - result.StdOut)) { + std::string error; + if (wrk.FileSys().FileWrite(wrk.Moc().PredefsFileAbs, result.StdOut, + &error)) { // Success } else { std::string emsg = "Writing "; emsg += Quoted(wrk.Moc().PredefsFileRel); - emsg += " failed."; + emsg += " failed. "; + emsg += error; wrk.LogFileError(GenT::MOC, wrk.Moc().PredefsFileAbs, emsg); } } else { @@ -835,7 +837,12 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk) void cmQtAutoGeneratorMocUic::JobMocT::GenerateMoc(WorkerT& wrk) { // Make sure the parent directory exists - if (wrk.FileSys().MakeParentDirectory(GenT::MOC, BuildFile)) { + if (!wrk.FileSys().MakeParentDirectory(BuildFile)) { + wrk.LogFileError(GenT::MOC, BuildFile, + "Could not create parent directory."); + return; + } + { // Compose moc command std::vector cmd; cmd.push_back(wrk.Moc().Executable); @@ -950,7 +957,12 @@ bool cmQtAutoGeneratorMocUic::JobUicT::UpdateRequired(WorkerT& wrk) void cmQtAutoGeneratorMocUic::JobUicT::GenerateUic(WorkerT& wrk) { // Make sure the parent directory exists - if (wrk.FileSys().MakeParentDirectory(GenT::UIC, BuildFile)) { + if (!wrk.FileSys().MakeParentDirectory(BuildFile)) { + wrk.LogFileError(GenT::UIC, BuildFile, + "Could not create parent directory."); + return; + } + { // Compose uic command std::vector cmd; cmd.push_back(wrk.Uic().Executable); @@ -1126,8 +1138,7 @@ void cmQtAutoGeneratorMocUic::WorkerT::UVProcessFinished() } cmQtAutoGeneratorMocUic::cmQtAutoGeneratorMocUic() - : FileSys_(&Logger_) - , Base_(&FileSys()) + : Base_(&FileSys()) , Moc_(&FileSys()) { // Precompile regular expressions @@ -1692,9 +1703,10 @@ void cmQtAutoGeneratorMocUic::SettingsFileWrite() SettingAppend("uic", SettingsStringUic_); } // Write settings file - if (!FileSys().FileWrite(GenT::GEN, SettingsFile_, content)) { + std::string error; + if (!FileSys().FileWrite(SettingsFile_, content, &error)) { Log().ErrorFile(GenT::GEN, SettingsFile_, - "Settings file writing failed"); + "Settings file writing failed. " + error); // Remove old settings file to trigger a full rebuild on the next run FileSys().FileRemove(SettingsFile_); RegisterJobError(); @@ -1705,7 +1717,9 @@ void cmQtAutoGeneratorMocUic::SettingsFileWrite() void cmQtAutoGeneratorMocUic::CreateDirectories() { // Create AUTOGEN include directory - if (!FileSys().MakeDirectory(GenT::GEN, Base().AutogenIncludeDir)) { + if (!FileSys().MakeDirectory(Base().AutogenIncludeDir)) { + Log().ErrorFile(GenT::GEN, Base().AutogenIncludeDir, + "Could not create directory."); RegisterJobError(); } } @@ -2004,9 +2018,10 @@ void cmQtAutoGeneratorMocUic::MocGenerateCompilation() if (Log().Verbose()) { Log().Info(GenT::MOC, "Generating MOC compilation " + compAbs); } - if (!FileSys().FileWrite(GenT::MOC, compAbs, content)) { + std::string error; + if (!FileSys().FileWrite(compAbs, content, &error)) { Log().ErrorFile(GenT::MOC, compAbs, - "mocs compilation file writing failed"); + "mocs compilation file writing failed. " + error); RegisterJobError(); return; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f161cfe5a8fa00d6d203885e9c1985ec53d7d625 commit f161cfe5a8fa00d6d203885e9c1985ec53d7d625 Author: Sebastian Holtermann AuthorDate: Sat Apr 6 11:43:21 2019 +0200 Commit: Sebastian Holtermann CommitDate: Sat Apr 6 17:37:12 2019 +0200 Autogen: Move Logger and FileSystem member variables to generator classes `cmQtAutoGenerator` automatically added `cmQtAutoGenerator::Logger` and `cmQtAutoGenerator::FileSystem` member variables to all inherited classes. This patch moves these members variable declarations to the inherited classes, where needed. diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx index f56f7c9..c1e6aab 100644 --- a/Source/cmQtAutoGenerator.cxx +++ b/Source/cmQtAutoGenerator.cxx @@ -20,6 +20,34 @@ // -- Class methods +cmQtAutoGenerator::Logger::Logger() +{ + // Initialize logger + { + std::string verbose; + if (cmSystemTools::GetEnv("VERBOSE", verbose) && !verbose.empty()) { + unsigned long iVerbose = 0; + if (cmSystemTools::StringToULong(verbose.c_str(), &iVerbose)) { + SetVerbosity(static_cast(iVerbose)); + } else { + // Non numeric verbosity + SetVerbose(cmSystemTools::IsOn(verbose)); + } + } + } + { + std::string colorEnv; + cmSystemTools::GetEnv("COLOR", colorEnv); + if (!colorEnv.empty()) { + SetColorOutput(cmSystemTools::IsOn(colorEnv)); + } else { + SetColorOutput(true); + } + } +} + +cmQtAutoGenerator::Logger::~Logger() = default; + void cmQtAutoGenerator::Logger::RaiseVerbosity(std::string const& value) { unsigned long verbosity = 0; @@ -670,31 +698,7 @@ void cmQtAutoGenerator::ReadOnlyProcessT::UVTryFinish() } cmQtAutoGenerator::cmQtAutoGenerator() - : FileSys_(&Logger_) { - // Initialize logger - { - std::string verbose; - if (cmSystemTools::GetEnv("VERBOSE", verbose) && !verbose.empty()) { - unsigned long iVerbose = 0; - if (cmSystemTools::StringToULong(verbose.c_str(), &iVerbose)) { - Logger_.SetVerbosity(static_cast(iVerbose)); - } else { - // Non numeric verbosity - Logger_.SetVerbose(cmSystemTools::IsOn(verbose)); - } - } - } - { - std::string colorEnv; - cmSystemTools::GetEnv("COLOR", colorEnv); - if (!colorEnv.empty()) { - Logger_.SetColorOutput(cmSystemTools::IsOn(colorEnv)); - } else { - Logger_.SetColorOutput(true); - } - } - // Initialize libuv loop uv_disable_stdio_inheritance(); #ifdef CMAKE_UV_SIGNAL_HACK diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h index 17170d7..2993946 100644 --- a/Source/cmQtAutoGenerator.h +++ b/Source/cmQtAutoGenerator.h @@ -31,12 +31,16 @@ public: class Logger { public: + // -- Construction + Logger(); + ~Logger(); // -- Verbosity unsigned int Verbosity() const { return this->Verbosity_; } void SetVerbosity(unsigned int value) { this->Verbosity_ = value; } void RaiseVerbosity(std::string const& value); bool Verbose() const { return (this->Verbosity_ != 0); } void SetVerbose(bool value) { this->Verbosity_ = value ? 1 : 0; } + // -- Color output bool ColorOutput() const { return this->ColorOutput_; } void SetColorOutput(bool value); // -- Log info @@ -258,11 +262,6 @@ public: // -- Run bool Run(std::string const& infoFile, std::string const& config); - // -- Accessors - // Logging - Logger& Log() { return Logger_; } - // File System - FileSystem& FileSys() { return FileSys_; } // InfoFile std::string const& InfoFile() const { return InfoFile_; } std::string const& InfoDir() const { return InfoDir_; } @@ -280,9 +279,6 @@ protected: virtual bool Process() = 0; private: - // -- Logging - Logger Logger_; - FileSystem FileSys_; // -- Info settings std::string InfoFile_; std::string InfoDir_; diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx index 0982473..607576f 100644 --- a/Source/cmQtAutoGeneratorMocUic.cxx +++ b/Source/cmQtAutoGeneratorMocUic.cxx @@ -1126,7 +1126,8 @@ void cmQtAutoGeneratorMocUic::WorkerT::UVProcessFinished() } cmQtAutoGeneratorMocUic::cmQtAutoGeneratorMocUic() - : Base_(&FileSys()) + : FileSys_(&Logger_) + , Base_(&FileSys()) , Moc_(&FileSys()) { // Precompile regular expressions diff --git a/Source/cmQtAutoGeneratorMocUic.h b/Source/cmQtAutoGeneratorMocUic.h index e48d7f3..cc785a7 100644 --- a/Source/cmQtAutoGeneratorMocUic.h +++ b/Source/cmQtAutoGeneratorMocUic.h @@ -387,6 +387,9 @@ public: void ParallelMocAutoUpdated(); private: + // -- Utility accessors + Logger& Log() { return Logger_; } + FileSystem& FileSys() { return FileSys_; } // -- Abstract processing interface bool Init(cmMakefile* makefile) override; bool Process() override; @@ -407,6 +410,9 @@ private: void MocGenerateCompilation(); private: + // -- Utility + Logger Logger_; + FileSystem FileSys_; // -- Settings BaseSettingsT Base_; MocSettingsT Moc_; diff --git a/Source/cmQtAutoGeneratorRcc.h b/Source/cmQtAutoGeneratorRcc.h index d831f1f..ff7a02a 100644 --- a/Source/cmQtAutoGeneratorRcc.h +++ b/Source/cmQtAutoGeneratorRcc.h @@ -25,6 +25,11 @@ public: cmQtAutoGeneratorRcc& operator=(cmQtAutoGeneratorRcc const&) = delete; private: + // -- Utility + Logger& Log() { return Logger_; } + bool IsMultiConfig() const { return MultiConfig_; } + std::string MultiConfigOutput() const; + // -- Abstract processing interface bool Init(cmMakefile* makefile) override; bool Process() override; @@ -39,11 +44,9 @@ private: bool GenerateRcc(); bool GenerateWrapper(); - // -- Utility - bool IsMultiConfig() const { return MultiConfig_; } - std::string MultiConfigOutput() const; - private: + // -- Logging + Logger Logger_; // -- Config settings bool MultiConfig_ = false; // -- Directories https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7baec5e94b372cfc21e777488ecf993e4bce368e commit 7baec5e94b372cfc21e777488ecf993e4bce368e Author: Sebastian Holtermann AuthorDate: Fri Apr 5 23:43:19 2019 +0200 Commit: Sebastian Holtermann CommitDate: Sat Apr 6 17:37:08 2019 +0200 AutoRcc: Don't use cmQtAutoGenerator::FileSystem methods `cmQtAutoGenerator::FileSystem` is only required for concurrent file system access, but `cmQtAutoGeneratorRcc` isn't concurrent. Therefore this patch replaces all `cmQtAutoGenerator::FileSystem` uses in `cmQtAutoGeneratorRcc`. diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx index 27afe48..f56f7c9 100644 --- a/Source/cmQtAutoGenerator.cxx +++ b/Source/cmQtAutoGenerator.cxx @@ -152,6 +152,87 @@ void cmQtAutoGenerator::Logger::ErrorCommand( } } +bool cmQtAutoGenerator::MakeParentDirectory(std::string const& filename) +{ + bool success = true; + std::string const dirName = cmSystemTools::GetFilenamePath(filename); + if (!dirName.empty()) { + success = cmSystemTools::MakeDirectory(dirName); + } + return success; +} + +bool cmQtAutoGenerator::FileRead(std::string& content, + std::string const& filename, + std::string* error) +{ + content.clear(); + if (!cmSystemTools::FileExists(filename, true)) { + if (error != nullptr) { + error->append("Not a file."); + } + return false; + } + + unsigned long const length = cmSystemTools::FileLength(filename); + cmsys::ifstream ifs(filename.c_str(), (std::ios::in | std::ios::binary)); + + // Use lambda to save destructor calls of ifs + return [&ifs, length, &content, error]() -> bool { + if (!ifs) { + if (error != nullptr) { + error->append("Opening the file for reading failed."); + } + return false; + } + content.reserve(length); + typedef std::istreambuf_iterator IsIt; + content.assign(IsIt{ ifs }, IsIt{}); + if (!ifs) { + content.clear(); + if (error != nullptr) { + error->append("Reading from the file failed."); + } + return false; + } + return true; + }(); +} + +bool cmQtAutoGenerator::FileWrite(std::string const& filename, + std::string const& content, + std::string* error) +{ + // Make sure the parent directory exists + if (!cmQtAutoGenerator::MakeParentDirectory(filename)) { + if (error != nullptr) { + error->assign("Could not create parent directory."); + } + return false; + } + cmsys::ofstream ofs; + ofs.open(filename.c_str(), + (std::ios::out | std::ios::binary | std::ios::trunc)); + + // Use lambda to save destructor calls of ofs + return [&ofs, &content, error]() -> bool { + if (!ofs) { + if (error != nullptr) { + error->assign("Opening file for writing failed."); + } + return false; + } + ofs << content; + if (!ofs.good()) { + if (error != nullptr) { + error->assign("File writing failed."); + } + return false; + } + return true; + }(); +} + std::string cmQtAutoGenerator::FileSystem::GetRealPath( std::string const& filename) { @@ -267,33 +348,8 @@ bool cmQtAutoGenerator::FileSystem::FileRead(std::string& content, std::string const& filename, std::string* error) { - bool success = false; - if (FileExists(filename, true)) { - unsigned long const length = FileLength(filename); - { - std::lock_guard lock(Mutex_); - cmsys::ifstream ifs(filename.c_str(), (std::ios::in | std::ios::binary)); - if (ifs) { - content.reserve(length); - content.assign(std::istreambuf_iterator{ ifs }, - std::istreambuf_iterator{}); - if (ifs) { - success = true; - } else { - content.clear(); - if (error != nullptr) { - error->append("Reading from the file failed."); - } - } - } else if (error != nullptr) { - error->append("Opening the file for reading failed."); - } - } - } else if (error != nullptr) { - error->append( - "The file does not exist, is not readable or is a directory."); - } - return success; + std::lock_guard lock(Mutex_); + return cmQtAutoGenerator::FileRead(content, filename, error); } bool cmQtAutoGenerator::FileSystem::FileRead(GenT genType, @@ -312,34 +368,8 @@ bool cmQtAutoGenerator::FileSystem::FileWrite(std::string const& filename, std::string const& content, std::string* error) { - bool success = false; - // Make sure the parent directory exists - if (MakeParentDirectory(filename)) { - std::lock_guard lock(Mutex_); - cmsys::ofstream outfile; - outfile.open(filename.c_str(), - (std::ios::out | std::ios::binary | std::ios::trunc)); - if (outfile) { - outfile << content; - // Check for write errors - if (outfile.good()) { - success = true; - } else { - if (error != nullptr) { - error->assign("File writing failed"); - } - } - } else { - if (error != nullptr) { - error->assign("Opening file for writing failed"); - } - } - } else { - if (error != nullptr) { - error->assign("Could not create parent directory"); - } - } - return success; + std::lock_guard lock(Mutex_); + return cmQtAutoGenerator::FileWrite(filename, content, error); } bool cmQtAutoGenerator::FileSystem::FileWrite(GenT genType, @@ -399,12 +429,8 @@ bool cmQtAutoGenerator::FileSystem::MakeDirectory(GenT genType, bool cmQtAutoGenerator::FileSystem::MakeParentDirectory( std::string const& filename) { - bool success = true; - std::string const dirName = cmSystemTools::GetFilenamePath(filename); - if (!dirName.empty()) { - success = MakeDirectory(dirName); - } - return success; + std::lock_guard lock(Mutex_); + return cmQtAutoGenerator::MakeParentDirectory(filename); } bool cmQtAutoGenerator::FileSystem::MakeParentDirectory( diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h index b55bebc..17170d7 100644 --- a/Source/cmQtAutoGenerator.h +++ b/Source/cmQtAutoGenerator.h @@ -62,6 +62,14 @@ public: bool ColorOutput_ = false; }; + // -- File system methods + static bool MakeParentDirectory(std::string const& filename); + static bool FileRead(std::string& content, std::string const& filename, + std::string* error = nullptr); + static bool FileWrite(std::string const& filename, + std::string const& content, + std::string* error = nullptr); + /// @brief Thread safe file system interface class FileSystem { diff --git a/Source/cmQtAutoGeneratorRcc.cxx b/Source/cmQtAutoGeneratorRcc.cxx index 792e6fd..add84de 100644 --- a/Source/cmQtAutoGeneratorRcc.cxx +++ b/Source/cmQtAutoGeneratorRcc.cxx @@ -52,7 +52,7 @@ bool cmQtAutoGeneratorRcc::Init(cmMakefile* makefile) // -- Read info file if (!makefile->ReadListFile(InfoFile())) { - Log().ErrorFile(GenT::RCC, InfoFile(), "File processing failed"); + Log().ErrorFile(GenT::RCC, InfoFile(), "File processing failed."); return false; } @@ -63,13 +63,13 @@ bool cmQtAutoGeneratorRcc::Init(cmMakefile* makefile) // - Directories AutogenBuildDir_ = InfoGet("ARCC_BUILD_DIR"); if (AutogenBuildDir_.empty()) { - Log().ErrorFile(GenT::RCC, InfoFile(), "Build directory empty"); + Log().ErrorFile(GenT::RCC, InfoFile(), "Build directory empty."); return false; } IncludeDir_ = InfoGetConfig("ARCC_INCLUDE_DIR"); if (IncludeDir_.empty()) { - Log().ErrorFile(GenT::RCC, InfoFile(), "Include directory empty"); + Log().ErrorFile(GenT::RCC, InfoFile(), "Include directory empty."); return false; } @@ -92,27 +92,27 @@ bool cmQtAutoGeneratorRcc::Init(cmMakefile* makefile) // - Validity checks if (LockFile_.empty()) { - Log().ErrorFile(GenT::RCC, InfoFile(), "Lock file name missing"); + Log().ErrorFile(GenT::RCC, InfoFile(), "Lock file name missing."); return false; } if (SettingsFile_.empty()) { - Log().ErrorFile(GenT::RCC, InfoFile(), "Settings file name missing"); + Log().ErrorFile(GenT::RCC, InfoFile(), "Settings file name missing."); return false; } if (AutogenBuildDir_.empty()) { - Log().ErrorFile(GenT::RCC, InfoFile(), "Autogen build directory missing"); + Log().ErrorFile(GenT::RCC, InfoFile(), "Autogen build directory missing."); return false; } if (RccExecutable_.empty()) { - Log().ErrorFile(GenT::RCC, InfoFile(), "rcc executable missing"); + Log().ErrorFile(GenT::RCC, InfoFile(), "rcc executable missing."); return false; } if (QrcFile_.empty()) { - Log().ErrorFile(GenT::RCC, InfoFile(), "rcc input file missing"); + Log().ErrorFile(GenT::RCC, InfoFile(), "rcc input file missing."); return false; } if (RccFileName_.empty()) { - Log().ErrorFile(GenT::RCC, InfoFile(), "rcc output file missing"); + Log().ErrorFile(GenT::RCC, InfoFile(), "rcc output file missing."); return false; } @@ -153,9 +153,6 @@ bool cmQtAutoGeneratorRcc::Process() } // Generate on demand if (generate) { - if (!GenerateParentDir()) { - return false; - } if (!GenerateRcc()) { return false; } @@ -210,17 +207,21 @@ bool cmQtAutoGeneratorRcc::SettingsFileRead() } // Make sure the settings file exists - if (!FileSys().FileExists(SettingsFile_, true)) { + if (!cmSystemTools::FileExists(SettingsFile_, true)) { // Touch the settings file to make sure it exists - FileSys().Touch(SettingsFile_, true); + if (!cmSystemTools::Touch(SettingsFile_, true)) { + Log().ErrorFile(GenT::RCC, SettingsFile_, + "Settings file creation failed."); + return false; + } } // Lock the lock file { // Make sure the lock file exists - if (!FileSys().FileExists(LockFile_, true)) { - if (!FileSys().Touch(LockFile_, true)) { - Log().ErrorFile(GenT::RCC, LockFile_, "Lock file creation failed"); + if (!cmSystemTools::FileExists(LockFile_, true)) { + if (!cmSystemTools::Touch(LockFile_, true)) { + Log().ErrorFile(GenT::RCC, LockFile_, "Lock file creation failed."); return false; } } @@ -237,13 +238,18 @@ bool cmQtAutoGeneratorRcc::SettingsFileRead() // Read old settings { std::string content; - if (FileSys().FileRead(content, SettingsFile_)) { + if (FileRead(content, SettingsFile_)) { SettingsChanged_ = (SettingsString_ != SettingsFind(content, "rcc")); // In case any setting changed clear the old settings file. // This triggers a full rebuild on the next run if the current // build is aborted before writing the current settings in the end. if (SettingsChanged_) { - FileSys().FileWrite(GenT::RCC, SettingsFile_, ""); + std::string error; + if (!FileWrite(SettingsFile_, "", &error)) { + Log().ErrorFile(GenT::RCC, SettingsFile_, + "Settings file clearing failed. " + error); + return false; + } } } else { SettingsChanged_ = true; @@ -264,11 +270,12 @@ bool cmQtAutoGeneratorRcc::SettingsFileWrite() std::string content = "rcc:"; content += SettingsString_; content += '\n'; - if (!FileSys().FileWrite(GenT::RCC, SettingsFile_, content)) { + std::string error; + if (!FileWrite(SettingsFile_, content, &error)) { Log().ErrorFile(GenT::RCC, SettingsFile_, - "Settings file writing failed"); + "Settings file writing failed. " + error); // Remove old settings file to trigger a full rebuild on the next run - FileSys().FileRemove(SettingsFile_); + cmSystemTools::RemoveFile(SettingsFile_); return false; } } @@ -398,21 +405,25 @@ bool cmQtAutoGeneratorRcc::TestInfoFile() Log().Info(GenT::RCC, reason); } // Touch build file - FileSys().Touch(RccFileOutput_); + if (!cmSystemTools::Touch(RccFileOutput_, false)) { + Log().ErrorFile(GenT::RCC, RccFileOutput_, "Build file touch failed"); + return false; + } BuildFileChanged_ = true; } return true; } -bool cmQtAutoGeneratorRcc::GenerateParentDir() -{ - // Make sure the parent directory exists - return FileSys().MakeParentDirectory(GenT::RCC, RccFileOutput_); -} - bool cmQtAutoGeneratorRcc::GenerateRcc() { + // Make parent directory + if (!MakeParentDirectory(RccFileOutput_)) { + Log().ErrorFile(GenT::RCC, RccFileOutput_, + "Could not create parent directory"); + return false; + } + // Start a rcc process std::vector cmd; cmd.push_back(RccExecutable_); @@ -444,7 +455,7 @@ bool cmQtAutoGeneratorRcc::GenerateRcc() err += Quoted(RccFileOutput_); Log().ErrorCommand(GenT::RCC, err, cmd, rccStdOut + rccStdErr); } - FileSys().FileRemove(RccFileOutput_); + cmSystemTools::RemoveFile(RccFileOutput_); return false; } @@ -470,15 +481,23 @@ bool cmQtAutoGeneratorRcc::GenerateWrapper() content += MultiConfigOutput(); content += ">\n"; - // Write content to file - if (FileSys().FileDiffers(RccFilePublic_, content)) { + // Compare with existing file content + bool fileDiffers = true; + { + std::string oldContents; + if (FileRead(oldContents, RccFilePublic_)) { + fileDiffers = (oldContents != content); + } + } + if (fileDiffers) { // Write new wrapper file if (Log().Verbose()) { Log().Info(GenT::RCC, "Generating RCC wrapper file " + RccFilePublic_); } - if (!FileSys().FileWrite(GenT::RCC, RccFilePublic_, content)) { + std::string error; + if (!FileWrite(RccFilePublic_, content, &error)) { Log().ErrorFile(GenT::RCC, RccFilePublic_, - "RCC wrapper file writing failed"); + "RCC wrapper file writing failed. " + error); return false; } } else if (BuildFileChanged_) { @@ -486,7 +505,11 @@ bool cmQtAutoGeneratorRcc::GenerateWrapper() if (Log().Verbose()) { Log().Info(GenT::RCC, "Touching RCC wrapper file " + RccFilePublic_); } - FileSys().Touch(RccFilePublic_); + if (!cmSystemTools::Touch(RccFilePublic_, false)) { + Log().ErrorFile(GenT::RCC, RccFilePublic_, + "RCC wrapper file touch failed."); + return false; + } } } return true; diff --git a/Source/cmQtAutoGeneratorRcc.h b/Source/cmQtAutoGeneratorRcc.h index baa560c..d831f1f 100644 --- a/Source/cmQtAutoGeneratorRcc.h +++ b/Source/cmQtAutoGeneratorRcc.h @@ -36,7 +36,6 @@ private: bool TestResources(bool& generate); bool TestInfoFile(); // -- Generation - bool GenerateParentDir(); bool GenerateRcc(); bool GenerateWrapper(); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=191269d247827a4c1de739165c0555b4c9ea9d79 commit 191269d247827a4c1de739165c0555b4c9ea9d79 Author: Sebastian Holtermann AuthorDate: Fri Apr 5 21:54:53 2019 +0200 Commit: Sebastian Holtermann CommitDate: Sat Apr 6 16:38:40 2019 +0200 AutoRcc: Remove libuv event loop from cmQtAutoGeneratorRcc Using a libuv event loop in AUTORCC is unnecessary and over complicated. This patch removes the loop and makes `cmQtAutoGeneratorRcc::Process` a regular serial processing method. diff --git a/Source/cmQtAutoGeneratorRcc.cxx b/Source/cmQtAutoGeneratorRcc.cxx index 309d0e5..792e6fd 100644 --- a/Source/cmQtAutoGeneratorRcc.cxx +++ b/Source/cmQtAutoGeneratorRcc.cxx @@ -5,18 +5,15 @@ #include "cmAlgorithms.h" #include "cmCryptoHash.h" +#include "cmDuration.h" #include "cmFileLockResult.h" #include "cmMakefile.h" +#include "cmProcessOutput.h" #include "cmSystemTools.h" -#include "cmUVHandlePtr.h" // -- Class methods -cmQtAutoGeneratorRcc::cmQtAutoGeneratorRcc() -{ - // Initialize libuv asynchronous iteration request - UVRequest().init(*UVLoop(), &cmQtAutoGeneratorRcc::UVPollStage, this); -} +cmQtAutoGeneratorRcc::cmQtAutoGeneratorRcc() = default; cmQtAutoGeneratorRcc::~cmQtAutoGeneratorRcc() = default; @@ -142,101 +139,38 @@ bool cmQtAutoGeneratorRcc::Init(cmMakefile* makefile) bool cmQtAutoGeneratorRcc::Process() { - // Run libuv event loop - UVRequest().send(); - if (uv_run(UVLoop(), UV_RUN_DEFAULT) == 0) { - if (Error_) { + if (!SettingsFileRead()) { + return false; + } + + // Test if the rcc output needs to be regenerated + bool generate = false; + if (!TestQrcRccFiles(generate)) { + return false; + } + if (!generate && !TestResources(generate)) { + return false; + } + // Generate on demand + if (generate) { + if (!GenerateParentDir()) { + return false; + } + if (!GenerateRcc()) { return false; } } else { - return false; + // Test if the info file is newer than the output file + if (!TestInfoFile()) { + return false; + } } - return true; -} - -void cmQtAutoGeneratorRcc::UVPollStage(uv_async_t* handle) -{ - reinterpret_cast(handle->data)->PollStage(); -} - -void cmQtAutoGeneratorRcc::PollStage() -{ - switch (Stage_) { - // -- Initialize - case StageT::SETTINGS_READ: - if (SettingsFileRead()) { - SetStage(StageT::TEST_QRC_RCC_FILES); - } else { - SetStage(StageT::FINISH); - } - break; - - // -- Change detection - case StageT::TEST_QRC_RCC_FILES: - if (TestQrcRccFiles()) { - SetStage(StageT::GENERATE); - } else { - SetStage(StageT::TEST_RESOURCES_READ); - } - break; - case StageT::TEST_RESOURCES_READ: - if (TestResourcesRead()) { - SetStage(StageT::TEST_RESOURCES); - } - break; - case StageT::TEST_RESOURCES: - if (TestResources()) { - SetStage(StageT::GENERATE); - } else { - SetStage(StageT::TEST_INFO_FILE); - } - break; - case StageT::TEST_INFO_FILE: - TestInfoFile(); - SetStage(StageT::GENERATE_WRAPPER); - break; - - // -- Generation - case StageT::GENERATE: - GenerateParentDir(); - SetStage(StageT::GENERATE_RCC); - break; - case StageT::GENERATE_RCC: - if (GenerateRcc()) { - SetStage(StageT::GENERATE_WRAPPER); - } - break; - case StageT::GENERATE_WRAPPER: - GenerateWrapper(); - SetStage(StageT::SETTINGS_WRITE); - break; - // -- Finalize - case StageT::SETTINGS_WRITE: - SettingsFileWrite(); - SetStage(StageT::FINISH); - break; - case StageT::FINISH: - // Clear all libuv handles - UVRequest().reset(); - // Set highest END stage manually - Stage_ = StageT::END; - break; - case StageT::END: - break; + if (!GenerateWrapper()) { + return false; } -} -void cmQtAutoGeneratorRcc::SetStage(StageT stage) -{ - if (Error_) { - stage = StageT::FINISH; - } - // Only allow to increase the stage - if (Stage_ < stage) { - Stage_ = stage; - UVRequest().send(); - } + return SettingsFileWrite(); } std::string cmQtAutoGeneratorRcc::MultiConfigOutput() const @@ -287,7 +221,6 @@ bool cmQtAutoGeneratorRcc::SettingsFileRead() if (!FileSys().FileExists(LockFile_, true)) { if (!FileSys().Touch(LockFile_, true)) { Log().ErrorFile(GenT::RCC, LockFile_, "Lock file creation failed"); - Error_ = true; return false; } } @@ -297,7 +230,6 @@ bool cmQtAutoGeneratorRcc::SettingsFileRead() if (!lockResult.IsOk()) { Log().ErrorFile(GenT::RCC, LockFile_, "File lock failed: " + lockResult.GetOutputMessage()); - Error_ = true; return false; } } @@ -321,7 +253,7 @@ bool cmQtAutoGeneratorRcc::SettingsFileRead() return true; } -void cmQtAutoGeneratorRcc::SettingsFileWrite() +bool cmQtAutoGeneratorRcc::SettingsFileWrite() { // Only write if any setting changed if (SettingsChanged_) { @@ -337,20 +269,30 @@ void cmQtAutoGeneratorRcc::SettingsFileWrite() "Settings file writing failed"); // Remove old settings file to trigger a full rebuild on the next run FileSys().FileRemove(SettingsFile_); - Error_ = true; + return false; } } // Unlock the lock file LockFileLock_.Release(); + return true; } -bool cmQtAutoGeneratorRcc::TestQrcRccFiles() +/// Do basic checks if rcc generation is required +bool cmQtAutoGeneratorRcc::TestQrcRccFiles(bool& generate) { - // Do basic checks if rcc generation is required + // Test if the rcc input file exists + if (!QrcFileTime_.Load(QrcFile_)) { + std::string error; + error = "The resources file "; + error += Quoted(QrcFile_); + error += " does not exist"; + Log().ErrorFile(GenT::RCC, QrcFile_, error); + return false; + } // Test if the rcc output file exists - if (!FileSys().FileExists(RccFileOutput_)) { + if (!RccFileTime_.Load(RccFileOutput_)) { if (Log().Verbose()) { std::string reason = "Generating "; reason += Quoted(RccFileOutput_); @@ -359,8 +301,8 @@ bool cmQtAutoGeneratorRcc::TestQrcRccFiles() reason += " because it doesn't exist"; Log().Info(GenT::RCC, reason); } - Generate_ = true; - return Generate_; + generate = true; + return true; } // Test if the settings changed @@ -373,192 +315,150 @@ bool cmQtAutoGeneratorRcc::TestQrcRccFiles() reason += " because the RCC settings changed"; Log().Info(GenT::RCC, reason); } - Generate_ = true; - return Generate_; + generate = true; + return true; } // Test if the rcc output file is older than the .qrc file - { - bool isOlder = false; - { - std::string error; - isOlder = FileSys().FileIsOlderThan(RccFileOutput_, QrcFile_, &error); - if (!error.empty()) { - Log().ErrorFile(GenT::RCC, QrcFile_, error); - Error_ = true; - } - } - if (isOlder) { - if (Log().Verbose()) { - std::string reason = "Generating "; - reason += Quoted(RccFileOutput_); - reason += " because it is older than "; - reason += Quoted(QrcFile_); - Log().Info(GenT::RCC, reason); - } - Generate_ = true; + if (RccFileTime_.Older(QrcFileTime_)) { + if (Log().Verbose()) { + std::string reason = "Generating "; + reason += Quoted(RccFileOutput_); + reason += " because it is older than "; + reason += Quoted(QrcFile_); + Log().Info(GenT::RCC, reason); } - } - - return Generate_; -} - -bool cmQtAutoGeneratorRcc::TestResourcesRead() -{ - if (!Inputs_.empty()) { - // Inputs are known already + generate = true; return true; } - std::string error; - RccLister lister(RccExecutable_, RccListOptions_); - if (!lister.list(QrcFile_, Inputs_, error)) { - Log().ErrorFile(GenT::RCC, QrcFile_, error); - Error_ = true; - } return true; } -bool cmQtAutoGeneratorRcc::TestResources() +bool cmQtAutoGeneratorRcc::TestResources(bool& generate) { + // Read resource files list if (Inputs_.empty()) { - return true; - } - { std::string error; - for (std::string const& resFile : Inputs_) { - // Check if the resource file exists - if (!FileSys().FileExists(resFile)) { - error = "Could not find the resource file\n "; - error += Quoted(resFile); - error += '\n'; - Log().ErrorFile(GenT::RCC, QrcFile_, error); - Error_ = true; - break; - } - // Check if the resource file is newer than the build file - if (FileSys().FileIsOlderThan(RccFileOutput_, resFile, &error)) { - if (Log().Verbose()) { - std::string reason = "Generating "; - reason += Quoted(RccFileOutput_); - reason += " from "; - reason += Quoted(QrcFile_); - reason += " because it is older than "; - reason += Quoted(resFile); - Log().Info(GenT::RCC, reason); - } - Generate_ = true; - break; - } - // Print error and break on demand - if (!error.empty()) { - Log().ErrorFile(GenT::RCC, QrcFile_, error); - Error_ = true; - break; - } + RccLister const lister(RccExecutable_, RccListOptions_); + if (!lister.list(QrcFile_, Inputs_, error, Log().Verbose())) { + Log().ErrorFile(GenT::RCC, QrcFile_, error); + return false; } } - return Generate_; -} - -void cmQtAutoGeneratorRcc::TestInfoFile() -{ - // Test if the rcc output file is older than the info file - { - bool isOlder = false; - { + for (std::string const& resFile : Inputs_) { + // Check if the resource file exists + cmFileTime fileTime; + if (!fileTime.Load(resFile)) { std::string error; - isOlder = FileSys().FileIsOlderThan(RccFileOutput_, InfoFile(), &error); - if (!error.empty()) { - Log().ErrorFile(GenT::RCC, QrcFile_, error); - Error_ = true; - } + error = "Could not find the resource file\n "; + error += Quoted(resFile); + error += '\n'; + Log().ErrorFile(GenT::RCC, QrcFile_, error); + return false; } - if (isOlder) { + // Check if the resource file is newer than the build file + if (RccFileTime_.Older(fileTime)) { if (Log().Verbose()) { - std::string reason = "Touching "; + std::string reason = "Generating "; reason += Quoted(RccFileOutput_); + reason += " from "; + reason += Quoted(QrcFile_); reason += " because it is older than "; - reason += Quoted(InfoFile()); + reason += Quoted(resFile); Log().Info(GenT::RCC, reason); } - // Touch build file - FileSys().Touch(RccFileOutput_); - BuildFileChanged_ = true; + generate = true; + break; } } + return true; } -void cmQtAutoGeneratorRcc::GenerateParentDir() +bool cmQtAutoGeneratorRcc::TestInfoFile() { - // Make sure the parent directory exists - if (!FileSys().MakeParentDirectory(GenT::RCC, RccFileOutput_)) { - Error_ = true; + // Test if the rcc output file is older than the info file + + cmFileTime infoFileTime; + if (!infoFileTime.Load(InfoFile())) { + std::string error; + error = "Could not find the info file "; + error += Quoted(InfoFile()); + error += '\n'; + Log().ErrorFile(GenT::RCC, QrcFile_, error); + return false; + } + if (RccFileTime_.Older(infoFileTime)) { + if (Log().Verbose()) { + std::string reason = "Touching "; + reason += Quoted(RccFileOutput_); + reason += " because it is older than "; + reason += Quoted(InfoFile()); + Log().Info(GenT::RCC, reason); + } + // Touch build file + FileSys().Touch(RccFileOutput_); + BuildFileChanged_ = true; } + + return true; +} + +bool cmQtAutoGeneratorRcc::GenerateParentDir() +{ + // Make sure the parent directory exists + return FileSys().MakeParentDirectory(GenT::RCC, RccFileOutput_); } -/** - * @return True when finished - */ bool cmQtAutoGeneratorRcc::GenerateRcc() { - if (!Generate_) { - // Nothing to do - return true; + // Start a rcc process + std::vector cmd; + cmd.push_back(RccExecutable_); + cmd.insert(cmd.end(), Options_.begin(), Options_.end()); + cmd.emplace_back("-o"); + cmd.push_back(RccFileOutput_); + cmd.push_back(QrcFile_); + + // Log command + if (Log().Verbose()) { + std::string msg = "Running command:\n"; + msg += QuotedCommand(cmd); + msg += '\n'; + cmSystemTools::Stdout(msg); } - if (Process_) { - // Process is running already - if (Process_->IsFinished()) { - // Process is finished - if (!ProcessResult_.error()) { - // Rcc process success - // Print rcc output - if (!ProcessResult_.StdOut.empty()) { - Log().Info(GenT::RCC, ProcessResult_.StdOut); - } - BuildFileChanged_ = true; - } else { - // Rcc process failed - { - std::string emsg = "The rcc process failed to compile\n "; - emsg += Quoted(QrcFile_); - emsg += "\ninto\n "; - emsg += Quoted(RccFileOutput_); - if (ProcessResult_.error()) { - emsg += "\n"; - emsg += ProcessResult_.ErrorMessage; - } - Log().ErrorCommand(GenT::RCC, emsg, Process_->Setup().Command, - ProcessResult_.StdOut); - } - FileSys().FileRemove(RccFileOutput_); - Error_ = true; - } - // Clean up - Process_.reset(); - ProcessResult_.reset(); - } else { - // Process is not finished, yet. - return false; + std::string rccStdOut; + std::string rccStdErr; + int retVal = 0; + bool result = cmSystemTools::RunSingleCommand( + cmd, &rccStdOut, &rccStdErr, &retVal, AutogenBuildDir_.c_str(), + cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto); + if (!result || (retVal != 0)) { + // rcc process failed + { + std::string err = "The rcc process failed to compile\n "; + err += Quoted(QrcFile_); + err += "\ninto\n "; + err += Quoted(RccFileOutput_); + Log().ErrorCommand(GenT::RCC, err, cmd, rccStdOut + rccStdErr); } - } else { - // Start a rcc process - std::vector cmd; - cmd.push_back(RccExecutable_); - cmd.insert(cmd.end(), Options_.begin(), Options_.end()); - cmd.emplace_back("-o"); - cmd.push_back(RccFileOutput_); - cmd.push_back(QrcFile_); - // We're done here if the process fails to start - return !StartProcess(AutogenBuildDir_, cmd, true); + FileSys().FileRemove(RccFileOutput_); + return false; } + // rcc process success + // Print rcc output + if (!rccStdOut.empty()) { + Log().Info(GenT::RCC, rccStdOut); + } + BuildFileChanged_ = true; + return true; } -void cmQtAutoGeneratorRcc::GenerateWrapper() +bool cmQtAutoGeneratorRcc::GenerateWrapper() { // Generate a wrapper source file on demand if (IsMultiConfig()) { @@ -579,7 +479,7 @@ void cmQtAutoGeneratorRcc::GenerateWrapper() if (!FileSys().FileWrite(GenT::RCC, RccFilePublic_, content)) { Log().ErrorFile(GenT::RCC, RccFilePublic_, "RCC wrapper file writing failed"); - Error_ = true; + return false; } } else if (BuildFileChanged_) { // Just touch the wrapper file @@ -589,31 +489,5 @@ void cmQtAutoGeneratorRcc::GenerateWrapper() FileSys().Touch(RccFilePublic_); } } -} - -bool cmQtAutoGeneratorRcc::StartProcess( - std::string const& workingDirectory, std::vector const& command, - bool mergedOutput) -{ - // Log command - if (Log().Verbose()) { - std::string msg = "Running command:\n"; - msg += QuotedCommand(command); - msg += '\n'; - Log().Info(GenT::RCC, msg); - } - - // Create process handler - Process_ = cm::make_unique(); - Process_->setup(&ProcessResult_, mergedOutput, command, workingDirectory); - // Start process - if (!Process_->start(UVLoop(), [this] { UVRequest().send(); })) { - Log().ErrorFile(GenT::RCC, QrcFile_, ProcessResult_.ErrorMessage); - Error_ = true; - // Clean up - Process_.reset(); - ProcessResult_.reset(); - return false; - } return true; } diff --git a/Source/cmQtAutoGeneratorRcc.h b/Source/cmQtAutoGeneratorRcc.h index 1ec1c4a..baa560c 100644 --- a/Source/cmQtAutoGeneratorRcc.h +++ b/Source/cmQtAutoGeneratorRcc.h @@ -6,8 +6,8 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cmFileLock.h" +#include "cmFileTime.h" #include "cmQtAutoGenerator.h" -#include "cm_uv.h" #include #include @@ -25,50 +25,24 @@ public: cmQtAutoGeneratorRcc& operator=(cmQtAutoGeneratorRcc const&) = delete; private: - // -- Types - - /// @brief Processing stage - enum class StageT : unsigned char - { - SETTINGS_READ, - TEST_QRC_RCC_FILES, - TEST_RESOURCES_READ, - TEST_RESOURCES, - TEST_INFO_FILE, - GENERATE, - GENERATE_RCC, - GENERATE_WRAPPER, - SETTINGS_WRITE, - FINISH, - END - }; - // -- Abstract processing interface bool Init(cmMakefile* makefile) override; bool Process() override; - // -- Process stage - static void UVPollStage(uv_async_t* handle); - void PollStage(); - void SetStage(StageT stage); // -- Settings file bool SettingsFileRead(); - void SettingsFileWrite(); + bool SettingsFileWrite(); // -- Tests - bool TestQrcRccFiles(); - bool TestResourcesRead(); - bool TestResources(); - void TestInfoFile(); + bool TestQrcRccFiles(bool& generate); + bool TestResources(bool& generate); + bool TestInfoFile(); // -- Generation - void GenerateParentDir(); + bool GenerateParentDir(); bool GenerateRcc(); - void GenerateWrapper(); + bool GenerateWrapper(); // -- Utility bool IsMultiConfig() const { return MultiConfig_; } std::string MultiConfigOutput() const; - bool StartProcess(std::string const& workingDirectory, - std::vector const& command, - bool mergedOutput); private: // -- Config settings @@ -85,23 +59,18 @@ private: std::string QrcFile_; std::string QrcFileName_; std::string QrcFileDir_; + cmFileTime QrcFileTime_; std::string RccPathChecksum_; std::string RccFileName_; std::string RccFileOutput_; std::string RccFilePublic_; + cmFileTime RccFileTime_; std::vector Options_; std::vector Inputs_; - // -- Subprocess - ProcessResultT ProcessResult_; - std::unique_ptr Process_; // -- Settings file std::string SettingsFile_; std::string SettingsString_; bool SettingsChanged_ = false; - // -- libuv loop - StageT Stage_ = StageT::SETTINGS_READ; - bool Error_ = false; - bool Generate_ = false; bool BuildFileChanged_ = false; }; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=95de172b68b23124d8dfa3fb238876b8f2ecd3e7 commit 95de172b68b23124d8dfa3fb238876b8f2ecd3e7 Author: Sebastian Holtermann AuthorDate: Fri Apr 5 21:34:42 2019 +0200 Commit: Sebastian Holtermann CommitDate: Sat Apr 6 16:17:40 2019 +0200 AutoRcc: Make rcc parsing function private The `.qrc` parsing functions in `cmQtAutoGen` are no longer needed outside the private implementation of `cmQtAutoGen::RccLister`. This makes them private, too. diff --git a/Source/cmQtAutoGen.cxx b/Source/cmQtAutoGen.cxx index 9880c02..9918c35 100644 --- a/Source/cmQtAutoGen.cxx +++ b/Source/cmQtAutoGen.cxx @@ -240,8 +240,8 @@ void cmQtAutoGen::RccMergeOptions(std::vector& baseOpts, MergeOptions(baseOpts, newOpts, valueOpts, isQt5); } -void cmQtAutoGen::RccListParseContent(std::string const& content, - std::vector& files) +static void RccListParseContent(std::string const& content, + std::vector& files) { cmsys::RegularExpression fileMatchRegex("(]*>)"); @@ -258,10 +258,10 @@ void cmQtAutoGen::RccListParseContent(std::string const& content, } } -bool cmQtAutoGen::RccListParseOutput(std::string const& rccStdOut, - std::string const& rccStdErr, - std::vector& files, - std::string& error) +static bool RccListParseOutput(std::string const& rccStdOut, + std::string const& rccStdErr, + std::vector& files, + std::string& error) { // Lambda to strip CR characters auto StripCR = [](std::string& line) { @@ -308,14 +308,6 @@ bool cmQtAutoGen::RccListParseOutput(std::string const& rccStdOut, return true; } -void cmQtAutoGen::RccListConvertFullPath(std::string const& qrcFileDir, - std::vector& files) -{ - for (std::string& entry : files) { - entry = cmSystemTools::CollapseFullPath(entry, qrcFileDir); - } -} - cmQtAutoGen::RccLister::RccLister() = default; cmQtAutoGen::RccLister::RccLister(std::string rccExecutable, @@ -412,6 +404,8 @@ bool cmQtAutoGen::RccLister::list(std::string const& qrcFile, } // Convert relative paths to absolute paths - RccListConvertFullPath(fileDir, files); + for (std::string& entry : files) { + entry = cmSystemTools::CollapseFullPath(entry, fileDir); + } return true; } diff --git a/Source/cmQtAutoGen.h b/Source/cmQtAutoGen.h index 0faf6b3..3a346b5 100644 --- a/Source/cmQtAutoGen.h +++ b/Source/cmQtAutoGen.h @@ -85,22 +85,6 @@ public: std::vector const& newOpts, bool isQt5); - /// @brief Parses the content of a qrc file - /// - /// Use when rcc does not support the "--list" option - static void RccListParseContent(std::string const& content, - std::vector& files); - - /// @brief Parses the output of the "rcc --list ..." command - static bool RccListParseOutput(std::string const& rccStdOut, - std::string const& rccStdErr, - std::vector& files, - std::string& error); - - /// @brief Converts relative qrc entry paths to full paths - static void RccListConvertFullPath(std::string const& qrcFileDir, - std::vector& files); - /** @class RccLister * @brief Lists files in qrc resource files */ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=521475b41b06d6f99edeeb9a36edb2bde8b55579 commit 521475b41b06d6f99edeeb9a36edb2bde8b55579 Author: Sebastian Holtermann AuthorDate: Fri Apr 5 21:31:27 2019 +0200 Commit: Sebastian Holtermann CommitDate: Sat Apr 6 16:17:23 2019 +0200 AutoRcc: Use cmQtAutoGen::RccLister in initializer and generator Both classes `cmQtAutoGenInitializer` and `cmQtAutoGeneratorRcc` had different implementations for reading the files list from a `.qrc` resources file. This patch replaces both implementations with the common simple `cmQtAutoGen::RccLister` implementation. diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index d80aaa2..be96f1a 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -7,7 +7,6 @@ #include "cmAlgorithms.h" #include "cmCustomCommand.h" #include "cmCustomCommandLines.h" -#include "cmDuration.h" #include "cmFilePathChecksum.h" #include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" @@ -19,7 +18,6 @@ #include "cmMessageType.h" #include "cmOutputConverter.h" #include "cmPolicies.h" -#include "cmProcessOutput.h" #include "cmSourceFile.h" #include "cmSourceFileLocationKind.h" #include "cmSourceGroup.h" @@ -28,7 +26,6 @@ #include "cmSystemTools.h" #include "cmTarget.h" #include "cmake.h" -#include "cmsys/FStream.hxx" #include "cmsys/SystemInformation.hxx" #include @@ -36,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -935,7 +931,8 @@ bool cmQtAutoGenInitializer::InitScanFiles() for (Qrc& qrc : this->Rcc.Qrcs) { if (!qrc.Generated) { std::string error; - if (!RccListInputs(qrc.QrcFile, qrc.Resources, error)) { + RccLister const lister(this->Rcc.Executable, this->Rcc.ListOptions); + if (!lister.list(qrc.QrcFile, qrc.Resources, error)) { cmSystemTools::Error(error); return false; } @@ -1630,86 +1627,3 @@ bool cmQtAutoGenInitializer::GetQtExecutable(GenVarsT& genVars, 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 -bool cmQtAutoGenInitializer::RccListInputs(std::string const& fileName, - std::vector& files, - std::string& error) -{ - if (!cmSystemTools::FileExists(fileName)) { - error = "rcc resource file does not exist:\n "; - error += Quoted(fileName); - error += "\n"; - return false; - } - if (this->Rcc.ExecutableExists && !this->Rcc.ListOptions.empty()) { - // Use rcc for file listing - if (this->Rcc.Executable.empty()) { - error = "rcc executable not available"; - return false; - } - - // Run rcc list command in the directory of the qrc file with the - // pathless - // qrc file name argument. This way rcc prints relative paths. - // This avoids issues on Windows when the qrc file is in a path that - // contains non-ASCII characters. - std::string const fileDir = cmSystemTools::GetFilenamePath(fileName); - std::string const fileNameName = cmSystemTools::GetFilenameName(fileName); - - bool result = false; - int retVal = 0; - std::string rccStdOut; - std::string rccStdErr; - { - std::vector cmd; - 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(), - cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto); - } - if (!result || retVal) { - error = "rcc list process failed for:\n "; - error += Quoted(fileName); - error += "\n"; - error += rccStdOut; - error += "\n"; - error += rccStdErr; - error += "\n"; - return false; - } - if (!RccListParseOutput(rccStdOut, rccStdErr, files, error)) { - return false; - } - } else { - // We can't use rcc for the file listing. - // Read the qrc file content into string and parse it. - { - std::string qrcContents; - { - cmsys::ifstream ifs(fileName.c_str()); - if (ifs) { - std::ostringstream osst; - osst << ifs.rdbuf(); - qrcContents = osst.str(); - } else { - error = "rcc file not readable:\n "; - error += Quoted(fileName); - error += "\n"; - return false; - } - } - // Parse string content - RccListParseContent(qrcContents, files); - } - } - - // Convert relative paths to absolute paths - RccListConvertFullPath(cmSystemTools::GetFilenamePath(fileName), files); - return true; -} diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index e7e5db2..7ff33c3 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -149,10 +149,6 @@ private: bool GetQtExecutable(GenVarsT& genVars, const std::string& executable, bool ignoreMissingTarget, std::string* output) const; - bool RccListInputs(std::string const& fileName, - std::vector& files, - std::string& errorMessage); - private: cmQtAutoGenGlobalInitializer* GlobalInitializer; cmGeneratorTarget* Target; diff --git a/Source/cmQtAutoGeneratorRcc.cxx b/Source/cmQtAutoGeneratorRcc.cxx index 5deb532..309d0e5 100644 --- a/Source/cmQtAutoGeneratorRcc.cxx +++ b/Source/cmQtAutoGeneratorRcc.cxx @@ -410,59 +410,12 @@ bool cmQtAutoGeneratorRcc::TestResourcesRead() return true; } - if (!RccListOptions_.empty()) { - // Start a rcc list process and parse the output - if (Process_) { - // Process is running already - if (Process_->IsFinished()) { - // Process is finished - if (!ProcessResult_.error()) { - // Process success - std::string parseError; - if (!RccListParseOutput(ProcessResult_.StdOut, ProcessResult_.StdErr, - Inputs_, parseError)) { - Log().ErrorFile(GenT::RCC, QrcFile_, parseError); - Error_ = true; - } - } else { - Log().ErrorFile(GenT::RCC, QrcFile_, ProcessResult_.ErrorMessage); - Error_ = true; - } - // Clean up - Process_.reset(); - ProcessResult_.reset(); - } else { - // Process is not finished, yet. - return false; - } - } else { - // Start a new process - // rcc prints relative entry paths when started in the directory of the - // qrc file with a pathless qrc file name argument. - // This is important because on Windows absolute paths returned by rcc - // might contain bad multibyte characters when the qrc file path - // contains non-ASCII pcharacters. - std::vector cmd; - cmd.push_back(RccExecutable_); - cmd.insert(cmd.end(), RccListOptions_.begin(), RccListOptions_.end()); - cmd.push_back(QrcFileName_); - // We're done here if the process fails to start - return !StartProcess(QrcFileDir_, cmd, false); - } - } else { - // rcc does not support the --list command. - // Read the qrc file content and parse it. - std::string qrcContent; - if (FileSys().FileRead(GenT::RCC, qrcContent, QrcFile_)) { - RccListParseContent(qrcContent, Inputs_); - } - } - - if (!Inputs_.empty()) { - // Convert relative paths to absolute paths - RccListConvertFullPath(QrcFileDir_, Inputs_); + std::string error; + RccLister lister(RccExecutable_, RccListOptions_); + if (!lister.list(QrcFile_, Inputs_, error)) { + Log().ErrorFile(GenT::RCC, QrcFile_, error); + Error_ = true; } - return true; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7cbde5c503f15bcc568a64239977b8e1f6f501cb commit 7cbde5c503f15bcc568a64239977b8e1f6f501cb Author: Sebastian Holtermann AuthorDate: Fri Apr 5 21:10:53 2019 +0200 Commit: Sebastian Holtermann CommitDate: Sat Apr 6 16:17:19 2019 +0200 AutoRcc: Add cmQtAutoGen::RccLister class The new `cmQtAutoGen::RccLister` class provides a simple interface to list files in a `.qrc` resources file by either calling `rcc` with list options or by parsing the resources file content. diff --git a/Source/cmQtAutoGen.cxx b/Source/cmQtAutoGen.cxx index d71d82f..9880c02 100644 --- a/Source/cmQtAutoGen.cxx +++ b/Source/cmQtAutoGen.cxx @@ -1,9 +1,12 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmQtAutoGen.h" + #include "cmAlgorithms.h" +#include "cmDuration.h" +#include "cmProcessOutput.h" #include "cmSystemTools.h" - +#include "cmsys/FStream.hxx" #include "cmsys/RegularExpression.hxx" #include @@ -309,7 +312,106 @@ void cmQtAutoGen::RccListConvertFullPath(std::string const& qrcFileDir, std::vector& files) { for (std::string& entry : files) { - std::string tmp = cmSystemTools::CollapseFullPath(entry, qrcFileDir); - entry = std::move(tmp); + entry = cmSystemTools::CollapseFullPath(entry, qrcFileDir); + } +} + +cmQtAutoGen::RccLister::RccLister() = default; + +cmQtAutoGen::RccLister::RccLister(std::string rccExecutable, + std::vector listOptions) + : RccExcutable_(std::move(rccExecutable)) + , ListOptions_(std::move(listOptions)) +{ +} + +bool cmQtAutoGen::RccLister::list(std::string const& qrcFile, + std::vector& files, + std::string& error, bool verbose) const +{ + error.clear(); + + if (!cmSystemTools::FileExists(qrcFile, true)) { + error = "The resource file "; + error += Quoted(qrcFile); + error += " does not exist."; + return false; + } + + // Run rcc list command in the directory of the qrc file with the pathless + // qrc file name argument. This way rcc prints relative paths. + // This avoids issues on Windows when the qrc file is in a path that + // contains non-ASCII characters. + std::string const fileDir = cmSystemTools::GetFilenamePath(qrcFile); + + if (!this->RccExcutable_.empty() && + cmSystemTools::FileExists(this->RccExcutable_, true) && + !this->ListOptions_.empty()) { + + bool result = false; + int retVal = 0; + std::string rccStdOut; + std::string rccStdErr; + { + std::vector cmd; + cmd.emplace_back(this->RccExcutable_); + cmd.insert(cmd.end(), this->ListOptions_.begin(), + this->ListOptions_.end()); + cmd.emplace_back(cmSystemTools::GetFilenameName(qrcFile)); + + // Log command + if (verbose) { + std::string msg = "Running command:\n"; + msg += QuotedCommand(cmd); + msg += '\n'; + cmSystemTools::Stdout(msg); + } + + result = cmSystemTools::RunSingleCommand( + cmd, &rccStdOut, &rccStdErr, &retVal, fileDir.c_str(), + cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto); + } + if (!result || retVal) { + error = "The rcc list process failed for "; + error += Quoted(qrcFile); + error += "\n"; + if (!rccStdOut.empty()) { + error += rccStdOut; + error += "\n"; + } + if (!rccStdErr.empty()) { + error += rccStdErr; + error += "\n"; + } + return false; + } + if (!RccListParseOutput(rccStdOut, rccStdErr, files, error)) { + return false; + } + } else { + // We can't use rcc for the file listing. + // Read the qrc file content into string and parse it. + { + std::string qrcContents; + { + cmsys::ifstream ifs(qrcFile.c_str()); + if (ifs) { + std::ostringstream osst; + osst << ifs.rdbuf(); + qrcContents = osst.str(); + } else { + error = "The resource file "; + error += Quoted(qrcFile); + error += " is not readable\n"; + return false; + } + } + // Parse string content + RccListParseContent(qrcContents, files); + } } + + // Convert relative paths to absolute paths + RccListConvertFullPath(fileDir, files); + return true; } diff --git a/Source/cmQtAutoGen.h b/Source/cmQtAutoGen.h index d127a71..0faf6b3 100644 --- a/Source/cmQtAutoGen.h +++ b/Source/cmQtAutoGen.h @@ -100,6 +100,45 @@ public: /// @brief Converts relative qrc entry paths to full paths static void RccListConvertFullPath(std::string const& qrcFileDir, std::vector& files); + + /** @class RccLister + * @brief Lists files in qrc resource files + */ + class RccLister + { + public: + RccLister(); + RccLister(std::string rccExecutable, std::vector listOptions); + + //! The rcc executable + std::string const& RccExcutable() const { return RccExcutable_; } + void SetRccExecutable(std::string const& rccExecutable) + { + RccExcutable_ = rccExecutable; + } + + //! The rcc executable list options + std::vector const& ListOptions() const + { + return ListOptions_; + } + void SetListOptions(std::vector const& listOptions) + { + ListOptions_ = listOptions; + } + + /** + * @brief Lists a files in the qrcFile + * @arg files The file names are appended to this list + * @arg error contains the error message when the function fails + */ + bool list(std::string const& qrcFile, std::vector& files, + std::string& error, bool verbose = false) const; + + private: + std::string RccExcutable_; + std::vector ListOptions_; + }; }; #endif ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-generator-expressions.7.rst | 19 + Help/release/dev/genex-TARGET_OUTPUT_NAME.rst | 7 + Source/CMakeLists.txt | 4 +- Source/cmGeneratorExpressionNode.cxx | 164 ++++- Source/cmGeneratorTarget.cxx | 25 + Source/cmGeneratorTarget.h | 3 + Source/cmQtAutoGen.cxx | 118 +++- Source/cmQtAutoGen.h | 53 +- Source/cmQtAutoGenInitializer.cxx | 90 +-- Source/cmQtAutoGenInitializer.h | 4 - Source/cmQtAutoGenerator.cxx | 265 ++++---- Source/cmQtAutoGenerator.h | 51 +- Source/cmQtAutoGeneratorMocUic.cxx | 50 +- Source/cmQtAutoGeneratorMocUic.h | 17 +- Source/cmQtAutoGeneratorRcc.cxx | 666 --------------------- Source/cmQtAutoRcc.cxx | 516 ++++++++++++++++ Source/{cmQtAutoGeneratorRcc.h => cmQtAutoRcc.h} | 71 +-- Source/cmcmd.cxx | 4 +- ...portedTarget-TARGET_PDB_OUTPUT_NAME-result.txt} | 0 ...mportedTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt | 8 + .../ImportedTarget-TARGET_PDB_OUTPUT_NAME.cmake | 2 + ...alidCompiler-TARGET_PDB_OUTPUT_NAME-result.txt} | 0 ...ValidCompiler-TARGET_PDB_OUTPUT_NAME-stderr.txt | 8 + .../NonValidCompiler-TARGET_PDB_OUTPUT_NAME.cmake | 9 + ...nValidTarget-TARGET_PDB_OUTPUT_NAME-result.txt} | 0 ...onValidTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt | 9 + .../NonValidTarget-TARGET_PDB_OUTPUT_NAME.cmake | 9 + .../OUTPUT_NAME-recursion-stderr.txt | 8 +- .../OUTPUT_NAME-recursion.cmake | 3 + .../GeneratorExpression/ResultValidator.cmake | 6 + .../GeneratorExpression/RunCMakeTest.cmake | 8 + ...LINKER_OUTPUT_NAME-non-valid-target-result.txt} | 0 ..._LINKER_OUTPUT_NAME-non-valid-target-stderr.txt | 6 + ...ARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake | 9 + .../TARGET_OUTPUT_NAME-check.cmake | 2 + .../TARGET_OUTPUT_NAME-imported-target-check.cmake | 2 + .../TARGET_OUTPUT_NAME-imported-target.cmake | 79 +++ ...TARGET_OUTPUT_NAME-non-valid-target-result.txt} | 0 .../TARGET_OUTPUT_NAME-non-valid-target-stderr.txt | 6 + .../TARGET_OUTPUT_NAME-non-valid-target.cmake | 9 + .../GeneratorExpression/TARGET_OUTPUT_NAME.cmake | 96 +++ .../ValidTarget-TARGET_PDB_OUTPUT_NAME-check.cmake | 7 + .../ValidTarget-TARGET_PDB_OUTPUT_NAME.cmake | 16 + 43 files changed, 1387 insertions(+), 1042 deletions(-) create mode 100644 Help/release/dev/genex-TARGET_OUTPUT_NAME.rst delete mode 100644 Source/cmQtAutoGeneratorRcc.cxx create mode 100644 Source/cmQtAutoRcc.cxx rename Source/{cmQtAutoGeneratorRcc.h => cmQtAutoRcc.h} (52%) copy Tests/RunCMake/{while/MissingArgument-result.txt => GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/ResultValidator.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-check.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target-check.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME-check.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Mon Apr 8 13:53:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 8 Apr 2019 13:53:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-638-g4f07fdd Message-ID: <20190408175304.52F24FB811@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 4f07fdde26f1de59e2e8c2a32f0af7a2caff422d (commit) via 32d7b0cc2c1ffe26fe4d84adfa9d1e7595c9ec10 (commit) via 68b307caae74ad0c8b455434fe1444f0f61bf638 (commit) from 7e60e77c3c2a09eb11750616db50d2dc149a9c54 (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=4f07fdde26f1de59e2e8c2a32f0af7a2caff422d commit 4f07fdde26f1de59e2e8c2a32f0af7a2caff422d Merge: 7e60e77 32d7b0c Author: Brad King AuthorDate: Mon Apr 8 17:52:05 2019 +0000 Commit: Kitware Robot CommitDate: Mon Apr 8 13:52:23 2019 -0400 Merge topic 'help_remove_duplicates' 32d7b0cc2c Help: Move entry to correct section in cmake-generator-expressions(7) manual 68b307caae Help: Add missing release notes for genex $ Acked-by: Kitware Robot Merge-request: !3200 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=32d7b0cc2c1ffe26fe4d84adfa9d1e7595c9ec10 commit 32d7b0cc2c1ffe26fe4d84adfa9d1e7595c9ec10 Author: Sebastian Lipponer AuthorDate: Sat Apr 6 10:37:44 2019 +0200 Commit: Sebastian Lipponer CommitDate: Mon Apr 8 19:19:29 2019 +0200 Help: Move entry to correct section in cmake-generator-expressions(7) manual The generator expression $ is string-valued, not boolean-valued. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 011631c..8f4c4fc 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -88,8 +88,6 @@ String Comparisons ``$`` ``1`` if ``string`` is member of the semicolon-separated ``list``, else ``0``. Uses case-sensitive comparisons. -``$`` - Removes duplicated items in the given ``list``. ``$`` ``1`` if ``v1`` is a version less than ``v2``, else ``0``. ``$`` @@ -293,6 +291,8 @@ String Transformations ``$`` Joins the list with the content of ``string``. +``$`` + Removes duplicated items in the given ``list``. ``$`` Content of ``string`` converted to lower case. ``$`` https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=68b307caae74ad0c8b455434fe1444f0f61bf638 commit 68b307caae74ad0c8b455434fe1444f0f61bf638 Author: Sebastian Lipponer AuthorDate: Sat Apr 6 10:36:34 2019 +0200 Commit: Sebastian Lipponer CommitDate: Mon Apr 8 19:19:29 2019 +0200 Help: Add missing release notes for genex $ diff --git a/Help/release/dev/remove_duplicates.rst b/Help/release/dev/remove_duplicates.rst new file mode 100644 index 0000000..f6a7fff --- /dev/null +++ b/Help/release/dev/remove_duplicates.rst @@ -0,0 +1,6 @@ +remove_duplicates +----------------- + +* A new ``$`` + :manual:`generator expression ` + has been added. ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-generator-expressions.7.rst | 4 ++-- Help/release/dev/remove_duplicates.rst | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 Help/release/dev/remove_duplicates.rst hooks/post-receive -- CMake From kwrobot at kitware.com Tue Apr 9 00:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 9 Apr 2019 00:03:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-639-gd6488cb Message-ID: <20190409040305.671CCFADD8@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 d6488cb6b3f417af1756e82171256724c8283e24 (commit) from 4f07fdde26f1de59e2e8c2a32f0af7a2caff422d (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=d6488cb6b3f417af1756e82171256724c8283e24 commit d6488cb6b3f417af1756e82171256724c8283e24 Author: Kitware Robot AuthorDate: Tue Apr 9 00:01:09 2019 -0400 Commit: Kitware Robot CommitDate: Tue Apr 9 00:01:09 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9ff8d5c..4951c02 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 14) -set(CMake_VERSION_PATCH 20190408) +set(CMake_VERSION_PATCH 20190409) #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 Apr 9 03:23:07 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 9 Apr 2019 03:23:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-641-g284429a Message-ID: <20190409072307.45DFFFB77E@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 284429ac879a91fe00e6f2c773b9a0d187667b9b (commit) via 698f51abacb572508c5386b406c2c8a30f0be1e8 (commit) from d6488cb6b3f417af1756e82171256724c8283e24 (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=284429ac879a91fe00e6f2c773b9a0d187667b9b commit 284429ac879a91fe00e6f2c773b9a0d187667b9b Merge: d6488cb 698f51a Author: Marc Chevrier AuthorDate: Tue Apr 9 07:20:12 2019 +0000 Commit: Kitware Robot CommitDate: Tue Apr 9 03:20:30 2019 -0400 Merge topic 'genex_filter' 698f51abac Genex: Add $ Acked-by: Kitware Robot Merge-request: !3188 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=698f51abacb572508c5386b406c2c8a30f0be1e8 commit 698f51abacb572508c5386b406c2c8a30f0be1e8 Author: Sebastian Lipponer AuthorDate: Wed Apr 3 21:26:29 2019 +0200 Commit: Sebastian Lipponer CommitDate: Mon Apr 8 19:57:22 2019 +0200 Genex: Add $ diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 8f4c4fc..e3a96bd 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -293,6 +293,8 @@ String Transformations Joins the list with the content of ``string``. ``$`` Removes duplicated items in the given ``list``. +``$`` + Includes or removes items from ``list`` that match the regular expression ``regex``. ``$`` Content of ``string`` converted to lower case. ``$`` diff --git a/Help/release/dev/genex_filter.rst b/Help/release/dev/genex_filter.rst new file mode 100644 index 0000000..ad23134 --- /dev/null +++ b/Help/release/dev/genex_filter.rst @@ -0,0 +1,6 @@ +genex_filter +------------ + +* A new ``$`` + :manual:`generator expression ` + has been added. diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index cef36fc..d8e1c42 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include // IWYU pragma: keep #include @@ -327,6 +328,51 @@ static const struct InListNode : public cmGeneratorExpressionNode } } inListNode; +static const struct FilterNode : public cmGeneratorExpressionNode +{ + FilterNode() {} // NOLINT(modernize-use-equals-default) + + int NumExpectedParameters() const override { return 3; } + + std::string Evaluate( + const std::vector& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override + { + if (parameters.size() != 3) { + reportError(context, content->GetOriginalExpression(), + "$ expression requires three parameters"); + return {}; + } + + if (parameters[1] != "INCLUDE" && parameters[1] != "EXCLUDE") { + reportError( + context, content->GetOriginalExpression(), + "$ second parameter must be either INCLUDE or EXCLUDE"); + return {}; + } + + const bool exclude = parameters[1] == "EXCLUDE"; + + cmsys::RegularExpression re; + if (!re.compile(parameters[2])) { + reportError(context, content->GetOriginalExpression(), + "$ failed to compile regex"); + return {}; + } + + std::vector values, result; + cmSystemTools::ExpandListArgument(parameters.front(), values, true); + + std::copy_if(values.cbegin(), values.cend(), std::back_inserter(result), + [&re, exclude](std::string const& input) { + return exclude ^ re.find(input); + }); + return cmJoin(cmMakeRange(result.cbegin(), result.cend()), ";"); + } +} filterNode; + static const struct RemoveDuplicatesNode : public cmGeneratorExpressionNode { RemoveDuplicatesNode() {} // NOLINT(modernize-use-equals-default) @@ -2331,6 +2377,7 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode( { "STREQUAL", &strEqualNode }, { "EQUAL", &equalNode }, { "IN_LIST", &inListNode }, + { "FILTER", &filterNode }, { "REMOVE_DUPLICATES", &removeDuplicatesNode }, { "LOWER_CASE", &lowerCaseNode }, { "UPPER_CASE", &upperCaseNode }, diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-Exclude-check.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-Exclude-check.cmake new file mode 100644 index 0000000..605ae4d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-Exclude-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/FILTER-generated.txt" content) + +set(expected "DO_NOT_FILTER_THIS;thisisanitem") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-Exclude.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-Exclude.cmake new file mode 100644 index 0000000..b879be2 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-Exclude.cmake @@ -0,0 +1,4 @@ +cmake_policy(VERSION 3.11) + +set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING) +file(GENERATE OUTPUT "FILTER-generated.txt" CONTENT "$") diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-Include-check.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-Include-check.cmake new file mode 100644 index 0000000..9d48d98 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-Include-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/FILTER-generated.txt" content) + +set(expected "FILTER_THIS_BIT;FILTER_THIS_THING") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-Include.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-Include.cmake new file mode 100644 index 0000000..5e0260a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-Include.cmake @@ -0,0 +1,4 @@ +cmake_policy(VERSION 3.11) + +set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING) +file(GENERATE OUTPUT "FILTER-generated.txt" CONTENT "$") diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-result.txt b/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-stderr.txt b/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-stderr.txt new file mode 100644 index 0000000..dd10925 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at FILTER-InvalidOperator.cmake:3 \(file\): + Error evaluating generator expression: + + \$ + + \$ second parameter must be either INCLUDE or EXCLUDE +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator.cmake new file mode 100644 index 0000000..26f3917 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator.cmake @@ -0,0 +1,3 @@ +cmake_policy(VERSION 3.11) + +file(GENERATE OUTPUT "FILTER-generated.txt" CONTENT "$") diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-empty-check.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-empty-check.cmake new file mode 100644 index 0000000..2844484 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-empty-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/FILTER-generated.txt" content) + +set(expected "") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-empty.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-empty.cmake new file mode 100644 index 0000000..e0fc671 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-empty.cmake @@ -0,0 +1,3 @@ +cmake_policy(VERSION 3.11) + +file(GENERATE OUTPUT "FILTER-generated.txt" CONTENT "$") diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 68bffa7..4202064 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -62,6 +62,10 @@ run_cmake(REMOVE_DUPLICATES-1) run_cmake(REMOVE_DUPLICATES-2) run_cmake(REMOVE_DUPLICATES-3) run_cmake(REMOVE_DUPLICATES-4) +run_cmake(FILTER-empty) +run_cmake(FILTER-InvalidOperator) +run_cmake(FILTER-Exclude) +run_cmake(FILTER-Include) run_cmake(ImportedTarget-TARGET_BUNDLE_DIR) run_cmake(ImportedTarget-TARGET_BUNDLE_CONTENT_DIR) ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-generator-expressions.7.rst | 2 + .../{remove_duplicates.rst => genex_filter.rst} | 6 +-- Source/cmGeneratorExpressionNode.cxx | 47 ++++++++++++++++++++++ ...-NEW-check.cmake => FILTER-Exclude-check.cmake} | 4 +- .../GeneratorExpression/FILTER-Exclude.cmake | 4 ++ ...-NEW-check.cmake => FILTER-Include-check.cmake} | 4 +- .../GeneratorExpression/FILTER-Include.cmake | 4 ++ .../FILTER-InvalidOperator-result.txt} | 0 .../FILTER-InvalidOperator-stderr.txt | 8 ++++ .../FILTER-InvalidOperator.cmake | 3 ++ ...-empty-check.cmake => FILTER-empty-check.cmake} | 2 +- .../GeneratorExpression/FILTER-empty.cmake | 3 ++ .../GeneratorExpression/RunCMakeTest.cmake | 4 ++ 13 files changed, 83 insertions(+), 8 deletions(-) copy Help/release/dev/{remove_duplicates.rst => genex_filter.rst} (53%) copy Tests/RunCMake/GeneratorExpression/{CMP0085-NEW-check.cmake => FILTER-Exclude-check.cmake} (54%) create mode 100644 Tests/RunCMake/GeneratorExpression/FILTER-Exclude.cmake copy Tests/RunCMake/GeneratorExpression/{CMP0085-NEW-check.cmake => FILTER-Include-check.cmake} (53%) create mode 100644 Tests/RunCMake/GeneratorExpression/FILTER-Include.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => GeneratorExpression/FILTER-InvalidOperator-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator.cmake copy Tests/RunCMake/GeneratorExpression/{REMOVE_DUPLICATES-empty-check.cmake => FILTER-empty-check.cmake} (65%) create mode 100644 Tests/RunCMake/GeneratorExpression/FILTER-empty.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Tue Apr 9 08:03:12 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 9 Apr 2019 08:03:12 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-650-g3d15ae4 Message-ID: <20190409120312.B573411E093@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 3d15ae4ea121ba68572f0314a93b756ed2659e09 (commit) via 0e953e138bf4a5e6f1e66bf6d89241781502f088 (commit) via 18962f8f8f71cfb29cf56bef7dfecb022f423a28 (commit) via a53c3f03bc0f659f326810af31b094dfde4a98e5 (commit) via fce03306ee995894f6f835ca4340cfa34ce9184b (commit) via 442f4c49026f4fb0d8eaa7f9d004cedff42bf9bb (commit) via ef41d49812f90f3d2a6edcae282a30b545df7f6d (commit) via 6bc6fc2a7f3fa142779e3b42de8cecfcf9d4ae74 (commit) via 82948805ecbd5d65db27c646b594f4ce331a8f97 (commit) from 284429ac879a91fe00e6f2c773b9a0d187667b9b (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=3d15ae4ea121ba68572f0314a93b756ed2659e09 commit 3d15ae4ea121ba68572f0314a93b756ed2659e09 Merge: 0e953e1 18962f8 Author: Brad King AuthorDate: Tue Apr 9 12:00:10 2019 +0000 Commit: Kitware Robot CommitDate: Tue Apr 9 08:01:01 2019 -0400 Merge topic 'cmake-gui-windows-theme' 18962f8f8f Utilities/Release: Link statically to QWindowsVistaStyle plugin a53c3f03bc Merge branch 'backport-cmake-gui-windows-theme' fce03306ee cmake-gui: Fix theme on Windows with Qt >= 5.10 Acked-by: Kitware Robot Merge-request: !3205 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0e953e138bf4a5e6f1e66bf6d89241781502f088 commit 0e953e138bf4a5e6f1e66bf6d89241781502f088 Merge: 284429a 442f4c4 Author: Brad King AuthorDate: Tue Apr 9 11:59:41 2019 +0000 Commit: Kitware Robot CommitDate: Tue Apr 9 07:59:52 2019 -0400 Merge topic 'implicit-includes-relative' 442f4c4902 Merge branch 'backport-implicit-includes-relative' ef41d49812 Fix implicit include directory extraction for adaptive relative paths 6bc6fc2a7f Tests: Teach RunCMake.ParseImplicitIncludeInfo to match output by regex 82948805ec Tests: Clarify hand-written cases in RunCMake.ParseImplicitIncludeInfo Acked-by: Kitware Robot Merge-request: !3204 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=18962f8f8f71cfb29cf56bef7dfecb022f423a28 commit 18962f8f8f71cfb29cf56bef7dfecb022f423a28 Author: mistersandman <9495-mistersandman at users.noreply.gitlab.kitware.com> AuthorDate: Mon Apr 8 18:17:15 2019 +0200 Commit: Brad King CommitDate: Mon Apr 8 13:30:36 2019 -0400 Utilities/Release: Link statically to QWindowsVistaStyle plugin We now build with Qt 5.12. This plugin is needed with Qt >= 5.10. Fixes: #19147 Suggested-by: mistersandman on gitlab.kitware.com diff --git a/Utilities/Release/win32_release.cmake b/Utilities/Release/win32_release.cmake index 1e4421c..974c402 100644 --- a/Utilities/Release/win32_release.cmake +++ b/Utilities/Release/win32_release.cmake @@ -11,6 +11,7 @@ set(MAKE "${MAKE_PROGRAM} -j16") set(qt_prefix "c:/Qt/5.12.1/msvc2017-32-w7-mt") set(qt_win_libs ${qt_prefix}/plugins/platforms/qwindows.lib + ${qt_prefix}/plugins/styles/qwindowsvistastyle.lib ${qt_prefix}/lib/Qt5EventDispatcherSupport.lib ${qt_prefix}/lib/Qt5FontDatabaseSupport.lib ${qt_prefix}/lib/Qt5ThemeSupport.lib diff --git a/Utilities/Release/win64_release.cmake b/Utilities/Release/win64_release.cmake index 98eaf19..20529f0 100644 --- a/Utilities/Release/win64_release.cmake +++ b/Utilities/Release/win64_release.cmake @@ -11,6 +11,7 @@ set(MAKE "${MAKE_PROGRAM} -j16") set(qt_prefix "c:/Qt/5.12.1/msvc2017-64-w7-mt") set(qt_win_libs ${qt_prefix}/plugins/platforms/qwindows.lib + ${qt_prefix}/plugins/styles/qwindowsvistastyle.lib ${qt_prefix}/lib/Qt5EventDispatcherSupport.lib ${qt_prefix}/lib/Qt5FontDatabaseSupport.lib ${qt_prefix}/lib/Qt5ThemeSupport.lib https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a53c3f03bc0f659f326810af31b094dfde4a98e5 commit a53c3f03bc0f659f326810af31b094dfde4a98e5 Merge: 7e60e77 fce0330 Author: Brad King AuthorDate: Mon Apr 8 13:30:26 2019 -0400 Commit: Brad King CommitDate: Mon Apr 8 13:30:26 2019 -0400 Merge branch 'backport-cmake-gui-windows-theme' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fce03306ee995894f6f835ca4340cfa34ce9184b commit fce03306ee995894f6f835ca4340cfa34ce9184b Author: mistersandman <9495-mistersandman at users.noreply.gitlab.kitware.com> AuthorDate: Mon Apr 8 18:17:15 2019 +0200 Commit: Brad King CommitDate: Mon Apr 8 13:30:05 2019 -0400 cmake-gui: Fix theme on Windows with Qt >= 5.10 In Qt 5.10 the theme support moved to a separate QWindowsVistaStyle plugin. Issue: #19147 diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index cd30ad5..8d9a50c 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -48,6 +48,9 @@ Q_IMPORT_PLUGIN(QXcbIntegrationPlugin); #if defined(USE_QWindowsIntegrationPlugin) Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin); +# if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) +Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin); +# endif #endif int main(int argc, char** argv) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=442f4c49026f4fb0d8eaa7f9d004cedff42bf9bb commit 442f4c49026f4fb0d8eaa7f9d004cedff42bf9bb Merge: 7e60e77 ef41d49 Author: Brad King AuthorDate: Mon Apr 8 10:16:14 2019 -0400 Commit: Brad King CommitDate: Mon Apr 8 10:16:47 2019 -0400 Merge branch 'backport-implicit-includes-relative' diff --cc Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-CXX-XLClang-16.1.0.1.output index e462894,0000000..7666f7e mode 100644,000000..100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-CXX-XLClang-16.1.0.1.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-CXX-XLClang-16.1.0.1.output @@@ -1,1 -1,0 +1,1 @@@ - /opt/IBM/xlC/16.1.0/include2/c++;/opt/IBM/xlC/16.1.0/include2;/opt/IBM/xlC/16.1.0/include2/aix;/opt/IBM/xlmass/9.1.0/include;/usr/include ++/opt/IBM/xlC/16.1.0/include2/c\+\+;/opt/IBM/xlC/16.1.0/include2;/opt/IBM/xlC/16.1.0/include2/aix;/opt/IBM/xlmass/9.1.0/include;/usr/include https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ef41d49812f90f3d2a6edcae282a30b545df7f6d commit ef41d49812f90f3d2a6edcae282a30b545df7f6d Author: Brad King AuthorDate: Mon Apr 8 10:04:05 2019 -0400 Commit: Brad King CommitDate: Mon Apr 8 10:12:22 2019 -0400 Fix implicit include directory extraction for adaptive relative paths In some cases GCC reports *relative* implicit include directories. They are computed adaptively with respect to the current working directory such that the effective implicit include directory is an unchanging absolute path. Teach our implicit include directory extraction to recognize such paths and normalize them. Fixes: #19133 diff --git a/Modules/CMakeParseImplicitIncludeInfo.cmake b/Modules/CMakeParseImplicitIncludeInfo.cmake index c8d4c5a..c42474b 100644 --- a/Modules/CMakeParseImplicitIncludeInfo.cmake +++ b/Modules/CMakeParseImplicitIncludeInfo.cmake @@ -216,6 +216,14 @@ function(cmake_parse_implicit_include_info text lang dir_var log_var state_var) get_filename_component(dir "${d}" ABSOLUTE) list(APPEND implicit_dirs "${dir}") string(APPEND log " collapse include dir [${d}] ==> [${dir}]\n") + elseif("${d}" MATCHES [[^\.\.[\/]\.\.[\/](.*)$]]) + # This relative path is deep enough to get out of the CMakeFiles/CMakeTmp + # directory where the ABI check is done. Assume that the compiler has + # computed this path adaptively based on the current working directory + # such that the effective result is absolute. + get_filename_component(dir "${CMAKE_BINARY_DIR}/${CMAKE_MATCH_1}" ABSOLUTE) + list(APPEND implicit_dirs "${dir}") + string(APPEND log " collapse relative include dir [${d}] ==> [${dir}]\n") else() string(APPEND log " skipping relative include dir [${d}]\n") endif() diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake b/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake index 7d04eb3..69615ef 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake @@ -19,6 +19,7 @@ set(targets darwin_nostdinc-CXX-AppleClang-8.0.0.8000042 freebsd-C-Clang-3.3.0 freebsd-CXX-Clang-3.3.0 freebsd-Fortran-GNU-4.6.4 hand-C-empty hand-CXX-empty + hand-C-relative hand-CXX-relative linux-C-GNU-7.3.0 linux-CXX-GNU-7.3.0 linux-Fortran-GNU-7.3.0 linux-C-Intel-18.0.0.20170811 linux-CXX-Intel-18.0.0.20170811 linux-C-PGI-18.10.1 linux-CXX-PGI-18.10.1 diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-relative.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-relative.input new file mode 100644 index 0000000..dd846e3 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-relative.input @@ -0,0 +1,21 @@ +CMAKE_LANG=C +CMAKE_C_COMPILER_ABI=ELF +CMAKE_C_COMPILER_AR=/usr/bin/gcc-ar-7 +CMAKE_C_COMPILER_ARCHITECTURE_ID= +CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_C_COMPILER_ID=GNU +CMAKE_C_COMPILER_LAUNCHER= +CMAKE_C_COMPILER_LOADED=1 +CMAKE_C_COMPILER_RANLIB=/usr/bin/gcc-ranlib-7 +CMAKE_C_COMPILER_TARGET= +CMAKE_C_COMPILER_VERSION=7.3.0 +CMAKE_C_COMPILER_VERSION_INTERAL= + +This is a hand-written test case. + +#include "..." search starts here: +#include <...> search starts here: + /usr/local/include + ../../../adaptive/relative/include + /usr/include +End of search list. diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-relative.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-relative.output new file mode 100644 index 0000000..e43139b --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-relative.output @@ -0,0 +1 @@ + /usr/local/include;[^;]*/Tests/RunCMake/ParseImplicitIncludeInfo/adaptive/relative/include;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-relative.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-relative.input new file mode 100644 index 0000000..54cc4db --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-relative.input @@ -0,0 +1,21 @@ +CMAKE_LANG=CXX +CMAKE_CXX_COMPILER_ABI=ELF +CMAKE_CXX_COMPILER_AR=/usr/bin/gcc-ar-7 +CMAKE_CXX_COMPILER_ARCHITECTURE_ID= +CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_CXX_COMPILER_ID=GNU +CMAKE_CXX_COMPILER_LAUNCHER= +CMAKE_CXX_COMPILER_LOADED=1 +CMAKE_CXX_COMPILER_RANLIB=/usr/bin/gcc-ranlib-7 +CMAKE_CXX_COMPILER_TARGET= +CMAKE_CXX_COMPILER_VERSION=7.3.0 +CMAKE_CXX_COMPILER_VERSION_INTERAL= + +This is a hand-written test case. + +#include "..." search starts here: +#include <...> search starts here: + /usr/local/include + ../../../adaptive/relative/include + /usr/include +End of search list. diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-relative.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-relative.output new file mode 100644 index 0000000..e43139b --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-relative.output @@ -0,0 +1 @@ + /usr/local/include;[^;]*/Tests/RunCMake/ParseImplicitIncludeInfo/adaptive/relative/include;/usr/include https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6bc6fc2a7f3fa142779e3b42de8cecfcf9d4ae74 commit 6bc6fc2a7f3fa142779e3b42de8cecfcf9d4ae74 Author: Brad King AuthorDate: Mon Apr 8 09:56:53 2019 -0400 Commit: Brad King CommitDate: Mon Apr 8 10:12:22 2019 -0400 Tests: Teach RunCMake.ParseImplicitIncludeInfo to match output by regex diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake b/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake index 41a407f..7d04eb3 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake @@ -108,8 +108,8 @@ foreach(t ${targets}) if("${state}" STREQUAL "done") message("empty parse failed: ${idirs}, log=${log}") endif() - elseif(NOT "${state}" STREQUAL "done" OR NOT "${output}" STREQUAL "${idirs}") - message("parse failed: state=${state}, ${output} != ${idirs}, log=${log}") + elseif(NOT "${state}" STREQUAL "done" OR NOT "${idirs}" MATCHES "^${output}$") + message("parse failed: state=${state}, '${idirs}' does not match '^${output}$', log=${log}") endif() unload_compiler_info("${cmvars}") endforeach(t) diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Cray-8.7.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Cray-8.7.output index 259c42a..263f8cb 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Cray-8.7.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Cray-8.7.output @@ -1 +1 @@ -/opt/cray/pe/cce/8.7.4/cce/x86_64/include/craylibs;/opt/gcc/6.1.0/snos/include/g++;/opt/gcc/6.1.0/snos/include/g++/x86_64-suse-linux;/opt/gcc/6.1.0/snos/include/g++/backward;/opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0/include;/opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0/include-fixed;/opt/cray/pe/cce/8.7.4/cce/x86_64/include/c++;/opt/cray/pe/cce/8.7.4/cce/x86_64/include/basic;/opt/gcc/6.1.0/snos/include;/usr/include;/opt/cray/pe/libsci/18.07.1/CRAY/8.6/x86_64/include;/opt/cray/pe/mpt/7.7.3/gni/mpich-cray/8.6/include;/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include;/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include;/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include;/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include;/opt/cray/dmapp/7.1.1-6.0.5.0_49.8__g1125556.ari/include;/opt/cray/pe/pmi/5.0.14/include;/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include;/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include;/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include;/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include;/opt/cray-hss-devel/8.0.0/include +/opt/cray/pe/cce/8.7.4/cce/x86_64/include/craylibs;/opt/gcc/6.1.0/snos/include/g\+\+;/opt/gcc/6.1.0/snos/include/g\+\+/x86_64-suse-linux;/opt/gcc/6.1.0/snos/include/g\+\+/backward;/opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0/include;/opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0/include-fixed;/opt/cray/pe/cce/8.7.4/cce/x86_64/include/c\+\+;/opt/cray/pe/cce/8.7.4/cce/x86_64/include/basic;/opt/gcc/6.1.0/snos/include;/usr/include;/opt/cray/pe/libsci/18.07.1/CRAY/8.6/x86_64/include;/opt/cray/pe/mpt/7.7.3/gni/mpich-cray/8.6/include;/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include;/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include;/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include;/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include;/opt/cray/dmapp/7.1.1-6.0.5.0_49.8__g1125556.ari/include;/opt/cray/pe/pmi/5.0.14/include;/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include;/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include;/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include;/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include;/opt/cray-hss-devel/8.0.0/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-GNU-7.3.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-GNU-7.3.0.output index d9095f7..b76c5db 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-GNU-7.3.0.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-GNU-7.3.0.output @@ -1 +1 @@ -/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include;/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include;/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include;/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include;/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include;/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include;/opt/cray/pe/pmi/5.0.14/include;/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include;/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include;/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include;/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include;/opt/cray-hss-devel/8.0.0/include;/opt/gcc/7.3.0/snos/include/g++;/opt/gcc/7.3.0/snos/include/g++/x86_64-suse-linux;/opt/gcc/7.3.0/snos/include/g++/backward;/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/include;/usr/local/include;/opt/gcc/7.3.0/snos/include;/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/include-fixed;/usr/include +/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include;/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include;/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include;/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include;/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include;/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include;/opt/cray/pe/pmi/5.0.14/include;/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include;/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include;/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include;/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include;/opt/cray-hss-devel/8.0.0/include;/opt/gcc/7.3.0/snos/include/g\+\+;/opt/gcc/7.3.0/snos/include/g\+\+/x86_64-suse-linux;/opt/gcc/7.3.0/snos/include/g\+\+/backward;/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/include;/usr/local/include;/opt/gcc/7.3.0/snos/include;/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/include-fixed;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Intel-18.0.2.20180210.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Intel-18.0.2.20180210.output index 31f8a11..031c324 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Intel-18.0.2.20180210.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Intel-18.0.2.20180210.output @@ -1 +1 @@ -/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/include;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/intel64;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/icc;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include;/opt/gcc/6.3.0/snos/include/g++;/opt/gcc/6.3.0/snos/include/g++/x86_64-suse-linux;/opt/gcc/6.3.0/snos/include/g++/backward;/usr/local/include;/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include;/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include-fixed;/opt/gcc/6.3.0/snos/include;/usr/include +/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/include;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/intel64;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/icc;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include;/opt/gcc/6.3.0/snos/include/g\+\+;/opt/gcc/6.3.0/snos/include/g\+\+/x86_64-suse-linux;/opt/gcc/6.3.0/snos/include/g\+\+/backward;/usr/local/include;/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include;/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include-fixed;/opt/gcc/6.3.0/snos/include;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-CXX-AppleClang-8.0.0.8000042.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-CXX-AppleClang-8.0.0.8000042.output index b10b2af..de0f91f 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-CXX-AppleClang-8.0.0.8000042.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-CXX-AppleClang-8.0.0.8000042.output @@ -1 +1 @@ -/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1;/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.0.0/include;/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include;/usr/include +/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c\+\+/v1;/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.0.0/include;/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-CXX-Clang-3.3.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-CXX-Clang-3.3.0.output index cd64264..97410f2 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-CXX-Clang-3.3.0.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-CXX-Clang-3.3.0.output @@ -1 +1 @@ -/usr/include/c++/v1;/usr/include/c++/4.2;/usr/include/c++/4.2/backward;/usr/include/clang/3.3;/usr/include +/usr/include/c\+\+/v1;/usr/include/c\+\+/4.2;/usr/include/c\+\+/4.2/backward;/usr/include/clang/3.3;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CUDA-NVIDIA-9.2.148.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CUDA-NVIDIA-9.2.148.output index 4f49cd1..497fb88 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CUDA-NVIDIA-9.2.148.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CUDA-NVIDIA-9.2.148.output @@ -1 +1 @@ -/usr/include/c++/5;/usr/include/x86_64-linux-gnu/c++/5;/usr/include/c++/5/backward;/usr/lib/gcc/x86_64-linux-gnu/5/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include +/usr/include/c\+\+/5;/usr/include/x86_64-linux-gnu/c\+\+/5;/usr/include/c\+\+/5/backward;/usr/lib/gcc/x86_64-linux-gnu/5/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-GNU-7.3.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-GNU-7.3.0.output index 6f5d071..af33ba8 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-GNU-7.3.0.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-GNU-7.3.0.output @@ -1 +1 @@ -/usr/include/c++/7;/usr/include/x86_64-linux-gnu/c++/7;/usr/include/c++/7/backward;/usr/lib/gcc/x86_64-linux-gnu/7/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include +/usr/include/c\+\+/7;/usr/include/x86_64-linux-gnu/c\+\+/7;/usr/include/c\+\+/7/backward;/usr/lib/gcc/x86_64-linux-gnu/7/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-Intel-18.0.0.20170811.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-Intel-18.0.0.20170811.output index 1bf5711..95bdf99 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-Intel-18.0.0.20170811.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-Intel-18.0.0.20170811.output @@ -1 +1 @@ -/opt/intel/compilers_and_libraries_2018.0.128/linux/ipp/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/pstl/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include/intel64;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include/icc;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include;/usr/include/c++/4.8.5;/usr/include/c++/4.8.5/x86_64-redhat-linux;/usr/include/c++/4.8.5/backward;/usr/local/include;/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include;/usr/include +/opt/intel/compilers_and_libraries_2018.0.128/linux/ipp/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/pstl/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include/intel64;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include/icc;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include;/usr/include/c\+\+/4.8.5;/usr/include/c\+\+/4.8.5/x86_64-redhat-linux;/usr/include/c\+\+/4.8.5/backward;/usr/local/include;/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-PGI-18.10.1.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-PGI-18.10.1.output index 8c9d24a..8eb97c8 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-PGI-18.10.1.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-PGI-18.10.1.output @@ -1 +1 @@ -/mnt/pgi/linux86-64/18.10/include-gcc70;/mnt/pgi/linux86-64/18.10/include;/usr/include/c++/7;/usr/include/x86_64-linux-gnu/c++/7;/usr/include/c++/7/backward;/usr/lib/gcc/x86_64-linux-gnu/7/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include +/mnt/pgi/linux86-64/18.10/include-gcc70;/mnt/pgi/linux86-64/18.10/include;/usr/include/c\+\+/7;/usr/include/x86_64-linux-gnu/c\+\+/7;/usr/include/c\+\+/7/backward;/usr/lib/gcc/x86_64-linux-gnu/7/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-12.1.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-12.1.0.output index a2d8c26..d6d3e58 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-12.1.0.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-12.1.0.output @@ -1 +1 @@ -/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/include;/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include;/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/include;/usr/include/c++/4.4.7;/usr/include/c++/4.4.7/ppc64-redhat-linux;/usr/include/c++/4.4.7/backward;/usr/local/include;/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/crt/include;/usr/include +/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/include;/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include;/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/include;/usr/include/c\+\+/4.4.7;/usr/include/c\+\+/4.4.7/ppc64-redhat-linux;/usr/include/c\+\+/4.4.7/backward;/usr/local/include;/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/crt/include;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-16.1.0.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-16.1.0.0.output index 6994f3c..9e118fc 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-16.1.0.0.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-16.1.0.0.output @@ -1 +1 @@ -/opt/ibm/xlsmp/5.1.0/include;/opt/ibm/xlmass/9.1.0/include;/opt/ibm/xlC/16.1.0/include;/usr/include/c++/4.8.5;/usr/include/c++/4.8.5/ppc64le-redhat-linux;/usr/include/c++/4.8.5/backward;/usr/local/include;/usr/include +/opt/ibm/xlsmp/5.1.0/include;/opt/ibm/xlmass/9.1.0/include;/opt/ibm/xlC/16.1.0/include;/usr/include/c\+\+/4.8.5;/usr/include/c\+\+/4.8.5/ppc64le-redhat-linux;/usr/include/c\+\+/4.8.5/backward;/usr/local/include;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-CXX-PGI-18.10.1.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-CXX-PGI-18.10.1.output index 8c9d24a..8eb97c8 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-CXX-PGI-18.10.1.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-CXX-PGI-18.10.1.output @@ -1 +1 @@ -/mnt/pgi/linux86-64/18.10/include-gcc70;/mnt/pgi/linux86-64/18.10/include;/usr/include/c++/7;/usr/include/x86_64-linux-gnu/c++/7;/usr/include/c++/7/backward;/usr/lib/gcc/x86_64-linux-gnu/7/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include +/mnt/pgi/linux86-64/18.10/include-gcc70;/mnt/pgi/linux86-64/18.10/include;/usr/include/c\+\+/7;/usr/include/x86_64-linux-gnu/c\+\+/7;/usr/include/c\+\+/7/backward;/usr/lib/gcc/x86_64-linux-gnu/7/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-CXX-GNU-4.9.3.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-CXX-GNU-4.9.3.output index 7a5e447..9996940 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-CXX-GNU-4.9.3.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-CXX-GNU-4.9.3.output @@ -1 +1 @@ -C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include/c++;C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include/c++/mingw32;C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include/c++/backward;C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include;C:/DoesNotExist/mingw/include;C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include-fixed +C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include/c\+\+;C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include/c\+\+/mingw32;C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include/c\+\+/backward;C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include;C:/DoesNotExist/mingw/include;C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include-fixed diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-CXX-GNU-4.8.5.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-CXX-GNU-4.8.5.output index 7b1e11e..d2289eb 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-CXX-GNU-4.8.5.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-CXX-GNU-4.8.5.output @@ -1 +1 @@ -/usr/include/g++;/usr/include/g++/backward;/usr/include/gcc-4.8;/usr/include +/usr/include/g\+\+;/usr/include/g\+\+/backward;/usr/include/gcc-4.8;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-CXX-Clang-5.0.1.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-CXX-Clang-5.0.1.output index 6da1398..d77687b 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-CXX-Clang-5.0.1.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-CXX-Clang-5.0.1.output @@ -1 +1 @@ -/usr/include/c++/v1;/usr/lib/clang/5.0.1/include;/usr/include +/usr/include/c\+\+/v1;/usr/lib/clang/5.0.1/include;/usr/include https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=82948805ecbd5d65db27c646b594f4ce331a8f97 commit 82948805ecbd5d65db27c646b594f4ce331a8f97 Author: Brad King AuthorDate: Mon Apr 8 09:49:29 2019 -0400 Commit: Brad King CommitDate: Mon Apr 8 10:11:54 2019 -0400 Tests: Clarify hand-written cases in RunCMake.ParseImplicitIncludeInfo diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake b/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake index a39a529..41a407f 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake @@ -17,8 +17,8 @@ set(targets darwin-C-AppleClang-8.0.0.8000042 darwin-CXX-AppleClang-8.0.0.8000042 darwin_nostdinc-C-AppleClang-8.0.0.8000042 darwin_nostdinc-CXX-AppleClang-8.0.0.8000042 - empty-C empty-CXX freebsd-C-Clang-3.3.0 freebsd-CXX-Clang-3.3.0 freebsd-Fortran-GNU-4.6.4 + hand-C-empty hand-CXX-empty linux-C-GNU-7.3.0 linux-CXX-GNU-7.3.0 linux-Fortran-GNU-7.3.0 linux-C-Intel-18.0.0.20170811 linux-CXX-Intel-18.0.0.20170811 linux-C-PGI-18.10.1 linux-CXX-PGI-18.10.1 @@ -104,7 +104,7 @@ foreach(t ${targets}) file(READ ${outfile} output) string(STRIP "${output}" output) cmake_parse_implicit_include_info("${input}" "${lang}" idirs log state) - if(t MATCHES "^empty-") # empty isn't supposed to parse + if(t MATCHES "-empty$") # empty isn't supposed to parse if("${state}" STREQUAL "done") message("empty parse failed: ${idirs}, log=${log}") endif() diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-C.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-empty.input similarity index 100% rename from Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-C.input rename to Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-empty.input diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-CXX.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-empty.output similarity index 100% rename from Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-CXX.output rename to Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-empty.output diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-CXX.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-empty.input similarity index 100% rename from Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-CXX.input rename to Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-empty.input diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-C.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-empty.output similarity index 100% rename from Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-C.output rename to Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-empty.output ----------------------------------------------------------------------- Summary of changes: Modules/CMakeParseImplicitIncludeInfo.cmake | 8 ++++++++ Source/QtDialog/CMakeSetup.cxx | 3 +++ .../ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake | 9 +++++---- .../data/aix-CXX-XLClang-16.1.0.1.output | 2 +- .../ParseImplicitIncludeInfo/data/craype-CXX-Cray-8.7.output | 2 +- .../ParseImplicitIncludeInfo/data/craype-CXX-GNU-7.3.0.output | 2 +- .../data/craype-CXX-Intel-18.0.2.20180210.output | 2 +- .../data/darwin-CXX-AppleClang-8.0.0.8000042.output | 2 +- .../ParseImplicitIncludeInfo/data/freebsd-CXX-Clang-3.3.0.output | 2 +- .../data/{empty-C.input => hand-C-empty.input} | 0 .../data/{empty-CXX.output => hand-C-empty.output} | 0 .../data/{empty-C.input => hand-C-relative.input} | 9 ++++++++- .../ParseImplicitIncludeInfo/data/hand-C-relative.output | 1 + .../data/{empty-CXX.input => hand-CXX-empty.input} | 0 .../data/{empty-C.output => hand-CXX-empty.output} | 0 .../data/{empty-CXX.input => hand-CXX-relative.input} | 9 ++++++++- .../ParseImplicitIncludeInfo/data/hand-CXX-relative.output | 1 + .../data/linux-CUDA-NVIDIA-9.2.148.output | 2 +- .../ParseImplicitIncludeInfo/data/linux-CXX-GNU-7.3.0.output | 2 +- .../data/linux-CXX-Intel-18.0.0.20170811.output | 2 +- .../ParseImplicitIncludeInfo/data/linux-CXX-PGI-18.10.1.output | 2 +- .../ParseImplicitIncludeInfo/data/linux-CXX-XL-12.1.0.output | 2 +- .../ParseImplicitIncludeInfo/data/linux-CXX-XL-16.1.0.0.output | 2 +- .../data/linux_nostdinc-CXX-PGI-18.10.1.output | 2 +- .../ParseImplicitIncludeInfo/data/mingw.org-CXX-GNU-4.9.3.output | 2 +- .../ParseImplicitIncludeInfo/data/netbsd-CXX-GNU-4.8.5.output | 2 +- .../ParseImplicitIncludeInfo/data/openbsd-CXX-Clang-5.0.1.output | 2 +- Utilities/Release/win32_release.cmake | 1 + Utilities/Release/win64_release.cmake | 1 + 29 files changed, 52 insertions(+), 22 deletions(-) copy Tests/RunCMake/ParseImplicitIncludeInfo/data/{empty-C.input => hand-C-empty.input} (100%) rename Tests/RunCMake/ParseImplicitIncludeInfo/data/{empty-CXX.output => hand-C-empty.output} (100%) rename Tests/RunCMake/ParseImplicitIncludeInfo/data/{empty-C.input => hand-C-relative.input} (64%) create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-relative.output copy Tests/RunCMake/ParseImplicitIncludeInfo/data/{empty-CXX.input => hand-CXX-empty.input} (100%) rename Tests/RunCMake/ParseImplicitIncludeInfo/data/{empty-C.output => hand-CXX-empty.output} (100%) rename Tests/RunCMake/ParseImplicitIncludeInfo/data/{empty-CXX.input => hand-CXX-relative.input} (66%) create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-relative.output hooks/post-receive -- CMake From kwrobot at kitware.com Tue Apr 9 08:13:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 9 Apr 2019 08:13:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-653-g6b126c4 Message-ID: <20190409121306.D778D11EB52@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 6b126c47bd0b90f2af9f800910054b3139667a73 (commit) via dff61585f3ed3973b52db9a90493f132d809677c (commit) via 30f68934e90ddc5fbf523b56ba1ae6199e49466b (commit) from 3d15ae4ea121ba68572f0314a93b756ed2659e09 (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=6b126c47bd0b90f2af9f800910054b3139667a73 commit 6b126c47bd0b90f2af9f800910054b3139667a73 Merge: 3d15ae4 dff6158 Author: Brad King AuthorDate: Tue Apr 9 08:03:46 2019 -0400 Commit: Brad King CommitDate: Tue Apr 9 08:03:46 2019 -0400 Merge branch 'release-3.14' ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Tue Apr 9 08:13:07 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 9 Apr 2019 08:13:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.14.1-11-gdff6158 Message-ID: <20190409121307.6A98511EB9E@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 dff61585f3ed3973b52db9a90493f132d809677c (commit) via fce03306ee995894f6f835ca4340cfa34ce9184b (commit) via 30f68934e90ddc5fbf523b56ba1ae6199e49466b (commit) via ef41d49812f90f3d2a6edcae282a30b545df7f6d (commit) via 6bc6fc2a7f3fa142779e3b42de8cecfcf9d4ae74 (commit) via 82948805ecbd5d65db27c646b594f4ce331a8f97 (commit) from 192aa506c66d5269e10d87f1a67df5397325a9af (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/CMakeParseImplicitIncludeInfo.cmake | 8 ++++++++ Source/QtDialog/CMakeSetup.cxx | 3 +++ .../ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake | 9 +++++---- .../ParseImplicitIncludeInfo/data/craype-CXX-Cray-8.7.output | 2 +- .../ParseImplicitIncludeInfo/data/craype-CXX-GNU-7.3.0.output | 2 +- .../data/craype-CXX-Intel-18.0.2.20180210.output | 2 +- .../data/darwin-CXX-AppleClang-8.0.0.8000042.output | 2 +- .../ParseImplicitIncludeInfo/data/freebsd-CXX-Clang-3.3.0.output | 2 +- .../data/{empty-C.input => hand-C-empty.input} | 0 .../data/{empty-CXX.output => hand-C-empty.output} | 0 .../data/{empty-C.input => hand-C-relative.input} | 9 ++++++++- .../ParseImplicitIncludeInfo/data/hand-C-relative.output | 1 + .../data/{empty-CXX.input => hand-CXX-empty.input} | 0 .../data/{empty-C.output => hand-CXX-empty.output} | 0 .../data/{empty-CXX.input => hand-CXX-relative.input} | 9 ++++++++- .../ParseImplicitIncludeInfo/data/hand-CXX-relative.output | 1 + .../data/linux-CUDA-NVIDIA-9.2.148.output | 2 +- .../ParseImplicitIncludeInfo/data/linux-CXX-GNU-7.3.0.output | 2 +- .../data/linux-CXX-Intel-18.0.0.20170811.output | 2 +- .../ParseImplicitIncludeInfo/data/linux-CXX-PGI-18.10.1.output | 2 +- .../ParseImplicitIncludeInfo/data/linux-CXX-XL-12.1.0.output | 2 +- .../ParseImplicitIncludeInfo/data/linux-CXX-XL-16.1.0.0.output | 2 +- .../data/linux_nostdinc-CXX-PGI-18.10.1.output | 2 +- .../ParseImplicitIncludeInfo/data/mingw.org-CXX-GNU-4.9.3.output | 2 +- .../ParseImplicitIncludeInfo/data/netbsd-CXX-GNU-4.8.5.output | 2 +- .../ParseImplicitIncludeInfo/data/openbsd-CXX-Clang-5.0.1.output | 2 +- 26 files changed, 49 insertions(+), 21 deletions(-) copy Tests/RunCMake/ParseImplicitIncludeInfo/data/{empty-C.input => hand-C-empty.input} (100%) rename Tests/RunCMake/ParseImplicitIncludeInfo/data/{empty-CXX.output => hand-C-empty.output} (100%) rename Tests/RunCMake/ParseImplicitIncludeInfo/data/{empty-C.input => hand-C-relative.input} (64%) create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-relative.output copy Tests/RunCMake/ParseImplicitIncludeInfo/data/{empty-CXX.input => hand-CXX-empty.input} (100%) rename Tests/RunCMake/ParseImplicitIncludeInfo/data/{empty-C.output => hand-CXX-empty.output} (100%) rename Tests/RunCMake/ParseImplicitIncludeInfo/data/{empty-CXX.input => hand-CXX-relative.input} (66%) create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-relative.output hooks/post-receive -- CMake From kwrobot at kitware.com Tue Apr 9 08:33:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 9 Apr 2019 08:33:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-664-ga289d79 Message-ID: <20190409123305.BC2C4D6254@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 a289d7951734d7d107e3d3f780740e4f6f759b05 (commit) via aa0692de6707face3ee45c458923f1820441ba95 (commit) via cb33befe2dec44728003720ec187ff2e7eb0317a (commit) via 0e4fbb4a1f24bf1e9cda4fca41f9cf80bd57aaf4 (commit) via b783e625334bbac9bbc16edce9a818d2d213de3a (commit) via 9bddb03f318dd152b32c651354c9f1c30eb4d902 (commit) via 45edf1ad66a97e9083b37aeab18e33436df70b29 (commit) via f5acecaa6f653ac6d4f216e5403d917856fbe19e (commit) via e6b6bb06188ec54a568b54d45930bf38d6547c27 (commit) via 4336a29edd5fd3a70db83103df8f36c5d8bebc59 (commit) via 4359fe133b03aac5d0b0c1ed2aa98a49515edf56 (commit) from 6b126c47bd0b90f2af9f800910054b3139667a73 (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=a289d7951734d7d107e3d3f780740e4f6f759b05 commit a289d7951734d7d107e3d3f780740e4f6f759b05 Merge: aa0692d cb33bef Author: Brad King AuthorDate: Tue Apr 9 12:30:05 2019 +0000 Commit: Kitware Robot CommitDate: Tue Apr 9 08:30:15 2019 -0400 Merge topic 'improve-formatting-of-help' cb33befe2d Modules: Update documentation formatting 0e4fbb4a1f Help: Improve formatting of Help documentation Acked-by: Kitware Robot Acked-by: Ben Boeckel Merge-request: !3199 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=aa0692de6707face3ee45c458923f1820441ba95 commit aa0692de6707face3ee45c458923f1820441ba95 Merge: 6b126c4 b783e62 Author: Brad King AuthorDate: Tue Apr 9 12:27:16 2019 +0000 Commit: Kitware Robot CommitDate: Tue Apr 9 08:27:31 2019 -0400 Merge topic 'argument-parser' b783e62533 cmExecuteProcessCommand: Port to cmArgumentParser 9bddb03f31 cmParseArgumentsCommand: Port to cmArgumentParser 45edf1ad66 Retire cmCommandArgumentsHelper f5acecaa6f cmExportCommand: Port to cmArgumentParser e6b6bb0618 cmInstallCommand: Port to cmArgumentParser 4336a29edd cmFileCommand: Port to cmArgumentParser 4359fe133b Introduce cmArgumentParser Acked-by: Kitware Robot Acked-by: Leonid Pospelov Merge-request: !3137 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cb33befe2dec44728003720ec187ff2e7eb0317a commit cb33befe2dec44728003720ec187ff2e7eb0317a Author: Bartosz Kosiorek AuthorDate: Fri Apr 5 17:22:38 2019 +0200 Commit: Bartosz Kosiorek CommitDate: Mon Apr 8 14:55:56 2019 +0200 Modules: Update documentation formatting diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst index 42755f3..eb44eb2 100644 --- a/Help/command/find_package.rst +++ b/Help/command/find_package.rst @@ -234,7 +234,7 @@ Each entry is meant for installation trees following Windows (``W``), UNIX /*/(lib/|lib*|share)/*/ (W/U) /*/(lib/|lib*|share)/*/(cmake|CMake)/ (W/U) -On systems supporting macOS :prop_tgt:`FRAMEWORK`s and :prop_tgt:`BUNDLE`s the +On systems supporting macOS :prop_tgt:`FRAMEWORK` and :prop_tgt:`BUNDLE`, the following directories are searched for Frameworks or Application Bundles containing a configuration file:: @@ -262,16 +262,16 @@ that order). * The ``lib`` path is always searched. If ``PATH_SUFFIXES`` is specified, the suffixes are appended to each -(W) or (U) directory entry one-by-one. +(``W``) or (``U``) directory entry one-by-one. This set of directories is intended to work in cooperation with projects that provide configuration files in their installation trees. -Directories above marked with (W) are intended for installations on +Directories above marked with (``W``) are intended for installations on Windows where the prefix may point at the top of an application's -installation directory. Those marked with (U) are intended for +installation directory. Those marked with (``U``) are intended for installations on UNIX platforms where the prefix is shared by multiple -packages. This is merely a convention, so all (W) and (U) directories -are still searched on all platforms. Directories marked with (A) are +packages. This is merely a convention, so all (``W``) and (``U``) directories +are still searched on all platforms. Directories marked with (``A``) are intended for installations on Apple platforms. The :variable:`CMAKE_FIND_FRAMEWORK` and :variable:`CMAKE_FIND_APPBUNDLE` variables determine the order of preference. diff --git a/Help/cpack_gen/nsis.rst b/Help/cpack_gen/nsis.rst index bebd196..cd2aea6 100644 --- a/Help/cpack_gen/nsis.rst +++ b/Help/cpack_gen/nsis.rst @@ -54,7 +54,7 @@ on Windows Nullsoft Scriptable Install System. .. variable:: CPACK_NSIS_COMPRESSOR - The arguments that will be passed to the NSIS `SetCompressor command. + The arguments that will be passed to the NSIS `SetCompressor` command. .. variable:: CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL @@ -71,8 +71,8 @@ on Windows Nullsoft Scriptable Install System. .. variable:: CPACK_NSIS_DISPLAY_NAME - The display name string that appears in the Windows `Add/Remove Program` - control panel + The display name string that appears in the Windows `Apps & features` + in `Control Panel` .. variable:: CPACK_NSIS_PACKAGE_NAME @@ -102,15 +102,15 @@ on Windows Nullsoft Scriptable Install System. .. variable:: CPACK_NSIS_CREATE_ICONS_EXTRA - Additional NSIS commands for creating start menu shortcuts. + Additional NSIS commands for creating `Start Menu` shortcuts. .. variable:: CPACK_NSIS_DELETE_ICONS_EXTRA - Additional NSIS commands to uninstall start menu shortcuts. + Additional NSIS commands to uninstall `Start Menu` shortcuts. .. variable:: CPACK_NSIS_EXECUTABLES_DIRECTORY - Creating NSIS start menu links assumes that they are in ``bin`` unless this + Creating NSIS `Start Menu` links assumes that they are in ``bin`` unless this variable is set. For example, you would set this to ``exec`` if your executables are in an exec directory. diff --git a/Help/envvar/ASM_DIALECT.rst b/Help/envvar/ASM_DIALECT.rst index 0588323..a06e3cb 100644 --- a/Help/envvar/ASM_DIALECT.rst +++ b/Help/envvar/ASM_DIALECT.rst @@ -5,7 +5,7 @@ ASM Preferred executable for compiling a specific dialect of assembly language files. ``ASM`` can be ``ASM``, ``ASM_NASM`` (Netwide Assembler), -``ASM_MASM`` (Microsoft Assembler) or ``ASM-ATT`` (Asembler AT&T). +``ASM_MASM`` (Microsoft Assembler) or ``ASM-ATT`` (Assembler AT&T). Will only be used by CMake on the first configuration to determine ``ASM`` compiler, after which the value for ``ASM`` is stored in the cache as diff --git a/Help/envvar/ASM_DIALECTFLAGS.rst b/Help/envvar/ASM_DIALECTFLAGS.rst index 32dbcc3..3c3b02a 100644 --- a/Help/envvar/ASM_DIALECTFLAGS.rst +++ b/Help/envvar/ASM_DIALECTFLAGS.rst @@ -7,7 +7,7 @@ Default compilation flags to be used when compiling a specific dialect of an assembly language. ``ASMFLAGS`` can be ``ASMFLAGS``, ``ASM_NASMFLAGS``, ``ASM_MASMFLAGS`` or ``ASM-ATTFLAGS``. Will only be used by CMake on the first configuration to determine ``ASM_`` default compilation -flags, after which the value for ``ASMFLAGS`` is stored in the cache as -``CMAKE_ASM_FLAGS _FLAGS>``. For any configuration -run (including the first), the environment variable will be ignored if the +flags, after which the value for ``ASMFLAGS`` is stored in the cache +as ``CMAKE_ASM_FLAGS _FLAGS>``. For any configuration +run (including the first), the environment variable will be ignored, if the ``CMAKE_ASM_FLAGS _FLAGS>`` variable is defined. diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index 38b8af6..5a6b329 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -369,11 +369,11 @@ is computed as:: where: -* ``raw_test_time[j,i]``: Wall-clock time for the ``i``th test - for the ``j``th label or subproject +* ``raw_test_time[j,i]``: Wall-clock time for the ``i`` test + for the ``j`` label or subproject * ``num_processors[j,i]``: Value of the CTest :prop_test:`PROCESSORS` property - for the ``i``th test for the ``j``th label or subproject -* ``num_tests[j]``: Number of tests associated with the ``j``th label or subproject + for the ``i`` test for the ``j`` label or subproject +* ``num_tests[j]``: Number of tests associated with the ``j`` label or subproject * ``total``: Total number of labels or subprojects that have at least one test run Therefore, the weighted time summary for each label or subproject represents diff --git a/Help/prop_sf/VS_DEPLOYMENT_CONTENT.rst b/Help/prop_sf/VS_DEPLOYMENT_CONTENT.rst index 89a5357..6a38478 100644 --- a/Help/prop_sf/VS_DEPLOYMENT_CONTENT.rst +++ b/Help/prop_sf/VS_DEPLOYMENT_CONTENT.rst @@ -3,7 +3,7 @@ VS_DEPLOYMENT_CONTENT Mark a source file as content for deployment with a Windows Phone or Windows Store application when built with a - :manual:`Visual Studio generators `. +:manual:`Visual Studio generators `. The value must evaluate to either ``1`` or ``0`` and may use :manual:`generator expressions ` to make the choice based on the build configuration. diff --git a/Help/variable/CMAKE_STAGING_PREFIX.rst b/Help/variable/CMAKE_STAGING_PREFIX.rst index 75bf366..bdb97fa 100644 --- a/Help/variable/CMAKE_STAGING_PREFIX.rst +++ b/Help/variable/CMAKE_STAGING_PREFIX.rst @@ -6,7 +6,7 @@ be useful if the path in :variable:`CMAKE_SYSROOT` is read-only, or otherwise should remain pristine. The :variable:`CMAKE_STAGING_PREFIX` location is also used as a search prefix - by the ``find_*`` commands. This can be controlled by setting the +by the ``find_*`` commands. This can be controlled by setting the :variable:`CMAKE_FIND_NO_INSTALL_PREFIX` variable. If any ``RPATH``/``RUNPATH`` entries passed to the linker contain the diff --git a/Help/variable/CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION.rst b/Help/variable/CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION.rst index e711a93..30ae236 100644 --- a/Help/variable/CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION.rst +++ b/Help/variable/CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION.rst @@ -5,7 +5,7 @@ Ask CPack to error out as soon as a file with absolute ``INSTALL DESTINATION`` is encountered. The fatal error is emitted before the installation of the offending -file takes place. Some CPack generators, like :cpack_gen:`nsis`, enforce this +file takes place. Some CPack generators, like ``NSIS``, enforce this internally. This variable triggers the definition of :variable:`CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION` when CPack runs. diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index 8c7646e..f94fc5c 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -7,7 +7,7 @@ BundleUtilities Functions to help assemble a standalone bundle application. -A collection of CMake utility functions useful for dealing with .app +A collection of CMake utility functions useful for dealing with ``.app`` bundles on the Mac and bundle-like directories on any OS. The following functions are provided by this module: @@ -33,7 +33,7 @@ The following functions are provided by this module: verify_bundle_symlinks Requires CMake 2.6 or greater because it uses function, break and -PARENT_SCOPE. Also depends on GetPrerequisites.cmake. +``PARENT_SCOPE``. Also depends on ``GetPrerequisites.cmake``. DO NOT USE THESE FUNCTIONS AT CONFIGURE TIME (from ``CMakeLists.txt``)! Instead, invoke them from an :command:`install(CODE)` or @@ -43,55 +43,57 @@ Instead, invoke them from an :command:`install(CODE)` or fixup_bundle( ) -Fix up a bundle in-place and make it standalone, such that it can be +Fix up ```` bundle in-place and make it standalone, such that it can be drag-n-drop copied to another machine and run on that machine as long as all of the system libraries are compatible. -If you pass plugins to fixup_bundle as the libs parameter, you should -install them or copy them into the bundle before calling fixup_bundle. -The "libs" parameter is a list of libraries that must be fixed up, but -that cannot be determined by otool output analysis. (i.e., plugins) +If you pass plugins to ``fixup_bundle`` as the libs parameter, you should +install them or copy them into the bundle before calling ``fixup_bundle``. +The ```` parameter is a list of libraries that must be fixed up, but +that cannot be determined by ``otool`` output analysis (i.e. ``plugins``). Gather all the keys for all the executables and libraries in a bundle, and then, for each key, copy each prerequisite into the bundle. Then fix each one up according to its own list of prerequisites. -Then clear all the keys and call verify_app on the final bundle to +Then clear all the keys and call ``verify_app`` on the final bundle to ensure that it is truly standalone. -As an optional parameter (IGNORE_ITEM) a list of file names can be passed, -which are then ignored (e.g. IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe") +As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed, +which are then ignored +(e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``). .. code-block:: cmake copy_and_fixup_bundle( ) -Makes a copy of the bundle at location and then fixes up -the new copied bundle in-place at ... +Makes a copy of the bundle ```` at location ```` and then fixes up +the new copied bundle in-place at ````. .. code-block:: cmake verify_app() -Verifies that an application appears valid based on running -analysis tools on it. Calls "message(FATAL_ERROR" if the application +Verifies that an application ```` appears valid based on running +analysis tools on it. Calls :command:`message(FATAL_ERROR)` if the application is not verified. -As an optional parameter (IGNORE_ITEM) a list of file names can be passed, -which are then ignored (e.g. IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe") +As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed, +which are then ignored +(e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``) .. code-block:: cmake get_bundle_main_executable( ) The result will be the full path name of the bundle's main executable -file or an "error:" prefixed string if it could not be determined. +file or an ``error:`` prefixed string if it could not be determined. .. code-block:: cmake get_dotapp_dir( ) -Returns the nearest parent dir whose name ends with ".app" given the +Returns the nearest parent dir whose name ends with ``.app`` given the full path to an executable. If there is no such parent dir, then simply return the dir containing the executable. @@ -101,26 +103,26 @@ The returned directory may or may not exist. get_bundle_and_executable( ) -Takes either a ".app" directory name or the name of an executable -nested inside a ".app" directory and returns the path to the ".app" -directory in and the path to its main executable in - +Takes either a ``.app`` directory name or the name of an executable +nested inside a ``.app`` directory and returns the path to the ``.app`` +directory in ```` and the path to its main executable in +````. .. code-block:: cmake get_bundle_all_executables( ) -Scans the given bundle recursively for all executable files and -accumulates them into a variable. +Scans ```` bundle recursively for all ```` executable +files and accumulates them into a variable. .. code-block:: cmake get_item_key( ) -Given a file (item) name, generate a key that should be unique +Given ```` file name, generate ```` key that should be unique considering the set of libraries that need copying or fixing up to make a bundle standalone. This is essentially the file name including -extension with "." replaced by "_" +extension with ``.`` replaced by ``_`` This key is used as a prefix for CMake variables so that we can associate a set of variables with a given item based on its key. @@ -129,10 +131,10 @@ associate a set of variables with a given item based on its key. clear_bundle_keys() -Loop over the list of keys, clearing all the variables associated with -each key. After the loop, clear the list of keys itself. +Loop over the ```` list of keys, clearing all the variables +associated with each key. After the loop, clear the list of keys itself. -Caller of get_bundle_keys should call clear_bundle_keys when done with +Caller of ``get_bundle_keys`` should call ``clear_bundle_keys`` when done with list of keys. .. code-block:: cmake @@ -140,86 +142,88 @@ list of keys. set_bundle_key_values( []) -Add a key to the list (if necessary) for the given item. If added, -also set all the variables associated with that key. +Add ```` key to the list (if necessary) for the given item. +If added, also set all the variables associated with that key. .. code-block:: cmake get_bundle_keys( ) -Loop over all the executable and library files within the bundle (and -given as extra ) and accumulate a list of keys representing +Loop over all the executable and library files within ```` bundle (and +given as extra ````) and accumulate a list of keys representing them. Set values associated with each key such that we can loop over all of them and copy prerequisite libs into the bundle and then do -appropriate install_name_tool fixups. +appropriate ``install_name_tool`` fixups. -As an optional parameter (IGNORE_ITEM) a list of file names can be passed, -which are then ignored (e.g. IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe") +As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed, +which are then ignored +(e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``) .. code-block:: cmake copy_resolved_item_into_bundle( ) -Copy a resolved item into the bundle if necessary. Copy is not -necessary if the resolved_item is "the same as" the -resolved_embedded_item. +Copy a resolved item into the bundle if necessary. +Copy is not necessary, if the ```` is "the same as" the +````. .. code-block:: cmake copy_resolved_framework_into_bundle( ) -Copy a resolved framework into the bundle if necessary. Copy is not -necessary if the resolved_item is "the same as" the -resolved_embedded_item. +Copy a resolved framework into the bundle if necessary. +Copy is not necessary, if the ```` is "the same as" the +````. -By default, BU_COPY_FULL_FRAMEWORK_CONTENTS is not set. If you want +By default, ``BU_COPY_FULL_FRAMEWORK_CONTENTS`` is not set. If you want full frameworks embedded in your bundles, set -BU_COPY_FULL_FRAMEWORK_CONTENTS to ON before calling fixup_bundle. By -default, COPY_RESOLVED_FRAMEWORK_INTO_BUNDLE copies the framework -dylib itself plus the framework Resources directory. +``BU_COPY_FULL_FRAMEWORK_CONTENTS`` to ``ON`` before calling fixup_bundle. By +default, ``COPY_RESOLVED_FRAMEWORK_INTO_BUNDLE`` copies the framework +dylib itself plus the framework ``Resources`` directory. .. code-block:: cmake fixup_bundle_item( ) -Get the direct/non-system prerequisites of the resolved embedded item. +Get the direct/non-system prerequisites of the ````. For each prerequisite, change the way it is referenced to the value of -the _EMBEDDED_ITEM keyed variable for that prerequisite. (Most likely -changing to an "@executable_path" style reference.) +the ``_EMBEDDED_ITEM`` keyed variable for that prerequisite. (Most likely +changing to an ``@executable_path`` style reference.) -This function requires that the resolved_embedded_item be "inside" the -bundle already. In other words, if you pass plugins to fixup_bundle +This function requires that the ```` be ``inside`` +the bundle already. In other words, if you pass plugins to ``fixup_bundle`` as the libs parameter, you should install them or copy them into the -bundle before calling fixup_bundle. The "libs" parameter is a list of +bundle before calling ``fixup_bundle``. The ``libs`` parameter is a list of libraries that must be fixed up, but that cannot be determined by -otool output analysis. (i.e., plugins) +otool output analysis. (i.e., ``plugins``) Also, change the id of the item being fixed up to its own -_EMBEDDED_ITEM value. +``_EMBEDDED_ITEM`` value. Accumulate changes in a local variable and make *one* call to -install_name_tool at the end of the function with all the changes at +``install_name_tool`` at the end of the function with all the changes at once. -If the BU_CHMOD_BUNDLE_ITEMS variable is set then bundle items will be -marked writable before install_name_tool tries to change them. +If the ``BU_CHMOD_BUNDLE_ITEMS`` variable is set then bundle items will be +marked writable before ``install_name_tool`` tries to change them. .. code-block:: cmake verify_bundle_prerequisites( ) Verifies that the sum of all prerequisites of all files inside the -bundle are contained within the bundle or are "system" libraries, +bundle are contained within the bundle or are ``system`` libraries, presumed to exist everywhere. -As an optional parameter (IGNORE_ITEM) a list of file names can be passed, -which are then ignored (e.g. IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe") +As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed, +which are then ignored +(e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``) .. code-block:: cmake verify_bundle_symlinks( ) -Verifies that any symlinks found in the bundle point to other files +Verifies that any symlinks found in the ```` bundle point to other files that are already also in the bundle... Anything that points to an external file causes this function to fail the verification. #]=======================================================================] diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 948b921..8f1e194 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -202,23 +202,24 @@ External Project Definition :command:`file(DOWNLOAD)`) ``NETRC `` - Specify whether the .netrc file is to be used for operation. If this - option is not specified, the value of the ``CMAKE_NETRC`` variable - will be used instead (see :command:`file(DOWNLOAD)`) + Specify whether the ``.netrc`` file is to be used for operation. + If this option is not specified, the value of the ``CMAKE_NETRC`` + variable will be used instead (see :command:`file(DOWNLOAD)`) Valid levels are: ``IGNORED`` - The .netrc file is ignored. + The ``.netrc`` file is ignored. This is the default. ``OPTIONAL`` - The .netrc file is optional, and information in the URL is preferred. - The file will be scanned to find which ever information is not specified - in the URL. + The ``.netrc`` file is optional, and information in the URL + is preferred. The file will be scanned to find which ever + information is not specified in the URL. ``REQUIRED`` - The .netrc file is required, and information in the URL is ignored. + The ``.netrc`` file is required, and information in the URL + is ignored. ``NETRC_FILE `` - Specify an alternative .netrc file to the one in your home directory + Specify an alternative ``.netrc`` file to the one in your home directory if the ``NETRC`` level is ``OPTIONAL`` or ``REQUIRED``. If this option is not specified, the value of the ``CMAKE_NETRC_FILE`` variable will be used instead (see :command:`file(DOWNLOAD)`) diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake index 06ac2d9..b0e25dc 100644 --- a/Modules/FindBISON.cmake +++ b/Modules/FindBISON.cmake @@ -19,7 +19,7 @@ The module defines the following variables: true if the program was found The minimum required version of ``bison`` can be specified using the -standard CMake syntax, e.g. ``find_package(BISON 2.1.3)``. +standard CMake syntax, e.g. :command:`find_package(BISON 2.1.3)`. If ``bison`` is found, the module defines the macro:: @@ -55,7 +55,7 @@ The options are: The macro defines the following variables: ``BISON__DEFINED`` - true is the macro ran successfully + ``True`` is the macro ran successfully ``BISON__INPUT`` The input source file, an alias for diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index bfa449f..77e689f 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -5,12 +5,12 @@ FindBLAS -------- -Find BLAS library +Find Basic Linear Algebra Subprograms (BLAS) library -This module finds an installed fortran library that implements the +This module finds an installed Fortran library that implements the BLAS linear-algebra interface (see http://www.netlib.org/blas/). The -list of libraries searched for is taken from the autoconf macro file, -acx_blas.m4 (distributed at +list of libraries searched for is taken from the ``autoconf`` macro file, +``acx_blas.m4`` (distributed at http://ac-archive.sourceforge.net/ac-archive/acx_blas.html). Input Variables @@ -52,7 +52,7 @@ The following variables may be set to influence this module's behavior: if ``ON`` tries to find the BLAS95 interfaces ``BLA_PREFER_PKGCONFIG`` - if set pkg-config will be used to search for a BLAS library first + if set ``pkg-config`` will be used to search for a BLAS library first and if one is found that is preferred Result Variables @@ -63,7 +63,7 @@ This module defines the following variables: ``BLAS_FOUND`` library implementing the BLAS interface is found ``BLAS_LINKER_FLAGS`` - uncached list of required linker flags (excluding -l and -L). + uncached list of required linker flags (excluding ``-l`` and ``-L``). ``BLAS_LIBRARIES`` uncached list of libraries (using full path name) to link against to use BLAS (may be empty if compiler implicitly links BLAS) @@ -75,7 +75,7 @@ This module defines the following variables: .. note:: - C or CXX must be enabled to use Intel MKL + C or CXX must be enabled to use Intel Math Kernel Library (MKL) For example, to use Intel MKL libraries and/or Intel compiler: diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 1231ff1..53be493 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -85,33 +85,33 @@ The following :prop_tgt:`IMPORTED` targets are also defined:: Boost::dynamic_linking - interface target to enable dynamic linking linking with MSVC (adds BOOST_ALL_DYN_LINK) -Implicit dependencies such as Boost::filesystem requiring -Boost::system will be automatically detected and satisfied, even -if system is not specified when using find_package and if -Boost::system is not added to target_link_libraries. If using -Boost::thread, then Threads::Threads will also be added automatically. +Implicit dependencies such as ``Boost::filesystem`` requiring +``Boost::system`` will be automatically detected and satisfied, even +if system is not specified when using :command:`find_package` and if +``Boost::system`` is not added to :command:`target_link_libraries`. If using +``Boost::thread``, then ``Threads::Threads`` will also be added automatically. It is important to note that the imported targets behave differently than variables created by this module: multiple calls to -find_package(Boost) in the same directory or sub-directories with +:command:`find_package(Boost)` in the same directory or sub-directories with different options (e.g. static or shared) will not override the values of the targets created by the first call. -Users may set these hints or results as cache entries. Projects +Users may set these hints or results as ``CACHE`` entries. Projects should not read these entries directly but instead use the above result variables. Note that some hint names start in upper-case "BOOST". One may specify these as environment variables if they are not specified as CMake variables or cache entries. -This module first searches for the Boost header files using the above -hint variables (excluding BOOST_LIBRARYDIR) and saves the result in -Boost_INCLUDE_DIR. Then it searches for requested component libraries -using the above hints (excluding BOOST_INCLUDEDIR and -Boost_ADDITIONAL_VERSIONS), "lib" directories near Boost_INCLUDE_DIR, +This module first searches for the ``Boost`` header files using the above +hint variables (excluding ``BOOST_LIBRARYDIR``) and saves the result in +``Boost_INCLUDE_DIR``. Then it searches for requested component libraries +using the above hints (excluding ``BOOST_INCLUDEDIR`` and +``Boost_ADDITIONAL_VERSIONS``), "lib" directories near ``Boost_INCLUDE_DIR``, and the library name configuration settings below. It saves the -library directories in Boost_LIBRARY_DIR_DEBUG and -Boost_LIBRARY_DIR_RELEASE and individual library -locations in Boost__LIBRARY_DEBUG and Boost__LIBRARY_RELEASE. +library directories in ``Boost_LIBRARY_DIR_DEBUG`` and +``Boost_LIBRARY_DIR_RELEASE`` and individual library +locations in ``Boost__LIBRARY_DEBUG`` and ``Boost__LIBRARY_RELEASE``. When one changes settings used by previous searches in the same build tree (excluding environment variables) this module discards previous search results affected by the changes and searches again. @@ -179,9 +179,9 @@ Other variables one may set to control this module are:: On Visual Studio and Borland compilers Boost headers request automatic linking to corresponding libraries. This requires matching libraries to be linked explicitly or available in the link library search path. -In this case setting Boost_USE_STATIC_LIBS to OFF may not achieve +In this case setting ``Boost_USE_STATIC_LIBS`` to ``OFF`` may not achieve dynamic linking. Boost automatic linking typically requests static -libraries with a few exceptions (such as Boost.Python). Use:: +libraries with a few exceptions (such as ``Boost.Python``). Use:: add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS}) @@ -230,12 +230,12 @@ Boost CMake If Boost was built using the boost-cmake project it provides a package configuration file for use with find_package's Config mode. This module looks for the package configuration file called -BoostConfig.cmake or boost-config.cmake and stores the result in cache -entry "Boost_DIR". If found, the package configuration file is loaded +``BoostConfig.cmake`` or ``boost-config.cmake`` and stores the result in +``CACHE`` entry "Boost_DIR". If found, the package configuration file is loaded and this module returns with no further action. See documentation of the Boost CMake package configuration for details on what it provides. -Set Boost_NO_BOOST_CMAKE to ON to disable the search for boost-cmake. +Set ``Boost_NO_BOOST_CMAKE`` to ``ON``, to disable the search for boost-cmake. #]=======================================================================] # Save project's policies diff --git a/Modules/FindCups.cmake b/Modules/FindCups.cmake index 27105b9..2c79911 100644 --- a/Modules/FindCups.cmake +++ b/Modules/FindCups.cmake @@ -7,8 +7,8 @@ FindCups Find the CUPS printing system. -Set CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE to TRUE if you need a version which -features this function (i.e. at least 1.1.19) +Set ``CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE`` to ``TRUE`` if you need a version which +features this function (i.e. at least ``1.1.19``) Imported targets ^^^^^^^^^^^^^^^^ diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake index edebe75..68eb9c8 100644 --- a/Modules/FindFLEX.cmake +++ b/Modules/FindFLEX.cmake @@ -13,7 +13,7 @@ The module defines the following variables: :: - FLEX_FOUND - true is flex executable is found + FLEX_FOUND - True is flex executable is found FLEX_EXECUTABLE - the path to the flex executable FLEX_VERSION - the version of flex FLEX_LIBRARIES - The flex libraries @@ -35,10 +35,10 @@ If flex is found on the system, the module provides the macro: [DEFINES_FILE ] ) -which creates a custom command to generate the file from -the file. If COMPILE_FLAGS option is specified, the next +which creates a custom command to generate the ``FlexOutput`` file from +the ``FlexInput`` file. If ``COMPILE_FLAGS`` option is specified, the next parameter is added to the flex command line. If flex is configured to -output a header file, the DEFINES_FILE option may be used to specify its +output a header file, the ``DEFINES_FILE`` option may be used to specify its name. Name is an alias used to get details of this custom command. Indeed the macro defines the following variables: @@ -61,8 +61,8 @@ defines a macro: ADD_FLEX_BISON_DEPENDENCY(FlexTarget BisonTarget) which adds the required dependency between a scanner and a parser -where and are the first parameters of -respectively FLEX_TARGET and BISON_TARGET macros. +where ``FlexTarget`` and ``BisonTarget`` are the first parameters of +respectively ``FLEX_TARGET`` and ``BISON_TARGET`` macros. :: diff --git a/Modules/FindSWIG.cmake b/Modules/FindSWIG.cmake index 9300522..49f303e 100644 --- a/Modules/FindSWIG.cmake +++ b/Modules/FindSWIG.cmake @@ -19,11 +19,11 @@ This module finds an installed SWIG. It sets the following variables: The minimum required version of SWIG can be specified using the -standard syntax, e.g. find_package(SWIG 1.1) +standard syntax, e.g. :command:`find_package(SWIG 1.1)` -All information is collected from the SWIG_EXECUTABLE so the version +All information is collected from the ``SWIG_EXECUTABLE``, so the version to be found can be changed from the command line by means of setting -SWIG_EXECUTABLE +``SWIG_EXECUTABLE`` #]=======================================================================] find_program(SWIG_EXECUTABLE NAMES swig3.0 swig2.0 swig) diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake index 63ca936..00a3a41 100644 --- a/Modules/FindTIFF.cmake +++ b/Modules/FindTIFF.cmake @@ -5,7 +5,7 @@ FindTIFF -------- -Find the TIFF library (libtiff). +Find the TIFF library (``libtiff``). Imported targets ^^^^^^^^^^^^^^^^ diff --git a/Modules/FindUnixCommands.cmake b/Modules/FindUnixCommands.cmake index 3a735f7..2513f5c 100644 --- a/Modules/FindUnixCommands.cmake +++ b/Modules/FindUnixCommands.cmake @@ -7,8 +7,9 @@ FindUnixCommands Find Unix commands, including the ones from Cygwin -This module looks for the Unix commands bash, cp, gzip, mv, rm, and tar -and stores the result in the variables BASH, CP, GZIP, MV, RM, and TAR. +This module looks for the Unix commands ``bash``, ``cp``, ``gzip``, +``mv``, ``rm``, and ``tar`` and stores the result in the variables +``BASH``, ``CP``, ``GZIP``, ``MV``, ``RM``, and ``TAR``. #]=======================================================================] include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake) diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index f2e4527..e4481f6 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -7,7 +7,7 @@ GenerateExportHeader Function for generation of export macros for libraries -This module provides the function GENERATE_EXPORT_HEADER(). +This module provides the function ``GENERATE_EXPORT_HEADER()``. The ``GENERATE_EXPORT_HEADER`` function can be used to generate a file suitable for preprocessor inclusion which contains EXPORT macros to be diff --git a/Modules/UseQt4.cmake b/Modules/UseQt4.cmake index dc2348e..8fec717 100644 --- a/Modules/UseQt4.cmake +++ b/Modules/UseQt4.cmake @@ -7,8 +7,8 @@ UseQt4 Use Module for QT4 -Sets up C and C++ to use Qt 4. It is assumed that FindQt.cmake has -already been loaded. See FindQt.cmake for information on how to load +Sets up C and C++ to use Qt 4. It is assumed that :module:`FindQt` has +already been loaded. See :module:`FindQt` for information on how to load Qt 4 into your CMake project. #]=======================================================================] @@ -105,4 +105,3 @@ foreach(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN endif () endforeach() - diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake index 21ccd7c..23d81b5 100644 --- a/Modules/WriteCompilerDetectionHeader.cmake +++ b/Modules/WriteCompilerDetectionHeader.cmake @@ -5,7 +5,7 @@ WriteCompilerDetectionHeader ---------------------------- -This module provides the function write_compiler_detection_header(). +This module provides the function ``write_compiler_detection_header()``. This function can be used to generate a file suitable for preprocessor inclusion which contains macros to be used in source code:: https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0e4fbb4a1f24bf1e9cda4fca41f9cf80bd57aaf4 commit 0e4fbb4a1f24bf1e9cda4fca41f9cf80bd57aaf4 Author: Bartosz Kosiorek AuthorDate: Fri Apr 5 16:03:53 2019 +0200 Commit: Bartosz Kosiorek CommitDate: Mon Apr 8 14:53:31 2019 +0200 Help: Improve formatting of Help documentation diff --git a/Help/command/export.rst b/Help/command/export.rst index ffd60e1..2ca7056 100644 --- a/Help/command/export.rst +++ b/Help/command/export.rst @@ -54,7 +54,7 @@ unspecified. export(PACKAGE ) Store the current build directory in the CMake user package registry -for package ````. The find_package command may consider the +for package ````. The :command:`find_package` command may consider the directory while searching for package ````. This helps dependent projects find and use a package from the current project's build tree without help from the user. Note that the entry in the package diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst index 54d5f68..42755f3 100644 --- a/Help/command/find_package.rst +++ b/Help/command/find_package.rst @@ -180,7 +180,7 @@ sets these variables: These variables are checked by the ``find_package`` command to determine whether the configuration file provides an acceptable version. They -are not available after the find_package call returns. If the version +are not available after the ``find_package`` call returns. If the version is acceptable the following variables are set: ``_VERSION`` @@ -220,8 +220,8 @@ Search Procedure CMake constructs a set of possible installation prefixes for the package. Under each prefix several directories are searched for a configuration file. The tables below show the directories searched. -Each entry is meant for installation trees following Windows (W), UNIX -(U), or Apple (A) conventions:: +Each entry is meant for installation trees following Windows (``W``), UNIX +(``U``), or Apple (``A``) conventions:: / (W) /(cmake|CMake)/ (W) @@ -234,8 +234,8 @@ Each entry is meant for installation trees following Windows (W), UNIX /*/(lib/|lib*|share)/*/ (W/U) /*/(lib/|lib*|share)/*/(cmake|CMake)/ (W/U) -On systems supporting macOS Frameworks and Application Bundles the -following directories are searched for frameworks or bundles +On systems supporting macOS :prop_tgt:`FRAMEWORK`s and :prop_tgt:`BUNDLE`s the +following directories are searched for Frameworks or Application Bundles containing a configuration file:: /.framework/Resources/ (A) diff --git a/Help/command/variable_requires.rst b/Help/command/variable_requires.rst index b4742a5..322b154 100644 --- a/Help/command/variable_requires.rst +++ b/Help/command/variable_requires.rst @@ -18,5 +18,5 @@ tested, if that variable is false nothing else is done. If ``TEST_VARIABLE`` is true, then the next argument (``RESULT_VARIABLE``) is a variable that is set to true if all the required variables are set. The rest of the arguments are variables that must be true or not set -to NOTFOUND to avoid an error. If any are not true, an error is +to ``NOTFOUND`` to avoid an error. If any are not true, an error is reported. diff --git a/Help/cpack_gen/nsis.rst b/Help/cpack_gen/nsis.rst index 9f82a04..bebd196 100644 --- a/Help/cpack_gen/nsis.rst +++ b/Help/cpack_gen/nsis.rst @@ -1,19 +1,19 @@ CPack NSIS Generator -------------------- -CPack NSIS generator specific options +CPack Nullsoft Scriptable Install System (NSIS) generator specific options Variables specific to CPack NSIS generator ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The following variables are specific to the graphical installers built -on Windows using the Nullsoft Installation System. +on Windows Nullsoft Scriptable Install System. .. variable:: CPACK_NSIS_INSTALL_ROOT The default installation directory presented to the end user by the NSIS installer is under this root dir. The full directory presented to the end - user is: ${CPACK_NSIS_INSTALL_ROOT}/${CPACK_PACKAGE_INSTALL_DIRECTORY} + user is: ``${CPACK_NSIS_INSTALL_ROOT}/${CPACK_PACKAGE_INSTALL_DIRECTORY}`` .. variable:: CPACK_NSIS_MUI_ICON @@ -31,11 +31,11 @@ on Windows using the Nullsoft Installation System. .. variable:: CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP - The filename of a bitmap to use as the NSIS MUI_WELCOMEFINISHPAGE_BITMAP. + The filename of a bitmap to use as the NSIS ``MUI_WELCOMEFINISHPAGE_BITMAP``. .. variable:: CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP - The filename of a bitmap to use as the NSIS MUI_UNWELCOMEFINISHPAGE_BITMAP. + The filename of a bitmap to use as the NSIS ``MUI_UNWELCOMEFINISHPAGE_BITMAP``. .. variable:: CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS @@ -54,24 +54,24 @@ on Windows using the Nullsoft Installation System. .. variable:: CPACK_NSIS_COMPRESSOR - The arguments that will be passed to the NSIS SetCompressor command. + The arguments that will be passed to the NSIS `SetCompressor command. .. variable:: CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL - Ask about uninstalling previous versions first. If this is set to "ON", + Ask about uninstalling previous versions first. If this is set to ``ON``, then an installer will look for previous installed versions and if one is found, ask the user whether to uninstall it before proceeding with the install. .. variable:: CPACK_NSIS_MODIFY_PATH - Modify PATH toggle. If this is set to "ON", then an extra page will appear + Modify ``PATH`` toggle. If this is set to ``ON``, then an extra page will appear in the installer that will allow the user to choose whether the program - directory should be added to the system PATH variable. + directory should be added to the system ``PATH`` variable. .. variable:: CPACK_NSIS_DISPLAY_NAME - The display name string that appears in the Windows Add/Remove Program + The display name string that appears in the Windows `Add/Remove Program` control panel .. variable:: CPACK_NSIS_PACKAGE_NAME @@ -97,8 +97,8 @@ on Windows using the Nullsoft Installation System. .. variable:: CPACK_NSIS__INSTALL_DIRECTORY - Custom install directory for the specified component instead - of $INSTDIR. + Custom install directory for the specified component ```` instead + of ``$INSTDIR``. .. variable:: CPACK_NSIS_CREATE_ICONS_EXTRA @@ -110,8 +110,8 @@ on Windows using the Nullsoft Installation System. .. variable:: CPACK_NSIS_EXECUTABLES_DIRECTORY - Creating NSIS start menu links assumes that they are in 'bin' unless this - variable is set. For example, you would set this to 'exec' if your + Creating NSIS start menu links assumes that they are in ``bin`` unless this + variable is set. For example, you would set this to ``exec`` if your executables are in an exec directory. .. variable:: CPACK_NSIS_MUI_FINISHPAGE_RUN @@ -121,8 +121,8 @@ on Windows using the Nullsoft Installation System. .. variable:: CPACK_NSIS_MENU_LINKS - Specify links in [application] menu. This should contain a list of pair - "link" "link name". The link may be a URL or a path relative to + Specify links in ``[application]`` menu. This should contain a list of pair + ``link`` ``link name``. The link may be a URL or a path relative to installation prefix. Like:: set(CPACK_NSIS_MENU_LINKS diff --git a/Help/envvar/ASM_DIALECT.rst b/Help/envvar/ASM_DIALECT.rst index cabb959..0588323 100644 --- a/Help/envvar/ASM_DIALECT.rst +++ b/Help/envvar/ASM_DIALECT.rst @@ -4,8 +4,9 @@ ASM .. include:: ENV_VAR.txt Preferred executable for compiling a specific dialect of assembly language -files. ``ASM`` can be ``ASM``, ``ASM_NASM``, ``ASM_MASM`` or -``ASM-ATT``. Will only be used by CMake on the first configuration to determine +files. ``ASM`` can be ``ASM``, ``ASM_NASM`` (Netwide Assembler), +``ASM_MASM`` (Microsoft Assembler) or ``ASM-ATT`` (Asembler AT&T). +Will only be used by CMake on the first configuration to determine ``ASM`` compiler, after which the value for ``ASM`` is stored in the cache as :variable:`CMAKE_ASM_COMPILER _COMPILER>`. For subsequent diff --git a/Help/envvar/ASM_DIALECTFLAGS.rst b/Help/envvar/ASM_DIALECTFLAGS.rst index 90cbbdb..32dbcc3 100644 --- a/Help/envvar/ASM_DIALECTFLAGS.rst +++ b/Help/envvar/ASM_DIALECTFLAGS.rst @@ -6,8 +6,8 @@ ASMFLAGS Default compilation flags to be used when compiling a specific dialect of an assembly language. ``ASMFLAGS`` can be ``ASMFLAGS``, ``ASM_NASMFLAGS``, ``ASM_MASMFLAGS`` or ``ASM-ATTFLAGS``. Will only be used by CMake on the -first configuration to determine ``ASM`` default compilation flags, after -which the value for ``ASMFLAGS`` is stored in the cache as -:variable:`CMAKE_ASM_FLAGS _FLAGS>`. For any configuration +first configuration to determine ``ASM_`` default compilation +flags, after which the value for ``ASMFLAGS`` is stored in the cache as +``CMAKE_ASM_FLAGS _FLAGS>``. For any configuration run (including the first), the environment variable will be ignored if the -:variable:`CMAKE_ASM_FLAGS _FLAGS>` variable is defined. +``CMAKE_ASM_FLAGS _FLAGS>`` variable is defined. diff --git a/Help/envvar/CTEST_INTERACTIVE_DEBUG_MODE.rst b/Help/envvar/CTEST_INTERACTIVE_DEBUG_MODE.rst index b769d51..e1991b2 100644 --- a/Help/envvar/CTEST_INTERACTIVE_DEBUG_MODE.rst +++ b/Help/envvar/CTEST_INTERACTIVE_DEBUG_MODE.rst @@ -4,4 +4,4 @@ CTEST_INTERACTIVE_DEBUG_MODE .. include:: ENV_VAR.txt Environment variable that will exist and be set to ``1`` when a test executed -by CTest is run in interactive mode. +by :manual:`ctest(1)` is run in interactive mode. diff --git a/Help/envvar/CTEST_OUTPUT_ON_FAILURE.rst b/Help/envvar/CTEST_OUTPUT_ON_FAILURE.rst index bf860cb..d8b4262 100644 --- a/Help/envvar/CTEST_OUTPUT_ON_FAILURE.rst +++ b/Help/envvar/CTEST_OUTPUT_ON_FAILURE.rst @@ -4,6 +4,6 @@ CTEST_OUTPUT_ON_FAILURE .. include:: ENV_VAR.txt Boolean environment variable that controls if the output should be logged for -failed tests. Set the value to 1, True, or ON to enable output on failure. +failed tests. Set the value to ``1``, ``True``, or ``ON`` to enable output on failure. See :manual:`ctest(1)` for more information on controlling output of failed tests. diff --git a/Help/envvar/CTEST_PROGRESS_OUTPUT.rst b/Help/envvar/CTEST_PROGRESS_OUTPUT.rst index de23e11..b36a6b8 100644 --- a/Help/envvar/CTEST_PROGRESS_OUTPUT.rst +++ b/Help/envvar/CTEST_PROGRESS_OUTPUT.rst @@ -4,7 +4,7 @@ CTEST_PROGRESS_OUTPUT .. include:: ENV_VAR.txt Boolean environment variable that affects how :manual:`ctest ` -command output reports overall progress. When set to 1, TRUE, ON or anything +command output reports overall progress. When set to ``1``, ``TRUE``, ``ON`` or anything else that evaluates to boolean true, progress is reported by repeatedly updating the same line. This greatly reduces the overall verbosity, but is only supported when output is sent directly to a terminal. If the environment diff --git a/Help/envvar/DASHBOARD_TEST_FROM_CTEST.rst b/Help/envvar/DASHBOARD_TEST_FROM_CTEST.rst index 2b303a4..6a52d64 100644 --- a/Help/envvar/DASHBOARD_TEST_FROM_CTEST.rst +++ b/Help/envvar/DASHBOARD_TEST_FROM_CTEST.rst @@ -3,5 +3,6 @@ DASHBOARD_TEST_FROM_CTEST .. include:: ENV_VAR.txt -Environment variable that will exist when a test executed by CTest is run -in non-interactive mode. The value will be equal to :variable:`CMAKE_VERSION`. +Environment variable that will exist when a test executed by :manual:`ctest(1)` +is run in non-interactive mode. The value will be equal to +:variable:`CMAKE_VERSION`. diff --git a/Help/envvar/PackageName_ROOT.rst b/Help/envvar/PackageName_ROOT.rst index ecec63b..82b0a06 100644 --- a/Help/envvar/PackageName_ROOT.rst +++ b/Help/envvar/PackageName_ROOT.rst @@ -5,7 +5,7 @@ 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 +```` is the name given to the :command:`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`. diff --git a/Help/manual/LINKS.txt b/Help/manual/LINKS.txt index 8e53c0c..60a260c 100644 --- a/Help/manual/LINKS.txt +++ b/Help/manual/LINKS.txt @@ -14,7 +14,7 @@ Online Documentation and Community Resources Mailing List https://cmake.org/mailing-lists - For help and discussion about using cmake, a mailing list is + For help and discussion about using CMake, a mailing list is provided at cmake at cmake.org. The list is member-post-only but one may sign up on the CMake web page. Please first read the full documentation at https://cmake.org before posting questions to diff --git a/Help/manual/OPTIONS_BUILD.txt b/Help/manual/OPTIONS_BUILD.txt index baa73d5..64fd816 100644 --- a/Help/manual/OPTIONS_BUILD.txt +++ b/Help/manual/OPTIONS_BUILD.txt @@ -9,23 +9,23 @@ ``-C `` Pre-load a script to populate the cache. - When cmake is first run in an empty build tree, it creates a - CMakeCache.txt file and populates it with customizable settings for + When CMake is first run in an empty build tree, it creates a + ``CMakeCache.txt`` file and populates it with customizable settings for the project. This option may be used to specify a file from which to load cache entries before the first pass through the project's - cmake listfiles. The loaded entries take priority over the + CMake listfiles. The loaded entries take priority over the project's default values. The given file should be a CMake script - containing SET commands that use the CACHE option, not a + containing :command:`set` commands that use the ``CACHE`` option, not a cache-format file. ``-D :=, -D =`` - Create or update a cmake cache entry. + Create or update a CMake ``CACHE`` entry. - When cmake is first run in an empty build tree, it creates a - CMakeCache.txt file and populates it with customizable settings for + When CMake is first run in an empty build tree, it creates a + ``CMakeCache.txt`` file and populates it with customizable settings for the project. This option may be used to specify a setting that takes priority over the project's default value. The option may be - repeated for as many cache entries as desired. + repeated for as many ``CACHE`` entries as desired. If the ``:`` portion is given it must be one of the types specified by the :command:`set` command documentation for its @@ -39,14 +39,14 @@ ``-D:=`` or ``-D=``. ``-U `` - Remove matching entries from CMake cache. + Remove matching entries from CMake ``CACHE``. This option may be used to remove one or more variables from the - CMakeCache.txt file, globbing expressions using * and ? are - supported. The option may be repeated for as many cache entries as + ``CMakeCache.txt`` file, globbing expressions using ``*`` and ``?`` are + supported. The option may be repeated for as many ``CACHE`` entries as desired. - Use with care, you can make your CMakeCache.txt non-working. + Use with care, you can make your ``CMakeCache.txt`` non-working. ``-G `` Specify a build system generator. @@ -74,47 +74,47 @@ Suppress developer warnings. Suppress warnings that are meant for the author of the - CMakeLists.txt files. By default this will also turn off + ``CMakeLists.txt`` files. By default this will also turn off deprecation warnings. ``-Wdev`` Enable developer warnings. - Enable warnings that are meant for the author of the CMakeLists.txt + Enable warnings that are meant for the author of the ``CMakeLists.txt`` files. By default this will also turn on deprecation warnings. ``-Werror=dev`` Make developer warnings errors. - Make warnings that are meant for the author of the CMakeLists.txt files + Make warnings that are meant for the author of the ``CMakeLists.txt`` files errors. By default this will also turn on deprecated warnings as errors. ``-Wno-error=dev`` Make developer warnings not errors. - Make warnings that are meant for the author of the CMakeLists.txt files not + Make warnings that are meant for the author of the ``CMakeLists.txt`` files not errors. By default this will also turn off deprecated warnings as errors. ``-Wdeprecated`` Enable deprecated functionality warnings. Enable warnings for usage of deprecated functionality, that are meant - for the author of the CMakeLists.txt files. + for the author of the ``CMakeLists.txt`` files. ``-Wno-deprecated`` Suppress deprecated functionality warnings. Suppress warnings for usage of deprecated functionality, that are meant - for the author of the CMakeLists.txt files. + for the author of the ``CMakeLists.txt`` files. ``-Werror=deprecated`` Make deprecated macro and function warnings errors. Make warnings for usage of deprecated macros and functions, that are meant - for the author of the CMakeLists.txt files, errors. + for the author of the ``CMakeLists.txt`` files, errors. ``-Wno-error=deprecated`` Make deprecated macro and function warnings not errors. Make warnings for usage of deprecated macros and functions, that are meant - for the author of the CMakeLists.txt files, not errors. + for the author of the ``CMakeLists.txt`` files, not errors. diff --git a/Help/manual/ccmake.1.rst b/Help/manual/ccmake.1.rst index 9548471..60d45a3 100644 --- a/Help/manual/ccmake.1.rst +++ b/Help/manual/ccmake.1.rst @@ -20,7 +20,7 @@ when the program is running. CMake is a cross-platform build system generator. Projects specify their build process with platform-independent CMake listfiles included -in each directory of a source tree with the name CMakeLists.txt. +in each directory of a source tree with the name ``CMakeLists.txt``. Users build a project by using CMake to generate a build system for a native tool on their platform. diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst index a1328f2..1ad3453 100644 --- a/Help/manual/cmake-buildsystem.7.rst +++ b/Help/manual/cmake-buildsystem.7.rst @@ -21,7 +21,7 @@ Binary Targets Executables and libraries are defined using the :command:`add_executable` and :command:`add_library` commands. The resulting binary files have -appropriate prefixes, suffixes and extensions for the platform targeted. +appropriate :prop_tgt:`PREFIX`, :prop_tgt:`SUFFIX` and extensions for the platform targeted. Dependencies between binary targets are expressed using the :command:`target_link_libraries` command: @@ -31,7 +31,7 @@ Dependencies between binary targets are expressed using the add_executable(zipapp zipapp.cpp) target_link_libraries(zipapp archive) -``archive`` is defined as a static library -- an archive containing objects +``archive`` is defined as a ``STATIC`` library -- an archive containing objects compiled from ``archive.cpp``, ``zip.cpp``, and ``lzma.cpp``. ``zipapp`` is defined as an executable formed by compiling and linking ``zipapp.cpp``. When linking the ``zipapp`` executable, the ``archive`` static library is @@ -59,7 +59,7 @@ Binary Library Types Normal Libraries ^^^^^^^^^^^^^^^^ -By default, the :command:`add_library` command defines a static library, +By default, the :command:`add_library` command defines a ``STATIC`` library, unless a type is specified. A type may be specified when using the command: .. code-block:: cmake @@ -141,8 +141,8 @@ Alternatively, object libraries may be linked into other targets: target_link_libraries(test_exe archive) The link (or archiving) step of those other targets will use the object -files from object libraries that are *directly* linked. Additionally, -usage requirements of the object libraries will be honored when compiling +files from ``OBJECT`` libraries that are *directly* linked. Additionally, +usage requirements of the ``OBJECT`` libraries will be honored when compiling sources in those other targets. Furthermore, those usage requirements will propagate transitively to dependents of those other targets. @@ -365,8 +365,8 @@ non-compatible requirements :manual:`cmake(1)` issues a diagnostic: target_link_libraries(exe2 lib1 lib2) The ``lib1`` requirement ``INTERFACE_POSITION_INDEPENDENT_CODE`` is not -"compatible" with the ``POSITION_INDEPENDENT_CODE`` property of the ``exe1`` -target. The library requires that consumers are built as +"compatible" with the :prop_tgt:`POSITION_INDEPENDENT_CODE` property of +the ``exe1`` target. The library requires that consumers are built as position-independent-code, while the executable specifies to not built as position-independent-code, so a diagnostic is issued. @@ -547,10 +547,10 @@ is not known until build-time. Therefore, code such as target_compile_definitions(exe1 PRIVATE DEBUG_BUILD) endif() -may appear to work for ``Makefile`` based and ``Ninja`` generators, but is not -portable to IDE generators. Additionally, the :prop_tgt:`IMPORTED` -configuration-mappings are not accounted for with code like this, so it should -be avoided. +may appear to work for :ref:`Makefile Generators` and :generator:`Ninja` +generators, but is not portable to IDE generators. Additionally, +the :prop_tgt:`IMPORTED` configuration-mappings are not accounted for +with code like this, so it should be avoided. The unary ``TARGET_PROPERTY`` generator expression and the ``TARGET_POLICY`` generator expression are evaluated with the consuming target context. This @@ -699,7 +699,7 @@ found in those directories. This behavior for :ref:`imported targets` may be controlled by setting the :prop_tgt:`NO_SYSTEM_FROM_IMPORTED` target property on the *consumers* of imported targets. -If a binary target is linked transitively to a Mac OX framework, the +If a binary target is linked transitively to a macOS :prop_tgt:`FRAMEWORK`, the ``Headers`` directory of the framework is also treated as a usage requirement. This has the same effect as passing the framework directory as an include directory. diff --git a/Help/manual/cmake-gui.1.rst b/Help/manual/cmake-gui.1.rst index 856aa2f..ff8311b 100644 --- a/Help/manual/cmake-gui.1.rst +++ b/Help/manual/cmake-gui.1.rst @@ -21,7 +21,7 @@ provided at the bottom of the window when the program is running. CMake is a cross-platform build system generator. Projects specify their build process with platform-independent CMake listfiles included -in each directory of a source tree with the name CMakeLists.txt. +in each directory of a source tree with the name ``CMakeLists.txt``. Users build a project by using CMake to generate a build system for a native tool on their platform. diff --git a/Help/manual/cmake-packages.7.rst b/Help/manual/cmake-packages.7.rst index bbe742e..f5aa42d 100644 --- a/Help/manual/cmake-packages.7.rst +++ b/Help/manual/cmake-packages.7.rst @@ -12,7 +12,7 @@ Introduction Packages provide dependency information to CMake based buildsystems. Packages are found with the :command:`find_package` command. The result of -using ``find_package`` is either a set of :prop_tgt:`IMPORTED` targets, or +using :command:`find_package` is either a set of :prop_tgt:`IMPORTED` targets, or a set of variables corresponding to build-relevant information. Using Packages diff --git a/Help/manual/cmake-toolchains.7.rst b/Help/manual/cmake-toolchains.7.rst index ba44b7f..df4531b 100644 --- a/Help/manual/cmake-toolchains.7.rst +++ b/Help/manual/cmake-toolchains.7.rst @@ -26,13 +26,13 @@ built-in variables, such as :variable:`CMAKE_CXX_COMPILER_ID _COMPILER_ID>` etc are set by invoking the :command:`project` command. If no project command is in the top-level CMakeLists file, one will be implicitly generated. By default -the enabled languages are C and CXX: +the enabled languages are ``C`` and ``CXX``: .. code-block:: cmake project(C_Only C) -A special value of NONE can also be used with the :command:`project` command +A special value of ``NONE`` can also be used with the :command:`project` command to enable no languages: .. code-block:: cmake @@ -468,10 +468,10 @@ The following variables will be computed and provided automatically: The Android ABI detected from the standalone toolchain. :variable:`CMAKE__ANDROID_TOOLCHAIN_PREFIX` - The absolute path prefix to the binutils in the standalone toolchain. + The absolute path prefix to the ``binutils`` in the standalone toolchain. :variable:`CMAKE__ANDROID_TOOLCHAIN_SUFFIX` - The host platform suffix of the binutils in the standalone toolchain. + The host platform suffix of the ``binutils`` in the standalone toolchain. For example, a toolchain file might contain: @@ -533,7 +533,7 @@ generator is recommended. The :generator:`Unix Makefiles` or :generator:`Ninja` generators can also be used, but they require the project to handle more areas like target CPU selection and code signing. -Any of the three systems can be targetted by setting the +Any of the three systems can be targeted by setting the :variable:`CMAKE_SYSTEM_NAME` variable to a value from the table below. By default, the latest Device SDK is chosen. As for all Apple platforms, a different SDK (e.g. a simulator) can be selected by setting the @@ -609,7 +609,7 @@ Code Signing Some build artifacts for the embedded Apple platforms require mandatory code signing. If the :generator:`Xcode` generator is being used and -code signing is required or desired, the developmemt team ID can be +code signing is required or desired, the development team ID can be specified via the ``CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM`` CMake variable. This team ID will then be included in the generated Xcode project. By default, CMake avoids the need for code signing during the internal diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index e9dca47..18dd9d7 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -7,7 +7,7 @@ cmake-variables(7) .. contents:: -This page documents variables that are provided by CMake +This page documents variables that are provided by CMake or have meaning to CMake when set by project code. For general information on variables, see the diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index b67fa3a..5b88694 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -172,12 +172,12 @@ Options ``-L[A][H]`` List non-advanced cached variables. - List cache variables will run CMake and list all the variables from - the CMake cache that are not marked as INTERNAL or ADVANCED. This - will effectively display current CMake settings, which can then be - changed with -D option. Changing some of the variables may result - in more variables being created. If A is specified, then it will - display also advanced variables. If H is specified, it will also + List ``CACHE`` variables will run CMake and list all the variables from + the CMake ``CACHE`` that are not marked as ``INTERNAL`` or :prop_cache:`ADVANCED`. + This will effectively display current CMake settings, which can then be + changed with ``-D`` option. Changing some of the variables may result + in more variables being created. If ``A`` is specified, then it will + display also advanced variables. If ``H`` is specified, it will also display help for each variable. ``-N`` @@ -201,9 +201,10 @@ Options additional information such as the cache, log files etc. ``--debug-trycompile`` - Do not delete the try_compile build tree. Only useful on one try_compile at a time. + Do not delete the :command:`try_compile` build tree. + Only useful on one :command:`try_compile` at a time. - Do not delete the files and directories created for try_compile + Do not delete the files and directories created for :command:`try_compile` calls. This is useful in debugging failed try_compiles. It may however change the results of the try-compiles as old junk from a previous try-compile may cause a different test to either pass or @@ -214,7 +215,7 @@ Options Put cmake in a debug mode. Print extra information during the cmake run like stack traces with - message(send_error ) calls. + :command:`message(SEND_ERROR)` calls. ``--trace`` Put cmake in trace mode. @@ -251,8 +252,8 @@ Options Find problems with variable usage in system files. Normally, unused and uninitialized variables are searched for only - in CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR. This flag tells CMake to - warn about other files as well. + in :variable:`CMAKE_SOURCE_DIR` and :variable:`CMAKE_BINARY_DIR`. + This flag tells CMake to warn about other files as well. .. _`Build Tool Mode`: @@ -329,10 +330,10 @@ The options are: Component-based install. Only install component ````. ``--prefix `` - The installation prefix CMAKE_INSTALL_PREFIX. + The installation prefix :variable:`CMAKE_INSTALL_PREFIX`. ``--strip`` - Strip before installing by setting CMAKE_INSTALL_DO_STRIP. + Strip before installing by setting ``CMAKE_INSTALL_DO_STRIP``. ``-v, --verbose`` Enable verbose output. @@ -363,8 +364,8 @@ Run a Script Process the given cmake file as a script written in the CMake language. No configure or generate step is performed and the cache -is not modified. If variables are defined using -D, this must be -done before the -P argument. +is not modified. If variables are defined using ``-D``, this must be +done before the ``-P`` argument. Run a Command-Line Tool @@ -421,7 +422,7 @@ Available commands are: ``compare_files [--ignore-eol] `` Check if ```` is same as ````. If files are the same, - then returns 0, if not it returns 1. The ``--ignore-eol`` option + then returns ``0``, if not it returns ``1``. The ``--ignore-eol`` option implies line-wise comparison and ignores LF/CRLF differences. ``copy ... `` diff --git a/Help/manual/cpack.1.rst b/Help/manual/cpack.1.rst index 679c547..10f617e 100644 --- a/Help/manual/cpack.1.rst +++ b/Help/manual/cpack.1.rst @@ -63,7 +63,7 @@ Options details. By default, ``CPackConfig.cmake`` in the current directory will be used. -``--verbose,-V`` +``--verbose, -V`` Run ``cpack`` with verbose output. This can be used to show more details from the package generation tools and is suitable for project developers. diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index d1bd69b..38b8af6 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -22,8 +22,8 @@ Description The **ctest** executable is the CMake test driver program. CMake-generated build trees created for projects that use the -ENABLE_TESTING and ADD_TEST commands have testing support. This -program will run the tests and report results. +:command:`enable_testing` and :command:`add_test` commands have testing support. +This program will run the tests and report results. Options ======= @@ -33,8 +33,8 @@ Options Some CMake-generated build trees can have multiple build configurations in the same tree. This option can be used to specify - which one should be tested. Example configurations are "Debug" and - "Release". + which one should be tested. Example configurations are ``Debug`` and + ``Release``. ``--progress`` Enable short progress output from tests. @@ -108,7 +108,7 @@ Options ``-O , --output-log `` Output to log file. - This option tells CTest to write all its output to a log file. + This option tells CTest to write all its output to a ```` log file. ``-N,--show-only[=]`` Disable actual execution of tests. @@ -172,9 +172,10 @@ Options Execute dashboard test. This option tells CTest to act as a CDash client and perform a - dashboard test. All tests are , where Mode can be - Experimental, Nightly, and Continuous, and Test can be Start, - Update, Configure, Build, Test, Coverage, and Submit. + dashboard test. All tests are ````, where ```` can be + ``Experimental``, ``Nightly``, and ``Continuous``, and ```` can be + ``Start``, ``Update``, ``Configure``, ``Build``, ``Test``, + ``Coverage``, and ``Submit``. See `Dashboard Client`_. @@ -229,10 +230,10 @@ Options ``-I [Start,End,Stride,test#,test#|Test file], --tests-information`` Run a specific number of tests by number. - This option causes CTest to run tests starting at number Start, - ending at number End, and incrementing by Stride. Any additional - numbers after Stride are considered individual test numbers. Start, - End,or stride can be empty. Optionally a file can be given that + This option causes CTest to run tests starting at number ``Start``, + ending at number ``End``, and incrementing by ``Stride``. Any additional + numbers after ``Stride`` are considered individual test numbers. ``Start``, + ``End``, or ``Stride`` can be empty. Optionally a file can be given that contains the same syntax as the command line. ``-U, --union`` @@ -264,12 +265,12 @@ Options name which can be very annoying. ``--interactive-debug-mode [0|1]`` - Set the interactive mode to 0 or 1. + Set the interactive mode to ``0`` or ``1``. This option causes CTest to run tests in either an interactive mode or a non-interactive mode. On Windows this means that in non-interactive mode, all system debug pop up windows are blocked. - In dashboard mode (Experimental, Nightly, Continuous), the default + In dashboard mode (``Experimental``, ``Nightly``, ``Continuous``), the default is non-interactive. When just running tests not for a dashboard the default is to allow popups and interactive debugging. @@ -350,7 +351,7 @@ See `Build and Test Mode`_. Label and Subproject Summary ============================ -CTest prints timing summary information for each label and subproject +CTest prints timing summary information for each ``LABEL`` and subproject associated with the tests run. The label time summary will not include labels that are mapped to subprojects. @@ -358,8 +359,8 @@ When the :prop_test:`PROCESSORS` test property is set, CTest will display a weighted test timing result in label and subproject summaries. The time is reported with `sec*proc` instead of just `sec`. -The weighted time summary reported for each label or subproject j is computed -as:: +The weighted time summary reported for each label or subproject ``j`` +is computed as:: Weighted Time Summary for Label/Subproject j = sum(raw_test_time[j,i] * num_processors[j,i], i=1...num_tests[j]) @@ -368,25 +369,25 @@ as:: where: -* raw_test_time[j,i]: Wall-clock time for the ith test for the jth label or - subproject -* num_processors[j,i]: Value of the CTest PROCESSORS property for the ith test - for the jth label or subproject -* num_tests[j]: Number of tests associated with the jth label or subproject -* total: Total number of labels or subprojects that have at least one test run +* ``raw_test_time[j,i]``: Wall-clock time for the ``i``th test + for the ``j``th label or subproject +* ``num_processors[j,i]``: Value of the CTest :prop_test:`PROCESSORS` property + for the ``i``th test for the ``j``th label or subproject +* ``num_tests[j]``: Number of tests associated with the ``j``th label or subproject +* ``total``: Total number of labels or subprojects that have at least one test run Therefore, the weighted time summary for each label or subproject represents the amount of time that CTest gave to run the tests for each label or subproject and gives a good representation of the total expense of the tests for each label or subproject when compared to other labels or subprojects. -For example, if "SubprojectA" showed "100 sec*proc" and "SubprojectB" showed -"10 sec*proc", then CTest allocated approximately 10 times the CPU/core time -to run the tests for "SubprojectA" than for "SubprojectB" (e.g. so if effort +For example, if ``SubprojectA`` showed ``100 sec*proc`` and ``SubprojectB`` showed +``10 sec*proc``, then CTest allocated approximately 10 times the CPU/core time +to run the tests for ``SubprojectA`` than for ``SubprojectB`` (e.g. so if effort is going to be expended to reduce the cost of the test suite for the whole -project, then reducing the cost of the test suite for "SubprojectA" would +project, then reducing the cost of the test suite for ``SubprojectA`` would likely have a larger impact than effort to reduce the cost of the test suite -for "SubprojectB"). +for ``SubprojectB``). .. _`Build and Test Mode`: @@ -449,7 +450,7 @@ this mode include: ``--build-config-sample`` A sample executable to use to determine the configuration that - should be used. e.g. Debug/Release/etc. + should be used. e.g. ``Debug``, ``Release`` etc. ``--build-options`` Additional options for configuring the build (i.e. for CMake, not for @@ -495,7 +496,7 @@ Options for Dashboard Client include: dashboard. ``--tomorrow-tag`` - Nightly or experimental starts with next day tag. + ``Nightly`` or ``Experimental`` starts with next day tag. This is useful if the build will not finish in one day. @@ -505,10 +506,10 @@ Options for Dashboard Client include: This option will submit extra files to the dashboard. ``--http1.0`` - Submit using HTTP 1.0. + Submit using `HTTP 1.0`. - This option will force CTest to use HTTP 1.0 to submit files to the - dashboard, instead of HTTP 1.1. + This option will force CTest to use `HTTP 1.0` to submit files to the + dashboard, instead of `HTTP 1.1`. ``--no-compress-output`` Do not compress test output when submitting. @@ -711,7 +712,7 @@ Configuration settings to specify the version control tool include: The source tree is updated by ``git fetch`` followed by ``git reset --hard`` to the ``FETCH_HEAD``. The result is the same - as ``git pull`` except that any local moficiations are overwritten. + as ``git pull`` except that any local modifications are overwritten. Use ``GITUpdateCustom`` to specify a different approach. ``GITInitSubmodules`` diff --git a/Help/prop_sf/VS_CSHARP_tagname.rst b/Help/prop_sf/VS_CSHARP_tagname.rst index d42159f..91c4a06 100644 --- a/Help/prop_sf/VS_CSHARP_tagname.rst +++ b/Help/prop_sf/VS_CSHARP_tagname.rst @@ -3,8 +3,9 @@ VS_CSHARP_ Visual Studio and CSharp source-file-specific configuration. -Tell the Visual Studio generator to set the source file tag -```` to a given value in the generated Visual Studio CSharp +Tell the :manual:`Visual Studio generators ` +to set the source file tag ```` +to a given value in the generated Visual Studio CSharp project. Ignored on other generators and languages. This property can be used to define dependencies between source files or set any other Visual Studio specific parameters. diff --git a/Help/prop_sf/VS_DEPLOYMENT_CONTENT.rst b/Help/prop_sf/VS_DEPLOYMENT_CONTENT.rst index 9fb3ba3..89a5357 100644 --- a/Help/prop_sf/VS_DEPLOYMENT_CONTENT.rst +++ b/Help/prop_sf/VS_DEPLOYMENT_CONTENT.rst @@ -2,7 +2,8 @@ VS_DEPLOYMENT_CONTENT --------------------- Mark a source file as content for deployment with a Windows Phone or -Windows Store application when built with a Visual Studio generator. +Windows Store application when built with a + :manual:`Visual Studio generators `. The value must evaluate to either ``1`` or ``0`` and may use :manual:`generator expressions ` to make the choice based on the build configuration. diff --git a/Help/prop_sf/VS_DEPLOYMENT_LOCATION.rst b/Help/prop_sf/VS_DEPLOYMENT_LOCATION.rst index 303db95..2ce22fc 100644 --- a/Help/prop_sf/VS_DEPLOYMENT_LOCATION.rst +++ b/Help/prop_sf/VS_DEPLOYMENT_LOCATION.rst @@ -2,7 +2,8 @@ VS_DEPLOYMENT_LOCATION ---------------------- Specifies the deployment location for a content source file with a Windows -Phone or Windows Store application when built with a Visual Studio generator. +Phone or Windows Store application when built +with a :manual:`Visual Studio generators `. This property is only applicable when using :prop_sf:`VS_DEPLOYMENT_CONTENT`. The value represent the path relative to the app package and applies to all configurations. diff --git a/Help/prop_sf/VS_INCLUDE_IN_VSIX.rst b/Help/prop_sf/VS_INCLUDE_IN_VSIX.rst index 30f471d..db470ef 100644 --- a/Help/prop_sf/VS_INCLUDE_IN_VSIX.rst +++ b/Help/prop_sf/VS_INCLUDE_IN_VSIX.rst @@ -1,6 +1,6 @@ VS_INCLUDE_IN_VSIX ------------------ -Boolean property to specify if the file should be included within a VSIX -extension package. This is needed for development of Visual Studio -extensions. +Boolean property to specify if the file should be included within a +VSIX (Visual Studio Integration Extension) extension package. +This is needed for development of Visual Studio extensions. diff --git a/Help/prop_sf/VS_SHADER_FLAGS.rst b/Help/prop_sf/VS_SHADER_FLAGS.rst index 0901123..0a53afd 100644 --- a/Help/prop_sf/VS_SHADER_FLAGS.rst +++ b/Help/prop_sf/VS_SHADER_FLAGS.rst @@ -1,4 +1,4 @@ VS_SHADER_FLAGS --------------- -Set additional VS shader flags of a ``.hlsl`` source file. +Set additional Visual Studio shader flags of a ``.hlsl`` source file. diff --git a/Help/prop_sf/VS_SHADER_TYPE.rst b/Help/prop_sf/VS_SHADER_TYPE.rst index 6880256..f104837 100644 --- a/Help/prop_sf/VS_SHADER_TYPE.rst +++ b/Help/prop_sf/VS_SHADER_TYPE.rst @@ -1,4 +1,4 @@ VS_SHADER_TYPE -------------- -Set the VS shader type of a ``.hlsl`` source file. +Set the Visual Studio shader type of a ``.hlsl`` source file. diff --git a/Help/prop_sf/VS_XAML_TYPE.rst b/Help/prop_sf/VS_XAML_TYPE.rst index 190a639..1a274ba 100644 --- a/Help/prop_sf/VS_XAML_TYPE.rst +++ b/Help/prop_sf/VS_XAML_TYPE.rst @@ -1,6 +1,7 @@ VS_XAML_TYPE ------------ -Mark a XAML source file as a different type than the default ``Page``. +Mark a Extensible Application Markup Language (XAML) source file +as a different type than the default ``Page``. The most common usage would be to set the default ``App.xaml`` file as ``ApplicationDefinition``. diff --git a/Help/prop_sf/WRAP_EXCLUDE.rst b/Help/prop_sf/WRAP_EXCLUDE.rst index 5f41c28..638ff03 100644 --- a/Help/prop_sf/WRAP_EXCLUDE.rst +++ b/Help/prop_sf/WRAP_EXCLUDE.rst @@ -4,7 +4,8 @@ WRAP_EXCLUDE Exclude this source file from any code wrapping techniques. Some packages can wrap source files into alternate languages to -provide additional functionality. For example, C++ code can be -wrapped into Java or Python etc using SWIG etc. If ``WRAP_EXCLUDE`` is -set to ``True``, that indicates that this source file should not be -wrapped. +provide additional functionality. + +For example, C++ code can be wrapped into Java or Python, using SWIG. +If ``WRAP_EXCLUDE`` is set to ``True``, that indicates that this +source file should not be wrapped. diff --git a/Help/release/3.9.rst b/Help/release/3.9.rst index ffa95aa..89da627 100644 --- a/Help/release/3.9.rst +++ b/Help/release/3.9.rst @@ -150,7 +150,7 @@ Modules * The :module:`CMakeFindDependencyMacro` module ``find_dependency`` macro now forwards all arguments to the underlying :command:`find_package` call. Existing uses will continue to function as before, but callers can - now access the full suite of arguments that ``find_package`` accepts. + now access the full suite of arguments that :command:`find_package` accepts. * The :module:`FeatureSummary` module :command:`feature_summary` command now accepts the new ``DEFAULT_DESCRIPTION`` option that will print the default diff --git a/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst b/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst index 95d2c7f..e7774f2 100644 --- a/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst +++ b/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst @@ -6,7 +6,7 @@ should point to a command on the host system that can run executable built for the target system. The command will be used to run :command:`try_run` generated executables, -which avoids manual population of the TryRunResults.cmake file. +which avoids manual population of the ``TryRunResults.cmake`` file. It is also used as the default value for the :prop_tgt:`CROSSCOMPILING_EMULATOR` target property of executables. diff --git a/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst b/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst index 72e8e66..eea2c4f 100644 --- a/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst +++ b/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst @@ -2,6 +2,6 @@ CMAKE_CUDA_HOST_COMPILER ------------------------ Executable to use when compiling host code when compiling ``CUDA`` language -files. Maps to the nvcc -ccbin option. Will only be used by CMake on the first +files. Maps to the ``nvcc -ccbin`` option. Will only be used by CMake on the first configuration to determine a valid host compiler for ``CUDA``. After a valid host compiler has been found, this value is read-only. diff --git a/Help/variable/CMAKE_SKIP_INSTALL_RULES.rst b/Help/variable/CMAKE_SKIP_INSTALL_RULES.rst index 44966f3..b77bb68 100644 --- a/Help/variable/CMAKE_SKIP_INSTALL_RULES.rst +++ b/Help/variable/CMAKE_SKIP_INSTALL_RULES.rst @@ -3,6 +3,6 @@ CMAKE_SKIP_INSTALL_RULES Whether to disable generation of installation rules. -If ``TRUE``, cmake will neither generate installaton rules nor +If ``TRUE``, CMake will neither generate installation rules nor will it generate ``cmake_install.cmake`` files. This variable is ``FALSE`` by default. diff --git a/Help/variable/CMAKE_SOURCE_DIR.rst b/Help/variable/CMAKE_SOURCE_DIR.rst index 416fbe1..d1f1798 100644 --- a/Help/variable/CMAKE_SOURCE_DIR.rst +++ b/Help/variable/CMAKE_SOURCE_DIR.rst @@ -7,7 +7,7 @@ This is the full path to the top level of the current CMake source tree. For an in-source build, this would be the same as :variable:`CMAKE_BINARY_DIR`. -When run in -P script mode, CMake sets the variables +When run in ``-P`` script mode, CMake sets the variables :variable:`CMAKE_BINARY_DIR`, :variable:`CMAKE_SOURCE_DIR`, :variable:`CMAKE_CURRENT_BINARY_DIR` and :variable:`CMAKE_CURRENT_SOURCE_DIR` to the current working directory. diff --git a/Help/variable/CMAKE_STAGING_PREFIX.rst b/Help/variable/CMAKE_STAGING_PREFIX.rst index 1310e94..75bf366 100644 --- a/Help/variable/CMAKE_STAGING_PREFIX.rst +++ b/Help/variable/CMAKE_STAGING_PREFIX.rst @@ -5,10 +5,10 @@ This variable may be set to a path to install to when cross-compiling. This can be useful if the path in :variable:`CMAKE_SYSROOT` is read-only, or otherwise should remain pristine. -The ``CMAKE_STAGING_PREFIX`` location is also used as a search prefix by the -``find_*`` commands. This can be controlled by setting the +The :variable:`CMAKE_STAGING_PREFIX` location is also used as a search prefix + by the ``find_*`` commands. This can be controlled by setting the :variable:`CMAKE_FIND_NO_INSTALL_PREFIX` variable. -If any RPATH/RUNPATH entries passed to the linker contain the -``CMAKE_STAGING_PREFIX``, the matching path fragments are replaced with the -:variable:`CMAKE_INSTALL_PREFIX`. +If any ``RPATH``/``RUNPATH`` entries passed to the linker contain the +:variable:`CMAKE_STAGING_PREFIX`, the matching path fragments are replaced +with the :variable:`CMAKE_INSTALL_PREFIX`. diff --git a/Help/variable/CMAKE_SUPPRESS_REGENERATION.rst b/Help/variable/CMAKE_SUPPRESS_REGENERATION.rst index ed47e1a..96184dd 100644 --- a/Help/variable/CMAKE_SUPPRESS_REGENERATION.rst +++ b/Help/variable/CMAKE_SUPPRESS_REGENERATION.rst @@ -1,10 +1,10 @@ CMAKE_SUPPRESS_REGENERATION --------------------------- -If CMAKE_SUPPRESS_REGENERATION is ``OFF``, which is default, then CMake adds a -special target on which all other targets depend that checks the build system -and optionally re-runs CMake to regenerate the build system when the target -specification source changes. +If ``CMAKE_SUPPRESS_REGENERATION`` is ``OFF``, which is default, then CMake +adds a special target on which all other targets depend that checks the build +system and optionally re-runs CMake to regenerate the build system when +the target specification source changes. If this variable evaluates to ``ON`` at the end of the top-level ``CMakeLists.txt`` file, CMake will not add the regeneration target to the diff --git a/Help/variable/CMAKE_SYSROOT.rst b/Help/variable/CMAKE_SYSROOT.rst index 64f81bb..35b944f 100644 --- a/Help/variable/CMAKE_SYSROOT.rst +++ b/Help/variable/CMAKE_SYSROOT.rst @@ -4,8 +4,8 @@ CMAKE_SYSROOT Path to pass to the compiler in the ``--sysroot`` flag. The ``CMAKE_SYSROOT`` content is passed to the compiler in the ``--sysroot`` -flag, if supported. The path is also stripped from the RPATH/RUNPATH if -necessary on installation. The ``CMAKE_SYSROOT`` is also used to prefix +flag, if supported. The path is also stripped from the ``RPATH``/``RUNPATH`` +if necessary on installation. The ``CMAKE_SYSROOT`` is also used to prefix paths searched by the ``find_*`` commands. This variable may only be set in a toolchain file specified by diff --git a/Help/variable/CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION.rst b/Help/variable/CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION.rst index 5dad6bd..e711a93 100644 --- a/Help/variable/CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION.rst +++ b/Help/variable/CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION.rst @@ -5,7 +5,7 @@ Ask CPack to error out as soon as a file with absolute ``INSTALL DESTINATION`` is encountered. The fatal error is emitted before the installation of the offending -file takes place. Some CPack generators, like NSIS, enforce this +file takes place. Some CPack generators, like :cpack_gen:`nsis`, enforce this internally. This variable triggers the definition of :variable:`CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION` when CPack runs. diff --git a/Help/variable/PackageName_ROOT.rst b/Help/variable/PackageName_ROOT.rst index c5b07ae..1c2fd34 100644 --- a/Help/variable/PackageName_ROOT.rst +++ b/Help/variable/PackageName_ROOT.rst @@ -3,7 +3,7 @@ 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 +```` is the name given to the :command:`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`. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b783e625334bbac9bbc16edce9a818d2d213de3a commit b783e625334bbac9bbc16edce9a818d2d213de3a Author: Regina Pfeifer AuthorDate: Mon Mar 25 07:54:30 2019 +0100 Commit: Kyle Edwards CommitDate: Thu Apr 4 13:24:40 2019 -0400 cmExecuteProcessCommand: Port to cmArgumentParser diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx index 03eac5b..ff6340f 100644 --- a/Source/cmExecuteProcessCommand.cxx +++ b/Source/cmExecuteProcessCommand.cxx @@ -2,12 +2,14 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmExecuteProcessCommand.h" +#include "cm_static_string_view.hxx" #include "cmsys/Process.h" +#include #include /* isspace */ -#include #include #include "cmAlgorithms.h" +#include "cmArgumentParser.h" #include "cmMakefile.h" #include "cmProcessOutput.h" #include "cmSystemTools.h" @@ -32,157 +34,85 @@ bool cmExecuteProcessCommand::InitialPass(std::vector const& args, this->SetError("called with incorrect number of arguments"); return false; } - std::vector> cmds; - std::string arguments; - bool doing_command = false; - size_t command_index = 0; - bool output_quiet = false; - bool error_quiet = false; - bool output_strip_trailing_whitespace = false; - bool error_strip_trailing_whitespace = false; - std::string timeout_string; - std::string input_file; - std::string output_file; - std::string error_file; - std::string output_variable; - std::string error_variable; - std::string result_variable; - std::string results_variable; - std::string working_directory; - cmProcessOutput::Encoding encoding = cmProcessOutput::None; - for (size_t i = 0; i < args.size(); ++i) { - if (args[i] == "COMMAND") { - doing_command = true; - command_index = cmds.size(); - cmds.emplace_back(); - } else if (args[i] == "OUTPUT_VARIABLE") { - doing_command = false; - if (++i < args.size()) { - output_variable = args[i]; - } else { - this->SetError(" called with no value for OUTPUT_VARIABLE."); - return false; - } - } else if (args[i] == "ERROR_VARIABLE") { - doing_command = false; - if (++i < args.size()) { - error_variable = args[i]; - } else { - this->SetError(" called with no value for ERROR_VARIABLE."); - return false; - } - } else if (args[i] == "RESULT_VARIABLE") { - doing_command = false; - if (++i < args.size()) { - result_variable = args[i]; - } else { - this->SetError(" called with no value for RESULT_VARIABLE."); - return false; - } - } else if (args[i] == "RESULTS_VARIABLE") { - doing_command = false; - if (++i < args.size()) { - results_variable = args[i]; - } else { - this->SetError(" called with no value for RESULTS_VARIABLE."); - return false; - } - } else if (args[i] == "WORKING_DIRECTORY") { - doing_command = false; - if (++i < args.size()) { - working_directory = args[i]; - } else { - this->SetError(" called with no value for WORKING_DIRECTORY."); - return false; - } - } else if (args[i] == "INPUT_FILE") { - doing_command = false; - if (++i < args.size()) { - input_file = args[i]; - } else { - this->SetError(" called with no value for INPUT_FILE."); - return false; - } - } else if (args[i] == "OUTPUT_FILE") { - doing_command = false; - if (++i < args.size()) { - output_file = args[i]; - } else { - this->SetError(" called with no value for OUTPUT_FILE."); - return false; - } - } else if (args[i] == "ERROR_FILE") { - doing_command = false; - if (++i < args.size()) { - error_file = args[i]; - } else { - this->SetError(" called with no value for ERROR_FILE."); - return false; - } - } else if (args[i] == "TIMEOUT") { - doing_command = false; - if (++i < args.size()) { - timeout_string = args[i]; - } else { - this->SetError(" called with no value for TIMEOUT."); - return false; - } - } else if (args[i] == "OUTPUT_QUIET") { - doing_command = false; - output_quiet = true; - } else if (args[i] == "ERROR_QUIET") { - doing_command = false; - error_quiet = true; - } else if (args[i] == "OUTPUT_STRIP_TRAILING_WHITESPACE") { - doing_command = false; - output_strip_trailing_whitespace = true; - } else if (args[i] == "ERROR_STRIP_TRAILING_WHITESPACE") { - doing_command = false; - error_strip_trailing_whitespace = true; - } else if (args[i] == "ENCODING") { - doing_command = false; - if (++i < args.size()) { - encoding = cmProcessOutput::FindEncoding(args[i]); - } else { - this->SetError(" called with no value for ENCODING."); - return false; - } - } else if (doing_command) { - cmds[command_index].push_back(args[i].c_str()); - } else { - std::ostringstream e; - e << " given unknown argument \"" << args[i] << "\"."; - this->SetError(e.str()); - return false; - } + + struct Arguments + { + std::vector> Commands; + std::string OutputVariable; + std::string ErrorVariable; + std::string ResultVariable; + std::string ResultsVariable; + std::string WorkingDirectory; + std::string InputFile; + std::string OutputFile; + std::string ErrorFile; + std::string Timeout; + bool OutputQuiet = false; + bool ErrorQuiet = false; + bool OutputStripTrailingWhitespace = false; + bool ErrorStripTrailingWhitespace = false; + std::string Encoding; + }; + + static auto const parser = + cmArgumentParser{} + .Bind("COMMAND"_s, &Arguments::Commands) + .Bind("OUTPUT_VARIABLE"_s, &Arguments::OutputVariable) + .Bind("ERROR_VARIABLE"_s, &Arguments::ErrorVariable) + .Bind("RESULT_VARIABLE"_s, &Arguments::ResultVariable) + .Bind("RESULTS_VARIABLE"_s, &Arguments::ResultsVariable) + .Bind("WORKING_DIRECTORY"_s, &Arguments::WorkingDirectory) + .Bind("INPUT_FILE"_s, &Arguments::InputFile) + .Bind("OUTPUT_FILE"_s, &Arguments::OutputFile) + .Bind("ERROR_FILE"_s, &Arguments::ErrorFile) + .Bind("TIMEOUT"_s, &Arguments::Timeout) + .Bind("OUTPUT_QUIET"_s, &Arguments::OutputQuiet) + .Bind("ERROR_QUIET"_s, &Arguments::ErrorQuiet) + .Bind("OUTPUT_STRIP_TRAILING_WHITESPACE"_s, + &Arguments::OutputStripTrailingWhitespace) + .Bind("ERROR_STRIP_TRAILING_WHITESPACE"_s, + &Arguments::ErrorStripTrailingWhitespace) + .Bind("ENCODING"_s, &Arguments::Encoding); + + std::vector unparsedArguments; + std::vector keywordsMissingValue; + Arguments const arguments = + parser.Parse(args, &unparsedArguments, &keywordsMissingValue); + + if (!keywordsMissingValue.empty()) { + this->SetError(" called with no value for " + + keywordsMissingValue.front() + "."); + return false; + } + if (!unparsedArguments.empty()) { + this->SetError(" given unknown argument \"" + unparsedArguments.front() + + "\"."); + return false; } - if (!this->Makefile->CanIWriteThisFile(output_file)) { - std::string e = "attempted to output into a file: " + output_file + - " into a source directory."; - this->SetError(e); + if (!this->Makefile->CanIWriteThisFile(arguments.OutputFile)) { + this->SetError("attempted to output into a file: " + arguments.OutputFile + + " into a source directory."); cmSystemTools::SetFatalErrorOccured(); return false; } // Check for commands given. - if (cmds.empty()) { + if (arguments.Commands.empty()) { this->SetError(" called with no COMMAND argument."); return false; } - for (auto& cmd : cmds) { + for (std::vector const& cmd : arguments.Commands) { if (cmd.empty()) { this->SetError(" given COMMAND argument with no value."); return false; } - // Add the null terminating pointer to the command argument list. - cmd.push_back(nullptr); } // Parse the timeout string. double timeout = -1; - if (!timeout_string.empty()) { - if (sscanf(timeout_string.c_str(), "%lg", &timeout) != 1) { + if (!arguments.Timeout.empty()) { + if (sscanf(arguments.Timeout.c_str(), "%lg", &timeout) != 1) { this->SetError(" called with TIMEOUT value that could not be parsed."); return false; } @@ -192,13 +122,17 @@ bool cmExecuteProcessCommand::InitialPass(std::vector const& args, cmsysProcess* cp = cmsysProcess_New(); // Set the command sequence. - for (auto const& cmd : cmds) { - cmsysProcess_AddCommand(cp, cmd.data()); + for (std::vector const& cmd : arguments.Commands) { + std::vector argv(cmd.size() + 1); + std::transform(cmd.begin(), cmd.end(), argv.begin(), + [](std::string const& s) { return s.c_str(); }); + argv.back() = nullptr; + cmsysProcess_AddCommand(cp, argv.data()); } // Set the process working directory. - if (!working_directory.empty()) { - cmsysProcess_SetWorkingDirectory(cp, working_directory.c_str()); + if (!arguments.WorkingDirectory.empty()) { + cmsysProcess_SetWorkingDirectory(cp, arguments.WorkingDirectory.c_str()); } // Always hide the process window. @@ -206,22 +140,24 @@ bool cmExecuteProcessCommand::InitialPass(std::vector const& args, // Check the output variables. bool merge_output = false; - if (!input_file.empty()) { - cmsysProcess_SetPipeFile(cp, cmsysProcess_Pipe_STDIN, input_file.c_str()); + if (!arguments.InputFile.empty()) { + cmsysProcess_SetPipeFile(cp, cmsysProcess_Pipe_STDIN, + arguments.InputFile.c_str()); } - if (!output_file.empty()) { + if (!arguments.OutputFile.empty()) { cmsysProcess_SetPipeFile(cp, cmsysProcess_Pipe_STDOUT, - output_file.c_str()); + arguments.OutputFile.c_str()); } - if (!error_file.empty()) { - if (error_file == output_file) { + if (!arguments.ErrorFile.empty()) { + if (arguments.ErrorFile == arguments.OutputFile) { merge_output = true; } else { cmsysProcess_SetPipeFile(cp, cmsysProcess_Pipe_STDERR, - error_file.c_str()); + arguments.ErrorFile.c_str()); } } - if (!output_variable.empty() && output_variable == error_variable) { + if (!arguments.OutputVariable.empty() && + arguments.OutputVariable == arguments.ErrorVariable) { merge_output = true; } if (merge_output) { @@ -242,19 +178,20 @@ bool cmExecuteProcessCommand::InitialPass(std::vector const& args, int length; char* data; int p; - cmProcessOutput processOutput(encoding); + cmProcessOutput processOutput( + cmProcessOutput::FindEncoding(arguments.Encoding)); std::string strdata; while ((p = cmsysProcess_WaitForData(cp, &data, &length, nullptr))) { // Put the output in the right place. - if (p == cmsysProcess_Pipe_STDOUT && !output_quiet) { - if (output_variable.empty()) { + if (p == cmsysProcess_Pipe_STDOUT && !arguments.OutputQuiet) { + if (arguments.OutputVariable.empty()) { processOutput.DecodeText(data, length, strdata, 1); cmSystemTools::Stdout(strdata); } else { cmExecuteProcessCommandAppend(tempOutput, data, length); } - } else if (p == cmsysProcess_Pipe_STDERR && !error_quiet) { - if (error_variable.empty()) { + } else if (p == cmsysProcess_Pipe_STDERR && !arguments.ErrorQuiet) { + if (arguments.ErrorVariable.empty()) { processOutput.DecodeText(data, length, strdata, 2); cmSystemTools::Stderr(strdata); } else { @@ -262,13 +199,13 @@ bool cmExecuteProcessCommand::InitialPass(std::vector const& args, } } } - if (!output_quiet && output_variable.empty()) { + if (!arguments.OutputQuiet && arguments.OutputVariable.empty()) { processOutput.DecodeText(std::string(), strdata, 1); if (!strdata.empty()) { cmSystemTools::Stdout(strdata); } } - if (!error_quiet && error_variable.empty()) { + if (!arguments.ErrorQuiet && arguments.ErrorVariable.empty()) { processOutput.DecodeText(std::string(), strdata, 2); if (!strdata.empty()) { cmSystemTools::Stderr(strdata); @@ -281,46 +218,49 @@ bool cmExecuteProcessCommand::InitialPass(std::vector const& args, processOutput.DecodeText(tempError, tempError); // Fix the text in the output strings. - cmExecuteProcessCommandFixText(tempOutput, output_strip_trailing_whitespace); - cmExecuteProcessCommandFixText(tempError, error_strip_trailing_whitespace); + cmExecuteProcessCommandFixText(tempOutput, + arguments.OutputStripTrailingWhitespace); + cmExecuteProcessCommandFixText(tempError, + arguments.ErrorStripTrailingWhitespace); // Store the output obtained. - if (!output_variable.empty() && !tempOutput.empty()) { - this->Makefile->AddDefinition(output_variable, tempOutput.data()); + if (!arguments.OutputVariable.empty() && !tempOutput.empty()) { + this->Makefile->AddDefinition(arguments.OutputVariable, tempOutput.data()); } - if (!merge_output && !error_variable.empty() && !tempError.empty()) { - this->Makefile->AddDefinition(error_variable, tempError.data()); + if (!merge_output && !arguments.ErrorVariable.empty() && + !tempError.empty()) { + this->Makefile->AddDefinition(arguments.ErrorVariable, tempError.data()); } // Store the result of running the process. - if (!result_variable.empty()) { + if (!arguments.ResultVariable.empty()) { switch (cmsysProcess_GetState(cp)) { case cmsysProcess_State_Exited: { int v = cmsysProcess_GetExitValue(cp); char buf[16]; sprintf(buf, "%d", v); - this->Makefile->AddDefinition(result_variable, buf); + this->Makefile->AddDefinition(arguments.ResultVariable, buf); } break; case cmsysProcess_State_Exception: - this->Makefile->AddDefinition(result_variable, + this->Makefile->AddDefinition(arguments.ResultVariable, cmsysProcess_GetExceptionString(cp)); break; case cmsysProcess_State_Error: - this->Makefile->AddDefinition(result_variable, + this->Makefile->AddDefinition(arguments.ResultVariable, cmsysProcess_GetErrorString(cp)); break; case cmsysProcess_State_Expired: - this->Makefile->AddDefinition(result_variable, + this->Makefile->AddDefinition(arguments.ResultVariable, "Process terminated due to timeout"); break; } } // Store the result of running the processes. - if (!results_variable.empty()) { + if (!arguments.ResultsVariable.empty()) { switch (cmsysProcess_GetState(cp)) { case cmsysProcess_State_Exited: { std::vector res; - for (size_t i = 0; i < cmds.size(); ++i) { + for (size_t i = 0; i < arguments.Commands.size(); ++i) { switch (cmsysProcess_GetStateByIndex(cp, static_cast(i))) { case kwsysProcess_StateByIndex_Exited: { int exitCode = @@ -339,19 +279,19 @@ bool cmExecuteProcessCommand::InitialPass(std::vector const& args, break; } } - this->Makefile->AddDefinition(results_variable, + this->Makefile->AddDefinition(arguments.ResultsVariable, cmJoin(res, ";").c_str()); } break; case cmsysProcess_State_Exception: - this->Makefile->AddDefinition(results_variable, + this->Makefile->AddDefinition(arguments.ResultsVariable, cmsysProcess_GetExceptionString(cp)); break; case cmsysProcess_State_Error: - this->Makefile->AddDefinition(results_variable, + this->Makefile->AddDefinition(arguments.ResultsVariable, cmsysProcess_GetErrorString(cp)); break; case cmsysProcess_State_Expired: - this->Makefile->AddDefinition(results_variable, + this->Makefile->AddDefinition(arguments.ResultsVariable, "Process terminated due to timeout"); break; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9bddb03f318dd152b32c651354c9f1c30eb4d902 commit 9bddb03f318dd152b32c651354c9f1c30eb4d902 Author: Regina Pfeifer AuthorDate: Sat Mar 23 22:45:41 2019 +0100 Commit: Kyle Edwards CommitDate: Thu Apr 4 13:24:40 2019 -0400 cmParseArgumentsCommand: Port to cmArgumentParser diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx index ab8d103..5213432 100644 --- a/Source/cmParseArgumentsCommand.cxx +++ b/Source/cmParseArgumentsCommand.cxx @@ -8,10 +8,12 @@ #include #include "cmAlgorithms.h" +#include "cmArgumentParser.h" #include "cmMakefile.h" #include "cmMessageType.h" #include "cmRange.h" #include "cmSystemTools.h" +#include "cm_string_view.hxx" class cmExecutionStatus; @@ -28,42 +30,43 @@ static std::string EscapeArg(const std::string& arg) return escapedArg; } -namespace { -enum insideValues +static std::string JoinList(std::vector const& arg, bool escape) { - NONE, - SINGLE, - MULTI -}; + return escape ? cmJoin(cmMakeRange(arg).transform(EscapeArg), ";") + : cmJoin(cmMakeRange(arg), ";"); +} + +namespace { typedef std::map options_map; typedef std::map single_map; typedef std::map> multi_map; typedef std::set options_set; -} -// function to be called every time, a new key word was parsed or all -// parameters where parsed. -static void DetectKeywordsMissingValues(insideValues currentState, - const std::string& currentArgName, - int& argumentsFound, - options_set& keywordsMissingValues) +struct UserArgumentParser : public cmArgumentParser { - if (currentState == SINGLE || - (currentState == MULTI && argumentsFound == 0)) { - keywordsMissingValues.insert(currentArgName); + template + void Bind(std::vector const& names, + std::map& ref, H duplicateKey) + { + for (std::string const& key : names) { + auto const it = ref.emplace(key, T{}).first; + bool const inserted = this->cmArgumentParser::Bind( + cm::string_view(it->first), it->second); + if (!inserted) { + duplicateKey(key); + } + } } +}; - argumentsFound = 0; -} +} // namespace -static void PassParsedArguments(const std::string& prefix, - cmMakefile& makefile, - const options_map& options, - const single_map& singleValArgs, - const multi_map& multiValArgs, - const std::vector& unparsed, - const options_set& keywordsMissingValues) +static void PassParsedArguments( + const std::string& prefix, cmMakefile& makefile, const options_map& options, + const single_map& singleValArgs, const multi_map& multiValArgs, + const std::vector& unparsed, + const options_set& keywordsMissingValues, bool parseFromArgV) { for (auto const& iter : options) { makefile.AddDefinition(prefix + iter.first, @@ -81,7 +84,7 @@ static void PassParsedArguments(const std::string& prefix, for (auto const& iter : multiValArgs) { if (!iter.second.empty()) { makefile.AddDefinition(prefix + iter.first, - cmJoin(cmMakeRange(iter.second), ";").c_str()); + JoinList(iter.second, parseFromArgV).c_str()); } else { makefile.RemoveDefinition(prefix + iter.first); } @@ -89,7 +92,7 @@ static void PassParsedArguments(const std::string& prefix, if (!unparsed.empty()) { makefile.AddDefinition(prefix + "UNPARSED_ARGUMENTS", - cmJoin(cmMakeRange(unparsed), ";").c_str()); + JoinList(unparsed, parseFromArgV).c_str()); } else { makefile.RemoveDefinition(prefix + "UNPARSED_ARGUMENTS"); } @@ -141,6 +144,8 @@ bool cmParseArgumentsCommand::InitialPass(std::vector const& args, // the first argument is the prefix const std::string prefix = (*argIter++) + "_"; + UserArgumentParser parser; + // define the result maps holding key/value pairs for // options, single values and multi values options_map options; @@ -150,45 +155,25 @@ bool cmParseArgumentsCommand::InitialPass(std::vector const& args, // anything else is put into a vector of unparsed strings std::vector unparsed; - // remember already defined keywords - std::set used_keywords; - const std::string dup_warning = "keyword defined more than once: "; + auto const duplicateKey = [this](std::string const& key) { + this->GetMakefile()->IssueMessage( + MessageType::WARNING, "keyword defined more than once: " + key); + }; // the second argument is a (cmake) list of options without argument std::vector list; cmSystemTools::ExpandListArgument(*argIter++, list); - for (std::string const& iter : list) { - if (!used_keywords.insert(iter).second) { - this->GetMakefile()->IssueMessage(MessageType::WARNING, - dup_warning + iter); - } - options[iter]; // default initialize - } + parser.Bind(list, options, duplicateKey); // the third argument is a (cmake) list of single argument options list.clear(); cmSystemTools::ExpandListArgument(*argIter++, list); - for (std::string const& iter : list) { - if (!used_keywords.insert(iter).second) { - this->GetMakefile()->IssueMessage(MessageType::WARNING, - dup_warning + iter); - } - singleValArgs[iter]; // default initialize - } + parser.Bind(list, singleValArgs, duplicateKey); // the fourth argument is a (cmake) list of multi argument options list.clear(); cmSystemTools::ExpandListArgument(*argIter++, list); - for (std::string const& iter : list) { - if (!used_keywords.insert(iter).second) { - this->GetMakefile()->IssueMessage(MessageType::WARNING, - dup_warning + iter); - } - multiValArgs[iter]; // default initialize - } - - insideValues insideValues = NONE; - std::string currentArgName; + parser.Bind(list, multiValArgs, duplicateKey); list.clear(); if (!parseFromArgV) { @@ -223,68 +208,14 @@ bool cmParseArgumentsCommand::InitialPass(std::vector const& args, } } - options_set keywordsMissingValues; - int multiArgumentsFound = 0; - - // iterate over the arguments list and fill in the values where applicable - for (std::string const& arg : list) { - const options_map::iterator optIter = options.find(arg); - if (optIter != options.end()) { - DetectKeywordsMissingValues(insideValues, currentArgName, - multiArgumentsFound, keywordsMissingValues); - insideValues = NONE; - optIter->second = true; - continue; - } - - const single_map::iterator singleIter = singleValArgs.find(arg); - if (singleIter != singleValArgs.end()) { - DetectKeywordsMissingValues(insideValues, currentArgName, - multiArgumentsFound, keywordsMissingValues); - insideValues = SINGLE; - currentArgName = arg; - continue; - } - - const multi_map::iterator multiIter = multiValArgs.find(arg); - if (multiIter != multiValArgs.end()) { - DetectKeywordsMissingValues(insideValues, currentArgName, - multiArgumentsFound, keywordsMissingValues); - insideValues = MULTI; - currentArgName = arg; - continue; - } - - switch (insideValues) { - case SINGLE: - singleValArgs[currentArgName] = arg; - insideValues = NONE; - break; - case MULTI: - ++multiArgumentsFound; - if (parseFromArgV) { - multiValArgs[currentArgName].push_back(EscapeArg(arg)); - } else { - multiValArgs[currentArgName].push_back(arg); - } - break; - default: - multiArgumentsFound = 0; - - if (parseFromArgV) { - unparsed.push_back(EscapeArg(arg)); - } else { - unparsed.push_back(arg); - } - break; - } - } + std::vector keywordsMissingValues; - DetectKeywordsMissingValues(insideValues, currentArgName, - multiArgumentsFound, keywordsMissingValues); + parser.Parse(list, &unparsed, &keywordsMissingValues); - PassParsedArguments(prefix, *this->Makefile, options, singleValArgs, - multiValArgs, unparsed, keywordsMissingValues); + PassParsedArguments( + prefix, *this->Makefile, options, singleValArgs, multiValArgs, unparsed, + options_set(keywordsMissingValues.begin(), keywordsMissingValues.end()), + parseFromArgV); return true; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=45edf1ad66a97e9083b37aeab18e33436df70b29 commit 45edf1ad66a97e9083b37aeab18e33436df70b29 Author: Regina Pfeifer AuthorDate: Sat Mar 23 22:45:41 2019 +0100 Commit: Kyle Edwards CommitDate: Thu Apr 4 13:24:40 2019 -0400 Retire cmCommandArgumentsHelper diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index a2836d6..0e1cc20 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -445,8 +445,6 @@ set(SRCS cmCMakeMinimumRequired.h cmCMakePolicyCommand.cxx cmCMakePolicyCommand.h - cmCommandArgumentsHelper.cxx - cmCommandArgumentsHelper.h cmConditionEvaluator.cxx cmConditionEvaluator.h cmConfigureFileCommand.cxx diff --git a/Source/cmCommandArgumentsHelper.cxx b/Source/cmCommandArgumentsHelper.cxx deleted file mode 100644 index 968b17c..0000000 --- a/Source/cmCommandArgumentsHelper.cxx +++ /dev/null @@ -1,233 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmCommandArgumentsHelper.h" - -cmCommandArgument::cmCommandArgument(cmCommandArgumentsHelper* args, - const char* key, - cmCommandArgumentGroup* group) - : Key(key) - , Group(group) - , WasActive(false) - , ArgumentsBeforeEmpty(true) - , CurrentIndex(0) -{ - if (args != nullptr) { - args->AddArgument(this); - } - - if (this->Group != nullptr) { - this->Group->ContainedArguments.push_back(this); - } -} - -void cmCommandArgument::Reset() -{ - this->WasActive = false; - this->CurrentIndex = 0; - this->DoReset(); -} - -void cmCommandArgument::Follows(const cmCommandArgument* arg) -{ - this->ArgumentsBeforeEmpty = false; - this->ArgumentsBefore.insert(arg); -} - -void cmCommandArgument::FollowsGroup(const cmCommandArgumentGroup* group) -{ - if (group != nullptr) { - this->ArgumentsBeforeEmpty = false; - this->ArgumentsBefore.insert(group->ContainedArguments.begin(), - group->ContainedArguments.end()); - } -} - -bool cmCommandArgument::MayFollow(const cmCommandArgument* current) const -{ - if (this->ArgumentsBeforeEmpty) { - return true; - } - return this->ArgumentsBefore.find(current) != this->ArgumentsBefore.end(); -} - -bool cmCommandArgument::KeyMatches(const std::string& key) const -{ - if ((this->Key == nullptr) || (this->Key[0] == '\0')) { - return true; - } - return (key == this->Key); -} - -void cmCommandArgument::ApplyOwnGroup() -{ - if (this->Group != nullptr) { - for (cmCommandArgument* cargs : this->Group->ContainedArguments) { - if (cargs != this) { - this->ArgumentsBefore.insert(cargs); - } - } - } -} - -void cmCommandArgument::Activate() -{ - this->WasActive = true; - this->CurrentIndex = 0; -} - -bool cmCommandArgument::Consume(const std::string& arg) -{ - bool res = this->DoConsume(arg, this->CurrentIndex); - this->CurrentIndex++; - return res; -} - -cmCAStringVector::cmCAStringVector(cmCommandArgumentsHelper* args, - const char* key, - cmCommandArgumentGroup* group) - : cmCommandArgument(args, key, group) - , Ignore(nullptr) -{ - if ((key == nullptr) || (*key == 0)) { - this->DataStart = 0; - } else { - this->DataStart = 1; - } -} - -bool cmCAStringVector::DoConsume(const std::string& arg, unsigned int index) -{ - if (index >= this->DataStart) { - if ((this->Ignore == nullptr) || (arg != this->Ignore)) { - this->Vector.push_back(arg); - } - } - - return false; -} - -void cmCAStringVector::DoReset() -{ - this->Vector.clear(); -} - -cmCAString::cmCAString(cmCommandArgumentsHelper* args, const char* key, - cmCommandArgumentGroup* group) - : cmCommandArgument(args, key, group) -{ - if ((key == nullptr) || (*key == 0)) { - this->DataStart = 0; - } else { - this->DataStart = 1; - } -} - -bool cmCAString::DoConsume(const std::string& arg, unsigned int index) -{ - if (index == this->DataStart) { - this->String = arg; - } - - return index >= this->DataStart; -} - -void cmCAString::DoReset() -{ - this->String.clear(); -} - -cmCAEnabler::cmCAEnabler(cmCommandArgumentsHelper* args, const char* key, - cmCommandArgumentGroup* group) - : cmCommandArgument(args, key, group) - , Enabled(false) -{ -} - -bool cmCAEnabler::DoConsume(const std::string&, unsigned int index) -{ - if (index == 0) { - this->Enabled = true; - } - return true; -} - -void cmCAEnabler::DoReset() -{ - this->Enabled = false; -} - -cmCADisabler::cmCADisabler(cmCommandArgumentsHelper* args, const char* key, - cmCommandArgumentGroup* group) - : cmCommandArgument(args, key, group) - , Enabled(true) -{ -} - -bool cmCADisabler::DoConsume(const std::string&, unsigned int index) -{ - if (index == 0) { - this->Enabled = false; - } - return true; -} - -void cmCADisabler::DoReset() -{ - this->Enabled = true; -} - -void cmCommandArgumentGroup::Follows(const cmCommandArgument* arg) -{ - for (cmCommandArgument* ca : this->ContainedArguments) { - ca->Follows(arg); - } -} - -void cmCommandArgumentGroup::FollowsGroup(const cmCommandArgumentGroup* group) -{ - for (cmCommandArgument* ca : this->ContainedArguments) { - ca->FollowsGroup(group); - } -} - -void cmCommandArgumentsHelper::Parse(const std::vector* args, - std::vector* unconsumedArgs) -{ - if (args == nullptr) { - return; - } - - for (cmCommandArgument* ca : this->Arguments) { - ca->ApplyOwnGroup(); - ca->Reset(); - } - - cmCommandArgument* activeArgument = nullptr; - const cmCommandArgument* previousArgument = nullptr; - for (std::string const& it : *args) { - for (cmCommandArgument* ca : this->Arguments) { - if (ca->KeyMatches(it) && (ca->MayFollow(previousArgument))) { - activeArgument = ca; - activeArgument->Activate(); - break; - } - } - - if (activeArgument) { - bool argDone = activeArgument->Consume(it); - previousArgument = activeArgument; - if (argDone) { - activeArgument = nullptr; - } - } else { - if (unconsumedArgs != nullptr) { - unconsumedArgs->push_back(it); - } - } - } -} - -void cmCommandArgumentsHelper::AddArgument(cmCommandArgument* arg) -{ - this->Arguments.push_back(arg); -} diff --git a/Source/cmCommandArgumentsHelper.h b/Source/cmCommandArgumentsHelper.h deleted file mode 100644 index dc934be..0000000 --- a/Source/cmCommandArgumentsHelper.h +++ /dev/null @@ -1,194 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCommandArgumentsHelper_h -#define cmCommandArgumentsHelper_h - -#include "cmConfigure.h" // IWYU pragma: keep - -#include -#include -#include - -class cmCommandArgumentGroup; -class cmCommandArgumentsHelper; - -/* cmCommandArgumentsHelper, cmCommandArgumentGroup and cmCommandArgument (i.e. -its derived classes cmCAXXX can be used to simplify the processing of -arguments to cmake commands. Maybe they can also be used to generate -documentation. - -For every argument supported by a command one cmCommandArgument is created -and added to cmCommandArgumentsHelper. cmCommand has a cmCommandArgumentsHelper -as member variable so this should be used. - -The order of the arguments is defined using the Follows(arg) method. It says -that this argument follows immediateley the given argument. It can be used -with multiple arguments if the argument can follow after different arguments. - -Arguments can be arranged in groups using cmCommandArgumentGroup. Every -member of a group can follow any other member of the group. These groups -can also be used to define the order. - -Once all arguments and groups are set up, cmCommandArgumentsHelper::Parse() -is called and afterwards the values of the arguments can be evaluated. - -For an example see cmExportCommand.cxx. -*/ -class cmCommandArgument -{ -public: - cmCommandArgument(cmCommandArgumentsHelper* args, const char* key, - cmCommandArgumentGroup* group = nullptr); - virtual ~cmCommandArgument() = default; - - /// this argument may follow after arg. 0 means it comes first. - void Follows(const cmCommandArgument* arg); - - /// this argument may follow after any of the arguments in the given group - void FollowsGroup(const cmCommandArgumentGroup* group); - - /// Returns true if the argument was found in the argument list - bool WasFound() const { return this->WasActive; } - - // The following methods are only called from - // cmCommandArgumentsHelper::Parse(), but making this a friend would - // give it access to everything - - /// Make the current argument the currently active argument - void Activate(); - /// Consume the current string - bool Consume(const std::string& arg); - - /// Return true if this argument may follow after the given argument. - bool MayFollow(const cmCommandArgument* current) const; - - /** Returns true if the given key matches the key for this argument. - If this argument has an empty key everything matches. */ - bool KeyMatches(const std::string& key) const; - - /// Make this argument follow all members of the own group - void ApplyOwnGroup(); - - /// Reset argument, so it's back to its initial state - void Reset(); - -private: - const char* Key; - std::set ArgumentsBefore; - cmCommandArgumentGroup* Group; - bool WasActive; - bool ArgumentsBeforeEmpty; - unsigned int CurrentIndex; - - virtual bool DoConsume(const std::string& arg, unsigned int index) = 0; - virtual void DoReset() = 0; -}; - -/** cmCAStringVector is to be used for arguments which can consist of more -than one string, e.g. the FILES argument in INSTALL(FILES f1 f2 f3 ...). */ -class cmCAStringVector : public cmCommandArgument -{ -public: - cmCAStringVector(cmCommandArgumentsHelper* args, const char* key, - cmCommandArgumentGroup* group = nullptr); - - /// Return the vector of strings - const std::vector& GetVector() const { return this->Vector; } - - /** Is there a keyword which should be skipped in - the arguments (e.g. ARGS for ADD_CUSTOM_COMMAND) ? */ - void SetIgnore(const char* ignore) { this->Ignore = ignore; } - -private: - std::vector Vector; - unsigned int DataStart; - const char* Ignore; - bool DoConsume(const std::string& arg, unsigned int index) override; - void DoReset() override; -}; - -/** cmCAString is to be used for arguments which consist of one value, -e.g. the executable name in ADD_EXECUTABLE(). */ -class cmCAString : public cmCommandArgument -{ -public: - cmCAString(cmCommandArgumentsHelper* args, const char* key, - cmCommandArgumentGroup* group = nullptr); - - /// Return the string - const std::string& GetString() const { return this->String; } - const char* GetCString() const { return this->String.c_str(); } - -private: - std::string String; - unsigned int DataStart; - bool DoConsume(const std::string& arg, unsigned int index) override; - void DoReset() override; -}; - -/** cmCAEnabler is to be used for options which are off by default and can be -enabled using a special argument, e.g. EXCLUDE_FROM_ALL in ADD_EXECUTABLE(). */ -class cmCAEnabler : public cmCommandArgument -{ -public: - cmCAEnabler(cmCommandArgumentsHelper* args, const char* key, - cmCommandArgumentGroup* group = nullptr); - - /// Has it been enabled ? - bool IsEnabled() const { return this->Enabled; } - -private: - bool Enabled; - bool DoConsume(const std::string& arg, unsigned int index) override; - void DoReset() override; -}; - -/** cmCADisable is to be used for options which are on by default and can be -disabled using a special argument.*/ -class cmCADisabler : public cmCommandArgument -{ -public: - cmCADisabler(cmCommandArgumentsHelper* args, const char* key, - cmCommandArgumentGroup* group = nullptr); - - /// Is it still enabled ? - bool IsEnabled() const { return this->Enabled; } - -private: - bool Enabled; - bool DoConsume(const std::string& arg, unsigned int index) override; - void DoReset() override; -}; - -/** Group of arguments, needed for ordering. E.g. WIN32, EXCLUDE_FROM_ALL and -MACSOX_BUNDLE from ADD_EXECUTABLE() are a group. -*/ -class cmCommandArgumentGroup -{ - friend class cmCommandArgument; - -public: - /// All members of this group may follow the given argument - void Follows(const cmCommandArgument* arg); - - /// All members of this group may follow all members of the given group - void FollowsGroup(const cmCommandArgumentGroup* group); - -private: - std::vector ContainedArguments; -}; - -class cmCommandArgumentsHelper -{ -public: - /// Parse the argument list - void Parse(const std::vector* args, - std::vector* unconsumedArgs); - /// Add an argument. - void AddArgument(cmCommandArgument* arg); - -private: - std::vector Arguments; -}; - -#endif diff --git a/bootstrap b/bootstrap index addb4f7..d46b8a8 100755 --- a/bootstrap +++ b/bootstrap @@ -269,7 +269,6 @@ CMAKE_CXX_SOURCES="\ cmCacheManager \ cmCommand \ cmCommandArgumentParserHelper \ - cmCommandArgumentsHelper \ cmCommands \ cmCommonTargetGenerator \ cmComputeComponentGraph \ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f5acecaa6f653ac6d4f216e5403d917856fbe19e commit f5acecaa6f653ac6d4f216e5403d917856fbe19e Author: Regina Pfeifer AuthorDate: Sat Mar 23 22:45:41 2019 +0100 Commit: Kyle Edwards CommitDate: Thu Apr 4 13:24:39 2019 -0400 cmExportCommand: Port to cmArgumentParser diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index c25e1f4..5b611c0 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -2,10 +2,13 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmExportCommand.h" +#include "cm_static_string_view.hxx" #include "cmsys/RegularExpression.hxx" #include #include +#include +#include "cmArgumentParser.h" #include "cmExportBuildAndroidMKGenerator.h" #include "cmExportBuildFileGenerator.h" #include "cmExportSetMap.h" @@ -18,6 +21,7 @@ #include "cmSystemTools.h" #include "cmTarget.h" +class cmExportSet; class cmExecutionStatus; #if defined(__HAIKU__) @@ -25,19 +29,6 @@ class cmExecutionStatus; # include #endif -cmExportCommand::cmExportCommand() - : Targets(&Helper, "TARGETS") - , Append(&Helper, "APPEND", &ArgumentGroup) - , ExportSetName(&Helper, "EXPORT", &ArgumentGroup) - , Namespace(&Helper, "NAMESPACE", &ArgumentGroup) - , Filename(&Helper, "FILE", &ArgumentGroup) - , ExportOld(&Helper, "EXPORT_LINK_INTERFACE_LIBRARIES", &ArgumentGroup) - , AndroidMKFile(&Helper, "ANDROID_MK") -{ - this->ExportSet = nullptr; -} - -// cmExportCommand bool cmExportCommand::InitialPass(std::vector const& args, cmExecutionStatus&) { @@ -49,45 +40,62 @@ bool cmExportCommand::InitialPass(std::vector const& args, if (args[0] == "PACKAGE") { return this->HandlePackage(args); } + + struct Arguments + { + std::string ExportSetName; + std::vector Targets; + std::string Namespace; + std::string Filename; + std::string AndroidMKFile; + bool Append = false; + bool ExportOld = false; + }; + + auto parser = cmArgumentParser{} + .Bind("NAMESPACE"_s, &Arguments::Namespace) + .Bind("FILE"_s, &Arguments::Filename); + if (args[0] == "EXPORT") { - this->ExportSetName.Follows(nullptr); - this->ArgumentGroup.Follows(&this->ExportSetName); + parser.Bind("EXPORT"_s, &Arguments::ExportSetName); } else { - this->Targets.Follows(nullptr); - this->ArgumentGroup.Follows(&this->Targets); + parser.Bind("TARGETS"_s, &Arguments::Targets); + parser.Bind("ANDROID_MK"_s, &Arguments::AndroidMKFile); + parser.Bind("APPEND"_s, &Arguments::Append); + parser.Bind("EXPORT_LINK_INTERFACE_LIBRARIES"_s, &Arguments::ExportOld); } std::vector unknownArgs; - this->Helper.Parse(&args, &unknownArgs); + Arguments const arguments = parser.Parse(args, &unknownArgs); if (!unknownArgs.empty()) { - this->SetError("Unknown arguments."); + this->SetError("Unknown argument: \"" + unknownArgs.front() + "\"."); return false; } std::string fname; bool android = false; - if (this->AndroidMKFile.WasFound()) { - fname = this->AndroidMKFile.GetString(); + if (!arguments.AndroidMKFile.empty()) { + fname = arguments.AndroidMKFile; android = true; } - if (!this->Filename.WasFound() && fname.empty()) { + if (arguments.Filename.empty() && fname.empty()) { if (args[0] != "EXPORT") { this->SetError("FILE option missing."); return false; } - fname = this->ExportSetName.GetString() + ".cmake"; + fname = arguments.ExportSetName + ".cmake"; } else if (fname.empty()) { // Make sure the file has a .cmake extension. - if (cmSystemTools::GetFilenameLastExtension(this->Filename.GetCString()) != + if (cmSystemTools::GetFilenameLastExtension(arguments.Filename) != ".cmake") { std::ostringstream e; - e << "FILE option given filename \"" << this->Filename.GetString() + e << "FILE option given filename \"" << arguments.Filename << "\" which does not have an extension of \".cmake\".\n"; this->SetError(e.str()); return false; } - fname = this->Filename.GetString(); + fname = arguments.Filename; } // Get the file to write. @@ -109,33 +117,19 @@ bool cmExportCommand::InitialPass(std::vector const& args, cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator(); + cmExportSet* ExportSet = nullptr; if (args[0] == "EXPORT") { - if (this->Append.IsEnabled()) { - std::ostringstream e; - e << "EXPORT signature does not recognise the APPEND option."; - this->SetError(e.str()); - return false; - } - - if (this->ExportOld.IsEnabled()) { - std::ostringstream e; - e << "EXPORT signature does not recognise the " - "EXPORT_LINK_INTERFACE_LIBRARIES option."; - this->SetError(e.str()); - return false; - } - cmExportSetMap& setMap = gg->GetExportSets(); - std::string setName = this->ExportSetName.GetString(); - if (setMap.find(setName) == setMap.end()) { + auto const it = setMap.find(arguments.ExportSetName); + if (it == setMap.end()) { std::ostringstream e; - e << "Export set \"" << setName << "\" not found."; + e << "Export set \"" << arguments.ExportSetName << "\" not found."; this->SetError(e.str()); return false; } - this->ExportSet = setMap[setName]; - } else if (this->Targets.WasFound()) { - for (std::string const& currentTarget : this->Targets.GetVector()) { + ExportSet = it->second; + } else if (!arguments.Targets.empty()) { + for (std::string const& currentTarget : arguments.Targets) { if (this->Makefile->IsAlias(currentTarget)) { std::ostringstream e; e << "given ALIAS target \"" << currentTarget @@ -159,7 +153,7 @@ bool cmExportCommand::InitialPass(std::vector const& args, } targets.push_back(currentTarget); } - if (this->Append.IsEnabled()) { + if (arguments.Append) { if (cmExportBuildFileGenerator* ebfg = gg->GetExportedTargetsFile(fname)) { ebfg->AppendTargets(targets); @@ -179,15 +173,15 @@ bool cmExportCommand::InitialPass(std::vector const& args, ebfg = new cmExportBuildFileGenerator; } ebfg->SetExportFile(fname.c_str()); - ebfg->SetNamespace(this->Namespace.GetCString()); - ebfg->SetAppendMode(this->Append.IsEnabled()); - if (this->ExportSet) { - ebfg->SetExportSet(this->ExportSet); + ebfg->SetNamespace(arguments.Namespace); + ebfg->SetAppendMode(arguments.Append); + if (ExportSet != nullptr) { + ebfg->SetExportSet(ExportSet); } else { ebfg->SetTargets(targets); } this->Makefile->AddExportBuildFileGenerator(ebfg); - ebfg->SetExportOld(this->ExportOld.IsEnabled()); + ebfg->SetExportOld(arguments.ExportOld); // Compute the set of configurations exported. std::vector configurationTypes; @@ -198,7 +192,7 @@ bool cmExportCommand::InitialPass(std::vector const& args, for (std::string const& ct : configurationTypes) { ebfg->AddConfiguration(ct); } - if (this->ExportSet) { + if (ExportSet != nullptr) { gg->AddBuildExportExportSet(ebfg); } else { gg->AddBuildExportSet(ebfg); diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h index a5c6751..99f9932 100644 --- a/Source/cmExportCommand.h +++ b/Source/cmExportCommand.h @@ -9,21 +9,12 @@ #include #include "cmCommand.h" -#include "cmCommandArgumentsHelper.h" class cmExecutionStatus; -class cmExportSet; -/** \class cmExportLibraryDependenciesCommand - * \brief Add a test to the lists of tests to run. - * - * cmExportLibraryDependenciesCommand adds a test to the list of tests to run - * - */ class cmExportCommand : public cmCommand { public: - cmExportCommand(); /** * This is a virtual constructor for the command. */ @@ -37,21 +28,6 @@ public: cmExecutionStatus& status) override; private: - cmCommandArgumentsHelper Helper; - cmCommandArgumentGroup ArgumentGroup; - cmCAStringVector Targets; - cmCAEnabler Append; - cmCAString ExportSetName; - cmCAString Namespace; - cmCAString Filename; - cmCAEnabler ExportOld; - cmCAString AndroidMKFile; - - cmExportSet* ExportSet; - - friend class cmExportBuildFileGenerator; - std::string ErrorMessage; - bool HandlePackage(std::vector const& args); void StorePackageRegistryWin(std::string const& package, const char* content, const char* hash); diff --git a/Tests/RunCMake/export/AppendExport-stderr.txt b/Tests/RunCMake/export/AppendExport-stderr.txt index d71620e..d12124c 100644 --- a/Tests/RunCMake/export/AppendExport-stderr.txt +++ b/Tests/RunCMake/export/AppendExport-stderr.txt @@ -1,4 +1,4 @@ CMake Error at AppendExport.cmake:[0-9]+ \(export\): - export EXPORT signature does not recognise the APPEND option. + export Unknown argument: "APPEND". Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/export/OldIface-stderr.txt b/Tests/RunCMake/export/OldIface-stderr.txt index 818c2cb..3cc1033 100644 --- a/Tests/RunCMake/export/OldIface-stderr.txt +++ b/Tests/RunCMake/export/OldIface-stderr.txt @@ -1,5 +1,4 @@ CMake Error at OldIface.cmake:[0-9]+ \(export\): - export EXPORT signature does not recognise the - EXPORT_LINK_INTERFACE_LIBRARIES option. + export Unknown argument: "EXPORT_LINK_INTERFACE_LIBRARIES". Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e6b6bb06188ec54a568b54d45930bf38d6547c27 commit e6b6bb06188ec54a568b54d45930bf38d6547c27 Author: Regina Pfeifer AuthorDate: Sat Mar 23 22:45:41 2019 +0100 Commit: Kyle Edwards CommitDate: Thu Apr 4 13:24:39 2019 -0400 cmInstallCommand: Port to cmArgumentParser diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 20d1a31..9736b41 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmInstallCommand.h" +#include "cm_static_string_view.hxx" #include "cmsys/Glob.hxx" #include #include @@ -9,7 +10,7 @@ #include #include "cmAlgorithms.h" -#include "cmCommandArgumentsHelper.h" +#include "cmArgumentParser.h" #include "cmExportSet.h" #include "cmExportSetMap.h" #include "cmGeneratorExpression.h" @@ -219,49 +220,51 @@ bool cmInstallCommand::HandleScriptMode(std::vector const& args) return true; } -/*struct InstallPart -{ - InstallPart(cmCommandArgumentsHelper* helper, const char* key, - cmCommandArgumentGroup* group); - cmCAStringVector argVector; - cmInstallCommandArguments args; -};*/ - bool cmInstallCommand::HandleTargetsMode(std::vector const& args) { // This is the TARGETS mode. std::vector targets; - cmCommandArgumentsHelper argHelper; - cmCommandArgumentGroup group; - cmCAStringVector genericArgVector(&argHelper, nullptr); - cmCAStringVector archiveArgVector(&argHelper, "ARCHIVE", &group); - cmCAStringVector libraryArgVector(&argHelper, "LIBRARY", &group); - cmCAStringVector runtimeArgVector(&argHelper, "RUNTIME", &group); - cmCAStringVector objectArgVector(&argHelper, "OBJECTS", &group); - cmCAStringVector frameworkArgVector(&argHelper, "FRAMEWORK", &group); - cmCAStringVector bundleArgVector(&argHelper, "BUNDLE", &group); - cmCAStringVector includesArgVector(&argHelper, "INCLUDES", &group); - cmCAStringVector privateHeaderArgVector(&argHelper, "PRIVATE_HEADER", - &group); - cmCAStringVector publicHeaderArgVector(&argHelper, "PUBLIC_HEADER", &group); - cmCAStringVector resourceArgVector(&argHelper, "RESOURCE", &group); - genericArgVector.Follows(nullptr); - group.Follows(&genericArgVector); - - argHelper.Parse(&args, nullptr); + struct ArgVectors + { + std::vector Archive; + std::vector Library; + std::vector Runtime; + std::vector Object; + std::vector Framework; + std::vector Bundle; + std::vector Includes; + std::vector PrivateHeader; + std::vector PublicHeader; + std::vector Resource; + }; + + static auto const argHelper = + cmArgumentParser{} + .Bind("ARCHIVE"_s, &ArgVectors::Archive) + .Bind("LIBRARY"_s, &ArgVectors::Library) + .Bind("RUNTIME"_s, &ArgVectors::Runtime) + .Bind("OBJECTS"_s, &ArgVectors::Object) + .Bind("FRAMEWORK"_s, &ArgVectors::Framework) + .Bind("BUNDLE"_s, &ArgVectors::Bundle) + .Bind("INCLUDES"_s, &ArgVectors::Includes) + .Bind("PRIVATE_HEADER"_s, &ArgVectors::PrivateHeader) + .Bind("PUBLIC_HEADER"_s, &ArgVectors::PublicHeader) + .Bind("RESOURCE"_s, &ArgVectors::Resource); + + std::vector genericArgVector; + ArgVectors const argVectors = argHelper.Parse(args, &genericArgVector); // now parse the generic args (i.e. the ones not specialized on LIBRARY/ // ARCHIVE, RUNTIME etc. (see above) // These generic args also contain the targets and the export stuff + std::vector targetList; + std::string exports; std::vector unknownArgs; cmInstallCommandArguments genericArgs(this->DefaultComponentName); - cmCAStringVector targetList(&genericArgs.Parser, "TARGETS"); - cmCAString exports(&genericArgs.Parser, "EXPORT", - &genericArgs.ArgumentGroup); - targetList.Follows(nullptr); - genericArgs.ArgumentGroup.Follows(&targetList); - genericArgs.Parse(&genericArgVector.GetVector(), &unknownArgs); + genericArgs.Bind("TARGETS"_s, targetList); + genericArgs.Bind("EXPORT"_s, exports); + genericArgs.Parse(genericArgVector, &unknownArgs); bool success = genericArgs.Finalize(); cmInstallCommandArguments archiveArgs(this->DefaultComponentName); @@ -277,16 +280,16 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) // now parse the args for specific parts of the target (e.g. LIBRARY, // RUNTIME, ARCHIVE etc. - archiveArgs.Parse(&archiveArgVector.GetVector(), &unknownArgs); - libraryArgs.Parse(&libraryArgVector.GetVector(), &unknownArgs); - runtimeArgs.Parse(&runtimeArgVector.GetVector(), &unknownArgs); - objectArgs.Parse(&objectArgVector.GetVector(), &unknownArgs); - frameworkArgs.Parse(&frameworkArgVector.GetVector(), &unknownArgs); - bundleArgs.Parse(&bundleArgVector.GetVector(), &unknownArgs); - privateHeaderArgs.Parse(&privateHeaderArgVector.GetVector(), &unknownArgs); - publicHeaderArgs.Parse(&publicHeaderArgVector.GetVector(), &unknownArgs); - resourceArgs.Parse(&resourceArgVector.GetVector(), &unknownArgs); - includesArgs.Parse(&includesArgVector.GetVector(), &unknownArgs); + archiveArgs.Parse(argVectors.Archive, &unknownArgs); + libraryArgs.Parse(argVectors.Library, &unknownArgs); + runtimeArgs.Parse(argVectors.Runtime, &unknownArgs); + objectArgs.Parse(argVectors.Object, &unknownArgs); + frameworkArgs.Parse(argVectors.Framework, &unknownArgs); + bundleArgs.Parse(argVectors.Bundle, &unknownArgs); + privateHeaderArgs.Parse(argVectors.PrivateHeader, &unknownArgs); + publicHeaderArgs.Parse(argVectors.PublicHeader, &unknownArgs); + resourceArgs.Parse(argVectors.Resource, &unknownArgs); + includesArgs.Parse(&argVectors.Includes, &unknownArgs); if (!unknownArgs.empty()) { // Unknown argument. @@ -382,7 +385,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) } // Check if there is something to do. - if (targetList.GetVector().empty()) { + if (targetList.empty()) { return true; } @@ -390,7 +393,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) bool dll_platform = !this->Makefile->GetSafeDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX").empty(); - for (std::string const& tgt : targetList.GetVector()) { + for (std::string const& tgt : targetList) { if (this->Makefile->IsAlias(tgt)) { std::ostringstream e; @@ -748,7 +751,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) // Add this install rule to an export if one was specified and // this is not a namelink-only rule. - if (!exports.GetString().empty() && !namelinkOnly) { + if (!exports.empty() && !namelinkOnly) { cmTargetExport* te = new cmTargetExport; te->TargetName = target.GetName(); te->ArchiveGenerator = archiveGenerator; @@ -759,7 +762,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) te->RuntimeGenerator = runtimeGenerator; te->ObjectsGenerator = objectGenerator; this->Makefile->GetGlobalGenerator() - ->GetExportSets()[exports.GetString()] + ->GetExportSets()[exports] ->AddTargetExport(te); te->InterfaceIncludeDirectories = @@ -818,11 +821,10 @@ bool cmInstallCommand::HandleFilesMode(std::vector const& args) // This is the FILES mode. bool programs = (args[0] == "PROGRAMS"); cmInstallCommandArguments ica(this->DefaultComponentName); - cmCAStringVector files(&ica.Parser, programs ? "PROGRAMS" : "FILES"); - files.Follows(nullptr); - ica.ArgumentGroup.Follows(&files); + std::vector files; + ica.Bind(programs ? "PROGRAMS"_s : "FILES"_s, files); std::vector unknownArgs; - ica.Parse(&args, &unknownArgs); + ica.Parse(args, &unknownArgs); if (!unknownArgs.empty()) { // Unknown argument. @@ -840,7 +842,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector const& args) return false; } - const std::vector& filesVector = files.GetVector(); + const std::vector& filesVector = files; // Check if there is something to do. if (filesVector.empty()) { @@ -1271,16 +1273,19 @@ bool cmInstallCommand::HandleExportAndroidMKMode( #ifdef CMAKE_BUILD_WITH_CMAKE // This is the EXPORT mode. cmInstallCommandArguments ica(this->DefaultComponentName); - cmCAString exp(&ica.Parser, "EXPORT_ANDROID_MK"); - cmCAString name_space(&ica.Parser, "NAMESPACE", &ica.ArgumentGroup); - cmCAEnabler exportOld(&ica.Parser, "EXPORT_LINK_INTERFACE_LIBRARIES", - &ica.ArgumentGroup); - cmCAString filename(&ica.Parser, "FILE", &ica.ArgumentGroup); - exp.Follows(nullptr); - - ica.ArgumentGroup.Follows(&exp); + + std::string exp; + std::string name_space; + bool exportOld = false; + std::string filename; + + ica.Bind("EXPORT_ANDROID_MK"_s, exp); + ica.Bind("NAMESPACE"_s, name_space); + ica.Bind("EXPORT_LINK_INTERFACE_LIBRARIES"_s, exportOld); + ica.Bind("FILE"_s, filename); + std::vector unknownArgs; - ica.Parse(&args, &unknownArgs); + ica.Parse(args, &unknownArgs); if (!unknownArgs.empty()) { // Unknown argument. @@ -1304,7 +1309,7 @@ bool cmInstallCommand::HandleExportAndroidMKMode( } // Check the file name. - std::string fname = filename.GetString(); + std::string fname = filename; if (fname.find_first_of(":/\\") != std::string::npos) { std::ostringstream e; e << args[0] << " given invalid export file name \"" << fname << "\". " @@ -1325,7 +1330,7 @@ bool cmInstallCommand::HandleExportAndroidMKMode( } if (fname.find_first_of(":/\\") != std::string::npos) { std::ostringstream e; - e << args[0] << " given export name \"" << exp.GetString() << "\". " + e << args[0] << " given export name \"" << exp << "\". " << "This name cannot be safely converted to a file name. " << "Specify a different export name or use the FILE option to set " << "a file name explicitly."; @@ -1338,7 +1343,7 @@ bool cmInstallCommand::HandleExportAndroidMKMode( } cmExportSet* exportSet = - this->Makefile->GetGlobalGenerator()->GetExportSets()[exp.GetString()]; + this->Makefile->GetGlobalGenerator()->GetExportSets()[exp]; cmInstallGenerator::MessageLevel message = cmInstallGenerator::SelectMessageLevel(this->Makefile); @@ -1347,8 +1352,8 @@ bool cmInstallCommand::HandleExportAndroidMKMode( cmInstallExportGenerator* exportGenerator = new cmInstallExportGenerator( exportSet, ica.GetDestination().c_str(), ica.GetPermissions().c_str(), ica.GetConfigurations(), ica.GetComponent().c_str(), message, - ica.GetExcludeFromAll(), fname.c_str(), name_space.GetCString(), - exportOld.IsEnabled(), true); + ica.GetExcludeFromAll(), fname.c_str(), name_space.c_str(), exportOld, + true); this->Makefile->AddInstallGenerator(exportGenerator); return true; @@ -1363,16 +1368,19 @@ bool cmInstallCommand::HandleExportMode(std::vector const& args) { // This is the EXPORT mode. cmInstallCommandArguments ica(this->DefaultComponentName); - cmCAString exp(&ica.Parser, "EXPORT"); - cmCAString name_space(&ica.Parser, "NAMESPACE", &ica.ArgumentGroup); - cmCAEnabler exportOld(&ica.Parser, "EXPORT_LINK_INTERFACE_LIBRARIES", - &ica.ArgumentGroup); - cmCAString filename(&ica.Parser, "FILE", &ica.ArgumentGroup); - exp.Follows(nullptr); - - ica.ArgumentGroup.Follows(&exp); + + std::string exp; + std::string name_space; + bool exportOld = false; + std::string filename; + + ica.Bind("EXPORT"_s, exp); + ica.Bind("NAMESPACE"_s, name_space); + ica.Bind("EXPORT_LINK_INTERFACE_LIBRARIES"_s, exportOld); + ica.Bind("FILE"_s, filename); + std::vector unknownArgs; - ica.Parse(&args, &unknownArgs); + ica.Parse(args, &unknownArgs); if (!unknownArgs.empty()) { // Unknown argument. @@ -1396,7 +1404,7 @@ bool cmInstallCommand::HandleExportMode(std::vector const& args) } // Check the file name. - std::string fname = filename.GetString(); + std::string fname = filename; if (fname.find_first_of(":/\\") != std::string::npos) { std::ostringstream e; e << args[0] << " given invalid export file name \"" << fname << "\". " @@ -1418,12 +1426,12 @@ bool cmInstallCommand::HandleExportMode(std::vector const& args) // Construct the file name. if (fname.empty()) { - fname = exp.GetString(); + fname = exp; fname += ".cmake"; if (fname.find_first_of(":/\\") != std::string::npos) { std::ostringstream e; - e << args[0] << " given export name \"" << exp.GetString() << "\". " + e << args[0] << " given export name \"" << exp << "\". " << "This name cannot be safely converted to a file name. " << "Specify a different export name or use the FILE option to set " << "a file name explicitly."; @@ -1433,8 +1441,8 @@ bool cmInstallCommand::HandleExportMode(std::vector const& args) } cmExportSet* exportSet = - this->Makefile->GetGlobalGenerator()->GetExportSets()[exp.GetString()]; - if (exportOld.IsEnabled()) { + this->Makefile->GetGlobalGenerator()->GetExportSets()[exp]; + if (exportOld) { for (cmTargetExport* te : *exportSet->GetTargetExports()) { cmTarget* tgt = this->Makefile->GetGlobalGenerator()->FindTarget(te->TargetName); @@ -1461,8 +1469,8 @@ bool cmInstallCommand::HandleExportMode(std::vector const& args) cmInstallExportGenerator* exportGenerator = new cmInstallExportGenerator( exportSet, ica.GetDestination().c_str(), ica.GetPermissions().c_str(), ica.GetConfigurations(), ica.GetComponent().c_str(), message, - ica.GetExcludeFromAll(), fname.c_str(), name_space.GetCString(), - exportOld.IsEnabled(), false); + ica.GetExcludeFromAll(), fname.c_str(), name_space.c_str(), exportOld, + false); this->Makefile->AddInstallGenerator(exportGenerator); return true; diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx index c64bd8a..8b33782 100644 --- a/Source/cmInstallCommandArguments.cxx +++ b/Source/cmInstallCommandArguments.cxx @@ -4,6 +4,7 @@ #include "cmRange.h" #include "cmSystemTools.h" +#include "cm_static_string_view.hxx" #include @@ -18,20 +19,19 @@ const std::string cmInstallCommandArguments::EmptyString; cmInstallCommandArguments::cmInstallCommandArguments( std::string defaultComponent) - : Destination(&Parser, "DESTINATION", &ArgumentGroup) - , Component(&Parser, "COMPONENT", &ArgumentGroup) - , NamelinkComponent(&Parser, "NAMELINK_COMPONENT", &ArgumentGroup) - , ExcludeFromAll(&Parser, "EXCLUDE_FROM_ALL", &ArgumentGroup) - , Rename(&Parser, "RENAME", &ArgumentGroup) - , Permissions(&Parser, "PERMISSIONS", &ArgumentGroup) - , Configurations(&Parser, "CONFIGURATIONS", &ArgumentGroup) - , Optional(&Parser, "OPTIONAL", &ArgumentGroup) - , NamelinkOnly(&Parser, "NAMELINK_ONLY", &ArgumentGroup) - , NamelinkSkip(&Parser, "NAMELINK_SKIP", &ArgumentGroup) - , Type(&Parser, "TYPE", &ArgumentGroup) - , GenericArguments(nullptr) - , DefaultComponentName(std::move(defaultComponent)) + : DefaultComponentName(std::move(defaultComponent)) { + this->Bind("DESTINATION"_s, this->Destination); + this->Bind("COMPONENT"_s, this->Component); + this->Bind("NAMELINK_COMPONENT"_s, this->NamelinkComponent); + this->Bind("EXCLUDE_FROM_ALL"_s, this->ExcludeFromAll); + this->Bind("RENAME"_s, this->Rename); + this->Bind("PERMISSIONS"_s, this->Permissions); + this->Bind("CONFIGURATIONS"_s, this->Configurations); + this->Bind("OPTIONAL"_s, this->Optional); + this->Bind("NAMELINK_ONLY"_s, this->NamelinkOnly); + this->Bind("NAMELINK_SKIP"_s, this->NamelinkSkip); + this->Bind("TYPE"_s, this->Type); } const std::string& cmInstallCommandArguments::GetDestination() const @@ -47,8 +47,8 @@ const std::string& cmInstallCommandArguments::GetDestination() const const std::string& cmInstallCommandArguments::GetComponent() const { - if (!this->Component.GetString().empty()) { - return this->Component.GetString(); + if (!this->Component.empty()) { + return this->Component; } if (this->GenericArguments != nullptr) { return this->GenericArguments->GetComponent(); @@ -62,16 +62,16 @@ const std::string& cmInstallCommandArguments::GetComponent() const const std::string& cmInstallCommandArguments::GetNamelinkComponent() const { - if (!this->NamelinkComponent.GetString().empty()) { - return this->NamelinkComponent.GetString(); + if (!this->NamelinkComponent.empty()) { + return this->NamelinkComponent; } return this->GetComponent(); } const std::string& cmInstallCommandArguments::GetRename() const { - if (!this->Rename.GetString().empty()) { - return this->Rename.GetString(); + if (!this->Rename.empty()) { + return this->Rename; } if (this->GenericArguments != nullptr) { return this->GenericArguments->GetRename(); @@ -92,7 +92,7 @@ const std::string& cmInstallCommandArguments::GetPermissions() const bool cmInstallCommandArguments::GetOptional() const { - if (this->Optional.IsEnabled()) { + if (this->Optional) { return true; } if (this->GenericArguments != nullptr) { @@ -103,7 +103,7 @@ bool cmInstallCommandArguments::GetOptional() const bool cmInstallCommandArguments::GetExcludeFromAll() const { - if (this->ExcludeFromAll.IsEnabled()) { + if (this->ExcludeFromAll) { return true; } if (this->GenericArguments != nullptr) { @@ -114,7 +114,7 @@ bool cmInstallCommandArguments::GetExcludeFromAll() const bool cmInstallCommandArguments::GetNamelinkOnly() const { - if (this->NamelinkOnly.IsEnabled()) { + if (this->NamelinkOnly) { return true; } if (this->GenericArguments != nullptr) { @@ -125,7 +125,7 @@ bool cmInstallCommandArguments::GetNamelinkOnly() const bool cmInstallCommandArguments::GetNamelinkSkip() const { - if (this->NamelinkSkip.IsEnabled()) { + if (this->NamelinkSkip) { return true; } if (this->GenericArguments != nullptr) { @@ -136,7 +136,7 @@ bool cmInstallCommandArguments::GetNamelinkSkip() const bool cmInstallCommandArguments::HasNamelinkComponent() const { - if (!this->NamelinkComponent.GetString().empty()) { + if (!this->NamelinkComponent.empty()) { return true; } if (this->GenericArguments != nullptr) { @@ -147,19 +147,19 @@ bool cmInstallCommandArguments::HasNamelinkComponent() const const std::string& cmInstallCommandArguments::GetType() const { - return this->Type.GetString(); + return this->Type; } const std::vector& cmInstallCommandArguments::GetConfigurations() const { - if (!this->Configurations.GetVector().empty()) { - return this->Configurations.GetVector(); + if (!this->Configurations.empty()) { + return this->Configurations; } if (this->GenericArguments != nullptr) { return this->GenericArguments->GetConfigurations(); } - return this->Configurations.GetVector(); + return this->Configurations; } bool cmInstallCommandArguments::Finalize() @@ -167,21 +167,15 @@ bool cmInstallCommandArguments::Finalize() if (!this->CheckPermissions()) { return false; } - this->DestinationString = this->Destination.GetString(); + this->DestinationString = this->Destination; cmSystemTools::ConvertToUnixSlashes(this->DestinationString); return true; } -void cmInstallCommandArguments::Parse(const std::vector* args, - std::vector* unconsumedArgs) -{ - this->Parser.Parse(args, unconsumedArgs); -} - bool cmInstallCommandArguments::CheckPermissions() { this->PermissionsString.clear(); - for (std::string const& perm : this->Permissions.GetVector()) { + for (std::string const& perm : this->Permissions) { if (!cmInstallCommandArguments::CheckPermissions( perm, this->PermissionsString)) { return false; diff --git a/Source/cmInstallCommandArguments.h b/Source/cmInstallCommandArguments.h index 9c0d417..5d2ee0a 100644 --- a/Source/cmInstallCommandArguments.h +++ b/Source/cmInstallCommandArguments.h @@ -8,9 +8,9 @@ #include #include -#include "cmCommandArgumentsHelper.h" +#include "cmArgumentParser.h" -class cmInstallCommandArguments +class cmInstallCommandArguments : public cmArgumentParser { public: cmInstallCommandArguments(std::string defaultComponent); @@ -18,8 +18,6 @@ public: { this->GenericArguments = args; } - void Parse(const std::vector* args, - std::vector* unconsumedArgs); // Compute destination path.and check permissions bool Finalize(); @@ -37,30 +35,25 @@ public: bool HasNamelinkComponent() const; const std::string& GetType() const; - // once HandleDirectoryMode() is also switched to using - // cmInstallCommandArguments then these two functions can become non-static - // private member functions without arguments static bool CheckPermissions(const std::string& onePerm, std::string& perm); - cmCommandArgumentsHelper Parser; - cmCommandArgumentGroup ArgumentGroup; private: - cmCAString Destination; - cmCAString Component; - cmCAString NamelinkComponent; - cmCAEnabler ExcludeFromAll; - cmCAString Rename; - cmCAStringVector Permissions; - cmCAStringVector Configurations; - cmCAEnabler Optional; - cmCAEnabler NamelinkOnly; - cmCAEnabler NamelinkSkip; - cmCAString Type; + std::string Destination; + std::string Component; + std::string NamelinkComponent; + bool ExcludeFromAll = false; + std::string Rename; + std::vector Permissions; + std::vector Configurations; + bool Optional = false; + bool NamelinkOnly = false; + bool NamelinkSkip = false; + std::string Type; std::string DestinationString; std::string PermissionsString; - cmInstallCommandArguments* GenericArguments; + cmInstallCommandArguments* GenericArguments = nullptr; static const char* PermissionsTable[]; static const std::string EmptyString; std::string DefaultComponentName; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4336a29edd5fd3a70db83103df8f36c5d8bebc59 commit 4336a29edd5fd3a70db83103df8f36c5d8bebc59 Author: Regina Pfeifer AuthorDate: Sat Mar 23 22:45:41 2019 +0100 Commit: Kyle Edwards CommitDate: Thu Apr 4 13:24:39 2019 -0400 cmFileCommand: Port to cmArgumentParser diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index d2bc851..f5ec9fe 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -3,6 +3,7 @@ #include "cmFileCommand.h" #include "cm_kwiml.h" +#include "cm_static_string_view.hxx" #include "cmsys/FStream.hxx" #include "cmsys/Glob.hxx" #include "cmsys/RegularExpression.hxx" @@ -19,7 +20,7 @@ #include #include "cmAlgorithms.h" -#include "cmCommandArgumentsHelper.h" +#include "cmArgumentParser.h" #include "cmCryptoHash.h" #include "cmFileCopier.h" #include "cmFileInstaller.h" @@ -268,36 +269,34 @@ bool cmFileCommand::HandleReadCommand(std::vector const& args) return false; } - cmCommandArgumentsHelper argHelper; - cmCommandArgumentGroup group; + std::string const& fileNameArg = args[1]; + std::string const& variable = args[2]; - cmCAString readArg(&argHelper, "READ"); - cmCAString fileNameArg(&argHelper, nullptr); - cmCAString resultArg(&argHelper, nullptr); + struct Arguments + { + std::string Offset; + std::string Limit; + bool Hex = false; + }; + + static auto const parser = cmArgumentParser{} + .Bind("OFFSET"_s, &Arguments::Offset) + .Bind("LIMIT"_s, &Arguments::Limit) + .Bind("HEX"_s, &Arguments::Hex); - cmCAString offsetArg(&argHelper, "OFFSET", &group); - cmCAString limitArg(&argHelper, "LIMIT", &group); - cmCAEnabler hexOutputArg(&argHelper, "HEX", &group); - readArg.Follows(nullptr); - fileNameArg.Follows(&readArg); - resultArg.Follows(&fileNameArg); - group.Follows(&resultArg); - argHelper.Parse(&args, nullptr); + Arguments const arguments = parser.Parse(cmMakeRange(args).advance(3)); - std::string fileName = fileNameArg.GetString(); + std::string fileName = fileNameArg; if (!cmsys::SystemTools::FileIsFullPath(fileName)) { fileName = this->Makefile->GetCurrentSourceDirectory(); - fileName += "/" + fileNameArg.GetString(); + fileName += "/" + fileNameArg; } - std::string variable = resultArg.GetString(); - // Open the specified file. #if defined(_WIN32) || defined(__CYGWIN__) - cmsys::ifstream file( - fileName.c_str(), - std::ios::in | - (hexOutputArg.IsEnabled() ? std::ios::binary : std::ios::in)); + cmsys::ifstream file(fileName.c_str(), + arguments.Hex ? (std::ios::binary | std::ios::in) + : std::ios::in); #else cmsys::ifstream file(fileName.c_str()); #endif @@ -313,21 +312,21 @@ bool cmFileCommand::HandleReadCommand(std::vector const& args) // is there a limit? long sizeLimit = -1; - if (!limitArg.GetString().empty()) { - sizeLimit = atoi(limitArg.GetCString()); + if (!arguments.Limit.empty()) { + sizeLimit = atoi(arguments.Limit.c_str()); } // is there an offset? long offset = 0; - if (!offsetArg.GetString().empty()) { - offset = atoi(offsetArg.GetCString()); + if (!arguments.Offset.empty()) { + offset = atoi(arguments.Offset.c_str()); } file.seekg(offset, std::ios::beg); // explicit ios::beg for IBM VisualAge 6 std::string output; - if (hexOutputArg.IsEnabled()) { + if (arguments.Hex) { // Convert part of the file into hex code char c; while ((sizeLimit != 0) && (file.get(c))) { @@ -1272,55 +1271,54 @@ bool cmFileCommand::HandleReadElfCommand(std::vector const& args) return false; } - cmCommandArgumentsHelper argHelper; - cmCommandArgumentGroup group; - - cmCAString readArg(&argHelper, "READ_ELF"); - cmCAString fileNameArg(&argHelper, nullptr); + std::string const& fileNameArg = args[1]; - cmCAString rpathArg(&argHelper, "RPATH", &group); - cmCAString runpathArg(&argHelper, "RUNPATH", &group); - cmCAString errorArg(&argHelper, "CAPTURE_ERROR", &group); + struct Arguments + { + std::string RPath; + std::string RunPath; + std::string Error; + }; - readArg.Follows(nullptr); - fileNameArg.Follows(&readArg); - group.Follows(&fileNameArg); - argHelper.Parse(&args, nullptr); + static auto const parser = cmArgumentParser{} + .Bind("RPATH"_s, &Arguments::RPath) + .Bind("RUNPATH"_s, &Arguments::RunPath) + .Bind("CAPTURE_ERROR"_s, &Arguments::Error); + Arguments const arguments = parser.Parse(cmMakeRange(args).advance(2)); - if (!cmSystemTools::FileExists(fileNameArg.GetString(), true)) { + if (!cmSystemTools::FileExists(fileNameArg, true)) { std::ostringstream e; - e << "READ_ELF given FILE \"" << fileNameArg.GetString() - << "\" that does not exist."; + e << "READ_ELF given FILE \"" << fileNameArg << "\" that does not exist."; this->SetError(e.str()); return false; } #if defined(CMAKE_USE_ELF_PARSER) - cmELF elf(fileNameArg.GetCString()); + cmELF elf(fileNameArg.c_str()); - if (!rpathArg.GetString().empty()) { + if (!arguments.RPath.empty()) { if (cmELF::StringEntry const* se_rpath = elf.GetRPath()) { std::string rpath(se_rpath->Value); std::replace(rpath.begin(), rpath.end(), ':', ';'); - this->Makefile->AddDefinition(rpathArg.GetString(), rpath.c_str()); + this->Makefile->AddDefinition(arguments.RPath, rpath.c_str()); } } - if (!runpathArg.GetString().empty()) { + if (!arguments.RunPath.empty()) { if (cmELF::StringEntry const* se_runpath = elf.GetRunPath()) { std::string runpath(se_runpath->Value); std::replace(runpath.begin(), runpath.end(), ':', ';'); - this->Makefile->AddDefinition(runpathArg.GetString(), runpath.c_str()); + this->Makefile->AddDefinition(arguments.RunPath, runpath.c_str()); } } return true; #else std::string error = "ELF parser not available on this platform."; - if (errorArg.GetString().empty()) { + if (arguments.Error.empty()) { this->SetError(error); return false; } - this->Makefile->AddDefinition(errorArg.GetString(), error.c_str()); + this->Makefile->AddDefinition(arguments.Error, error.c_str()); return true; #endif } @@ -2597,44 +2595,39 @@ bool cmFileCommand::HandleCreateLinkCommand( return false; } - cmCommandArgumentsHelper argHelper; - cmCommandArgumentGroup group; - - cmCAString linkArg(&argHelper, "CREATE_LINK"); - cmCAString fileArg(&argHelper, nullptr); - cmCAString newFileArg(&argHelper, nullptr); + std::string const& fileName = args[1]; + std::string const& newFileName = args[2]; - cmCAString resultArg(&argHelper, "RESULT", &group); - cmCAEnabler copyOnErrorArg(&argHelper, "COPY_ON_ERROR", &group); - cmCAEnabler symbolicArg(&argHelper, "SYMBOLIC", &group); + struct Arguments + { + std::string Result; + bool CopyOnError = false; + bool Symbolic = false; + }; - linkArg.Follows(nullptr); - fileArg.Follows(&linkArg); - newFileArg.Follows(&fileArg); - group.Follows(&newFileArg); + static auto const parser = + cmArgumentParser{} + .Bind("RESULT"_s, &Arguments::Result) + .Bind("COPY_ON_ERROR"_s, &Arguments::CopyOnError) + .Bind("SYMBOLIC"_s, &Arguments::Symbolic); std::vector unconsumedArgs; - argHelper.Parse(&args, &unconsumedArgs); + Arguments const arguments = + parser.Parse(cmMakeRange(args).advance(3), &unconsumedArgs); if (!unconsumedArgs.empty()) { this->SetError("unknown argument: \"" + unconsumedArgs.front() + '\"'); return false; } - std::string fileName = fileArg.GetString(); - std::string newFileName = newFileArg.GetString(); - - // Output variable for storing the result. - const std::string& resultVar = resultArg.GetString(); - // The system error message generated in the operation. std::string result; // Check if the paths are distinct. if (fileName == newFileName) { result = "CREATE_LINK cannot use same file and newfile"; - if (!resultVar.empty()) { - this->Makefile->AddDefinition(resultVar, result.c_str()); + if (!arguments.Result.empty()) { + this->Makefile->AddDefinition(arguments.Result, result.c_str()); return true; } this->SetError(result); @@ -2642,10 +2635,10 @@ bool cmFileCommand::HandleCreateLinkCommand( } // Hard link requires original file to exist. - if (!symbolicArg.IsEnabled() && !cmSystemTools::FileExists(fileName)) { + if (!arguments.Symbolic && !cmSystemTools::FileExists(fileName)) { result = "Cannot hard link \'" + fileName + "\' as it does not exist."; - if (!resultVar.empty()) { - this->Makefile->AddDefinition(resultVar, result.c_str()); + if (!arguments.Result.empty()) { + this->Makefile->AddDefinition(arguments.Result, result.c_str()); return true; } this->SetError(result); @@ -2661,8 +2654,8 @@ bool cmFileCommand::HandleCreateLinkCommand( << "' because existing path cannot be removed: " << cmSystemTools::GetLastSystemError() << "\n"; - if (!resultVar.empty()) { - this->Makefile->AddDefinition(resultVar, e.str().c_str()); + if (!arguments.Result.empty()) { + this->Makefile->AddDefinition(arguments.Result, e.str().c_str()); return true; } this->SetError(e.str()); @@ -2673,14 +2666,14 @@ bool cmFileCommand::HandleCreateLinkCommand( bool completed = false; // Check if the command requires a symbolic link. - if (symbolicArg.IsEnabled()) { + if (arguments.Symbolic) { completed = cmSystemTools::CreateSymlink(fileName, newFileName, &result); } else { completed = cmSystemTools::CreateLink(fileName, newFileName, &result); } // Check if copy-on-error is enabled in the arguments. - if (!completed && copyOnErrorArg.IsEnabled()) { + if (!completed && arguments.CopyOnError) { completed = cmsys::SystemTools::CopyFileAlways(fileName, newFileName); if (!completed) { result = "Copy failed: " + cmSystemTools::GetLastSystemError(); @@ -2690,14 +2683,14 @@ bool cmFileCommand::HandleCreateLinkCommand( // Check if the operation was successful. if (completed) { result = "0"; - } else if (resultVar.empty()) { + } else if (arguments.Result.empty()) { // The operation failed and the result is not reported in a variable. this->SetError(result); return false; } - if (!resultVar.empty()) { - this->Makefile->AddDefinition(resultVar, result.c_str()); + if (!arguments.Result.empty()) { + this->Makefile->AddDefinition(arguments.Result, result.c_str()); } return true; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4359fe133b03aac5d0b0c1ed2aa98a49515edf56 commit 4359fe133b03aac5d0b0c1ed2aa98a49515edf56 Author: Regina Pfeifer AuthorDate: Sat Mar 23 22:45:41 2019 +0100 Commit: Kyle Edwards CommitDate: Thu Apr 4 13:24:39 2019 -0400 Introduce cmArgumentParser diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 52f6742..a2836d6 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -143,6 +143,8 @@ set(SRCS cmAffinity.cxx cmAffinity.h cmArchiveWrite.cxx + cmArgumentParser.cxx + cmArgumentParser.h cmBase32.cxx cmCacheManager.cxx cmCacheManager.h diff --git a/Source/cmArgumentParser.cxx b/Source/cmArgumentParser.cxx new file mode 100644 index 0000000..9a9932c --- /dev/null +++ b/Source/cmArgumentParser.cxx @@ -0,0 +1,93 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmArgumentParser.h" + +#include +#include + +namespace ArgumentParser { + +auto ActionMap::Emplace(cm::string_view name, Action action) + -> std::pair +{ + auto const it = + std::lower_bound(this->begin(), this->end(), name, + [](value_type const& elem, cm::string_view const& k) { + return elem.first < k; + }); + return (it != this->end() && it->first == name) + ? std::make_pair(it, false) + : std::make_pair(this->emplace(it, name, std::move(action)), true); +} + +auto ActionMap::Find(cm::string_view name) const -> const_iterator +{ + auto const it = + std::lower_bound(this->begin(), this->end(), name, + [](value_type const& elem, cm::string_view const& k) { + return elem.first < k; + }); + return (it != this->end() && it->first == name) ? it : this->end(); +} + +void Instance::Bind(bool& val) +{ + val = true; + this->CurrentString = nullptr; + this->CurrentList = nullptr; + this->ExpectValue = false; +} + +void Instance::Bind(std::string& val) +{ + this->CurrentString = &val; + this->CurrentList = nullptr; + this->ExpectValue = true; +} + +void Instance::Bind(StringList& val) +{ + this->CurrentString = nullptr; + this->CurrentList = &val; + this->ExpectValue = true; +} + +void Instance::Bind(MultiStringList& val) +{ + this->CurrentString = nullptr; + this->CurrentList = (val.emplace_back(), &val.back()); + this->ExpectValue = false; +} + +void Instance::Consume(cm::string_view arg, void* result, + std::vector* unparsedArguments, + std::vector* keywordsMissingValue) +{ + auto const it = this->Bindings.Find(arg); + if (it != this->Bindings.end()) { + it->second(*this, result); + if (this->ExpectValue && keywordsMissingValue != nullptr) { + keywordsMissingValue->emplace_back(arg); + } + return; + } + + if (this->CurrentString != nullptr) { + this->CurrentString->assign(std::string(arg)); + this->CurrentString = nullptr; + this->CurrentList = nullptr; + } else if (this->CurrentList != nullptr) { + this->CurrentList->emplace_back(arg); + } else if (unparsedArguments != nullptr) { + unparsedArguments->emplace_back(arg); + } + + if (this->ExpectValue) { + if (keywordsMissingValue != nullptr) { + keywordsMissingValue->pop_back(); + } + this->ExpectValue = false; + } +} + +} // namespace ArgumentParser diff --git a/Source/cmArgumentParser.h b/Source/cmArgumentParser.h new file mode 100644 index 0000000..6cfe946 --- /dev/null +++ b/Source/cmArgumentParser.h @@ -0,0 +1,143 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cmArgumentParser_h +#define cmArgumentParser_h + +#include "cmConfigure.h" // IWYU pragma: keep + +#include "cm_static_string_view.hxx" +#include "cm_string_view.hxx" + +#include +#include +#include +#include +#include + +namespace ArgumentParser { + +using StringList = std::vector; +using MultiStringList = std::vector; + +class Instance; +using Action = std::function; + +// using ActionMap = cm::flat_map; +class ActionMap : public std::vector> +{ +public: + std::pair Emplace(cm::string_view name, Action action); + const_iterator Find(cm::string_view name) const; +}; + +class Instance +{ +public: + Instance(ActionMap const& bindings) + : Bindings(bindings) + { + } + + void Bind(bool& val); + void Bind(std::string& val); + void Bind(StringList& val); + void Bind(MultiStringList& val); + + void Consume(cm::string_view arg, void* result, + std::vector* unparsedArguments, + std::vector* keywordsMissingValue); + +private: + ActionMap const& Bindings; + std::string* CurrentString = nullptr; + StringList* CurrentList = nullptr; + bool ExpectValue = false; +}; + +} // namespace ArgumentParser + +template +class cmArgumentParser +{ +public: + // I *think* this function could be made `constexpr` when the code is + // compiled as C++20. This would allow building a parser at compile time. + template + cmArgumentParser& Bind(cm::static_string_view name, T Result::*member) + { + bool const inserted = + this->Bindings + .Emplace(name, + [member](ArgumentParser::Instance& instance, void* result) { + instance.Bind(static_cast(result)->*member); + }) + .second; + assert(inserted), (void)inserted; + return *this; + } + + template + void Parse(Result& result, Range const& args, + std::vector* unparsedArguments = nullptr, + std::vector* keywordsMissingValue = nullptr) const + { + ArgumentParser::Instance instance(this->Bindings); + for (cm::string_view arg : args) { + instance.Consume(arg, &result, unparsedArguments, keywordsMissingValue); + } + } + + template + Result Parse(Range const& args, + std::vector* unparsedArguments = nullptr, + std::vector* keywordsMissingValue = nullptr) const + { + Result result; + this->Parse(result, args, unparsedArguments, keywordsMissingValue); + return result; + } + +private: + ArgumentParser::ActionMap Bindings; +}; + +template <> +class cmArgumentParser +{ +public: + template + cmArgumentParser& Bind(cm::static_string_view name, T& ref) + { + bool const inserted = this->Bind(cm::string_view(name), ref); + assert(inserted), (void)inserted; + return *this; + } + + template + void Parse(Range const& args, + std::vector* unparsedArguments = nullptr, + std::vector* keywordsMissingValue = nullptr) const + { + ArgumentParser::Instance instance(this->Bindings); + for (cm::string_view arg : args) { + instance.Consume(arg, nullptr, unparsedArguments, keywordsMissingValue); + } + } + +protected: + template + bool Bind(cm::string_view name, T& ref) + { + return this->Bindings + .Emplace(name, + [&ref](ArgumentParser::Instance& instance, void*) { + instance.Bind(ref); + }) + .second; + } + +private: + ArgumentParser::ActionMap Bindings; +}; + +#endif diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt index 91f7e25..031ab01 100644 --- a/Tests/CMakeLib/CMakeLists.txt +++ b/Tests/CMakeLib/CMakeLists.txt @@ -5,6 +5,7 @@ include_directories( ) set(CMakeLib_TESTS + testArgumentParser.cxx testGeneratedFileStream.cxx testRST.cxx testRange.cxx diff --git a/Tests/CMakeLib/testArgumentParser.cxx b/Tests/CMakeLib/testArgumentParser.cxx new file mode 100644 index 0000000..788fece --- /dev/null +++ b/Tests/CMakeLib/testArgumentParser.cxx @@ -0,0 +1,148 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ + +#include "cmArgumentParser.h" + +#include "cm_static_string_view.hxx" +#include "cm_string_view.hxx" + +#include +#include +#include +#include + +namespace { + +struct Result +{ + bool Option1 = false; + bool Option2 = false; + + std::string String1; + std::string String2; + + std::vector List1; + std::vector List2; + std::vector List3; + + std::vector> Multi1; + std::vector> Multi2; + std::vector> Multi3; +}; + +std::initializer_list const args = { + /* clang-format off */ + "OPTION_1", // option + "STRING_1", // string arg missing value + "STRING_2", "foo", "bar", // string arg + unparsed value + "LIST_1", // list arg missing values + "LIST_2", "foo", "bar", // list arg with 2 elems + "LIST_3", "bar", // list arg ... + "LIST_3", "foo", // ... with continuation + "MULTI_2", // multi list with 0 lists + "MULTI_3", "foo", "bar", // multi list with first list with two elems + "MULTI_3", "bar", "foo", // multi list with second list with two elems + /* clang-format on */ +}; + +bool verifyResult(Result const& result, + std::vector const& unparsedArguments, + std::vector const& keywordsMissingValue) +{ + static std::vector const foobar = { "foo", "bar" }; + static std::vector const barfoo = { "bar", "foo" }; + static std::vector const missing = { "STRING_1", "LIST_1" }; + +#define ASSERT_TRUE(x) \ + do { \ + if (!(x)) { \ + std::cout << "ASSERT_TRUE(" #x ") failed on line " << __LINE__ << "\n"; \ + return false; \ + } \ + } while (false) + + ASSERT_TRUE(result.Option1); + ASSERT_TRUE(!result.Option2); + + ASSERT_TRUE(result.String1.empty()); + ASSERT_TRUE(result.String2 == "foo"); + + ASSERT_TRUE(result.List1.empty()); + ASSERT_TRUE(result.List2 == foobar); + ASSERT_TRUE(result.List3 == barfoo); + + ASSERT_TRUE(result.Multi1.empty()); + ASSERT_TRUE(result.Multi2.size() == 1); + ASSERT_TRUE(result.Multi2[0].empty()); + ASSERT_TRUE(result.Multi3.size() == 2); + ASSERT_TRUE(result.Multi3[0] == foobar); + ASSERT_TRUE(result.Multi3[1] == barfoo); + + ASSERT_TRUE(unparsedArguments.size() == 1); + ASSERT_TRUE(unparsedArguments[0] == "bar"); + ASSERT_TRUE(keywordsMissingValue == missing); + + return true; +} + +bool testArgumentParserDynamic() +{ + Result result; + std::vector unparsedArguments; + std::vector keywordsMissingValue; + + cmArgumentParser{} + .Bind("OPTION_1"_s, result.Option1) + .Bind("OPTION_2"_s, result.Option2) + .Bind("STRING_1"_s, result.String1) + .Bind("STRING_2"_s, result.String2) + .Bind("LIST_1"_s, result.List1) + .Bind("LIST_2"_s, result.List2) + .Bind("LIST_3"_s, result.List3) + .Bind("MULTI_1"_s, result.Multi1) + .Bind("MULTI_2"_s, result.Multi2) + .Bind("MULTI_3"_s, result.Multi3) + .Parse(args, &unparsedArguments, &keywordsMissingValue); + + return verifyResult(result, unparsedArguments, keywordsMissingValue); +} + +bool testArgumentParserStatic() +{ + static auto const parser = // + cmArgumentParser{} + .Bind("OPTION_1"_s, &Result::Option1) + .Bind("OPTION_2"_s, &Result::Option2) + .Bind("STRING_1"_s, &Result::String1) + .Bind("STRING_2"_s, &Result::String2) + .Bind("LIST_1"_s, &Result::List1) + .Bind("LIST_2"_s, &Result::List2) + .Bind("LIST_3"_s, &Result::List3) + .Bind("MULTI_1"_s, &Result::Multi1) + .Bind("MULTI_2"_s, &Result::Multi2) + .Bind("MULTI_3"_s, &Result::Multi3); + + std::vector unparsedArguments; + std::vector keywordsMissingValue; + Result const result = + parser.Parse(args, &unparsedArguments, &keywordsMissingValue); + + return verifyResult(result, unparsedArguments, keywordsMissingValue); +} + +} // namespace + +int testArgumentParser(int /*unused*/, char* /*unused*/ []) +{ + if (!testArgumentParserDynamic()) { + std::cout << "While executing testArgumentParserDynamic().\n"; + return -1; + } + + if (!testArgumentParserStatic()) { + std::cout << "While executing testArgumentParserStatic().\n"; + return -1; + } + + return 0; +} diff --git a/Utilities/IWYU/mapping.imp b/Utilities/IWYU/mapping.imp index 482a08d..0393ff1 100644 --- a/Utilities/IWYU/mapping.imp +++ b/Utilities/IWYU/mapping.imp @@ -68,6 +68,7 @@ { symbol: [ "std::__decay_and_strip::__type", private, "\"cmConfigure.h\"", public ] }, { symbol: [ "std::__decay_and_strip::__type", private, "\"cmConfigure.h\"", public ] }, { symbol: [ "std::__decay_and_strip::__type", private, "\"cmConfigure.h\"", public ] }, + { symbol: [ "std::__decay_and_strip::__type", private, "\"cmConfigure.h\"", public ] }, { symbol: [ "std::__decay_and_strip &>::__type", private, "\"cmConfigure.h\"", public ] }, { symbol: [ "std::__decay_and_strip &>::__type", private, "\"cmConfigure.h\"", public ] }, { symbol: [ "std::__decay_and_strip::__type", private, "\"cmConfigure.h\"", public ] }, diff --git a/bootstrap b/bootstrap index 537b43b..addb4f7 100755 --- a/bootstrap +++ b/bootstrap @@ -260,6 +260,7 @@ CMAKE_CXX_SOURCES="\ cmAddLibraryCommand \ cmAddSubDirectoryCommand \ cmAddTestCommand \ + cmArgumentParser \ cmBreakCommand \ cmBuildCommand \ cmCMakeMinimumRequired \ ----------------------------------------------------------------------- Summary of changes: Help/command/export.rst | 2 +- Help/command/find_package.rst | 20 +- Help/command/variable_requires.rst | 2 +- Help/cpack_gen/nsis.rst | 38 +-- Help/envvar/ASM_DIALECT.rst | 5 +- Help/envvar/ASM_DIALECTFLAGS.rst | 10 +- Help/envvar/CTEST_INTERACTIVE_DEBUG_MODE.rst | 2 +- Help/envvar/CTEST_OUTPUT_ON_FAILURE.rst | 2 +- Help/envvar/CTEST_PROGRESS_OUTPUT.rst | 2 +- Help/envvar/DASHBOARD_TEST_FROM_CTEST.rst | 5 +- Help/envvar/PackageName_ROOT.rst | 2 +- Help/manual/LINKS.txt | 2 +- Help/manual/OPTIONS_BUILD.txt | 40 +-- Help/manual/ccmake.1.rst | 2 +- Help/manual/cmake-buildsystem.7.rst | 24 +- Help/manual/cmake-gui.1.rst | 2 +- Help/manual/cmake-packages.7.rst | 2 +- Help/manual/cmake-toolchains.7.rst | 12 +- Help/manual/cmake-variables.7.rst | 2 +- Help/manual/cmake.1.rst | 33 +-- Help/manual/cpack.1.rst | 2 +- Help/manual/ctest.1.rst | 69 ++--- Help/prop_sf/VS_CSHARP_tagname.rst | 5 +- Help/prop_sf/VS_DEPLOYMENT_CONTENT.rst | 3 +- Help/prop_sf/VS_DEPLOYMENT_LOCATION.rst | 3 +- Help/prop_sf/VS_INCLUDE_IN_VSIX.rst | 6 +- Help/prop_sf/VS_SHADER_FLAGS.rst | 2 +- Help/prop_sf/VS_SHADER_TYPE.rst | 2 +- Help/prop_sf/VS_XAML_TYPE.rst | 3 +- Help/prop_sf/WRAP_EXCLUDE.rst | 9 +- Help/release/3.9.rst | 2 +- Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst | 2 +- Help/variable/CMAKE_CUDA_HOST_COMPILER.rst | 2 +- Help/variable/CMAKE_SKIP_INSTALL_RULES.rst | 2 +- Help/variable/CMAKE_SOURCE_DIR.rst | 2 +- Help/variable/CMAKE_STAGING_PREFIX.rst | 10 +- Help/variable/CMAKE_SUPPRESS_REGENERATION.rst | 8 +- Help/variable/CMAKE_SYSROOT.rst | 4 +- ...CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION.rst | 2 +- Help/variable/PackageName_ROOT.rst | 2 +- Modules/BundleUtilities.cmake | 126 +++++----- Modules/ExternalProject.cmake | 19 +- Modules/FindBISON.cmake | 4 +- Modules/FindBLAS.cmake | 14 +- Modules/FindBoost.cmake | 40 +-- Modules/FindCups.cmake | 4 +- Modules/FindFLEX.cmake | 12 +- Modules/FindSWIG.cmake | 6 +- Modules/FindTIFF.cmake | 2 +- Modules/FindUnixCommands.cmake | 5 +- Modules/GenerateExportHeader.cmake | 2 +- Modules/UseQt4.cmake | 5 +- Modules/WriteCompilerDetectionHeader.cmake | 2 +- Source/CMakeLists.txt | 4 +- Source/cmArgumentParser.cxx | 93 +++++++ Source/cmArgumentParser.h | 143 +++++++++++ Source/cmCommandArgumentsHelper.cxx | 233 ----------------- Source/cmCommandArgumentsHelper.h | 194 -------------- Source/cmExecuteProcessCommand.cxx | 280 ++++++++------------- Source/cmExportCommand.cxx | 102 ++++---- Source/cmExportCommand.h | 24 -- Source/cmFileCommand.cxx | 155 ++++++------ Source/cmInstallCommand.cxx | 172 +++++++------ Source/cmInstallCommandArguments.cxx | 66 +++-- Source/cmInstallCommandArguments.h | 35 ++- Source/cmParseArgumentsCommand.cxx | 159 ++++-------- Tests/CMakeLib/CMakeLists.txt | 1 + Tests/CMakeLib/testArgumentParser.cxx | 148 +++++++++++ Tests/RunCMake/export/AppendExport-stderr.txt | 2 +- Tests/RunCMake/export/OldIface-stderr.txt | 3 +- Utilities/IWYU/mapping.imp | 1 + bootstrap | 2 +- 72 files changed, 1104 insertions(+), 1303 deletions(-) create mode 100644 Source/cmArgumentParser.cxx create mode 100644 Source/cmArgumentParser.h delete mode 100644 Source/cmCommandArgumentsHelper.cxx delete mode 100644 Source/cmCommandArgumentsHelper.h create mode 100644 Tests/CMakeLib/testArgumentParser.cxx hooks/post-receive -- CMake From kwrobot at kitware.com Tue Apr 9 18:03:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 9 Apr 2019 18:03:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-666-g0a29875 Message-ID: <20190409220306.64440FBB22@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 0a29875313566c12cbc16391fc23dbe2da8c5c18 (commit) via b8cb63457e0c94cf678c6da9723bff2e912a69de (commit) from a289d7951734d7d107e3d3f780740e4f6f759b05 (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=0a29875313566c12cbc16391fc23dbe2da8c5c18 commit 0a29875313566c12cbc16391fc23dbe2da8c5c18 Merge: a289d79 b8cb634 Author: Craig Scott AuthorDate: Tue Apr 9 21:55:22 2019 +0000 Commit: Kitware Robot CommitDate: Tue Apr 9 17:55:34 2019 -0400 Merge topic 'fix-submit-url' b8cb63457e Modules/CTest: Fix SubmitURL Acked-by: Kitware Robot Merge-request: !3206 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b8cb63457e0c94cf678c6da9723bff2e912a69de commit b8cb63457e0c94cf678c6da9723bff2e912a69de Author: Regina Pfeifer AuthorDate: Mon Apr 8 22:23:11 2019 +0200 Commit: Craig Scott CommitDate: Wed Apr 10 07:43:20 2019 +1000 Modules/CTest: Fix SubmitURL Problem appeared in d6475daa79 (Modules/CTest: Set SubmitURL, 2018-12-08). Fixes: #19099 diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake index d100704..3a111ca 100644 --- a/Modules/CTest.cmake +++ b/Modules/CTest.cmake @@ -118,7 +118,7 @@ if(BUILD_TESTING) endif() string(APPEND SUBMIT_URL "@") endif() - string(APPEND SUBMIT_URL "${DROP_SITE}${DROP_SITE_LOCATION}") + string(APPEND SUBMIT_URL "${DROP_SITE}${DROP_LOCATION}") endif() find_program(CVSCOMMAND cvs ) ----------------------------------------------------------------------- Summary of changes: Modules/CTest.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Apr 9 18:13:03 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 9 Apr 2019 18:13:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-668-g6aef0aa Message-ID: <20190409221303.76074FA828@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 6aef0aa5fe2fa85342f3903f8e9ac0afdc62aa07 (commit) via 127d0ea2a660507c3f629bcf934e6863f60c09db (commit) from 0a29875313566c12cbc16391fc23dbe2da8c5c18 (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=6aef0aa5fe2fa85342f3903f8e9ac0afdc62aa07 commit 6aef0aa5fe2fa85342f3903f8e9ac0afdc62aa07 Merge: 0a29875 127d0ea Author: Craig Scott AuthorDate: Wed Apr 10 07:57:12 2019 +1000 Commit: Craig Scott CommitDate: Wed Apr 10 07:57:12 2019 +1000 Merge branch 'release-3.14' ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Tue Apr 9 18:13:03 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 9 Apr 2019 18:13:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.14.1-13-g127d0ea Message-ID: <20190409221303.9021EFAD24@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 127d0ea2a660507c3f629bcf934e6863f60c09db (commit) via b8cb63457e0c94cf678c6da9723bff2e912a69de (commit) from dff61585f3ed3973b52db9a90493f132d809677c (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/CTest.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Apr 10 00:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 10 Apr 2019 00:03:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-669-g784c35b Message-ID: <20190410040306.014C2FB80D@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 784c35b4445ca4ecf5a6aad859bd3724cdb49ff6 (commit) from 6aef0aa5fe2fa85342f3903f8e9ac0afdc62aa07 (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=784c35b4445ca4ecf5a6aad859bd3724cdb49ff6 commit 784c35b4445ca4ecf5a6aad859bd3724cdb49ff6 Author: Kitware Robot AuthorDate: Wed Apr 10 00:01:10 2019 -0400 Commit: Kitware Robot CommitDate: Wed Apr 10 00:01:10 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4951c02..4571566 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 14) -set(CMake_VERSION_PATCH 20190409) +set(CMake_VERSION_PATCH 20190410) #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 Apr 10 08:53:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 10 Apr 2019 08:53:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-674-g876680e Message-ID: <20190410125306.BA23CE4742@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 876680e94bed75e1e22a78f1e063e545ff6bce69 (commit) via 613ac56e508be666e2b6fcf42a6502055bf0764c (commit) via b0f46c48f6e3efc0481d7c573f67cc76dfa5b2fd (commit) via 646fb1a646a3b860e983f3d030dfd223c761d49f (commit) via 0d641fcfad232a6981f587a8ee077dcf08432843 (commit) from 784c35b4445ca4ecf5a6aad859bd3724cdb49ff6 (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=876680e94bed75e1e22a78f1e063e545ff6bce69 commit 876680e94bed75e1e22a78f1e063e545ff6bce69 Merge: 784c35b 613ac56 Author: Brad King AuthorDate: Wed Apr 10 12:49:11 2019 +0000 Commit: Kitware Robot CommitDate: Wed Apr 10 08:49:21 2019 -0400 Merge topic 'meta-feature_only_infer_granular_support' 613ac56e50 Add a test to verify meta-feature parity with granular features b0f46c48f6 CompileFeatures: Now able to presume full language level support 646fb1a646 CompileFeatures: memoize C++ compilers with full language level support 0d641fcfad Tests: Remove outdated portion of CompileFeatures genex test Acked-by: Kitware Robot Merge-request: !3176 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=613ac56e508be666e2b6fcf42a6502055bf0764c commit 613ac56e508be666e2b6fcf42a6502055bf0764c Author: Robert Maynard AuthorDate: Tue Mar 5 15:25:24 2019 -0500 Commit: Brad King CommitDate: Tue Apr 9 08:44:56 2019 -0400 Add a test to verify meta-feature parity with granular features diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index afa8df7..68411d6 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -192,6 +192,9 @@ add_RunCMake_test(GoogleTest) # Note: does not actually depend on Google Test add_RunCMake_test(TargetPropertyGeneratorExpressions) add_RunCMake_test(Languages) add_RunCMake_test(LinkStatic) +if(CMAKE_CXX_COMPILER_ID MATCHES "^(Cray|PGI|XL|XLClang)$") + add_RunCMake_test(MetaCompileFeatures) +endif() add_RunCMake_test(ObjectLibrary) add_RunCMake_test(ParseImplicitIncludeInfo) if(UNIX AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG AND CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF") diff --git a/Tests/RunCMake/MetaCompileFeatures/C.cmake b/Tests/RunCMake/MetaCompileFeatures/C.cmake new file mode 100644 index 0000000..3bb6181 --- /dev/null +++ b/Tests/RunCMake/MetaCompileFeatures/C.cmake @@ -0,0 +1,27 @@ + +enable_language(C) + +function(check_language_feature_flags lang level) + if(CMAKE_${lang}${level}_STANDARD_COMPILE_OPTION) + #this property is an internal implementation detail of CMake + get_property(known_features GLOBAL PROPERTY CMAKE_${lang}${level}_KNOWN_FEATURES) + list(LENGTH known_features len) + if(len LESS 1) + message(FATAL_ERROR "unable to find known features of ${lang}${level}") + endif() + + string(TOLOWER ${lang} lang_lower) + set(known_name ${lang_lower}${level}_known_features) + set(meta_name ${lang_lower}${level}_meta_feature) + + add_library(${known_name} STATIC a.c) + target_compile_features(${known_name} PUBLIC ${known_features}) + add_library(${meta_name} STATIC a.c) + target_compile_features(${meta_name} PUBLIC ${lang_lower}_std_${level}) + endif() +endfunction() + + +check_language_feature_flags(C 90) +check_language_feature_flags(C 99) +check_language_feature_flags(C 11) diff --git a/Tests/RunCMake/MetaCompileFeatures/CMakeLists.txt b/Tests/RunCMake/MetaCompileFeatures/CMakeLists.txt new file mode 100644 index 0000000..3e470a2 --- /dev/null +++ b/Tests/RunCMake/MetaCompileFeatures/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.14) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/MetaCompileFeatures/CXX.cmake b/Tests/RunCMake/MetaCompileFeatures/CXX.cmake new file mode 100644 index 0000000..ef3b9d4 --- /dev/null +++ b/Tests/RunCMake/MetaCompileFeatures/CXX.cmake @@ -0,0 +1,27 @@ + +enable_language(CXX) + +function(check_language_feature_flags lang level) + if(CMAKE_${lang}${level}_STANDARD_COMPILE_OPTION) + #this property is an internal implementation detail of CMake + get_property(known_features GLOBAL PROPERTY CMAKE_${lang}${level}_KNOWN_FEATURES) + list(LENGTH known_features len) + if(len LESS 1) + message(FATAL_ERROR "unable to find known features of ${lang}${level}") + endif() + + string(TOLOWER ${lang} lang_lower) + set(known_name ${lang_lower}${level}_known_features) + set(meta_name ${lang_lower}${level}_meta_feature) + + add_library(${known_name} STATIC a.cxx) + target_compile_features(${known_name} PUBLIC ${known_features}) + add_library(${meta_name} STATIC a.cxx) + target_compile_features(${meta_name} PUBLIC ${lang_lower}_std_${level}) + endif() +endfunction() + + +check_language_feature_flags(CXX 98) +check_language_feature_flags(CXX 11) +check_language_feature_flags(CXX 14) diff --git a/Tests/RunCMake/MetaCompileFeatures/RunCMakeTest.cmake b/Tests/RunCMake/MetaCompileFeatures/RunCMakeTest.cmake new file mode 100644 index 0000000..009cde4 --- /dev/null +++ b/Tests/RunCMake/MetaCompileFeatures/RunCMakeTest.cmake @@ -0,0 +1,4 @@ +include(RunCMake) + +run_cmake(C) +run_cmake(CXX) diff --git a/Tests/RunCMake/MetaCompileFeatures/a.c b/Tests/RunCMake/MetaCompileFeatures/a.c new file mode 100644 index 0000000..e69de29 diff --git a/Tests/RunCMake/MetaCompileFeatures/a.cxx b/Tests/RunCMake/MetaCompileFeatures/a.cxx new file mode 100644 index 0000000..e69de29 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b0f46c48f6e3efc0481d7c573f67cc76dfa5b2fd commit b0f46c48f6e3efc0481d7c573f67cc76dfa5b2fd Author: Robert Maynard AuthorDate: Wed Mar 6 12:28:00 2019 -0500 Commit: Brad King CommitDate: Tue Apr 9 08:44:56 2019 -0400 CompileFeatures: Now able to presume full language level support Previously compilers that only supported the meta-level flags would not have any of the granular features listed. Now we presume that they have full support and enable all the features. Update granular feature tests to skip the actual compilation checks for the presumed features. diff --git a/Modules/Compiler/Cray-CXX.cmake b/Modules/Compiler/Cray-CXX.cmake index 85a3167..38c8b1e 100644 --- a/Modules/Compiler/Cray-CXX.cmake +++ b/Modules/Compiler/Cray-CXX.cmake @@ -10,13 +10,16 @@ string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG") if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1) set(CMAKE_CXX98_STANDARD_COMPILE_OPTION -h conform) set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -h gnu) + set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.4) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION -h std=c++11) set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION -h std=c++11,gnu) + set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) endif() if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.6) set(CMAKE_CXX14_STANDARD_COMPILE_OPTION -h std=c++14) set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION -h std=c++14,gnu) + set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) endif () endif () diff --git a/Modules/Compiler/PGI-CXX.cmake b/Modules/Compiler/PGI-CXX.cmake index 35076bb..c77de36 100644 --- a/Modules/Compiler/PGI-CXX.cmake +++ b/Modules/Compiler/PGI-CXX.cmake @@ -6,15 +6,19 @@ string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG") if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12.10) set(CMAKE_CXX98_STANDARD_COMPILE_OPTION -A) set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION --gnu_extensions) + set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.10) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION --c++11 -A) set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION --c++11 --gnu_extensions) + set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 15.7) set(CMAKE_CXX14_STANDARD_COMPILE_OPTION --c++14 -A) set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION --c++14 --gnu_extensions) + set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17.1) set(CMAKE_CXX17_STANDARD_COMPILE_OPTION --c++17 -A) set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION --c++17 --gnu_extensions) + set(CMAKE_CXX17_STANDARD__HAS_FULL_SUPPORT ON) endif() endif() endif() diff --git a/Modules/Compiler/XL-CXX.cmake b/Modules/Compiler/XL-CXX.cmake index 0026b4a..ec3f1f8 100644 --- a/Modules/Compiler/XL-CXX.cmake +++ b/Modules/Compiler/XL-CXX.cmake @@ -16,6 +16,8 @@ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) endif() set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x") + set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) endif () __compiler_check_default_language_standard(CXX 10.1 98) diff --git a/Modules/Compiler/XLClang-CXX.cmake b/Modules/Compiler/XLClang-CXX.cmake index f535ebc..03c7c7b 100644 --- a/Modules/Compiler/XLClang-CXX.cmake +++ b/Modules/Compiler/XLClang-CXX.cmake @@ -4,13 +4,16 @@ __compiler_xlclang(CXX) if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1) set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "") + set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x") + set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11") set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y") set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") + set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) endif () endif() diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index 6ccdcc3..2dd8917 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -15,17 +15,21 @@ macro(run_test feature lang) endif() endmacro() -get_property(c_features GLOBAL PROPERTY CMAKE_C_KNOWN_FEATURES) -list(FILTER c_features EXCLUDE REGEX "^c_std_[0-9][0-9]") -foreach(feature ${c_features}) - run_test(${feature} C) -endforeach() +if(NOT CMAKE_C_COMPILER_ID MATCHES "^(Cray|PGI|XL|XLClang)$") + get_property(c_features GLOBAL PROPERTY CMAKE_C_KNOWN_FEATURES) + list(FILTER c_features EXCLUDE REGEX "^c_std_[0-9][0-9]") + foreach(feature ${c_features}) + run_test(${feature} C) + endforeach() +endif() -get_property(cxx_features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES) -list(FILTER cxx_features EXCLUDE REGEX "^cxx_std_[0-9][0-9]") -foreach(feature ${cxx_features}) - run_test(${feature} CXX) -endforeach() +if(NOT CMAKE_CXX_COMPILER_ID MATCHES "^(Cray|PGI|XL|XLClang)$") + get_property(cxx_features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES) + list(FILTER cxx_features EXCLUDE REGEX "^cxx_std_[0-9][0-9]") + foreach(feature ${cxx_features}) + run_test(${feature} CXX) + endforeach() +endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1) diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt index b584e16..cffef5a 100644 --- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt +++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt @@ -52,8 +52,10 @@ endmacro() # detailed features tables, not just meta-features if (CMAKE_C_COMPILE_FEATURES) - set(C_expected_features ${CMAKE_C_COMPILE_FEATURES}) - list(FILTER C_expected_features EXCLUDE REGEX "^c_std_[0-9][0-9]") + if(NOT CMAKE_C_COMPILER_ID MATCHES "^(Cray|PGI|XL|XLClang)$") + set(C_expected_features ${CMAKE_C_COMPILE_FEATURES}) + list(FILTER C_expected_features EXCLUDE REGEX "^c_std_[0-9][0-9]") + endif() endif() if (C_expected_features) string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" COMPILER_VERSION_MAJOR "${CMAKE_C_COMPILER_VERSION}") @@ -93,8 +95,10 @@ if (C_expected_features) endif() if (CMAKE_CXX_COMPILE_FEATURES) - set(CXX_expected_features ${CMAKE_CXX_COMPILE_FEATURES}) - list(FILTER CXX_expected_features EXCLUDE REGEX "^cxx_std_[0-9][0-9]") + if(NOT CMAKE_CXX_COMPILER_ID MATCHES "^(Cray|PGI|XL|XLClang)$") + set(CXX_expected_features ${CMAKE_CXX_COMPILE_FEATURES}) + list(FILTER CXX_expected_features EXCLUDE REGEX "^cxx_std_[0-9][0-9]") + endif() endif() if (NOT CXX_expected_features) file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp" https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=646fb1a646a3b860e983f3d030dfd223c761d49f commit 646fb1a646a3b860e983f3d030dfd223c761d49f Author: Robert Maynard AuthorDate: Wed Mar 27 15:44:37 2019 -0400 Commit: Brad King CommitDate: Tue Apr 9 08:44:56 2019 -0400 CompileFeatures: memoize C++ compilers with full language level support Previously compilers that had full support for a language standard level were still verified every time a new build directory was created. Now we record this information and insert the correct granular compile features instead of doing a `try_compile`. diff --git a/Modules/Compiler/CMakeCommonCompilerMacros.cmake b/Modules/Compiler/CMakeCommonCompilerMacros.cmake index 9c62e10..96537f8 100644 --- a/Modules/Compiler/CMakeCommonCompilerMacros.cmake +++ b/Modules/Compiler/CMakeCommonCompilerMacros.cmake @@ -94,18 +94,43 @@ endmacro() macro(cmake_record_cxx_compile_features) set(_result 0) if(_result EQUAL 0 AND DEFINED CMAKE_CXX20_STANDARD_COMPILE_OPTION) - _record_compiler_features_cxx(20) + if(CMAKE_CXX20_STANDARD__HAS_FULL_SUPPORT) + _has_compiler_features_cxx(20) + else() + _record_compiler_features_cxx(20) + endif() + unset(CMAKE_CXX20_STANDARD__HAS_FULL_SUPPORT) endif() if(_result EQUAL 0 AND DEFINED CMAKE_CXX17_STANDARD_COMPILE_OPTION) - _record_compiler_features_cxx(17) + if(CMAKE_CXX17_STANDARD__HAS_FULL_SUPPORT) + _has_compiler_features_cxx(17) + else() + _record_compiler_features_cxx(17) + endif() + unset(CMAKE_CXX17_STANDARD__HAS_FULL_SUPPORT) endif() if(_result EQUAL 0 AND DEFINED CMAKE_CXX14_STANDARD_COMPILE_OPTION) - _record_compiler_features_cxx(14) + if(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT) + _has_compiler_features_cxx(14) + else() + _record_compiler_features_cxx(14) + endif() + unset(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT) endif() if(_result EQUAL 0 AND DEFINED CMAKE_CXX11_STANDARD_COMPILE_OPTION) - _record_compiler_features_cxx(11) + if(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT) + _has_compiler_features_cxx(11) + else() + _record_compiler_features_cxx(11) + endif() + unset(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT) endif() if(_result EQUAL 0 AND DEFINED CMAKE_CXX98_STANDARD_COMPILE_OPTION) - _record_compiler_features_cxx(98) + if(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT) + _has_compiler_features_cxx(98) + else() + _record_compiler_features_cxx(98) + endif() + unset(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT) endif() endmacro() diff --git a/Modules/Internal/FeatureTesting.cmake b/Modules/Internal/FeatureTesting.cmake index f7b3e96..75be473 100644 --- a/Modules/Internal/FeatureTesting.cmake +++ b/Modules/Internal/FeatureTesting.cmake @@ -99,3 +99,7 @@ macro(_has_compiler_features_c std) list(APPEND CMAKE_C${std}_COMPILE_FEATURES c_std_${std}) _has_compiler_features(C ${std} "${CMAKE_C${std}_STANDARD_COMPILE_OPTION}" CMAKE_C${std}_COMPILE_FEATURES) endmacro() +macro(_has_compiler_features_cxx std) + list(APPEND CMAKE_CXX${std}_COMPILE_FEATURES cxx_std_${std}) + _has_compiler_features(CXX ${std} "${CMAKE_CXX${std}_STANDARD_COMPILE_OPTION}" CMAKE_CXX${std}_COMPILE_FEATURES) +endmacro() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0d641fcfad232a6981f587a8ee077dcf08432843 commit 0d641fcfad232a6981f587a8ee077dcf08432843 Author: Brad King AuthorDate: Tue Apr 9 08:43:14 2019 -0400 Commit: Brad King CommitDate: Tue Apr 9 08:44:56 2019 -0400 Tests: Remove outdated portion of CompileFeatures genex test The genex part of the test verifies that `$` evaluates as expected. It does not need to actually try using code with the associated features, as that is tested separately. diff --git a/Tests/CompileFeatures/genex_test.cpp b/Tests/CompileFeatures/genex_test.cpp index 4539789..53dce62 100644 --- a/Tests/CompileFeatures/genex_test.cpp +++ b/Tests/CompileFeatures/genex_test.cpp @@ -31,17 +31,6 @@ # if !EXPECT_OVERRIDE_CONTROL # error "Expect no override control feature" # endif - -struct A -{ - virtual int getA() { return 7; } -}; - -struct B final : A -{ - int getA() override { return 42; } -}; - #endif #if !HAVE_AUTO_TYPE ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/CMakeCommonCompilerMacros.cmake | 35 ++++++++++++++++++---- Modules/Compiler/Cray-CXX.cmake | 3 ++ Modules/Compiler/PGI-CXX.cmake | 4 +++ Modules/Compiler/XL-CXX.cmake | 2 ++ Modules/Compiler/XLClang-CXX.cmake | 3 ++ Modules/Internal/FeatureTesting.cmake | 4 +++ Tests/CompileFeatures/CMakeLists.txt | 24 ++++++++------- Tests/CompileFeatures/genex_test.cpp | 11 ------- .../WriteCompilerDetectionHeader/CMakeLists.txt | 12 +++++--- Tests/RunCMake/CMakeLists.txt | 3 ++ Tests/RunCMake/MetaCompileFeatures/C.cmake | 27 +++++++++++++++++ .../CMakeLists.txt | 2 +- Tests/RunCMake/MetaCompileFeatures/CXX.cmake | 27 +++++++++++++++++ .../MetaCompileFeatures/RunCMakeTest.cmake | 4 +++ .../MetaCompileFeatures/a.c} | 0 .../MetaCompileFeatures/a.cxx} | 0 16 files changed, 130 insertions(+), 31 deletions(-) create mode 100644 Tests/RunCMake/MetaCompileFeatures/C.cmake copy Tests/RunCMake/{Android => MetaCompileFeatures}/CMakeLists.txt (63%) create mode 100644 Tests/RunCMake/MetaCompileFeatures/CXX.cmake create mode 100644 Tests/RunCMake/MetaCompileFeatures/RunCMakeTest.cmake copy Tests/{Wrapping/vtkIncluded.cxx => RunCMake/MetaCompileFeatures/a.c} (100%) copy Tests/{Wrapping/vtkIncluded.cxx => RunCMake/MetaCompileFeatures/a.cxx} (100%) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Apr 11 00:03:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 11 Apr 2019 00:03:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-675-gbe101e9 Message-ID: <20190411040306.54776102461@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 be101e909e42c4a22c180d29ee217d5b8c4508d1 (commit) from 876680e94bed75e1e22a78f1e063e545ff6bce69 (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=be101e909e42c4a22c180d29ee217d5b8c4508d1 commit be101e909e42c4a22c180d29ee217d5b8c4508d1 Author: Kitware Robot AuthorDate: Thu Apr 11 00:01:09 2019 -0400 Commit: Kitware Robot CommitDate: Thu Apr 11 00:01:09 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4571566..2ee78dc 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 14) -set(CMake_VERSION_PATCH 20190410) +set(CMake_VERSION_PATCH 20190411) #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 Apr 11 10:13:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 11 Apr 2019 10:13:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-680-g5ae1506 Message-ID: <20190411141306.3EF61102E9A@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 5ae15061c36f45551d0308a5ff916067970705ff (commit) via 39e7fd8c68a1f039f089756352a418bd0ae36aea (commit) via baed22c4b000d524f4890af86cf3c02dc885cba6 (commit) via 44d6370db35c82d182bfc9480f0f0031b6b559ed (commit) via 538721939faef01b00ffd20416e8f7146d7368ac (commit) from be101e909e42c4a22c180d29ee217d5b8c4508d1 (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=5ae15061c36f45551d0308a5ff916067970705ff commit 5ae15061c36f45551d0308a5ff916067970705ff Merge: be101e9 39e7fd8 Author: Brad King AuthorDate: Thu Apr 11 14:12:08 2019 +0000 Commit: Kitware Robot CommitDate: Thu Apr 11 10:12:32 2019 -0400 Merge topic 'test-explicit-dirs' 39e7fd8c68 Tests: Avoid enabling languages in RunCMake.CommandLine -S and -B cases baed22c4b0 Tests: Fix RunCMake.CommandLine test to use generator with -S and -B 44d6370db3 Tests: Add RunCMake helper to run cmake with options 538721939f Tests: Teach RunCMake to optionally exclude the source dir argument Acked-by: Kitware Robot Merge-request: !3209 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=39e7fd8c68a1f039f089756352a418bd0ae36aea commit 39e7fd8c68a1f039f089756352a418bd0ae36aea Author: Brad King AuthorDate: Wed Apr 10 09:33:02 2019 -0400 Commit: Brad King CommitDate: Wed Apr 10 09:40:48 2019 -0400 Tests: Avoid enabling languages in RunCMake.CommandLine -S and -B cases The test project does not compile any sources and so does not need to enable any languages. diff --git a/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt b/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt index 0ca5a0a..fc62914 100644 --- a/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt +++ b/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt @@ -1,4 +1,5 @@ -cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.14) +project(ExplicitDirs NONE) add_custom_command( OUTPUT output.txt COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output.txt https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=baed22c4b000d524f4890af86cf3c02dc885cba6 commit baed22c4b000d524f4890af86cf3c02dc885cba6 Author: Brad King AuthorDate: Wed Apr 10 09:31:38 2019 -0400 Commit: Brad King CommitDate: Wed Apr 10 09:40:48 2019 -0400 Tests: Fix RunCMake.CommandLine test to use generator with -S and -B The `-S` and `-B` command-line option tests do generate build systems and so should use the generator being tested. diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 3deabd0..ea749ea 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -82,23 +82,27 @@ project(ExplicitDirsMissing LANGUAGES NONE) set(source_dir ${RunCMake_SOURCE_DIR}/ExplicitDirs) set(binary_dir ${RunCMake_BINARY_DIR}/ExplicitDirs-build) + set(RunCMake_TEST_SOURCE_DIR "${source_dir}") + set(RunCMake_TEST_BINARY_DIR "${binary_dir}") + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_NO_SOURCE_DIR 1) + file(REMOVE_RECURSE "${binary_dir}") - file(MAKE_DIRECTORY "${binary_dir}") - run_cmake_command(S-arg ${CMAKE_COMMAND} -S ${source_dir} ${binary_dir}) - run_cmake_command(S-arg-reverse-order ${CMAKE_COMMAND} ${binary_dir} -S${source_dir} ) - run_cmake_command(S-no-arg ${CMAKE_COMMAND} -S ) - run_cmake_command(S-no-arg2 ${CMAKE_COMMAND} -S -T) - run_cmake_command(S-B ${CMAKE_COMMAND} -S ${source_dir} -B ${binary_dir}) + run_cmake_with_options(S-arg -S ${source_dir} ${binary_dir}) + run_cmake_with_options(S-arg-reverse-order ${binary_dir} -S${source_dir} ) + run_cmake_with_options(S-no-arg -S ) + run_cmake_with_options(S-no-arg2 -S -T) + run_cmake_with_options(S-B -S ${source_dir} -B ${binary_dir}) # make sure that -B can explicitly construct build directories file(REMOVE_RECURSE "${binary_dir}") - run_cmake_command(B-arg ${CMAKE_COMMAND} -B ${binary_dir} ${source_dir}) + run_cmake_with_options(B-arg -B ${binary_dir} ${source_dir}) file(REMOVE_RECURSE "${binary_dir}") - run_cmake_command(B-arg-reverse-order ${CMAKE_COMMAND} ${source_dir} -B${binary_dir}) - run_cmake_command(B-no-arg ${CMAKE_COMMAND} -B ) - run_cmake_command(B-no-arg2 ${CMAKE_COMMAND} -B -T) + run_cmake_with_options(B-arg-reverse-order ${source_dir} -B${binary_dir}) + run_cmake_with_options(B-no-arg -B ) + run_cmake_with_options(B-no-arg2 -B -T) file(REMOVE_RECURSE "${binary_dir}") - run_cmake_command(B-S ${CMAKE_COMMAND} -B${binary_dir} -S${source_dir}) + run_cmake_with_options(B-S -B${binary_dir} -S${source_dir}) endfunction() run_ExplicitDirs() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=44d6370db35c82d182bfc9480f0f0031b6b559ed commit 44d6370db35c82d182bfc9480f0f0031b6b559ed Author: Brad King AuthorDate: Wed Apr 10 09:30:46 2019 -0400 Commit: Brad King CommitDate: Wed Apr 10 09:40:48 2019 -0400 Tests: Add RunCMake helper to run cmake with options diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 5d49909..ad3f8f6 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -188,5 +188,10 @@ function(run_cmake_command test) run_cmake(${test}) endfunction() +function(run_cmake_with_options test) + set(RunCMake_TEST_OPTIONS "${ARGN}") + run_cmake(${test}) +endfunction() + # Protect RunCMake tests from calling environment. unset(ENV{MAKEFLAGS}) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=538721939faef01b00ffd20416e8f7146d7368ac commit 538721939faef01b00ffd20416e8f7146d7368ac Author: Brad King AuthorDate: Wed Apr 10 09:29:30 2019 -0400 Commit: Brad King CommitDate: Wed Apr 10 09:40:48 2019 -0400 Tests: Teach RunCMake to optionally exclude the source dir argument diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index ce71677..5d49909 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -98,8 +98,14 @@ function(run_cmake test) else() set(_D_CMAKE_GENERATOR_INSTANCE "") endif() + if(NOT RunCMake_TEST_NO_SOURCE_DIR) + set(maybe_source_dir "${RunCMake_TEST_SOURCE_DIR}") + else() + set(maybe_source_dir "") + endif() execute_process( - COMMAND ${CMAKE_COMMAND} "${RunCMake_TEST_SOURCE_DIR}" + COMMAND ${CMAKE_COMMAND} + ${maybe_source_dir} -G "${RunCMake_GENERATOR}" -A "${RunCMake_GENERATOR_PLATFORM}" -T "${RunCMake_GENERATOR_TOOLSET}" ----------------------------------------------------------------------- Summary of changes: .../CommandLine/ExplicitDirs/CMakeLists.txt | 3 ++- Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 26 +++++++++++++--------- Tests/RunCMake/RunCMake.cmake | 13 ++++++++++- 3 files changed, 29 insertions(+), 13 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Apr 11 10:23:03 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 11 Apr 2019 10:23:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-682-ga550e2d Message-ID: <20190411142303.549B2FAE36@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 a550e2d6e48798d342a5ba7436013c6aa6ce5151 (commit) via 06dab0f0e5dcef89a0d03c4fd395a13a99056ea4 (commit) from 5ae15061c36f45551d0308a5ff916067970705ff (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=a550e2d6e48798d342a5ba7436013c6aa6ce5151 commit a550e2d6e48798d342a5ba7436013c6aa6ce5151 Merge: 5ae1506 06dab0f Author: Brad King AuthorDate: Thu Apr 11 14:12:16 2019 +0000 Commit: Kitware Robot CommitDate: Thu Apr 11 10:13:47 2019 -0400 Merge topic 'test-autogen-GAT-generator' 06dab0f0e5 Tests: Fix Qt*Autogen.GlobalAutogenTarget to use matching generator Acked-by: Kitware Robot Merge-request: !3210 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=06dab0f0e5dcef89a0d03c4fd395a13a99056ea4 commit 06dab0f0e5dcef89a0d03c4fd395a13a99056ea4 Author: Brad King AuthorDate: Wed Apr 10 09:58:46 2019 -0400 Commit: Brad King CommitDate: Wed Apr 10 10:01:19 2019 -0400 Tests: Fix Qt*Autogen.GlobalAutogenTarget to use matching generator Build the GAT project with the same generator as the rest of the test. This was accidentally left out of commit 8c8731b422 (Autogen: Add test for CMAKE_GLOBAL_AUTOGEN/RCC_TARGET, 2018-11-11, v3.14.0-rc1~396^2~2). diff --git a/Tests/QtAutogen/GlobalAutogenTarget/CMakeLists.txt b/Tests/QtAutogen/GlobalAutogenTarget/CMakeLists.txt index cff7022..81fd8db 100644 --- a/Tests/QtAutogen/GlobalAutogenTarget/CMakeLists.txt +++ b/Tests/QtAutogen/GlobalAutogenTarget/CMakeLists.txt @@ -69,6 +69,9 @@ file(MAKE_DIRECTORY ${GAT_BDIR}) message("___ Configuring GAT project ___") execute_process( COMMAND "${CMAKE_COMMAND}" "${GAT_SDIR}" + -G "${CMAKE_GENERATOR}" + -A "${CMAKE_GENERATOR_PLATFORM}" + -T "${CMAKE_GENERATOR_TOOLSET}" "-DQT_TEST_VERSION=${QT_TEST_VERSION}" "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}" "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" ----------------------------------------------------------------------- Summary of changes: Tests/QtAutogen/GlobalAutogenTarget/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Apr 12 00:03:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 12 Apr 2019 00:03:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-683-g1601b47 Message-ID: <20190412040306.53CFA10F570@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 1601b47b3e55e5de755412ced342a5bb75c4507a (commit) from a550e2d6e48798d342a5ba7436013c6aa6ce5151 (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=1601b47b3e55e5de755412ced342a5bb75c4507a commit 1601b47b3e55e5de755412ced342a5bb75c4507a Author: Kitware Robot AuthorDate: Fri Apr 12 00:01:09 2019 -0400 Commit: Kitware Robot CommitDate: Fri Apr 12 00:01:09 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2ee78dc..70c44e1 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 14) -set(CMake_VERSION_PATCH 20190411) +set(CMake_VERSION_PATCH 20190412) #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 Apr 12 07:33:09 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 12 Apr 2019 07:33:09 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-688-ga593243 Message-ID: <20190412113309.4FA1E11ED3A@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 a5932438cd71a8ef4a7480d9e2e86f70bbf571d5 (commit) via 680641a882254d3b8c6eb52415e7be841a46a6eb (commit) via 12ef832c96a7aa222f28353d5b9b33dd015d9f53 (commit) via 428c1e429ffb320b64c19d3da32e0822ff1b1b8d (commit) via b4385d5ccc0241f8adcb012ad645d3696bcc544c (commit) from 1601b47b3e55e5de755412ced342a5bb75c4507a (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=a5932438cd71a8ef4a7480d9e2e86f70bbf571d5 commit a5932438cd71a8ef4a7480d9e2e86f70bbf571d5 Merge: 680641a 12ef832 Author: Brad King AuthorDate: Fri Apr 12 11:29:11 2019 +0000 Commit: Kitware Robot CommitDate: Fri Apr 12 07:29:20 2019 -0400 Merge topic 'fix-overlay-icon-windows' 12ef832c96 cmake-gui: Fix icon overlay on windows Acked-by: Kitware Robot Merge-request: !3217 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=680641a882254d3b8c6eb52415e7be841a46a6eb commit 680641a882254d3b8c6eb52415e7be841a46a6eb Merge: 1601b47 428c1e4 Author: Brad King AuthorDate: Fri Apr 12 11:23:24 2019 +0000 Commit: Kitware Robot CommitDate: Fri Apr 12 07:23:31 2019 -0400 Merge topic 'xcode-extra-sources' 428c1e429f Xcode: Avoid mutating App Bundle targets during generation b4385d5ccc Xcode: Factor out duplicate source group code into lambda Acked-by: Kitware Robot Merge-request: !3208 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=12ef832c96a7aa222f28353d5b9b33dd015d9f53 commit 12ef832c96a7aa222f28353d5b9b33dd015d9f53 Author: Julien Jomier AuthorDate: Thu Apr 11 19:50:25 2019 +0200 Commit: Brad King CommitDate: Thu Apr 11 14:03:29 2019 -0400 cmake-gui: Fix icon overlay on windows Since commit 9175a378f5 (QtDialog: Add windows taskbar progress, 2018-11-17, v3.14.0-rc1~330^2) we've added a missing overlay icon. This results in Windows falling back to a default overlay icon. Simply drop this line. Fixes: #19160 diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 72cce9f..5f6ccca 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -303,7 +303,6 @@ void CMakeSetupDialog::initialize() #ifdef QT_WINEXTRAS this->TaskbarButton = new QWinTaskbarButton(this); this->TaskbarButton->setWindow(this->windowHandle()); - this->TaskbarButton->setOverlayIcon(QIcon(":/loading.png")); #endif } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=428c1e429ffb320b64c19d3da32e0822ff1b1b8d commit 428c1e429ffb320b64c19d3da32e0822ff1b1b8d Author: Brad King AuthorDate: Wed Apr 10 08:04:15 2019 -0400 Commit: Brad King CommitDate: Thu Apr 11 10:35:14 2019 -0400 Xcode: Avoid mutating App Bundle targets during generation For `MACOSX_BUNDLE` targets we generate an `Info.plist` automatically and add it to the sources presented to Xcode. Avoid mutating the original target's list of sources to achieve this. Otherwise when we generate the same target again (e.g. in a sub-project's Xcode file) it will look different than the first time and possibly break invariants. Fixes: #19114 diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index dd6008f..57de60e 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1142,6 +1142,13 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget( // Add CMakeLists.txt file for user convenience. this->AddXCodeProjBuildRule(gtgt, classes); + // Add the Info.plist we are about to generate for an App Bundle. + if (gtgt->GetPropertyAsBool("MACOSX_BUNDLE")) { + std::string plist = this->ComputeInfoPListLocation(gtgt); + cmSourceFile* sf = gtgt->Makefile->GetOrCreateSource(plist, true); + classes.push_back(sf); + } + std::sort(classes.begin(), classes.end(), cmSourceFilePathCompare()); gtgt->ComputeObjectMapping(); @@ -2883,14 +2890,6 @@ bool cmGlobalXCodeGenerator::CreateGroups( this->GroupMap[key] = pbxgroup; }; - // add the soon to be generated Info.plist file as a source for a - // MACOSX_BUNDLE file - if (gtgt->GetPropertyAsBool("MACOSX_BUNDLE")) { - std::string plist = this->ComputeInfoPListLocation(gtgt); - mf->GetOrCreateSource(plist, true); - gtgt->AddSource(plist); - } - // Put cmSourceFile instances in proper groups: for (auto const& si : gtgt->GetAllConfigSources()) { cmSourceFile const* sf = si.Source; @@ -2909,6 +2908,13 @@ bool cmGlobalXCodeGenerator::CreateGroups( cmSourceFile* sf = gtgt->Makefile->GetOrCreateSource(listfile); addSourceToGroup(sf->GetFullPath()); } + + // Add the Info.plist we are about to generate for an App Bundle. + if (gtgt->GetPropertyAsBool("MACOSX_BUNDLE")) { + std::string plist = this->ComputeInfoPListLocation(gtgt); + cmSourceFile* sf = gtgt->Makefile->GetOrCreateSource(plist, true); + addSourceToGroup(sf->GetFullPath()); + } } } return true; diff --git a/Tests/BundleTest/BundleSubDir/CMakeLists.txt b/Tests/BundleTest/BundleSubDir/CMakeLists.txt index 43c366a..2f7f2c4 100644 --- a/Tests/BundleTest/BundleSubDir/CMakeLists.txt +++ b/Tests/BundleTest/BundleSubDir/CMakeLists.txt @@ -1,3 +1,5 @@ +project(BundleSubDir) + add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist" COMMAND /bin/cp @@ -34,3 +36,8 @@ install(TARGETS SecondBundle DESTINATION Applications) # bundle does not respect the name. Also the executable will not be found by # the test driver if this does not work. set_target_properties(SecondBundle PROPERTIES OUTPUT_NAME SecondBundleExe) + +# Express one app bundle in terms of another's SOURCES to verify that +# the generators do not expose the Info.plist of one to the other. +add_executable(SubdirBundle1 MACOSX_BUNDLE EXCLUDE_FROM_ALL ../BundleTest.cxx) +add_executable(SubdirBundle2 MACOSX_BUNDLE EXCLUDE_FROM_ALL $) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b4385d5ccc0241f8adcb012ad645d3696bcc544c commit b4385d5ccc0241f8adcb012ad645d3696bcc544c Author: Brad King AuthorDate: Wed Apr 10 07:59:37 2019 -0400 Commit: Brad King CommitDate: Thu Apr 11 10:35:14 2019 -0400 Xcode: Factor out duplicate source group code into lambda diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 51c001e..dd6008f 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2875,6 +2875,14 @@ bool cmGlobalXCodeGenerator::CreateGroups( continue; } + auto addSourceToGroup = [this, mf, gtgt, + &sourceGroups](std::string const& source) { + cmSourceGroup* sourceGroup = mf->FindSourceGroup(source, sourceGroups); + cmXCodeObject* pbxgroup = this->CreateOrGetPBXGroup(gtgt, sourceGroup); + std::string key = GetGroupMapKeyFromPath(gtgt, source); + this->GroupMap[key] = pbxgroup; + }; + // add the soon to be generated Info.plist file as a source for a // MACOSX_BUNDLE file if (gtgt->GetPropertyAsBool("MACOSX_BUNDLE")) { @@ -2890,12 +2898,7 @@ bool cmGlobalXCodeGenerator::CreateGroups( // Object library files go on the link line instead. continue; } - // Add the file to the list of sources. - std::string const& source = sf->GetFullPath(); - cmSourceGroup* sourceGroup = mf->FindSourceGroup(source, sourceGroups); - cmXCodeObject* pbxgroup = this->CreateOrGetPBXGroup(gtgt, sourceGroup); - std::string key = GetGroupMapKeyFromPath(gtgt, source); - this->GroupMap[key] = pbxgroup; + addSourceToGroup(sf->GetFullPath()); } // Add CMakeLists.txt file for user convenience. @@ -2904,11 +2907,7 @@ bool cmGlobalXCodeGenerator::CreateGroups( gtgt->GetLocalGenerator()->GetCurrentSourceDirectory(); listfile += "/CMakeLists.txt"; cmSourceFile* sf = gtgt->Makefile->GetOrCreateSource(listfile); - std::string const& source = sf->GetFullPath(); - cmSourceGroup* sourceGroup = mf->FindSourceGroup(source, sourceGroups); - cmXCodeObject* pbxgroup = this->CreateOrGetPBXGroup(gtgt, sourceGroup); - std::string key = GetGroupMapKeyFromPath(gtgt, source); - this->GroupMap[key] = pbxgroup; + addSourceToGroup(sf->GetFullPath()); } } } ----------------------------------------------------------------------- Summary of changes: Source/QtDialog/CMakeSetupDialog.cxx | 1 - Source/cmGlobalXCodeGenerator.cxx | 41 ++++++++++++++++------------ Tests/BundleTest/BundleSubDir/CMakeLists.txt | 7 +++++ 3 files changed, 30 insertions(+), 19 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Apr 12 07:53:07 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 12 Apr 2019 07:53:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-691-g90c616b Message-ID: <20190412115307.76CBC1253C9@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 90c616b936027ee7db2507d6310cb2f80459bda6 (commit) via 6a39d3df5466735e22f96c3b6c9b73db1b8ec8f1 (commit) via 7bad2464fcf9ab1029268aed60d3d407fbdddc3d (commit) from a5932438cd71a8ef4a7480d9e2e86f70bbf571d5 (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=90c616b936027ee7db2507d6310cb2f80459bda6 commit 90c616b936027ee7db2507d6310cb2f80459bda6 Merge: a593243 6a39d3d Author: Brad King AuthorDate: Fri Apr 12 07:45:35 2019 -0400 Commit: Brad King CommitDate: Fri Apr 12 07:45:35 2019 -0400 Merge branch 'release-3.14' ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Fri Apr 12 07:53:07 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 12 Apr 2019 07:53:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.14.1-18-g6a39d3d Message-ID: <20190412115308.4B3F71253CA@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 6a39d3df5466735e22f96c3b6c9b73db1b8ec8f1 (commit) via 12ef832c96a7aa222f28353d5b9b33dd015d9f53 (commit) via 7bad2464fcf9ab1029268aed60d3d407fbdddc3d (commit) via 428c1e429ffb320b64c19d3da32e0822ff1b1b8d (commit) via b4385d5ccc0241f8adcb012ad645d3696bcc544c (commit) from 127d0ea2a660507c3f629bcf934e6863f60c09db (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/QtDialog/CMakeSetupDialog.cxx | 1 - Source/cmGlobalXCodeGenerator.cxx | 41 ++++++++++++++++------------ Tests/BundleTest/BundleSubDir/CMakeLists.txt | 7 +++++ 3 files changed, 30 insertions(+), 19 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Apr 12 08:03:11 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 12 Apr 2019 08:03:11 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-697-g4ff7706 Message-ID: <20190412120314.31AC1F9AE5@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 4ff7706f2d7eaaffe3970da5f77d18f67771a4a8 (commit) via f70367e4ed8a3092cd333acb8bb79735e8307980 (commit) via d798d2f7c5cc6b3fc69974f8d9392265228dbe5b (commit) via f0948499f6b47a7a856aef3334a8d8a38c1265d5 (commit) via 67645c132b39d1bacc524f1afa58367b8d4ba4fd (commit) via aeddf63587c242a7995598f4b1a5f248e4e3cb13 (commit) from 90c616b936027ee7db2507d6310cb2f80459bda6 (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=4ff7706f2d7eaaffe3970da5f77d18f67771a4a8 commit 4ff7706f2d7eaaffe3970da5f77d18f67771a4a8 Merge: f70367e 67645c1 Author: Brad King AuthorDate: Fri Apr 12 11:58:35 2019 +0000 Commit: Kitware Robot CommitDate: Fri Apr 12 07:59:55 2019 -0400 Merge topic 'cpack-cleanup' 67645c132b cpack: Remove unused file with old development notes Acked-by: Kitware Robot Merge-request: !3215 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f70367e4ed8a3092cd333acb8bb79735e8307980 commit f70367e4ed8a3092cd333acb8bb79735e8307980 Merge: d798d2f f094849 Author: Brad King AuthorDate: Fri Apr 12 11:58:20 2019 +0000 Commit: Kitware Robot CommitDate: Fri Apr 12 07:58:52 2019 -0400 Merge topic 'cmSystemTools-StringToULong-negatives' f0948499f6 cmSystemTools: Fix StringToULong to reject negative numbers Acked-by: Kitware Robot Merge-request: !3216 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d798d2f7c5cc6b3fc69974f8d9392265228dbe5b commit d798d2f7c5cc6b3fc69974f8d9392265228dbe5b Merge: 90c616b aeddf63 Author: Brad King AuthorDate: Fri Apr 12 11:57:54 2019 +0000 Commit: Kitware Robot CommitDate: Fri Apr 12 07:58:01 2019 -0400 Merge topic 'argument-parser-warning' aeddf63587 cmArgumentParser: Fix -Wcomma warning Acked-by: Kitware Robot Merge-request: !3214 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f0948499f6b47a7a856aef3334a8d8a38c1265d5 commit f0948499f6b47a7a856aef3334a8d8a38c1265d5 Author: Brad King AuthorDate: Thu Apr 11 12:56:32 2019 -0400 Commit: Brad King CommitDate: Thu Apr 11 12:56:32 2019 -0400 cmSystemTools: Fix StringToULong to reject negative numbers Fixes: #19161 diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index d201061..212608d 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -3023,6 +3023,12 @@ bool cmSystemTools::StringToULong(const char* str, unsigned long* value) { errno = 0; char* endp; + while (isspace(*str)) { + ++str; + } + if (*str == '-') { + return false; + } *value = strtoul(str, &endp, 10); return (*endp == '\0') && (endp != str) && (errno == 0); } diff --git a/Tests/CMakeLib/testSystemTools.cxx b/Tests/CMakeLib/testSystemTools.cxx index 96a4819..121e639 100644 --- a/Tests/CMakeLib/testSystemTools.cxx +++ b/Tests/CMakeLib/testSystemTools.cxx @@ -93,5 +93,22 @@ int testSystemTools(int /*unused*/, char* /*unused*/ []) if (!failed) { cmPassed("cmSystemTools::strverscmp working"); } + + // ---------------------------------------------------------------------- + // Test cmSystemTools::StringToULong + { + unsigned long value; + cmAssert(cmSystemTools::StringToULong("1", &value) && value == 1, + "StringToULong parses a decimal integer."); + cmAssert(cmSystemTools::StringToULong(" 1", &value) && value == 1, + "StringToULong parses a decimal integer after whitespace."); + cmAssert(!cmSystemTools::StringToULong("-1", &value), + "StringToULong rejects a negative number."); + cmAssert(!cmSystemTools::StringToULong(" -1", &value), + "StringToULong rejects a negative number after whitespace."); + cmAssert(!cmSystemTools::StringToULong("1x", &value), + "StringToULong rejects trailing content."); + } + return failed; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=67645c132b39d1bacc524f1afa58367b8d4ba4fd commit 67645c132b39d1bacc524f1afa58367b8d4ba4fd Author: Brad King AuthorDate: Thu Apr 11 10:55:53 2019 -0400 Commit: Brad King CommitDate: Thu Apr 11 10:56:05 2019 -0400 cpack: Remove unused file with old development notes diff --git a/Source/CPack/bills-comments.txt b/Source/CPack/bills-comments.txt deleted file mode 100644 index 1aaf9af..0000000 --- a/Source/CPack/bills-comments.txt +++ /dev/null @@ -1,68 +0,0 @@ -cpack.cxx - -cmCPackGenerators -- creates cmCPackGenericGenerator's via NewGenerator - - a cmCPackGenericGenerator factory - - -cmCPackGenericGenerator::Initialize - this->InitializeInternal - CPACK_INCLUDE_TOPLEVEL_DIRECTORY = 0 turns off - - -// binary package run -cmCPackGenericGenerator::ProcessGenerator // DoPackage - cmCPackGenericGenerator::PrepareNames -- sets a bunch of CPACK_vars - cmCPackGenericGenerator::InstallProject - run preinstall (make preinstall/fast) - call ReadListFile(cmake_install.cmake) - glob recurse in install directory to get list of files - this->CompressFiles with the list of files - - -// source package run -cmCPackGenericGenerator::ProcessGenerator // DoPackage - cmCPackGenericGenerator::PrepareNames -- sets a bunch of CPACK_vars - cmCPackGenericGenerator::InstallProject --> - if set CPACK_INSTALLED_DIRECTORIES - glob the files in that directory - copy those files to the tmp install directory _CPack something - glob recurse in install directory to get list of files - this->CompressFiles with the list of files - - -cmCPackGenericGenerator::InstallProject is used for both source and binary -packages. It is controlled based on values set in CPACK_ variables. - - -InstallProject - 1. CPACK_INSTALL_COMMANDS - a list of commands used to install the package - - 2. CPACK_INSTALLED_DIRECTORIES - copy this directory to CPACK_TEMPORARY_DIRECTORY - - 3. CPACK_INSTALL_CMAKE_PROJECTS - a cmake install script - - run make preinstall - - run cmake_install.cmake - - set CMAKE_INSTALL_PREFIX to the temp directory - - CPACK_BUILD_CONFIG check this and set the BUILD_TYPE to it - - ReadListFile on the install script cmake_install.cmake - - run strip on the executables and libraries if CPACK_STRIP_FILES is TRUE - -Recommendations: - -rename cmCPackGenerators to cmCPackGeneratorFactory - -rename cmCPackGenericGenerator --> cmCPackGenerator - -rename cmCPackGenericGenerator::ProcessGenerator -> cmCPackGenerator::DoPackage - - -break up cmCPackGenerator::InstallProject so it calls the following: - -// run user provided install commands - cmCPackGenerator::RunInstallCommands(); -// copy entire directories that need no processing like source trees - cmCPackGenerator::CopyPreInstalledDirectories(); -// run the cmake install scripts if provided - cmCPackGenerator::RunCMakeInstallScripts() - -- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=aeddf63587c242a7995598f4b1a5f248e4e3cb13 commit aeddf63587c242a7995598f4b1a5f248e4e3cb13 Author: Brad King AuthorDate: Thu Apr 11 10:41:03 2019 -0400 Commit: Brad King CommitDate: Thu Apr 11 10:44:38 2019 -0400 cmArgumentParser: Fix -Wcomma warning Clang `-Wcomma` warns: ``` Source/cmArgumentParser.cxx:58:42: warning: possible misuse of comma operator this->CurrentList = (val.emplace_back(), &val.back()); ^ ``` This was introduced by commit 4359fe133b (Introduce cmArgumentParser, 2019-03-23). Suppress it with the suggested cast. diff --git a/Source/cmArgumentParser.cxx b/Source/cmArgumentParser.cxx index 9a9932c..751d117 100644 --- a/Source/cmArgumentParser.cxx +++ b/Source/cmArgumentParser.cxx @@ -55,7 +55,7 @@ void Instance::Bind(StringList& val) void Instance::Bind(MultiStringList& val) { this->CurrentString = nullptr; - this->CurrentList = (val.emplace_back(), &val.back()); + this->CurrentList = (static_cast(val.emplace_back()), &val.back()); this->ExpectValue = false; } ----------------------------------------------------------------------- Summary of changes: Source/CPack/bills-comments.txt | 68 -------------------------------------- Source/cmArgumentParser.cxx | 2 +- Source/cmSystemTools.cxx | 6 ++++ Tests/CMakeLib/testSystemTools.cxx | 17 ++++++++++ 4 files changed, 24 insertions(+), 69 deletions(-) delete mode 100644 Source/CPack/bills-comments.txt hooks/post-receive -- CMake From kwrobot at kitware.com Fri Apr 12 09:33:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 12 Apr 2019 09:33:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.1-699-gdb6fdfd Message-ID: <20190412133304.D53151135EC@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 db6fdfdb053a372382ff8eadad9bfa47c1a3b4bc (commit) via 5e98111643e22ad515afa2bf48a92573b6987115 (commit) from 4ff7706f2d7eaaffe3970da5f77d18f67771a4a8 (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=db6fdfdb053a372382ff8eadad9bfa47c1a3b4bc commit db6fdfdb053a372382ff8eadad9bfa47c1a3b4bc Merge: 4ff7706 5e98111 Author: Brad King AuthorDate: Fri Apr 12 09:30:03 2019 -0400 Commit: Brad King CommitDate: Fri Apr 12 09:30:03 2019 -0400 Merge branch 'release-3.14' ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Fri Apr 12 09:33:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 12 Apr 2019 09:33:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.14.1-19-g5e98111 Message-ID: <20190412133304.EB00D113605@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 5e98111643e22ad515afa2bf48a92573b6987115 (commit) from 6a39d3df5466735e22f96c3b6c9b73db1b8ec8f1 (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 Fri Apr 12 09:43:02 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 12 Apr 2019 09:43:02 -0400 (EDT) Subject: [Cmake-commits] CMake annotated tag, v3.14.2, created. v3.14.2 Message-ID: <20190412134302.C99D1FB836@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.14.2 has been created at 901ac046904dc8add46dde2e18a3b4981a0b5ecb (tag) tagging 5e98111643e22ad515afa2bf48a92573b6987115 (commit) replaces v3.14.1 tagged by Brad King on Fri Apr 12 09:27:06 2019 -0400 - Log ----------------------------------------------------------------- CMake 3.14.2 -----BEGIN PGP SIGNATURE----- iQJKBAABCgA0FiEExsJlMku+vcNQtRPQLSzvEDSSFoQFAlywkioWHGJyYWQua2lu Z0BraXR3YXJlLmNvbQAKCRAtLO8QNJIWhDOWD/sGSuaeKtdGWhcKLem4q3pEejUo /8Ik7bFOheQ4dfCG2tUY4iXJ+WUJOLtHjnJkLeOiU+u1orl1l1huDmmHbH5vecA8 FnvFmEPxjtlxs+t7LpHm/Tp+CjiECODMrF7/64LK6TOKH69mqO18PnXlJEO06LdS YO+XX6AdpWZk9W2KmyLKH04EEVFpaHPtQxJv+iPYHeiZIbbhq2zmG5WxcrUIMyoN ioiW/OEPyy6hIKeQ4AKczpXOBR7emDrknto/lMtBvoJKf3GItHWoYPR9fFAvjbPU ZNclQJ+OyogdW2OQJwPoQX7oz97KoE8fGaLf13ILynd0qqzeWVMHniWZYGcKwJjg zVtmkU8VZvldcoNZKem6IslfnQ8bag/beCY4aQLW96vyqunCqXp40jreh9A/v13+ Xj/4sImFqZKSD5LoYEyEm79618M/1eIxXbgNd3PHg4I41ltKUMd4ScQn5+yfPc78 4xFRlM/5RxNrnICc6uxnb5QhOmqZDowlKBt14kyZF5SsUNFSuVsiojwL+o5r2yWQ jkqBTwBmm0+JkqjF5N7ytvqos88KXDZVW5ks2MHYOP4s2T9CXPDkzgMiaUkhoT+u qquKdAwru64mWt2WfCdQ7vaNbSOL21Eb/Jws9KB4frZan9AyblWQLj1xiCdlTRSE M1k9RpvzfsgKQ27G1w== =+Y0d -----END PGP SIGNATURE----- Brad King (15): MSVC: Fix MSVC_TOOLSET_VERSION for VS 2019 v142 toolset ARMCC: Do not identify ARMClang as ARMCC IRSL: Fix discovery of VS 2019 v142 toolset redistributables Merge branch 'armcc-compiler-id' into release-3.14 Merge branch 'vs2019-redist' into release-3.14 Tests: Clarify hand-written cases in RunCMake.ParseImplicitIncludeInfo Tests: Teach RunCMake.ParseImplicitIncludeInfo to match output by regex Fix implicit include directory extraction for adaptive relative paths Merge branch 'backport-implicit-includes-relative' into release-3.14 Merge branch 'backport-cmake-gui-windows-theme' into release-3.14 Xcode: Factor out duplicate source group code into lambda Xcode: Avoid mutating App Bundle targets during generation Merge branch 'xcode-extra-sources' into release-3.14 Merge branch 'fix-overlay-icon-windows' into release-3.14 CMake 3.14.2 Craig Scott (1): Merge branch 'fix-submit-url' into release-3.14 Julien Jomier (1): cmake-gui: Fix icon overlay on windows Regina Pfeifer (1): Modules/CTest: Fix SubmitURL mistersandman (1): cmake-gui: Fix theme on Windows with Qt >= 5.10 ----------------------------------------------------------------------- hooks/post-receive -- CMake From kwrobot at kitware.com Fri Apr 12 10:23:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 12 Apr 2019 10:23:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.2-685-ge3ebad7 Message-ID: <20190412142304.632B71121F5@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 e3ebad7def73fa656069835e916db3245ab70a62 (commit) via 4adc0b7c758ed98776bec63d21bb2037b0f28e2d (commit) via a40f9083dd17d1cccf89ccdf290c3f494cab3aac (commit) via b70bac647dd2124011f8b98c7472ecfebb404d35 (commit) via f65763fe9be16ccded53f26dda257fdb028cccf6 (commit) from db6fdfdb053a372382ff8eadad9bfa47c1a3b4bc (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=e3ebad7def73fa656069835e916db3245ab70a62 commit e3ebad7def73fa656069835e916db3245ab70a62 Merge: 4adc0b7 b70bac6 Author: Brad King AuthorDate: Fri Apr 12 14:22:23 2019 +0000 Commit: Kitware Robot CommitDate: Fri Apr 12 10:22:33 2019 -0400 Merge topic 'genex-target-prefix-suffix' b70bac647d Genex: add $ and $ f65763fe9b Refactor: Add new methods to retrieve prefix and suffix Acked-by: Kitware Robot Merge-request: !3207 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4adc0b7c758ed98776bec63d21bb2037b0f28e2d commit 4adc0b7c758ed98776bec63d21bb2037b0f28e2d Merge: db6fdfd a40f908 Author: Brad King AuthorDate: Fri Apr 12 14:20:09 2019 +0000 Commit: Kitware Robot CommitDate: Fri Apr 12 10:20:20 2019 -0400 Merge topic 'iface-headers' a40f9083dd INTERFACE Target: allow (PUBLIC/PRIVATE)_HEADER properties Acked-by: Kitware Robot Merge-request: !3181 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a40f9083dd17d1cccf89ccdf290c3f494cab3aac commit a40f9083dd17d1cccf89ccdf290c3f494cab3aac Author: Avraham Shukron AuthorDate: Sat Apr 6 00:27:04 2019 +0300 Commit: Brad King CommitDate: Thu Apr 11 11:09:42 2019 -0400 INTERFACE Target: allow (PUBLIC/PRIVATE)_HEADER properties Also support installing headers on an INTERFACE library. Signed-off-by: Avraham Shukron Fixes: #15234 diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst index ec6cb9d..b42fe42 100644 --- a/Help/command/add_library.rst +++ b/Help/command/add_library.rst @@ -80,12 +80,17 @@ option extends visibility. It may be referenced like any target built within the project. ``IMPORTED`` libraries are useful for convenient reference from commands like :command:`target_link_libraries`. Details about the imported library are specified by setting properties whose names -begin in ``IMPORTED_`` and ``INTERFACE_``. The most important such -property is :prop_tgt:`IMPORTED_LOCATION` (and its per-configuration -variant :prop_tgt:`IMPORTED_LOCATION_`) which specifies the -location of the main library file on disk. Or, for object libraries, -:prop_tgt:`IMPORTED_OBJECTS` (and :prop_tgt:`IMPORTED_OBJECTS_`) -specifies the locations of object files on disk. +begin in ``IMPORTED_`` and ``INTERFACE_``. + +The most important properties are: + +* :prop_tgt:`IMPORTED_LOCATION` (and its per-configuration + variant :prop_tgt:`IMPORTED_LOCATION_`) which specifies the + location of the main library file on disk. +* :prop_tgt:`IMPORTED_OBJECTS` (and :prop_tgt:`IMPORTED_OBJECTS_`) + for object libraries, specifies the locations of object files on disk. +* :prop_tgt:`PUBLIC_HEADER` files to be installed during :command:`install` invocation + See documentation of the ``IMPORTED_*`` and ``INTERFACE_*`` properties for more information. diff --git a/Help/command/install.rst b/Help/command/install.rst index a4cee71..7571aae 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -148,13 +148,13 @@ project. There are several kinds of target files that may be installed: property are treated as ``FRAMEWORK`` targets on macOS. ``BUNDLE`` - Executables marked with the ``MACOSX_BUNDLE`` property are treated as + Executables marked with the :prop_tgt:`MACOSX_BUNDLE` property are treated as ``BUNDLE`` targets on macOS. ``PUBLIC_HEADER`` - Any ``PUBLIC_HEADER`` files associated with a library are installed in + Any :prop_tgt:`PUBLIC_HEADER` files associated with a library are installed in the destination specified by the ``PUBLIC_HEADER`` argument on non-Apple - platforms. Rules defined by this argument are ignored for ``FRAMEWORK`` + platforms. Rules defined by this argument are ignored for :prop_tgt:`FRAMEWORK` libraries on Apple platforms because the associated files are installed into the appropriate locations inside the framework folder. See :prop_tgt:`PUBLIC_HEADER` for details. diff --git a/Help/release/dev/iface-headers.rst b/Help/release/dev/iface-headers.rst new file mode 100644 index 0000000..2e1de5e --- /dev/null +++ b/Help/release/dev/iface-headers.rst @@ -0,0 +1,7 @@ +iface-headers +------------- + +* ``INTERFACE`` library can now have :prop_tgt:`PUBLIC_HEADER` and + :prop_tgt:`PRIVATE_HEADER` properties set. The headers specified by those + properties can be installed using the :command:`install(TARGETS)` command by + passing the ``PUBLIC_HEADER`` and ``PRIVATE_HEADER`` arguments respectively. diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 20d1a31..65875dc 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -663,8 +663,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) // generators for them. bool createInstallGeneratorsForTargetFileSets = true; - if (target.IsFrameworkOnApple() || - target.GetType() == cmStateEnums::INTERFACE_LIBRARY) { + if (target.IsFrameworkOnApple()) { createInstallGeneratorsForTargetFileSets = false; } diff --git a/Source/cmTargetPropertyComputer.cxx b/Source/cmTargetPropertyComputer.cxx index d2c3496..994fcf7 100644 --- a/Source/cmTargetPropertyComputer.cxx +++ b/Source/cmTargetPropertyComputer.cxx @@ -67,6 +67,8 @@ bool cmTargetPropertyComputer::WhiteListedInterfaceProperty( builtIns.insert("IMPORTED_GLOBAL"); builtIns.insert("MANUALLY_ADDED_DEPENDENCIES"); builtIns.insert("NAME"); + builtIns.insert("PRIVATE_HEADER"); + builtIns.insert("PUBLIC_HEADER"); builtIns.insert("TYPE"); } diff --git a/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake b/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake index c41cb2a..15335b2 100644 --- a/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake +++ b/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake @@ -4,6 +4,8 @@ if(WIN32) [[bin/exe\.exe]] [[bin/(lib)?lib1\.dll]] [[include]] + [[include/obj1\.h]] + [[include/obj2\.h]] [[include/obj4\.h]] [[include/obj5\.h]] [[lib]] @@ -20,6 +22,8 @@ elseif(CYGWIN) [[bin/cyglib1\.dll]] [[bin/exe\.exe]] [[include]] + [[include/obj1\.h]] + [[include/obj2\.h]] [[include/obj4\.h]] [[include/obj5\.h]] [[lib]] @@ -35,6 +39,8 @@ else() [[bin]] [[bin/exe]] [[include]] + [[include/obj1\.h]] + [[include/obj2\.h]] [[include/obj4\.h]] [[include/obj5\.h]] [[lib]] diff --git a/Tests/RunCMake/install/TARGETS-Defaults.cmake b/Tests/RunCMake/install/TARGETS-Defaults.cmake index bfd8c2c..324aa11 100644 --- a/Tests/RunCMake/install/TARGETS-Defaults.cmake +++ b/Tests/RunCMake/install/TARGETS-Defaults.cmake @@ -8,6 +8,11 @@ set_property(TARGET lib3 PROPERTY PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/obj add_library(lib4 SHARED obj5.c) set_property(TARGET lib4 PROPERTY PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/obj5.h) +add_library(iface INTERFACE) +set_target_properties(iface PROPERTIES + PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/obj1.h + PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/obj2.h) + install(TARGETS exe lib1 lib2) install(TARGETS lib3 LIBRARY DESTINATION lib3 @@ -17,3 +22,6 @@ install(TARGETS lib4 LIBRARY DESTINATION lib4 RUNTIME DESTINATION lib4 ) +install(TARGETS iface + PUBLIC_HEADER DESTINATION include + PRIVATE_HEADER DESTINATION include) diff --git a/Tests/RunCMake/install/obj2.h b/Tests/RunCMake/install/obj2.h new file mode 100644 index 0000000..90bcd34 --- /dev/null +++ b/Tests/RunCMake/install/obj2.h @@ -0,0 +1,6 @@ +#ifndef OBJ2_H +#define OBJ2_H + +int obj2(void); + +#endif /* OBJ2_H */ diff --git a/Tests/RunCMake/interface_library/whitelist.cmake b/Tests/RunCMake/interface_library/whitelist.cmake index bf64f01..0db6375 100644 --- a/Tests/RunCMake/interface_library/whitelist.cmake +++ b/Tests/RunCMake/interface_library/whitelist.cmake @@ -14,3 +14,12 @@ get_target_property(outname iface "_custom_property") set_property(TARGET iface PROPERTY "custom_property" output) set_property(TARGET iface APPEND PROPERTY "custom_property" append) get_target_property(outname iface "custom_property") + +# PUBLIC_HEADER / PRIVATE_HEADER properties are allowed +set_property(TARGET iface PROPERTY PUBLIC_HEADER foo.h) +set_property(TARGET iface APPEND PROPERTY PUBLIC_HEADER bar.h) +get_target_property(outname iface PUBLIC_HEADER) + +set_property(TARGET iface PROPERTY PRIVATE_HEADER foo.h) +set_property(TARGET iface APPEND PROPERTY PRIVATE_HEADER bar.h) +get_target_property(outname iface PRIVATE_HEADER) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b70bac647dd2124011f8b98c7472ecfebb404d35 commit b70bac647dd2124011f8b98c7472ecfebb404d35 Author: Marc Chevrier AuthorDate: Tue Apr 9 15:54:17 2019 +0200 Commit: Marc Chevrier CommitDate: Wed Apr 10 23:45:12 2019 +0200 Genex: add $ and $ These capabilities complement MR !3190 and is also needed to solve issue #18771. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index e3a96bd..e9b3f4c 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -393,7 +393,18 @@ Target-Dependent Queries Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. ``$`` - Full path to main file (.exe, .so.1.2, .a) where ``tgt`` is the name of a target. + Full path to main file (.exe, .so.1.2, .a) where ``tgt`` is the name of a + target. +``$`` + Prefix of main file where ``tgt`` is the name of a target. + + Note that ``tgt`` is not added as a dependency of the target this + expression is evaluated on. +``$`` + Suffix of main file where ``tgt`` is the name of a target. + + Note that ``tgt`` is not added as a dependency of the target this + expression is evaluated on. ``$`` Name of main file (.exe, .so.1.2, .a). ``$`` @@ -405,6 +416,16 @@ Target-Dependent Queries expression is evaluated on. ``$`` File used to link (.a, .lib, .so) where ``tgt`` is the name of a target. +``$`` + Prefix of file used to link where ``tgt`` is the name of a target. + + Note that ``tgt`` is not added as a dependency of the target this + expression is evaluated on. +``$`` + Suffix of file used to link where ``tgt`` is the name of a target. + + Note that ``tgt`` is not added as a dependency of the target this + expression is evaluated on. ``$`` Name of file used to link (.a, .lib, .so). ``$`` diff --git a/Help/release/dev/genex-TARGET_FILE_PREFIX.rst b/Help/release/dev/genex-TARGET_FILE_PREFIX.rst new file mode 100644 index 0000000..3e480bb --- /dev/null +++ b/Help/release/dev/genex-TARGET_FILE_PREFIX.rst @@ -0,0 +1,7 @@ +genex-TARGET_FILE_PREFIX +------------------------ + +* New ``$``, ``$``, + ``$`` and ``$`` + :manual:`generator expressions ` have been + added to retrieve the prefix and suffix of various artifacts. diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index d8e1c42..af409e4 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -2297,6 +2297,119 @@ static const TargetOutputNameArtifact static const TargetOutputNameArtifact targetPdbOutputNameNode; +class ArtifactFilePrefixTag; +class ArtifactLinkerFilePrefixTag; +class ArtifactFileSuffixTag; +class ArtifactLinkerFileSuffixTag; + +template +struct TargetFileArtifactResultGetter +{ + static std::string Get(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content); +}; + +template <> +struct TargetFileArtifactResultGetter +{ + static std::string Get(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent*) + { + return target->GetFilePrefix(context->Config); + } +}; +template <> +struct TargetFileArtifactResultGetter +{ + static std::string Get(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content) + { + if (!target->IsLinkable()) { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_LINKER_PREFIX is allowed only for libraries and " + "executables with ENABLE_EXPORTS."); + return std::string(); + } + + cmStateEnums::ArtifactType artifact = + target->HasImportLibrary(context->Config) + ? cmStateEnums::ImportLibraryArtifact + : cmStateEnums::RuntimeBinaryArtifact; + + return target->GetFilePrefix(context->Config, artifact); + } +}; +template <> +struct TargetFileArtifactResultGetter +{ + static std::string Get(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent*) + { + return target->GetFileSuffix(context->Config); + } +}; +template <> +struct TargetFileArtifactResultGetter +{ + static std::string Get(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content) + { + if (!target->IsLinkable()) { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_LINKER_SUFFIX is allowed only for libraries and " + "executables with ENABLE_EXPORTS."); + return std::string(); + } + + cmStateEnums::ArtifactType artifact = + target->HasImportLibrary(context->Config) + ? cmStateEnums::ImportLibraryArtifact + : cmStateEnums::RuntimeBinaryArtifact; + + return target->GetFileSuffix(context->Config, artifact); + } +}; + +template +struct TargetFileArtifact : public TargetArtifactBase +{ + TargetFileArtifact() {} // NOLINT(modernize-use-equals-default) + + int NumExpectedParameters() const override { return 1; } + + std::string Evaluate( + const std::vector& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* dagChecker) const override + { + cmGeneratorTarget* target = + this->GetTarget(parameters, context, content, dagChecker); + if (!target) { + return std::string(); + } + + std::string result = + TargetFileArtifactResultGetter::Get(target, context, content); + if (context->HadError) { + return std::string(); + } + return result; + } +}; + +static const TargetFileArtifact targetFilePrefixNode; +static const TargetFileArtifact + targetLinkerFilePrefixNode; +static const TargetFileArtifact targetFileSuffixNode; +static const TargetFileArtifact + targetLinkerFileSuffixNode; + static const struct ShellPathNode : public cmGeneratorExpressionNode { ShellPathNode() {} // NOLINT(modernize-use-equals-default) @@ -2361,6 +2474,10 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode( { "TARGET_LINKER_FILE", &targetLinkerNodeGroup.File }, { "TARGET_SONAME_FILE", &targetSoNameNodeGroup.File }, { "TARGET_PDB_FILE", &targetPdbNodeGroup.File }, + { "TARGET_FILE_PREFIX", &targetFilePrefixNode }, + { "TARGET_LINKER_FILE_PREFIX", &targetLinkerFilePrefixNode }, + { "TARGET_FILE_SUFFIX", &targetFileSuffixNode }, + { "TARGET_LINKER_FILE_SUFFIX", &targetLinkerFileSuffixNode }, { "TARGET_FILE_NAME", &targetNodeGroup.FileName }, { "TARGET_LINKER_FILE_NAME", &targetLinkerNodeGroup.FileName }, { "TARGET_SONAME_FILE_NAME", &targetSoNameNodeGroup.FileName }, diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 4202064..0b0fb78 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -33,6 +33,14 @@ run_cmake(COMPILE_LANGUAGE-add_test) run_cmake(COMPILE_LANGUAGE-unknown-lang) run_cmake(TARGET_FILE-recursion) run_cmake(OUTPUT_NAME-recursion) +run_cmake(TARGET_FILE_PREFIX) +run_cmake(TARGET_FILE_PREFIX-imported-target) +run_cmake(TARGET_FILE_PREFIX-non-valid-target) +run_cmake(TARGET_LINKER_FILE_PREFIX-non-valid-target) +run_cmake(TARGET_FILE_SUFFIX) +run_cmake(TARGET_FILE_SUFFIX-imported-target) +run_cmake(TARGET_FILE_SUFFIX-non-valid-target) +run_cmake(TARGET_LINKER_FILE_SUFFIX-non-valid-target) run_cmake(TARGET_OUTPUT_NAME) run_cmake(TARGET_OUTPUT_NAME-imported-target) run_cmake(TARGET_OUTPUT_NAME-non-valid-target) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-check.cmake new file mode 100644 index 0000000..676ad4b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-check.cmake @@ -0,0 +1,2 @@ + +include ("${RunCMake_TEST_BINARY_DIR}/TARGET_FILE_PREFIX-generated.cmake") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-imported-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-imported-target-check.cmake new file mode 100644 index 0000000..676ad4b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-imported-target-check.cmake @@ -0,0 +1,2 @@ + +include ("${RunCMake_TEST_BINARY_DIR}/TARGET_FILE_PREFIX-generated.cmake") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-imported-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-imported-target.cmake new file mode 100644 index 0000000..34e500a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-imported-target.cmake @@ -0,0 +1,49 @@ + +cmake_minimum_required(VERSION 3.14) + +enable_language (C) + +set (win_platforms Windows CYGWIN) + +set (GENERATE_CONTENT [[ +macro (CHECK_VALUE test_msg value expected) + if (NOT "${value}" STREQUAL "${expected}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [${value}]\nbut expected:\n [${expected}]\n") + endif() +endmacro() +]]) + +add_executable(exec1 IMPORTED) +add_library (shared1 SHARED IMPORTED) +add_library (static1 STATIC IMPORTED) + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_FILE_PREFIX executable default\" \"$\" \"\") +check_value (\"TARGET_FILE_PREFIX shared default\" \"$\" \"${CMAKE_SHARED_LIBRARY_PREFIX}\") +check_value (\"TARGET_LINKER_FILE_PREFIX shared linker default\" \"$\" \"$,${win_platforms}>,${CMAKE_IMPORT_LIBRARY_PREFIX},${CMAKE_SHARED_LIBRARY_PREFIX}>\") +check_value (\"TARGET_FILE_PREFIX static default\" \"$\" \"${CMAKE_STATIC_LIBRARY_PREFIX}\") +check_value (\"TARGET_LINKER_FILE_PREFIX static linker default\" \"$\" \"${CMAKE_STATIC_LIBRARY_PREFIX}\")\n") + + +add_executable (exec2 IMPORTED) +set_property (TARGET exec2 PROPERTY PREFIX exec2_prefix) +set_property (TARGET exec2 PROPERTY ENABLE_EXPORTS TRUE) +set_property (TARGET exec2 PROPERTY IMPORT_PREFIX exec2_import_prefix) +add_library (shared2 SHARED IMPORTED) +set_property (TARGET shared2 PROPERTY PREFIX shared2_prefix) +set_property (TARGET shared2 PROPERTY IMPORT_PREFIX shared2_import_prefix) +add_library (static2 STATIC IMPORTED) +set_property (TARGET static2 PROPERTY PREFIX static2_prefix) +set_property (TARGET static2 PROPERTY IMPORT_PREFIX static2_import_prefix) + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_FILE_PREFIX executable custom\" \"$\" \"exec2_prefix\") +check_value (\"TARGET_LINKER_FILE_PREFIX executable linker custom\" \"$\" \"$,${win_platforms}>,exec2_import_prefix,exec2_prefix>\") +check_value (\"TARGET_FILE_PREFIX shared custom\" \"$\" \"shared2_prefix\") +check_value (\"TARGET_LINKER_FILE_PREFIX shared linker custom\" \"$\" \"$,${win_platforms}>,shared2_import_prefix,shared2_prefix>\") +check_value (\"TARGET_FILE_PREFIX static custom\" \"$\" \"static2_prefix\") +check_value (\"TARGET_LINKER_FILE_PREFIX static linker custom\" \"$\" \"static2_prefix\")\n") + + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_FILE_PREFIX-generated.cmake" + CONTENT "${GENERATE_CONTENT}") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-non-valid-target-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-non-valid-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-non-valid-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-non-valid-target-stderr.txt new file mode 100644 index 0000000..81362ef --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-non-valid-target-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at TARGET_FILE_PREFIX-non-valid-target.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$ + + Target "empty" is not an executable or library\. diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-non-valid-target.cmake similarity index 59% copy from Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake copy to Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-non-valid-target.cmake index 2ff733c..d1095fa 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-non-valid-target.cmake @@ -1,9 +1,7 @@ -enable_language(C) - add_custom_target(empty) file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" - CONTENT "[$]" + CONTENT "[$]" ) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX.cmake new file mode 100644 index 0000000..6bb1e44 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX.cmake @@ -0,0 +1,49 @@ + +cmake_minimum_required(VERSION 3.14) + +enable_language (C) + +set (win_platforms Windows CYGWIN) + +set (GENERATE_CONTENT [[ +macro (CHECK_VALUE test_msg value expected) + if (NOT "${value}" STREQUAL "${expected}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [${value}]\nbut expected:\n [${expected}]\n") + endif() +endmacro() +]]) + +add_executable (exec1 empty.c) +add_library (shared1 SHARED empty.c) +add_library (static1 STATIC empty.c) + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_FILE_PREFIX executable default\" \"$\" \"\") +check_value (\"TARGET_FILE_PREFIX shared default\" \"$\" \"${CMAKE_SHARED_LIBRARY_PREFIX}\") +check_value (\"TARGET_LINKER_FILE_PREFIX shared linker default\" \"$\" \"$,${win_platforms}>,${CMAKE_IMPORT_LIBRARY_PREFIX},${CMAKE_SHARED_LIBRARY_PREFIX}>\") +check_value (\"TARGET_FILE_PREFIX static default\" \"$\" \"${CMAKE_STATIC_LIBRARY_PREFIX}\") +check_value (\"TARGET_LINKER_FILE_PREFIX static linker default\" \"$\" \"${CMAKE_STATIC_LIBRARY_PREFIX}\")\n") + + +add_executable (exec2 empty.c) +set_property (TARGET exec2 PROPERTY PREFIX exec2_prefix) +set_property (TARGET exec2 PROPERTY ENABLE_EXPORTS TRUE) +set_property (TARGET exec2 PROPERTY IMPORT_PREFIX exec2_import_prefix) +add_library (shared2 SHARED empty.c) +set_property (TARGET shared2 PROPERTY PREFIX shared2_prefix) +set_property (TARGET shared2 PROPERTY IMPORT_PREFIX shared2_import_prefix) +add_library (static2 STATIC empty.c) +set_property (TARGET static2 PROPERTY PREFIX static2_prefix) +set_property (TARGET static2 PROPERTY IMPORT_PREFIX static2_import_prefix) + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_FILE_PREFIX executable custom\" \"$\" \"exec2_prefix\") +check_value (\"TARGET_LINKER_FILE_PREFIX executable linker custom\" \"$\" \"$,${win_platforms}>,exec2_import_prefix,exec2_prefix>\") +check_value (\"TARGET_FILE_PREFIX shared custom\" \"$\" \"shared2_prefix\") +check_value (\"TARGET_LINKER_FILE_PREFIX shared linker custom\" \"$\" \"$,${win_platforms}>,shared2_import_prefix,shared2_prefix>\") +check_value (\"TARGET_FILE_PREFIX static custom\" \"$\" \"static2_prefix\") +check_value (\"TARGET_LINKER_FILE_PREFIX static linker custom\" \"$\" \"static2_prefix\")\n") + + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_FILE_PREFIX-generated.cmake" + CONTENT "${GENERATE_CONTENT}") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-check.cmake new file mode 100644 index 0000000..f159370 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-check.cmake @@ -0,0 +1,2 @@ + +include ("${RunCMake_TEST_BINARY_DIR}/TARGET_FILE_SUFFIX-generated.cmake") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-imported-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-imported-target-check.cmake new file mode 100644 index 0000000..f159370 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-imported-target-check.cmake @@ -0,0 +1,2 @@ + +include ("${RunCMake_TEST_BINARY_DIR}/TARGET_FILE_SUFFIX-generated.cmake") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-imported-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-imported-target.cmake new file mode 100644 index 0000000..e1b7654 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-imported-target.cmake @@ -0,0 +1,49 @@ + +cmake_minimum_required(VERSION 3.14) + +enable_language (C) + +set (win_platforms Windows CYGWIN) + +set (GENERATE_CONTENT [[ +macro (CHECK_VALUE test_msg value expected) + if (NOT "${value}" STREQUAL "${expected}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [${value}]\nbut expected:\n [${expected}]\n") + endif() +endmacro() +]]) + +add_executable (exec1 IMPORTED) +add_library (shared1 SHARED IMPORTED) +add_library (static1 STATIC IMPORTED) + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_FILE_SUFFIX executable default\" \"$\" \"${CMAKE_EXECUTABLE_SUFFIX}\") +check_value (\"TARGET_FILE_SUFFIX shared default\" \"$\" \"${CMAKE_SHARED_LIBRARY_SUFFIX}\") +check_value (\"TARGET_LINKER_FILE_SUFFIX shared linker default\" \"$\" \"$,${win_platforms}>,${CMAKE_IMPORT_LIBRARY_SUFFIX},${CMAKE_SHARED_LIBRARY_SUFFIX}>\") +check_value (\"TARGET_FILE_SUFFIX static default\" \"$\" \"${CMAKE_STATIC_LIBRARY_SUFFIX}\") +check_value (\"TARGET_LINKER_FILE_SUFFIX static linker default\" \"$\" \"${CMAKE_STATIC_LIBRARY_SUFFIX}\")\n") + + +add_executable (exec2 IMPORTED) +set_property (TARGET exec2 PROPERTY SUFFIX exec2_suffix) +set_property (TARGET exec2 PROPERTY ENABLE_EXPORTS TRUE) +set_property (TARGET exec2 PROPERTY IMPORT_SUFFIX exec2_import_suffix) +add_library (shared2 SHARED IMPORTED) +set_property (TARGET shared2 PROPERTY SUFFIX shared2_suffix) +set_property (TARGET shared2 PROPERTY IMPORT_SUFFIX shared2_import_suffix) +add_library (static2 STATIC IMPORTED) +set_property (TARGET static2 PROPERTY SUFFIX static2_suffix) +set_property (TARGET static2 PROPERTY IMPORT_SUFFIX static2_import_suffix) + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_FILE_SUFFIX executable custom\" \"$\" \"exec2_suffix\") +check_value (\"TARGET_LINKER_FILE_SUFFIX executable linker custom\" \"$\" \"$,${win_platforms}>,exec2_import_suffix,exec2_suffix>\") +check_value (\"TARGET_FILE_SUFFIX shared custom\" \"$\" \"shared2_suffix\") +check_value (\"TARGET_LINKER_FILE_SUFFIX shared linker custom\" \"$\" \"$,${win_platforms}>,shared2_import_suffix,shared2_suffix>\") +check_value (\"TARGET_FILE_SUFFIX static custom\" \"$\" \"static2_suffix\") +check_value (\"TARGET_LINKER_FILE_SUFFIX static linker custom\" \"$\" \"static2_suffix\")\n") + + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_FILE_SUFFIX-generated.cmake" + CONTENT "${GENERATE_CONTENT}") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-non-valid-target-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-non-valid-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-non-valid-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-non-valid-target-stderr.txt new file mode 100644 index 0000000..9ea09d1 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-non-valid-target-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at TARGET_FILE_SUFFIX-non-valid-target.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$ + + Target "empty" is not an executable or library\. diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-non-valid-target.cmake similarity index 59% copy from Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake copy to Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-non-valid-target.cmake index 2ff733c..f7089f9 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-non-valid-target.cmake @@ -1,9 +1,7 @@ -enable_language(C) - add_custom_target(empty) file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" - CONTENT "[$]" + CONTENT "[$]" ) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX.cmake new file mode 100644 index 0000000..78afecd --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX.cmake @@ -0,0 +1,49 @@ + +cmake_minimum_required(VERSION 3.14) + +enable_language (C) + +set (win_platforms Windows CYGWIN) + +set (GENERATE_CONTENT [[ +macro (CHECK_VALUE test_msg value expected) + if (NOT "${value}" STREQUAL "${expected}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [${value}]\nbut expected:\n [${expected}]\n") + endif() +endmacro() +]]) + +add_executable (exec1 empty.c) +add_library (shared1 SHARED empty.c) +add_library (static1 STATIC empty.c) + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_FILE_SUFFIX executable default\" \"$\" \"${CMAKE_EXECUTABLE_SUFFIX}\") +check_value (\"TARGET_FILE_SUFFIX shared default\" \"$\" \"${CMAKE_SHARED_LIBRARY_SUFFIX}\") +check_value (\"TARGET_LINKER_FILE_SUFFIX shared linker default\" \"$\" \"$,${win_platforms}>,${CMAKE_IMPORT_LIBRARY_SUFFIX},${CMAKE_SHARED_LIBRARY_SUFFIX}>\") +check_value (\"TARGET_FILE_SUFFIX static default\" \"$\" \"${CMAKE_STATIC_LIBRARY_SUFFIX}\") +check_value (\"TARGET_LINKER_FILE_SUFFIX static linker default\" \"$\" \"${CMAKE_STATIC_LIBRARY_SUFFIX}\")\n") + + +add_executable (exec2 empty.c) +set_property (TARGET exec2 PROPERTY SUFFIX exec2_suffix) +set_property (TARGET exec2 PROPERTY ENABLE_EXPORTS TRUE) +set_property (TARGET exec2 PROPERTY IMPORT_SUFFIX exec2_import_suffix) +add_library (shared2 SHARED empty.c) +set_property (TARGET shared2 PROPERTY SUFFIX shared2_suffix) +set_property (TARGET shared2 PROPERTY IMPORT_SUFFIX shared2_import_suffix) +add_library (static2 STATIC empty.c) +set_property (TARGET static2 PROPERTY SUFFIX static2_suffix) +set_property (TARGET static2 PROPERTY IMPORT_SUFFIX static2_import_suffix) + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_FILE_SUFFIX executable custom\" \"$\" \"exec2_suffix\") +check_value (\"TARGET_LINKER_FILE_SUFFIX executable linker custom\" \"$\" \"$,${win_platforms}>,exec2_import_suffix,exec2_suffix>\") +check_value (\"TARGET_FILE_SUFFIX shared custom\" \"$\" \"shared2_suffix\") +check_value (\"TARGET_LINKER_FILE_SUFFIX shared linker custom\" \"$\" \"$,${win_platforms}>,shared2_import_suffix,shared2_suffix>\") +check_value (\"TARGET_FILE_SUFFIX static custom\" \"$\" \"static2_suffix\") +check_value (\"TARGET_LINKER_FILE_SUFFIX static linker custom\" \"$\" \"static2_suffix\")\n") + + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_FILE_SUFFIX-generated.cmake" + CONTENT "${GENERATE_CONTENT}") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_PREFIX-non-valid-target-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_PREFIX-non-valid-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_PREFIX-non-valid-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_PREFIX-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_PREFIX-non-valid-target-stderr.txt new file mode 100644 index 0000000..7a36cef --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_PREFIX-non-valid-target-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at TARGET_LINKER_FILE_PREFIX-non-valid-target.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$ + + Target "empty" is not an executable or library\. diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_PREFIX-non-valid-target.cmake similarity index 59% copy from Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake copy to Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_PREFIX-non-valid-target.cmake index 2ff733c..8dad4da 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_PREFIX-non-valid-target.cmake @@ -1,9 +1,7 @@ -enable_language(C) - add_custom_target(empty) file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" - CONTENT "[$]" + CONTENT "[$]" ) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_SUFFIX-non-valid-target-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_SUFFIX-non-valid-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_SUFFIX-non-valid-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_SUFFIX-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_SUFFIX-non-valid-target-stderr.txt new file mode 100644 index 0000000..cc5217a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_SUFFIX-non-valid-target-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at TARGET_LINKER_FILE_SUFFIX-non-valid-target.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$ + + Target "empty" is not an executable or library\. diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_SUFFIX-non-valid-target.cmake similarity index 59% copy from Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake copy to Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_SUFFIX-non-valid-target.cmake index 2ff733c..82c2f3a 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_SUFFIX-non-valid-target.cmake @@ -1,9 +1,7 @@ -enable_language(C) - add_custom_target(empty) file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" - CONTENT "[$]" + CONTENT "[$]" ) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-stderr.txt index 29f6211..0e09469 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake:6 \(file\): +CMake Error at TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake:[0-9]+ \(file\): Error evaluating generator expression: \$ diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake index e1496b4..c439535 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake @@ -1,6 +1,4 @@ -enable_language(C) - add_custom_target(empty) file(GENERATE diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-stderr.txt index e78ec01..9672a99 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at TARGET_OUTPUT_NAME-non-valid-target.cmake:6 \(file\): +CMake Error at TARGET_OUTPUT_NAME-non-valid-target.cmake:[0-9]+ \(file\): Error evaluating generator expression: \$ diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake index 2ff733c..5248dfa 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake +++ b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake @@ -1,6 +1,4 @@ -enable_language(C) - add_custom_target(empty) file(GENERATE https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f65763fe9be16ccded53f26dda257fdb028cccf6 commit f65763fe9be16ccded53f26dda257fdb028cccf6 Author: Marc Chevrier AuthorDate: Wed Apr 10 17:52:11 2019 +0200 Commit: Marc Chevrier CommitDate: Wed Apr 10 18:37:03 2019 +0200 Refactor: Add new methods to retrieve prefix and suffix diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index f8c16cc..3fb95bf 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -464,6 +464,134 @@ std::string cmGeneratorTarget::GetOutputName( return i->second; } +std::string cmGeneratorTarget::GetFilePrefix( + const std::string& config, cmStateEnums::ArtifactType artifact) const +{ + if (this->IsImported()) { + const char* prefix = this->GetFilePrefixInternal(artifact); + + return prefix ? prefix : std::string(); + } + + std::string prefix, suffix, base; + this->GetFullNameInternal(config, artifact, prefix, base, suffix); + return prefix; +} +std::string cmGeneratorTarget::GetFileSuffix( + const std::string& config, cmStateEnums::ArtifactType artifact) const +{ + if (this->IsImported()) { + const char* suffix = this->GetFileSuffixInternal(artifact); + + return suffix ? suffix : std::string(); + } + + std::string prefix, suffix, base; + this->GetFullNameInternal(config, artifact, prefix, base, suffix); + return suffix; +} + +const char* cmGeneratorTarget::GetFilePrefixInternal( + cmStateEnums::ArtifactType artifact, const std::string& language) const +{ + // no prefix for non-main target types. + if (this->GetType() != cmStateEnums::STATIC_LIBRARY && + this->GetType() != cmStateEnums::SHARED_LIBRARY && + this->GetType() != cmStateEnums::MODULE_LIBRARY && + this->GetType() != cmStateEnums::EXECUTABLE) { + return nullptr; + } + + const bool isImportedLibraryArtifact = + (artifact == cmStateEnums::ImportLibraryArtifact); + + // Return an empty prefix for the import library if this platform + // does not support import libraries. + if (isImportedLibraryArtifact && + !this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX")) { + return nullptr; + } + + // The implib option is only allowed for shared libraries, module + // libraries, and executables. + if (this->GetType() != cmStateEnums::SHARED_LIBRARY && + this->GetType() != cmStateEnums::MODULE_LIBRARY && + this->GetType() != cmStateEnums::EXECUTABLE) { + artifact = cmStateEnums::RuntimeBinaryArtifact; + } + + // Compute prefix value. + const char* targetPrefix = + (isImportedLibraryArtifact ? this->GetProperty("IMPORT_PREFIX") + : this->GetProperty("PREFIX")); + + if (!targetPrefix) { + const char* prefixVar = this->Target->GetPrefixVariableInternal(artifact); + if (!language.empty() && prefixVar && *prefixVar) { + std::string langPrefix = prefixVar + std::string("_") + language; + targetPrefix = this->Makefile->GetDefinition(langPrefix); + } + + // if there is no prefix on the target nor specific language + // use the cmake definition. + if (!targetPrefix && prefixVar) { + targetPrefix = this->Makefile->GetDefinition(prefixVar); + } + } + + return targetPrefix; +} +const char* cmGeneratorTarget::GetFileSuffixInternal( + cmStateEnums::ArtifactType artifact, const std::string& language) const +{ + // no suffix for non-main target types. + if (this->GetType() != cmStateEnums::STATIC_LIBRARY && + this->GetType() != cmStateEnums::SHARED_LIBRARY && + this->GetType() != cmStateEnums::MODULE_LIBRARY && + this->GetType() != cmStateEnums::EXECUTABLE) { + return nullptr; + } + + const bool isImportedLibraryArtifact = + (artifact == cmStateEnums::ImportLibraryArtifact); + + // Return an empty suffix for the import library if this platform + // does not support import libraries. + if (isImportedLibraryArtifact && + !this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX")) { + return nullptr; + } + + // The implib option is only allowed for shared libraries, module + // libraries, and executables. + if (this->GetType() != cmStateEnums::SHARED_LIBRARY && + this->GetType() != cmStateEnums::MODULE_LIBRARY && + this->GetType() != cmStateEnums::EXECUTABLE) { + artifact = cmStateEnums::RuntimeBinaryArtifact; + } + + // Compute suffix value. + const char* targetSuffix = + (isImportedLibraryArtifact ? this->GetProperty("IMPORT_SUFFIX") + : this->GetProperty("SUFFIX")); + + if (!targetSuffix) { + const char* suffixVar = this->Target->GetSuffixVariableInternal(artifact); + if (!language.empty() && suffixVar && *suffixVar) { + std::string langSuffix = suffixVar + std::string("_") + language; + targetSuffix = this->Makefile->GetDefinition(langSuffix); + } + + // if there is no suffix on the target nor specific language + // use the cmake definition. + if (!targetSuffix && suffixVar) { + targetSuffix = this->Makefile->GetDefinition(suffixVar); + } + } + + return targetSuffix; +} + void cmGeneratorTarget::ClearSourcesCache() { this->KindedSourcesMap.clear(); @@ -3788,6 +3916,11 @@ void cmGeneratorTarget::GetFullNameInternal( return; } + // retrieve prefix and suffix + std::string ll = this->GetLinkerLanguage(config); + const char* targetPrefix = this->GetFilePrefixInternal(artifact, ll); + const char* targetSuffix = this->GetFileSuffixInternal(artifact, ll); + // The implib option is only allowed for shared libraries, module // libraries, and executables. if (this->GetType() != cmStateEnums::SHARED_LIBRARY && @@ -3797,12 +3930,6 @@ void cmGeneratorTarget::GetFullNameInternal( } // Compute the full name for main target types. - const char* targetPrefix = - (isImportedLibraryArtifact ? this->GetProperty("IMPORT_PREFIX") - : this->GetProperty("PREFIX")); - const char* targetSuffix = - (isImportedLibraryArtifact ? this->GetProperty("IMPORT_SUFFIX") - : this->GetProperty("SUFFIX")); const char* configPostfix = nullptr; if (!config.empty()) { std::string configProp = cmSystemTools::UpperCase(config); @@ -3814,30 +3941,6 @@ void cmGeneratorTarget::GetFullNameInternal( configPostfix = nullptr; } } - const char* prefixVar = this->Target->GetPrefixVariableInternal(artifact); - const char* suffixVar = this->Target->GetSuffixVariableInternal(artifact); - - // Check for language-specific default prefix and suffix. - std::string ll = this->GetLinkerLanguage(config); - if (!ll.empty()) { - if (!targetSuffix && suffixVar && *suffixVar) { - std::string langSuff = suffixVar + std::string("_") + ll; - targetSuffix = this->Makefile->GetDefinition(langSuff); - } - if (!targetPrefix && prefixVar && *prefixVar) { - std::string langPrefix = prefixVar + std::string("_") + ll; - targetPrefix = this->Makefile->GetDefinition(langPrefix); - } - } - - // if there is no prefix on the target use the cmake definition - if (!targetPrefix && prefixVar) { - targetPrefix = this->Makefile->GetSafeDefinition(prefixVar).c_str(); - } - // if there is no suffix on the target use the cmake definition - if (!targetSuffix && suffixVar) { - targetSuffix = this->Makefile->GetSafeDefinition(suffixVar).c_str(); - } // frameworks have directory prefix but no suffix std::string fw_prefix; diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 065b457..81f5255 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -534,6 +534,15 @@ public: std::string GetOutputName(const std::string& config, cmStateEnums::ArtifactType artifact) const; + /** Get target file prefix */ + std::string GetFilePrefix(const std::string& config, + cmStateEnums::ArtifactType artifact = + cmStateEnums::RuntimeBinaryArtifact) const; + /** Get target file prefix */ + std::string GetFileSuffix(const std::string& config, + cmStateEnums::ArtifactType artifact = + cmStateEnums::RuntimeBinaryArtifact) const; + /** Clears cached meta data for local and external source files. * The meta data will be recomputed on demand. */ @@ -728,6 +737,11 @@ private: mutable std::map DebugCompatiblePropertiesDone; + const char* GetFilePrefixInternal(cmStateEnums::ArtifactType artifact, + const std::string& language = "") const; + const char* GetFileSuffixInternal(cmStateEnums::ArtifactType artifact, + const std::string& language = "") const; + std::string GetFullNameInternal(const std::string& config, cmStateEnums::ArtifactType artifact) const; void GetFullNameInternal(const std::string& config, ----------------------------------------------------------------------- Summary of changes: Help/command/add_library.rst | 17 ++- Help/command/install.rst | 6 +- Help/manual/cmake-generator-expressions.7.rst | 23 ++- Help/release/dev/genex-TARGET_FILE_PREFIX.rst | 7 + Help/release/dev/iface-headers.rst | 7 + Source/cmGeneratorExpressionNode.cxx | 117 +++++++++++++++ Source/cmGeneratorTarget.cxx | 163 +++++++++++++++++---- Source/cmGeneratorTarget.h | 14 ++ Source/cmInstallCommand.cxx | 3 +- Source/cmTargetPropertyComputer.cxx | 2 + .../GeneratorExpression/RunCMakeTest.cmake | 8 + .../TARGET_FILE_PREFIX-check.cmake | 2 + .../TARGET_FILE_PREFIX-imported-target-check.cmake | 2 + .../TARGET_FILE_PREFIX-imported-target.cmake | 49 +++++++ ...TARGET_FILE_PREFIX-non-valid-target-result.txt} | 0 .../TARGET_FILE_PREFIX-non-valid-target-stderr.txt | 6 + ...e => TARGET_FILE_PREFIX-non-valid-target.cmake} | 4 +- .../GeneratorExpression/TARGET_FILE_PREFIX.cmake | 49 +++++++ .../TARGET_FILE_SUFFIX-check.cmake | 2 + .../TARGET_FILE_SUFFIX-imported-target-check.cmake | 2 + .../TARGET_FILE_SUFFIX-imported-target.cmake | 49 +++++++ ...TARGET_FILE_SUFFIX-non-valid-target-result.txt} | 0 .../TARGET_FILE_SUFFIX-non-valid-target-stderr.txt | 6 + ...e => TARGET_FILE_SUFFIX-non-valid-target.cmake} | 4 +- .../GeneratorExpression/TARGET_FILE_SUFFIX.cmake | 49 +++++++ ...LINKER_FILE_PREFIX-non-valid-target-result.txt} | 0 ..._LINKER_FILE_PREFIX-non-valid-target-stderr.txt | 6 + ...RGET_LINKER_FILE_PREFIX-non-valid-target.cmake} | 4 +- ...LINKER_FILE_SUFFIX-non-valid-target-result.txt} | 0 ..._LINKER_FILE_SUFFIX-non-valid-target-stderr.txt | 6 + ...RGET_LINKER_FILE_SUFFIX-non-valid-target.cmake} | 4 +- ..._LINKER_OUTPUT_NAME-non-valid-target-stderr.txt | 2 +- ...ARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake | 2 - .../TARGET_OUTPUT_NAME-non-valid-target-stderr.txt | 2 +- .../TARGET_OUTPUT_NAME-non-valid-target.cmake | 2 - .../install/TARGETS-Defaults-all-check.cmake | 6 + Tests/RunCMake/install/TARGETS-Defaults.cmake | 8 + Tests/RunCMake/install/obj2.h | 6 + Tests/RunCMake/interface_library/whitelist.cmake | 9 ++ 39 files changed, 588 insertions(+), 60 deletions(-) create mode 100644 Help/release/dev/genex-TARGET_FILE_PREFIX.rst create mode 100644 Help/release/dev/iface-headers.rst create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-check.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-imported-target-check.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-imported-target.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => GeneratorExpression/TARGET_FILE_PREFIX-non-valid-target-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-non-valid-target-stderr.txt copy Tests/RunCMake/GeneratorExpression/{TARGET_OUTPUT_NAME-non-valid-target.cmake => TARGET_FILE_PREFIX-non-valid-target.cmake} (59%) create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-check.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-imported-target-check.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-imported-target.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => GeneratorExpression/TARGET_FILE_SUFFIX-non-valid-target-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-non-valid-target-stderr.txt copy Tests/RunCMake/GeneratorExpression/{TARGET_OUTPUT_NAME-non-valid-target.cmake => TARGET_FILE_SUFFIX-non-valid-target.cmake} (59%) create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => GeneratorExpression/TARGET_LINKER_FILE_PREFIX-non-valid-target-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_PREFIX-non-valid-target-stderr.txt copy Tests/RunCMake/GeneratorExpression/{TARGET_OUTPUT_NAME-non-valid-target.cmake => TARGET_LINKER_FILE_PREFIX-non-valid-target.cmake} (59%) copy Tests/RunCMake/{while/MissingArgument-result.txt => GeneratorExpression/TARGET_LINKER_FILE_SUFFIX-non-valid-target-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_SUFFIX-non-valid-target-stderr.txt copy Tests/RunCMake/GeneratorExpression/{TARGET_OUTPUT_NAME-non-valid-target.cmake => TARGET_LINKER_FILE_SUFFIX-non-valid-target.cmake} (59%) create mode 100644 Tests/RunCMake/install/obj2.h hooks/post-receive -- CMake From kwrobot at kitware.com Fri Apr 12 11:23:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 12 Apr 2019 11:23:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.2-687-g7f83e80 Message-ID: <20190412152306.B1105113605@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 7f83e8033bd30ad112989f7dc17840fdf497586b (commit) via 239a8a026626449bb09508d88a650eb0faad2a97 (commit) from e3ebad7def73fa656069835e916db3245ab70a62 (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=7f83e8033bd30ad112989f7dc17840fdf497586b commit 7f83e8033bd30ad112989f7dc17840fdf497586b Merge: e3ebad7 239a8a0 Author: Brad King AuthorDate: Fri Apr 12 15:13:48 2019 +0000 Commit: Kitware Robot CommitDate: Fri Apr 12 11:13:59 2019 -0400 Merge topic 'memorize_cxx_compilers_with_full_98_support' 239a8a0266 CompileFeatures: Record when CXX compilers have gained full support for 98 Acked-by: Kitware Robot Merge-request: !3213 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=239a8a026626449bb09508d88a650eb0faad2a97 commit 239a8a026626449bb09508d88a650eb0faad2a97 Author: Robert Maynard AuthorDate: Wed Apr 10 09:40:36 2019 -0400 Commit: Brad King CommitDate: Thu Apr 11 11:20:48 2019 -0400 CompileFeatures: Record when CXX compilers have gained full support for 98 Use the infrastructure added by commit 646fb1a646 (CompileFeatures: memoize C++ compilers with full language level support, 2019-03-27) to avoid using a `try_compile` to check for C++98 feature support when the running compiler is known to have all features. diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake index e5fd647..d34d494 100644 --- a/Modules/Compiler/AppleClang-CXX.cmake +++ b/Modules/Compiler/AppleClang-CXX.cmake @@ -8,6 +8,7 @@ endif() if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98") set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98") + set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11") diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index e99011b..34ffd66 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -19,6 +19,7 @@ if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.1) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11") + set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2.1) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++0x") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++0x") @@ -59,6 +60,7 @@ elseif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 3.9 # support for -std: flags. set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "") + set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "") set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std:c++14") diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake index 0058223..7202607 100644 --- a/Modules/Compiler/GNU-CXX.cmake +++ b/Modules/Compiler/GNU-CXX.cmake @@ -19,6 +19,7 @@ endif() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11") + set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) # 4.3 supports 0x variants set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++0x") diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake index c115b6a..471dd4a 100644 --- a/Modules/Compiler/Intel-CXX.cmake +++ b/Modules/Compiler/Intel-CXX.cmake @@ -30,6 +30,7 @@ if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "") + set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) endif() else() @@ -64,6 +65,7 @@ else() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98") set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98") + set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) endif() endif() diff --git a/Modules/Compiler/MSVC-CXX.cmake b/Modules/Compiler/MSVC-CXX.cmake index be259ff..691926f 100644 --- a/Modules/Compiler/MSVC-CXX.cmake +++ b/Modules/Compiler/MSVC-CXX.cmake @@ -11,6 +11,7 @@ if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0.24215.1 AND # with the default and minimum level being C++14. set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "") + set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "") set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std:c++14") diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake index 5ce58b2..c2f6d1d 100644 --- a/Modules/Compiler/SunPro-CXX.cmake +++ b/Modules/Compiler/SunPro-CXX.cmake @@ -48,6 +48,7 @@ set(CMAKE_CXX_CREATE_STATIC_LIBRARY if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++03") set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=c++03") + set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=c++11") set(CMAKE_CXX_LINK_WITH_STANDARD_COMPILE_OPTION 1) ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/AppleClang-CXX.cmake | 1 + Modules/Compiler/Clang-CXX.cmake | 2 ++ Modules/Compiler/GNU-CXX.cmake | 1 + Modules/Compiler/Intel-CXX.cmake | 2 ++ Modules/Compiler/MSVC-CXX.cmake | 1 + Modules/Compiler/SunPro-CXX.cmake | 1 + 6 files changed, 8 insertions(+) hooks/post-receive -- CMake From kwrobot at kitware.com Sat Apr 13 00:03:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 13 Apr 2019 00:03:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.2-688-ge59e17c Message-ID: <20190413040306.D8FAD103335@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 e59e17c1c7059b7d0f02d6b12bc3094a2afee778 (commit) from 7f83e8033bd30ad112989f7dc17840fdf497586b (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=e59e17c1c7059b7d0f02d6b12bc3094a2afee778 commit e59e17c1c7059b7d0f02d6b12bc3094a2afee778 Author: Kitware Robot AuthorDate: Sat Apr 13 00:01:12 2019 -0400 Commit: Kitware Robot CommitDate: Sat Apr 13 00:01:12 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 70c44e1..3346c16 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 14) -set(CMake_VERSION_PATCH 20190412) +set(CMake_VERSION_PATCH 20190413) #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 Apr 14 00:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 14 Apr 2019 00:03:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.2-689-g9194e9a Message-ID: <20190414040305.39214FA790@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 9194e9a78268e8976b1de7d7c421018e4530f0a2 (commit) from e59e17c1c7059b7d0f02d6b12bc3094a2afee778 (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=9194e9a78268e8976b1de7d7c421018e4530f0a2 commit 9194e9a78268e8976b1de7d7c421018e4530f0a2 Author: Kitware Robot AuthorDate: Sun Apr 14 00:01:03 2019 -0400 Commit: Kitware Robot CommitDate: Sun Apr 14 00:01:03 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 3346c16..3bb36eb 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 14) -set(CMake_VERSION_PATCH 20190413) +set(CMake_VERSION_PATCH 20190414) #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 Apr 15 00:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 15 Apr 2019 00:03:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.2-690-gef9c38c Message-ID: <20190415040305.B14FFFE699@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 ef9c38ccf8b6bf12e8d8b539a316a304076948c8 (commit) from 9194e9a78268e8976b1de7d7c421018e4530f0a2 (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=ef9c38ccf8b6bf12e8d8b539a316a304076948c8 commit ef9c38ccf8b6bf12e8d8b539a316a304076948c8 Author: Kitware Robot AuthorDate: Mon Apr 15 00:01:03 2019 -0400 Commit: Kitware Robot CommitDate: Mon Apr 15 00:01:03 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 3bb36eb..4e7e400 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 14) -set(CMake_VERSION_PATCH 20190414) +set(CMake_VERSION_PATCH 20190415) #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 Apr 15 10:53:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 15 Apr 2019 10:53:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.2-705-g0793464 Message-ID: <20190415145306.9A89011DF56@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 0793464d95c3dbbe9ed87bb5882d29efb7a8e3c3 (commit) via e2128e11ac7ac38f33100f5277cb4ace8697bad8 (commit) via 6aab5e0ef9b95933495042f3e2dab64c3c002f37 (commit) via a6bf68141faca9af22624c8d0e1603653a73fce4 (commit) via 032e969879f4362471eb4a952b28aae6fd5a8116 (commit) via 717e85418b068734dd9d8d0aa3063ec4e363fcbf (commit) via 9010f5c18a60ce034fb547d98a19585326aadba1 (commit) via 2bae6a1346cb95703a93dbf73c9689598c9056d1 (commit) via 3b415c60c1a02b9ac76089a44c28e70692dcdef1 (commit) via 83c47ef5b8a6b1a63edbd82092d8eae68da453d6 (commit) via 5d2e1404bdfa83eeae5b361bd7d8a882aadc7242 (commit) via b6bfa7eeb29937fbed44153518abfa4f28b9aa62 (commit) via 39ee9718d9a56e7b8b15f63576f042415a2771f8 (commit) via 8d3dad9a76591ae0426335d039b8aaacb95862cd (commit) via 37acc9e2299713b9b23c767e72b0e0169697e510 (commit) from ef9c38ccf8b6bf12e8d8b539a316a304076948c8 (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=0793464d95c3dbbe9ed87bb5882d29efb7a8e3c3 commit 0793464d95c3dbbe9ed87bb5882d29efb7a8e3c3 Merge: e2128e1 2bae6a1 Author: Brad King AuthorDate: Mon Apr 15 14:52:11 2019 +0000 Commit: Kitware Robot CommitDate: Mon Apr 15 10:52:21 2019 -0400 Merge topic 'ghs_custom' 2bae6a1346 GHS: Update tests and notes 3b415c60c1 GHS: Update ExternalProject for GHS tools 83c47ef5b8 GHS: Update project layout to accommodate gbuild inconsistencies 5d2e1404bd GHS: Update project layout to build targets correctly b6bfa7eeb2 GHS: Support add_dependencies() command 39ee9718d9 GHS: Support add_custom_target() command 8d3dad9a76 GHS: Support add_custom_command( OUTPUT ) signature 37acc9e229 GHS: Update custom command build events Acked-by: Kitware Robot Acked-by: Narendhar Manimohan Merge-request: !3119 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e2128e11ac7ac38f33100f5277cb4ace8697bad8 commit e2128e11ac7ac38f33100f5277cb4ace8697bad8 Merge: 6aab5e0 a6bf681 Author: Brad King AuthorDate: Mon Apr 15 10:51:08 2019 -0400 Commit: Brad King CommitDate: Mon Apr 15 10:51:08 2019 -0400 Merge branch 'release-3.14' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6aab5e0ef9b95933495042f3e2dab64c3c002f37 commit 6aab5e0ef9b95933495042f3e2dab64c3c002f37 Merge: ef9c38c 032e969 Author: Brad King AuthorDate: Mon Apr 15 14:49:46 2019 +0000 Commit: Kitware Robot CommitDate: Mon Apr 15 10:49:54 2019 -0400 Merge topic 'FindBoost-msvc-toolset-14.2' 032e969879 Merge branch 'backport-FindBoost-msvc-toolset-14.2' 717e85418b FindBoost: Add support for MSVC toolset version 14.2 9010f5c18a FindBoost: Add support for MSVC toolset version 14.2 Acked-by: Kitware Robot Merge-request: !3221 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=032e969879f4362471eb4a952b28aae6fd5a8116 commit 032e969879f4362471eb4a952b28aae6fd5a8116 Merge: 717e854 9010f5c Author: Brad King AuthorDate: Fri Apr 12 11:37:51 2019 -0400 Commit: Brad King CommitDate: Fri Apr 12 11:37:51 2019 -0400 Merge branch 'backport-FindBoost-msvc-toolset-14.2' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=717e85418b068734dd9d8d0aa3063ec4e363fcbf commit 717e85418b068734dd9d8d0aa3063ec4e363fcbf Author: Brad King AuthorDate: Fri Apr 12 09:48:20 2019 -0400 Commit: Brad King CommitDate: Fri Apr 12 11:35:19 2019 -0400 FindBoost: Add support for MSVC toolset version 14.2 Generalize the logic to express compatibility among 14.x versions. diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 53be493..c30c6c8 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -466,8 +466,17 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret) elseif (GHSMULTI) set(_boost_COMPILER "-ghs") elseif("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC" OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") - if(MSVC_TOOLSET_VERSION GREATER_EQUAL 141) - set(_boost_COMPILER "-vc141;-vc140") + if(MSVC_TOOLSET_VERSION GREATER_EQUAL 150) + # Not yet known. + set(_boost_COMPILER "") + elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 140) + # MSVC toolset 14.x versions are forward compatible. + set(_boost_COMPILER "") + foreach(v 9 8 7 6 5 4 3 2 1 0) + if(MSVC_TOOLSET_VERSION GREATER_EQUAL 14${v}) + list(APPEND _boost_COMPILER "-vc14${v}") + endif() + endforeach() elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 80) set(_boost_COMPILER "-vc${MSVC_TOOLSET_VERSION}") elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.10) @@ -1083,9 +1092,15 @@ function(_Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS component else() set(_arch_suffix 32) endif() - if(MSVC_TOOLSET_VERSION GREATER_EQUAL 141) - list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.1) - list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.0) + if(MSVC_TOOLSET_VERSION GREATER_EQUAL 150) + # Not yet known. + elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 140) + # MSVC toolset 14.x versions are forward compatible. + foreach(v 9 8 7 6 5 4 3 2 1 0) + if(MSVC_TOOLSET_VERSION GREATER_EQUAL 14${v}) + list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.${v}) + endif() + endforeach() elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 80) math(EXPR _toolset_major_version "${MSVC_TOOLSET_VERSION} / 10") list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-${_toolset_major_version}.0) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2bae6a1346cb95703a93dbf73c9689598c9056d1 commit 2bae6a1346cb95703a93dbf73c9689598c9056d1 Author: Fred Baksik AuthorDate: Mon Apr 8 09:55:35 2019 -0400 Commit: Fred Baksik CommitDate: Thu Apr 11 13:15:51 2019 -0400 GHS: Update tests and notes -- add new tests for custom commands -- minor test cleanup Fixes #15995 Fixes #18909 Fixes #15902 diff --git a/Help/release/dev/ghs-custom-commands.rst b/Help/release/dev/ghs-custom-commands.rst new file mode 100644 index 0000000..a29ef88 --- /dev/null +++ b/Help/release/dev/ghs-custom-commands.rst @@ -0,0 +1,5 @@ +ghs_custom_commands +------------------- + +* The :generator:`Green Hills MULTI` generator now supports + :command:`add_custom_command` and :command:`add_custom_target` diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 2d9b806..2e0902c 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2391,6 +2391,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_test_GhsMulti(compiler_options_kernel GhsMultiCompilerOptions Kernel "-DRUN_TEST=KERNEL_FLAGS -DRUN_TEST_BUILD_TYPE=DEBUG") add_test_GhsMulti(try_compile_copy GhsMultiCopyFile "" "") add_test_GhsMulti(ghs_platform GhsMultiPlatform "" "") + add_test_GhsMulti(custom_target GhsMultiCustomTarget "" "") + add_test_GhsMulti(dep_order GhsMultiDepOrder "" "") + add_test_GhsMulti(external_project GhsMultiExternalProject "" "") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/GhsMulti/${ghs_config_name}") #unset ghs config variables unset(ghs_config_name) diff --git a/Tests/GhsMulti/GhsMultiCustomTarget/CMakeLists.txt b/Tests/GhsMulti/GhsMultiCustomTarget/CMakeLists.txt new file mode 100644 index 0000000..93d668b --- /dev/null +++ b/Tests/GhsMulti/GhsMultiCustomTarget/CMakeLists.txt @@ -0,0 +1,110 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test C) + +# Tests assume no previous builds in the build directory +file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/build) + +macro (test_output) + if (BUILD_OUTPUT STREQUAL EXPECTED_LINES ) + message("Build OK") + else() + message("BUILD_OUTPUT") + foreach(Line IN LISTS BUILD_OUTPUT) + message("${Line}") + endforeach() + message("EXPECTED_LINES") + foreach(Line IN LISTS EXPECTED_LINES) + message("${Line}") + endforeach() + message(SEND_ERROR "Build KO") + endif() +endmacro() + +message("Copy project") +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in + ${CMAKE_CURRENT_BINARY_DIR}/src/CMakeLists.txt COPYONLY) + +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/exe1.c + ${CMAKE_CURRENT_SOURCE_DIR}/lib1.c + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src +) + +message("Building ALL target") +try_compile(RESULT + ${CMAKE_CURRENT_BINARY_DIR}/build + ${CMAKE_CURRENT_BINARY_DIR}/src + test + CMAKE_FLAGS + -DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS} + OUTPUT_VARIABLE BUILD_OUTPUT) + +message("Output from build:\n${BUILD_OUTPUT}") + +#filter outputs +string(REPLACE "\r" "" BUILD_OUTPUT "${BUILD_OUTPUT}") +string(REPLACE "\n" ";" BUILD_OUTPUT "${BUILD_OUTPUT}") +list(FILTER BUILD_OUTPUT INCLUDE REGEX "^.*CT:") + +unset(EXPECTED_LINES) +list(APPEND EXPECTED_LINES "CT: Processing target_empty_prebuild") +list(APPEND EXPECTED_LINES "CT: Processing target_empty_postbuild") +list(APPEND EXPECTED_LINES "CT: Processing target_cmd") +list(APPEND EXPECTED_LINES "CT: Processing target_cmd_prebuild") +list(APPEND EXPECTED_LINES "CT: Processing target_cmd_postbuild") + +test_output() + +message("Building target_update_files target") +try_compile(RESULT + ${CMAKE_CURRENT_BINARY_DIR}/build + ${CMAKE_CURRENT_BINARY_DIR}/src + test target_update_files + CMAKE_FLAGS + -DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS} + OUTPUT_VARIABLE BUILD_OUTPUT) + +message("Output from build:\n${BUILD_OUTPUT}") + +#filter outputs +string(REPLACE "\r" "" BUILD_OUTPUT "${BUILD_OUTPUT}") +string(REPLACE "\n" ";" BUILD_OUTPUT "${BUILD_OUTPUT}") +list(FILTER BUILD_OUTPUT INCLUDE REGEX "^.*CT:") + +unset(EXPECTED_LINES) +list(APPEND EXPECTED_LINES "CT: Processing target_empty_prebuild") +list(APPEND EXPECTED_LINES "CT: Processing target_empty_postbuild") +list(APPEND EXPECTED_LINES "CT: generate C file another_file") +list(APPEND EXPECTED_LINES "CT: generate text file dependsA") +list(APPEND EXPECTED_LINES "CT: generate text file out_of_order_dep") +list(APPEND EXPECTED_LINES "CT: generate text files A, B, and C") +list(APPEND EXPECTED_LINES "CT: Processing target_update_files") + +test_output() + +message("Rerun target_update_files target") +try_compile(RESULT + ${CMAKE_CURRENT_BINARY_DIR}/build + ${CMAKE_CURRENT_BINARY_DIR}/src + test target_update_files + CMAKE_FLAGS + -DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS} + OUTPUT_VARIABLE BUILD_OUTPUT) + +message("Output from build:\n${BUILD_OUTPUT}") + +#filter outputs +string(REPLACE "\r" "" BUILD_OUTPUT "${BUILD_OUTPUT}") +string(REPLACE "\n" ";" BUILD_OUTPUT "${BUILD_OUTPUT}") +list(FILTER BUILD_OUTPUT INCLUDE REGEX "^.*CT:") + +unset(EXPECTED_LINES) +list(APPEND EXPECTED_LINES "CT: Processing target_empty_prebuild") +list(APPEND EXPECTED_LINES "CT: Processing target_empty_postbuild") +list(APPEND EXPECTED_LINES "CT: generate text files A, B, and C") +list(APPEND EXPECTED_LINES "CT: Processing target_update_files") + +test_output() diff --git a/Tests/GhsMulti/GhsMultiCustomTarget/CMakeLists.txt.in b/Tests/GhsMulti/GhsMultiCustomTarget/CMakeLists.txt.in new file mode 100644 index 0000000..fed946c --- /dev/null +++ b/Tests/GhsMulti/GhsMultiCustomTarget/CMakeLists.txt.in @@ -0,0 +1,108 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test C) + +if(CMAKE_C_COMPILER_ID STREQUAL "GHS") + add_link_options("-non_shared") +endif() + +add_library(lib1 lib1.c) + +set(TEST_MISSING_TARGET_SRC 0) +set(TEST_MISSING_TARGET_DEP 0) +set(TEST_MISSING_DEP 0) +set(TEST_DEP_CYCLE 0) + +add_executable(exe1 exe1.c) +target_link_libraries(exe1 lib1) + +add_custom_target(target_cmd ALL + COMMAND ${CMAKE_COMMAND} -E echo "target_cmd" > target_cmd + COMMAND ${CMAKE_COMMAND} -E echo "target_cmd_extra" > target_cmd_extra.txt + BYPRODUCTS target_cmd target_cmd_extra.txt + COMMENT "CT: Processing target_cmd") + +add_custom_command(TARGET target_cmd PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E echo "target_cmd_prebuild" > target_cmd_prebuild.txt + BYPRODUCTS target_cmd_prebuild.txt + COMMENT "CT: Processing target_cmd_prebuild") +#event does not run for custom targets +add_custom_command(TARGET target_cmd PRE_LINK + COMMAND ${CMAKE_COMMAND} -E echo "executing target_cmd_prelink commands" + COMMAND ${CMAKE_COMMAND} -E echo "target_cmd_prelink" > target_cmd_prelink.txt + BYPRODUCTS target_cmd_prelink.txt + COMMENT "CT: Processing target_cmd_prelink") +add_custom_command(TARGET target_cmd POST_BUILD + COMMAND ${CMAKE_COMMAND} -E echo "executing target_cmd_postbuild commands" + COMMAND ${CMAKE_COMMAND} -E echo "target_cmd_postbuild" > target_cmd_postbuild.txt + BYPRODUCTS target_cmd_postbuild.txt + COMMENT "CT: Processing target_cmd_postbuild") + +add_custom_target(target_empty ALL + COMMENT "CT: Processing target_empty") + +add_custom_command(TARGET target_empty PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E echo "target_empty_prebuild" > target_empty_prebuild.txt + BYPRODUCTS target_empty_prebuild.txt + COMMENT "CT: Processing target_empty_prebuild") +add_custom_command(TARGET target_empty POST_BUILD + COMMAND ${CMAKE_COMMAND} -E echo "target_empty_postbuild" > target_empty_postbuild.txt + BYPRODUCTS target_empty_postbuild.txt + COMMENT "CT: Processing target_empty_postbuild") + +add_dependencies(target_cmd target_empty) + +add_custom_command( + OUTPUT out_of_order_dep.txt + COMMAND ${CMAKE_COMMAND} -E echo "out_of_order_dep" > out_of_order_dep.txt + COMMENT "CT: generate text file out_of_order_dep" + DEPENDS dependsA.txt +) + +if(TEST_MISSING_TARGET_SRC) + set(SRC_FILE does_not_exist) +endif() +if(TEST_MISSING_TARGET_DEP) + set(DEP_FILE does_not_exist) +endif() + +add_custom_target(target_update_files + DEPENDS genc_do_not_list.txt ${DEP_FILE} + SOURCES gena.txt genb.txt another_file.c ${SRC_FILE} + BYPRODUCTS junkit.txt + COMMAND ${CMAKE_COMMAND} -E copy another_file.c junkit.txt + COMMENT "CT: Processing target_update_files") + +add_custom_command( + OUTPUT force_rebuild gena.txt genb.txt genc_do_not_list.txt + COMMAND ${CMAKE_COMMAND} -E copy dependsA.txt gena.txt + COMMAND ${CMAKE_COMMAND} -E echo "genb" > genb.txt + COMMAND ${CMAKE_COMMAND} -E echo "genc" > genc_do_not_list.txt + DEPENDS out_of_order_dep.txt dependsA.txt + COMMENT "CT: generate text files A, B, and C" +) + +if(TEST_MISSING_DEP) + set(MISSING_DEP MISSING_DEP) +endif() +if(TEST_DEP_CYCLE) + set(DEP_CYCLE out_of_order_dep.txt) +endif() + +add_custom_command( + OUTPUT dependsA.txt + COMMAND ${CMAKE_COMMAND} -E echo "dependsA" > dependsA.txt + DEPENDS ${MISSING_DEP} ${DEP_CYCLE} another_file.c + COMMENT "CT: generate text file dependsA" +) + +add_custom_command( + OUTPUT another_file.c + COMMAND ${CMAKE_COMMAND} -E echo "//auto-gen file" > another_file.c + COMMENT "CT: generate C file another_file" +) + +add_dependencies(target_update_files target_empty) diff --git a/Tests/GhsMulti/GhsMultiCustomTarget/exe1.c b/Tests/GhsMulti/GhsMultiCustomTarget/exe1.c new file mode 100644 index 0000000..29ad70a --- /dev/null +++ b/Tests/GhsMulti/GhsMultiCustomTarget/exe1.c @@ -0,0 +1,5 @@ +extern int func(void); +int main(void) +{ + return func(); +} diff --git a/Tests/GhsMulti/GhsMultiCustomTarget/lib1.c b/Tests/GhsMulti/GhsMultiCustomTarget/lib1.c new file mode 100644 index 0000000..b35e9cc --- /dev/null +++ b/Tests/GhsMulti/GhsMultiCustomTarget/lib1.c @@ -0,0 +1,4 @@ +int func(void) +{ + return 2; +} diff --git a/Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt b/Tests/GhsMulti/GhsMultiDepOrder/CMakeLists.txt similarity index 56% copy from Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt copy to Tests/GhsMulti/GhsMultiDepOrder/CMakeLists.txt index ed3094b..2e2871b 100644 --- a/Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiDepOrder/CMakeLists.txt @@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR) project(test C) -add_custom_target(testTarget ALL echo this is a test) - -add_library(sharedLib SHARED file.c) - -add_library(moduleLib MODULE file.c) +#set_property( GLOBAL PROPERTY GLOBAL_DEPENDS_DEBUG_MODE 1) +add_subdirectory(exec) +add_subdirectory(lib) +add_subdirectory(protolib) +add_dependencies(lib1 proto) diff --git a/Tests/GhsMulti/GhsMultiDepOrder/exec/CMakeLists.txt b/Tests/GhsMulti/GhsMultiDepOrder/exec/CMakeLists.txt new file mode 100644 index 0000000..85ee805 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiDepOrder/exec/CMakeLists.txt @@ -0,0 +1,11 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +add_executable(exe1 exe1.c) +target_link_libraries(exe1 lib1) +target_include_directories(exe1 PRIVATE "${test_BINARY_DIR}") +if(CMAKE_C_COMPILER_ID STREQUAL "GHS") + target_link_options(exe1 PRIVATE "-non_shared") +endif() diff --git a/Tests/GhsMulti/GhsMultiDepOrder/exec/exe1.c b/Tests/GhsMulti/GhsMultiDepOrder/exec/exe1.c new file mode 100644 index 0000000..fbf4ed4 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiDepOrder/exec/exe1.c @@ -0,0 +1,8 @@ +#include "lib1.h" +#include "p.h" + +int main(void) +{ + return func1() + func2() + func3() + func1p() + func2p() + func3p() + + PROTO1 + PROTO2 + PROTO3; +} diff --git a/Tests/GhsMulti/GhsMultiDepOrder/lib/CMakeLists.txt b/Tests/GhsMulti/GhsMultiDepOrder/lib/CMakeLists.txt new file mode 100644 index 0000000..ae30fa2 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiDepOrder/lib/CMakeLists.txt @@ -0,0 +1,17 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +add_library(lib1 STATIC + func1.c lib1.h + "${test_BINARY_DIR}/protolib/proto1.c" + "${test_BINARY_DIR}/protolib/proto1.h") +set_source_files_properties( + "${test_BINARY_DIR}/protolib/proto1.c" + "${test_BINARY_DIR}/protolib/proto1.h" + PROPERTIES GENERATED 1) +target_include_directories(lib1 PRIVATE "${test_BINARY_DIR}/protolib" + PUBLIC .) +add_custom_command( TARGET lib1 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "${test_BINARY_DIR}/protolib/proto1.h" "${test_BINARY_DIR}/p.h" + COMMENT "Copy ${test_BINARY_DIR}/protolib/proto1.h ${test_BINARY_DIR}/p.h" + BYPRODUCTS "${test_BINARY_DIR}/p.h") diff --git a/Tests/GhsMulti/GhsMultiDepOrder/lib/func1.c b/Tests/GhsMulti/GhsMultiDepOrder/lib/func1.c new file mode 100644 index 0000000..53334fe --- /dev/null +++ b/Tests/GhsMulti/GhsMultiDepOrder/lib/func1.c @@ -0,0 +1,17 @@ +#include "lib1.h" +#include "proto1.h" + +int func1(void) +{ + return 1 + PROTO1; +} + +int func2(void) +{ + return 2 + PROTO2; +} + +int func3(void) +{ + return 3 + PROTO3; +} diff --git a/Tests/GhsMulti/GhsMultiDepOrder/lib/lib1.h b/Tests/GhsMulti/GhsMultiDepOrder/lib/lib1.h new file mode 100644 index 0000000..5e99f02 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiDepOrder/lib/lib1.h @@ -0,0 +1,3 @@ +extern int func1(void); +extern int func2(void); +extern int func3(void); diff --git a/Tests/GhsMulti/GhsMultiDepOrder/protolib/CMakeLists.txt b/Tests/GhsMulti/GhsMultiDepOrder/protolib/CMakeLists.txt new file mode 100644 index 0000000..8cb6869 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiDepOrder/protolib/CMakeLists.txt @@ -0,0 +1,28 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +add_custom_target(proto ALL + DEPENDS proto1.c + proto1.h + SOURCES + ${test_SOURCE_DIR}/protolib/proto1.c.in + ${test_SOURCE_DIR}/protolib/proto1.h.in + COMMENT "Creating proto files") + +add_custom_command( + OUTPUT proto1.c + COMMAND ${CMAKE_COMMAND} -E copy + ${test_SOURCE_DIR}/protolib/proto1.c.in proto1.c + DEPENDS ${test_SOURCE_DIR}/protolib/proto1.c.in + COMMENT "generate proto C files" +) + +add_custom_command( + OUTPUT proto1.h + COMMAND ${CMAKE_COMMAND} -E copy + ${test_SOURCE_DIR}/protolib/proto1.h.in proto1.h + DEPENDS ${test_SOURCE_DIR}/protolib/proto1.h.in + COMMENT "generate proto H files" +) diff --git a/Tests/GhsMulti/GhsMultiDepOrder/protolib/proto1.c.in b/Tests/GhsMulti/GhsMultiDepOrder/protolib/proto1.c.in new file mode 100644 index 0000000..0efb1bd --- /dev/null +++ b/Tests/GhsMulti/GhsMultiDepOrder/protolib/proto1.c.in @@ -0,0 +1,16 @@ +#include "proto1.h" + +int func1p(void) +{ + return 1; +} + +int func2p(void) +{ + return 2; +} + +int func3p(void) +{ + return 3; +} diff --git a/Tests/GhsMulti/GhsMultiDepOrder/protolib/proto1.h.in b/Tests/GhsMulti/GhsMultiDepOrder/protolib/proto1.h.in new file mode 100644 index 0000000..f2f93af --- /dev/null +++ b/Tests/GhsMulti/GhsMultiDepOrder/protolib/proto1.h.in @@ -0,0 +1,7 @@ +extern int func1p(void); +extern int func2p(void); +extern int func3p(void); + +#define PROTO1 0x1 +#define PROTO2 0x2 +#define PROTO3 0x3 diff --git a/Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt b/Tests/GhsMulti/GhsMultiExternalProject/CMakeLists.txt similarity index 54% copy from Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt copy to Tests/GhsMulti/GhsMultiExternalProject/CMakeLists.txt index ed3094b..24126c8 100644 --- a/Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiExternalProject/CMakeLists.txt @@ -4,9 +4,11 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR) project(test C) - -add_custom_target(testTarget ALL echo this is a test) - -add_library(sharedLib SHARED file.c) - -add_library(moduleLib MODULE file.c) +include(ExternalProject) + +ExternalProject_Add(another_project + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/empty + BINARY_DIR empty_build + INSTALL_COMMAND "" + TEST_COMMAND "" + ) diff --git a/Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt b/Tests/GhsMulti/GhsMultiExternalProject/empty/CMakeLists.txt similarity index 57% copy from Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt copy to Tests/GhsMulti/GhsMultiExternalProject/empty/CMakeLists.txt index ed3094b..6846a98 100644 --- a/Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiExternalProject/empty/CMakeLists.txt @@ -3,10 +3,6 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR) -project(test C) +project(empty NONE) -add_custom_target(testTarget ALL echo this is a test) - -add_library(sharedLib SHARED file.c) - -add_library(moduleLib MODULE file.c) +message("EMPTY PROJECT") diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/App/CMakeLists.txt b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/App/CMakeLists.txt index e431217..3837b5a 100644 --- a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/App/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/App/CMakeLists.txt @@ -1,4 +1,3 @@ add_executable(App Main.c) -target_include_directories(App PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../Lib) target_link_libraries(App Lib) target_compile_options(App PUBLIC "-non_shared") diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Lib/CMakeLists.txt b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Lib/CMakeLists.txt index 00e0f59..bb9849a 100644 --- a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Lib/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Lib/CMakeLists.txt @@ -1 +1,2 @@ add_library(Lib HelperFun.c HelperFun.h) +target_include_directories(Lib PUBLIC .) diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/CMakeLists.txt b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/CMakeLists.txt index c5db155..3f2f0eb 100644 --- a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/CMakeLists.txt @@ -18,3 +18,4 @@ target_link_options(kernel PRIVATE -kernel) # create monolith INTEGRITY application add_executable(monolith test.int) +add_dependencies(monolith vas) diff --git a/Tests/GhsMulti/GhsMultiPlatform/file1.c b/Tests/GhsMulti/GhsMultiPlatform/file1.c deleted file mode 100644 index 4132aa4..0000000 --- a/Tests/GhsMulti/GhsMultiPlatform/file1.c +++ /dev/null @@ -1,4 +0,0 @@ -int main(void) -{ - return -42; -} diff --git a/Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt b/Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt index f5792b4..b2540d9 100644 --- a/Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt @@ -13,7 +13,7 @@ endif() if(RUN_TEST STREQUAL "SINGLE_EXEC") add_executable(exe1 exe.c) - set(targets_to_install ${targets_to_install} exe1) + set(targets_to_install exe1) endif() if(RUN_TEST STREQUAL "SINGLE_EXEC_RENAMED") @@ -22,7 +22,7 @@ if(RUN_TEST STREQUAL "SINGLE_EXEC_RENAMED") set_property(TARGET exe1 PROPERTY RUNTIME_OUTPUT_DIRECTORY ${name}_bin_$) set_property(TARGET exe1 PROPERTY OUTPUT_NAME ${name}_$) set_property(TARGET exe1 PROPERTY SUFFIX .bin) - set(targets_to_install ${targets_to_install} exe1) + set(targets_to_install exe1) endif() if(RUN_TEST STREQUAL "EXEC_AND_LIB") @@ -33,7 +33,7 @@ if(RUN_TEST STREQUAL "EXEC_AND_LIB") add_executable(exe1 exe1.c) target_link_libraries(exe1 lib1) - set(targets_to_install ${targets_to_install} exe1 lib1) + set(targets_to_install exe1 lib1) endif() install(TARGETS ${targets_to_install} diff --git a/Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt b/Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt index ed3094b..f5f3c55 100644 --- a/Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt @@ -5,8 +5,6 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR) project(test C) -add_custom_target(testTarget ALL echo this is a test) - add_library(sharedLib SHARED file.c) add_library(moduleLib MODULE file.c) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3b415c60c1a02b9ac76089a44c28e70692dcdef1 commit 3b415c60c1a02b9ac76089a44c28e70692dcdef1 Author: Fred Baksik AuthorDate: Mon Apr 8 09:55:35 2019 -0400 Commit: Fred Baksik CommitDate: Thu Apr 11 13:15:51 2019 -0400 GHS: Update ExternalProject for GHS tools -- When using default values for the external project forward GHS platform variables so that the external project builds with the same tools as the original project. -- Fix issue with bad top level project when GHS_PRIMARY_TARGET is set but has no value. In this case treat it as unset and use default value. diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 948b921..104ef9f 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -421,6 +421,10 @@ External Project Definition different behavior depending on whether the build starts from a fresh build directory or re-uses previous build contents. + If the CMake generator is the ``Green Hills MULTI`` and not overridden then + the orginal projects settings for the GHS toolset and target system + customization cache variables are propagated into the external project. + ``SOURCE_SUBDIR `` When no ``CONFIGURE_COMMAND`` option is specified, the configure step assumes the external project has a ``CMakeLists.txt`` file at the top of @@ -2849,18 +2853,6 @@ function(_ep_extract_configure_command var name) set(has_cmake_cache_default_args 1) endif() - if(has_cmake_cache_args OR has_cmake_cache_default_args) - set(_ep_cache_args_script "/${name}-cache-$.cmake") - if(has_cmake_cache_args) - _ep_command_line_to_initial_cache(script_initial_cache_force "${cmake_cache_args}" 1) - endif() - if(has_cmake_cache_default_args) - _ep_command_line_to_initial_cache(script_initial_cache_default "${cmake_cache_default_args}" 0) - endif() - _ep_write_initial_cache(${name} "${_ep_cache_args_script}" "${script_initial_cache_force}${script_initial_cache_default}") - list(APPEND cmd "-C${_ep_cache_args_script}") - endif() - get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR) get_target_property(cmake_generator_instance ${name} _EP_CMAKE_GENERATOR_INSTANCE) get_target_property(cmake_generator_platform ${name} _EP_CMAKE_GENERATOR_PLATFORM) @@ -2881,6 +2873,16 @@ function(_ep_extract_configure_command var name) list(APPEND cmd "-G${CMAKE_EXTRA_GENERATOR} - ${CMAKE_GENERATOR}") else() list(APPEND cmd "-G${CMAKE_GENERATOR}") + if("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI") + set(has_cmake_cache_default_args 1) + set(cmake_cache_default_args ${cmake_cache_default_args} + "-DGHS_TARGET_PLATFORM:STRING=${GHS_TARGET_PLATFORM}" + "-DGHS_PRIMARY_TARGET:STRING=${GHS_PRIMARY_TARGET}" + "-DGHS_TOOLSET_ROOT:STRING=${GHS_TOOLSET_ROOT}" + "-DGHS_OS_ROOT:STRING=${GHS_OS_ROOT}" + "-DGHS_OS_DIR:STRING=${GHS_OS_DIR}" + "-DGHS_BSP_NAME:STRING=${GHS_BSP_NAME}") + endif() endif() if(cmake_generator_platform) message(FATAL_ERROR "Option CMAKE_GENERATOR_PLATFORM not allowed without CMAKE_GENERATOR.") @@ -2902,6 +2904,18 @@ function(_ep_extract_configure_command var name) endif() endif() + if(has_cmake_cache_args OR has_cmake_cache_default_args) + set(_ep_cache_args_script "/${name}-cache-$.cmake") + if(has_cmake_cache_args) + _ep_command_line_to_initial_cache(script_initial_cache_force "${cmake_cache_args}" 1) + endif() + if(has_cmake_cache_default_args) + _ep_command_line_to_initial_cache(script_initial_cache_default "${cmake_cache_default_args}" 0) + endif() + _ep_write_initial_cache(${name} "${_ep_cache_args_script}" "${script_initial_cache_force}${script_initial_cache_default}") + list(APPEND cmd "-C${_ep_cache_args_script}") + endif() + list(APPEND cmd "") endif() diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index f9d7e75..b69dea0 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -638,7 +638,7 @@ void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives( std::string tgt; const char* t = this->GetCMakeInstance()->GetCacheDefinition("GHS_PRIMARY_TARGET"); - if (t) { + if (t && *t != '\0') { tgt = t; this->GetCMakeInstance()->MarkCliAsUsed("GHS_PRIMARY_TARGET"); } else { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=83c47ef5b8a6b1a63edbd82092d8eae68da453d6 commit 83c47ef5b8a6b1a63edbd82092d8eae68da453d6 Author: Fred Baksik AuthorDate: Mon Apr 8 09:55:35 2019 -0400 Commit: Fred Baksik CommitDate: Thu Apr 11 13:15:51 2019 -0400 GHS: Update project layout to accommodate gbuild inconsistencies -- Do not use reference projects, use build hierarchy instead. gbuild has three parallel levels: * low -- Parallelizes compiling source files within a single project (.gpj) file when safe to do so. * medium -- Parallelizes processing files within a single linked output when safe to do so. * high [default] -- Parallelizes processing files whenever safe to do so, including linking task. Testing showed that for some combinations of gbuild / MULTI there are issues with building a project that uses references to target project files along with using {nobuild} option. Sometimes the archiving of a library and linking of an executable were happening in parallel and the build would fail when linking because the archive wasn't complete. This behavior was also inconsistent when running the build from MULTI and from the command line with gbuild. In some cases MULTI did not parallelize archiving and linking, but gbuild performed these actions in parallel. The parallel build issue was not seen when using a build hierarchy where the project listed the project files normally instead of using a reference link. The other option was to add the -parallel_level=medium to the command line when using "cmake --build" but this wouldn't fix the issue if gbuild itself was used to and the user might not be aware of the extra option used by cmake. diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index f59d410..b80da72 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -143,8 +143,6 @@ void cmGhsMultiTargetGenerator::GenerateTarget() } this->WriteSources(fout); fout.Close(); - - this->WriteReferenceFile(fproj); } cmGlobalGhsMultiGenerator* cmGhsMultiTargetGenerator::GetGlobalGenerator() @@ -735,27 +733,6 @@ void cmGhsMultiTargetGenerator::WriteObjectLangOverride( } } -void cmGhsMultiTargetGenerator::WriteReferenceFile(std::string fproj) -{ - // Open the target ref file in copy-if-different mode. - std::string fname = this->LocalGenerator->GetCurrentBinaryDirectory(); - fname += "/"; - fname += this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); - fname += "/"; - fname += this->Name + "_REF" + cmGlobalGhsMultiGenerator::FILE_EXTENSION; - cmGeneratedFileStream fref(fname); - fref.SetCopyIfDifferent(true); - this->GetGlobalGenerator()->WriteFileHeader(fref); - GhsMultiGpj::WriteGpjTag(GhsMultiGpj::REFERENCE, fref); - fref << " :reference=CMakeFiles/${PROJ_NAME}.project.gpj;" << fproj - << std::endl; - fref.Close(); - - // Store location of the reference file - this->GeneratorTarget->Target->SetProperty("GHS_REFERENCE_PROJECT", - fname.c_str()); -} - bool cmGhsMultiTargetGenerator::DetermineIfIntegrityApp() { const char* p = this->GeneratorTarget->GetProperty("ghs_integrity_app"); diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index 9a41c92..a131567 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -66,7 +66,6 @@ private: void WriteSourceProperty(std::ostream& fout, const cmSourceFile* sf, std::string const& propName, std::string const& propFlag); - void WriteReferenceFile(std::string fproj); static void WriteObjectLangOverride(std::ostream& fout, const cmSourceFile* sourceFile); diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 7cf0664..f9d7e75 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -352,66 +352,24 @@ void cmGlobalGhsMultiGenerator::WriteTopLevelProject(std::ostream& fout, } fout << "\"" << this->OsDir << "\"" << std::endl; } - - this->WriteSubProjects(fout, root); } void cmGlobalGhsMultiGenerator::WriteSubProjects(std::ostream& fout, - cmLocalGenerator* root) -{ - fout << "CMakeFiles/" << root->GetProjectName() << this->GetAllTargetName() - << "_REF" << FILE_EXTENSION << " [Reference]" << std::endl; - fout << "{nobuild} CMakeFiles/" << root->GetProjectName() << ".target" - << FILE_EXTENSION << " [Project]" << std::endl; - fout << "{nobuild} CMakeFiles/" << root->GetProjectName() << ".project" - << FILE_EXTENSION << " [Project]" << std::endl; -} - -void cmGlobalGhsMultiGenerator::WriteProjectRefLine( - std::ostream& fout, cmGeneratorTarget const* target, cmLocalGenerator* root, - std::string& rootBinaryDir) -{ - const char* projRef = target->GetProperty("GHS_REFERENCE_PROJECT"); - if (projRef) { - std::string projFile = projRef; - projFile = root->MaybeConvertToRelativePath(rootBinaryDir, projFile); - fout << projFile << " [Reference]\n"; - } else { - /* Should never happen */ - std::string message = "The project file reference for target [" + - target->GetName() + "] is missing.\n"; - cmSystemTools::Error(message); - fout << "{comment} " << target->GetName() << " [missing reference file]\n"; - } -} - -void cmGlobalGhsMultiGenerator::WriteProjects(cmLocalGenerator* root) + std::string& all_target) { - std::string fname = root->GetCurrentBinaryDirectory(); - fname += "/CMakeFiles/"; - fname += root->GetProjectName(); - fname += ".project"; - fname += FILE_EXTENSION; - cmGeneratedFileStream pf(fname); - pf.SetCopyIfDifferent(true); - this->WriteFileHeader(pf); - GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, pf); - - std::string rootBinaryDir = root->GetCurrentBinaryDirectory(); - rootBinaryDir += "/CMakeFiles"; - + fout << "CMakeFiles/" << all_target << " [Project]" << std::endl; + // All known targets for (cmGeneratorTarget const* target : this->ProjectTargets) { if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY || target->GetType() == cmStateEnums::MODULE_LIBRARY || target->GetType() == cmStateEnums::SHARED_LIBRARY || (target->GetType() == cmStateEnums::GLOBAL_TARGET && - target->GetName() != this->GetInstallTargetName())) { + target->GetName() != GetInstallTargetName())) { continue; } - this->WriteProjectLine(pf, target, root, rootBinaryDir); + fout << "CMakeFiles/" << target->GetName() + ".tgt" + FILE_EXTENSION + << " [Project]" << std::endl; } - - pf.Close(); } void cmGlobalGhsMultiGenerator::WriteProjectLine( @@ -446,25 +404,10 @@ void cmGlobalGhsMultiGenerator::WriteProjectLine( void cmGlobalGhsMultiGenerator::WriteTargets(cmLocalGenerator* root) { - std::string fname = root->GetCurrentBinaryDirectory(); - fname += "/CMakeFiles/"; - fname += root->GetProjectName(); - fname += ".target"; - fname += FILE_EXTENSION; - cmGeneratedFileStream tf(fname); - tf.SetCopyIfDifferent(true); - WriteFileHeader(tf); - GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, tf); - std::string rootBinaryDir = root->GetCurrentBinaryDirectory(); rootBinaryDir += "/CMakeFiles"; - // ALL target - tf << root->GetProjectName() + "." + this->GetAllTargetName() + - FILE_EXTENSION - << " [Project]" << std::endl; - - // All other targets + // All known targets for (cmGeneratorTarget const* target : this->ProjectTargets) { if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY || target->GetType() == cmStateEnums::MODULE_LIBRARY || @@ -475,8 +418,8 @@ void cmGlobalGhsMultiGenerator::WriteTargets(cmLocalGenerator* root) } // create target build file - fname = root->GetCurrentBinaryDirectory() + "/CMakeFiles/" + - target->GetName() + FILE_EXTENSION; + std::string name = target->GetName() + ".tgt" + FILE_EXTENSION; + std::string fname = rootBinaryDir + "/" + name; cmGeneratedFileStream fbld(fname); fbld.SetCopyIfDifferent(true); this->WriteFileHeader(fbld); @@ -488,24 +431,24 @@ void cmGlobalGhsMultiGenerator::WriteTargets(cmLocalGenerator* root) cmSystemTools::Error(message); } else { for (auto& tgt : build) { - this->WriteProjectRefLine(fbld, tgt, root, rootBinaryDir); + WriteProjectLine(fbld, tgt, root, rootBinaryDir); } } fbld.Close(); - - tf << target->GetName() << FILE_EXTENSION << " [Project]" << std::endl; } - tf.Close(); } void cmGlobalGhsMultiGenerator::WriteAllTarget( - cmLocalGenerator* root, std::vector& generators) + cmLocalGenerator* root, std::vector& generators, + std::string& all_target) { this->ProjectTargets.clear(); // create target build file - std::string fname = root->GetCurrentBinaryDirectory() + "/CMakeFiles/" + - root->GetProjectName() + "." + this->GetAllTargetName() + FILE_EXTENSION; + all_target = root->GetProjectName() + "." + this->GetAllTargetName() + + ".tgt" + FILE_EXTENSION; + std::string fname = + root->GetCurrentBinaryDirectory() + "/CMakeFiles/" + all_target; cmGeneratedFileStream fbld(fname); fbld.SetCopyIfDifferent(true); this->WriteFileHeader(fbld); @@ -513,12 +456,6 @@ void cmGlobalGhsMultiGenerator::WriteAllTarget( // Collect all targets under this root generator and the transitive // closure of their dependencies. - /* NOTE: GetTargetSets() returns the set in a different order - * every time it is run even though nothing has changed. To avoid - * creating a different build order sort the targets by name so that - * the inputs of calculating build order are the same (otherwise the - * build order will be different every time). - */ TargetDependSet projectTargets; TargetDependSet originalTargets; this->GetTargetSets(projectTargets, originalTargets, root, generators); @@ -551,22 +488,10 @@ void cmGlobalGhsMultiGenerator::WriteAllTarget( target->GetType() == cmStateEnums::SHARED_LIBRARY) { continue; } - this->WriteProjectRefLine(fbld, target, root, rootBinaryDir); + this->WriteProjectLine(fbld, target, root, rootBinaryDir); } } fbld.Close(); - - // Open the target ref file in copy-if-different mode. - std::string frn = root->GetCurrentBinaryDirectory() + "/CMakeFiles/" + - root->GetProjectName() + this->GetAllTargetName() + "_REF" + - FILE_EXTENSION; - cmGeneratedFileStream fref(frn); - fref.SetCopyIfDifferent(true); - this->WriteFileHeader(fref); - GhsMultiGpj::WriteGpjTag(GhsMultiGpj::REFERENCE, fref); - fref << " :reference=CMakeFiles/${PROJ_NAME}.target.gpj;" << fname - << std::endl; - fref.Close(); } void cmGlobalGhsMultiGenerator::Generate() @@ -604,6 +529,7 @@ void cmGlobalGhsMultiGenerator::OutputTopLevelProject( cmLocalGenerator* root, std::vector& generators) { std::string fname; + std::string all_target; if (generators.empty()) { return; @@ -622,11 +548,12 @@ void cmGlobalGhsMultiGenerator::OutputTopLevelProject( cmGeneratedFileStream top(fname); top.SetCopyIfDifferent(true); this->WriteTopLevelProject(top, root); - top.Close(); - this->WriteAllTarget(root, generators); + this->WriteAllTarget(root, generators, all_target); this->WriteTargets(root); - this->WriteProjects(root); + + this->WriteSubProjects(top, all_target); + top.Close(); } std::vector @@ -655,10 +582,12 @@ cmGlobalGhsMultiGenerator::GenerateBuildCommand( /* determine which top-project file to use */ std::string proj = projectName + ".top" + FILE_EXTENSION; - std::string target = projectName + ".target" + FILE_EXTENSION; std::vector files; cmSystemTools::Glob(projectDir, ".*\\.top\\.gpj", files); if (!files.empty()) { + /* if multiple top-projects are found in build directory + * then prefer projectName top-project. + */ auto p = std::find(files.begin(), files.end(), proj); if (p == files.end()) { proj = files.at(0); @@ -671,21 +600,18 @@ cmGlobalGhsMultiGenerator::GenerateBuildCommand( targetNames.end()) { makeCommand.Add("-clean"); } else { - bool print_within = true; for (const auto& tname : targetNames) { if (!tname.empty()) { - if (print_within) { - makeCommand.Add("-within", target); - print_within = false; - } - if (tname.compare(tname.size() - 4, 4, ".gpj") == 0) { - makeCommand.Add(tname); - } else { - makeCommand.Add(tname + ".gpj"); - } + makeCommand.Add(tname + ".tgt.gpj"); } } } + } else { + /* transform name to default build */; + std::string all = proj; + all.replace(all.end() - 7, all.end(), + std::string(this->GetAllTargetName()) + ".tgt.gpj"); + makeCommand.Add(all); } return { makeCommand }; } diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index a964af8..98358c7 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -98,17 +98,15 @@ private: void WriteTopLevelProject(std::ostream& fout, cmLocalGenerator* root); void WriteMacros(std::ostream& fout, cmLocalGenerator* root); void WriteHighLevelDirectives(cmLocalGenerator* root, std::ostream& fout); - void WriteSubProjects(std::ostream& fout, cmLocalGenerator* root); + void WriteSubProjects(std::ostream& fout, std::string& all_target); void WriteTargets(cmLocalGenerator* root); - void WriteProjects(cmLocalGenerator* root); void WriteProjectLine(std::ostream& fout, cmGeneratorTarget const* target, cmLocalGenerator* root, std::string& rootBinaryDir); - void WriteProjectRefLine(std::ostream& fout, cmGeneratorTarget const* target, - cmLocalGenerator* root, std::string& rootBinaryDir); void WriteCustomRuleBOD(std::ostream& fout); void WriteCustomTargetBOD(std::ostream& fout); void WriteAllTarget(cmLocalGenerator* root, - std::vector& generators); + std::vector& generators, + std::string& all_target); std::string TrimQuotes(std::string const& str); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5d2e1404bdfa83eeae5b361bd7d8a882aadc7242 commit 5d2e1404bdfa83eeae5b361bd7d8a882aadc7242 Author: Fred Baksik AuthorDate: Mon Apr 8 09:55:34 2019 -0400 Commit: Fred Baksik CommitDate: Thu Apr 11 13:15:50 2019 -0400 GHS: Update project layout to build targets correctly -- Restructure projects and files to support proper building of targets Build order is determined by hierarchy of project files and folders Custom targets may have been run multiple times in the original file / folder structure -- Default to build targets that are part of ALL target -- List all known targets for this project Includes global targets for ALL_BUILD and INSTALL -- Compute build order for building targets diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 51d08cb..f59d410 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -13,13 +13,13 @@ #include "cmMakefile.h" #include "cmOutputConverter.h" #include "cmSourceFile.h" +#include "cmSourceFileLocation.h" #include "cmSourceGroup.h" #include "cmStateDirectory.h" #include "cmStateSnapshot.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" -#include "cmTargetDepend.h" #include #include @@ -94,6 +94,16 @@ void cmGhsMultiTargetGenerator::Generate() this->TagType = GhsMultiGpj::CUSTOM_TARGET; break; } + case cmStateEnums::GLOBAL_TARGET: { + this->TargetNameReal = this->GeneratorTarget->GetName(); + if (this->TargetNameReal == + this->GetGlobalGenerator()->GetInstallTargetName()) { + this->TagType = GhsMultiGpj::CUSTOM_TARGET; + } else { + return; + } + break; + } default: return; } @@ -120,10 +130,9 @@ void cmGhsMultiTargetGenerator::GenerateTarget() this->GetGlobalGenerator()->WriteFileHeader(fout); GhsMultiGpj::WriteGpjTag(this->TagType, fout); - const std::string language( - this->GeneratorTarget->GetLinkerLanguage(this->ConfigName)); - if (this->TagType != GhsMultiGpj::CUSTOM_TARGET) { + const std::string language( + this->GeneratorTarget->GetLinkerLanguage(this->ConfigName)); this->WriteTargetSpecifics(fout, this->ConfigName); this->SetCompilerFlags(this->ConfigName, language); this->WriteCompilerFlags(fout, this->ConfigName, language); @@ -132,23 +141,10 @@ void cmGhsMultiTargetGenerator::GenerateTarget() this->WriteTargetLinkLine(fout, this->ConfigName); this->WriteBuildEvents(fout); } - this->WriteReferences(fout); this->WriteSources(fout); - fout.Close(); - // Open the target ref file in copy-if-different mode. - std::string fname = this->LocalGenerator->GetCurrentBinaryDirectory(); - fname += "/"; - fname += this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); - fname += "/"; - fname += this->Name + "_REF" + cmGlobalGhsMultiGenerator::FILE_EXTENSION; - cmGeneratedFileStream fref(fname); - fref.SetCopyIfDifferent(true); - this->GetGlobalGenerator()->WriteFileHeader(fref); - GhsMultiGpj::WriteGpjTag(GhsMultiGpj::REFERENCE, fref); - fref << " :reference=" << fproj << std::endl; - fref.Close(); + this->WriteReferenceFile(fproj); } cmGlobalGhsMultiGenerator* cmGhsMultiTargetGenerator::GetGlobalGenerator() @@ -739,27 +735,25 @@ void cmGhsMultiTargetGenerator::WriteObjectLangOverride( } } -void cmGhsMultiTargetGenerator::WriteReferences(std::ostream& fout) +void cmGhsMultiTargetGenerator::WriteReferenceFile(std::string fproj) { - // FIXME - compare unordered to ordered projects - // also needs transitive build order deps! - // Get the targets that this one depends upon - cmTargetDependSet unordered = - this->GetGlobalGenerator()->GetTargetDirectDepends(this->GeneratorTarget); - cmGlobalGhsMultiGenerator::OrderedTargetDependSet ordered(unordered, - this->Name); - for (auto& t : ordered) { - std::string tname = t->GetName(); - std::string tpath = t->LocalGenerator->GetCurrentBinaryDirectory(); - std::string rootpath = this->LocalGenerator->GetCurrentBinaryDirectory(); - std::string outpath = - this->LocalGenerator->MaybeConvertToRelativePath(rootpath, tpath) + "/" + - tname + "REF" + cmGlobalGhsMultiGenerator::FILE_EXTENSION; - - fout << outpath; - fout << " "; - GhsMultiGpj::WriteGpjTag(GhsMultiGpj::REFERENCE, fout); - } + // Open the target ref file in copy-if-different mode. + std::string fname = this->LocalGenerator->GetCurrentBinaryDirectory(); + fname += "/"; + fname += this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); + fname += "/"; + fname += this->Name + "_REF" + cmGlobalGhsMultiGenerator::FILE_EXTENSION; + cmGeneratedFileStream fref(fname); + fref.SetCopyIfDifferent(true); + this->GetGlobalGenerator()->WriteFileHeader(fref); + GhsMultiGpj::WriteGpjTag(GhsMultiGpj::REFERENCE, fref); + fref << " :reference=CMakeFiles/${PROJ_NAME}.project.gpj;" << fproj + << std::endl; + fref.Close(); + + // Store location of the reference file + this->GeneratorTarget->Target->SetProperty("GHS_REFERENCE_PROJECT", + fname.c_str()); } bool cmGhsMultiTargetGenerator::DetermineIfIntegrityApp() diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index 3ba3884..9a41c92 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -66,7 +66,7 @@ private: void WriteSourceProperty(std::ostream& fout, const cmSourceFile* sf, std::string const& propName, std::string const& propFlag); - void WriteReferences(std::ostream& fout); + void WriteReferenceFile(std::string fproj); static void WriteObjectLangOverride(std::ostream& fout, const cmSourceFile* sourceFile); diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index f212efc..7cf0664 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -321,13 +321,11 @@ void cmGlobalGhsMultiGenerator::WriteCustomTargetBOD(std::ostream& fout) "}\n"; } -void cmGlobalGhsMultiGenerator::WriteTopLevelProject( - std::ostream& fout, cmLocalGenerator* root, - std::vector& generators) +void cmGlobalGhsMultiGenerator::WriteTopLevelProject(std::ostream& fout, + cmLocalGenerator* root) { - WriteFileHeader(fout); - - this->WriteMacros(fout); + this->WriteFileHeader(fout); + this->WriteMacros(fout, root); this->WriteHighLevelDirectives(root, fout); GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, fout); @@ -355,73 +353,70 @@ void cmGlobalGhsMultiGenerator::WriteTopLevelProject( fout << "\"" << this->OsDir << "\"" << std::endl; } - WriteSubProjects(fout, root, generators); + this->WriteSubProjects(fout, root); } -void cmGlobalGhsMultiGenerator::WriteSubProjects( - std::ostream& fout, cmLocalGenerator* root, - std::vector& generators) +void cmGlobalGhsMultiGenerator::WriteSubProjects(std::ostream& fout, + cmLocalGenerator* root) { - this->DefaultTargets.clear(); - this->ProjectTargets.clear(); - - // Collect all targets under this root generator and the transitive - // closure of their dependencies. - // FIXME -- what is correct list or is it build order - TargetDependSet projectTargets; - TargetDependSet originalTargets; - this->GetTargetSets(projectTargets, originalTargets, root, generators); - OrderedTargetDependSet orderedProjectTargets(projectTargets, ""); - - // determine the targets for ALL target - std::string rootBinaryDir = root->GetCurrentBinaryDirectory(); - for (cmGeneratorTarget const* target : orderedProjectTargets) { - if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { - continue; - } - this->ProjectTargets.push_back(target); - if (!cmSystemTools::IsOn(target->GetProperty("EXCLUDE_FROM_ALL"))) { - this->DefaultTargets.push_back(target); - } - } - - fout << root->GetProjectName() << ".default" << FILE_EXTENSION - << " [Project]" << std::endl; - fout << "{nobuild} " << root->GetProjectName() << ".target" << FILE_EXTENSION - << " [Project]" << std::endl; - fout << "{nobuild} " << root->GetProjectName() << ".project" + fout << "CMakeFiles/" << root->GetProjectName() << this->GetAllTargetName() + << "_REF" << FILE_EXTENSION << " [Reference]" << std::endl; + fout << "{nobuild} CMakeFiles/" << root->GetProjectName() << ".target" + << FILE_EXTENSION << " [Project]" << std::endl; + fout << "{nobuild} CMakeFiles/" << root->GetProjectName() << ".project" << FILE_EXTENSION << " [Project]" << std::endl; } -void cmGlobalGhsMultiGenerator::WriteDefaultProject( - std::ostream& fout, cmLocalGenerator* root, - std::vector& generators) +void cmGlobalGhsMultiGenerator::WriteProjectRefLine( + std::ostream& fout, cmGeneratorTarget const* target, cmLocalGenerator* root, + std::string& rootBinaryDir) { - // write out all the targets for this project - WriteFileHeader(fout); - GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, fout); - std::string rootBinaryDir = root->GetCurrentBinaryDirectory(); - for (cmGeneratorTarget const* target : this->DefaultTargets) { - this->WriteProjectLine(fout, target, root, rootBinaryDir, false); + const char* projRef = target->GetProperty("GHS_REFERENCE_PROJECT"); + if (projRef) { + std::string projFile = projRef; + projFile = root->MaybeConvertToRelativePath(rootBinaryDir, projFile); + fout << projFile << " [Reference]\n"; + } else { + /* Should never happen */ + std::string message = "The project file reference for target [" + + target->GetName() + "] is missing.\n"; + cmSystemTools::Error(message); + fout << "{comment} " << target->GetName() << " [missing reference file]\n"; } } -void cmGlobalGhsMultiGenerator::WriteTargetProjects( - std::ostream& fout, cmLocalGenerator* root, - std::vector& generators, bool proj) +void cmGlobalGhsMultiGenerator::WriteProjects(cmLocalGenerator* root) { - // write out all the targets for this project - WriteFileHeader(fout); - GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, fout); + std::string fname = root->GetCurrentBinaryDirectory(); + fname += "/CMakeFiles/"; + fname += root->GetProjectName(); + fname += ".project"; + fname += FILE_EXTENSION; + cmGeneratedFileStream pf(fname); + pf.SetCopyIfDifferent(true); + this->WriteFileHeader(pf); + GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, pf); + std::string rootBinaryDir = root->GetCurrentBinaryDirectory(); + rootBinaryDir += "/CMakeFiles"; + for (cmGeneratorTarget const* target : this->ProjectTargets) { - this->WriteProjectLine(fout, target, root, rootBinaryDir, proj); + if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY || + target->GetType() == cmStateEnums::MODULE_LIBRARY || + target->GetType() == cmStateEnums::SHARED_LIBRARY || + (target->GetType() == cmStateEnums::GLOBAL_TARGET && + target->GetName() != this->GetInstallTargetName())) { + continue; + } + this->WriteProjectLine(pf, target, root, rootBinaryDir); } + + pf.Close(); } void cmGlobalGhsMultiGenerator::WriteProjectLine( std::ostream& fout, cmGeneratorTarget const* target, cmLocalGenerator* root, - std::string& rootBinaryDir, bool proj) + std::string& rootBinaryDir) { const char* projName = target->GetProperty("GENERATOR_FILE_NAME"); const char* projType = target->GetProperty("GENERATOR_FILE_NAME_EXT"); @@ -440,7 +435,138 @@ void cmGlobalGhsMultiGenerator::WriteProjectLine( std::string projFile = dir + projName + FILE_EXTENSION; fout << projFile; fout << " " << projType << std::endl; + } else { + /* Should never happen */ + std::string message = + "The project file for target [" + target->GetName() + "] is missing.\n"; + cmSystemTools::Error(message); + fout << "{comment} " << target->GetName() << " [missing project file]\n"; + } +} + +void cmGlobalGhsMultiGenerator::WriteTargets(cmLocalGenerator* root) +{ + std::string fname = root->GetCurrentBinaryDirectory(); + fname += "/CMakeFiles/"; + fname += root->GetProjectName(); + fname += ".target"; + fname += FILE_EXTENSION; + cmGeneratedFileStream tf(fname); + tf.SetCopyIfDifferent(true); + WriteFileHeader(tf); + GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, tf); + + std::string rootBinaryDir = root->GetCurrentBinaryDirectory(); + rootBinaryDir += "/CMakeFiles"; + + // ALL target + tf << root->GetProjectName() + "." + this->GetAllTargetName() + + FILE_EXTENSION + << " [Project]" << std::endl; + + // All other targets + for (cmGeneratorTarget const* target : this->ProjectTargets) { + if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY || + target->GetType() == cmStateEnums::MODULE_LIBRARY || + target->GetType() == cmStateEnums::SHARED_LIBRARY || + (target->GetType() == cmStateEnums::GLOBAL_TARGET && + target->GetName() != GetInstallTargetName())) { + continue; + } + + // create target build file + fname = root->GetCurrentBinaryDirectory() + "/CMakeFiles/" + + target->GetName() + FILE_EXTENSION; + cmGeneratedFileStream fbld(fname); + fbld.SetCopyIfDifferent(true); + this->WriteFileHeader(fbld); + GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, fbld); + std::vector build; + if (ComputeTargetBuildOrder(target, build)) { + std::string message = "The inter-target dependency graph for target [" + + target->GetName() + "] had a cycle.\n"; + cmSystemTools::Error(message); + } else { + for (auto& tgt : build) { + this->WriteProjectRefLine(fbld, tgt, root, rootBinaryDir); + } + } + fbld.Close(); + + tf << target->GetName() << FILE_EXTENSION << " [Project]" << std::endl; } + tf.Close(); +} + +void cmGlobalGhsMultiGenerator::WriteAllTarget( + cmLocalGenerator* root, std::vector& generators) +{ + this->ProjectTargets.clear(); + + // create target build file + std::string fname = root->GetCurrentBinaryDirectory() + "/CMakeFiles/" + + root->GetProjectName() + "." + this->GetAllTargetName() + FILE_EXTENSION; + cmGeneratedFileStream fbld(fname); + fbld.SetCopyIfDifferent(true); + this->WriteFileHeader(fbld); + GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, fbld); + + // Collect all targets under this root generator and the transitive + // closure of their dependencies. + /* NOTE: GetTargetSets() returns the set in a different order + * every time it is run even though nothing has changed. To avoid + * creating a different build order sort the targets by name so that + * the inputs of calculating build order are the same (otherwise the + * build order will be different every time). + */ + TargetDependSet projectTargets; + TargetDependSet originalTargets; + this->GetTargetSets(projectTargets, originalTargets, root, generators); + OrderedTargetDependSet sortedProjectTargets(projectTargets, ""); + std::vector defaultTargets; + for (cmGeneratorTarget const* t : sortedProjectTargets) { + /* save list of all targets in sorted order */ + this->ProjectTargets.push_back(t); + } + for (cmGeneratorTarget const* t : sortedProjectTargets) { + if (t->GetType() == cmStateEnums::INTERFACE_LIBRARY) { + continue; + } + if (!cmSystemTools::IsOn(t->GetProperty("EXCLUDE_FROM_ALL"))) { + defaultTargets.push_back(t); + } + } + std::vector build; + if (ComputeTargetBuildOrder(defaultTargets, build)) { + std::string message = "The inter-target dependency graph for project [" + + root->GetProjectName() + "] had a cycle.\n"; + cmSystemTools::Error(message); + } else { + // determine the targets for ALL target + std::string rootBinaryDir = root->GetCurrentBinaryDirectory(); + rootBinaryDir += "/CMakeFiles"; + for (cmGeneratorTarget const* target : build) { + if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY || + target->GetType() == cmStateEnums::MODULE_LIBRARY || + target->GetType() == cmStateEnums::SHARED_LIBRARY) { + continue; + } + this->WriteProjectRefLine(fbld, target, root, rootBinaryDir); + } + } + fbld.Close(); + + // Open the target ref file in copy-if-different mode. + std::string frn = root->GetCurrentBinaryDirectory() + "/CMakeFiles/" + + root->GetProjectName() + this->GetAllTargetName() + "_REF" + + FILE_EXTENSION; + cmGeneratedFileStream fref(frn); + fref.SetCopyIfDifferent(true); + this->WriteFileHeader(fref); + GhsMultiGpj::WriteGpjTag(GhsMultiGpj::REFERENCE, fref); + fref << " :reference=CMakeFiles/${PROJ_NAME}.target.gpj;" << fname + << std::endl; + fref.Close(); } void cmGlobalGhsMultiGenerator::Generate() @@ -495,35 +621,12 @@ void cmGlobalGhsMultiGenerator::OutputTopLevelProject( cmGeneratedFileStream top(fname); top.SetCopyIfDifferent(true); - this->WriteTopLevelProject(top, root, generators); + this->WriteTopLevelProject(top, root); top.Close(); - fname = root->GetCurrentBinaryDirectory() + "/"; - fname += root->GetProjectName(); - fname += ".target"; - fname += FILE_EXTENSION; - cmGeneratedFileStream target(fname); - target.SetCopyIfDifferent(true); - this->WriteTargetProjects(target, root, generators, false); - target.Close(); - - fname = root->GetCurrentBinaryDirectory() + "/"; - fname += root->GetProjectName(); - fname += ".project"; - fname += FILE_EXTENSION; - cmGeneratedFileStream project(fname); - project.SetCopyIfDifferent(true); - this->WriteTargetProjects(project, root, generators, true); - project.Close(); - - fname = root->GetCurrentBinaryDirectory() + "/"; - fname += root->GetProjectName(); - fname += ".default"; - fname += FILE_EXTENSION; - cmGeneratedFileStream default_targets(fname); - default_targets.SetCopyIfDifferent(true); - this->WriteDefaultProject(default_targets, root, generators); - default_targets.Close(); + this->WriteAllTarget(root, generators); + this->WriteTargets(root); + this->WriteProjects(root); } std::vector @@ -552,6 +655,7 @@ cmGlobalGhsMultiGenerator::GenerateBuildCommand( /* determine which top-project file to use */ std::string proj = projectName + ".top" + FILE_EXTENSION; + std::string target = projectName + ".target" + FILE_EXTENSION; std::vector files; cmSystemTools::Glob(projectDir, ".*\\.top\\.gpj", files); if (!files.empty()) { @@ -567,8 +671,13 @@ cmGlobalGhsMultiGenerator::GenerateBuildCommand( targetNames.end()) { makeCommand.Add("-clean"); } else { + bool print_within = true; for (const auto& tname : targetNames) { if (!tname.empty()) { + if (print_within) { + makeCommand.Add("-within", target); + print_within = false; + } if (tname.compare(tname.size() - 4, 4, ".gpj") == 0) { makeCommand.Add(tname); } else { @@ -581,8 +690,10 @@ cmGlobalGhsMultiGenerator::GenerateBuildCommand( return { makeCommand }; } -void cmGlobalGhsMultiGenerator::WriteMacros(std::ostream& fout) +void cmGlobalGhsMultiGenerator::WriteMacros(std::ostream& fout, + cmLocalGenerator* root) { + fout << "macro PROJ_NAME=" << root->GetProjectName() << std::endl; char const* ghsGpjMacros = this->GetCMakeInstance()->GetCacheDefinition("GHS_GPJ_MACROS"); if (nullptr != ghsGpjMacros) { @@ -624,12 +735,12 @@ void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives( char const* const customization = this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION"); if (nullptr != customization && strlen(customization) > 0) { - fout << "customization=" << trimQuotes(customization) << std::endl; + fout << "customization=" << this->TrimQuotes(customization) << std::endl; this->GetCMakeInstance()->MarkCliAsUsed("GHS_CUSTOMIZATION"); } } -std::string cmGlobalGhsMultiGenerator::trimQuotes(std::string const& str) +std::string cmGlobalGhsMultiGenerator::TrimQuotes(std::string const& str) { std::string result; result.reserve(str.size()); @@ -662,3 +773,56 @@ cmGlobalGhsMultiGenerator::OrderedTargetDependSet::OrderedTargetDependSet( { this->insert(targets.begin(), targets.end()); } + +bool cmGlobalGhsMultiGenerator::ComputeTargetBuildOrder( + cmGeneratorTarget const* tgt, std::vector& build) +{ + std::vector t{ tgt }; + return ComputeTargetBuildOrder(t, build); +} + +bool cmGlobalGhsMultiGenerator::ComputeTargetBuildOrder( + std::vector& tgt, + std::vector& build) +{ + std::set temp; + std::set perm; + + for (auto ti : tgt) { + bool r = VisitTarget(temp, perm, build, ti); + if (r) { + return r; + } + } + return false; +} + +bool cmGlobalGhsMultiGenerator::VisitTarget( + std::set& temp, + std::set& perm, + std::vector& order, cmGeneratorTarget const* ti) +{ + /* check if permanent mark is set*/ + if (perm.find(ti) == perm.end()) { + /* set temporary mark; check if revisit*/ + if (temp.insert(ti).second) { + /* sort targets lexicographically to ensure that nodes are always visited + * in the same order */ + OrderedTargetDependSet sortedTargets(this->GetTargetDirectDepends(ti), + ""); + for (auto& di : sortedTargets) { + if (this->VisitTarget(temp, perm, order, di)) { + return true; + } + } + /* mark as complete; insert into beginning of list*/ + perm.insert(ti); + order.push_back(ti); + return false; + } + /* revisiting item - not a DAG */ + return true; + } + /* already complete */ + return false; +} diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index 5027a7c..a964af8 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -78,23 +78,7 @@ public: // Write the common disclaimer text at the top of each build file. void WriteFileHeader(std::ostream& fout); - // Target dependency sorting - class TargetSet : public std::set - { - }; - class TargetCompare - { - std::string First; - - public: - TargetCompare(std::string first) - : First(std::move(first)) - { - } - bool operator()(cmGeneratorTarget const* l, - cmGeneratorTarget const* r) const; - }; - class OrderedTargetDependSet; + const char* GetInstallTargetName() const override { return "install"; } protected: void Generate() override; @@ -111,30 +95,55 @@ private: /* top-level project */ void OutputTopLevelProject(cmLocalGenerator* root, std::vector& generators); - void WriteTopLevelProject(std::ostream& fout, cmLocalGenerator* root, - std::vector& generators); - void WriteMacros(std::ostream& fout); + void WriteTopLevelProject(std::ostream& fout, cmLocalGenerator* root); + void WriteMacros(std::ostream& fout, cmLocalGenerator* root); void WriteHighLevelDirectives(cmLocalGenerator* root, std::ostream& fout); - void WriteSubProjects(std::ostream& fout, cmLocalGenerator* root, - std::vector& generators); - void WriteTargetProjects(std::ostream& fout, cmLocalGenerator* root, - std::vector& generators, - bool proj); - void WriteDefaultProject(std::ostream& fout, cmLocalGenerator* root, - std::vector& generators); + void WriteSubProjects(std::ostream& fout, cmLocalGenerator* root); + void WriteTargets(cmLocalGenerator* root); + void WriteProjects(cmLocalGenerator* root); void WriteProjectLine(std::ostream& fout, cmGeneratorTarget const* target, - cmLocalGenerator* root, std::string& rootBinaryDir, - bool proj); + cmLocalGenerator* root, std::string& rootBinaryDir); + void WriteProjectRefLine(std::ostream& fout, cmGeneratorTarget const* target, + cmLocalGenerator* root, std::string& rootBinaryDir); void WriteCustomRuleBOD(std::ostream& fout); void WriteCustomTargetBOD(std::ostream& fout); + void WriteAllTarget(cmLocalGenerator* root, + std::vector& generators); - std::string trimQuotes(std::string const& str); + std::string TrimQuotes(std::string const& str); std::string OsDir; static const char* DEFAULT_BUILD_PROGRAM; static const char* DEFAULT_TOOLSET_ROOT; - std::vector DefaultTargets; + + bool ComputeTargetBuildOrder(cmGeneratorTarget const* tgt, + std::vector& build); + bool ComputeTargetBuildOrder(std::vector& tgt, + std::vector& build); + bool VisitTarget(std::set& temp, + std::set& perm, + std::vector& order, + cmGeneratorTarget const* ti); + std::vector ProjectTargets; + + // Target sorting + class TargetSet : public std::set + { + }; + class TargetCompare + { + std::string First; + + public: + TargetCompare(std::string first) + : First(std::move(first)) + { + } + bool operator()(cmGeneratorTarget const* l, + cmGeneratorTarget const* r) const; + }; + class OrderedTargetDependSet; }; class cmGlobalGhsMultiGenerator::OrderedTargetDependSet diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 3746965..2d9b806 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2336,7 +2336,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endmacro() macro(add_test_GhsMulti_rename_install test_name) add_test_GhsMulti( ${test_name} GhsMultiRenameInstall ${test_name} - "-DCMAKE_INSTALL_PREFIX=. -DRUN_TEST=${test_name}" ${CMAKE_CMAKE_COMMAND} -P ./cmake_install.cmake) + "-DCMAKE_INSTALL_PREFIX=. -DRUN_TEST=${test_name}" ${CMAKE_CMAKE_COMMAND} --build . --target install) endmacro() #unset ghs config variables unset(ghs_config_name) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b6bfa7eeb29937fbed44153518abfa4f28b9aa62 commit b6bfa7eeb29937fbed44153518abfa4f28b9aa62 Author: Fred Baksik AuthorDate: Mon Apr 8 09:55:34 2019 -0400 Commit: Fred Baksik CommitDate: Thu Apr 11 13:15:50 2019 -0400 GHS: Support add_dependencies() command -- use references to list target dependencies diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 725c4b4..51d08cb 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -109,12 +109,12 @@ void cmGhsMultiTargetGenerator::Generate() void cmGhsMultiTargetGenerator::GenerateTarget() { - // Open the filestream in copy-if-different mode. - std::string fname = this->LocalGenerator->GetCurrentBinaryDirectory(); - fname += "/"; - fname += this->Name; - fname += cmGlobalGhsMultiGenerator::FILE_EXTENSION; - cmGeneratedFileStream fout(fname); + // Open the target file in copy-if-different mode. + std::string fproj = this->LocalGenerator->GetCurrentBinaryDirectory(); + fproj += "/"; + fproj += this->Name; + fproj += cmGlobalGhsMultiGenerator::FILE_EXTENSION; + cmGeneratedFileStream fout(fproj); fout.SetCopyIfDifferent(true); this->GetGlobalGenerator()->WriteFileHeader(fout); @@ -132,9 +132,23 @@ void cmGhsMultiTargetGenerator::GenerateTarget() this->WriteTargetLinkLine(fout, this->ConfigName); this->WriteBuildEvents(fout); } - this->WriteSources(fout); this->WriteReferences(fout); + this->WriteSources(fout); + fout.Close(); + + // Open the target ref file in copy-if-different mode. + std::string fname = this->LocalGenerator->GetCurrentBinaryDirectory(); + fname += "/"; + fname += this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); + fname += "/"; + fname += this->Name + "_REF" + cmGlobalGhsMultiGenerator::FILE_EXTENSION; + cmGeneratedFileStream fref(fname); + fref.SetCopyIfDifferent(true); + this->GetGlobalGenerator()->WriteFileHeader(fref); + GhsMultiGpj::WriteGpjTag(GhsMultiGpj::REFERENCE, fref); + fref << " :reference=" << fproj << std::endl; + fref.Close(); } cmGlobalGhsMultiGenerator* cmGhsMultiTargetGenerator::GetGlobalGenerator() @@ -489,7 +503,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj) /* list of known groups and the order they are displayed in a project file */ const std::vector standardGroups = { - "Header Files", "Source Files", "CMake Rules", + "CMake Rules", "Header Files", "Source Files", "Object Files", "Object Libraries", "Resources" }; @@ -667,7 +681,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj) fname += std::to_string(cmdcount++) + "_"; fname += (sf->GetLocation()).GetName(); fname += this->CmdWindowsShell ? ".bat" : ".sh"; - cmGeneratedFileStream f(fname.c_str()); + cmGeneratedFileStream f(fname); f.SetCopyIfDifferent(true); this->WriteCustomCommandsHelper(f, ccg); f.Close(); @@ -727,11 +741,8 @@ void cmGhsMultiTargetGenerator::WriteObjectLangOverride( void cmGhsMultiTargetGenerator::WriteReferences(std::ostream& fout) { - // This only applies to INTEGRITY Applications - if (this->TagType != GhsMultiGpj::INTERGRITY_APPLICATION) { - return; - } - + // FIXME - compare unordered to ordered projects + // also needs transitive build order deps! // Get the targets that this one depends upon cmTargetDependSet unordered = this->GetGlobalGenerator()->GetTargetDirectDepends(this->GeneratorTarget); @@ -748,9 +759,6 @@ void cmGhsMultiTargetGenerator::WriteReferences(std::ostream& fout) fout << outpath; fout << " "; GhsMultiGpj::WriteGpjTag(GhsMultiGpj::REFERENCE, fout); - - // Tell the global generator that a reference project needs to be created - t->Target->SetProperty("GHS_REFERENCE_PROJECT", "ON"); } } diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 2180770..f212efc 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -322,7 +322,7 @@ void cmGlobalGhsMultiGenerator::WriteCustomTargetBOD(std::ostream& fout) } void cmGlobalGhsMultiGenerator::WriteTopLevelProject( - std::ostream& fout, std::string& ename, cmLocalGenerator* root, + std::ostream& fout, cmLocalGenerator* root, std::vector& generators) { WriteFileHeader(fout); @@ -355,64 +355,80 @@ void cmGlobalGhsMultiGenerator::WriteTopLevelProject( fout << "\"" << this->OsDir << "\"" << std::endl; } - WriteSubProjects(fout, ename, root, generators); + WriteSubProjects(fout, root, generators); } void cmGlobalGhsMultiGenerator::WriteSubProjects( - std::ostream& fout, std::string& ename, cmLocalGenerator* root, + std::ostream& fout, cmLocalGenerator* root, std::vector& generators) { - this->ExcludedTargets.clear(); + this->DefaultTargets.clear(); + this->ProjectTargets.clear(); // Collect all targets under this root generator and the transitive // closure of their dependencies. + // FIXME -- what is correct list or is it build order TargetDependSet projectTargets; TargetDependSet originalTargets; this->GetTargetSets(projectTargets, originalTargets, root, generators); OrderedTargetDependSet orderedProjectTargets(projectTargets, ""); - // write out all the targets for ALL target + // determine the targets for ALL target std::string rootBinaryDir = root->GetCurrentBinaryDirectory(); for (cmGeneratorTarget const* target : orderedProjectTargets) { if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } - if (cmSystemTools::IsOn(target->GetProperty("EXCLUDE_FROM_ALL"))) { - this->ExcludedTargets.push_back(target); - continue; + this->ProjectTargets.push_back(target); + if (!cmSystemTools::IsOn(target->GetProperty("EXCLUDE_FROM_ALL"))) { + this->DefaultTargets.push_back(target); } - this->WriteProjectLine(fout, target, root, rootBinaryDir); - } - if (!this->ExcludedTargets.empty()) { - fout << "{nobuild} " << ename << " [Project]" << std::endl; } + + fout << root->GetProjectName() << ".default" << FILE_EXTENSION + << " [Project]" << std::endl; + fout << "{nobuild} " << root->GetProjectName() << ".target" << FILE_EXTENSION + << " [Project]" << std::endl; + fout << "{nobuild} " << root->GetProjectName() << ".project" + << FILE_EXTENSION << " [Project]" << std::endl; } -void cmGlobalGhsMultiGenerator::WriteExcludedProjects( +void cmGlobalGhsMultiGenerator::WriteDefaultProject( std::ostream& fout, cmLocalGenerator* root, std::vector& generators) { - // write out all the excluded targets + // write out all the targets for this project + WriteFileHeader(fout); + GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, fout); std::string rootBinaryDir = root->GetCurrentBinaryDirectory(); - for (cmGeneratorTarget const* target : this->ExcludedTargets) { - if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { - continue; - } - this->WriteProjectLine(fout, target, root, rootBinaryDir); + for (cmGeneratorTarget const* target : this->DefaultTargets) { + this->WriteProjectLine(fout, target, root, rootBinaryDir, false); + } +} + +void cmGlobalGhsMultiGenerator::WriteTargetProjects( + std::ostream& fout, cmLocalGenerator* root, + std::vector& generators, bool proj) +{ + // write out all the targets for this project + WriteFileHeader(fout); + GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, fout); + std::string rootBinaryDir = root->GetCurrentBinaryDirectory(); + for (cmGeneratorTarget const* target : this->ProjectTargets) { + this->WriteProjectLine(fout, target, root, rootBinaryDir, proj); } - this->ExcludedTargets.clear(); } void cmGlobalGhsMultiGenerator::WriteProjectLine( std::ostream& fout, cmGeneratorTarget const* target, cmLocalGenerator* root, - std::string& rootBinaryDir) + std::string& rootBinaryDir, bool proj) { const char* projName = target->GetProperty("GENERATOR_FILE_NAME"); const char* projType = target->GetProperty("GENERATOR_FILE_NAME_EXT"); if (projName && projType) { cmLocalGenerator* lg = target->GetLocalGenerator(); std::string dir = lg->GetCurrentBinaryDirectory(); - dir = root->MaybeConvertToRelativePath(rootBinaryDir, dir.c_str()); + dir = root->MaybeConvertToRelativePath(rootBinaryDir, dir); if (dir == ".") { dir.clear(); } else { @@ -424,23 +440,6 @@ void cmGlobalGhsMultiGenerator::WriteProjectLine( std::string projFile = dir + projName + FILE_EXTENSION; fout << projFile; fout << " " << projType << std::endl; - - if (cmSystemTools::IsOn(target->GetProperty("GHS_REFERENCE_PROJECT"))) { - // create reference project - std::string fname = dir; - fname += target->GetName(); - fname += "REF"; - fname += FILE_EXTENSION; - - cmGeneratedFileStream fref(fname); - fref.SetCopyIfDifferent(true); - - this->WriteFileHeader(fref); - GhsMultiGpj::WriteGpjTag(GhsMultiGpj::REFERENCE, fref); - fref << " :reference=" << projFile << std::endl; - - fref.Close(); - } } } @@ -468,7 +467,7 @@ void cmGlobalGhsMultiGenerator::Generate() // create custom target BOD file fname = this->GetCMakeInstance()->GetHomeOutputDirectory() + "/CMakeFiles/custom_target.bod"; - cmGeneratedFileStream ftarget(fname.c_str()); + cmGeneratedFileStream ftarget(fname); ftarget.SetCopyIfDifferent(true); this->WriteFileHeader(ftarget); this->WriteCustomTargetBOD(ftarget); @@ -479,7 +478,6 @@ void cmGlobalGhsMultiGenerator::OutputTopLevelProject( cmLocalGenerator* root, std::vector& generators) { std::string fname; - std::string ename; if (generators.empty()) { return; @@ -495,24 +493,37 @@ void cmGlobalGhsMultiGenerator::OutputTopLevelProject( fname += ".top"; fname += FILE_EXTENSION; - ename = root->GetProjectName(); - ename += ".nobuild"; - ename += FILE_EXTENSION; - cmGeneratedFileStream top(fname); top.SetCopyIfDifferent(true); - this->WriteTopLevelProject(top, ename, root, generators); + this->WriteTopLevelProject(top, root, generators); top.Close(); - if (!this->ExcludedTargets.empty()) { - ename = root->GetCurrentBinaryDirectory() + "/" + ename; - cmGeneratedFileStream exclude(ename); - exclude.SetCopyIfDifferent(true); - WriteFileHeader(exclude); - GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, exclude); - this->WriteExcludedProjects(exclude, root, generators); - exclude.Close(); - } + fname = root->GetCurrentBinaryDirectory() + "/"; + fname += root->GetProjectName(); + fname += ".target"; + fname += FILE_EXTENSION; + cmGeneratedFileStream target(fname); + target.SetCopyIfDifferent(true); + this->WriteTargetProjects(target, root, generators, false); + target.Close(); + + fname = root->GetCurrentBinaryDirectory() + "/"; + fname += root->GetProjectName(); + fname += ".project"; + fname += FILE_EXTENSION; + cmGeneratedFileStream project(fname); + project.SetCopyIfDifferent(true); + this->WriteTargetProjects(project, root, generators, true); + project.Close(); + + fname = root->GetCurrentBinaryDirectory() + "/"; + fname += root->GetProjectName(); + fname += ".default"; + fname += FILE_EXTENSION; + cmGeneratedFileStream default_targets(fname); + default_targets.SetCopyIfDifferent(true); + this->WriteDefaultProject(default_targets, root, generators); + default_targets.Close(); } std::vector diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index a987205..5027a7c 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -111,18 +111,20 @@ private: /* top-level project */ void OutputTopLevelProject(cmLocalGenerator* root, std::vector& generators); - void WriteTopLevelProject(std::ostream& fout, std::string& ename, - cmLocalGenerator* root, + void WriteTopLevelProject(std::ostream& fout, cmLocalGenerator* root, std::vector& generators); void WriteMacros(std::ostream& fout); void WriteHighLevelDirectives(cmLocalGenerator* root, std::ostream& fout); - void WriteSubProjects(std::ostream& fout, std::string& ename, - cmLocalGenerator* root, + void WriteSubProjects(std::ostream& fout, cmLocalGenerator* root, std::vector& generators); - void WriteExcludedProjects(std::ostream& fout, cmLocalGenerator* root, - std::vector& generators); + void WriteTargetProjects(std::ostream& fout, cmLocalGenerator* root, + std::vector& generators, + bool proj); + void WriteDefaultProject(std::ostream& fout, cmLocalGenerator* root, + std::vector& generators); void WriteProjectLine(std::ostream& fout, cmGeneratorTarget const* target, - cmLocalGenerator* root, std::string& rootBinaryDir); + cmLocalGenerator* root, std::string& rootBinaryDir, + bool proj); void WriteCustomRuleBOD(std::ostream& fout); void WriteCustomTargetBOD(std::ostream& fout); @@ -131,7 +133,8 @@ private: std::string OsDir; static const char* DEFAULT_BUILD_PROGRAM; static const char* DEFAULT_TOOLSET_ROOT; - std::vector ExcludedTargets; + std::vector DefaultTargets; + std::vector ProjectTargets; }; class cmGlobalGhsMultiGenerator::OrderedTargetDependSet https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=39ee9718d9a56e7b8b15f63576f042415a2771f8 commit 39ee9718d9a56e7b8b15f63576f042415a2771f8 Author: Fred Baksik AuthorDate: Mon Apr 8 09:55:34 2019 -0400 Commit: Fred Baksik CommitDate: Thu Apr 11 13:15:50 2019 -0400 GHS: Support add_custom_target() command -- add new project type that runs shell scripts in proper order diff --git a/Source/cmGhsMultiGpj.cxx b/Source/cmGhsMultiGpj.cxx index 8b69b51..da27971 100644 --- a/Source/cmGhsMultiGpj.cxx +++ b/Source/cmGhsMultiGpj.cxx @@ -9,7 +9,8 @@ static const char* GHS_TAG[] = { "[INTEGRITY Application]", "[Project]", "[Program]", "[Reference]", - "[Subproject]" }; + "[Subproject]", + "[Custom Target]" }; const char* GhsMultiGpj::GetGpjTag(Types gpjType) { @@ -21,6 +22,7 @@ const char* GhsMultiGpj::GetGpjTag(Types gpjType) case PROGRAM: case REFERENCE: case SUBPROJECT: + case CUSTOM_TARGET: tag = GHS_TAG[gpjType]; break; default: diff --git a/Source/cmGhsMultiGpj.h b/Source/cmGhsMultiGpj.h index 420eab1..e588150 100644 --- a/Source/cmGhsMultiGpj.h +++ b/Source/cmGhsMultiGpj.h @@ -16,7 +16,8 @@ public: PROJECT, PROGRAM, REFERENCE, - SUBPROJECT + SUBPROJECT, + CUSTOM_TARGET }; static void WriteGpjTag(Types gpjType, std::ostream& fout); diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 9d0d195..725c4b4 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -90,10 +90,9 @@ void cmGhsMultiTargetGenerator::Generate() return; } case cmStateEnums::UTILITY: { - std::string msg = "add_custom_target( ...) not supported: "; - msg += this->Name; - cmSystemTools::Message(msg); - return; + this->TargetNameReal = this->GeneratorTarget->GetName(); + this->TagType = GhsMultiGpj::CUSTOM_TARGET; + break; } default: return; @@ -124,13 +123,15 @@ void cmGhsMultiTargetGenerator::GenerateTarget() const std::string language( this->GeneratorTarget->GetLinkerLanguage(this->ConfigName)); - this->WriteTargetSpecifics(fout, this->ConfigName); - this->SetCompilerFlags(this->ConfigName, language); - this->WriteCompilerFlags(fout, this->ConfigName, language); - this->WriteCompilerDefinitions(fout, this->ConfigName, language); - this->WriteIncludes(fout, this->ConfigName, language); - this->WriteTargetLinkLine(fout, this->ConfigName); - this->WriteBuildEvents(fout); + if (this->TagType != GhsMultiGpj::CUSTOM_TARGET) { + this->WriteTargetSpecifics(fout, this->ConfigName); + this->SetCompilerFlags(this->ConfigName, language); + this->WriteCompilerFlags(fout, this->ConfigName, language); + this->WriteCompilerDefinitions(fout, this->ConfigName, language); + this->WriteIncludes(fout, this->ConfigName, language); + this->WriteTargetLinkLine(fout, this->ConfigName); + this->WriteBuildEvents(fout); + } this->WriteSources(fout); this->WriteReferences(fout); fout.Close(); @@ -315,9 +316,11 @@ void cmGhsMultiTargetGenerator::WriteBuildEvents(std::ostream& fout) fout, this->GeneratorTarget->GetPreBuildCommands(), std::string("prebuild"), std::string("preexecShell")); - this->WriteBuildEventsHelper( - fout, this->GeneratorTarget->GetPreLinkCommands(), std::string("prelink"), - std::string("preexecShell")); + if (this->TagType != GhsMultiGpj::CUSTOM_TARGET) { + this->WriteBuildEventsHelper( + fout, this->GeneratorTarget->GetPreLinkCommands(), + std::string("prelink"), std::string("preexecShell")); + } this->WriteBuildEventsHelper( fout, this->GeneratorTarget->GetPostBuildCommands(), @@ -343,7 +346,12 @@ void cmGhsMultiTargetGenerator::WriteBuildEventsHelper( f.SetCopyIfDifferent(true); this->WriteCustomCommandsHelper(f, ccg); f.Close(); - fout << " :" << cmd << "=\"" << fname << "\"" << std::endl; + if (this->TagType != GhsMultiGpj::CUSTOM_TARGET) { + fout << " :" << cmd << "=\"" << fname << "\"" << std::endl; + } else { + fout << fname << std::endl; + fout << " :outputName=\"" << fname << ".rule\"" << std::endl; + } for (auto& byp : ccg.GetByproducts()) { fout << " :extraOutputFile=\"" << byp << "\"" << std::endl; } @@ -499,6 +507,14 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj) groupFilesList[i] = *n; i += 1; groupNames.erase(gn); + } else if (this->TagType == GhsMultiGpj::CUSTOM_TARGET && + gn == "CMake Rules") { + /* make sure that rules folder always exists in case of custom targets + * that have no custom commands except for pre or post build events. + */ + groupFilesList.resize(groupFilesList.size() + 1); + groupFilesList[i] = gn; + i += 1; } } @@ -575,37 +591,46 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj) if (sg != "CMake Rules") { /* output rule for each source file */ for (const cmSourceFile* si : groupFiles[sg]) { - + bool compile = true; // Convert filename to native system // WORKAROUND: GHS MULTI 6.1.4 and 6.1.6 are known to need backslash on // windows when opening some files from the search window. std::string fname(si->GetFullPath()); cmSystemTools::ConvertToOutputSlashes(fname); - /* Comment out any custom command dependencies to prevent from - * being considered part of the build. + /* For custom targets list any associated sources, + * comment out source code to prevent it from being + * compiled when processing this target. + * Otherwise, comment out any custom command (main) dependencies that + * are listed as source files to prevent them from being considered + * part of the build. */ std::string comment; - if (si->GetCustomCommand()) { + if ((this->TagType == GhsMultiGpj::CUSTOM_TARGET && + !si->GetLanguage().empty()) || + si->GetCustomCommand()) { comment = "{comment} "; + compile = false; } - *fout << comment << fname << std::endl; - if ("ld" != si->GetExtension() && "int" != si->GetExtension() && - "bsp" != si->GetExtension()) { - WriteObjectLangOverride(*fout, si); - } + *fout << comment << fname << std::endl; + if (compile) { + if ("ld" != si->GetExtension() && "int" != si->GetExtension() && + "bsp" != si->GetExtension()) { + WriteObjectLangOverride(*fout, si); + } - this->WriteSourceProperty(*fout, si, "INCLUDE_DIRECTORIES", "-I"); - this->WriteSourceProperty(*fout, si, "COMPILE_DEFINITIONS", "-D"); - this->WriteSourceProperty(*fout, si, "COMPILE_OPTIONS", ""); + this->WriteSourceProperty(*fout, si, "INCLUDE_DIRECTORIES", "-I"); + this->WriteSourceProperty(*fout, si, "COMPILE_DEFINITIONS", "-D"); + this->WriteSourceProperty(*fout, si, "COMPILE_OPTIONS", ""); - /* to avoid clutter in the gui only print out the objectName if it has - * been renamed */ - std::string objectName = this->GeneratorTarget->GetObjectName(si); - if (!objectName.empty() && - this->GeneratorTarget->HasExplicitObjectName(si)) { - *fout << " -o " << objectName << std::endl; + /* to avoid clutter in the GUI only print out the objectName if it + * has been renamed */ + std::string objectName = this->GeneratorTarget->GetObjectName(si); + if (!objectName.empty() && + this->GeneratorTarget->HasExplicitObjectName(si)) { + *fout << " -o " << objectName << std::endl; + } } } } else { @@ -649,6 +674,9 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj) this->WriteCustomCommandLine(*fout, fname, ccg); } } + if (this->TagType == GhsMultiGpj::CUSTOM_TARGET) { + this->WriteBuildEvents(*fout); + } } } diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index a2138d1..2180770 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -308,8 +308,21 @@ void cmGlobalGhsMultiGenerator::WriteCustomRuleBOD(std::ostream& fout) "}\n"; } +void cmGlobalGhsMultiGenerator::WriteCustomTargetBOD(std::ostream& fout) +{ + fout << "FileTypes {\n" + " CmakeTarget {\n" + " name = \"Custom Target\"\n" + " action = \"&Execute\"\n" + " grepable = false\n" + " outputType = \"None\"\n" + " color = \"#800080\"\n" + " }\n" + "}\n"; +} + void cmGlobalGhsMultiGenerator::WriteTopLevelProject( - std::ostream& fout, cmLocalGenerator* root, + std::ostream& fout, std::string& ename, cmLocalGenerator* root, std::vector& generators) { WriteFileHeader(fout); @@ -342,13 +355,15 @@ void cmGlobalGhsMultiGenerator::WriteTopLevelProject( fout << "\"" << this->OsDir << "\"" << std::endl; } - WriteSubProjects(fout, root, generators); + WriteSubProjects(fout, ename, root, generators); } void cmGlobalGhsMultiGenerator::WriteSubProjects( - std::ostream& fout, cmLocalGenerator* root, + std::ostream& fout, std::string& ename, cmLocalGenerator* root, std::vector& generators) { + this->ExcludedTargets.clear(); + // Collect all targets under this root generator and the transitive // closure of their dependencies. TargetDependSet projectTargets; @@ -356,50 +371,75 @@ void cmGlobalGhsMultiGenerator::WriteSubProjects( this->GetTargetSets(projectTargets, originalTargets, root, generators); OrderedTargetDependSet orderedProjectTargets(projectTargets, ""); - // write out all the sub-projects + // write out all the targets for ALL target std::string rootBinaryDir = root->GetCurrentBinaryDirectory(); for (cmGeneratorTarget const* target : orderedProjectTargets) { if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } + if (cmSystemTools::IsOn(target->GetProperty("EXCLUDE_FROM_ALL"))) { + this->ExcludedTargets.push_back(target); + continue; + } + this->WriteProjectLine(fout, target, root, rootBinaryDir); + } + if (!this->ExcludedTargets.empty()) { + fout << "{nobuild} " << ename << " [Project]" << std::endl; + } +} - const char* projName = target->GetProperty("GENERATOR_FILE_NAME"); - const char* projType = target->GetProperty("GENERATOR_FILE_NAME_EXT"); - if (projName && projType) { - cmLocalGenerator* lg = target->GetLocalGenerator(); - std::string dir = lg->GetCurrentBinaryDirectory(); - dir = root->MaybeConvertToRelativePath(rootBinaryDir, dir); - if (dir == ".") { - dir.clear(); - } else { - if (dir.back() != '/') { - dir += "/"; - } - } +void cmGlobalGhsMultiGenerator::WriteExcludedProjects( + std::ostream& fout, cmLocalGenerator* root, + std::vector& generators) +{ + // write out all the excluded targets + std::string rootBinaryDir = root->GetCurrentBinaryDirectory(); + for (cmGeneratorTarget const* target : this->ExcludedTargets) { + if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { + continue; + } + this->WriteProjectLine(fout, target, root, rootBinaryDir); + } + this->ExcludedTargets.clear(); +} - if (cmSystemTools::IsOn(target->GetProperty("EXCLUDE_FROM_ALL"))) { - fout << "{comment} "; +void cmGlobalGhsMultiGenerator::WriteProjectLine( + std::ostream& fout, cmGeneratorTarget const* target, cmLocalGenerator* root, + std::string& rootBinaryDir) +{ + const char* projName = target->GetProperty("GENERATOR_FILE_NAME"); + const char* projType = target->GetProperty("GENERATOR_FILE_NAME_EXT"); + if (projName && projType) { + cmLocalGenerator* lg = target->GetLocalGenerator(); + std::string dir = lg->GetCurrentBinaryDirectory(); + dir = root->MaybeConvertToRelativePath(rootBinaryDir, dir.c_str()); + if (dir == ".") { + dir.clear(); + } else { + if (dir.back() != '/') { + dir += "/"; } - std::string projFile = dir + projName + FILE_EXTENSION; - fout << projFile; - fout << " " << projType << std::endl; + } - if (cmSystemTools::IsOn(target->GetProperty("GHS_REFERENCE_PROJECT"))) { - // create reference project - std::string fname = dir; - fname += target->GetName(); - fname += "REF"; - fname += FILE_EXTENSION; + std::string projFile = dir + projName + FILE_EXTENSION; + fout << projFile; + fout << " " << projType << std::endl; - cmGeneratedFileStream fref(fname); - fref.SetCopyIfDifferent(true); + if (cmSystemTools::IsOn(target->GetProperty("GHS_REFERENCE_PROJECT"))) { + // create reference project + std::string fname = dir; + fname += target->GetName(); + fname += "REF"; + fname += FILE_EXTENSION; - this->WriteFileHeader(fref); - GhsMultiGpj::WriteGpjTag(GhsMultiGpj::REFERENCE, fref); - fref << " :reference=" << projFile << std::endl; + cmGeneratedFileStream fref(fname); + fref.SetCopyIfDifferent(true); - fref.Close(); - } + this->WriteFileHeader(fref); + GhsMultiGpj::WriteGpjTag(GhsMultiGpj::REFERENCE, fref); + fref << " :reference=" << projFile << std::endl; + + fref.Close(); } } } @@ -424,11 +464,23 @@ void cmGlobalGhsMultiGenerator::Generate() this->WriteFileHeader(frule); this->WriteCustomRuleBOD(frule); frule.Close(); + + // create custom target BOD file + fname = this->GetCMakeInstance()->GetHomeOutputDirectory() + + "/CMakeFiles/custom_target.bod"; + cmGeneratedFileStream ftarget(fname.c_str()); + ftarget.SetCopyIfDifferent(true); + this->WriteFileHeader(ftarget); + this->WriteCustomTargetBOD(ftarget); + ftarget.Close(); } void cmGlobalGhsMultiGenerator::OutputTopLevelProject( cmLocalGenerator* root, std::vector& generators) { + std::string fname; + std::string ename; + if (generators.empty()) { return; } @@ -437,18 +489,30 @@ void cmGlobalGhsMultiGenerator::OutputTopLevelProject( * with target projects. This avoid the issue where the project has * the same name as the executable target. */ - std::string fname = root->GetCurrentBinaryDirectory(); + fname = root->GetCurrentBinaryDirectory(); fname += "/"; fname += root->GetProjectName(); fname += ".top"; fname += FILE_EXTENSION; - cmGeneratedFileStream fout(fname); - fout.SetCopyIfDifferent(true); - - this->WriteTopLevelProject(fout, root, generators); - - fout.Close(); + ename = root->GetProjectName(); + ename += ".nobuild"; + ename += FILE_EXTENSION; + + cmGeneratedFileStream top(fname); + top.SetCopyIfDifferent(true); + this->WriteTopLevelProject(top, ename, root, generators); + top.Close(); + + if (!this->ExcludedTargets.empty()) { + ename = root->GetCurrentBinaryDirectory() + "/" + ename; + cmGeneratedFileStream exclude(ename); + exclude.SetCopyIfDifferent(true); + WriteFileHeader(exclude); + GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, exclude); + this->WriteExcludedProjects(exclude, root, generators); + exclude.Close(); + } } std::vector @@ -543,6 +607,8 @@ void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives( fout << "primaryTarget=" << tgt << std::endl; fout << "customization=" << root->GetBinaryDirectory() << "/CMakeFiles/custom_rule.bod" << std::endl; + fout << "customization=" << root->GetBinaryDirectory() + << "/CMakeFiles/custom_target.bod" << std::endl; char const* const customization = this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION"); diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index 1dd951a..a987205 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -111,19 +111,27 @@ private: /* top-level project */ void OutputTopLevelProject(cmLocalGenerator* root, std::vector& generators); - void WriteTopLevelProject(std::ostream& fout, cmLocalGenerator* root, + void WriteTopLevelProject(std::ostream& fout, std::string& ename, + cmLocalGenerator* root, std::vector& generators); void WriteMacros(std::ostream& fout); void WriteHighLevelDirectives(cmLocalGenerator* root, std::ostream& fout); - void WriteSubProjects(std::ostream& fout, cmLocalGenerator* root, + void WriteSubProjects(std::ostream& fout, std::string& ename, + cmLocalGenerator* root, std::vector& generators); + void WriteExcludedProjects(std::ostream& fout, cmLocalGenerator* root, + std::vector& generators); + void WriteProjectLine(std::ostream& fout, cmGeneratorTarget const* target, + cmLocalGenerator* root, std::string& rootBinaryDir); void WriteCustomRuleBOD(std::ostream& fout); + void WriteCustomTargetBOD(std::ostream& fout); std::string trimQuotes(std::string const& str); std::string OsDir; static const char* DEFAULT_BUILD_PROGRAM; static const char* DEFAULT_TOOLSET_ROOT; + std::vector ExcludedTargets; }; class cmGlobalGhsMultiGenerator::OrderedTargetDependSet https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8d3dad9a76591ae0426335d039b8aaacb95862cd commit 8d3dad9a76591ae0426335d039b8aaacb95862cd Author: Fred Baksik AuthorDate: Mon Apr 8 09:55:34 2019 -0400 Commit: Fred Baksik CommitDate: Thu Apr 11 13:15:50 2019 -0400 GHS: Support add_custom_command( OUTPUT ) signature -- add new file type to run a shell script -- gbuild does not compute interfile dependencies like other build tools. Therefore calculate the required build order of custom commands and list all of them in the CMake Rules subproject. diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 9f9ef18..9d0d195 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -572,31 +572,82 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj) *fout << "{comment} Others" << std::endl; } - /* output rule for each source file */ - for (const cmSourceFile* si : groupFiles[sg]) { - - // Convert filename to native system - // WORKAROUND: GHS MULTI 6.1.4 and 6.1.6 are known to need backslash on - // windows when opening some files from the search window. - std::string fname(si->GetFullPath()); - cmSystemTools::ConvertToOutputSlashes(fname); - *fout << fname << std::endl; - - if ("ld" != si->GetExtension() && "int" != si->GetExtension() && - "bsp" != si->GetExtension()) { - WriteObjectLangOverride(*fout, si); - } + if (sg != "CMake Rules") { + /* output rule for each source file */ + for (const cmSourceFile* si : groupFiles[sg]) { + + // Convert filename to native system + // WORKAROUND: GHS MULTI 6.1.4 and 6.1.6 are known to need backslash on + // windows when opening some files from the search window. + std::string fname(si->GetFullPath()); + cmSystemTools::ConvertToOutputSlashes(fname); + + /* Comment out any custom command dependencies to prevent from + * being considered part of the build. + */ + std::string comment; + if (si->GetCustomCommand()) { + comment = "{comment} "; + } + *fout << comment << fname << std::endl; - this->WriteSourceProperty(*fout, si, "INCLUDE_DIRECTORIES", "-I"); - this->WriteSourceProperty(*fout, si, "COMPILE_DEFINITIONS", "-D"); - this->WriteSourceProperty(*fout, si, "COMPILE_OPTIONS", ""); + if ("ld" != si->GetExtension() && "int" != si->GetExtension() && + "bsp" != si->GetExtension()) { + WriteObjectLangOverride(*fout, si); + } - /* to avoid clutter in the gui only print out the objectName if it has - * been renamed */ - std::string objectName = this->GeneratorTarget->GetObjectName(si); - if (!objectName.empty() && - this->GeneratorTarget->HasExplicitObjectName(si)) { - *fout << " -o " << objectName << std::endl; + this->WriteSourceProperty(*fout, si, "INCLUDE_DIRECTORIES", "-I"); + this->WriteSourceProperty(*fout, si, "COMPILE_DEFINITIONS", "-D"); + this->WriteSourceProperty(*fout, si, "COMPILE_OPTIONS", ""); + + /* to avoid clutter in the gui only print out the objectName if it has + * been renamed */ + std::string objectName = this->GeneratorTarget->GetObjectName(si); + if (!objectName.empty() && + this->GeneratorTarget->HasExplicitObjectName(si)) { + *fout << " -o " << objectName << std::endl; + } + } + } else { + std::vector customCommands; + if (ComputeCustomCommandOrder(customCommands)) { + std::string message = "The custom commands for target [" + + this->GeneratorTarget->GetName() + "] had a cycle.\n"; + cmSystemTools::Error(message); + } else { + /* Custom targets do not have a dependency on SOURCES files. + * Therefore the dependency list may include SOURCES files after the + * custom target. Because nothing can depend on the custom target just + * move it to the last item. + */ + for (auto sf = customCommands.begin(); sf != customCommands.end(); + ++sf) { + if (((*sf)->GetLocation()).GetName() == this->Name + ".rule") { + std::rotate(sf, sf + 1, customCommands.end()); + break; + } + } + int cmdcount = 0; + for (auto& sf : customCommands) { + const cmCustomCommand* cc = sf->GetCustomCommand(); + cmCustomCommandGenerator ccg(*cc, this->ConfigName, + this->LocalGenerator); + + // Open the filestream for this custom command + std::string fname = + this->LocalGenerator->GetCurrentBinaryDirectory(); + fname += "/" + + this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); + fname += "/" + this->Name + "_cc"; + fname += std::to_string(cmdcount++) + "_"; + fname += (sf->GetLocation()).GetName(); + fname += this->CmdWindowsShell ? ".bat" : ".sh"; + cmGeneratedFileStream f(fname.c_str()); + f.SetCopyIfDifferent(true); + this->WriteCustomCommandsHelper(f, ccg); + f.Close(); + this->WriteCustomCommandLine(*fout, fname, ccg); + } } } } @@ -606,6 +657,33 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj) } } +void cmGhsMultiTargetGenerator::WriteCustomCommandLine( + std::ostream& fout, std::string& fname, cmCustomCommandGenerator const& ccg) +{ + /* NOTE: Customization Files are not well documented. Testing showed + * that ":outputName=file" can only be used once per script. The + * script will only run if ":outputName=file" is missing or just run + * once if ":outputName=file" is not specified. If there are + * multiple outputs then the script needs to be listed multiple times + * for each output. Otherwise it won't rerun the script if one of + * the outputs is manually deleted. + */ + bool specifyExtra = true; + for (auto& out : ccg.GetOutputs()) { + fout << fname << std::endl; + fout << " :outputName=\"" << out << "\"" << std::endl; + if (specifyExtra) { + for (auto& byp : ccg.GetByproducts()) { + fout << " :extraOutputFile=\"" << byp << "\"" << std::endl; + } + for (auto& dep : ccg.GetDepends()) { + fout << " :depends=\"" << dep << "\"" << std::endl; + } + specifyExtra = false; + } + } +} + void cmGhsMultiTargetGenerator::WriteObjectLangOverride( std::ostream& fout, const cmSourceFile* sourceFile) { @@ -643,7 +721,7 @@ void cmGhsMultiTargetGenerator::WriteReferences(std::ostream& fout) fout << " "; GhsMultiGpj::WriteGpjTag(GhsMultiGpj::REFERENCE, fout); - // Tell the global generator that a refernce project needs to be created + // Tell the global generator that a reference project needs to be created t->Target->SetProperty("GHS_REFERENCE_PROJECT", "ON"); } } @@ -664,3 +742,51 @@ bool cmGhsMultiTargetGenerator::DetermineIfIntegrityApp() } return false; } + +bool cmGhsMultiTargetGenerator::ComputeCustomCommandOrder( + std::vector& order) +{ + std::set temp; + std::set perm; + + // Collect all custom commands for this target + std::vector customCommands; + this->GeneratorTarget->GetCustomCommands(customCommands, this->ConfigName); + + for (cmSourceFile const* si : customCommands) { + bool r = VisitCustomCommand(temp, perm, order, si); + if (r) { + return r; + } + } + return false; +} + +bool cmGhsMultiTargetGenerator::VisitCustomCommand( + std::set& temp, std::set& perm, + std::vector& order, cmSourceFile const* si) +{ + /* check if permanent mark is set*/ + if (perm.find(si) == perm.end()) { + /* set temporary mark; check if revisit*/ + if (temp.insert(si).second) { + for (auto& di : si->GetCustomCommand()->GetDepends()) { + cmSourceFile const* sf = this->GeneratorTarget->GetLocalGenerator() + ->GetMakefile() + ->GetSourceFileWithOutput(di); + /* if sf exists then visit */ + if (sf && this->VisitCustomCommand(temp, perm, order, sf)) { + return true; + } + } + /* mark as complete; insert into beginning of list*/ + perm.insert(si); + order.push_back(si); + return false; + } + /* revisiting item - not a DAG */ + return true; + } + /* already complete */ + return false; +} diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index fa251b0..3ba3884 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -54,6 +55,13 @@ private: std::string const& name, std::string const& cmd); void WriteCustomCommandsHelper(std::ostream& fout, cmCustomCommandGenerator const& ccg); + void WriteCustomCommandLine(std::ostream& fout, std::string& fname, + cmCustomCommandGenerator const& ccg); + bool ComputeCustomCommandOrder(std::vector& order); + bool VisitCustomCommand(std::set& temp, + std::set& perm, + std::vector& order, + cmSourceFile const* sf); void WriteSources(std::ostream& fout_proj); void WriteSourceProperty(std::ostream& fout, const cmSourceFile* sf, std::string const& propName, diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 9f361f6..a2138d1 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -265,6 +265,49 @@ void cmGlobalGhsMultiGenerator::WriteFileHeader(std::ostream& fout) << std::endl; } +void cmGlobalGhsMultiGenerator::WriteCustomRuleBOD(std::ostream& fout) +{ + fout << "Commands {\n" + " Custom_Rule_Command {\n" + " name = \"Custom Rule Command\"\n" + " exec = \""; +#ifdef _WIN32 + fout << "cmd.exe"; +#else + fout << "/bin/sh"; +#endif + fout << "\"\n" + " options = {\"SpecialOptions\"}\n" + " }\n" + "}\n"; + + fout << "\n\n"; + fout << "FileTypes {\n" + " CmakeRule {\n" + " name = \"Custom Rule\"\n" + " action = \"&Run\"\n" + " extensions = {\""; +#ifdef _WIN32 + fout << "bat"; +#else + fout << "sh"; +#endif + fout << "\"}\n" + " grepable = false\n" + " command = \"Custom Rule Command\"\n" + " commandLine = \"$COMMAND "; +#ifdef _WIN32 + fout << "/c"; +#endif + fout << " $INPUTFILE\"\n" + " progress = \"Processing Custom Rule\"\n" + " promoteToFirstPass = true\n" + " outputType = \"None\"\n" + " color = \"#800080\"\n" + " }\n" + "}\n"; +} + void cmGlobalGhsMultiGenerator::WriteTopLevelProject( std::ostream& fout, cmLocalGenerator* root, std::vector& generators) @@ -272,7 +315,7 @@ void cmGlobalGhsMultiGenerator::WriteTopLevelProject( WriteFileHeader(fout); this->WriteMacros(fout); - this->WriteHighLevelDirectives(fout); + this->WriteHighLevelDirectives(root, fout); GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, fout); fout << "# Top Level Project File" << std::endl; @@ -363,6 +406,8 @@ void cmGlobalGhsMultiGenerator::WriteSubProjects( void cmGlobalGhsMultiGenerator::Generate() { + std::string fname; + // first do the superclass method this->cmGlobalGenerator::Generate(); @@ -370,6 +415,15 @@ void cmGlobalGhsMultiGenerator::Generate() for (auto& it : this->ProjectMap) { this->OutputTopLevelProject(it.second[0], it.second); } + + // create custom rule BOD file + fname = this->GetCMakeInstance()->GetHomeOutputDirectory() + + "/CMakeFiles/custom_rule.bod"; + cmGeneratedFileStream frule(fname); + frule.SetCopyIfDifferent(true); + this->WriteFileHeader(frule); + this->WriteCustomRuleBOD(frule); + frule.Close(); } void cmGlobalGhsMultiGenerator::OutputTopLevelProject( @@ -465,7 +519,8 @@ void cmGlobalGhsMultiGenerator::WriteMacros(std::ostream& fout) } } -void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives(std::ostream& fout) +void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives( + cmLocalGenerator* root, std::ostream& fout) { /* set primary target */ std::string tgt; @@ -486,6 +541,8 @@ void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives(std::ostream& fout) } fout << "primaryTarget=" << tgt << std::endl; + fout << "customization=" << root->GetBinaryDirectory() + << "/CMakeFiles/custom_rule.bod" << std::endl; char const* const customization = this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION"); diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index 1aeb1dc..1dd951a 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -114,9 +114,10 @@ private: void WriteTopLevelProject(std::ostream& fout, cmLocalGenerator* root, std::vector& generators); void WriteMacros(std::ostream& fout); - void WriteHighLevelDirectives(std::ostream& fout); + void WriteHighLevelDirectives(cmLocalGenerator* root, std::ostream& fout); void WriteSubProjects(std::ostream& fout, cmLocalGenerator* root, std::vector& generators); + void WriteCustomRuleBOD(std::ostream& fout); std::string trimQuotes(std::string const& str); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=37acc9e2299713b9b23c767e72b0e0169697e510 commit 37acc9e2299713b9b23c767e72b0e0169697e510 Author: Fred Baksik AuthorDate: Mon Apr 8 09:55:34 2019 -0400 Commit: Brad King CommitDate: Wed Apr 10 11:54:56 2019 -0400 GHS: Update custom command build events -- Fixes issue where commands run out of order; Run commands as single script Do not allow build events to run in parallel -- Use command generator to parse the commands -- Support pre-link build events -- Support more options: COMMENT, BYPRODUCTS, WORKING_DIRECTORY diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 668bcbd..9f9ef18 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -3,7 +3,7 @@ #include "cmGhsMultiTargetGenerator.h" #include "cmCustomCommand.h" -#include "cmCustomCommandLines.h" +#include "cmCustomCommandGenerator.h" #include "cmGeneratedFileStream.h" #include "cmGeneratorTarget.h" #include "cmGlobalGhsMultiGenerator.h" @@ -11,6 +11,7 @@ #include "cmLocalGenerator.h" #include "cmLocalGhsMultiGenerator.h" #include "cmMakefile.h" +#include "cmOutputConverter.h" #include "cmSourceFile.h" #include "cmSourceGroup.h" #include "cmStateDirectory.h" @@ -21,7 +22,6 @@ #include "cmTargetDepend.h" #include -#include #include #include #include @@ -32,6 +32,11 @@ cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget* target) static_cast(target->GetLocalGenerator())) , Makefile(target->Target->GetMakefile()) , Name(target->GetName()) +#ifdef _WIN32 + , CmdWindowsShell(true) +#else + , CmdWindowsShell(false) +#endif { // Store the configuration name that is being used if (const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE")) { @@ -125,7 +130,7 @@ void cmGhsMultiTargetGenerator::GenerateTarget() this->WriteCompilerDefinitions(fout, this->ConfigName, language); this->WriteIncludes(fout, this->ConfigName, language); this->WriteTargetLinkLine(fout, this->ConfigName); - this->WriteCustomCommands(fout); + this->WriteBuildEvents(fout); this->WriteSources(fout); this->WriteReferences(fout); fout.Close(); @@ -304,47 +309,138 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLine(std::ostream& fout, } } -void cmGhsMultiTargetGenerator::WriteCustomCommands(std::ostream& fout) +void cmGhsMultiTargetGenerator::WriteBuildEvents(std::ostream& fout) { - WriteCustomCommandsHelper(fout, this->GeneratorTarget->GetPreBuildCommands(), - cmTarget::PRE_BUILD); - WriteCustomCommandsHelper( - fout, this->GeneratorTarget->GetPostBuildCommands(), cmTarget::POST_BUILD); + this->WriteBuildEventsHelper( + fout, this->GeneratorTarget->GetPreBuildCommands(), + std::string("prebuild"), std::string("preexecShell")); + + this->WriteBuildEventsHelper( + fout, this->GeneratorTarget->GetPreLinkCommands(), std::string("prelink"), + std::string("preexecShell")); + + this->WriteBuildEventsHelper( + fout, this->GeneratorTarget->GetPostBuildCommands(), + std::string("postbuild"), std::string("postexecShell")); +} + +void cmGhsMultiTargetGenerator::WriteBuildEventsHelper( + std::ostream& fout, const std::vector& ccv, + std::string const& name, std::string const& cmd) +{ + int cmdcount = 0; + + for (cmCustomCommand const& cc : ccv) { + cmCustomCommandGenerator ccg(cc, this->ConfigName, this->LocalGenerator); + // Open the filestream for this custom command + std::string fname = this->LocalGenerator->GetCurrentBinaryDirectory(); + fname += + "/" + this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); + fname += "/" + this->Name + "_" + name; + fname += std::to_string(cmdcount++); + fname += this->CmdWindowsShell ? ".bat" : ".sh"; + cmGeneratedFileStream f(fname); + f.SetCopyIfDifferent(true); + this->WriteCustomCommandsHelper(f, ccg); + f.Close(); + fout << " :" << cmd << "=\"" << fname << "\"" << std::endl; + for (auto& byp : ccg.GetByproducts()) { + fout << " :extraOutputFile=\"" << byp << "\"" << std::endl; + } + } } void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper( - std::ostream& fout, std::vector const& commandsSet, - cmTarget::CustomCommandType const commandType) + std::ostream& fout, cmCustomCommandGenerator const& ccg) { - for (cmCustomCommand const& customCommand : commandsSet) { - cmCustomCommandLines const& commandLines = customCommand.GetCommandLines(); - for (cmCustomCommandLine const& command : commandLines) { - switch (commandType) { - case cmTarget::PRE_BUILD: - fout << " :preexecShellSafe="; - break; - case cmTarget::POST_BUILD: - fout << " :postexecShellSafe="; - break; - default: - assert("Only pre and post are supported"); + std::vector cmdLines; + + // if the command specified a working directory use it. + std::string dir = this->LocalGenerator->GetCurrentBinaryDirectory(); + std::string currentBinDir = dir; + std::string workingDir = ccg.GetWorkingDirectory(); + if (!workingDir.empty()) { + dir = workingDir; + } + + // Line to check for error between commands. +#ifdef _WIN32 + std::string check_error = "if %errorlevel% neq 0 exit /b %errorlevel%"; +#else + std::string check_error = "if [[ $? -ne 0 ]]; then exit 1; fi"; +#endif + +#ifdef _WIN32 + cmdLines.push_back("@echo off"); +#endif + // Echo the custom command's comment text. + const char* comment = ccg.GetComment(); + if (comment && *comment) { + std::string echocmd = "echo "; + echocmd += comment; + cmdLines.push_back(std::move(echocmd)); + } + + // Switch to working directory + std::string cdCmd; +#ifdef _WIN32 + std::string cdStr = "cd /D "; +#else + std::string cdStr = "cd "; +#endif + cdCmd = cdStr + + this->LocalGenerator->ConvertToOutputFormat(dir, cmOutputConverter::SHELL); + cmdLines.push_back(std::move(cdCmd)); + + for (unsigned int c = 0; c < ccg.GetNumberOfCommands(); ++c) { + // Build the command line in a single string. + std::string cmd = ccg.GetCommand(c); + if (!cmd.empty()) { + // Use "call " before any invocations of .bat or .cmd files + // invoked as custom commands in the WindowsShell. + // + bool useCall = false; + + if (this->CmdWindowsShell) { + std::string suffix; + if (cmd.size() > 4) { + suffix = cmSystemTools::LowerCase(cmd.substr(cmd.size() - 4)); + if (suffix == ".bat" || suffix == ".cmd") { + useCall = true; + } + } } - bool firstIteration = true; - for (std::string const& commandLine : command) { - std::string subCommandE = - this->LocalGenerator->EscapeForShell(commandLine, true); - fout << (firstIteration ? "'" : " "); - // Need to double escape backslashes - cmSystemTools::ReplaceString(subCommandE, "\\", "\\\\"); - fout << subCommandE; - firstIteration = false; + cmSystemTools::ReplaceString(cmd, "/./", "/"); + // Convert the command to a relative path only if the current + // working directory will be the start-output directory. + bool had_slash = cmd.find('/') != std::string::npos; + if (workingDir.empty()) { + cmd = + this->LocalGenerator->MaybeConvertToRelativePath(currentBinDir, cmd); } - if (!command.empty()) { - fout << "'" << std::endl; + bool has_slash = cmd.find('/') != std::string::npos; + if (had_slash && !has_slash) { + // This command was specified as a path to a file in the + // current directory. Add a leading "./" so it can run + // without the current directory being in the search path. + cmd = "./" + cmd; } + cmd = this->LocalGenerator->ConvertToOutputFormat( + cmd, cmOutputConverter::SHELL); + if (useCall) { + cmd = "call " + cmd; + } + ccg.AppendArguments(c, cmd); + cmdLines.push_back(std::move(cmd)); } } + + // push back the custom commands + for (auto const& c : cmdLines) { + fout << c << std::endl; + fout << check_error << std::endl; + } } void cmGhsMultiTargetGenerator::WriteSourceProperty( @@ -433,7 +529,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj) /* write files into the proper project file * -- groups go into main project file - * unless FOLDER property or variable is set. + * unless NO_SOURCE_GROUP_FILE property or variable is set. */ for (auto& sg : groupFilesList) { std::ostream* fout; @@ -472,6 +568,8 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj) } else { *fout << "{comment} " << sg << std::endl; } + } else if (sg.empty()) { + *fout << "{comment} Others" << std::endl; } /* output rule for each source file */ diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index a4e23d9..fa251b0 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -5,14 +5,13 @@ #include "cmGhsMultiGpj.h" -#include "cmTarget.h" - #include #include #include #include class cmCustomCommand; +class cmCustomCommandGenerator; class cmGeneratorTarget; class cmGlobalGhsMultiGenerator; class cmLocalGhsMultiGenerator; @@ -49,10 +48,12 @@ private: void WriteIncludes(std::ostream& fout, const std::string& config, const std::string& language); void WriteTargetLinkLine(std::ostream& fout, std::string const& config); - void WriteCustomCommands(std::ostream& fout); - void WriteCustomCommandsHelper( - std::ostream& fout, std::vector const& commandsSet, - cmTarget::CustomCommandType commandType); + void WriteBuildEvents(std::ostream& fout); + void WriteBuildEventsHelper(std::ostream& fout, + const std::vector& ccv, + std::string const& name, std::string const& cmd); + void WriteCustomCommandsHelper(std::ostream& fout, + cmCustomCommandGenerator const& ccg); void WriteSources(std::ostream& fout_proj); void WriteSourceProperty(std::ostream& fout, const cmSourceFile* sf, std::string const& propName, @@ -71,7 +72,8 @@ private: std::string TargetNameReal; GhsMultiGpj::Types TagType; std::string const Name; - std::string ConfigName; /* CMAKE_BUILD_TYPE */ + std::string ConfigName; /* CMAKE_BUILD_TYPE */ + bool const CmdWindowsShell; /* custom commands run in cmd.exe or /bin/sh */ }; #endif // ! cmGhsMultiTargetGenerator_h ----------------------------------------------------------------------- Summary of changes: Help/release/dev/ghs-custom-commands.rst | 5 + Modules/ExternalProject.cmake | 38 +- Modules/FindBoost.cmake | 25 +- Source/cmGhsMultiGpj.cxx | 4 +- Source/cmGhsMultiGpj.h | 3 +- Source/cmGhsMultiTargetGenerator.cxx | 449 ++++++++++++++++----- Source/cmGhsMultiTargetGenerator.h | 25 +- Source/cmGlobalGhsMultiGenerator.cxx | 358 +++++++++++++--- Source/cmGlobalGhsMultiGenerator.h | 69 ++-- Tests/CMakeLists.txt | 5 +- Tests/GhsMulti/GhsMultiCustomTarget/CMakeLists.txt | 110 +++++ .../GhsMultiCustomTarget/CMakeLists.txt.in | 108 +++++ .../exe1.c | 0 .../lib1.c | 0 .../CMakeLists.txt | 10 +- .../GhsMulti/GhsMultiDepOrder/exec/CMakeLists.txt | 11 + Tests/GhsMulti/GhsMultiDepOrder/exec/exe1.c | 8 + Tests/GhsMulti/GhsMultiDepOrder/lib/CMakeLists.txt | 17 + Tests/GhsMulti/GhsMultiDepOrder/lib/func1.c | 17 + Tests/GhsMulti/GhsMultiDepOrder/lib/lib1.h | 3 + .../GhsMultiDepOrder/protolib/CMakeLists.txt | 28 ++ .../GhsMulti/GhsMultiDepOrder/protolib/proto1.c.in | 16 + .../GhsMulti/GhsMultiDepOrder/protolib/proto1.h.in | 7 + .../CMakeLists.txt | 14 +- .../empty}/CMakeLists.txt | 8 +- .../GhsMultiIntegrityDDInt/App/CMakeLists.txt | 1 - .../GhsMultiIntegrityDDInt/Lib/CMakeLists.txt | 1 + .../GhsMultiIntegrityMonolith/CMakeLists.txt | 1 + Tests/GhsMulti/GhsMultiPlatform/file1.c | 4 - .../GhsMulti/GhsMultiRenameInstall/CMakeLists.txt | 6 +- .../GhsMultiUnsupportedTargets/CMakeLists.txt | 2 - 31 files changed, 1097 insertions(+), 256 deletions(-) create mode 100644 Help/release/dev/ghs-custom-commands.rst create mode 100644 Tests/GhsMulti/GhsMultiCustomTarget/CMakeLists.txt create mode 100644 Tests/GhsMulti/GhsMultiCustomTarget/CMakeLists.txt.in copy Tests/GhsMulti/{GhsMultiRenameInstall => GhsMultiCustomTarget}/exe1.c (100%) copy Tests/GhsMulti/{GhsMultiRenameInstall => GhsMultiCustomTarget}/lib1.c (100%) copy Tests/GhsMulti/{GhsMultiUnsupportedTargets => GhsMultiDepOrder}/CMakeLists.txt (56%) create mode 100644 Tests/GhsMulti/GhsMultiDepOrder/exec/CMakeLists.txt create mode 100644 Tests/GhsMulti/GhsMultiDepOrder/exec/exe1.c create mode 100644 Tests/GhsMulti/GhsMultiDepOrder/lib/CMakeLists.txt create mode 100644 Tests/GhsMulti/GhsMultiDepOrder/lib/func1.c create mode 100644 Tests/GhsMulti/GhsMultiDepOrder/lib/lib1.h create mode 100644 Tests/GhsMulti/GhsMultiDepOrder/protolib/CMakeLists.txt create mode 100644 Tests/GhsMulti/GhsMultiDepOrder/protolib/proto1.c.in create mode 100644 Tests/GhsMulti/GhsMultiDepOrder/protolib/proto1.h.in copy Tests/GhsMulti/{GhsMultiUnsupportedTargets => GhsMultiExternalProject}/CMakeLists.txt (54%) copy Tests/GhsMulti/{GhsMultiUnsupportedTargets => GhsMultiExternalProject/empty}/CMakeLists.txt (57%) delete mode 100644 Tests/GhsMulti/GhsMultiPlatform/file1.c hooks/post-receive -- CMake From kwrobot at kitware.com Mon Apr 15 10:53:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 15 Apr 2019 10:53:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.14.2-2-ga6bf681 Message-ID: <20190415145306.B36C311E1C1@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 a6bf68141faca9af22624c8d0e1603653a73fce4 (commit) via 9010f5c18a60ce034fb547d98a19585326aadba1 (commit) from 5e98111643e22ad515afa2bf48a92573b6987115 (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/FindBoost.cmake | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Apr 15 11:03:03 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 15 Apr 2019 11:03:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.2-713-gd38d774 Message-ID: <20190415150303.684A814BD@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 d38d7747fe91db4753e9aa26e9b7dd8d065e1cdc (commit) via 8905f04a1d17dbec61a8be29ac37da223222c005 (commit) via 8b667f24d4d65422dd889eb7102136bd651ee47b (commit) via 81cc3de28e2245f0fa9aa017aed9aa120e87cb23 (commit) via 3e70a8d0df08301e11fd5c01e623223e434b3d3c (commit) via e10b04ef055f2c46749e683d13b643c9e2cf32e7 (commit) via 2418a5aec0cad5cfd23fdb82ac6e11aa2a20a63e (commit) via ea83d0f8fb8fd6806c4d5f32e0392638ddc3b65e (commit) from 0793464d95c3dbbe9ed87bb5882d29efb7a8e3c3 (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=d38d7747fe91db4753e9aa26e9b7dd8d065e1cdc commit d38d7747fe91db4753e9aa26e9b7dd8d065e1cdc Merge: 8905f04 81cc3de Author: Brad King AuthorDate: Mon Apr 15 14:55:43 2019 +0000 Commit: Kitware Robot CommitDate: Mon Apr 15 10:55:53 2019 -0400 Merge topic 'ctest-build-and-test-no-progress' 81cc3de28e ctest: drop incremental progress-only messages from build-and-test output Acked-by: Kitware Robot Merge-request: !3225 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8905f04a1d17dbec61a8be29ac37da223222c005 commit 8905f04a1d17dbec61a8be29ac37da223222c005 Merge: 8b667f2 3e70a8d Author: Brad King AuthorDate: Mon Apr 15 14:54:31 2019 +0000 Commit: Kitware Robot CommitDate: Mon Apr 15 10:54:39 2019 -0400 Merge topic 'code-cleanup' 3e70a8d0df cmVisualStudio10TargetGenerator: Simplify code of two functions e10b04ef05 cmVisualStudio10TargetGenerator: Use count instead of find 2418a5aec0 cmVisualStudio10TargetGenerator: Remove uses of const_cast Acked-by: Kitware Robot Merge-request: !3223 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8b667f24d4d65422dd889eb7102136bd651ee47b commit 8b667f24d4d65422dd889eb7102136bd651ee47b Merge: 0793464 ea83d0f Author: Brad King AuthorDate: Mon Apr 15 14:53:22 2019 +0000 Commit: Kitware Robot CommitDate: Mon Apr 15 10:53:35 2019 -0400 Merge topic 'iar-generalize' ea83d0f8fb IAR: Generalize and add support for IAR RX compiler Acked-by: Kitware Robot Merge-request: !3196 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=81cc3de28e2245f0fa9aa017aed9aa120e87cb23 commit 81cc3de28e2245f0fa9aa017aed9aa120e87cb23 Author: Brad King AuthorDate: Fri Apr 12 12:07:31 2019 -0400 Commit: Brad King CommitDate: Fri Apr 12 12:07:31 2019 -0400 ctest: drop incremental progress-only messages from build-and-test output The cmake progress callback is called with non-negative progress values to provide incremental updates on "Configuring" and "Generating" steps. These are useful in interactive views but are just noise in test output. diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index a7d4455..9ad9669 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -126,11 +126,12 @@ public: cmSystemTools::SetStdoutCallback([&s](std::string const& m) { s += m; }); cmSystemTools::SetStderrCallback([&s](std::string const& m) { s += m; }); - this->CM.SetProgressCallback( - [&s](const std::string& msg, float /*unused*/) { + this->CM.SetProgressCallback([&s](const std::string& msg, float prog) { + if (prog < 0) { s += msg; s += "\n"; - }); + } + }); } ~cmCTestBuildAndTestCaptureRAII() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3e70a8d0df08301e11fd5c01e623223e434b3d3c commit 3e70a8d0df08301e11fd5c01e623223e434b3d3c Author: Leonid Pospelov AuthorDate: Fri Apr 12 18:24:21 2019 +0300 Commit: Leonid Pospelov CommitDate: Fri Apr 12 18:24:21 2019 +0300 cmVisualStudio10TargetGenerator: Simplify code of two functions diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 80b1add..0cec2fb 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1430,10 +1430,10 @@ std::string cmVisualStudio10TargetGenerator::ConvertPath( static void ConvertToWindowsSlash(std::string& s) { // first convert all of the slashes - std::string::size_type pos = 0; - while ((pos = s.find('/', pos)) != std::string::npos) { - s[pos] = '\\'; - pos++; + for (auto& ch : s) { + if (ch == '/') { + ch = '\\'; + } } } @@ -4642,10 +4642,8 @@ void cmVisualStudio10TargetGenerator::GetCSharpSourceProperties( void cmVisualStudio10TargetGenerator::WriteCSharpSourceProperties( Elem& e2, const std::map& tags) { - if (!tags.empty()) { - for (const auto& i : tags) { - e2.Element(i.first.c_str(), i.second); - } + for (const auto& i : tags) { + e2.Element(i.first.c_str(), i.second); } } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e10b04ef055f2c46749e683d13b643c9e2cf32e7 commit e10b04ef055f2c46749e683d13b643c9e2cf32e7 Author: Leonid Pospelov AuthorDate: Fri Apr 12 18:21:55 2019 +0300 Commit: Leonid Pospelov CommitDate: Fri Apr 12 18:22:00 2019 +0300 cmVisualStudio10TargetGenerator: Use count instead of find diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 1b72ac3..80b1add 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1583,15 +1583,15 @@ void cmVisualStudio10TargetGenerator::AddMissingSourceGroups( this->AddMissingSourceGroups(groupsUsed, children); - if (groupsUsed.find(¤t) != groupsUsed.end()) { + if (groupsUsed.count(¤t) > 0) { continue; // group has already been added to set } // check if it least one of the group's descendants is not empty // (at least one child must already have been added) - std::vector::const_iterator child_it = children.begin(); + auto child_it = children.begin(); while (child_it != children.end()) { - if (groupsUsed.find(&(*child_it)) != groupsUsed.end()) { + if (groupsUsed.count(&(*child_it)) > 0) { break; // found a child that was already added => add current group too } child_it++; @@ -2528,10 +2528,9 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( } else { std::set languages; this->GeneratorTarget->GetLanguages(languages, configName); - for (const char* const* l = cm::cbegin(clLangs); l != cm::cend(clLangs); - ++l) { - if (languages.find(*l) != languages.end()) { - langForClCompile = *l; + for (const char* l : clLangs) { + if (languages.count(l)) { + langForClCompile = l; break; } } @@ -4056,10 +4055,7 @@ bool cmVisualStudio10TargetGenerator::IsResxHeader( { std::set expectedResxHeaders; this->GeneratorTarget->GetExpectedResxHeaders(expectedResxHeaders, ""); - - std::set::const_iterator it = - expectedResxHeaders.find(headerFile); - return it != expectedResxHeaders.end(); + return expectedResxHeaders.count(headerFile) > 0; } bool cmVisualStudio10TargetGenerator::IsXamlHeader( @@ -4067,10 +4063,7 @@ bool cmVisualStudio10TargetGenerator::IsXamlHeader( { std::set expectedXamlHeaders; this->GeneratorTarget->GetExpectedXamlHeaders(expectedXamlHeaders, ""); - - std::set::const_iterator it = - expectedXamlHeaders.find(headerFile); - return it != expectedXamlHeaders.end(); + return expectedXamlHeaders.count(headerFile) > 0; } bool cmVisualStudio10TargetGenerator::IsXamlSource( @@ -4078,10 +4071,7 @@ bool cmVisualStudio10TargetGenerator::IsXamlSource( { std::set expectedXamlSources; this->GeneratorTarget->GetExpectedXamlSources(expectedXamlSources, ""); - - std::set::const_iterator it = - expectedXamlSources.find(sourceFile); - return it != expectedXamlSources.end(); + return expectedXamlSources.count(sourceFile) > 0; } void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings(Elem& e1) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2418a5aec0cad5cfd23fdb82ac6e11aa2a20a63e commit 2418a5aec0cad5cfd23fdb82ac6e11aa2a20a63e Author: Leonid Pospelov AuthorDate: Fri Apr 12 18:19:58 2019 +0300 Commit: Leonid Pospelov CommitDate: Fri Apr 12 18:20:07 2019 +0300 cmVisualStudio10TargetGenerator: Remove uses of const_cast diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 5195957..1b72ac3 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1449,7 +1449,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() std::vector const& sources = this->GeneratorTarget->GetAllConfigSources(); - std::set groupsUsed; + std::set groupsUsed; for (cmGeneratorTarget::AllConfigSource const& si : sources) { std::string const& source = si.Source->GetFullPath(); cmSourceGroup* sourceGroup = @@ -1534,13 +1534,13 @@ void cmVisualStudio10TargetGenerator::WriteGroups() { Elem e1(e0, "ItemGroup"); e1.SetHasElements(); - std::vector groupsVec(groupsUsed.begin(), - groupsUsed.end()); + std::vector groupsVec(groupsUsed.begin(), + groupsUsed.end()); std::sort(groupsVec.begin(), groupsVec.end(), - [](cmSourceGroup* l, cmSourceGroup* r) { + [](cmSourceGroup const* l, cmSourceGroup const* r) { return l->GetFullName() < r->GetFullName(); }); - for (cmSourceGroup* sg : groupsVec) { + for (cmSourceGroup const* sg : groupsVec) { std::string const& name = sg->GetFullName(); if (!name.empty()) { std::string guidName = "SG_Filter_" + name; @@ -1572,7 +1572,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() // Add to groupsUsed empty source groups that have non-empty children. void cmVisualStudio10TargetGenerator::AddMissingSourceGroups( - std::set& groupsUsed, + std::set& groupsUsed, const std::vector& allGroups) { for (cmSourceGroup const& current : allGroups) { @@ -1583,8 +1583,7 @@ void cmVisualStudio10TargetGenerator::AddMissingSourceGroups( this->AddMissingSourceGroups(groupsUsed, children); - cmSourceGroup* current_ptr = const_cast(¤t); - if (groupsUsed.find(current_ptr) != groupsUsed.end()) { + if (groupsUsed.find(¤t) != groupsUsed.end()) { continue; // group has already been added to set } @@ -1592,8 +1591,7 @@ void cmVisualStudio10TargetGenerator::AddMissingSourceGroups( // (at least one child must already have been added) std::vector::const_iterator child_it = children.begin(); while (child_it != children.end()) { - cmSourceGroup* child_ptr = const_cast(&(*child_it)); - if (groupsUsed.find(child_ptr) != groupsUsed.end()) { + if (groupsUsed.find(&(*child_it)) != groupsUsed.end()) { break; // found a child that was already added => add current group too } child_it++; @@ -1603,7 +1601,7 @@ void cmVisualStudio10TargetGenerator::AddMissingSourceGroups( continue; // no descendants have source files => ignore this group } - groupsUsed.insert(current_ptr); + groupsUsed.insert(¤t); } } diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 5901004..6a1ee1d 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -165,7 +165,7 @@ private: void WriteGroupSources(Elem& e0, std::string const& name, ToolSources const& sources, std::vector&); - void AddMissingSourceGroups(std::set& groupsUsed, + void AddMissingSourceGroups(std::set& groupsUsed, const std::vector& allGroups); bool IsResxHeader(const std::string& headerFile); bool IsXamlHeader(const std::string& headerFile); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ea83d0f8fb8fd6806c4d5f32e0392638ddc3b65e commit ea83d0f8fb8fd6806c4d5f32e0392638ddc3b65e Author: Stefan Andersson AuthorDate: Fri Apr 5 11:50:59 2019 +0200 Commit: Stefan Andersson CommitDate: Fri Apr 12 09:10:02 2019 +0200 IAR: Generalize and add support for IAR RX compiler Moved common ASM setup to the common macros and changed version check. diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake index b8c8c5d..eabb8b5 100644 --- a/Modules/CMakeDetermineASMCompiler.cmake +++ b/Modules/CMakeDetermineASMCompiler.cmake @@ -119,35 +119,40 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT} "${userflags}") if("x${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}" STREQUAL "xIAR") # primary necessary to detect architecture, so the right archiver and linker can be picked - # eg. IAR Assembler V8.10.1.12857/W32 for ARM + # eg. "IAR Assembler V8.10.1.12857/W32 for ARM" or "IAR Assembler V4.11.1.4666 for Renesas RX" # Cut out identification first, newline handling is a pain string(REGEX MATCH "IAR Assembler[^\r\n]*" _compileid "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_OUTPUT}") if("${_compileid}" MATCHES "V([0-9]+\\.[0-9]+\\.[0-9]+)") set(CMAKE_ASM${ASM_DIALECT}_COMPILER_VERSION ${CMAKE_MATCH_1}) endif() - if("${_compileid}" MATCHES "for[ ]+([A-Za-z0-9]+)") - set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID ${CMAKE_MATCH_1}) + string(REGEX MATCHALL "([A-Za-z0-9]+)" _all_compileid_matches "${_compileid}") + if(_all_compileid_matches) + list(GET _all_compileid_matches "-1" CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID) endif() endif() unset(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_OUTPUT) + unset(_all_compileid_matches) unset(_compileid) endif() - if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) if(CMAKE_ASM${ASM_DIALECT}_COMPILER_VERSION) set(_version " ${CMAKE_ASM${ASM_DIALECT}_COMPILER_VERSION}") else() set(_version "") endif() - message(STATUS "The ASM${ASM_DIALECT} compiler identification is ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}${_version}") + if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID) + set(_archid " ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}") + else() + set(_archid "") + endif() + message(STATUS "The ASM${ASM_DIALECT} compiler identification is ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}${_archid}${_version}") + unset(_archid) unset(_version) else() message(STATUS "The ASM${ASM_DIALECT} compiler identification is unknown") endif() - - # If we have a gas/as cross compiler, they have usually some prefix, like # e.g. powerpc-linux-gas, arm-elf-gas or i586-mingw32msvc-gas , optionally # with a 3-component version number at the end diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 594f85b..c1c9982 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -110,8 +110,15 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) else() set(_version "") endif() + if(CMAKE_${lang}_COMPILER_ARCHITECTURE_ID) + set(_archid " ${CMAKE_${lang}_COMPILER_ARCHITECTURE_ID}") + else() + set(_archid "") + endif() message(STATUS "The ${lang} compiler identification is " - "${CMAKE_${lang}_COMPILER_ID}${_version}") + "${CMAKE_${lang}_COMPILER_ID}${_archid}${_version}") + unset(_archid) + unset(_version) else() message(STATUS "The ${lang} compiler identification is unknown") endif() diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in index 3cb7f24..c88094a 100644 --- a/Modules/CMakePlatformId.h.in +++ b/Modules/CMakePlatformId.h.in @@ -156,6 +156,9 @@ # if defined(__ICCARM__) # define ARCHITECTURE_ID "ARM" +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + # elif defined(__ICCAVR__) # define ARCHITECTURE_ID "AVR" diff --git a/Modules/Compiler/IAR-ASM.cmake b/Modules/Compiler/IAR-ASM.cmake index e12bfd1..f9c0ced 100644 --- a/Modules/Compiler/IAR-ASM.cmake +++ b/Modules/Compiler/IAR-ASM.cmake @@ -3,21 +3,20 @@ include(Compiler/IAR) if("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM") -set(CMAKE_ASM_COMPILE_OBJECT " -S -o ") - __compiler_iar_ARM(ASM) + set(CMAKE_ASM_COMPILE_OBJECT " -S -o ") + __compiler_iar_ilink(ASM) set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa) - string(APPEND CMAKE_ASM_FLAGS_INIT " ") - string(APPEND CMAKE_ASM_FLAGS_DEBUG_INIT " -r") - string(APPEND CMAKE_ASM_FLAGS_MINSIZEREL_INIT " -DNDEBUG") - string(APPEND CMAKE_ASM_FLAGS_RELEASE_INIT " -DNDEBUG") - string(APPEND CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT " -r -DNDEBUG") +elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RX") + set(CMAKE_ASM_COMPILE_OBJECT " --silent -o ") + __compiler_iar_ilink(ASM) + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa) elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") set(CMAKE_ASM_COMPILE_OBJECT " -S -o ") - __compiler_iar_AVR(ASM) + __compiler_iar_xlink(ASM) set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s90;asm;msa) else() - message(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID not detected as \"AVR\" or \"ARM\". This should be automatic.") + message(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID not detected. This should be automatic.") endif() diff --git a/Modules/Compiler/IAR-C.cmake b/Modules/Compiler/IAR-C.cmake index b5e61f0..cb10020 100644 --- a/Modules/Compiler/IAR-C.cmake +++ b/Modules/Compiler/IAR-C.cmake @@ -3,44 +3,39 @@ include(Compiler/IAR) include(Compiler/CMakeCommonCompilerMacros) -# The toolchains for ARM and AVR are quite different: -if("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM") - if(NOT CMAKE_C_COMPILER_VERSION) - message(FATAL_ERROR "CMAKE_C_COMPILER_VERSION not detected. This should be automatic.") - endif() +# Common +if(NOT CMAKE_C_COMPILER_VERSION) + message(FATAL_ERROR "CMAKE_C_COMPILER_VERSION not detected. This should be automatic.") +endif() - set(CMAKE_C_EXTENSION_COMPILE_OPTION -e) +set(CMAKE_C_EXTENSION_COMPILE_OPTION -e) +if(CMAKE_CXX_COMPILER_VERSION_INTERNAL VERSION_GREATER 7) + set(CMAKE_C90_STANDARD_COMPILE_OPTION --c89) + set(CMAKE_C90_EXTENSION_COMPILE_OPTION --c89 -e) + set(CMAKE_C99_STANDARD_COMPILE_OPTION "") + set(CMAKE_C99_EXTENSION_COMPILE_OPTION -e) +elseif() set(CMAKE_C90_STANDARD_COMPILE_OPTION "") set(CMAKE_C90_EXTENSION_COMPILE_OPTION -e) +endif() - if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.10) - set(CMAKE_C90_STANDARD_COMPILE_OPTION --c89) - set(CMAKE_C90_EXTENSION_COMPILE_OPTION --c89 -e) - set(CMAKE_C99_STANDARD_COMPILE_OPTION "") - set(CMAKE_C99_EXTENSION_COMPILE_OPTION -e) - endif() - if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.10) - set(CMAKE_C11_STANDARD_COMPILE_OPTION "") - set(CMAKE_C11_EXTENSION_COMPILE_OPTION -e) - endif() +if(CMAKE_CXX_COMPILER_VERSION_INTERNAL VERSION_GREATER 8) + set(CMAKE_C11_STANDARD_COMPILE_OPTION "") + set(CMAKE_C11_EXTENSION_COMPILE_OPTION -e) +endif() - __compiler_iar_ARM(C) +# Architecture specific +if("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM") + __compiler_iar_ilink(C) __compiler_check_default_language_standard(C 1.10 90 6.10 99 8.10 11) -elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") - if(NOT CMAKE_C_COMPILER_VERSION) - message(FATAL_ERROR "CMAKE_C_COMPILER_VERSION not detected. This should be automatic.") - endif() - - set(CMAKE_C_EXTENSION_COMPILE_OPTION -e) - - set(CMAKE_C90_STANDARD_COMPILE_OPTION --c89) - set(CMAKE_C90_EXTENSION_COMPILE_OPTION -e) - set(CMAKE_C99_STANDARD_COMPILE_OPTION "") - set(CMAKE_C99_EXTENSION_COMPILE_OPTION -e) +elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "RX") + __compiler_iar_ilink(C) + __compiler_check_default_language_standard(C 1.10 90 2.10 99 4.10 11) - __compiler_iar_AVR(C) +elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") + __compiler_iar_xlink(C) __compiler_check_default_language_standard(C 7.10 99) set(CMAKE_C_OUTPUT_EXTENSION ".r90") @@ -48,9 +43,6 @@ elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") set(CMAKE_C_LINK_FLAGS "-Fmotorola") endif() - set(CMAKE_C_LINK_EXECUTABLE " -o ") - set(CMAKE_C_CREATE_STATIC_LIBRARY " -o ") - # add the target specific include directory: get_filename_component(_compilerDir "${CMAKE_C_COMPILER}" PATH) get_filename_component(_compilerDir "${_compilerDir}" PATH) @@ -58,5 +50,5 @@ elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") include_directories("${_compilerDir}/inc/Atmel" ) else() - message(FATAL_ERROR "CMAKE_C_COMPILER_ARCHITECTURE_ID not detected as \"AVR\" or \"ARM\". This should be automatic.") + message(FATAL_ERROR "CMAKE_C_COMPILER_ARCHITECTURE_ID not detected. This should be automatic.") endif() diff --git a/Modules/Compiler/IAR-CXX.cmake b/Modules/Compiler/IAR-CXX.cmake index b7076f5..eb27e3c 100644 --- a/Modules/Compiler/IAR-CXX.cmake +++ b/Modules/Compiler/IAR-CXX.cmake @@ -3,60 +3,45 @@ include(Compiler/IAR) include(Compiler/CMakeCommonCompilerMacros) -if("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM") - # "(extended) embedded C++" Mode - # old version: --ec++ or --eec++ - # since 8.10: --c++ --no_exceptions --no_rtti - # - # --c++ is full C++ and supported since 6.10 - if(NOT CMAKE_IAR_CXX_FLAG) - if(NOT CMAKE_CXX_COMPILER_VERSION) - message(FATAL_ERROR "CMAKE_CXX_COMPILER_VERSION not detected. This should be automatic.") - endif() - if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.10) - set(CMAKE_IAR_CXX_FLAG --c++) - else() - set(CMAKE_IAR_CXX_FLAG --eec++) - endif() +# Common +if(NOT CMAKE_IAR_CXX_FLAG) + if(NOT CMAKE_CXX_COMPILER_VERSION) + message(FATAL_ERROR "CMAKE_CXX_COMPILER_VERSION not detected. This should be automatic.") + endif() + if(CMAKE_CXX_COMPILER_VERSION_INTERNAL VERSION_GREATER 8) + set(CMAKE_IAR_CXX_FLAG --c++) + else() + set(CMAKE_IAR_CXX_FLAG --eec++) endif() +endif() - set(CMAKE_CXX_EXTENSION_COMPILE_OPTION -e) +set(CMAKE_CXX_EXTENSION_COMPILE_OPTION -e) +if(CMAKE_CXX_COMPILER_VERSION_INTERNAL VERSION_GREATER 7) set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -e) - - if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.10) set(CMAKE_CXX03_STANDARD_COMPILE_OPTION "") set(CMAKE_CXX03_EXTENSION_COMPILE_OPTION -e) +endif() + +if(CMAKE_CXX_COMPILER_VERSION_INTERNAL VERSION_GREATER 8) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION -e) set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "") set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION -e) - endif() +endif() - __compiler_iar_ARM(CXX) +# Architecture specific +if("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM") + __compiler_iar_ilink(CXX) __compiler_check_default_language_standard(CXX 6.10 98 8.10 14) -elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") - # "embedded C++" --EC++ is probably closest to CXX98 but with no support for: - # Templates, multiple inheritance, virtual inheritance, exceptions, RTTI, C++ style casts, - # Namespaces, the mutable attribute, no STL, any library features related to the above features. - # - # "(extended) embedded C++" --EEC++ Mode but DOES NOT support any normal C++ standard - # probably closest to CXX98 but with no RTTI and no exceptions, and the library - # provided is not in the standard namespace - if(NOT CMAKE_IAR_CXX_FLAG) - if(NOT CMAKE_CXX_COMPILER_VERSION) - message(FATAL_ERROR "CMAKE_CXX_COMPILER_VERSION not detected. This should be automatic.") - endif() - set(CMAKE_IAR_CXX_FLAG --eec++) - endif() +elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "RX") + __compiler_iar_ilink(CXX) + __compiler_check_default_language_standard(CXX 2.10 98 4.10 14) - set(CMAKE_CXX_EXTENSION_COMPILE_OPTION -e) - set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") - set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -e) - - __compiler_iar_AVR(CXX) +elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") + __compiler_iar_xlink(CXX) __compiler_check_default_language_standard(CXX 7.10 98) set(CMAKE_CXX_OUTPUT_EXTENSION ".r90") @@ -64,15 +49,12 @@ elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") set(CMAKE_CXX_LINK_FLAGS "-Fmotorola") endif() - set(CMAKE_CXX_LINK_EXECUTABLE " -o ") - set(CMAKE_CXX_CREATE_STATIC_LIBRARY " -o ") - # add the target specific include directory: get_filename_component(_compilerDir "${CMAKE_C_COMPILER}" PATH) get_filename_component(_compilerDir "${_compilerDir}" PATH) - include_directories("${_compilerDir}/inc") - include_directories("${_compilerDir}/inc/Atmel") + include_directories("${_compilerDir}/inc" ) + include_directories("${_compilerDir}/inc/Atmel" ) else() - message(FATAL_ERROR "CMAKE_CXX_COMPILER_ARCHITECTURE_ID not detected as \"AVR\" or \"ARM\". This should be automatic." ) + message(FATAL_ERROR "CMAKE_CXX_COMPILER_ARCHITECTURE_ID not detected. This should be automatic." ) endif() diff --git a/Modules/Compiler/IAR-DetermineCompiler.cmake b/Modules/Compiler/IAR-DetermineCompiler.cmake index 43477ac..cdfb095 100644 --- a/Modules/Compiler/IAR-DetermineCompiler.cmake +++ b/Modules/Compiler/IAR-DetermineCompiler.cmake @@ -31,7 +31,7 @@ set(_compiler_id_version_compute " # define @PREFIX at COMPILER_VERSION_MINOR @MACRO_DEC@(((__VER__) / 1000) % 1000) # define @PREFIX at COMPILER_VERSION_PATCH @MACRO_DEC@((__VER__) % 1000) # define @PREFIX at COMPILER_VERSION_INTERNAL @MACRO_DEC@(__IAR_SYSTEMS_ICC__) -# elif defined(__VER__) && defined(__ICCAVR__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__)) # define @PREFIX at COMPILER_VERSION_MAJOR @MACRO_DEC@((__VER__) / 100) # define @PREFIX at COMPILER_VERSION_MINOR @MACRO_DEC@((__VER__) - (((__VER__) / 100)*100)) # define @PREFIX at COMPILER_VERSION_PATCH @MACRO_DEC@(__SUBVERSION__) diff --git a/Modules/Compiler/IAR-FindBinUtils.cmake b/Modules/Compiler/IAR-FindBinUtils.cmake index 5fecb26..e8f5e6b 100644 --- a/Modules/Compiler/IAR-FindBinUtils.cmake +++ b/Modules/Compiler/IAR-FindBinUtils.cmake @@ -10,39 +10,39 @@ get_filename_component(__iar_hint_2 "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPI set(__iar_hints "${__iar_hint_1}" "${__iar_hint_2}") -if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM") - # could allow using normal binutils ar, since objects are normal ELF files? - find_program(CMAKE_IAR_LINKARM ilinkarm.exe HINTS ${__iar_hints} - DOC "The IAR ARM linker") +if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM" OR + "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RX") + # could allow using normal binutils ar, since objects are normal ELF files? + find_program(CMAKE_IAR_LINKER ilink${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}.exe HINTS ${__iar_hints} + DOC "The IAR ILINK linker") find_program(CMAKE_IAR_ARCHIVE iarchive.exe HINTS ${__iar_hints} DOC "The IAR archiver") # find auxiliary tools find_program(CMAKE_IAR_ELFTOOL ielftool.exe HINTS ${__iar_hints} DOC "The IAR ELF Tool") - find_program(CMAKE_IAR_ELFDUMP ielfdumparm.exe HINTS ${__iar_hints} + find_program(CMAKE_IAR_ELFDUMP ielfdump${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}.exe HINTS ${__iar_hints} DOC "The IAR ELF Dumper") find_program(CMAKE_IAR_OBJMANIP iobjmanip.exe HINTS ${__iar_hints} DOC "The IAR ELF Object Tool") find_program(CMAKE_IAR_SYMEXPORT isymexport.exe HINTS ${__iar_hints} DOC "The IAR Absolute Symbol Exporter") - mark_as_advanced(CMAKE_IAR_LINKARM CMAKE_IAR_ARCHIVE CMAKE_IAR_ELFTOOL CMAKE_IAR_ELFDUMP CMAKE_IAR_OBJMANIP CMAKE_IAR_SYMEXPORT) + mark_as_advanced(CMAKE_IAR_LINKER CMAKE_IAR_ARCHIVE CMAKE_IAR_ELFTOOL CMAKE_IAR_ELFDUMP CMAKE_IAR_OBJMANIP CMAKE_IAR_SYMEXPORT) set(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_CUSTOM_CODE -"set(CMAKE_IAR_LINKARM \"${CMAKE_IAR_LINKARM}\") +"set(CMAKE_IAR_LINKER \"${CMAKE_IAR_LINKER}\") set(CMAKE_IAR_ARCHIVE \"${CMAKE_IAR_ARCHIVE}\") set(CMAKE_IAR_ELFTOOL \"${CMAKE_IAR_ELFTOOL}\") set(CMAKE_IAR_ELFDUMP \"${CMAKE_IAR_ELFDUMP}\") set(CMAKE_IAR_OBJMANIP \"${CMAKE_IAR_OBJMANIP}\") -set(CMAKE_IAR_LINKARM \"${CMAKE_IAR_LINKARM}\") +set(CMAKE_IAR_LINKER \"${CMAKE_IAR_LINKER}\") ") - elseif("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") # For AVR and AVR32, IAR uses the "xlink" linker and the "xar" archiver: find_program(CMAKE_IAR_LINKER xlink.exe HINTS ${__iar_hints} - DOC "The IAR AVR linker") + DOC "The IAR XLINK linker") find_program(CMAKE_IAR_AR xar.exe HINTS ${__iar_hints} DOC "The IAR archiver") mark_as_advanced(CMAKE_IAR_LINKER CMAKE_IAR_AR) diff --git a/Modules/Compiler/IAR.cmake b/Modules/Compiler/IAR.cmake index bbcdea2..8e75caa 100644 --- a/Modules/Compiler/IAR.cmake +++ b/Modules/Compiler/IAR.cmake @@ -2,11 +2,16 @@ # Documentation can be downloaded here: http://www.iar.com/website1/1.0.1.0/675/1/ # The initial feature request is here: https://gitlab.kitware.com/cmake/cmake/issues/10176 # It also contains additional links and information. -# See USER GUIDES -> C/C++ Development Guide and ReleaseNotes for: +# See USER GUIDES -> C/C++ Development Guide and ReleaseNotes for EWARM: # version 6.30.8: http://supp.iar.com/FilesPublic/UPDINFO/006607/arm/doc/infocenter/index.ENU.html # version 7.60.1: http://supp.iar.com/FilesPublic/UPDINFO/011006/arm/doc/infocenter/index.ENU.html # version 8.10.1: http://netstorage.iar.com/SuppDB/Public/UPDINFO/011854/arm/doc/infocenter/index.ENU.html +# The IAR internal compiler platform generations (Predefined symbol __IAR_SYSTEMS_ICC__): +# 9 and higher means C11 and C++14 as language default (EWARM v8.x, EWRX v4.x and higher) +# 8 means C99 and C++03 as language default (EWARM v6.x, v7.x. EWRX v2.x, 3.x) +# 7 and lower means C89 and EC++ as language default. (EWARM v5.x and lower) + # C/C++ Standard versions # # IAR typically only supports one C and C++ Standard version, @@ -33,15 +38,11 @@ # code and data size printouts (that can be inspected with common tools). # This module is shared by multiple languages; use include blocker. -if(_IARARM_CMAKE_LOADED) - return() -endif() -set(_IARARM_CMAKE_LOADED 1) +include_guard() -macro(__compiler_iar_ARM lang) +macro(__compiler_iar_ilink lang) set(CMAKE_EXECUTABLE_SUFFIX ".elf") if (${lang} STREQUAL "C" OR ${lang} STREQUAL "CXX") - set(CMAKE_${lang}_COMPILE_OBJECT " ${CMAKE_IAR_${lang}_FLAG} --silent -o ") set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " ${CMAKE_IAR_${lang}_FLAG} --silent --preprocess=cnl ") set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " ${CMAKE_IAR_${lang}_FLAG} --silent -lAH -o .dummy") @@ -56,17 +57,25 @@ macro(__compiler_iar_ARM lang) string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -Oh -r -DNDEBUG") endif() - set(CMAKE_${lang}_LINK_EXECUTABLE "\"${CMAKE_IAR_LINKARM}\" --silent -o ") + if (${lang} STREQUAL "ASM") + string(APPEND CMAKE_ASM_FLAGS_INIT " ") + string(APPEND CMAKE_ASM_FLAGS_DEBUG_INIT " -r") + string(APPEND CMAKE_ASM_FLAGS_MINSIZEREL_INIT " -DNDEBUG") + string(APPEND CMAKE_ASM_FLAGS_RELEASE_INIT " -DNDEBUG") + string(APPEND CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT " -r -DNDEBUG") + endif() + + set(CMAKE_${lang}_LINK_EXECUTABLE "\"${CMAKE_IAR_LINKER}\" --silent -o ") set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "\"${CMAKE_IAR_ARCHIVE}\" --create ") set(CMAKE_${lang}_ARCHIVE_CREATE "\"${CMAKE_IAR_ARCHIVE}\" --create ") set(CMAKE_${lang}_ARCHIVE_APPEND "\"${CMAKE_IAR_ARCHIVE}\" --replace ") set(CMAKE_${lang}_ARCHIVE_FINISH "") - set(CMAKE_LINKER "${CMAKE_IAR_LINKARM}" CACHE FILEPATH "The IAR linker" FORCE) + set(CMAKE_LINKER "${CMAKE_IAR_LINKER}" CACHE FILEPATH "The IAR linker" FORCE) set(CMAKE_AR "${CMAKE_IAR_ARCHIVE}" CACHE FILEPATH "The IAR archiver" FORCE) endmacro() -macro(__compiler_iar_AVR lang) +macro(__compiler_iar_xlink lang) set(CMAKE_EXECUTABLE_SUFFIX ".bin") if (${lang} STREQUAL "C" OR ${lang} STREQUAL "CXX") @@ -84,6 +93,14 @@ macro(__compiler_iar_AVR lang) string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -Oh -r -DNDEBUG") endif() + if (${lang} STREQUAL "ASM") + string(APPEND CMAKE_ASM_FLAGS_INIT " ") + string(APPEND CMAKE_ASM_FLAGS_DEBUG_INIT " -r") + string(APPEND CMAKE_ASM_FLAGS_MINSIZEREL_INIT " -DNDEBUG") + string(APPEND CMAKE_ASM_FLAGS_RELEASE_INIT " -DNDEBUG") + string(APPEND CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT " -r -DNDEBUG") + endif() + set(CMAKE_${lang}_LINK_EXECUTABLE "\"${CMAKE_IAR_LINKER}\" -S -o ") set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "\"${CMAKE_IAR_AR}\" ") set(CMAKE_${lang}_ARCHIVE_CREATE "\"${CMAKE_IAR_AR}\" ") ----------------------------------------------------------------------- Summary of changes: Modules/CMakeDetermineASMCompiler.cmake | 19 +++++--- Modules/CMakeDetermineCompilerId.cmake | 9 +++- Modules/CMakePlatformId.h.in | 3 ++ Modules/Compiler/IAR-ASM.cmake | 17 ++++--- Modules/Compiler/IAR-C.cmake | 58 ++++++++++------------ Modules/Compiler/IAR-CXX.cmake | 72 +++++++++++----------------- Modules/Compiler/IAR-DetermineCompiler.cmake | 2 +- Modules/Compiler/IAR-FindBinUtils.cmake | 20 ++++---- Modules/Compiler/IAR.cmake | 37 ++++++++++---- Source/CTest/cmCTestBuildAndTestHandler.cxx | 7 +-- Source/cmVisualStudio10TargetGenerator.cxx | 58 +++++++++------------- Source/cmVisualStudio10TargetGenerator.h | 2 +- 12 files changed, 148 insertions(+), 156 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Apr 16 00:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 16 Apr 2019 00:03:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.2-714-g5ec9d16 Message-ID: <20190416040305.9040D1031E0@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 5ec9d16b5a955de40d1ba904d08479ab204c0cb7 (commit) from d38d7747fe91db4753e9aa26e9b7dd8d065e1cdc (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=5ec9d16b5a955de40d1ba904d08479ab204c0cb7 commit 5ec9d16b5a955de40d1ba904d08479ab204c0cb7 Author: Kitware Robot AuthorDate: Tue Apr 16 00:01:04 2019 -0400 Commit: Kitware Robot CommitDate: Tue Apr 16 00:01:04 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4e7e400..636d332 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 14) -set(CMake_VERSION_PATCH 20190415) +set(CMake_VERSION_PATCH 20190416) #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 Apr 16 13:43:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 16 Apr 2019 13:43:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.2-729-g9aecda5 Message-ID: <20190416174305.C86A8FE699@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 9aecda56ba960267b392e54e5c28388a6cfa92ed (commit) via 3205561b8a04f16d0004f73d0dc5eeffd0c7dd02 (commit) via 34975815a8b07879ea10b23e8cb630bb1930a3ee (commit) via 68a0b51ef882456affb852e33317cc58aa1e3692 (commit) via 7f9e93aa0599e039f7673fb55143701754f33bb9 (commit) via fc4324a27cb534080fa981a77391e0224df2ef67 (commit) via 09fba6146fa726a83cbbccc3d5fb288f7f14f111 (commit) via 0b54f72e940503adfbd978d7f1dedc3da4799f52 (commit) via 60ec2922585d3710b45212fb5671676ff726965e (commit) via 536cca60ea1c037d751b03bf5da8385783856000 (commit) via cce342a5b966c57d933951053757090fc860a067 (commit) via a0b6448c855053301cba575c226abecef173f2c3 (commit) via 58f04b6ecf853e4ee5cce2bfb258fa7d4cc75b79 (commit) via a3f062091f488237c0151f3f4753e0668f37c60d (commit) via 8cb26a0a2ad57ca9012f97c7437711ee94f1a9db (commit) from 5ec9d16b5a955de40d1ba904d08479ab204c0cb7 (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=9aecda56ba960267b392e54e5c28388a6cfa92ed commit 9aecda56ba960267b392e54e5c28388a6cfa92ed Merge: 3205561 60ec292 Author: Brad King AuthorDate: Tue Apr 16 17:42:43 2019 +0000 Commit: Kitware Robot CommitDate: Tue Apr 16 13:42:53 2019 -0400 Merge topic 'genex-output_name' 60ec292258 Genex: Rename $ in $ Acked-by: Kitware Robot Merge-request: !3228 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3205561b8a04f16d0004f73d0dc5eeffd0c7dd02 commit 3205561b8a04f16d0004f73d0dc5eeffd0c7dd02 Merge: 3497581 536cca6 Author: Brad King AuthorDate: Tue Apr 16 17:39:51 2019 +0000 Commit: Kitware Robot CommitDate: Tue Apr 16 13:40:02 2019 -0400 Merge topic 'string-repeat' 536cca60ea string: introduce `REPEAT` sub-command Acked-by: Kitware Robot Merge-request: !3239 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=34975815a8b07879ea10b23e8cb630bb1930a3ee commit 34975815a8b07879ea10b23e8cb630bb1930a3ee Merge: 68a0b51 58f04b6 Author: Brad King AuthorDate: Tue Apr 16 17:38:08 2019 +0000 Commit: Kitware Robot CommitDate: Tue Apr 16 13:38:21 2019 -0400 Merge topic 'autogen_moc_uic_single_job_queue' 58f04b6ecf Autogen: Add ManySources test a3f062091f Autogen: Rename `cmQtAutoGeneratorMocUic` class to `cmQtAutoMocUic` 8cb26a0a2a Autogen: Factor out concurrency framework to cmWorkerPool class Acked-by: Kitware Robot Merge-request: !3224 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=68a0b51ef882456affb852e33317cc58aa1e3692 commit 68a0b51ef882456affb852e33317cc58aa1e3692 Merge: 7f9e93a 09fba61 Author: Brad King AuthorDate: Tue Apr 16 13:36:54 2019 -0400 Commit: Brad King CommitDate: Tue Apr 16 13:36:54 2019 -0400 Merge branch 'release-3.14' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7f9e93aa0599e039f7673fb55143701754f33bb9 commit 7f9e93aa0599e039f7673fb55143701754f33bb9 Merge: fc4324a a0b6448 Author: Brad King AuthorDate: Tue Apr 16 17:35:27 2019 +0000 Commit: Kitware Robot CommitDate: Tue Apr 16 13:35:39 2019 -0400 Merge topic 'vs2019-redist' a0b6448c85 IRSL: Update redist directory for VS 2019 update 1 Acked-by: Kitware Robot Merge-request: !3233 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fc4324a27cb534080fa981a77391e0224df2ef67 commit fc4324a27cb534080fa981a77391e0224df2ef67 Merge: 5ec9d16 0b54f72 Author: Brad King AuthorDate: Tue Apr 16 17:34:33 2019 +0000 Commit: Kitware Robot CommitDate: Tue Apr 16 13:34:41 2019 -0400 Merge topic 'Boost-Gentoo' 0b54f72e94 FindBoost: Fix detection with version suffixes on Gentoo Acked-by: Kitware Robot Merge-request: !3237 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=60ec2922585d3710b45212fb5671676ff726965e commit 60ec2922585d3710b45212fb5671676ff726965e Author: Marc Chevrier AuthorDate: Sun Apr 14 19:48:39 2019 +0200 Commit: Marc Chevrier CommitDate: Mon Apr 15 18:22:14 2019 +0200 Genex: Rename $ in $ diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index e9b3f4c..7f4761f 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -387,14 +387,25 @@ Target-Dependent Queries ``$`` Expands to the ``tgt`` if the given target exists, an empty string otherwise. -``$`` +``$`` + Full path to main file (.exe, .so.1.2, .a) where ``tgt`` is the name of a + target. +``$`` Base name of main file where ``tgt`` is the name of a target. + The base name corresponds to the target file name (see + ``$``) without prefix and suffix. For example, if + target file name is ``libbase.so``, the base name is ``base``. + + See also the :prop_tgt:`OUTPUT_NAME`, :prop_tgt:`ARCHIVE_OUTPUT_NAME`, + :prop_tgt:`LIBRARY_OUTPUT_NAME` and :prop_tgt:`RUNTIME_OUTPUT_NAME` + target properties and their configuration specific variants + :prop_tgt:`OUTPUT_NAME_`, :prop_tgt:`ARCHIVE_OUTPUT_NAME_`, + :prop_tgt:`LIBRARY_OUTPUT_NAME_` and + :prop_tgt:`RUNTIME_OUTPUT_NAME_`. + Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. -``$`` - Full path to main file (.exe, .so.1.2, .a) where ``tgt`` is the name of a - target. ``$`` Prefix of main file where ``tgt`` is the name of a target. @@ -409,13 +420,23 @@ Target-Dependent Queries Name of main file (.exe, .so.1.2, .a). ``$`` Directory of main file (.exe, .so.1.2, .a). -``$`` +``$`` + File used to link (.a, .lib, .so) where ``tgt`` is the name of a target. +``$`` Base name of file used to link where ``tgt`` is the name of a target. + The base name corresponds to the target linker file name (see + ``$``) without prefix and suffix. For example, + if target file name is ``libbase.a``, the base name is ``base``. + + See also the :prop_tgt:`OUTPUT_NAME`, :prop_tgt:`ARCHIVE_OUTPUT_NAME`, + and :prop_tgt:`LIBRARY_OUTPUT_NAME` target properties and their configuration + specific variants :prop_tgt:`OUTPUT_NAME_`, + :prop_tgt:`ARCHIVE_OUTPUT_NAME_` and + :prop_tgt:`LIBRARY_OUTPUT_NAME_`. + Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. -``$`` - File used to link (.a, .lib, .so) where ``tgt`` is the name of a target. ``$`` Prefix of file used to link where ``tgt`` is the name of a target. @@ -436,22 +457,26 @@ Target-Dependent Queries Name of file with soname (.so.3). ``$`` Directory of with soname (.so.3). -``$`` +``$`` + Full path to the linker generated program database file (.pdb) + where ``tgt`` is the name of a target. + + See also the :prop_tgt:`PDB_NAME` and :prop_tgt:`PDB_OUTPUT_DIRECTORY` + target properties and their configuration specific variants + :prop_tgt:`PDB_NAME_` and :prop_tgt:`PDB_OUTPUT_DIRECTORY_`. +``$`` Base name of the linker generated program database file (.pdb) where ``tgt`` is the name of a target. + The base name corresponds to the target PDB file name (see + ``$``) without prefix and suffix. For example, + if target file name is ``base.pdb``, the base name is ``base``. + See also the :prop_tgt:`PDB_NAME` target property and its configuration specific variant :prop_tgt:`PDB_NAME_`. Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. -``$`` - Full path to the linker generated program database file (.pdb) - where ``tgt`` is the name of a target. - - See also the :prop_tgt:`PDB_NAME` and :prop_tgt:`PDB_OUTPUT_DIRECTORY` - target properties and their configuration specific variants - :prop_tgt:`PDB_NAME_` and :prop_tgt:`PDB_OUTPUT_DIRECTORY_`. ``$`` Name of the linker generated program database file (.pdb). ``$`` diff --git a/Help/release/dev/genex-TARGET_FILE_BASE_NAME.rst b/Help/release/dev/genex-TARGET_FILE_BASE_NAME.rst new file mode 100644 index 0000000..d8b2b21 --- /dev/null +++ b/Help/release/dev/genex-TARGET_FILE_BASE_NAME.rst @@ -0,0 +1,7 @@ +genex-TARGET_FILE_BASE_NAME +--------------------------- + +* New ``$``, ``$`` + and ``$`` + :manual:`generator expressions ` have been + added to retrieve the base name of various artifacts. diff --git a/Help/release/dev/genex-TARGET_OUTPUT_NAME.rst b/Help/release/dev/genex-TARGET_OUTPUT_NAME.rst deleted file mode 100644 index e3ffe57..0000000 --- a/Help/release/dev/genex-TARGET_OUTPUT_NAME.rst +++ /dev/null @@ -1,7 +0,0 @@ -genex-TARGET_OUTPUT_NAME ------------------------- - -* New ``$``, ``$`` and - ``$`` - :manual:`generator expressions ` have been - added to retrieve the base name of various artifacts. diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index af409e4..8b3d9d6 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -2210,8 +2210,8 @@ struct TargetOutputNameArtifactResultGetter // The file used to link to the target (.so, .lib, .a). if (!target->IsLinkable()) { ::reportError(context, content->GetOriginalExpression(), - "TARGET_LINKER_OUTPUT_NAME is allowed only for libraries " - "and executables with ENABLE_EXPORTS."); + "TARGET_LINKER_FILE_BASE_NAME is allowed only for " + "libraries and executables with ENABLE_EXPORTS."); return std::string(); } cmStateEnums::ArtifactType artifact = @@ -2232,7 +2232,7 @@ struct TargetOutputNameArtifactResultGetter if (target->IsImported()) { ::reportError( context, content->GetOriginalExpression(), - "TARGET_PDB_OUTPUT_NAME not allowed for IMPORTED targets."); + "TARGET_PDB_FILE_BASE_NAME not allowed for IMPORTED targets."); return std::string(); } @@ -2243,7 +2243,7 @@ struct TargetOutputNameArtifactResultGetter if (!context->LG->GetMakefile()->IsOn(pdbSupportVar)) { ::reportError( context, content->GetOriginalExpression(), - "TARGET_PDB_OUTPUT_NAME is not supported by the target linker."); + "TARGET_PDB_FILE_BASE_NAME is not supported by the target linker."); return std::string(); } @@ -2253,7 +2253,7 @@ struct TargetOutputNameArtifactResultGetter targetType != cmStateEnums::MODULE_LIBRARY && targetType != cmStateEnums::EXECUTABLE) { ::reportError(context, content->GetOriginalExpression(), - "TARGET_PDB_OUTPUT_NAME is allowed only for " + "TARGET_PDB_FILE_BASE_NAME is allowed only for " "targets with linker created artifacts."); return std::string(); } @@ -2263,9 +2263,9 @@ struct TargetOutputNameArtifactResultGetter }; template -struct TargetOutputNameArtifact : public TargetArtifactBase +struct TargetFileBaseNameArtifact : public TargetArtifactBase { - TargetOutputNameArtifact() {} // NOLINT(modernize-use-equals-default) + TargetFileBaseNameArtifact() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return 1; } @@ -2290,12 +2290,12 @@ struct TargetOutputNameArtifact : public TargetArtifactBase } }; -static const TargetOutputNameArtifact targetOutputNameNode; - -static const TargetOutputNameArtifact - targetLinkerOutputNameNode; - -static const TargetOutputNameArtifact targetPdbOutputNameNode; +static const TargetFileBaseNameArtifact + targetFileBaseNameNode; +static const TargetFileBaseNameArtifact + targetLinkerFileBaseNameNode; +static const TargetFileBaseNameArtifact + targetPdbFileBaseNameNode; class ArtifactFilePrefixTag; class ArtifactLinkerFilePrefixTag; @@ -2474,6 +2474,9 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode( { "TARGET_LINKER_FILE", &targetLinkerNodeGroup.File }, { "TARGET_SONAME_FILE", &targetSoNameNodeGroup.File }, { "TARGET_PDB_FILE", &targetPdbNodeGroup.File }, + { "TARGET_FILE_BASE_NAME", &targetFileBaseNameNode }, + { "TARGET_LINKER_FILE_BASE_NAME", &targetLinkerFileBaseNameNode }, + { "TARGET_PDB_FILE_BASE_NAME", &targetPdbFileBaseNameNode }, { "TARGET_FILE_PREFIX", &targetFilePrefixNode }, { "TARGET_LINKER_FILE_PREFIX", &targetLinkerFilePrefixNode }, { "TARGET_FILE_SUFFIX", &targetFileSuffixNode }, @@ -2488,9 +2491,6 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode( { "TARGET_PDB_FILE_DIR", &targetPdbNodeGroup.FileDir }, { "TARGET_BUNDLE_DIR", &targetBundleDirNode }, { "TARGET_BUNDLE_CONTENT_DIR", &targetBundleContentDirNode }, - { "TARGET_OUTPUT_NAME", &targetOutputNameNode }, - { "TARGET_LINKER_OUTPUT_NAME", &targetLinkerOutputNameNode }, - { "TARGET_PDB_OUTPUT_NAME", &targetPdbOutputNameNode }, { "STREQUAL", &strEqualNode }, { "EQUAL", &equalNode }, { "IN_LIST", &inListNode }, diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-result.txt b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-result.txt similarity index 100% rename from Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-result.txt rename to Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-result.txt diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt new file mode 100644 index 0000000..3b2a814 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at ImportedTarget-TARGET_PDB_FILE_BASE_NAME.cmake:2 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + TARGET_PDB_FILE_BASE_NAME not allowed for IMPORTED targets. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME.cmake b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME.cmake new file mode 100644 index 0000000..489d8e6 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME.cmake @@ -0,0 +1,2 @@ +add_library(empty UNKNOWN IMPORTED) +add_custom_target(custom COMMAND echo $) diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt deleted file mode 100644 index 783bfb3..0000000 --- a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt +++ /dev/null @@ -1,8 +0,0 @@ -CMake Error at ImportedTarget-TARGET_PDB_OUTPUT_NAME.cmake:2 \(add_custom_target\): - Error evaluating generator expression: - - \$ - - TARGET_PDB_OUTPUT_NAME not allowed for IMPORTED targets. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME.cmake b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME.cmake deleted file mode 100644 index 010b38e..0000000 --- a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME.cmake +++ /dev/null @@ -1,2 +0,0 @@ -add_library(empty UNKNOWN IMPORTED) -add_custom_target(custom COMMAND echo $) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-result.txt similarity index 100% rename from Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-result.txt rename to Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-result.txt diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-stderr.txt new file mode 100644 index 0000000..b061ce3 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at NonValidCompiler-TARGET_PDB_FILE_BASE_NAME.cmake:6 \(file\): + Error evaluating generator expression: + + \$ + + TARGET_PDB_FILE_BASE_NAME is not supported by the target linker. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME.cmake b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME.cmake similarity index 71% rename from Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME.cmake rename to Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME.cmake index 07951de..811c3f7 100644 --- a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME.cmake +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME.cmake @@ -5,5 +5,5 @@ add_library(empty STATIC empty.c) file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" - CONTENT "[$]" + CONTENT "[$]" ) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-stderr.txt deleted file mode 100644 index 00ec496..0000000 --- a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-stderr.txt +++ /dev/null @@ -1,8 +0,0 @@ -CMake Error at NonValidCompiler-TARGET_PDB_OUTPUT_NAME.cmake:6 \(file\): - Error evaluating generator expression: - - \$ - - TARGET_PDB_OUTPUT_NAME is not supported by the target linker. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-result.txt similarity index 100% rename from Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-result.txt rename to Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-result.txt diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt new file mode 100644 index 0000000..c7d245c --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at NonValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake:6 \(file\): + Error evaluating generator expression: + + \$ + + TARGET_PDB_FILE_BASE_NAME is allowed only for targets with linker created + artifacts. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake similarity index 71% rename from Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME.cmake rename to Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake index 07951de..811c3f7 100644 --- a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME.cmake +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake @@ -5,5 +5,5 @@ add_library(empty STATIC empty.c) file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" - CONTENT "[$]" + CONTENT "[$]" ) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt deleted file mode 100644 index 8ac349e..0000000 --- a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt +++ /dev/null @@ -1,9 +0,0 @@ -CMake Error at NonValidTarget-TARGET_PDB_OUTPUT_NAME.cmake:6 \(file\): - Error evaluating generator expression: - - \$ - - TARGET_PDB_OUTPUT_NAME is allowed only for targets with linker created - artifacts. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion.cmake b/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion.cmake index 775f68a..006b0da 100644 --- a/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion.cmake +++ b/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion.cmake @@ -3,4 +3,4 @@ add_executable(empty1 empty.c) set_property(TARGET empty1 PROPERTY OUTPUT_NAME $) add_executable(empty2 empty.c) -set_property(TARGET empty2 PROPERTY OUTPUT_NAME $) +set_property(TARGET empty2 PROPERTY OUTPUT_NAME $) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 0b0fb78..477b593 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -41,10 +41,10 @@ run_cmake(TARGET_FILE_SUFFIX) run_cmake(TARGET_FILE_SUFFIX-imported-target) run_cmake(TARGET_FILE_SUFFIX-non-valid-target) run_cmake(TARGET_LINKER_FILE_SUFFIX-non-valid-target) -run_cmake(TARGET_OUTPUT_NAME) -run_cmake(TARGET_OUTPUT_NAME-imported-target) -run_cmake(TARGET_OUTPUT_NAME-non-valid-target) -run_cmake(TARGET_LINKER_OUTPUT_NAME-non-valid-target) +run_cmake(TARGET_FILE_BASE_NAME) +run_cmake(TARGET_FILE_BASE_NAME-imported-target) +run_cmake(TARGET_FILE_BASE_NAME-non-valid-target) +run_cmake(TARGET_LINKER_FILE_BASE_NAME-non-valid-target) run_cmake(TARGET_PROPERTY-LOCATION) run_cmake(TARGET_PROPERTY-SOURCES) run_cmake(LINK_ONLY-not-linking) @@ -78,15 +78,15 @@ run_cmake(FILTER-Include) run_cmake(ImportedTarget-TARGET_BUNDLE_DIR) run_cmake(ImportedTarget-TARGET_BUNDLE_CONTENT_DIR) run_cmake(ImportedTarget-TARGET_PDB_FILE) -run_cmake(ImportedTarget-TARGET_PDB_OUTPUT_NAME) +run_cmake(ImportedTarget-TARGET_PDB_FILE_BASE_NAME) if(LINKER_SUPPORTS_PDB) run_cmake(NonValidTarget-TARGET_PDB_FILE) run_cmake(ValidTarget-TARGET_PDB_FILE) - run_cmake(NonValidTarget-TARGET_PDB_OUTPUT_NAME) - run_cmake(ValidTarget-TARGET_PDB_OUTPUT_NAME) + run_cmake(NonValidTarget-TARGET_PDB_FILE_BASE_NAME) + run_cmake(ValidTarget-TARGET_PDB_FILE_BASE_NAME) else() run_cmake(NonValidCompiler-TARGET_PDB_FILE) - run_cmake(NonValidCompiler-TARGET_PDB_OUTPUT_NAME) + run_cmake(NonValidCompiler-TARGET_PDB_FILE_BASE_NAME) endif() set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0085:STRING=OLD) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-check.cmake new file mode 100644 index 0000000..793edb1 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-check.cmake @@ -0,0 +1,2 @@ + +include ("${RunCMake_TEST_BINARY_DIR}/TARGET_FILE_BASE_NAME-generated.cmake") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target-check.cmake new file mode 100644 index 0000000..793edb1 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target-check.cmake @@ -0,0 +1,2 @@ + +include ("${RunCMake_TEST_BINARY_DIR}/TARGET_FILE_BASE_NAME-generated.cmake") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target.cmake similarity index 51% rename from Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target.cmake rename to Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target.cmake index 548a2d7..aa54b31 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target.cmake +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target.cmake @@ -17,11 +17,11 @@ add_library (static1 STATIC IMPORTED) string (APPEND GENERATE_CONTENT [[ -check_value ("TARGET_OUTPUT_NAME executable default" "$" "exec1") -check_value ("TARGET_OUTPUT_NAME shared default" "$" "shared1") -check_value ("TARGET_LINKER_OUTPUT_NAME shared linker default" "$" "shared1") -check_value ("TARGET_OUTPUT_NAME static default" "$" "static1") -check_value ("TARGET_LINKER_OUTPUT_NAME static linker default" "$" "static1") +check_value ("TARGET_FILE_BASE_NAME executable default" "$" "exec1") +check_value ("TARGET_FILE_BASE_NAME shared default" "$" "shared1") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker default" "$" "shared1") +check_value ("TARGET_FILE_BASE_NAME static default" "$" "static1") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker default" "$" "static1") ]]) @@ -34,11 +34,11 @@ set_property (TARGET static2 PROPERTY OUTPUT_NAME static2_custom) string (APPEND GENERATE_CONTENT [[ -check_value ("TARGET_OUTPUT_NAME executable custom" "$" "exec2_custom") -check_value ("TARGET_OUTPUT_NAME shared custom" "$" "shared2_custom") -check_value ("TARGET_LINKER_OUTPUT_NAME shared linker custom" "$" "shared2_custom") -check_value ("TARGET_OUTPUT_NAME static custom" "$" "static2_custom") -check_value ("TARGET_LINKER_OUTPUT_NAME static linker custom" "$" "static2_custom") +check_value ("TARGET_FILE_BASE_NAME executable custom" "$" "exec2_custom") +check_value ("TARGET_FILE_BASE_NAME shared custom" "$" "shared2_custom") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker custom" "$" "shared2_custom") +check_value ("TARGET_FILE_BASE_NAME static custom" "$" "static2_custom") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker custom" "$" "static2_custom") ]]) @@ -60,11 +60,11 @@ set_property (TARGET static3 PROPERTY PDB_NAME static3_pdb) string (APPEND GENERATE_CONTENT [[ -check_value ("TARGET_OUTPUT_NAME executable all properties" "$" "exec3_runtime") -check_value ("TARGET_OUTPUT_NAME shared all properties" "$" "$,Windows$CYGWIN>,shared3_runtime,shared3_library>") -check_value ("TARGET_LINKER_OUTPUT_NAME shared linker all properties" "$" "$,Windows$CYGWIN>,shared3_archive,shared3_library>") -check_value ("TARGET_OUTPUT_NAME static all properties" "$" "static3_archive") -check_value ("TARGET_LINKER_OUTPUT_NAME static linker all properties" "$" "static3_archive") +check_value ("TARGET_FILE_BASE_NAME executable all properties" "$" "exec3_runtime") +check_value ("TARGET_FILE_BASE_NAME shared all properties" "$" "$,Windows$CYGWIN>,shared3_runtime,shared3_library>") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties" "$" "$,Windows$CYGWIN>,shared3_archive,shared3_library>") +check_value ("TARGET_FILE_BASE_NAME static all properties" "$" "static3_archive") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker all properties" "$" "static3_archive") ]]) @@ -75,5 +75,5 @@ if(_isMultiConfig) set(GENERATE_CONDITION CONDITION $) endif() -file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_OUTPUT_NAME-generated.cmake" +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_FILE_BASE_NAME-generated.cmake" CONTENT "${GENERATE_CONTENT}" ${GENERATE_CONDITION}) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target-result.txt similarity index 100% rename from Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-result.txt rename to Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target-result.txt diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target-stderr.txt new file mode 100644 index 0000000..ecb9e5d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at TARGET_FILE_BASE_NAME-non-valid-target.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$ + + Target "empty" is not an executable or library\. diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target.cmake similarity index 66% rename from Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake rename to Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target.cmake index 5248dfa..8622b7d 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target.cmake @@ -3,5 +3,5 @@ add_custom_target(empty) file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" - CONTENT "[$]" + CONTENT "[$]" ) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME.cmake new file mode 100644 index 0000000..5ea53a0 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME.cmake @@ -0,0 +1,96 @@ + +cmake_minimum_required(VERSION 3.14) + +enable_language (C) + +set (GENERATE_CONTENT [[ +macro (CHECK_VALUE test_msg value expected) + if (NOT "${value}" STREQUAL "${expected}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [${value}]\nbut expected:\n [${expected}]\n") + endif() +endmacro() +]]) + +add_executable (exec1 empty.c) +add_library (shared1 SHARED empty.c) +add_library (static1 STATIC empty.c) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_FILE_BASE_NAME executable default" "$" "exec1") +check_value ("TARGET_FILE_BASE_NAME shared default" "$" "shared1") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker default" "$" "shared1") +check_value ("TARGET_FILE_BASE_NAME static default" "$" "static1") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker default" "$" "static1") +]]) +if (CMAKE_C_LINKER_SUPPORTS_PDB) + string(APPEND GENERATE_CONTENT [[ +check_value ("TARGET_PDB_FILE_BASE_NAME executable PDB default" "$" "exec1") +check_value ("TARGET_PDB_FILE_BASE_NAME shared PDB default" "$" "shared1") +]]) +endif() + + +add_executable (exec2 empty.c) +set_property (TARGET exec2 PROPERTY OUTPUT_NAME exec2_custom) +add_library (shared2 SHARED empty.c) +set_property (TARGET shared2 PROPERTY OUTPUT_NAME shared2_custom) +add_library (static2 STATIC empty.c) +set_property (TARGET static2 PROPERTY OUTPUT_NAME static2_custom) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_FILE_BASE_NAME executable custom" "$" "exec2_custom") +check_value ("TARGET_FILE_BASE_NAME shared custom" "$" "shared2_custom") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker custom" "$" "shared2_custom") +check_value ("TARGET_FILE_BASE_NAME static custom" "$" "static2_custom") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker custom" "$" "static2_custom") +]]) +if (CMAKE_C_LINKER_SUPPORTS_PDB) + string (APPEND GENERATE_CONTENT [[ +check_value ("TARGET_PDB_FILE_BASE_NAME executable PDB custom" "$" "exec2_custom") +check_value ("TARGET_PDB_FILE_BASE_NAME shared PDB custom" "$" "shared2_custom") + ]]) +endif() + +add_executable (exec3 empty.c) +set_property (TARGET exec3 PROPERTY RUNTIME_OUTPUT_NAME exec3_runtime) +set_property (TARGET exec3 PROPERTY LIBRARY_OUTPUT_NAME exec3_library) +set_property (TARGET exec3 PROPERTY ARCHIVE_OUTPUT_NAME exec3_archive) +set_property (TARGET exec3 PROPERTY PDB_NAME exec3_pdb) +add_library (shared3 SHARED empty.c) +set_property (TARGET shared3 PROPERTY RUNTIME_OUTPUT_NAME shared3_runtime) +set_property (TARGET shared3 PROPERTY LIBRARY_OUTPUT_NAME shared3_library) +set_property (TARGET shared3 PROPERTY ARCHIVE_OUTPUT_NAME shared3_archive) +set_property (TARGET shared3 PROPERTY PDB_NAME shared3_pdb) +add_library (static3 STATIC empty.c) +set_property (TARGET static3 PROPERTY RUNTIME_OUTPUT_NAME static3_runtime) +set_property (TARGET static3 PROPERTY LIBRARY_OUTPUT_NAME static3_library) +set_property (TARGET static3 PROPERTY ARCHIVE_OUTPUT_NAME static3_archive) +set_property (TARGET static3 PROPERTY PDB_NAME static3_pdb) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_FILE_BASE_NAME executable all properties" "$" "exec3_runtime") +check_value ("TARGET_FILE_BASE_NAME shared all properties" "$" "$,Windows$CYGWIN>,shared3_runtime,shared3_library>") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties" "$" "$,Windows$CYGWIN>,shared3_archive,shared3_library>") +check_value ("TARGET_FILE_BASE_NAME static all properties" "$" "static3_archive") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker all properties" "$" "static3_archive") +]]) +if (CMAKE_C_LINKER_SUPPORTS_PDB) + string (APPEND GENERATE_CONTENT [[ +check_value ("TARGET_PDB_FILE_BASE_NAME executable PDB all properties" "$" "exec3_pdb") +check_value ("TARGET_PDB_FILE_BASE_NAME shared PDB all properties" "$" "shared3_pdb") +]]) +endif() + + +unset(GENERATE_CONDITION) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) + list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG) + set(GENERATE_CONDITION CONDITION $) +endif() + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_FILE_BASE_NAME-generated.cmake" + CONTENT "${GENERATE_CONTENT}" ${GENERATE_CONDITION}) diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-result.txt similarity index 100% rename from Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-result.txt rename to Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-result.txt diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-stderr.txt new file mode 100644 index 0000000..1ae2f2c --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at TARGET_LINKER_FILE_BASE_NAME-non-valid-target.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$ + + Target "empty" is not an executable or library\. diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target.cmake similarity index 63% rename from Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake rename to Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target.cmake index c439535..776fb4b 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target.cmake @@ -3,5 +3,5 @@ add_custom_target(empty) file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" - CONTENT "[$]" + CONTENT "[$]" ) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-stderr.txt deleted file mode 100644 index 0e09469..0000000 --- a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -CMake Error at TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake:[0-9]+ \(file\): - Error evaluating generator expression: - - \$ - - Target "empty" is not an executable or library\. diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-check.cmake deleted file mode 100644 index fa4f2b9..0000000 --- a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-check.cmake +++ /dev/null @@ -1,2 +0,0 @@ - -include ("${RunCMake_TEST_BINARY_DIR}/TARGET_OUTPUT_NAME-generated.cmake") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target-check.cmake deleted file mode 100644 index fa4f2b9..0000000 --- a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target-check.cmake +++ /dev/null @@ -1,2 +0,0 @@ - -include ("${RunCMake_TEST_BINARY_DIR}/TARGET_OUTPUT_NAME-generated.cmake") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-stderr.txt deleted file mode 100644 index 9672a99..0000000 --- a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -CMake Error at TARGET_OUTPUT_NAME-non-valid-target.cmake:[0-9]+ \(file\): - Error evaluating generator expression: - - \$ - - Target "empty" is not an executable or library\. diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME.cmake deleted file mode 100644 index b7bae15..0000000 --- a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME.cmake +++ /dev/null @@ -1,96 +0,0 @@ - -cmake_minimum_required(VERSION 3.14) - -enable_language (C) - -set (GENERATE_CONTENT [[ -macro (CHECK_VALUE test_msg value expected) - if (NOT "${value}" STREQUAL "${expected}") - string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [${value}]\nbut expected:\n [${expected}]\n") - endif() -endmacro() -]]) - -add_executable (exec1 empty.c) -add_library (shared1 SHARED empty.c) -add_library (static1 STATIC empty.c) - -string (APPEND GENERATE_CONTENT [[ - -check_value ("TARGET_OUTPUT_NAME executable default" "$" "exec1") -check_value ("TARGET_OUTPUT_NAME shared default" "$" "shared1") -check_value ("TARGET_LINKER_OUTPUT_NAME shared linker default" "$" "shared1") -check_value ("TARGET_OUTPUT_NAME static default" "$" "static1") -check_value ("TARGET_LINKER_OUTPUT_NAME static linker default" "$" "static1") -]]) -if (CMAKE_C_LINKER_SUPPORTS_PDB) - string(APPEND GENERATE_CONTENT [[ -check_value ("TARGET_PDB_OUTPUT_NAME executable PDB default" "$" "exec1") -check_value ("TARGET_PDB_OUTPUT_NAME shared PDB default" "$" "shared1") -]]) -endif() - - -add_executable (exec2 empty.c) -set_property (TARGET exec2 PROPERTY OUTPUT_NAME exec2_custom) -add_library (shared2 SHARED empty.c) -set_property (TARGET shared2 PROPERTY OUTPUT_NAME shared2_custom) -add_library (static2 STATIC empty.c) -set_property (TARGET static2 PROPERTY OUTPUT_NAME static2_custom) - -string (APPEND GENERATE_CONTENT [[ - -check_value ("TARGET_OUTPUT_NAME executable custom" "$" "exec2_custom") -check_value ("TARGET_OUTPUT_NAME shared custom" "$" "shared2_custom") -check_value ("TARGET_LINKER_OUTPUT_NAME shared linker custom" "$" "shared2_custom") -check_value ("TARGET_OUTPUT_NAME static custom" "$" "static2_custom") -check_value ("TARGET_LINKER_OUTPUT_NAME static linker custom" "$" "static2_custom") -]]) -if (CMAKE_C_LINKER_SUPPORTS_PDB) - string (APPEND GENERATE_CONTENT [[ -check_value ("TARGET_PDB_OUTPUT_NAME executable PDB custom" "$" "exec2_custom") -check_value ("TARGET_PDB_OUTPUT_NAME shared PDB custom" "$" "shared2_custom") - ]]) -endif() - -add_executable (exec3 empty.c) -set_property (TARGET exec3 PROPERTY RUNTIME_OUTPUT_NAME exec3_runtime) -set_property (TARGET exec3 PROPERTY LIBRARY_OUTPUT_NAME exec3_library) -set_property (TARGET exec3 PROPERTY ARCHIVE_OUTPUT_NAME exec3_archive) -set_property (TARGET exec3 PROPERTY PDB_NAME exec3_pdb) -add_library (shared3 SHARED empty.c) -set_property (TARGET shared3 PROPERTY RUNTIME_OUTPUT_NAME shared3_runtime) -set_property (TARGET shared3 PROPERTY LIBRARY_OUTPUT_NAME shared3_library) -set_property (TARGET shared3 PROPERTY ARCHIVE_OUTPUT_NAME shared3_archive) -set_property (TARGET shared3 PROPERTY PDB_NAME shared3_pdb) -add_library (static3 STATIC empty.c) -set_property (TARGET static3 PROPERTY RUNTIME_OUTPUT_NAME static3_runtime) -set_property (TARGET static3 PROPERTY LIBRARY_OUTPUT_NAME static3_library) -set_property (TARGET static3 PROPERTY ARCHIVE_OUTPUT_NAME static3_archive) -set_property (TARGET static3 PROPERTY PDB_NAME static3_pdb) - -string (APPEND GENERATE_CONTENT [[ - -check_value ("TARGET_OUTPUT_NAME executable all properties" "$" "exec3_runtime") -check_value ("TARGET_OUTPUT_NAME shared all properties" "$" "$,Windows$CYGWIN>,shared3_runtime,shared3_library>") -check_value ("TARGET_LINKER_OUTPUT_NAME shared linker all properties" "$" "$,Windows$CYGWIN>,shared3_archive,shared3_library>") -check_value ("TARGET_OUTPUT_NAME static all properties" "$" "static3_archive") -check_value ("TARGET_LINKER_OUTPUT_NAME static linker all properties" "$" "static3_archive") -]]) -if (CMAKE_C_LINKER_SUPPORTS_PDB) - string (APPEND GENERATE_CONTENT [[ -check_value ("TARGET_PDB_OUTPUT_NAME executable PDB all properties" "$" "exec3_pdb") -check_value ("TARGET_PDB_OUTPUT_NAME shared PDB all properties" "$" "shared3_pdb") -]]) -endif() - - -unset(GENERATE_CONDITION) -get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) -if(_isMultiConfig) - list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG) - set(GENERATE_CONDITION CONDITION $) -endif() - -file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_OUTPUT_NAME-generated.cmake" - CONTENT "${GENERATE_CONTENT}" ${GENERATE_CONDITION}) diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE_BASE_NAME-check.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE_BASE_NAME-check.cmake new file mode 100644 index 0000000..996d2d4 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE_BASE_NAME-check.cmake @@ -0,0 +1,7 @@ +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/test.txt TEST_TXT ENCODING UTF-8) + +list(GET TEST_TXT 0 PDB_FILE_BASE_NAME) + +if(NOT PDB_FILE_BASE_NAME MATCHES "empty") + set(RunCMake_TEST_FAILED "unexpected PDB_FILE_BASE_NAME [${PDB_FILE_BASE_NAME}]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake similarity index 88% rename from Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME.cmake rename to Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake index ba70b43..cc53bdf 100644 --- a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME.cmake +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake @@ -11,6 +11,6 @@ endif() file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" - CONTENT "$" + CONTENT "$" ${GENERATE_CONDITION} ) diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME-check.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME-check.cmake deleted file mode 100644 index 8d1103e..0000000 --- a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME-check.cmake +++ /dev/null @@ -1,7 +0,0 @@ -file(STRINGS ${RunCMake_TEST_BINARY_DIR}/test.txt TEST_TXT ENCODING UTF-8) - -list(GET TEST_TXT 0 PDB_OUTPUT_NAME) - -if(NOT PDB_OUTPUT_NAME MATCHES "empty") - set(RunCMake_TEST_FAILED "unexpected PDB_OUTPUT_NAME [${PDB_OUTPUT_NAME}]") -endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=536cca60ea1c037d751b03bf5da8385783856000 commit 536cca60ea1c037d751b03bf5da8385783856000 Author: Alex Turbov AuthorDate: Sat Apr 6 17:53:58 2019 +0800 Commit: Brad King CommitDate: Mon Apr 15 11:06:06 2019 -0400 string: introduce `REPEAT` sub-command diff --git a/Help/command/string.rst b/Help/command/string.rst index 893fb43..2e89d7b 100644 --- a/Help/command/string.rst +++ b/Help/command/string.rst @@ -28,6 +28,7 @@ Synopsis string(`SUBSTRING`_ ) string(`STRIP`_ ) string(`GENEX_STRIP`_ ) + string(`REPEAT`_ ) `Comparison`_ string(`COMPARE`_ ) @@ -269,6 +270,14 @@ trailing spaces removed. Strip any :manual:`generator expressions ` from the ``input string`` and store the result in the ``output variable``. +.. _REPEAT: + +.. code-block:: cmake + + string(REPEAT ) + +Produce the output string as repetion of ``input string`` ``count`` times. + Comparison ^^^^^^^^^^ diff --git a/Help/release/dev/string-repeat.rst b/Help/release/dev/string-repeat.rst new file mode 100644 index 0000000..4be0d5c --- /dev/null +++ b/Help/release/dev/string-repeat.rst @@ -0,0 +1,4 @@ +string-repeat +-------------- + +* The :command:`string` learned a new sub-command ``REPEAT``. diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index 252d985..998f904 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -1,9 +1,13 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ +#define _SCL_SECURE_NO_WARNINGS + #include "cmStringCommand.h" #include "cmsys/RegularExpression.hxx" +#include #include +#include #include // IWYU pragma: keep #include #include @@ -13,6 +17,7 @@ #include "cmCryptoHash.h" #include "cmGeneratorExpression.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmRange.h" #include "cmStringReplaceHelper.h" #include "cmSystemTools.h" @@ -79,6 +84,9 @@ bool cmStringCommand::InitialPass(std::vector const& args, if (subCommand == "STRIP") { return this->HandleStripCommand(args); } + if (subCommand == "REPEAT") { + return this->HandleRepeatCommand(args); + } if (subCommand == "RANDOM") { return this->HandleRandomCommand(args); } @@ -709,6 +717,59 @@ bool cmStringCommand::HandleStripCommand(std::vector const& args) return true; } +bool cmStringCommand::HandleRepeatCommand(std::vector const& args) +{ + // `string(REPEAT "" OUTPUT_VARIABLE)` + enum ArgPos : std::size_t + { + SUB_COMMAND, + VALUE, + TIMES, + OUTPUT_VARIABLE, + TOTAL_ARGS + }; + + if (args.size() != ArgPos::TOTAL_ARGS) { + this->Makefile->IssueMessage( + MessageType::FATAL_ERROR, + "sub-command REPEAT requires three arguments."); + return true; + } + + unsigned long times; + if (!cmSystemTools::StringToULong(args[ArgPos::TIMES].c_str(), ×)) { + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, + "repeat count is not a positive number."); + return true; + } + + const auto& stringValue = args[ArgPos::VALUE]; + const auto& variableName = args[ArgPos::OUTPUT_VARIABLE]; + const auto inStringLength = stringValue.size(); + + std::string result; + switch (inStringLength) { + case 0u: + // Nothing to do for zero length input strings + break; + case 1u: + // NOTE If the string to repeat consists of the only character, + // use the appropriate constructor. + result = std::string(times, stringValue[0]); + break; + default: + result = std::string(inStringLength * times, char{}); + for (auto i = 0u; i < times; ++i) { + std::copy(cm::cbegin(stringValue), cm::cend(stringValue), + &result[i * inStringLength]); + } + break; + } + + this->Makefile->AddDefinition(variableName, result.c_str()); + return true; +} + bool cmStringCommand::HandleRandomCommand(std::vector const& args) { if (args.size() < 2 || args.size() == 3 || args.size() == 5) { diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h index cbff73e..acde605 100644 --- a/Source/cmStringCommand.h +++ b/Source/cmStringCommand.h @@ -51,6 +51,7 @@ protected: bool HandleConcatCommand(std::vector const& args); bool HandleJoinCommand(std::vector const& args); bool HandleStripCommand(std::vector const& args); + bool HandleRepeatCommand(std::vector const& args); bool HandleRandomCommand(std::vector const& args); bool HandleFindCommand(std::vector const& args); bool HandleTimestampCommand(std::vector const& args); diff --git a/Tests/RunCMake/string/Repeat.cmake b/Tests/RunCMake/string/Repeat.cmake new file mode 100644 index 0000000..fc390aa --- /dev/null +++ b/Tests/RunCMake/string/Repeat.cmake @@ -0,0 +1,45 @@ +string(REPEAT "q" 4 q_out) + +if(NOT DEFINED q_out) + message(FATAL_ERROR "q_out is not defined") +endif() + +if(NOT q_out STREQUAL "qqqq") + message(FATAL_ERROR "unexpected result") +endif() + +string(REPEAT "1234" 0 zero_out) + +if(NOT DEFINED zero_out) + message(FATAL_ERROR "zero_out is not defined") +endif() + +if(NOT zero_out STREQUAL "") + message(FATAL_ERROR "unexpected result") +endif() + +unset(zero_out) + +string(REPEAT "" 100 zero_out) + +if(NOT DEFINED zero_out) + message(FATAL_ERROR "zero_out is not defined") +endif() + +if(NOT zero_out STREQUAL "") + message(FATAL_ERROR "unexpected result") +endif() + +string(REPEAT "1" 1 one_out) + +if(NOT one_out STREQUAL "1") + message(FATAL_ERROR "unexpected result") +endif() + +unset(one_out) + +string(REPEAT "one" 1 one_out) + +if(NOT one_out STREQUAL "one") + message(FATAL_ERROR "unexpected result") +endif() diff --git a/Tests/RunCMake/string/RepeatNegativeCount-result.txt b/Tests/RunCMake/string/RepeatNegativeCount-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/string/RepeatNegativeCount-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/string/RepeatNegativeCount-stderr.txt b/Tests/RunCMake/string/RepeatNegativeCount-stderr.txt new file mode 100644 index 0000000..bbd498e --- /dev/null +++ b/Tests/RunCMake/string/RepeatNegativeCount-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at RepeatNegativeCount.cmake:[0-9]+ \(string\): + repeat count is not a positive number. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/string/RepeatNegativeCount.cmake b/Tests/RunCMake/string/RepeatNegativeCount.cmake new file mode 100644 index 0000000..769e7c0 --- /dev/null +++ b/Tests/RunCMake/string/RepeatNegativeCount.cmake @@ -0,0 +1 @@ +string(REPEAT "blah" -1 out) diff --git a/Tests/RunCMake/string/RepeatNoArgs-result.txt b/Tests/RunCMake/string/RepeatNoArgs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/string/RepeatNoArgs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/string/RepeatNoArgs-stderr.txt b/Tests/RunCMake/string/RepeatNoArgs-stderr.txt new file mode 100644 index 0000000..5abcb3b --- /dev/null +++ b/Tests/RunCMake/string/RepeatNoArgs-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at RepeatNoArgs.cmake:[0-9]+ \(string\): + sub-command REPEAT requires three arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/string/RepeatNoArgs.cmake b/Tests/RunCMake/string/RepeatNoArgs.cmake new file mode 100644 index 0000000..e327e99 --- /dev/null +++ b/Tests/RunCMake/string/RepeatNoArgs.cmake @@ -0,0 +1 @@ +string(REPEAT) diff --git a/Tests/RunCMake/string/RunCMakeTest.cmake b/Tests/RunCMake/string/RunCMakeTest.cmake index 211337a..c432b4e 100644 --- a/Tests/RunCMake/string/RunCMakeTest.cmake +++ b/Tests/RunCMake/string/RunCMakeTest.cmake @@ -33,3 +33,7 @@ run_cmake(UTF-16BE) run_cmake(UTF-16LE) run_cmake(UTF-32BE) run_cmake(UTF-32LE) + +run_cmake(Repeat) +run_cmake(RepeatNoArgs) +run_cmake(RepeatNegativeCount) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=58f04b6ecf853e4ee5cce2bfb258fa7d4cc75b79 commit 58f04b6ecf853e4ee5cce2bfb258fa7d4cc75b79 Author: Sebastian Holtermann AuthorDate: Fri Apr 12 13:01:09 2019 +0200 Commit: Sebastian Holtermann CommitDate: Mon Apr 15 16:07:14 2019 +0200 Autogen: Add ManySources test The QtAutogen/ManySources test generates a number of source, header, .ui and .qrc files that get AUTOMOC, AUTOUIC and AUTORCC processed. This stresses the concurrency framework in `cmQtAutoMocUic` and should reveal any issues with that. diff --git a/Tests/QtAutogen/ManySources/CMakeLists.txt b/Tests/QtAutogen/ManySources/CMakeLists.txt new file mode 100644 index 0000000..df8a2a6 --- /dev/null +++ b/Tests/QtAutogen/ManySources/CMakeLists.txt @@ -0,0 +1,35 @@ +cmake_minimum_required(VERSION 3.10) +project(ManySources) +include("../AutogenGuiTest.cmake") + +# Test AUTOMOC and AUTOUIC on many source files to stress the concurrent +# parsing and processing framework. + +set(CSD ${CMAKE_CURRENT_SOURCE_DIR}) +set(CBD ${CMAKE_CURRENT_BINARY_DIR}) + +set(SRCS main.cpp) +set(MAIN_INCLUDES "\n// Item includes\n") +set(MAIN_ITEMS "\n// Items\n") + +set(NUM 24) +foreach(III RANGE 1 ${NUM}) + configure_file(${CSD}/object.h.in ${CBD}/object_${III}.h) + configure_file(${CSD}/item.h.in ${CBD}/item_${III}.h) + configure_file(${CSD}/item.cpp.in ${CBD}/item_${III}.cpp) + configure_file(${CSD}/view.ui.in ${CBD}/view_${III}.ui) + configure_file(${CSD}/data.qrc.in ${CBD}/data_${III}.qrc) + + list(APPEND SRCS ${CBD}/item_${III}.cpp) + list(APPEND SRCS ${CBD}/data_${III}.qrc) + + string(APPEND MAIN_INCLUDES "#include \"item_${III}.h\"\n") + string(APPEND MAIN_ITEMS "Item_${III} item_${III};\n") + string(APPEND MAIN_ITEMS "item_${III}.TheSlot();\n") +endforeach() + +configure_file(${CSD}/main.cpp.in ${CBD}/main.cpp) + +add_executable(manySources ${SRCS} ${CBD}/main.cpp) +target_link_libraries(manySources ${QT_LIBRARIES}) +set_target_properties(manySources PROPERTIES AUTOMOC 1 AUTOUIC 1 AUTORCC 1) diff --git a/Tests/QtAutogen/ManySources/data.qrc.in b/Tests/QtAutogen/ManySources/data.qrc.in new file mode 100644 index 0000000..870d486 --- /dev/null +++ b/Tests/QtAutogen/ManySources/data.qrc.in @@ -0,0 +1,7 @@ + + + object_ at III@.h + item_ at III@.h + item_ at III@.cpp + + diff --git a/Tests/QtAutogen/ManySources/item.cpp.in b/Tests/QtAutogen/ManySources/item.cpp.in new file mode 100644 index 0000000..c34ad16 --- /dev/null +++ b/Tests/QtAutogen/ManySources/item.cpp.in @@ -0,0 +1,27 @@ +#include "item_ at III@.h" +#include "object_ at III@.h" +// AUTOUIC include +#include + +class LocalObject_ at III@ : public QObject +{ + Q_OBJECT; + +public: + LocalObject_ at III@() = default; + ~LocalObject_ at III@() = default; +}; + +void Item_ at III@ ::TheSlot() +{ + LocalObject_ at III@ localObject; + Object_ at III@ obj; + obj.ObjectSlot(); + + Ui_View_ at III@ ui_view; +} + +// AUTOMOC includes +#include "item_ at III@.moc" +#include "moc_item_ at III@.cpp" +#include "moc_object_ at III@.cpp" diff --git a/Tests/QtAutogen/ManySources/item.h.in b/Tests/QtAutogen/ManySources/item.h.in new file mode 100644 index 0000000..67ad794 --- /dev/null +++ b/Tests/QtAutogen/ManySources/item.h.in @@ -0,0 +1,15 @@ +#ifndef ITEM_ at III@HPP +#define ITEM_ at III@HPP + +#include + +class Item_ at III@ : public QObject +{ + Q_OBJECT + +public: + Q_SLOT + void TheSlot(); +}; + +#endif diff --git a/Tests/QtAutogen/ManySources/main.cpp.in b/Tests/QtAutogen/ManySources/main.cpp.in new file mode 100644 index 0000000..e1dda40 --- /dev/null +++ b/Tests/QtAutogen/ManySources/main.cpp.in @@ -0,0 +1,7 @@ + at MAIN_INCLUDES@ + +int main(int argv, char** args) +{ + @MAIN_ITEMS@ + return 0; +} diff --git a/Tests/QtAutogen/ManySources/object.h.in b/Tests/QtAutogen/ManySources/object.h.in new file mode 100644 index 0000000..a747cbc --- /dev/null +++ b/Tests/QtAutogen/ManySources/object.h.in @@ -0,0 +1,15 @@ +#ifndef OBJECT_ at III@H +#define OBJECT_ at III@H + +#include + +class Object_ at III@ : public QObject +{ + Q_OBJECT + +public: + Q_SLOT + void ObjectSlot(){}; +}; + +#endif diff --git a/Tests/QtAutogen/ManySources/view.ui.in b/Tests/QtAutogen/ManySources/view.ui.in new file mode 100644 index 0000000..6901fe3 --- /dev/null +++ b/Tests/QtAutogen/ManySources/view.ui.in @@ -0,0 +1,24 @@ + + + View_ at III@ + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/Tests.cmake b/Tests/QtAutogen/Tests.cmake index 096d5e3..6771828 100644 --- a/Tests/QtAutogen/Tests.cmake +++ b/Tests/QtAutogen/Tests.cmake @@ -5,6 +5,7 @@ ADD_AUTOGEN_TEST(AutogenTargetDepends) ADD_AUTOGEN_TEST(Complex QtAutogen) ADD_AUTOGEN_TEST(GlobalAutogenTarget) ADD_AUTOGEN_TEST(LowMinimumVersion lowMinimumVersion) +ADD_AUTOGEN_TEST(ManySources manySources) ADD_AUTOGEN_TEST(MocOnly mocOnly) ADD_AUTOGEN_TEST(MocOptions mocOptions) ADD_AUTOGEN_TEST(ObjectLibrary someProgram) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a3f062091f488237c0151f3f4753e0668f37c60d commit a3f062091f488237c0151f3f4753e0668f37c60d Author: Sebastian Holtermann AuthorDate: Fri Apr 12 10:56:08 2019 +0200 Commit: Sebastian Holtermann CommitDate: Mon Apr 15 16:07:13 2019 +0200 Autogen: Rename `cmQtAutoGeneratorMocUic` class to `cmQtAutoMocUic` The class name `cmQtAutoGeneratorMocUic` is long and cumbersome. This renames it to `cmQtAutoMocUic`. diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index fcea2e3..49f237f 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -350,8 +350,8 @@ set(SRCS cmQtAutoGenGlobalInitializer.h cmQtAutoGenInitializer.cxx cmQtAutoGenInitializer.h - cmQtAutoGeneratorMocUic.cxx - cmQtAutoGeneratorMocUic.h + cmQtAutoMocUic.cxx + cmQtAutoMocUic.h cmQtAutoRcc.cxx cmQtAutoRcc.h cmRST.cxx diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoMocUic.cxx similarity index 94% rename from Source/cmQtAutoGeneratorMocUic.cxx rename to Source/cmQtAutoMocUic.cxx index 80684b6..75c5d8a 100644 --- a/Source/cmQtAutoGeneratorMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -1,6 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmQtAutoGeneratorMocUic.h" +#include "cmQtAutoMocUic.h" #include #include @@ -24,7 +24,7 @@ // -- Class methods -std::string cmQtAutoGeneratorMocUic::BaseSettingsT::AbsoluteBuildPath( +std::string cmQtAutoMocUic::BaseSettingsT::AbsoluteBuildPath( std::string const& relativePath) const { return FileSys->CollapseFullPath(relativePath, AutogenBuildDir); @@ -35,7 +35,7 @@ std::string cmQtAutoGeneratorMocUic::BaseSettingsT::AbsoluteBuildPath( * appending different header extensions * @return True on success */ -bool cmQtAutoGeneratorMocUic::BaseSettingsT::FindHeader( +bool cmQtAutoMocUic::BaseSettingsT::FindHeader( std::string& header, std::string const& testBasePath) const { for (std::string const& ext : HeaderExtensions) { @@ -50,8 +50,7 @@ bool cmQtAutoGeneratorMocUic::BaseSettingsT::FindHeader( return false; } -bool cmQtAutoGeneratorMocUic::MocSettingsT::skipped( - std::string const& fileName) const +bool cmQtAutoMocUic::MocSettingsT::skipped(std::string const& fileName) const { return (!Enabled || (SkipList.find(fileName) != SkipList.end())); } @@ -60,7 +59,7 @@ bool cmQtAutoGeneratorMocUic::MocSettingsT::skipped( * @brief Returns the first relevant Qt macro name found in the given C++ code * @return The name of the Qt macro or an empty string */ -std::string cmQtAutoGeneratorMocUic::MocSettingsT::FindMacro( +std::string cmQtAutoMocUic::MocSettingsT::FindMacro( std::string const& content) const { for (KeyExpT const& filter : MacroFilters) { @@ -77,7 +76,7 @@ std::string cmQtAutoGeneratorMocUic::MocSettingsT::FindMacro( return std::string(); } -std::string cmQtAutoGeneratorMocUic::MocSettingsT::MacrosString() const +std::string cmQtAutoMocUic::MocSettingsT::MacrosString() const { std::string res; const auto itB = MacroFilters.cbegin(); @@ -99,7 +98,7 @@ std::string cmQtAutoGeneratorMocUic::MocSettingsT::MacrosString() const return res; } -std::string cmQtAutoGeneratorMocUic::MocSettingsT::FindIncludedFile( +std::string cmQtAutoMocUic::MocSettingsT::FindIncludedFile( std::string const& sourcePath, std::string const& includeString) const { // Search in vicinity of the source @@ -123,7 +122,7 @@ std::string cmQtAutoGeneratorMocUic::MocSettingsT::FindIncludedFile( return std::string(); } -void cmQtAutoGeneratorMocUic::MocSettingsT::FindDependencies( +void cmQtAutoMocUic::MocSettingsT::FindDependencies( std::string const& content, std::set& depends) const { if (!DependFilters.empty() && !content.empty()) { @@ -147,27 +146,27 @@ void cmQtAutoGeneratorMocUic::MocSettingsT::FindDependencies( } } -bool cmQtAutoGeneratorMocUic::UicSettingsT::skipped( - std::string const& fileName) const +bool cmQtAutoMocUic::UicSettingsT::skipped(std::string const& fileName) const { return (!Enabled || (SkipList.find(fileName) != SkipList.end())); } -void cmQtAutoGeneratorMocUic::JobT::LogError(GenT genType, - std::string const& message) const +void cmQtAutoMocUic::JobT::LogError(GenT genType, + std::string const& message) const { Gen()->AbortError(); Gen()->Log().Error(genType, message); } -void cmQtAutoGeneratorMocUic::JobT::LogFileError( - GenT genType, std::string const& filename, std::string const& message) const +void cmQtAutoMocUic::JobT::LogFileError(GenT genType, + std::string const& filename, + std::string const& message) const { Gen()->AbortError(); Gen()->Log().ErrorFile(genType, filename, message); } -void cmQtAutoGeneratorMocUic::JobT::LogCommandError( +void cmQtAutoMocUic::JobT::LogCommandError( GenT genType, std::string const& message, std::vector const& command, std::string const& output) const { @@ -175,9 +174,9 @@ void cmQtAutoGeneratorMocUic::JobT::LogCommandError( Gen()->Log().ErrorCommand(genType, message, command, output); } -bool cmQtAutoGeneratorMocUic::JobT::RunProcess( - GenT genType, cmWorkerPool::ProcessResultT& result, - std::vector const& command) +bool cmQtAutoMocUic::JobT::RunProcess(GenT genType, + cmWorkerPool::ProcessResultT& result, + std::vector const& command) { // Log command if (Log().Verbose()) { @@ -190,7 +189,7 @@ bool cmQtAutoGeneratorMocUic::JobT::RunProcess( Gen()->Base().AutogenBuildDir); } -void cmQtAutoGeneratorMocUic::JobMocPredefsT::Process() +void cmQtAutoMocUic::JobMocPredefsT::Process() { // (Re)generate moc_predefs.h on demand bool generate(false); @@ -260,7 +259,7 @@ void cmQtAutoGeneratorMocUic::JobMocPredefsT::Process() } } -void cmQtAutoGeneratorMocUic::JobParseT::Process() +void cmQtAutoMocUic::JobParseT::Process() { if (AutoMoc && Header) { // Don't parse header for moc if the file is included by a source already @@ -297,7 +296,7 @@ void cmQtAutoGeneratorMocUic::JobParseT::Process() } } -bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(MetaT const& meta) +bool cmQtAutoMocUic::JobParseT::ParseMocSource(MetaT const& meta) { struct JobPre { @@ -550,7 +549,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(MetaT const& meta) return true; } -bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocHeader(MetaT const& meta) +bool cmQtAutoMocUic::JobParseT::ParseMocHeader(MetaT const& meta) { bool success = true; std::string const macroName = Gen()->Moc().FindMacro(meta.Content); @@ -568,7 +567,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocHeader(MetaT const& meta) return success; } -std::string cmQtAutoGeneratorMocUic::JobParseT::MocStringHeaders( +std::string cmQtAutoMocUic::JobParseT::MocStringHeaders( std::string const& fileBase) const { std::string res = fileBase; @@ -578,7 +577,7 @@ std::string cmQtAutoGeneratorMocUic::JobParseT::MocStringHeaders( return res; } -std::string cmQtAutoGeneratorMocUic::JobParseT::MocFindIncludedHeader( +std::string cmQtAutoMocUic::JobParseT::MocFindIncludedHeader( std::string const& includerDir, std::string const& includeBase) { std::string header; @@ -601,7 +600,7 @@ std::string cmQtAutoGeneratorMocUic::JobParseT::MocFindIncludedHeader( return header; } -bool cmQtAutoGeneratorMocUic::JobParseT::ParseUic(MetaT const& meta) +bool cmQtAutoMocUic::JobParseT::ParseUic(MetaT const& meta) { bool success = true; if (meta.Content.find("ui_") != std::string::npos) { @@ -618,8 +617,8 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseUic(MetaT const& meta) return success; } -bool cmQtAutoGeneratorMocUic::JobParseT::ParseUicInclude( - MetaT const& meta, std::string&& includeString) +bool cmQtAutoMocUic::JobParseT::ParseUicInclude(MetaT const& meta, + std::string&& includeString) { bool success = false; std::string uiInputFile = UicFindIncludedFile(meta, includeString); @@ -636,7 +635,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseUicInclude( return success; } -std::string cmQtAutoGeneratorMocUic::JobParseT::UicFindIncludedFile( +std::string cmQtAutoMocUic::JobParseT::UicFindIncludedFile( MetaT const& meta, std::string const& includeString) { std::string res; @@ -698,7 +697,7 @@ std::string cmQtAutoGeneratorMocUic::JobParseT::UicFindIncludedFile( return res; } -void cmQtAutoGeneratorMocUic::JobPostParseT::Process() +void cmQtAutoMocUic::JobPostParseT::Process() { if (Gen()->Moc().Enabled) { // Add mocs compilations fence job @@ -708,7 +707,7 @@ void cmQtAutoGeneratorMocUic::JobPostParseT::Process() Gen()->WorkerPool().EmplaceJob(); } -void cmQtAutoGeneratorMocUic::JobMocsCompilationT::Process() +void cmQtAutoMocUic::JobMocsCompilationT::Process() { // Compose mocs compilation file content std::string content = @@ -750,14 +749,13 @@ void cmQtAutoGeneratorMocUic::JobMocsCompilationT::Process() } } -void cmQtAutoGeneratorMocUic::JobMocT::FindDependencies( - std::string const& content) +void cmQtAutoMocUic::JobMocT::FindDependencies(std::string const& content) { Gen()->Moc().FindDependencies(content, Depends); DependsValid = true; } -void cmQtAutoGeneratorMocUic::JobMocT::Process() +void cmQtAutoMocUic::JobMocT::Process() { // Compute build file name if (!IncludeString.empty()) { @@ -788,7 +786,7 @@ void cmQtAutoGeneratorMocUic::JobMocT::Process() } } -bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired() +bool cmQtAutoMocUic::JobMocT::UpdateRequired() { bool const verbose = Log().Verbose(); @@ -921,7 +919,7 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired() return false; } -void cmQtAutoGeneratorMocUic::JobMocT::GenerateMoc() +void cmQtAutoMocUic::JobMocT::GenerateMoc() { // Make sure the parent directory exists if (!FileSys().MakeParentDirectory(BuildFile)) { @@ -972,7 +970,7 @@ void cmQtAutoGeneratorMocUic::JobMocT::GenerateMoc() } } -void cmQtAutoGeneratorMocUic::JobUicT::Process() +void cmQtAutoMocUic::JobUicT::Process() { // Compute build file name BuildFile = Gen()->Base().AutogenIncludeDir; @@ -984,7 +982,7 @@ void cmQtAutoGeneratorMocUic::JobUicT::Process() } } -bool cmQtAutoGeneratorMocUic::JobUicT::UpdateRequired() +bool cmQtAutoMocUic::JobUicT::UpdateRequired() { bool const verbose = Log().Verbose(); @@ -1040,7 +1038,7 @@ bool cmQtAutoGeneratorMocUic::JobUicT::UpdateRequired() return false; } -void cmQtAutoGeneratorMocUic::JobUicT::GenerateUic() +void cmQtAutoMocUic::JobUicT::GenerateUic() { // Make sure the parent directory exists if (!FileSys().MakeParentDirectory(BuildFile)) { @@ -1089,12 +1087,12 @@ void cmQtAutoGeneratorMocUic::JobUicT::GenerateUic() } } -void cmQtAutoGeneratorMocUic::JobFinishT::Process() +void cmQtAutoMocUic::JobFinishT::Process() { Gen()->AbortSuccess(); } -cmQtAutoGeneratorMocUic::cmQtAutoGeneratorMocUic() +cmQtAutoMocUic::cmQtAutoMocUic() : Base_(&FileSys()) , Moc_(&FileSys()) { @@ -1106,9 +1104,9 @@ cmQtAutoGeneratorMocUic::cmQtAutoGeneratorMocUic() "[\"<](([^ \">]+/)?ui_[^ \">/]+\\.h)[\">]"); } -cmQtAutoGeneratorMocUic::~cmQtAutoGeneratorMocUic() = default; +cmQtAutoMocUic::~cmQtAutoMocUic() = default; -bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile) +bool cmQtAutoMocUic::Init(cmMakefile* makefile) { // -- Meta Base_.HeaderExtensions = makefile->GetCMakeInstance()->GetHeaderExtensions(); @@ -1478,7 +1476,7 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile) return true; } -bool cmQtAutoGeneratorMocUic::Process() +bool cmQtAutoMocUic::Process() { SettingsFileRead(); if (!CreateDirectories()) { @@ -1496,7 +1494,7 @@ bool cmQtAutoGeneratorMocUic::Process() return SettingsFileWrite(); } -void cmQtAutoGeneratorMocUic::SettingsFileRead() +void cmQtAutoMocUic::SettingsFileRead() { // Compose current settings strings { @@ -1562,7 +1560,7 @@ void cmQtAutoGeneratorMocUic::SettingsFileRead() } } -bool cmQtAutoGeneratorMocUic::SettingsFileWrite() +bool cmQtAutoMocUic::SettingsFileWrite() { // Only write if any setting changed if (Moc().SettingsChanged || Uic().SettingsChanged) { @@ -1597,7 +1595,7 @@ bool cmQtAutoGeneratorMocUic::SettingsFileWrite() return true; } -bool cmQtAutoGeneratorMocUic::CreateDirectories() +bool cmQtAutoMocUic::CreateDirectories() { // Create AUTOGEN include directory if (!FileSys().MakeDirectory(Base().AutogenIncludeDir)) { @@ -1608,9 +1606,9 @@ bool cmQtAutoGeneratorMocUic::CreateDirectories() return true; } -// Private method that requires cmQtAutoGeneratorMocUic::JobsMutex_ to be +// Private method that requires cmQtAutoMocUic::JobsMutex_ to be // locked -void cmQtAutoGeneratorMocUic::Abort(bool error) +void cmQtAutoMocUic::Abort(bool error) { if (error) { JobError_.store(true); @@ -1618,8 +1616,7 @@ void cmQtAutoGeneratorMocUic::Abort(bool error) WorkerPool_.Abort(); } -bool cmQtAutoGeneratorMocUic::ParallelJobPushMoc( - cmWorkerPool::JobHandleT&& jobHandle) +bool cmQtAutoMocUic::ParallelJobPushMoc(cmWorkerPool::JobHandleT&& jobHandle) { JobMocT const& mocJob(static_cast(*jobHandle)); // Do additional tests if this is an included moc job @@ -1669,8 +1666,7 @@ bool cmQtAutoGeneratorMocUic::ParallelJobPushMoc( return WorkerPool_.PushJob(std::move(jobHandle)); } -bool cmQtAutoGeneratorMocUic::ParallelJobPushUic( - cmWorkerPool::JobHandleT&& jobHandle) +bool cmQtAutoMocUic::ParallelJobPushUic(cmWorkerPool::JobHandleT&& jobHandle) { const JobUicT& uicJob(static_cast(*jobHandle)); { @@ -1717,14 +1713,13 @@ bool cmQtAutoGeneratorMocUic::ParallelJobPushUic( return WorkerPool_.PushJob(std::move(jobHandle)); } -bool cmQtAutoGeneratorMocUic::ParallelMocIncluded( - std::string const& sourceFile) +bool cmQtAutoMocUic::ParallelMocIncluded(std::string const& sourceFile) { std::lock_guard guard(MocMetaMutex_); return (MocIncludedFiles_.find(sourceFile) != MocIncludedFiles_.end()); } -std::string cmQtAutoGeneratorMocUic::ParallelMocAutoRegister( +std::string cmQtAutoMocUic::ParallelMocAutoRegister( std::string const& baseName) { std::string res; diff --git a/Source/cmQtAutoGeneratorMocUic.h b/Source/cmQtAutoMocUic.h similarity index 95% rename from Source/cmQtAutoGeneratorMocUic.h rename to Source/cmQtAutoMocUic.h index 4efc2c6..3902abb 100644 --- a/Source/cmQtAutoGeneratorMocUic.h +++ b/Source/cmQtAutoMocUic.h @@ -1,7 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmQtAutoGeneratorMocUic_h -#define cmQtAutoGeneratorMocUic_h +#ifndef cmQtAutoMocUic_h +#define cmQtAutoMocUic_h #include "cmConfigure.h" // IWYU pragma: keep @@ -24,14 +24,14 @@ class cmMakefile; // @brief AUTOMOC and AUTOUIC generator -class cmQtAutoGeneratorMocUic : public cmQtAutoGenerator +class cmQtAutoMocUic : public cmQtAutoGenerator { public: - cmQtAutoGeneratorMocUic(); - ~cmQtAutoGeneratorMocUic() override; + cmQtAutoMocUic(); + ~cmQtAutoMocUic() override; - cmQtAutoGeneratorMocUic(cmQtAutoGeneratorMocUic const&) = delete; - cmQtAutoGeneratorMocUic& operator=(cmQtAutoGeneratorMocUic const&) = delete; + cmQtAutoMocUic(cmQtAutoMocUic const&) = delete; + cmQtAutoMocUic& operator=(cmQtAutoMocUic const&) = delete; public: // -- Types @@ -183,9 +183,9 @@ public: } //! Get the generator. Only valid during Process() call! - cmQtAutoGeneratorMocUic* Gen() const + cmQtAutoMocUic* Gen() const { - return static_cast(UserData()); + return static_cast(UserData()); }; //! Get the file system interface. Only valid during Process() call! diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index c18c256..3c75957 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -7,7 +7,7 @@ #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" -#include "cmQtAutoGeneratorMocUic.h" +#include "cmQtAutoMocUic.h" #include "cmQtAutoRcc.h" #include "cmRange.h" #include "cmState.h" @@ -1018,7 +1018,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector const& args) #ifdef CMAKE_BUILD_WITH_CMAKE if ((args[1] == "cmake_autogen") && (args.size() >= 4)) { - cmQtAutoGeneratorMocUic autoGen; + cmQtAutoMocUic autoGen; std::string const& infoDir = args[2]; std::string const& config = args[3]; return autoGen.Run(infoDir, config) ? 0 : 1; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8cb26a0a2ad57ca9012f97c7437711ee94f1a9db commit 8cb26a0a2ad57ca9012f97c7437711ee94f1a9db Author: Sebastian Holtermann AuthorDate: Fri Apr 5 12:19:14 2019 +0200 Commit: Sebastian Holtermann CommitDate: Mon Apr 15 16:07:13 2019 +0200 Autogen: Factor out concurrency framework to cmWorkerPool class This factors out the concurrency framework in `cmQtAutoGeneratorMocUic` to a dedicated class `cmWorkerPool` which might be reused in other places. `cmWorkerPool` supports fence jobs that require that - all other jobs before in the queue have been processed before the fence job processing gets started, - no jobs later in the queue will be processed before the fence job processing has been completed. Fence jobs are needed where the completion of all previous jobs in the queue is a requirement for further processing. E.g. in `cmQtAutoGeneratorMocUic` the generation of `mocs_compilation.cpp` requires that all previous source file parse jobs have been completed. diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 924d997..fcea2e3 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -391,6 +391,8 @@ set(SRCS cmVariableWatch.h cmVersion.cxx cmVersion.h + cmWorkerPool.cxx + cmWorkerPool.h cmWorkingDirectory.cxx cmWorkingDirectory.h cmXMLParser.cxx diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx index f115016..6fbea82 100644 --- a/Source/cmQtAutoGenerator.cxx +++ b/Source/cmQtAutoGenerator.cxx @@ -14,12 +14,6 @@ #include "cmSystemTools.h" #include "cmake.h" -#include -#include -#include - -// -- Class methods - cmQtAutoGenerator::Logger::Logger() { // Initialize logger @@ -431,232 +425,6 @@ bool cmQtAutoGenerator::FileSystem::MakeParentDirectory( return cmQtAutoGenerator::MakeParentDirectory(filename); } -int cmQtAutoGenerator::ReadOnlyProcessT::PipeT::init(uv_loop_t* uv_loop, - ReadOnlyProcessT* process) -{ - Process_ = process; - Target_ = nullptr; - return UVPipe_.init(*uv_loop, 0, this); -} - -int cmQtAutoGenerator::ReadOnlyProcessT::PipeT::startRead(std::string* target) -{ - Target_ = target; - return uv_read_start(uv_stream(), &PipeT::UVAlloc, &PipeT::UVData); -} - -void cmQtAutoGenerator::ReadOnlyProcessT::PipeT::reset() -{ - Process_ = nullptr; - Target_ = nullptr; - UVPipe_.reset(); - Buffer_.clear(); - Buffer_.shrink_to_fit(); -} - -void cmQtAutoGenerator::ReadOnlyProcessT::PipeT::UVAlloc(uv_handle_t* handle, - size_t suggestedSize, - uv_buf_t* buf) -{ - auto& pipe = *reinterpret_cast(handle->data); - pipe.Buffer_.resize(suggestedSize); - buf->base = pipe.Buffer_.data(); - buf->len = pipe.Buffer_.size(); -} - -void cmQtAutoGenerator::ReadOnlyProcessT::PipeT::UVData(uv_stream_t* stream, - ssize_t nread, - const uv_buf_t* buf) -{ - auto& pipe = *reinterpret_cast(stream->data); - if (nread > 0) { - // Append data to merged output - if ((buf->base != nullptr) && (pipe.Target_ != nullptr)) { - pipe.Target_->append(buf->base, nread); - } - } else if (nread < 0) { - // EOF or error - auto* proc = pipe.Process_; - // Check it this an unusual error - if (nread != UV_EOF) { - if (!proc->Result()->error()) { - proc->Result()->ErrorMessage = - "libuv reading from pipe failed with error code "; - proc->Result()->ErrorMessage += std::to_string(nread); - } - } - // Clear libuv pipe handle and try to finish - pipe.reset(); - proc->UVTryFinish(); - } -} - -void cmQtAutoGenerator::ProcessResultT::reset() -{ - ExitStatus = 0; - TermSignal = 0; - if (!StdOut.empty()) { - StdOut.clear(); - StdOut.shrink_to_fit(); - } - if (!StdErr.empty()) { - StdErr.clear(); - StdErr.shrink_to_fit(); - } - if (!ErrorMessage.empty()) { - ErrorMessage.clear(); - ErrorMessage.shrink_to_fit(); - } -} - -void cmQtAutoGenerator::ReadOnlyProcessT::setup( - ProcessResultT* result, bool mergedOutput, - std::vector const& command, std::string const& workingDirectory) -{ - Setup_.WorkingDirectory = workingDirectory; - Setup_.Command = command; - Setup_.Result = result; - Setup_.MergedOutput = mergedOutput; -} - -static std::string getUVError(const char* prefixString, int uvErrorCode) -{ - std::ostringstream ost; - ost << prefixString << ": " << uv_strerror(uvErrorCode); - return ost.str(); -} - -bool cmQtAutoGenerator::ReadOnlyProcessT::start( - uv_loop_t* uv_loop, std::function&& finishedCallback) -{ - if (IsStarted() || (Result() == nullptr)) { - return false; - } - - // Reset result before the start - Result()->reset(); - - // Fill command string pointers - if (!Setup().Command.empty()) { - CommandPtr_.reserve(Setup().Command.size() + 1); - for (std::string const& arg : Setup().Command) { - CommandPtr_.push_back(arg.c_str()); - } - CommandPtr_.push_back(nullptr); - } else { - Result()->ErrorMessage = "Empty command"; - } - - if (!Result()->error()) { - if (UVPipeOut_.init(uv_loop, this) != 0) { - Result()->ErrorMessage = "libuv stdout pipe initialization failed"; - } - } - if (!Result()->error()) { - if (UVPipeErr_.init(uv_loop, this) != 0) { - Result()->ErrorMessage = "libuv stderr pipe initialization failed"; - } - } - if (!Result()->error()) { - // -- Setup process stdio options - // stdin - UVOptionsStdIO_[0].flags = UV_IGNORE; - UVOptionsStdIO_[0].data.stream = nullptr; - // stdout - UVOptionsStdIO_[1].flags = - static_cast(UV_CREATE_PIPE | UV_WRITABLE_PIPE); - UVOptionsStdIO_[1].data.stream = UVPipeOut_.uv_stream(); - // stderr - UVOptionsStdIO_[2].flags = - static_cast(UV_CREATE_PIPE | UV_WRITABLE_PIPE); - UVOptionsStdIO_[2].data.stream = UVPipeErr_.uv_stream(); - - // -- Setup process options - std::fill_n(reinterpret_cast(&UVOptions_), sizeof(UVOptions_), 0); - UVOptions_.exit_cb = &ReadOnlyProcessT::UVExit; - UVOptions_.file = CommandPtr_[0]; - UVOptions_.args = const_cast(CommandPtr_.data()); - UVOptions_.cwd = Setup_.WorkingDirectory.c_str(); - UVOptions_.flags = UV_PROCESS_WINDOWS_HIDE; - UVOptions_.stdio_count = static_cast(UVOptionsStdIO_.size()); - UVOptions_.stdio = UVOptionsStdIO_.data(); - - // -- Spawn process - int uvErrorCode = UVProcess_.spawn(*uv_loop, UVOptions_, this); - if (uvErrorCode != 0) { - Result()->ErrorMessage = - getUVError("libuv process spawn failed ", uvErrorCode); - } - } - // -- Start reading from stdio streams - if (!Result()->error()) { - if (UVPipeOut_.startRead(&Result()->StdOut) != 0) { - Result()->ErrorMessage = "libuv start reading from stdout pipe failed"; - } - } - if (!Result()->error()) { - if (UVPipeErr_.startRead(Setup_.MergedOutput ? &Result()->StdOut - : &Result()->StdErr) != 0) { - Result()->ErrorMessage = "libuv start reading from stderr pipe failed"; - } - } - - if (!Result()->error()) { - IsStarted_ = true; - FinishedCallback_ = std::move(finishedCallback); - } else { - // Clear libuv handles and finish - UVProcess_.reset(); - UVPipeOut_.reset(); - UVPipeErr_.reset(); - CommandPtr_.clear(); - } - - return IsStarted(); -} - -void cmQtAutoGenerator::ReadOnlyProcessT::UVExit(uv_process_t* handle, - int64_t exitStatus, - int termSignal) -{ - auto& proc = *reinterpret_cast(handle->data); - if (proc.IsStarted() && !proc.IsFinished()) { - // Set error message on demand - proc.Result()->ExitStatus = exitStatus; - proc.Result()->TermSignal = termSignal; - if (!proc.Result()->error()) { - if (termSignal != 0) { - proc.Result()->ErrorMessage = "Process was terminated by signal "; - proc.Result()->ErrorMessage += - std::to_string(proc.Result()->TermSignal); - } else if (exitStatus != 0) { - proc.Result()->ErrorMessage = "Process failed with return value "; - proc.Result()->ErrorMessage += - std::to_string(proc.Result()->ExitStatus); - } - } - - // Reset process handle and try to finish - proc.UVProcess_.reset(); - proc.UVTryFinish(); - } -} - -void cmQtAutoGenerator::ReadOnlyProcessT::UVTryFinish() -{ - // There still might be data in the pipes after the process has finished. - // Therefore check if the process is finished AND all pipes are closed - // before signaling the worker thread to continue. - if (UVProcess_.get() == nullptr) { - if (UVPipeOut_.uv_pipe() == nullptr) { - if (UVPipeErr_.uv_pipe() == nullptr) { - IsFinished_ = true; - FinishedCallback_(); - } - } - } -} - cmQtAutoGenerator::cmQtAutoGenerator() = default; cmQtAutoGenerator::~cmQtAutoGenerator() = default; diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h index 479d357..437fa20 100644 --- a/Source/cmQtAutoGenerator.h +++ b/Source/cmQtAutoGenerator.h @@ -7,14 +7,8 @@ #include "cmFilePathChecksum.h" #include "cmQtAutoGen.h" -#include "cmUVHandlePtr.h" -#include "cm_uv.h" -#include -#include #include -#include -#include #include #include @@ -137,102 +131,6 @@ public: cmFilePathChecksum FilePathChecksum_; }; - /// @brief Return value and output of an external process - struct ProcessResultT - { - void reset(); - bool error() const - { - return (ExitStatus != 0) || (TermSignal != 0) || !ErrorMessage.empty(); - } - - std::int64_t ExitStatus = 0; - int TermSignal = 0; - std::string StdOut; - std::string StdErr; - std::string ErrorMessage; - }; - - /// @brief External process management class - struct ReadOnlyProcessT - { - // -- Types - - /// @brief libuv pipe buffer class - class PipeT - { - public: - int init(uv_loop_t* uv_loop, ReadOnlyProcessT* process); - int startRead(std::string* target); - void reset(); - - // -- Libuv casts - uv_pipe_t* uv_pipe() { return UVPipe_.get(); } - uv_stream_t* uv_stream() - { - return reinterpret_cast(uv_pipe()); - } - uv_handle_t* uv_handle() - { - return reinterpret_cast(uv_pipe()); - } - - // -- Libuv callbacks - static void UVAlloc(uv_handle_t* handle, size_t suggestedSize, - uv_buf_t* buf); - static void UVData(uv_stream_t* stream, ssize_t nread, - const uv_buf_t* buf); - - private: - ReadOnlyProcessT* Process_ = nullptr; - std::string* Target_ = nullptr; - std::vector Buffer_; - cm::uv_pipe_ptr UVPipe_; - }; - - /// @brief Process settings - struct SetupT - { - std::string WorkingDirectory; - std::vector Command; - ProcessResultT* Result = nullptr; - bool MergedOutput = false; - }; - - // -- Const accessors - const SetupT& Setup() const { return Setup_; } - ProcessResultT* Result() const { return Setup_.Result; } - bool IsStarted() const { return IsStarted_; } - bool IsFinished() const { return IsFinished_; } - - // -- Runtime - void setup(ProcessResultT* result, bool mergedOutput, - std::vector const& command, - std::string const& workingDirectory = std::string()); - bool start(uv_loop_t* uv_loop, std::function&& finishedCallback); - - private: - // -- Friends - friend class PipeT; - // -- Libuv callbacks - static void UVExit(uv_process_t* handle, int64_t exitStatus, - int termSignal); - void UVTryFinish(); - - // -- Setup - SetupT Setup_; - // -- Runtime - bool IsStarted_ = false; - bool IsFinished_ = false; - std::function FinishedCallback_; - std::vector CommandPtr_; - std::array UVOptionsStdIO_; - uv_process_options_t UVOptions_; - cm::uv_process_ptr UVProcess_; - PipeT UVPipeOut_; - PipeT UVPipeErr_; - }; - public: // -- Constructors cmQtAutoGenerator(); diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx index ec1a1aa..80684b6 100644 --- a/Source/cmQtAutoGeneratorMocUic.cxx +++ b/Source/cmQtAutoGeneratorMocUic.cxx @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include #include @@ -153,11 +153,118 @@ bool cmQtAutoGeneratorMocUic::UicSettingsT::skipped( return (!Enabled || (SkipList.find(fileName) != SkipList.end())); } -void cmQtAutoGeneratorMocUic::JobParseT::Process(WorkerT& wrk) +void cmQtAutoGeneratorMocUic::JobT::LogError(GenT genType, + std::string const& message) const +{ + Gen()->AbortError(); + Gen()->Log().Error(genType, message); +} + +void cmQtAutoGeneratorMocUic::JobT::LogFileError( + GenT genType, std::string const& filename, std::string const& message) const +{ + Gen()->AbortError(); + Gen()->Log().ErrorFile(genType, filename, message); +} + +void cmQtAutoGeneratorMocUic::JobT::LogCommandError( + GenT genType, std::string const& message, + std::vector const& command, std::string const& output) const +{ + Gen()->AbortError(); + Gen()->Log().ErrorCommand(genType, message, command, output); +} + +bool cmQtAutoGeneratorMocUic::JobT::RunProcess( + GenT genType, cmWorkerPool::ProcessResultT& result, + std::vector const& command) +{ + // Log command + if (Log().Verbose()) { + std::string msg = "Running command:\n"; + msg += QuotedCommand(command); + msg += '\n'; + Log().Info(genType, msg); + } + return cmWorkerPool::JobT::RunProcess(result, command, + Gen()->Base().AutogenBuildDir); +} + +void cmQtAutoGeneratorMocUic::JobMocPredefsT::Process() +{ + // (Re)generate moc_predefs.h on demand + bool generate(false); + bool fileExists(FileSys().FileExists(Gen()->Moc().PredefsFileAbs)); + if (!fileExists) { + if (Log().Verbose()) { + std::string reason = "Generating "; + reason += Quoted(Gen()->Moc().PredefsFileRel); + reason += " because it doesn't exist"; + Log().Info(GenT::MOC, reason); + } + generate = true; + } else if (Gen()->Moc().SettingsChanged) { + if (Log().Verbose()) { + std::string reason = "Generating "; + reason += Quoted(Gen()->Moc().PredefsFileRel); + reason += " because the settings changed."; + Log().Info(GenT::MOC, reason); + } + generate = true; + } + if (generate) { + cmWorkerPool::ProcessResultT result; + { + // Compose command + std::vector cmd = Gen()->Moc().PredefsCmd; + // Add includes + cmd.insert(cmd.end(), Gen()->Moc().Includes.begin(), + Gen()->Moc().Includes.end()); + // Add definitions + for (std::string const& def : Gen()->Moc().Definitions) { + cmd.push_back("-D" + def); + } + // Execute command + if (!RunProcess(GenT::MOC, result, cmd)) { + std::string emsg = "The content generation command for "; + emsg += Quoted(Gen()->Moc().PredefsFileRel); + emsg += " failed.\n"; + emsg += result.ErrorMessage; + LogCommandError(GenT::MOC, emsg, cmd, result.StdOut); + } + } + + // (Re)write predefs file only on demand + if (!result.error()) { + if (!fileExists || + FileSys().FileDiffers(Gen()->Moc().PredefsFileAbs, result.StdOut)) { + if (FileSys().FileWrite(Gen()->Moc().PredefsFileAbs, result.StdOut)) { + // Success + } else { + std::string emsg = "Writing "; + emsg += Quoted(Gen()->Moc().PredefsFileRel); + emsg += " failed."; + LogFileError(GenT::MOC, Gen()->Moc().PredefsFileAbs, emsg); + } + } else { + // Touch to update the time stamp + if (Log().Verbose()) { + std::string msg = "Touching "; + msg += Quoted(Gen()->Moc().PredefsFileRel); + msg += "."; + Log().Info(GenT::MOC, msg); + } + FileSys().Touch(Gen()->Moc().PredefsFileAbs); + } + } + } +} + +void cmQtAutoGeneratorMocUic::JobParseT::Process() { if (AutoMoc && Header) { // Don't parse header for moc if the file is included by a source already - if (wrk.Gen().ParallelMocIncluded(FileName)) { + if (Gen()->ParallelMocIncluded(FileName)) { AutoMoc = false; } } @@ -165,35 +272,32 @@ void cmQtAutoGeneratorMocUic::JobParseT::Process(WorkerT& wrk) if (AutoMoc || AutoUic) { std::string error; MetaT meta; - if (wrk.FileSys().FileRead(meta.Content, FileName, &error)) { + if (FileSys().FileRead(meta.Content, FileName, &error)) { if (!meta.Content.empty()) { - meta.FileDir = wrk.FileSys().SubDirPrefix(FileName); - meta.FileBase = - wrk.FileSys().GetFilenameWithoutLastExtension(FileName); + meta.FileDir = FileSys().SubDirPrefix(FileName); + meta.FileBase = FileSys().GetFilenameWithoutLastExtension(FileName); bool success = true; if (AutoMoc) { if (Header) { - success = ParseMocHeader(wrk, meta); + success = ParseMocHeader(meta); } else { - success = ParseMocSource(wrk, meta); + success = ParseMocSource(meta); } } if (AutoUic && success) { - ParseUic(wrk, meta); + ParseUic(meta); } } else { - wrk.LogFileWarning(GenT::GEN, FileName, "The source file is empty"); + Log().WarningFile(GenT::GEN, FileName, "The source file is empty"); } } else { - wrk.LogFileError(GenT::GEN, FileName, - "Could not read the file: " + error); + LogFileError(GenT::GEN, FileName, "Could not read the file: " + error); } } } -bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk, - MetaT const& meta) +bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(MetaT const& meta) { struct JobPre { @@ -211,7 +315,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk, }; // Check if this source file contains a relevant macro - std::string const ownMacro = wrk.Moc().FindMacro(meta.Content); + std::string const ownMacro = Gen()->Moc().FindMacro(meta.Content); // Extract moc includes from file std::deque mocIncsUsc; @@ -220,11 +324,11 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk, if (meta.Content.find("moc") != std::string::npos) { const char* contentChars = meta.Content.c_str(); cmsys::RegularExpressionMatch match; - while (wrk.Moc().RegExpInclude.find(contentChars, match)) { + while (Gen()->Moc().RegExpInclude.find(contentChars, match)) { std::string incString = match.match(2); - std::string incDir(wrk.FileSys().SubDirPrefix(incString)); + std::string incDir(FileSys().SubDirPrefix(incString)); std::string incBase = - wrk.FileSys().GetFilenameWithoutLastExtension(incString); + FileSys().GetFilenameWithoutLastExtension(incString); if (cmHasLiteralPrefix(incBase, "moc_")) { // moc_.cxx // Remove the moc_ part from the base name @@ -253,10 +357,10 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk, // Process moc_.cxx includes for (const MocInclude& mocInc : mocIncsUsc) { std::string const header = - MocFindIncludedHeader(wrk, meta.FileDir, mocInc.Dir + mocInc.Base); + MocFindIncludedHeader(meta.FileDir, mocInc.Dir + mocInc.Base); if (!header.empty()) { // Check if header is skipped - if (wrk.Moc().skipped(header)) { + if (Gen()->Moc().skipped(header)) { continue; } // Register moc job @@ -271,9 +375,9 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk, std::string emsg = "The file includes the moc file "; emsg += Quoted(mocInc.Inc); emsg += ", but the header "; - emsg += Quoted(MocStringHeaders(wrk, mocInc.Base)); + emsg += Quoted(MocStringHeaders(mocInc.Base)); emsg += " could not be found."; - wrk.LogFileError(GenT::MOC, FileName, emsg); + LogFileError(GenT::MOC, FileName, emsg); } return false; } @@ -282,7 +386,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk, // Process .moc includes for (const MocInclude& mocInc : mocIncsDot) { const bool ownMoc = (mocInc.Base == meta.FileBase); - if (wrk.Moc().RelaxedMode) { + if (Gen()->Moc().RelaxedMode) { // Relaxed mode if (!ownMacro.empty() && ownMoc) { // Add self @@ -292,10 +396,10 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk, // In relaxed mode try to find a header instead but issue a warning. // This is for KDE4 compatibility std::string const header = - MocFindIncludedHeader(wrk, meta.FileDir, mocInc.Dir + mocInc.Base); + MocFindIncludedHeader(meta.FileDir, mocInc.Dir + mocInc.Base); if (!header.empty()) { // Check if header is skipped - if (wrk.Moc().skipped(header)) { + if (Gen()->Moc().skipped(header)) { continue; } // Register moc job @@ -305,14 +409,14 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk, std::string emsg = "The file includes the moc file "; emsg += Quoted(mocInc.Inc); emsg += ", but does not contain a "; - emsg += wrk.Moc().MacrosString(); + emsg += Gen()->Moc().MacrosString(); emsg += " macro.\nRunning moc on\n "; emsg += Quoted(header); emsg += "!\nBetter include "; emsg += Quoted("moc_" + mocInc.Base + ".cpp"); emsg += " for a compatibility with strict mode.\n" "(CMAKE_AUTOMOC_RELAXED_MODE warning)\n"; - wrk.LogFileWarning(GenT::MOC, FileName, emsg); + Log().WarningFile(GenT::MOC, FileName, emsg); } else { std::string emsg = "The file includes the moc file "; emsg += Quoted(mocInc.Inc); @@ -324,7 +428,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk, emsg += Quoted("moc_" + mocInc.Base + ".cpp"); emsg += " for compatibility with strict mode.\n" "(CMAKE_AUTOMOC_RELAXED_MODE warning)\n"; - wrk.LogFileWarning(GenT::MOC, FileName, emsg); + Log().WarningFile(GenT::MOC, FileName, emsg); } } } else { @@ -334,9 +438,9 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk, emsg += ", which seems to be the moc file from a different " "source file.\nCMAKE_AUTOMOC_RELAXED_MODE: Also a " "matching header "; - emsg += Quoted(MocStringHeaders(wrk, mocInc.Base)); + emsg += Quoted(MocStringHeaders(mocInc.Base)); emsg += " could not be found."; - wrk.LogFileError(GenT::MOC, FileName, emsg); + LogFileError(GenT::MOC, FileName, emsg); } return false; } @@ -352,9 +456,9 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk, std::string emsg = "The file includes the moc file "; emsg += Quoted(mocInc.Inc); emsg += ", but does not contain a "; - emsg += wrk.Moc().MacrosString(); + emsg += Gen()->Moc().MacrosString(); emsg += " macro."; - wrk.LogFileWarning(GenT::MOC, FileName, emsg); + Log().WarningFile(GenT::MOC, FileName, emsg); } } else { // Don't allow .moc include other than self in strict mode @@ -365,7 +469,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk, "source file.\nThis is not supported. Include "; emsg += Quoted(meta.FileBase + ".moc"); emsg += " to run moc on this source file."; - wrk.LogFileError(GenT::MOC, FileName, emsg); + LogFileError(GenT::MOC, FileName, emsg); } return false; } @@ -379,7 +483,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk, // foo.cpp instead of foo.h, because otherwise it won't build. // But warn, since this is not how it is supposed to be used. // This is for KDE4 compatibility. - if (wrk.Moc().RelaxedMode && ownMocUscIncluded) { + if (Gen()->Moc().RelaxedMode && ownMocUscIncluded) { JobPre uscJobPre; // Remove underscore job request { @@ -408,7 +512,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk, emsg += Quoted(meta.FileBase + ".moc"); emsg += " for compatibility with strict mode.\n" "(CMAKE_AUTOMOC_RELAXED_MODE warning)"; - wrk.LogFileWarning(GenT::MOC, FileName, emsg); + Log().WarningFile(GenT::MOC, FileName, emsg); } // Add own source job jobs.emplace_back( @@ -423,7 +527,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk, emsg += "!\nConsider to\n - add #include \""; emsg += meta.FileBase; emsg += ".moc\"\n - enable SKIP_AUTOMOC for this file"; - wrk.LogFileError(GenT::MOC, FileName, emsg); + LogFileError(GenT::MOC, FileName, emsg); } return false; } @@ -431,76 +535,80 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk, // Convert pre jobs to actual jobs for (JobPre& jobPre : jobs) { - JobHandleT jobHandle = cm::make_unique( + cmWorkerPool::JobHandleT jobHandle = cm::make_unique( std::move(jobPre.SourceFile), FileName, std::move(jobPre.IncludeString)); if (jobPre.self) { // Read dependencies from this source - static_cast(*jobHandle).FindDependencies(wrk, meta.Content); + JobMocT& jobMoc = static_cast(*jobHandle); + Gen()->Moc().FindDependencies(meta.Content, jobMoc.Depends); + jobMoc.DependsValid = true; } - if (!wrk.Gen().ParallelJobPushMoc(jobHandle)) { + if (!Gen()->ParallelJobPushMoc(std::move(jobHandle))) { return false; } } return true; } -bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocHeader(WorkerT& wrk, - MetaT const& meta) +bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocHeader(MetaT const& meta) { bool success = true; - std::string const macroName = wrk.Moc().FindMacro(meta.Content); + std::string const macroName = Gen()->Moc().FindMacro(meta.Content); if (!macroName.empty()) { - JobHandleT jobHandle = cm::make_unique( + cmWorkerPool::JobHandleT jobHandle = cm::make_unique( std::string(FileName), std::string(), std::string()); // Read dependencies from this source - static_cast(*jobHandle).FindDependencies(wrk, meta.Content); - success = wrk.Gen().ParallelJobPushMoc(jobHandle); + { + JobMocT& jobMoc = static_cast(*jobHandle); + Gen()->Moc().FindDependencies(meta.Content, jobMoc.Depends); + jobMoc.DependsValid = true; + } + success = Gen()->ParallelJobPushMoc(std::move(jobHandle)); } return success; } std::string cmQtAutoGeneratorMocUic::JobParseT::MocStringHeaders( - WorkerT& wrk, std::string const& fileBase) const + std::string const& fileBase) const { std::string res = fileBase; res += ".{"; - res += cmJoin(wrk.Base().HeaderExtensions, ","); + res += cmJoin(Gen()->Base().HeaderExtensions, ","); res += "}"; return res; } std::string cmQtAutoGeneratorMocUic::JobParseT::MocFindIncludedHeader( - WorkerT& wrk, std::string const& includerDir, std::string const& includeBase) + std::string const& includerDir, std::string const& includeBase) { std::string header; // Search in vicinity of the source - if (!wrk.Base().FindHeader(header, includerDir + includeBase)) { + if (!Gen()->Base().FindHeader(header, includerDir + includeBase)) { // Search in include directories - for (std::string const& path : wrk.Moc().IncludePaths) { + for (std::string const& path : Gen()->Moc().IncludePaths) { std::string fullPath = path; fullPath.push_back('/'); fullPath += includeBase; - if (wrk.Base().FindHeader(header, fullPath)) { + if (Gen()->Base().FindHeader(header, fullPath)) { break; } } } // Sanitize if (!header.empty()) { - header = wrk.FileSys().GetRealPath(header); + header = FileSys().GetRealPath(header); } return header; } -bool cmQtAutoGeneratorMocUic::JobParseT::ParseUic(WorkerT& wrk, - MetaT const& meta) +bool cmQtAutoGeneratorMocUic::JobParseT::ParseUic(MetaT const& meta) { bool success = true; if (meta.Content.find("ui_") != std::string::npos) { const char* contentChars = meta.Content.c_str(); cmsys::RegularExpressionMatch match; - while (wrk.Uic().RegExpInclude.find(contentChars, match)) { - if (!ParseUicInclude(wrk, meta, match.match(2))) { + while (Gen()->Uic().RegExpInclude.find(contentChars, match)) { + if (!ParseUicInclude(meta, match.match(2))) { success = false; break; } @@ -511,15 +619,15 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseUic(WorkerT& wrk, } bool cmQtAutoGeneratorMocUic::JobParseT::ParseUicInclude( - WorkerT& wrk, MetaT const& meta, std::string&& includeString) + MetaT const& meta, std::string&& includeString) { bool success = false; - std::string uiInputFile = UicFindIncludedFile(wrk, meta, includeString); + std::string uiInputFile = UicFindIncludedFile(meta, includeString); if (!uiInputFile.empty()) { - if (!wrk.Uic().skipped(uiInputFile)) { - JobHandleT jobHandle = cm::make_unique( + if (!Gen()->Uic().skipped(uiInputFile)) { + cmWorkerPool::JobHandleT jobHandle = cm::make_unique( std::move(uiInputFile), FileName, std::move(includeString)); - success = wrk.Gen().ParallelJobPushUic(jobHandle); + success = Gen()->ParallelJobPushUic(std::move(jobHandle)); } else { // A skipped file is successful success = true; @@ -529,16 +637,16 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseUicInclude( } std::string cmQtAutoGeneratorMocUic::JobParseT::UicFindIncludedFile( - WorkerT& wrk, MetaT const& meta, std::string const& includeString) + MetaT const& meta, std::string const& includeString) { std::string res; std::string searchFile = - wrk.FileSys().GetFilenameWithoutLastExtension(includeString).substr(3); + FileSys().GetFilenameWithoutLastExtension(includeString).substr(3); searchFile += ".ui"; // Collect search paths list std::deque testFiles; { - std::string const searchPath = wrk.FileSys().SubDirPrefix(includeString); + std::string const searchPath = FileSys().SubDirPrefix(includeString); std::string searchFileFull; if (!searchPath.empty()) { @@ -554,12 +662,12 @@ std::string cmQtAutoGeneratorMocUic::JobParseT::UicFindIncludedFile( } } // AUTOUIC search paths - if (!wrk.Uic().SearchPaths.empty()) { - for (std::string const& sPath : wrk.Uic().SearchPaths) { + if (!Gen()->Uic().SearchPaths.empty()) { + for (std::string const& sPath : Gen()->Uic().SearchPaths) { testFiles.push_back((sPath + "/").append(searchFile)); } if (!searchPath.empty()) { - for (std::string const& sPath : wrk.Uic().SearchPaths) { + for (std::string const& sPath : Gen()->Uic().SearchPaths) { testFiles.push_back((sPath + "/").append(searchFileFull)); } } @@ -568,8 +676,8 @@ std::string cmQtAutoGeneratorMocUic::JobParseT::UicFindIncludedFile( // Search for the .ui file! for (std::string const& testFile : testFiles) { - if (wrk.FileSys().FileExists(testFile)) { - res = wrk.FileSys().GetRealPath(testFile); + if (FileSys().FileExists(testFile)) { + res = FileSys().GetRealPath(testFile); break; } } @@ -584,162 +692,141 @@ std::string cmQtAutoGeneratorMocUic::JobParseT::UicFindIncludedFile( emsg += Quoted(testFile); emsg += "\n"; } - wrk.LogFileError(GenT::UIC, FileName, emsg); + LogFileError(GenT::UIC, FileName, emsg); } return res; } -void cmQtAutoGeneratorMocUic::JobMocPredefsT::Process(WorkerT& wrk) +void cmQtAutoGeneratorMocUic::JobPostParseT::Process() { - // (Re)generate moc_predefs.h on demand - bool generate(false); - bool fileExists(wrk.FileSys().FileExists(wrk.Moc().PredefsFileAbs)); - if (!fileExists) { - if (wrk.Log().Verbose()) { - std::string reason = "Generating "; - reason += Quoted(wrk.Moc().PredefsFileRel); - reason += " because it doesn't exist"; - wrk.LogInfo(GenT::MOC, reason); - } - generate = true; - } else if (wrk.Moc().SettingsChanged) { - if (wrk.Log().Verbose()) { - std::string reason = "Generating "; - reason += Quoted(wrk.Moc().PredefsFileRel); - reason += " because the settings changed."; - wrk.LogInfo(GenT::MOC, reason); - } - generate = true; + if (Gen()->Moc().Enabled) { + // Add mocs compilations fence job + Gen()->WorkerPool().EmplaceJob(); } - if (generate) { - ProcessResultT result; - { - // Compose command - std::vector cmd = wrk.Moc().PredefsCmd; - // Add includes - cmd.insert(cmd.end(), wrk.Moc().Includes.begin(), - wrk.Moc().Includes.end()); - // Add definitions - for (std::string const& def : wrk.Moc().Definitions) { - cmd.push_back("-D" + def); - } - // Execute command - if (!wrk.RunProcess(GenT::MOC, result, cmd)) { - std::string emsg = "The content generation command for "; - emsg += Quoted(wrk.Moc().PredefsFileRel); - emsg += " failed.\n"; - emsg += result.ErrorMessage; - wrk.LogCommandError(GenT::MOC, emsg, cmd, result.StdOut); - } + // Add finish job + Gen()->WorkerPool().EmplaceJob(); +} + +void cmQtAutoGeneratorMocUic::JobMocsCompilationT::Process() +{ + // Compose mocs compilation file content + std::string content = + "// This file is autogenerated. Changes will be overwritten.\n"; + if (Gen()->MocAutoFiles().empty()) { + // Placeholder content + content += "// No files found that require moc or the moc files are " + "included\n"; + content += "enum some_compilers { need_more_than_nothing };\n"; + } else { + // Valid content + char const sbeg = Gen()->Base().MultiConfig ? '<' : '"'; + char const send = Gen()->Base().MultiConfig ? '>' : '"'; + for (std::string const& mocfile : Gen()->MocAutoFiles()) { + content += "#include "; + content += sbeg; + content += mocfile; + content += send; + content += '\n'; } + } - // (Re)write predefs file only on demand - if (!result.error()) { - if (!fileExists || - wrk.FileSys().FileDiffers(wrk.Moc().PredefsFileAbs, result.StdOut)) { - std::string error; - if (wrk.FileSys().FileWrite(wrk.Moc().PredefsFileAbs, result.StdOut, - &error)) { - // Success - } else { - std::string emsg = "Writing "; - emsg += Quoted(wrk.Moc().PredefsFileRel); - emsg += " failed. "; - emsg += error; - wrk.LogFileError(GenT::MOC, wrk.Moc().PredefsFileAbs, emsg); - } - } else { - // Touch to update the time stamp - if (wrk.Log().Verbose()) { - std::string msg = "Touching "; - msg += Quoted(wrk.Moc().PredefsFileRel); - msg += "."; - wrk.LogInfo(GenT::MOC, msg); - } - wrk.FileSys().Touch(wrk.Moc().PredefsFileAbs); - } + std::string const& compAbs = Gen()->Moc().CompFileAbs; + if (FileSys().FileDiffers(compAbs, content)) { + // Actually write mocs compilation file + if (Log().Verbose()) { + Log().Info(GenT::MOC, "Generating MOC compilation " + compAbs); } + if (!FileSys().FileWrite(compAbs, content)) { + LogFileError(GenT::MOC, compAbs, + "mocs compilation file writing failed."); + } + } else if (Gen()->MocAutoFileUpdated()) { + // Only touch mocs compilation file + if (Log().Verbose()) { + Log().Info(GenT::MOC, "Touching mocs compilation " + compAbs); + } + FileSys().Touch(compAbs); } } void cmQtAutoGeneratorMocUic::JobMocT::FindDependencies( - WorkerT& wrk, std::string const& content) + std::string const& content) { - wrk.Moc().FindDependencies(content, Depends); + Gen()->Moc().FindDependencies(content, Depends); DependsValid = true; } -void cmQtAutoGeneratorMocUic::JobMocT::Process(WorkerT& wrk) +void cmQtAutoGeneratorMocUic::JobMocT::Process() { // Compute build file name if (!IncludeString.empty()) { - BuildFile = wrk.Base().AutogenIncludeDir; + BuildFile = Gen()->Base().AutogenIncludeDir; BuildFile += '/'; BuildFile += IncludeString; } else { // Relative build path - std::string relPath = wrk.FileSys().GetFilePathChecksum(SourceFile); + std::string relPath = FileSys().GetFilePathChecksum(SourceFile); relPath += "/moc_"; - relPath += wrk.FileSys().GetFilenameWithoutLastExtension(SourceFile); + relPath += FileSys().GetFilenameWithoutLastExtension(SourceFile); // Register relative file path with duplication check - relPath = wrk.Gen().ParallelMocAutoRegister(relPath); + relPath = Gen()->ParallelMocAutoRegister(relPath); // Absolute build path - if (wrk.Base().MultiConfig) { - BuildFile = wrk.Base().AutogenIncludeDir; + if (Gen()->Base().MultiConfig) { + BuildFile = Gen()->Base().AutogenIncludeDir; BuildFile += '/'; BuildFile += relPath; } else { - BuildFile = wrk.Base().AbsoluteBuildPath(relPath); + BuildFile = Gen()->Base().AbsoluteBuildPath(relPath); } } - if (UpdateRequired(wrk)) { - GenerateMoc(wrk); + if (UpdateRequired()) { + GenerateMoc(); } } -bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk) +bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired() { - bool const verbose = wrk.Gen().Log().Verbose(); + bool const verbose = Log().Verbose(); // Test if the build file exists - if (!wrk.FileSys().FileExists(BuildFile)) { + if (!FileSys().FileExists(BuildFile)) { if (verbose) { std::string reason = "Generating "; reason += Quoted(BuildFile); reason += " from its source file "; reason += Quoted(SourceFile); reason += " because it doesn't exist"; - wrk.LogInfo(GenT::MOC, reason); + Log().Info(GenT::MOC, reason); } return true; } // Test if any setting changed - if (wrk.Moc().SettingsChanged) { + if (Gen()->Moc().SettingsChanged) { if (verbose) { std::string reason = "Generating "; reason += Quoted(BuildFile); reason += " from "; reason += Quoted(SourceFile); reason += " because the MOC settings changed"; - wrk.LogInfo(GenT::MOC, reason); + Log().Info(GenT::MOC, reason); } return true; } // Test if the moc_predefs file is newer - if (!wrk.Moc().PredefsFileAbs.empty()) { + if (!Gen()->Moc().PredefsFileAbs.empty()) { bool isOlder = false; { std::string error; - isOlder = wrk.FileSys().FileIsOlderThan( - BuildFile, wrk.Moc().PredefsFileAbs, &error); + isOlder = FileSys().FileIsOlderThan(BuildFile, + Gen()->Moc().PredefsFileAbs, &error); if (!isOlder && !error.empty()) { - wrk.LogError(GenT::MOC, error); + LogError(GenT::MOC, error); return false; } } @@ -748,8 +835,8 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk) std::string reason = "Generating "; reason += Quoted(BuildFile); reason += " because it's older than: "; - reason += Quoted(wrk.Moc().PredefsFileAbs); - wrk.LogInfo(GenT::MOC, reason); + reason += Quoted(Gen()->Moc().PredefsFileAbs); + Log().Info(GenT::MOC, reason); } return true; } @@ -760,9 +847,9 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk) bool isOlder = false; { std::string error; - isOlder = wrk.FileSys().FileIsOlderThan(BuildFile, SourceFile, &error); + isOlder = FileSys().FileIsOlderThan(BuildFile, SourceFile, &error); if (!isOlder && !error.empty()) { - wrk.LogError(GenT::MOC, error); + LogError(GenT::MOC, error); return false; } } @@ -772,7 +859,7 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk) reason += Quoted(BuildFile); reason += " because it's older than its source file "; reason += Quoted(SourceFile); - wrk.LogInfo(GenT::MOC, reason); + Log().Info(GenT::MOC, reason); } return true; } @@ -785,7 +872,7 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk) std::string content; { std::string error; - if (!wrk.FileSys().FileRead(content, SourceFile, &error)) { + if (!FileSys().FileRead(content, SourceFile, &error)) { std::string emsg = "Could not read file\n "; emsg += Quoted(SourceFile); emsg += "\nrequired by moc include "; @@ -794,20 +881,20 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk) emsg += Quoted(IncluderFile); emsg += ".\n"; emsg += error; - wrk.LogError(GenT::MOC, emsg); + LogError(GenT::MOC, emsg); return false; } } - FindDependencies(wrk, content); + FindDependencies(content); } // Check dependency timestamps std::string error; - std::string sourceDir = wrk.FileSys().SubDirPrefix(SourceFile); + std::string sourceDir = FileSys().SubDirPrefix(SourceFile); for (std::string const& depFileRel : Depends) { std::string depFileAbs = - wrk.Moc().FindIncludedFile(sourceDir, depFileRel); + Gen()->Moc().FindIncludedFile(sourceDir, depFileRel); if (!depFileAbs.empty()) { - if (wrk.FileSys().FileIsOlderThan(BuildFile, depFileAbs, &error)) { + if (FileSys().FileIsOlderThan(BuildFile, depFileAbs, &error)) { if (verbose) { std::string reason = "Generating "; reason += Quoted(BuildFile); @@ -815,18 +902,18 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk) reason += Quoted(SourceFile); reason += " because it is older than it's dependency file "; reason += Quoted(depFileAbs); - wrk.LogInfo(GenT::MOC, reason); + Log().Info(GenT::MOC, reason); } return true; } if (!error.empty()) { - wrk.LogError(GenT::MOC, error); + LogError(GenT::MOC, error); return false; } } else { std::string message = "Could not find dependency file "; message += Quoted(depFileRel); - wrk.LogFileWarning(GenT::MOC, SourceFile, message); + Log().WarningFile(GenT::MOC, SourceFile, message); } } } @@ -834,41 +921,40 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk) return false; } -void cmQtAutoGeneratorMocUic::JobMocT::GenerateMoc(WorkerT& wrk) +void cmQtAutoGeneratorMocUic::JobMocT::GenerateMoc() { // Make sure the parent directory exists - if (!wrk.FileSys().MakeParentDirectory(BuildFile)) { - wrk.LogFileError(GenT::MOC, BuildFile, - "Could not create parent directory."); + if (!FileSys().MakeParentDirectory(BuildFile)) { + LogFileError(GenT::MOC, BuildFile, "Could not create parent directory."); return; } { // Compose moc command std::vector cmd; - cmd.push_back(wrk.Moc().Executable); + cmd.push_back(Gen()->Moc().Executable); // Add options - cmd.insert(cmd.end(), wrk.Moc().AllOptions.begin(), - wrk.Moc().AllOptions.end()); + cmd.insert(cmd.end(), Gen()->Moc().AllOptions.begin(), + Gen()->Moc().AllOptions.end()); // Add predefs include - if (!wrk.Moc().PredefsFileAbs.empty()) { + if (!Gen()->Moc().PredefsFileAbs.empty()) { cmd.emplace_back("--include"); - cmd.push_back(wrk.Moc().PredefsFileAbs); + cmd.push_back(Gen()->Moc().PredefsFileAbs); } cmd.emplace_back("-o"); cmd.push_back(BuildFile); cmd.push_back(SourceFile); // Execute moc command - ProcessResultT result; - if (wrk.RunProcess(GenT::MOC, result, cmd)) { + cmWorkerPool::ProcessResultT result; + if (RunProcess(GenT::MOC, result, cmd)) { // Moc command success // Print moc output if (!result.StdOut.empty()) { - wrk.LogInfo(GenT::MOC, result.StdOut); + Log().Info(GenT::MOC, result.StdOut); } // Notify the generator that a not included file changed (on demand) if (IncludeString.empty()) { - wrk.Gen().ParallelMocAutoUpdated(); + Gen()->ParallelMocAutoUpdated(); } } else { // Moc command failed @@ -879,51 +965,51 @@ void cmQtAutoGeneratorMocUic::JobMocT::GenerateMoc(WorkerT& wrk) emsg += Quoted(BuildFile); emsg += ".\n"; emsg += result.ErrorMessage; - wrk.LogCommandError(GenT::MOC, emsg, cmd, result.StdOut); + LogCommandError(GenT::MOC, emsg, cmd, result.StdOut); } - wrk.FileSys().FileRemove(BuildFile); + FileSys().FileRemove(BuildFile); } } } -void cmQtAutoGeneratorMocUic::JobUicT::Process(WorkerT& wrk) +void cmQtAutoGeneratorMocUic::JobUicT::Process() { // Compute build file name - BuildFile = wrk.Base().AutogenIncludeDir; + BuildFile = Gen()->Base().AutogenIncludeDir; BuildFile += '/'; BuildFile += IncludeString; - if (UpdateRequired(wrk)) { - GenerateUic(wrk); + if (UpdateRequired()) { + GenerateUic(); } } -bool cmQtAutoGeneratorMocUic::JobUicT::UpdateRequired(WorkerT& wrk) +bool cmQtAutoGeneratorMocUic::JobUicT::UpdateRequired() { - bool const verbose = wrk.Gen().Log().Verbose(); + bool const verbose = Log().Verbose(); // Test if the build file exists - if (!wrk.FileSys().FileExists(BuildFile)) { + if (!FileSys().FileExists(BuildFile)) { if (verbose) { std::string reason = "Generating "; reason += Quoted(BuildFile); reason += " from its source file "; reason += Quoted(SourceFile); reason += " because it doesn't exist"; - wrk.LogInfo(GenT::UIC, reason); + Log().Info(GenT::UIC, reason); } return true; } // Test if the uic settings changed - if (wrk.Uic().SettingsChanged) { + if (Gen()->Uic().SettingsChanged) { if (verbose) { std::string reason = "Generating "; reason += Quoted(BuildFile); reason += " from "; reason += Quoted(SourceFile); reason += " because the UIC settings changed"; - wrk.LogInfo(GenT::UIC, reason); + Log().Info(GenT::UIC, reason); } return true; } @@ -933,9 +1019,9 @@ bool cmQtAutoGeneratorMocUic::JobUicT::UpdateRequired(WorkerT& wrk) bool isOlder = false; { std::string error; - isOlder = wrk.FileSys().FileIsOlderThan(BuildFile, SourceFile, &error); + isOlder = FileSys().FileIsOlderThan(BuildFile, SourceFile, &error); if (!isOlder && !error.empty()) { - wrk.LogError(GenT::UIC, error); + LogError(GenT::UIC, error); return false; } } @@ -945,7 +1031,7 @@ bool cmQtAutoGeneratorMocUic::JobUicT::UpdateRequired(WorkerT& wrk) reason += Quoted(BuildFile); reason += " because it's older than its source file "; reason += Quoted(SourceFile); - wrk.LogInfo(GenT::UIC, reason); + Log().Info(GenT::UIC, reason); } return true; } @@ -954,37 +1040,36 @@ bool cmQtAutoGeneratorMocUic::JobUicT::UpdateRequired(WorkerT& wrk) return false; } -void cmQtAutoGeneratorMocUic::JobUicT::GenerateUic(WorkerT& wrk) +void cmQtAutoGeneratorMocUic::JobUicT::GenerateUic() { // Make sure the parent directory exists - if (!wrk.FileSys().MakeParentDirectory(BuildFile)) { - wrk.LogFileError(GenT::UIC, BuildFile, - "Could not create parent directory."); + if (!FileSys().MakeParentDirectory(BuildFile)) { + LogFileError(GenT::UIC, BuildFile, "Could not create parent directory."); return; } { // Compose uic command std::vector cmd; - cmd.push_back(wrk.Uic().Executable); + cmd.push_back(Gen()->Uic().Executable); { - std::vector allOpts = wrk.Uic().TargetOptions; - auto optionIt = wrk.Uic().Options.find(SourceFile); - if (optionIt != wrk.Uic().Options.end()) { + std::vector allOpts = Gen()->Uic().TargetOptions; + auto optionIt = Gen()->Uic().Options.find(SourceFile); + if (optionIt != Gen()->Uic().Options.end()) { UicMergeOptions(allOpts, optionIt->second, - (wrk.Base().QtVersionMajor == 5)); + (Gen()->Base().QtVersionMajor == 5)); } cmd.insert(cmd.end(), allOpts.begin(), allOpts.end()); } cmd.emplace_back("-o"); - cmd.push_back(BuildFile); - cmd.push_back(SourceFile); + cmd.emplace_back(BuildFile); + cmd.emplace_back(SourceFile); - ProcessResultT result; - if (wrk.RunProcess(GenT::UIC, result, cmd)) { + cmWorkerPool::ProcessResultT result; + if (RunProcess(GenT::UIC, result, cmd)) { // Uic command success // Print uic output if (!result.StdOut.empty()) { - wrk.LogInfo(GenT::UIC, result.StdOut); + Log().Info(GenT::UIC, result.StdOut); } } else { // Uic command failed @@ -997,144 +1082,16 @@ void cmQtAutoGeneratorMocUic::JobUicT::GenerateUic(WorkerT& wrk) emsg += Quoted(IncluderFile); emsg += ".\n"; emsg += result.ErrorMessage; - wrk.LogCommandError(GenT::UIC, emsg, cmd, result.StdOut); + LogCommandError(GenT::UIC, emsg, cmd, result.StdOut); } - wrk.FileSys().FileRemove(BuildFile); - } - } -} - -cmQtAutoGeneratorMocUic::WorkerT::WorkerT(cmQtAutoGeneratorMocUic* gen, - uv_loop_t* uvLoop) - : Gen_(gen) -{ - // Initialize uv asynchronous callback for process starting - ProcessRequest_.init(*uvLoop, &WorkerT::UVProcessStart, this); - // Start thread - Thread_ = std::thread(&WorkerT::Loop, this); -} - -cmQtAutoGeneratorMocUic::WorkerT::~WorkerT() -{ - // Join thread - if (Thread_.joinable()) { - Thread_.join(); - } -} - -void cmQtAutoGeneratorMocUic::WorkerT::LogInfo( - GenT genType, std::string const& message) const -{ - Log().Info(genType, message); -} - -void cmQtAutoGeneratorMocUic::WorkerT::LogWarning( - GenT genType, std::string const& message) const -{ - Log().Warning(genType, message); -} - -void cmQtAutoGeneratorMocUic::WorkerT::LogFileWarning( - GenT genType, std::string const& filename, std::string const& message) const -{ - Log().WarningFile(genType, filename, message); -} - -void cmQtAutoGeneratorMocUic::WorkerT::LogError( - GenT genType, std::string const& message) const -{ - Gen().ParallelRegisterJobError(); - Log().Error(genType, message); -} - -void cmQtAutoGeneratorMocUic::WorkerT::LogFileError( - GenT genType, std::string const& filename, std::string const& message) const -{ - Gen().ParallelRegisterJobError(); - Log().ErrorFile(genType, filename, message); -} - -void cmQtAutoGeneratorMocUic::WorkerT::LogCommandError( - GenT genType, std::string const& message, - std::vector const& command, std::string const& output) const -{ - Gen().ParallelRegisterJobError(); - Log().ErrorCommand(genType, message, command, output); -} - -bool cmQtAutoGeneratorMocUic::WorkerT::RunProcess( - GenT genType, ProcessResultT& result, - std::vector const& command) -{ - if (command.empty()) { - return false; - } - - // Create process instance - { - std::lock_guard lock(ProcessMutex_); - Process_ = cm::make_unique(); - Process_->setup(&result, true, command, Gen().Base().AutogenBuildDir); - } - - // Send asynchronous process start request to libuv loop - ProcessRequest_.send(); - - // Log command - if (this->Log().Verbose()) { - std::string msg = "Running command:\n"; - msg += QuotedCommand(command); - msg += '\n'; - this->LogInfo(genType, msg); - } - - // Wait until the process has been finished and destroyed - { - std::unique_lock ulock(ProcessMutex_); - while (Process_) { - ProcessCondition_.wait(ulock); + FileSys().FileRemove(BuildFile); } } - return !result.error(); } -void cmQtAutoGeneratorMocUic::WorkerT::Loop() +void cmQtAutoGeneratorMocUic::JobFinishT::Process() { - while (true) { - Gen().WorkerSwapJob(JobHandle_); - if (JobHandle_) { - JobHandle_->Process(*this); - } else { - break; - } - } -} - -void cmQtAutoGeneratorMocUic::WorkerT::UVProcessStart(uv_async_t* handle) -{ - auto& wrk = *reinterpret_cast(handle->data); - { - std::lock_guard lock(wrk.ProcessMutex_); - if (wrk.Process_ && !wrk.Process_->IsStarted()) { - wrk.Process_->start(handle->loop, [&wrk] { wrk.UVProcessFinished(); }); - } - } - - if (!wrk.Process_->IsStarted()) { - wrk.UVProcessFinished(); - } -} - -void cmQtAutoGeneratorMocUic::WorkerT::UVProcessFinished() -{ - { - std::lock_guard lock(ProcessMutex_); - if (Process_ && (Process_->IsFinished() || !Process_->IsStarted())) { - Process_.reset(); - } - } - // Notify idling thread - ProcessCondition_.notify_one(); + Gen()->AbortSuccess(); } cmQtAutoGeneratorMocUic::cmQtAutoGeneratorMocUic() @@ -1147,24 +1104,9 @@ cmQtAutoGeneratorMocUic::cmQtAutoGeneratorMocUic() "[\"<](([^ \">]+/)?moc_[^ \">/]+\\.cpp|[^ \">]+\\.moc)[\">]"); Uic_.RegExpInclude.compile("(^|\n)[ \t]*#[ \t]*include[ \t]+" "[\"<](([^ \">]+/)?ui_[^ \">/]+\\.h)[\">]"); - - // Initialize libuv loop - uv_disable_stdio_inheritance(); -#ifdef CMAKE_UV_SIGNAL_HACK - UVHackRAII_ = cm::make_unique(); -#endif - UVLoop_ = cm::make_unique(); - uv_loop_init(UVLoop()); - - // Initialize libuv asynchronous iteration request - UVRequest().init(*UVLoop(), &cmQtAutoGeneratorMocUic::UVPollStage, this); } -cmQtAutoGeneratorMocUic::~cmQtAutoGeneratorMocUic() -{ - // Close libuv loop - uv_loop_close(UVLoop()); -} +cmQtAutoGeneratorMocUic::~cmQtAutoGeneratorMocUic() = default; bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile) { @@ -1364,7 +1306,7 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile) Moc_.PredefsCmd = InfoGetList("AM_MOC_PREDEFS_CMD"); // Install moc predefs job if (!Moc().PredefsCmd.empty()) { - JobQueues_.MocPredefs.emplace_back(cm::make_unique()); + WorkerPool().EmplaceJob(); } } @@ -1400,46 +1342,48 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile) } // - Headers and sources + // Add sources { - auto addHeader = [this](std::string&& hdr, bool moc, bool uic) { - this->JobQueues_.Headers.emplace_back( - cm::make_unique(std::move(hdr), moc, uic, true)); - }; auto addSource = [this](std::string&& src, bool moc, bool uic) { - this->JobQueues_.Sources.emplace_back( - cm::make_unique(std::move(src), moc, uic, false)); + WorkerPool().EmplaceJob(std::move(src), moc, uic, false); }; - - // Add headers - for (std::string& hdr : InfoGetList("AM_HEADERS")) { - addHeader(std::move(hdr), true, true); + for (std::string& src : InfoGetList("AM_SOURCES")) { + addSource(std::move(src), true, true); } if (Moc().Enabled) { - for (std::string& hdr : InfoGetList("AM_MOC_HEADERS")) { - addHeader(std::move(hdr), true, false); + for (std::string& src : InfoGetList("AM_MOC_SOURCES")) { + addSource(std::move(src), true, false); } } if (Uic().Enabled) { - for (std::string& hdr : InfoGetList("AM_UIC_HEADERS")) { - addHeader(std::move(hdr), false, true); + for (std::string& src : InfoGetList("AM_UIC_SOURCES")) { + addSource(std::move(src), false, true); } } - - // Add sources - for (std::string& src : InfoGetList("AM_SOURCES")) { - addSource(std::move(src), true, true); + } + // Add Fence job + WorkerPool().EmplaceJob(); + // Add headers + { + auto addHeader = [this](std::string&& hdr, bool moc, bool uic) { + WorkerPool().EmplaceJob(std::move(hdr), moc, uic, true); + }; + for (std::string& hdr : InfoGetList("AM_HEADERS")) { + addHeader(std::move(hdr), true, true); } if (Moc().Enabled) { - for (std::string& src : InfoGetList("AM_MOC_SOURCES")) { - addSource(std::move(src), true, false); + for (std::string& hdr : InfoGetList("AM_MOC_HEADERS")) { + addHeader(std::move(hdr), true, false); } } if (Uic().Enabled) { - for (std::string& src : InfoGetList("AM_UIC_SOURCES")) { - addSource(std::move(src), false, true); + for (std::string& hdr : InfoGetList("AM_UIC_HEADERS")) { + addHeader(std::move(hdr), false, true); } } } + // Addpost parse fence job + WorkerPool().EmplaceJob(); // Init derived information // ------------------------ @@ -1536,93 +1480,20 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile) bool cmQtAutoGeneratorMocUic::Process() { - // Run libuv event loop - UVRequest().send(); - if (uv_run(UVLoop(), UV_RUN_DEFAULT) == 0) { - if (JobError_) { - return false; - } - } else { + SettingsFileRead(); + if (!CreateDirectories()) { return false; } - return true; -} - -void cmQtAutoGeneratorMocUic::UVPollStage(uv_async_t* handle) -{ - reinterpret_cast(handle->data)->PollStage(); -} -void cmQtAutoGeneratorMocUic::PollStage() -{ - switch (Stage_) { - case StageT::SETTINGS_READ: - SettingsFileRead(); - SetStage(StageT::CREATE_DIRECTORIES); - break; - case StageT::CREATE_DIRECTORIES: - CreateDirectories(); - SetStage(StageT::PARSE_SOURCES); - break; - case StageT::PARSE_SOURCES: - if (ThreadsStartJobs(JobQueues_.Sources)) { - SetStage(StageT::PARSE_HEADERS); - } - break; - case StageT::PARSE_HEADERS: - if (ThreadsStartJobs(JobQueues_.Headers)) { - SetStage(StageT::MOC_PREDEFS); - } - break; - case StageT::MOC_PREDEFS: - if (ThreadsStartJobs(JobQueues_.MocPredefs)) { - SetStage(StageT::MOC_PROCESS); - } - break; - case StageT::MOC_PROCESS: - if (ThreadsStartJobs(JobQueues_.Moc)) { - SetStage(StageT::MOCS_COMPILATION); - } - break; - case StageT::MOCS_COMPILATION: - if (ThreadsJobsDone()) { - MocGenerateCompilation(); - SetStage(StageT::UIC_PROCESS); - } - break; - case StageT::UIC_PROCESS: - if (ThreadsStartJobs(JobQueues_.Uic)) { - SetStage(StageT::SETTINGS_WRITE); - } - break; - case StageT::SETTINGS_WRITE: - SettingsFileWrite(); - SetStage(StageT::FINISH); - break; - case StageT::FINISH: - if (ThreadsJobsDone()) { - // Clear all libuv handles - ThreadsStop(); - UVRequest().reset(); - // Set highest END stage manually - Stage_ = StageT::END; - } - break; - case StageT::END: - break; + if (!WorkerPool_.Process(Base().NumThreads, this)) { + return false; } -} -void cmQtAutoGeneratorMocUic::SetStage(StageT stage) -{ if (JobError_) { - stage = StageT::FINISH; - } - // Only allow to increase the stage - if (Stage_ < stage) { - Stage_ = stage; - UVRequest().send(); + return false; } + + return SettingsFileWrite(); } void cmQtAutoGeneratorMocUic::SettingsFileRead() @@ -1691,11 +1562,10 @@ void cmQtAutoGeneratorMocUic::SettingsFileRead() } } -void cmQtAutoGeneratorMocUic::SettingsFileWrite() +bool cmQtAutoGeneratorMocUic::SettingsFileWrite() { - std::lock_guard jobsLock(JobsMutex_); // Only write if any setting changed - if (!JobError_ && (Moc().SettingsChanged || Uic().SettingsChanged)) { + if (Moc().SettingsChanged || Uic().SettingsChanged) { if (Log().Verbose()) { Log().Info(GenT::GEN, "Writing settings file " + Quoted(SettingsFile_)); } @@ -1721,246 +1591,136 @@ void cmQtAutoGeneratorMocUic::SettingsFileWrite() "Settings file writing failed. " + error); // Remove old settings file to trigger a full rebuild on the next run FileSys().FileRemove(SettingsFile_); - RegisterJobError(); + return false; } } + return true; } -void cmQtAutoGeneratorMocUic::CreateDirectories() +bool cmQtAutoGeneratorMocUic::CreateDirectories() { // Create AUTOGEN include directory if (!FileSys().MakeDirectory(Base().AutogenIncludeDir)) { Log().ErrorFile(GenT::GEN, Base().AutogenIncludeDir, "Could not create directory."); - RegisterJobError(); + return false; } + return true; } -bool cmQtAutoGeneratorMocUic::ThreadsStartJobs(JobQueueT& queue) +// Private method that requires cmQtAutoGeneratorMocUic::JobsMutex_ to be +// locked +void cmQtAutoGeneratorMocUic::Abort(bool error) { - bool done = false; - std::size_t queueSize = queue.size(); - - // Change the active queue - { - std::lock_guard jobsLock(JobsMutex_); - // Check if there are still unfinished jobs from the previous queue - if (JobsRemain_ == 0) { - if (!JobThreadsAbort_) { - JobQueue_.swap(queue); - JobsRemain_ = queueSize; - } else { - // Abort requested - queue.clear(); - queueSize = 0; - } - done = true; - } + if (error) { + JobError_.store(true); } + WorkerPool_.Abort(); +} - if (done && (queueSize != 0)) { - // Start new threads on demand - if (Workers_.empty()) { - Workers_.resize(Base().NumThreads); - for (auto& item : Workers_) { - item = cm::make_unique(this, UVLoop()); +bool cmQtAutoGeneratorMocUic::ParallelJobPushMoc( + cmWorkerPool::JobHandleT&& jobHandle) +{ + JobMocT const& mocJob(static_cast(*jobHandle)); + // Do additional tests if this is an included moc job + if (!mocJob.IncludeString.empty()) { + std::lock_guard guard(MocMetaMutex_); + // Register included moc file + MocIncludedFiles_.emplace(mocJob.SourceFile); + + // Check if the same moc file would be generated from a different + // source file. + auto const range = MocIncludes_.equal_range(mocJob.IncludeString); + for (auto it = range.first; it != range.second; ++it) { + if (it->second[0] == mocJob.SourceFile) { + // The output file already gets generated + return true; } - } else { - // Notify threads - if (queueSize == 1) { - JobsConditionRead_.notify_one(); - } else { - JobsConditionRead_.notify_all(); + { + // The output file already gets generated - from a different source + // file! + std::string error = "The two source files\n "; + error += Quoted(mocJob.IncluderFile); + error += " and\n "; + error += Quoted(it->second[1]); + error += "\ncontain the same moc include string "; + error += Quoted(mocJob.IncludeString); + error += "\nbut the moc file would be generated from different " + "source files\n "; + error += Quoted(mocJob.SourceFile); + error += " and\n "; + error += Quoted(it->second[0]); + error += ".\nConsider to\n" + "- not include the \"moc_.cpp\" file\n" + "- add a directory prefix to a \".moc\" include " + "(e.g \"sub/.moc\")\n" + "- rename the source file(s)\n"; + Log().Error(GenT::MOC, error); + AbortError(); + return false; } } - } - - return done; -} -void cmQtAutoGeneratorMocUic::ThreadsStop() -{ - if (!Workers_.empty()) { - // Clear all jobs - { - std::lock_guard jobsLock(JobsMutex_); - JobThreadsAbort_ = true; - JobsRemain_ -= JobQueue_.size(); - JobQueue_.clear(); - - JobQueues_.Sources.clear(); - JobQueues_.Headers.clear(); - JobQueues_.MocPredefs.clear(); - JobQueues_.Moc.clear(); - JobQueues_.Uic.clear(); - } - // Wake threads - JobsConditionRead_.notify_all(); - // Join and clear threads - Workers_.clear(); + // We're still here so register this job + MocIncludes_.emplace_hint(range.first, mocJob.IncludeString, + std::array{ + { mocJob.SourceFile, mocJob.IncluderFile } }); } + return WorkerPool_.PushJob(std::move(jobHandle)); } -bool cmQtAutoGeneratorMocUic::ThreadsJobsDone() +bool cmQtAutoGeneratorMocUic::ParallelJobPushUic( + cmWorkerPool::JobHandleT&& jobHandle) { - std::lock_guard jobsLock(JobsMutex_); - return (JobsRemain_ == 0); -} - -void cmQtAutoGeneratorMocUic::WorkerSwapJob(JobHandleT& jobHandle) -{ - bool const jobProcessed(jobHandle); - if (jobProcessed) { - jobHandle.reset(); - } + const JobUicT& uicJob(static_cast(*jobHandle)); { - std::unique_lock jobsLock(JobsMutex_); - // Reduce the remaining job count and notify the libuv loop - // when all jobs are done - if (jobProcessed) { - --JobsRemain_; - if (JobsRemain_ == 0) { - UVRequest().send(); + std::lock_guard guard(UicMetaMutex_); + // Check if the same uic file would be generated from a different + // source file. + auto const range = UicIncludes_.equal_range(uicJob.IncludeString); + for (auto it = range.first; it != range.second; ++it) { + if (it->second[0] == uicJob.SourceFile) { + // The output file already gets generated + return true; } - } - // Wait for new jobs - while (!JobThreadsAbort_ && JobQueue_.empty()) { - JobsConditionRead_.wait(jobsLock); - } - // Try to pick up a new job handle - if (!JobThreadsAbort_ && !JobQueue_.empty()) { - jobHandle = std::move(JobQueue_.front()); - JobQueue_.pop_front(); - } - } -} - -void cmQtAutoGeneratorMocUic::ParallelRegisterJobError() -{ - std::lock_guard jobsLock(JobsMutex_); - RegisterJobError(); -} - -// Private method that requires cmQtAutoGeneratorMocUic::JobsMutex_ to be -// locked -void cmQtAutoGeneratorMocUic::RegisterJobError() -{ - JobError_ = true; - if (!JobThreadsAbort_) { - JobThreadsAbort_ = true; - // Clear remaining jobs - if (JobsRemain_ != 0) { - JobsRemain_ -= JobQueue_.size(); - JobQueue_.clear(); - } - } -} - -bool cmQtAutoGeneratorMocUic::ParallelJobPushMoc(JobHandleT& jobHandle) -{ - std::lock_guard jobsLock(JobsMutex_); - if (!JobThreadsAbort_) { - bool pushJobHandle = true; - // Do additional tests if this is an included moc job - const JobMocT& mocJob(static_cast(*jobHandle)); - if (!mocJob.IncludeString.empty()) { - // Register included moc file and look for collisions - MocIncludedFiles_.emplace(mocJob.SourceFile); - if (!MocIncludedStrings_.emplace(mocJob.IncludeString).second) { - // Another source file includes the same moc file! - for (const JobHandleT& otherHandle : JobQueues_.Moc) { - const JobMocT& otherJob(static_cast(*otherHandle)); - if (otherJob.IncludeString == mocJob.IncludeString) { - // Check if the same moc file would be generated from different - // source files which is an error. - if (otherJob.SourceFile != mocJob.SourceFile) { - // Include string collision - std::string error = "The two source files\n "; - error += Quoted(mocJob.IncluderFile); - error += " and\n "; - error += Quoted(otherJob.IncluderFile); - error += "\ncontain the same moc include string "; - error += Quoted(mocJob.IncludeString); - error += "\nbut the moc file would be generated from different " - "source files\n "; - error += Quoted(mocJob.SourceFile); - error += " and\n "; - error += Quoted(otherJob.SourceFile); - error += ".\nConsider to\n" - "- not include the \"moc_.cpp\" file\n" - "- add a directory prefix to a \".moc\" include " - "(e.g \"sub/.moc\")\n" - "- rename the source file(s)\n"; - Log().Error(GenT::MOC, error); - RegisterJobError(); - } - // Do not push this job in since the included moc file already - // gets generated by an other job. - pushJobHandle = false; - break; - } - } + { + // The output file already gets generated - from a different .ui + // file! + std::string error = "The two source files\n "; + error += Quoted(uicJob.IncluderFile); + error += " and\n "; + error += Quoted(it->second[1]); + error += "\ncontain the same uic include string "; + error += Quoted(uicJob.IncludeString); + error += "\nbut the uic file would be generated from different " + "source files\n "; + error += Quoted(uicJob.SourceFile); + error += " and\n "; + error += Quoted(it->second[0]); + error += + ".\nConsider to\n" + "- add a directory prefix to a \"ui_.h\" include " + "(e.g \"sub/ui_.h\")\n" + "- rename the .ui file(s) and adjust the \"ui_.h\" " + "include(s)\n"; + Log().Error(GenT::UIC, error); + AbortError(); + return false; } } - // Push job on demand - if (pushJobHandle) { - JobQueues_.Moc.emplace_back(std::move(jobHandle)); - } - } - return !JobError_; -} -bool cmQtAutoGeneratorMocUic::ParallelJobPushUic(JobHandleT& jobHandle) -{ - std::lock_guard jobsLock(JobsMutex_); - if (!JobThreadsAbort_) { - bool pushJobHandle = true; - // Look for include collisions. - const JobUicT& uicJob(static_cast(*jobHandle)); - for (const JobHandleT& otherHandle : JobQueues_.Uic) { - const JobUicT& otherJob(static_cast(*otherHandle)); - if (otherJob.IncludeString == uicJob.IncludeString) { - // Check if the same uic file would be generated from different - // source files which would be an error. - if (otherJob.SourceFile != uicJob.SourceFile) { - // Include string collision - std::string error = "The two source files\n "; - error += Quoted(uicJob.IncluderFile); - error += " and\n "; - error += Quoted(otherJob.IncluderFile); - error += "\ncontain the same uic include string "; - error += Quoted(uicJob.IncludeString); - error += "\nbut the uic file would be generated from different " - "source files\n "; - error += Quoted(uicJob.SourceFile); - error += " and\n "; - error += Quoted(otherJob.SourceFile); - error += - ".\nConsider to\n" - "- add a directory prefix to a \"ui_.h\" include " - "(e.g \"sub/ui_.h\")\n" - "- rename the .ui file(s) and adjust the \"ui_.h\" " - "include(s)\n"; - Log().Error(GenT::UIC, error); - RegisterJobError(); - } - // Do not push this job in since the uic file already - // gets generated by an other job. - pushJobHandle = false; - break; - } - } - if (pushJobHandle) { - JobQueues_.Uic.emplace_back(std::move(jobHandle)); - } + // We're still here so register this job + UicIncludes_.emplace_hint(range.first, uicJob.IncludeString, + std::array{ + { uicJob.SourceFile, uicJob.IncluderFile } }); } - return !JobError_; + return WorkerPool_.PushJob(std::move(jobHandle)); } bool cmQtAutoGeneratorMocUic::ParallelMocIncluded( std::string const& sourceFile) { - std::lock_guard mocLock(JobsMutex_); + std::lock_guard guard(MocMetaMutex_); return (MocIncludedFiles_.find(sourceFile) != MocIncludedFiles_.end()); } @@ -1969,7 +1729,7 @@ std::string cmQtAutoGeneratorMocUic::ParallelMocAutoRegister( { std::string res; { - std::lock_guard mocLock(JobsMutex_); + std::lock_guard mocLock(MocMetaMutex_); res = baseName; res += ".cpp"; if (MocAutoFiles_.find(res) == MocAutoFiles_.end()) { @@ -1990,63 +1750,3 @@ std::string cmQtAutoGeneratorMocUic::ParallelMocAutoRegister( } return res; } - -void cmQtAutoGeneratorMocUic::ParallelMocAutoUpdated() -{ - std::lock_guard mocLock(JobsMutex_); - MocAutoFileUpdated_ = true; -} - -void cmQtAutoGeneratorMocUic::MocGenerateCompilation() -{ - std::lock_guard mocLock(JobsMutex_); - if (!JobError_ && Moc().Enabled) { - // Write mocs compilation build file - { - // Compose mocs compilation file content - std::string content = - "// This file is autogenerated. Changes will be overwritten.\n"; - if (MocAutoFiles_.empty()) { - // Placeholder content - content += "// No files found that require moc or the moc files are " - "included\n"; - content += "enum some_compilers { need_more_than_nothing };\n"; - } else { - // Valid content - char const sbeg = Base().MultiConfig ? '<' : '"'; - char const send = Base().MultiConfig ? '>' : '"'; - for (std::string const& mocfile : MocAutoFiles_) { - content += "#include "; - content += sbeg; - content += mocfile; - content += send; - content += '\n'; - } - } - - std::string const& compAbs = Moc().CompFileAbs; - if (FileSys().FileDiffers(compAbs, content)) { - // Actually write mocs compilation file - if (Log().Verbose()) { - Log().Info(GenT::MOC, "Generating MOC compilation " + compAbs); - } - std::string error; - if (!FileSys().FileWrite(compAbs, content, &error)) { - Log().ErrorFile(GenT::MOC, compAbs, - "mocs compilation file writing failed. " + error); - RegisterJobError(); - return; - } - } else if (MocAutoFileUpdated_) { - // Only touch mocs compilation file - if (Log().Verbose()) { - Log().Info(GenT::MOC, "Touching mocs compilation " + compAbs); - } - FileSys().Touch(compAbs); - } - } - // Write mocs compilation wrapper file - if (Base().MultiConfig) { - } - } -} diff --git a/Source/cmQtAutoGeneratorMocUic.h b/Source/cmQtAutoGeneratorMocUic.h index 27d73a7..4efc2c6 100644 --- a/Source/cmQtAutoGeneratorMocUic.h +++ b/Source/cmQtAutoGeneratorMocUic.h @@ -7,20 +7,16 @@ #include "cmQtAutoGen.h" #include "cmQtAutoGenerator.h" -#include "cmUVHandlePtr.h" -#include "cmUVSignalHackRAII.h" // IWYU pragma: keep -#include "cm_uv.h" +#include "cmWorkerPool.h" #include "cmsys/RegularExpression.hxx" -#include -#include -#include +#include +#include #include #include // IWYU pragma: keep #include #include #include -#include #include #include #include @@ -39,7 +35,7 @@ public: public: // -- Types - class WorkerT; + typedef std::multimap> IncludesMap; /// @brief Search key plus regular expression pair /// @@ -173,31 +169,71 @@ public: cmsys::RegularExpression RegExpInclude; }; - /// @brief Abstract job class for threaded processing + /// @brief Abstract job class for concurrent job processing /// - class JobT + class JobT : public cmWorkerPool::JobT { - public: - JobT() = default; - virtual ~JobT() = default; + protected: + /** + * @brief Protected default constructor + */ + JobT(bool fence = false) + : cmWorkerPool::JobT(fence) + { + } + + //! Get the generator. Only valid during Process() call! + cmQtAutoGeneratorMocUic* Gen() const + { + return static_cast(UserData()); + }; + + //! Get the file system interface. Only valid during Process() call! + FileSystem& FileSys() { return Gen()->FileSys(); } + //! Get the logger. Only valid during Process() call! + Logger& Log() { return Gen()->Log(); } + + // -- Error logging with automatic abort + void LogError(GenT genType, std::string const& message) const; + void LogFileError(GenT genType, std::string const& filename, + std::string const& message) const; + void LogCommandError(GenT genType, std::string const& message, + std::vector const& command, + std::string const& output) const; - JobT(JobT const&) = delete; - JobT& operator=(JobT const&) = delete; + /** + * @brief Run an external process. Use only during Process() call! + */ + bool RunProcess(GenT genType, cmWorkerPool::ProcessResultT& result, + std::vector const& command); + }; - // -- Abstract processing interface - virtual void Process(WorkerT& wrk) = 0; + /// @brief Fence job utility class + /// + class JobFenceT : public JobT + { + public: + JobFenceT() + : JobT(true) + { + } + void Process() override{}; }; - // Job management types - typedef std::unique_ptr JobHandleT; - typedef std::deque JobQueueT; + /// @brief Generate moc_predefs.h + /// + class JobMocPredefsT : public JobT + { + private: + void Process() override; + }; - /// @brief Parse source job + /// @brief Parses a source file /// class JobParseT : public JobT { public: - JobParseT(std::string&& fileName, bool moc, bool uic, bool header = false) + JobParseT(std::string fileName, bool moc, bool uic, bool header = false) : FileName(std::move(fileName)) , AutoMoc(moc) , AutoUic(uic) @@ -213,18 +249,15 @@ public: std::string FileBase; }; - void Process(WorkerT& wrk) override; - bool ParseMocSource(WorkerT& wrk, MetaT const& meta); - bool ParseMocHeader(WorkerT& wrk, MetaT const& meta); - std::string MocStringHeaders(WorkerT& wrk, - std::string const& fileBase) const; - std::string MocFindIncludedHeader(WorkerT& wrk, - std::string const& includerDir, + void Process() override; + bool ParseMocSource(MetaT const& meta); + bool ParseMocHeader(MetaT const& meta); + std::string MocStringHeaders(std::string const& fileBase) const; + std::string MocFindIncludedHeader(std::string const& includerDir, std::string const& includeBase); - bool ParseUic(WorkerT& wrk, MetaT const& meta); - bool ParseUicInclude(WorkerT& wrk, MetaT const& meta, - std::string&& includeString); - std::string UicFindIncludedFile(WorkerT& wrk, MetaT const& meta, + bool ParseUic(MetaT const& meta); + bool ParseUicInclude(MetaT const& meta, std::string&& includeString); + std::string UicFindIncludedFile(MetaT const& meta, std::string const& includeString); private: @@ -234,12 +267,20 @@ public: bool Header = false; }; - /// @brief Generate moc_predefs + /// @brief Generates additional jobs after all files have been parsed /// - class JobMocPredefsT : public JobT + class JobPostParseT : public JobFenceT { private: - void Process(WorkerT& wrk) override; + void Process() override; + }; + + /// @brief Generate mocs_compilation.cpp + /// + class JobMocsCompilationT : public JobFenceT + { + private: + void Process() override; }; /// @brief Moc a file job @@ -247,20 +288,20 @@ public: class JobMocT : public JobT { public: - JobMocT(std::string&& sourceFile, std::string includerFile, - std::string&& includeString) + JobMocT(std::string sourceFile, std::string includerFile, + std::string includeString) : SourceFile(std::move(sourceFile)) , IncluderFile(std::move(includerFile)) , IncludeString(std::move(includeString)) { } - void FindDependencies(WorkerT& wrk, std::string const& content); + void FindDependencies(std::string const& content); private: - void Process(WorkerT& wrk) override; - bool UpdateRequired(WorkerT& wrk); - void GenerateMoc(WorkerT& wrk); + void Process() override; + bool UpdateRequired(); + void GenerateMoc(); public: std::string SourceFile; @@ -276,8 +317,8 @@ public: class JobUicT : public JobT { public: - JobUicT(std::string&& sourceFile, std::string includerFile, - std::string&& includeString) + JobUicT(std::string sourceFile, std::string includerFile, + std::string includeString) : SourceFile(std::move(sourceFile)) , IncluderFile(std::move(includerFile)) , IncludeString(std::move(includeString)) @@ -285,9 +326,9 @@ public: } private: - void Process(WorkerT& wrk) override; - bool UpdateRequired(WorkerT& wrk); - void GenerateUic(WorkerT& wrk); + void Process() override; + bool UpdateRequired(); + void GenerateUic(); public: std::string SourceFile; @@ -296,80 +337,12 @@ public: std::string BuildFile; }; - /// @brief Worker Thread + /// @brief The last job /// - class WorkerT + class JobFinishT : public JobFenceT { - public: - WorkerT(cmQtAutoGeneratorMocUic* gen, uv_loop_t* uvLoop); - ~WorkerT(); - - WorkerT(WorkerT const&) = delete; - WorkerT& operator=(WorkerT const&) = delete; - - // -- Const accessors - cmQtAutoGeneratorMocUic& Gen() const { return *Gen_; } - Logger& Log() const { return Gen_->Log(); } - FileSystem& FileSys() const { return Gen_->FileSys(); } - const BaseSettingsT& Base() const { return Gen_->Base(); } - const MocSettingsT& Moc() const { return Gen_->Moc(); } - const UicSettingsT& Uic() const { return Gen_->Uic(); } - - // -- Log info - void LogInfo(GenT genType, std::string const& message) const; - // -- Log warning - void LogWarning(GenT genType, std::string const& message) const; - void LogFileWarning(GenT genType, std::string const& filename, - std::string const& message) const; - // -- Log error - void LogError(GenT genType, std::string const& message) const; - void LogFileError(GenT genType, std::string const& filename, - std::string const& message) const; - void LogCommandError(GenT genType, std::string const& message, - std::vector const& command, - std::string const& output) const; - - // -- External processes - /// @brief Verbose logging version - bool RunProcess(GenT genType, ProcessResultT& result, - std::vector const& command); - private: - /// @brief Thread main loop - void Loop(); - - // -- Libuv callbacks - static void UVProcessStart(uv_async_t* handle); - void UVProcessFinished(); - - private: - // -- Generator - cmQtAutoGeneratorMocUic* Gen_; - // -- Job handle - JobHandleT JobHandle_; - // -- Process management - std::mutex ProcessMutex_; - cm::uv_async_ptr ProcessRequest_; - std::condition_variable ProcessCondition_; - std::unique_ptr Process_; - // -- System thread - std::thread Thread_; - }; - - /// @brief Processing stage - enum class StageT - { - SETTINGS_READ, - CREATE_DIRECTORIES, - PARSE_SOURCES, - PARSE_HEADERS, - MOC_PREDEFS, - MOC_PROCESS, - MOCS_COMPILATION, - UIC_PROCESS, - SETTINGS_WRITE, - FINISH, - END + void Process() override; }; // -- Const settings interface @@ -377,41 +350,39 @@ public: const MocSettingsT& Moc() const { return this->Moc_; } const UicSettingsT& Uic() const { return this->Uic_; } - // -- Worker thread interface - void WorkerSwapJob(JobHandleT& jobHandle); // -- Parallel job processing interface - void ParallelRegisterJobError(); - bool ParallelJobPushMoc(JobHandleT& jobHandle); - bool ParallelJobPushUic(JobHandleT& jobHandle); - bool ParallelMocIncluded(std::string const& sourceFile); + cmWorkerPool& WorkerPool() { return WorkerPool_; } + void AbortError() { Abort(true); } + void AbortSuccess() { Abort(false); } + bool ParallelJobPushMoc(cmWorkerPool::JobHandleT&& jobHandle); + bool ParallelJobPushUic(cmWorkerPool::JobHandleT&& jobHandle); + + // -- Mocs compilation include file updated flag + void ParallelMocAutoUpdated() { MocAutoFileUpdated_.store(true); } + bool MocAutoFileUpdated() const { return MocAutoFileUpdated_.load(); } + + // -- Mocs compilation file register std::string ParallelMocAutoRegister(std::string const& baseName); - void ParallelMocAutoUpdated(); + bool ParallelMocIncluded(std::string const& sourceFile); + std::set const& MocAutoFiles() const + { + return this->MocAutoFiles_; + } private: // -- Utility accessors Logger& Log() { return Logger_; } FileSystem& FileSys() { return FileSys_; } - // -- libuv loop accessors - uv_loop_t* UVLoop() { return UVLoop_.get(); } - cm::uv_async_ptr& UVRequest() { return UVRequest_; } // -- Abstract processing interface bool Init(cmMakefile* makefile) override; bool Process() override; - // -- Process stage - static void UVPollStage(uv_async_t* handle); - void PollStage(); - void SetStage(StageT stage); // -- Settings file void SettingsFileRead(); - void SettingsFileWrite(); + bool SettingsFileWrite(); // -- Thread processing - bool ThreadsStartJobs(JobQueueT& queue); - bool ThreadsJobsDone(); - void ThreadsStop(); - void RegisterJobError(); + void Abort(bool error); // -- Generation - void CreateDirectories(); - void MocGenerateCompilation(); + bool CreateDirectories(); private: // -- Utility @@ -421,39 +392,22 @@ private: BaseSettingsT Base_; MocSettingsT Moc_; UicSettingsT Uic_; - // -- libuv loop -#ifdef CMAKE_UV_SIGNAL_HACK - std::unique_ptr UVHackRAII_; -#endif - std::unique_ptr UVLoop_; - cm::uv_async_ptr UVRequest_; - StageT Stage_ = StageT::SETTINGS_READ; - // -- Job queues - std::mutex JobsMutex_; - struct - { - JobQueueT Sources; - JobQueueT Headers; - JobQueueT MocPredefs; - JobQueueT Moc; - JobQueueT Uic; - } JobQueues_; - JobQueueT JobQueue_; - std::size_t volatile JobsRemain_ = 0; - bool volatile JobError_ = false; - bool volatile JobThreadsAbort_ = false; - std::condition_variable JobsConditionRead_; // -- Moc meta - std::set MocIncludedStrings_; + std::mutex MocMetaMutex_; std::set MocIncludedFiles_; + IncludesMap MocIncludes_; std::set MocAutoFiles_; - bool volatile MocAutoFileUpdated_ = false; + std::atomic MocAutoFileUpdated_ = ATOMIC_VAR_INIT(false); + // -- Uic meta + std::mutex UicMetaMutex_; + IncludesMap UicIncludes_; // -- Settings file std::string SettingsFile_; std::string SettingsStringMoc_; std::string SettingsStringUic_; - // -- Threads and loops - std::vector> Workers_; + // -- Thread pool and job queue + std::atomic JobError_ = ATOMIC_VAR_INIT(false); + cmWorkerPool WorkerPool_; }; #endif diff --git a/Source/cmWorkerPool.cxx b/Source/cmWorkerPool.cxx new file mode 100644 index 0000000..464182c --- /dev/null +++ b/Source/cmWorkerPool.cxx @@ -0,0 +1,770 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmWorkerPool.h" + +#include "cmRange.h" +#include "cmUVHandlePtr.h" +#include "cmUVSignalHackRAII.h" // IWYU pragma: keep +#include "cm_uv.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/** + * @brief libuv pipe buffer class + */ +class cmUVPipeBuffer +{ +public: + typedef cmRange DataRange; + typedef std::function DataFunction; + /// On error the ssize_t argument is a non zero libuv error code + typedef std::function EndFunction; + +public: + /** + * Reset to construction state + */ + void reset(); + + /** + * Initializes uv_pipe(), uv_stream() and uv_handle() + * @return true on success + */ + bool init(uv_loop_t* uv_loop); + + /** + * Start reading + * @return true on success + */ + bool startRead(DataFunction dataFunction, EndFunction endFunction); + + //! libuv pipe + uv_pipe_t* uv_pipe() const { return UVPipe_.get(); } + //! uv_pipe() casted to libuv stream + uv_stream_t* uv_stream() const { return static_cast(UVPipe_); } + //! uv_pipe() casted to libuv handle + uv_handle_t* uv_handle() { return static_cast(UVPipe_); } + +private: + // -- Libuv callbacks + static void UVAlloc(uv_handle_t* handle, size_t suggestedSize, + uv_buf_t* buf); + static void UVData(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf); + +private: + cm::uv_pipe_ptr UVPipe_; + std::vector Buffer_; + DataFunction DataFunction_; + EndFunction EndFunction_; +}; + +void cmUVPipeBuffer::reset() +{ + if (UVPipe_.get() != nullptr) { + EndFunction_ = nullptr; + DataFunction_ = nullptr; + Buffer_.clear(); + Buffer_.shrink_to_fit(); + UVPipe_.reset(); + } +} + +bool cmUVPipeBuffer::init(uv_loop_t* uv_loop) +{ + reset(); + if (uv_loop == nullptr) { + return false; + } + int ret = UVPipe_.init(*uv_loop, 0, this); + return (ret == 0); +} + +bool cmUVPipeBuffer::startRead(DataFunction dataFunction, + EndFunction endFunction) +{ + if (UVPipe_.get() == nullptr) { + return false; + } + if (!dataFunction || !endFunction) { + return false; + } + DataFunction_ = std::move(dataFunction); + EndFunction_ = std::move(endFunction); + int ret = uv_read_start(uv_stream(), &cmUVPipeBuffer::UVAlloc, + &cmUVPipeBuffer::UVData); + return (ret == 0); +} + +void cmUVPipeBuffer::UVAlloc(uv_handle_t* handle, size_t suggestedSize, + uv_buf_t* buf) +{ + auto& pipe = *reinterpret_cast(handle->data); + pipe.Buffer_.resize(suggestedSize); + buf->base = pipe.Buffer_.data(); + buf->len = static_cast(pipe.Buffer_.size()); +} + +void cmUVPipeBuffer::UVData(uv_stream_t* stream, ssize_t nread, + const uv_buf_t* buf) +{ + auto& pipe = *reinterpret_cast(stream->data); + if (nread > 0) { + if (buf->base != nullptr) { + // Call data function + pipe.DataFunction_(DataRange(buf->base, buf->base + nread)); + } + } else if (nread < 0) { + // Save the end function on the stack before resetting the pipe + EndFunction efunc; + efunc.swap(pipe.EndFunction_); + // Reset pipe before calling the end function + pipe.reset(); + // Call end function + efunc((nread == UV_EOF) ? 0 : nread); + } +} + +/** + * @brief External process management class + */ +class cmUVReadOnlyProcess +{ +public: + // -- Types + //! @brief Process settings + struct SetupT + { + std::string WorkingDirectory; + std::vector Command; + cmWorkerPool::ProcessResultT* Result = nullptr; + bool MergedOutput = false; + }; + +public: + // -- Const accessors + SetupT const& Setup() const { return Setup_; } + cmWorkerPool::ProcessResultT* Result() const { return Setup_.Result; } + bool IsStarted() const { return IsStarted_; } + bool IsFinished() const { return IsFinished_; } + + // -- Runtime + void setup(cmWorkerPool::ProcessResultT* result, bool mergedOutput, + std::vector const& command, + std::string const& workingDirectory = std::string()); + bool start(uv_loop_t* uv_loop, std::function finishedCallback); + +private: + // -- Libuv callbacks + static void UVExit(uv_process_t* handle, int64_t exitStatus, int termSignal); + void UVPipeOutData(cmUVPipeBuffer::DataRange data); + void UVPipeOutEnd(ssize_t error); + void UVPipeErrData(cmUVPipeBuffer::DataRange data); + void UVPipeErrEnd(ssize_t error); + void UVTryFinish(); + +private: + // -- Setup + SetupT Setup_; + // -- Runtime + bool IsStarted_ = false; + bool IsFinished_ = false; + std::function FinishedCallback_; + std::vector CommandPtr_; + std::array UVOptionsStdIO_; + uv_process_options_t UVOptions_; + cm::uv_process_ptr UVProcess_; + cmUVPipeBuffer UVPipeOut_; + cmUVPipeBuffer UVPipeErr_; +}; + +void cmUVReadOnlyProcess::setup(cmWorkerPool::ProcessResultT* result, + bool mergedOutput, + std::vector const& command, + std::string const& workingDirectory) +{ + Setup_.WorkingDirectory = workingDirectory; + Setup_.Command = command; + Setup_.Result = result; + Setup_.MergedOutput = mergedOutput; +} + +bool cmUVReadOnlyProcess::start(uv_loop_t* uv_loop, + std::function finishedCallback) +{ + if (IsStarted() || (Result() == nullptr)) { + return false; + } + + // Reset result before the start + Result()->reset(); + + // Fill command string pointers + if (!Setup().Command.empty()) { + CommandPtr_.reserve(Setup().Command.size() + 1); + for (std::string const& arg : Setup().Command) { + CommandPtr_.push_back(arg.c_str()); + } + CommandPtr_.push_back(nullptr); + } else { + Result()->ErrorMessage = "Empty command"; + } + + if (!Result()->error()) { + if (!UVPipeOut_.init(uv_loop)) { + Result()->ErrorMessage = "libuv stdout pipe initialization failed"; + } + } + if (!Result()->error()) { + if (!UVPipeErr_.init(uv_loop)) { + Result()->ErrorMessage = "libuv stderr pipe initialization failed"; + } + } + if (!Result()->error()) { + // -- Setup process stdio options + // stdin + UVOptionsStdIO_[0].flags = UV_IGNORE; + UVOptionsStdIO_[0].data.stream = nullptr; + // stdout + UVOptionsStdIO_[1].flags = + static_cast(UV_CREATE_PIPE | UV_WRITABLE_PIPE); + UVOptionsStdIO_[1].data.stream = UVPipeOut_.uv_stream(); + // stderr + UVOptionsStdIO_[2].flags = + static_cast(UV_CREATE_PIPE | UV_WRITABLE_PIPE); + UVOptionsStdIO_[2].data.stream = UVPipeErr_.uv_stream(); + + // -- Setup process options + std::fill_n(reinterpret_cast(&UVOptions_), sizeof(UVOptions_), 0); + UVOptions_.exit_cb = &cmUVReadOnlyProcess::UVExit; + UVOptions_.file = CommandPtr_[0]; + UVOptions_.args = const_cast(CommandPtr_.data()); + UVOptions_.cwd = Setup_.WorkingDirectory.c_str(); + UVOptions_.flags = UV_PROCESS_WINDOWS_HIDE; + UVOptions_.stdio_count = static_cast(UVOptionsStdIO_.size()); + UVOptions_.stdio = UVOptionsStdIO_.data(); + + // -- Spawn process + int uvErrorCode = UVProcess_.spawn(*uv_loop, UVOptions_, this); + if (uvErrorCode != 0) { + Result()->ErrorMessage = "libuv process spawn failed"; + if (const char* uvErr = uv_strerror(uvErrorCode)) { + Result()->ErrorMessage += ": "; + Result()->ErrorMessage += uvErr; + } + } + } + // -- Start reading from stdio streams + if (!Result()->error()) { + if (!UVPipeOut_.startRead( + [this](cmUVPipeBuffer::DataRange range) { + this->UVPipeOutData(range); + }, + [this](ssize_t error) { this->UVPipeOutEnd(error); })) { + Result()->ErrorMessage = "libuv start reading from stdout pipe failed"; + } + } + if (!Result()->error()) { + if (!UVPipeErr_.startRead( + [this](cmUVPipeBuffer::DataRange range) { + this->UVPipeErrData(range); + }, + [this](ssize_t error) { this->UVPipeErrEnd(error); })) { + Result()->ErrorMessage = "libuv start reading from stderr pipe failed"; + } + } + + if (!Result()->error()) { + IsStarted_ = true; + FinishedCallback_ = std::move(finishedCallback); + } else { + // Clear libuv handles and finish + UVProcess_.reset(); + UVPipeOut_.reset(); + UVPipeErr_.reset(); + CommandPtr_.clear(); + } + + return IsStarted(); +} + +void cmUVReadOnlyProcess::UVExit(uv_process_t* handle, int64_t exitStatus, + int termSignal) +{ + auto& proc = *reinterpret_cast(handle->data); + if (proc.IsStarted() && !proc.IsFinished()) { + // Set error message on demand + proc.Result()->ExitStatus = exitStatus; + proc.Result()->TermSignal = termSignal; + if (!proc.Result()->error()) { + if (termSignal != 0) { + proc.Result()->ErrorMessage = "Process was terminated by signal "; + proc.Result()->ErrorMessage += + std::to_string(proc.Result()->TermSignal); + } else if (exitStatus != 0) { + proc.Result()->ErrorMessage = "Process failed with return value "; + proc.Result()->ErrorMessage += + std::to_string(proc.Result()->ExitStatus); + } + } + + // Reset process handle + proc.UVProcess_.reset(); + // Try finish + proc.UVTryFinish(); + } +} + +void cmUVReadOnlyProcess::UVPipeOutData(cmUVPipeBuffer::DataRange data) +{ + Result()->StdOut.append(data.begin(), data.end()); +} + +void cmUVReadOnlyProcess::UVPipeOutEnd(ssize_t error) +{ + // Process pipe error + if ((error != 0) && !Result()->error()) { + Result()->ErrorMessage = + "Reading from stdout pipe failed with libuv error code "; + Result()->ErrorMessage += std::to_string(error); + } + // Try finish + UVTryFinish(); +} + +void cmUVReadOnlyProcess::UVPipeErrData(cmUVPipeBuffer::DataRange data) +{ + std::string* str = + Setup_.MergedOutput ? &Result()->StdOut : &Result()->StdErr; + str->append(data.begin(), data.end()); +} + +void cmUVReadOnlyProcess::UVPipeErrEnd(ssize_t error) +{ + // Process pipe error + if ((error != 0) && !Result()->error()) { + Result()->ErrorMessage = + "Reading from stderr pipe failed with libuv error code "; + Result()->ErrorMessage += std::to_string(error); + } + // Try finish + UVTryFinish(); +} + +void cmUVReadOnlyProcess::UVTryFinish() +{ + // There still might be data in the pipes after the process has finished. + // Therefore check if the process is finished AND all pipes are closed + // before signaling the worker thread to continue. + if ((UVProcess_.get() != nullptr) || (UVPipeOut_.uv_pipe() != nullptr) || + (UVPipeErr_.uv_pipe() != nullptr)) { + return; + } + IsFinished_ = true; + FinishedCallback_(); +} + +/** + * @brief Private worker pool internals + */ +class cmWorkerPoolInternal +{ +public: + // -- Types + + /** + * @brief Worker thread + */ + class WorkerT + { + public: + WorkerT(unsigned int index); + ~WorkerT(); + + WorkerT(WorkerT const&) = delete; + WorkerT& operator=(WorkerT const&) = delete; + + /** + * Start the thread + */ + void Start(cmWorkerPoolInternal* internal); + + /** + * @brief Run an external process + */ + bool RunProcess(cmWorkerPool::ProcessResultT& result, + std::vector const& command, + std::string const& workingDirectory); + + // -- Accessors + unsigned int Index() const { return Index_; } + cmWorkerPool::JobHandleT& JobHandle() { return JobHandle_; } + + private: + // -- Libuv callbacks + static void UVProcessStart(uv_async_t* handle); + void UVProcessFinished(); + + private: + //! @brief Job handle + cmWorkerPool::JobHandleT JobHandle_; + //! @brief Worker index + unsigned int Index_; + // -- Process management + struct + { + std::mutex Mutex; + cm::uv_async_ptr Request; + std::condition_variable Condition; + std::unique_ptr ROP; + } Proc_; + // -- System thread + std::thread Thread_; + }; + +public: + // -- Constructors + cmWorkerPoolInternal(cmWorkerPool* pool); + ~cmWorkerPoolInternal(); + + /** + * @brief Runs the libuv loop + */ + bool Process(); + + /** + * @brief Clear queue and abort threads + */ + void Abort(); + + /** + * @brief Push a job to the queue and notify a worker + */ + bool PushJob(cmWorkerPool::JobHandleT&& jobHandle); + + /** + * @brief Worker thread main loop method + */ + void Work(WorkerT* worker); + + // -- Request slots + static void UVSlotBegin(uv_async_t* handle); + static void UVSlotEnd(uv_async_t* handle); + +public: + // -- UV loop +#ifdef CMAKE_UV_SIGNAL_HACK + std::unique_ptr UVHackRAII; +#endif + std::unique_ptr UVLoop; + cm::uv_async_ptr UVRequestBegin; + cm::uv_async_ptr UVRequestEnd; + + // -- Thread pool and job queue + std::mutex Mutex; + bool Aborting = false; + bool FenceProcessing = false; + unsigned int WorkersRunning = 0; + unsigned int WorkersIdle = 0; + unsigned int JobsProcessing = 0; + std::deque Queue; + std::condition_variable Condition; + std::vector> Workers; + + // -- References + cmWorkerPool* Pool = nullptr; +}; + +cmWorkerPoolInternal::WorkerT::WorkerT(unsigned int index) + : Index_(index) +{ +} + +cmWorkerPoolInternal::WorkerT::~WorkerT() +{ + if (Thread_.joinable()) { + Thread_.join(); + } +} + +void cmWorkerPoolInternal::WorkerT::Start(cmWorkerPoolInternal* internal) +{ + Proc_.Request.init(*(internal->UVLoop), &WorkerT::UVProcessStart, this); + Thread_ = std::thread(&cmWorkerPoolInternal::Work, internal, this); +} + +bool cmWorkerPoolInternal::WorkerT::RunProcess( + cmWorkerPool::ProcessResultT& result, + std::vector const& command, std::string const& workingDirectory) +{ + if (command.empty()) { + return false; + } + // Create process instance + { + std::lock_guard lock(Proc_.Mutex); + Proc_.ROP = cm::make_unique(); + Proc_.ROP->setup(&result, true, command, workingDirectory); + } + // Send asynchronous process start request to libuv loop + Proc_.Request.send(); + // Wait until the process has been finished and destroyed + { + std::unique_lock ulock(Proc_.Mutex); + while (Proc_.ROP) { + Proc_.Condition.wait(ulock); + } + } + return !result.error(); +} + +void cmWorkerPoolInternal::WorkerT::UVProcessStart(uv_async_t* handle) +{ + auto* wrk = reinterpret_cast(handle->data); + bool startFailed = false; + { + auto& Proc = wrk->Proc_; + std::lock_guard lock(Proc.Mutex); + if (Proc.ROP && !Proc.ROP->IsStarted()) { + startFailed = + !Proc.ROP->start(handle->loop, [wrk] { wrk->UVProcessFinished(); }); + } + } + // Clean up if starting of the process failed + if (startFailed) { + wrk->UVProcessFinished(); + } +} + +void cmWorkerPoolInternal::WorkerT::UVProcessFinished() +{ + { + std::lock_guard lock(Proc_.Mutex); + if (Proc_.ROP && (Proc_.ROP->IsFinished() || !Proc_.ROP->IsStarted())) { + Proc_.ROP.reset(); + } + } + // Notify idling thread + Proc_.Condition.notify_one(); +} + +void cmWorkerPool::ProcessResultT::reset() +{ + ExitStatus = 0; + TermSignal = 0; + if (!StdOut.empty()) { + StdOut.clear(); + StdOut.shrink_to_fit(); + } + if (!StdErr.empty()) { + StdErr.clear(); + StdErr.shrink_to_fit(); + } + if (!ErrorMessage.empty()) { + ErrorMessage.clear(); + ErrorMessage.shrink_to_fit(); + } +} + +cmWorkerPoolInternal::cmWorkerPoolInternal(cmWorkerPool* pool) + : Pool(pool) +{ + // Initialize libuv loop + uv_disable_stdio_inheritance(); +#ifdef CMAKE_UV_SIGNAL_HACK + UVHackRAII = cm::make_unique(); +#endif + UVLoop = cm::make_unique(); + uv_loop_init(UVLoop.get()); +} + +cmWorkerPoolInternal::~cmWorkerPoolInternal() +{ + uv_loop_close(UVLoop.get()); +} + +bool cmWorkerPoolInternal::Process() +{ + // Reset state + Aborting = false; + // Initialize libuv asynchronous request + UVRequestBegin.init(*UVLoop, &cmWorkerPoolInternal::UVSlotBegin, this); + UVRequestEnd.init(*UVLoop, &cmWorkerPoolInternal::UVSlotEnd, this); + // Send begin request + UVRequestBegin.send(); + // Run libuv loop + return (uv_run(UVLoop.get(), UV_RUN_DEFAULT) == 0); +} + +void cmWorkerPoolInternal::Abort() +{ + bool firstCall = false; + // Clear all jobs and set abort flag + { + std::lock_guard guard(Mutex); + if (!Aborting) { + // Register abort and clear queue + Aborting = true; + Queue.clear(); + firstCall = true; + } + } + if (firstCall) { + // Wake threads + Condition.notify_all(); + } +} + +inline bool cmWorkerPoolInternal::PushJob(cmWorkerPool::JobHandleT&& jobHandle) +{ + std::lock_guard guard(Mutex); + if (Aborting) { + return false; + } + + // Append the job to the queue + Queue.emplace_back(std::move(jobHandle)); + + // Notify an idle worker if there's one + if (WorkersIdle != 0) { + Condition.notify_one(); + } + + return true; +} + +void cmWorkerPoolInternal::UVSlotBegin(uv_async_t* handle) +{ + auto& gint = *reinterpret_cast(handle->data); + // Create worker threads + { + unsigned int const num = gint.Pool->ThreadCount(); + // Create workers + gint.Workers.reserve(num); + for (unsigned int ii = 0; ii != num; ++ii) { + gint.Workers.emplace_back(cm::make_unique(ii)); + } + // Start workers + for (auto& wrk : gint.Workers) { + wrk->Start(&gint); + } + } + // Destroy begin request + gint.UVRequestBegin.reset(); +} + +void cmWorkerPoolInternal::UVSlotEnd(uv_async_t* handle) +{ + auto& gint = *reinterpret_cast(handle->data); + // Join and destroy worker threads + gint.Workers.clear(); + // Destroy end request + gint.UVRequestEnd.reset(); +} + +void cmWorkerPoolInternal::Work(WorkerT* worker) +{ + std::unique_lock uLock(Mutex); + // Increment running workers count + ++WorkersRunning; + // Enter worker main loop + while (true) { + // Abort on request + if (Aborting) { + break; + } + // Wait for new jobs + if (Queue.empty()) { + ++WorkersIdle; + Condition.wait(uLock); + --WorkersIdle; + continue; + } + + // Check for fence jobs + if (FenceProcessing || Queue.front()->IsFence()) { + if (JobsProcessing != 0) { + Condition.wait(uLock); + continue; + } + // No jobs get processed. Set the fence job processing flag. + FenceProcessing = true; + } + + // Pop next job from queue + worker->JobHandle() = std::move(Queue.front()); + Queue.pop_front(); + + // Unlocked scope for job processing + ++JobsProcessing; + { + uLock.unlock(); + worker->JobHandle()->Work(Pool, worker->Index()); // Process job + worker->JobHandle().reset(); // Destroy job + uLock.lock(); + } + --JobsProcessing; + + // Was this a fence job? + if (FenceProcessing) { + FenceProcessing = false; + Condition.notify_all(); + } + } + + // Decrement running workers count + if (--WorkersRunning == 0) { + // Last worker thread about to finish. Send libuv event. + UVRequestEnd.send(); + } +} + +cmWorkerPool::JobT::~JobT() = default; + +bool cmWorkerPool::JobT::RunProcess(ProcessResultT& result, + std::vector const& command, + std::string const& workingDirectory) +{ + // Get worker by index + auto* wrk = Pool_->Int_->Workers.at(WorkerIndex_).get(); + return wrk->RunProcess(result, command, workingDirectory); +} + +cmWorkerPool::cmWorkerPool() + : Int_(cm::make_unique(this)) +{ +} + +cmWorkerPool::~cmWorkerPool() = default; + +bool cmWorkerPool::Process(unsigned int threadCount, void* userData) +{ + // Setup user data + UserData_ = userData; + ThreadCount_ = (threadCount > 0) ? threadCount : 1u; + + // Run libuv loop + bool success = Int_->Process(); + + // Clear user data + UserData_ = nullptr; + ThreadCount_ = 0; + + return success; +} + +bool cmWorkerPool::PushJob(JobHandleT&& jobHandle) +{ + return Int_->PushJob(std::move(jobHandle)); +} + +void cmWorkerPool::Abort() +{ + Int_->Abort(); +} diff --git a/Source/cmWorkerPool.h b/Source/cmWorkerPool.h new file mode 100644 index 0000000..71c7d84 --- /dev/null +++ b/Source/cmWorkerPool.h @@ -0,0 +1,219 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cmWorkerPool_h +#define cmWorkerPool_h + +#include "cmConfigure.h" // IWYU pragma: keep + +#include "cmAlgorithms.h" // IWYU pragma: keep + +#include // IWYU pragma: keep +#include +#include +#include +#include + +// -- Types +class cmWorkerPoolInternal; + +/** @class cmWorkerPool + * @brief Thread pool with job queue + */ +class cmWorkerPool +{ +public: + /** + * Return value and output of an external process. + */ + struct ProcessResultT + { + void reset(); + bool error() const + { + return (ExitStatus != 0) || (TermSignal != 0) || !ErrorMessage.empty(); + } + + std::int64_t ExitStatus = 0; + int TermSignal = 0; + std::string StdOut; + std::string StdErr; + std::string ErrorMessage; + }; + + /** + * Abstract job class for concurrent job processing. + */ + class JobT + { + public: + JobT(JobT const&) = delete; + JobT& operator=(JobT const&) = delete; + + /** + * @brief Virtual destructor. + */ + virtual ~JobT(); + + /** + * @brief Fence job flag + * + * Fence jobs require that: + * - all jobs before in the queue have been processed + * - no jobs later in the queue will be processed before this job was + * processed + */ + bool IsFence() const { return Fence_; } + + protected: + /** + * @brief Protected default constructor + */ + JobT(bool fence = false) + : Fence_(fence) + { + } + + /** + * Abstract processing interface that must be implement in derived classes. + */ + virtual void Process() = 0; + + /** + * Get the worker pool. + * Only valid during the JobT::Process() call! + */ + cmWorkerPool* Pool() const { return Pool_; } + + /** + * Get the user data. + * Only valid during the JobT::Process() call! + */ + void* UserData() const { return Pool_->UserData(); }; + + /** + * Get the worker index. + * This is the index of the thread processing this job and is in the range + * [0..ThreadCount). + * Concurrently processing jobs will never have the same WorkerIndex(). + * Only valid during the JobT::Process() call! + */ + unsigned int WorkerIndex() const { return WorkerIndex_; } + + /** + * Run an external read only process. + * Use only during JobT::Process() call! + */ + bool RunProcess(ProcessResultT& result, + std::vector const& command, + std::string const& workingDirectory); + + private: + //! Needs access to Work() + friend class cmWorkerPoolInternal; + //! Worker thread entry method. + void Work(cmWorkerPool* pool, unsigned int workerIndex) + { + Pool_ = pool; + WorkerIndex_ = workerIndex; + this->Process(); + } + + private: + cmWorkerPool* Pool_ = nullptr; + unsigned int WorkerIndex_ = 0; + bool Fence_ = false; + }; + + /** + * @brief Job handle type + */ + typedef std::unique_ptr JobHandleT; + + /** + * @brief Fence job base class + */ + class JobFenceT : public JobT + { + public: + JobFenceT() + : JobT(true) + { + } + //! Does nothing + void Process() override{}; + }; + + /** + * @brief Fence job that aborts the worker pool. + * This class is useful as the last job in the job queue. + */ + class JobEndT : JobFenceT + { + public: + //! Does nothing + void Process() override { Pool()->Abort(); } + }; + +public: + // -- Methods + cmWorkerPool(); + ~cmWorkerPool(); + + /** + * @brief Blocking function that starts threads to process all Jobs in + * the queue. + * + * This method blocks until a job calls the Abort() method. + * @arg threadCount Number of threads to process jobs. + * @arg userData Common user data pointer available in all Jobs. + */ + bool Process(unsigned int threadCount, void* userData = nullptr); + + /** + * Number of worker threads passed to Process(). + * Only valid during Process(). + */ + unsigned int ThreadCount() const { return ThreadCount_; } + + /** + * User data reference passed to Process(). + * Only valid during Process(). + */ + void* UserData() const { return UserData_; } + + // -- Job processing interface + + /** + * @brief Clears the job queue and aborts all worker threads. + * + * This method is thread safe and can be called from inside a job. + */ + void Abort(); + + /** + * @brief Push job to the queue. + * + * This method is thread safe and can be called from inside a job or before + * Process(). + */ + bool PushJob(JobHandleT&& jobHandle); + + /** + * @brief Push job to the queue + * + * This method is thread safe and can be called from inside a job or before + * Process(). + */ + template + bool EmplaceJob(Args&&... args) + { + return PushJob(cm::make_unique(std::forward(args)...)); + } + +private: + void* UserData_ = nullptr; + unsigned int ThreadCount_ = 0; + std::unique_ptr Int_; +}; + +#endif ----------------------------------------------------------------------- Summary of changes: Help/command/string.rst | 9 + Help/manual/cmake-generator-expressions.7.rst | 55 +- Help/release/dev/genex-TARGET_FILE_BASE_NAME.rst | 7 + Help/release/dev/genex-TARGET_OUTPUT_NAME.rst | 7 - Help/release/dev/string-repeat.rst | 4 + Modules/FindBoost.cmake | 2 +- Modules/InstallRequiredSystemLibraries.cmake | 7 +- Source/CMakeLists.txt | 6 +- Source/cmGeneratorExpressionNode.cxx | 32 +- Source/cmQtAutoGenerator.cxx | 232 ---- Source/cmQtAutoGenerator.h | 102 -- ...tAutoGeneratorMocUic.cxx => cmQtAutoMocUic.cxx} | 1211 ++++++++------------ ...{cmQtAutoGeneratorMocUic.h => cmQtAutoMocUic.h} | 298 ++--- Source/cmStringCommand.cxx | 61 + Source/cmStringCommand.h | 1 + Source/cmWorkerPool.cxx | 770 +++++++++++++ Source/cmWorkerPool.h | 219 ++++ Source/cmcmd.cxx | 4 +- Tests/FindBoost/CMakeLists.txt | 13 + Tests/FindBoost/TestPython/CMakeLists.txt | 17 + Tests/QtAutogen/ManySources/CMakeLists.txt | 35 + Tests/QtAutogen/ManySources/data.qrc.in | 7 + Tests/QtAutogen/ManySources/item.cpp.in | 27 + Tests/QtAutogen/ManySources/item.h.in | 15 + Tests/QtAutogen/ManySources/main.cpp.in | 7 + Tests/QtAutogen/ManySources/object.h.in | 15 + Tests/QtAutogen/ManySources/view.ui.in | 24 + Tests/QtAutogen/Tests.cmake | 1 + ...tedTarget-TARGET_PDB_FILE_BASE_NAME-result.txt} | 0 ...rtedTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt | 8 + .../ImportedTarget-TARGET_PDB_FILE_BASE_NAME.cmake | 2 + ...mportedTarget-TARGET_PDB_OUTPUT_NAME-result.txt | 1 - ...mportedTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt | 8 - .../ImportedTarget-TARGET_PDB_OUTPUT_NAME.cmake | 2 - ...dCompiler-TARGET_PDB_FILE_BASE_NAME-result.txt} | 0 ...idCompiler-TARGET_PDB_FILE_BASE_NAME-stderr.txt | 8 + ...nValidCompiler-TARGET_PDB_FILE_BASE_NAME.cmake} | 2 +- ...ValidCompiler-TARGET_PDB_OUTPUT_NAME-result.txt | 1 - ...ValidCompiler-TARGET_PDB_OUTPUT_NAME-stderr.txt | 8 - ...lidTarget-TARGET_PDB_FILE_BASE_NAME-result.txt} | 0 ...alidTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt | 9 + ...NonValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake} | 2 +- ...onValidTarget-TARGET_PDB_OUTPUT_NAME-result.txt | 1 - ...onValidTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt | 9 - .../OUTPUT_NAME-recursion.cmake | 2 +- .../GeneratorExpression/RunCMakeTest.cmake | 16 +- .../TARGET_FILE_BASE_NAME-check.cmake | 2 + ...RGET_FILE_BASE_NAME-imported-target-check.cmake | 2 + ...=> TARGET_FILE_BASE_NAME-imported-target.cmake} | 32 +- ...GET_FILE_BASE_NAME-non-valid-target-result.txt} | 0 ...RGET_FILE_BASE_NAME-non-valid-target-stderr.txt | 6 + ...> TARGET_FILE_BASE_NAME-non-valid-target.cmake} | 2 +- .../TARGET_FILE_BASE_NAME.cmake | 96 ++ ...KER_FILE_BASE_NAME-non-valid-target-result.txt} | 0 ...NKER_FILE_BASE_NAME-non-valid-target-stderr.txt | 6 + ...T_LINKER_FILE_BASE_NAME-non-valid-target.cmake} | 2 +- ..._LINKER_OUTPUT_NAME-non-valid-target-result.txt | 1 - ..._LINKER_OUTPUT_NAME-non-valid-target-stderr.txt | 6 - .../TARGET_OUTPUT_NAME-check.cmake | 2 - .../TARGET_OUTPUT_NAME-imported-target-check.cmake | 2 - .../TARGET_OUTPUT_NAME-non-valid-target-result.txt | 1 - .../TARGET_OUTPUT_NAME-non-valid-target-stderr.txt | 6 - .../GeneratorExpression/TARGET_OUTPUT_NAME.cmake | 96 -- ...lidTarget-TARGET_PDB_FILE_BASE_NAME-check.cmake | 7 + ...=> ValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake} | 2 +- .../ValidTarget-TARGET_PDB_OUTPUT_NAME-check.cmake | 7 - Tests/RunCMake/string/Repeat.cmake | 45 + .../RepeatNegativeCount-result.txt} | 0 .../RunCMake/string/RepeatNegativeCount-stderr.txt | 4 + Tests/RunCMake/string/RepeatNegativeCount.cmake | 1 + .../RepeatNoArgs-result.txt} | 0 Tests/RunCMake/string/RepeatNoArgs-stderr.txt | 4 + Tests/RunCMake/string/RepeatNoArgs.cmake | 1 + Tests/RunCMake/string/RunCMakeTest.cmake | 4 + 74 files changed, 2114 insertions(+), 1490 deletions(-) create mode 100644 Help/release/dev/genex-TARGET_FILE_BASE_NAME.rst delete mode 100644 Help/release/dev/genex-TARGET_OUTPUT_NAME.rst create mode 100644 Help/release/dev/string-repeat.rst rename Source/{cmQtAutoGeneratorMocUic.cxx => cmQtAutoMocUic.cxx} (59%) rename Source/{cmQtAutoGeneratorMocUic.h => cmQtAutoMocUic.h} (56%) create mode 100644 Source/cmWorkerPool.cxx create mode 100644 Source/cmWorkerPool.h create mode 100644 Tests/FindBoost/TestPython/CMakeLists.txt create mode 100644 Tests/QtAutogen/ManySources/CMakeLists.txt create mode 100644 Tests/QtAutogen/ManySources/data.qrc.in create mode 100644 Tests/QtAutogen/ManySources/item.cpp.in create mode 100644 Tests/QtAutogen/ManySources/item.h.in create mode 100644 Tests/QtAutogen/ManySources/main.cpp.in create mode 100644 Tests/QtAutogen/ManySources/object.h.in create mode 100644 Tests/QtAutogen/ManySources/view.ui.in copy Tests/RunCMake/{while/MissingArgument-result.txt => GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME.cmake delete mode 100644 Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-result.txt delete mode 100644 Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt delete mode 100644 Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-stderr.txt rename Tests/RunCMake/GeneratorExpression/{NonValidTarget-TARGET_PDB_OUTPUT_NAME.cmake => NonValidCompiler-TARGET_PDB_FILE_BASE_NAME.cmake} (71%) delete mode 100644 Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-result.txt delete mode 100644 Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-stderr.txt copy Tests/RunCMake/{while/MissingArgument-result.txt => GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt rename Tests/RunCMake/GeneratorExpression/{NonValidCompiler-TARGET_PDB_OUTPUT_NAME.cmake => NonValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake} (71%) delete mode 100644 Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-result.txt delete mode 100644 Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-check.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target-check.cmake rename Tests/RunCMake/GeneratorExpression/{TARGET_OUTPUT_NAME-imported-target.cmake => TARGET_FILE_BASE_NAME-imported-target.cmake} (51%) copy Tests/RunCMake/{while/MissingArgument-result.txt => GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target-stderr.txt rename Tests/RunCMake/GeneratorExpression/{TARGET_OUTPUT_NAME-non-valid-target.cmake => TARGET_FILE_BASE_NAME-non-valid-target.cmake} (66%) create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-stderr.txt rename Tests/RunCMake/GeneratorExpression/{TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake => TARGET_LINKER_FILE_BASE_NAME-non-valid-target.cmake} (63%) delete mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-result.txt delete mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-stderr.txt delete mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-check.cmake delete mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target-check.cmake delete mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-result.txt delete mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-stderr.txt delete mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE_BASE_NAME-check.cmake rename Tests/RunCMake/GeneratorExpression/{ValidTarget-TARGET_PDB_OUTPUT_NAME.cmake => ValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake} (88%) delete mode 100644 Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME-check.cmake create mode 100644 Tests/RunCMake/string/Repeat.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => string/RepeatNegativeCount-result.txt} (100%) create mode 100644 Tests/RunCMake/string/RepeatNegativeCount-stderr.txt create mode 100644 Tests/RunCMake/string/RepeatNegativeCount.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => string/RepeatNoArgs-result.txt} (100%) create mode 100644 Tests/RunCMake/string/RepeatNoArgs-stderr.txt create mode 100644 Tests/RunCMake/string/RepeatNoArgs.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Tue Apr 16 13:43:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 16 Apr 2019 13:43:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.14.2-6-g09fba61 Message-ID: <20190416174306.C0FEC10349B@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 09fba6146fa726a83cbbccc3d5fb288f7f14f111 (commit) via 0b54f72e940503adfbd978d7f1dedc3da4799f52 (commit) via cce342a5b966c57d933951053757090fc860a067 (commit) via a0b6448c855053301cba575c226abecef173f2c3 (commit) from a6bf68141faca9af22624c8d0e1603653a73fce4 (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/FindBoost.cmake | 2 +- Modules/InstallRequiredSystemLibraries.cmake | 7 +++++-- Tests/FindBoost/CMakeLists.txt | 13 +++++++++++++ Tests/FindBoost/TestPython/CMakeLists.txt | 17 +++++++++++++++++ 4 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 Tests/FindBoost/TestPython/CMakeLists.txt hooks/post-receive -- CMake From kwrobot at kitware.com Tue Apr 16 13:53:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 16 Apr 2019 13:53:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.2-731-g2d37678 Message-ID: <20190416175304.8B20F102941@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 2d3767822662ad3f19190eb5a84b43becdb84a1f (commit) via d145d72e708b7d742fb1324c056ba2c0254dda76 (commit) from 9aecda56ba960267b392e54e5c28388a6cfa92ed (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=2d3767822662ad3f19190eb5a84b43becdb84a1f commit 2d3767822662ad3f19190eb5a84b43becdb84a1f Merge: 9aecda5 d145d72 Author: Brad King AuthorDate: Tue Apr 16 17:43:42 2019 +0000 Commit: Kitware Robot CommitDate: Tue Apr 16 13:43:52 2019 -0400 Merge topic 'vs-project-import' d145d72e70 VS: add target property VS_PROJECT_IMPORT_ Acked-by: Kitware Robot Merge-request: !3143 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d145d72e708b7d742fb1324c056ba2c0254dda76 commit d145d72e708b7d742fb1324c056ba2c0254dda76 Author: Leonid Pospelov AuthorDate: Sun Mar 24 04:47:53 2019 +0300 Commit: Brad King CommitDate: Mon Apr 15 13:05:07 2019 -0400 VS: add target property VS_PROJECT_IMPORT_ Fixes: #18998 diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 4d4b9ff..bd19ccf 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -335,6 +335,7 @@ Properties on Targets /prop_tgt/VS_KEYWORD /prop_tgt/VS_MOBILE_EXTENSIONS_VERSION /prop_tgt/VS_NO_SOLUTION_DEPLOY + /prop_tgt/VS_PROJECT_IMPORT /prop_tgt/VS_SCC_AUXPATH /prop_tgt/VS_SCC_LOCALPATH /prop_tgt/VS_SCC_PROJECTNAME diff --git a/Help/prop_tgt/VS_PROJECT_IMPORT.rst b/Help/prop_tgt/VS_PROJECT_IMPORT.rst new file mode 100644 index 0000000..569c8ea --- /dev/null +++ b/Help/prop_tgt/VS_PROJECT_IMPORT.rst @@ -0,0 +1,8 @@ +VS_PROJECT_IMPORT +----------------- + +Visual Studio managed project imports + +Adds to a generated Visual Studio project one or more semicolon-delimited paths +to .props files needed when building projects from some NuGet packages. +For example, ``my_packages_path/MyPackage.1.0.0/build/MyPackage.props``. diff --git a/Help/release/dev/vs-project-import.rst b/Help/release/dev/vs-project-import.rst new file mode 100644 index 0000000..de6024d --- /dev/null +++ b/Help/release/dev/vs-project-import.rst @@ -0,0 +1,5 @@ +vs-project-import +----------------- + +* The :prop_tgt:`VS_PROJECT_IMPORT` target property was added which allows + to import external .props files in managed Visual Studio targets. diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 5c9f25e..6ec47c2 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -662,6 +662,7 @@ void cmVisualStudio10TargetGenerator::Generate() this->WriteCustomCommands(e0); this->WriteAllSources(e0); this->WriteDotNetReferences(e0); + this->WriteImports(e0); this->WriteEmbeddedResourceGroup(e0); this->WriteXamlFilesGroup(e0); this->WriteWinRTReferences(e0); @@ -810,6 +811,24 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReference( this->WriteDotNetReferenceCustomTags(e2, ref); } +void cmVisualStudio10TargetGenerator::WriteImports(Elem& e0) +{ + const char* imports = + this->GeneratorTarget->Target->GetProperty("VS_PROJECT_IMPORT"); + if (imports) { + std::vector argsSplit; + cmSystemTools::ExpandListArgument(std::string(imports), argsSplit, false); + for (auto& path : argsSplit) { + if (!cmsys::SystemTools::FileIsFullPath(path)) { + path = this->Makefile->GetCurrentSourceDirectory() + "/" + path; + } + ConvertToWindowsSlash(path); + Elem e1(e0, "Import"); + e1.Attribute("Project", path); + } + } +} + void cmVisualStudio10TargetGenerator::WriteDotNetReferenceCustomTags( Elem& e2, std::string const& ref) { diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 5901004..b5b7a4a 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -76,6 +76,7 @@ private: void WriteDotNetReference(Elem& e1, std::string const& ref, std::string const& hint, std::string const& config); + void WriteImports(Elem& e0); void WriteDotNetReferenceCustomTags(Elem& e2, std::string const& ref); void WriteEmbeddedResourceGroup(Elem& e0); void WriteWinRTReferences(Elem& e0); diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index df253a9..219e529 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -18,3 +18,4 @@ run_cmake(VsCSharpDeployFiles) run_cmake(VSCSharpDefines) run_cmake(VsSdkDirectories) run_cmake(VsGlobals) +run_cmake(VsProjectImport) diff --git a/Tests/RunCMake/VS10Project/VsProjectImport-check.cmake b/Tests/RunCMake/VS10Project/VsProjectImport-check.cmake new file mode 100644 index 0000000..e438bf4 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsProjectImport-check.cmake @@ -0,0 +1,28 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + +set(test1Import "path\\\\to\\\\nuget_packages\\\\Foo.1.0.0\\\\build\\\\Foo.props") +set(test2Import "path\\\\to\\\\nuget_packages\\\\Bar.1.0.0\\\\build\\\\Bar.props") + +set(import1Found FALSE) +set(import2Found FALSE) + +file(STRINGS "${vcProjectFile}" lines) + +foreach(i 1 2) + set(testImport "${test${i}Import}") + foreach(line IN LISTS lines) + if(line MATCHES "^ *$") + message(STATUS "foo.vcxproj is using project import ${testImport}") + set(import${i}Found TRUE) + endif() + endforeach() +endforeach() + +if(NOT import1Found OR NOT import2Found) + set(RunCMake_TEST_FAILED "Imported project not found.") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsProjectImport.cmake b/Tests/RunCMake/VS10Project/VsProjectImport.cmake new file mode 100644 index 0000000..70bdded --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsProjectImport.cmake @@ -0,0 +1,11 @@ +enable_language(CXX) +add_library(foo foo.cpp) + +set(test1Import "path/to/nuget_packages/Foo.1.0.0/build/Foo.props") +set(test2Import "path/to/nuget_packages/Bar.1.0.0/build/Bar.props") + +set_property(TARGET foo PROPERTY + VS_PROJECT_IMPORT + ${test1Import} + ${test2Import} + ) ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-properties.7.rst | 1 + Help/prop_tgt/VS_PROJECT_IMPORT.rst | 8 +++++++ Help/release/dev/vs-project-import.rst | 5 ++++ Source/cmVisualStudio10TargetGenerator.cxx | 19 +++++++++++++++ Source/cmVisualStudio10TargetGenerator.h | 1 + Tests/RunCMake/VS10Project/RunCMakeTest.cmake | 1 + .../VS10Project/VsProjectImport-check.cmake | 28 ++++++++++++++++++++++ Tests/RunCMake/VS10Project/VsProjectImport.cmake | 11 +++++++++ 8 files changed, 74 insertions(+) create mode 100644 Help/prop_tgt/VS_PROJECT_IMPORT.rst create mode 100644 Help/release/dev/vs-project-import.rst create mode 100644 Tests/RunCMake/VS10Project/VsProjectImport-check.cmake create mode 100644 Tests/RunCMake/VS10Project/VsProjectImport.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Wed Apr 17 00:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 17 Apr 2019 00:03:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.2-732-g8d5eb97 Message-ID: <20190417040305.A81101034E0@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 8d5eb9787885d21d5d20630473c11a79250ca28e (commit) from 2d3767822662ad3f19190eb5a84b43becdb84a1f (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=8d5eb9787885d21d5d20630473c11a79250ca28e commit 8d5eb9787885d21d5d20630473c11a79250ca28e Author: Kitware Robot AuthorDate: Wed Apr 17 00:01:04 2019 -0400 Commit: Kitware Robot CommitDate: Wed Apr 17 00:01:04 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 636d332..b7b278b 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 14) -set(CMake_VERSION_PATCH 20190416) +set(CMake_VERSION_PATCH 20190417) #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 Apr 17 10:53:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 17 Apr 2019 10:53:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.2-734-g87609ee Message-ID: <20190417145305.9A8A8FA5A8@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 87609eebf390bdf183aab80061ee9fa2fbdbc17a (commit) via 844050adaf4ff28356a14b34d3ec73f36e843339 (commit) from 8d5eb9787885d21d5d20630473c11a79250ca28e (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=87609eebf390bdf183aab80061ee9fa2fbdbc17a commit 87609eebf390bdf183aab80061ee9fa2fbdbc17a Merge: 8d5eb97 844050a Author: Brad King AuthorDate: Wed Apr 17 14:43:23 2019 +0000 Commit: Kitware Robot CommitDate: Wed Apr 17 10:44:05 2019 -0400 Merge topic 'libglvnd-subdir' 844050adaf FindOpenGL: look for GLVND libraries with a libglvnd suffix Acked-by: Kitware Robot Merge-request: !3236 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=844050adaf4ff28356a14b34d3ec73f36e843339 commit 844050adaf4ff28356a14b34d3ec73f36e843339 Author: Ben Boeckel AuthorDate: Mon Apr 15 15:37:59 2019 -0400 Commit: Brad King CommitDate: Wed Apr 17 10:16:46 2019 -0400 FindOpenGL: look for GLVND libraries with a libglvnd suffix On CentOS 6.10, the libglvnd package from EPEL installs its libraries under a libglvnd subdirectory. diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake index 832dca2..00db033 100644 --- a/Modules/FindOpenGL.cmake +++ b/Modules/FindOpenGL.cmake @@ -205,11 +205,13 @@ else() find_library(OPENGL_glx_LIBRARY NAMES GLX PATHS ${_OPENGL_LIB_PATH} + PATH_SUFFIXES libglvnd ) find_library(OPENGL_egl_LIBRARY NAMES EGL PATHS ${_OPENGL_LIB_PATH} + PATH_SUFFIXES libglvnd ) find_library(OPENGL_glu_LIBRARY @@ -264,6 +266,7 @@ else() /usr/openwin/lib /usr/shlib ${_OPENGL_LIB_PATH} + PATH_SUFFIXES libglvnd ) endif() ----------------------------------------------------------------------- Summary of changes: Modules/FindOpenGL.cmake | 3 +++ 1 file changed, 3 insertions(+) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Apr 17 11:03:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 17 Apr 2019 11:03:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.2-741-g2ed688a Message-ID: <20190417150304.4E1FEF9BE9@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 2ed688a863671d58513055ad56ab04d6be05295b (commit) via fb3370b6a1681190ffd8daf63975c44ce8fc1c49 (commit) via 5cd187147ecbd29a0afc5a6b49f2232b61a1ab8c (commit) via 0238295c7e9d19340e968b766d6d0cf07fc5af50 (commit) via c648551bea65c6457f21b608f31c4ccd5b69a0fa (commit) via 8e4899fd6cb3518723710f7ba57d28ef058518c0 (commit) via f621e7fa5df8d35cc379f9f7825f3d75b8489876 (commit) from 87609eebf390bdf183aab80061ee9fa2fbdbc17a (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=2ed688a863671d58513055ad56ab04d6be05295b commit 2ed688a863671d58513055ad56ab04d6be05295b Merge: 5cd1871 fb3370b Author: Brad King AuthorDate: Wed Apr 17 15:01:03 2019 +0000 Commit: Kitware Robot CommitDate: Wed Apr 17 11:01:37 2019 -0400 Merge topic 'msvc-runtime-library' fb3370b6a1 MSVC: Add abstraction for runtime library selection f621e7fa5d VS: Fix Fortran runtime library flag map special case for '-' options Acked-by: Kitware Robot Acked-by: Ben Boeckel Acked-by: Leonid Pospelov Merge-request: !3211 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fb3370b6a1681190ffd8daf63975c44ce8fc1c49 commit fb3370b6a1681190ffd8daf63975c44ce8fc1c49 Author: Brad King AuthorDate: Wed Apr 10 13:38:41 2019 -0400 Commit: Brad King CommitDate: Wed Apr 17 11:00:44 2019 -0400 MSVC: Add abstraction for runtime library selection Replace our hard-coded defaults for `/MD` and `/MDd` with a first-class abstraction to select the runtime library from an enumeration of logical names. We've long hesitated to do this because the idea of "runtime library selection" touches on related concepts on several platforms. Avoid that scope creep by simply defining an abstraction that applies only when targeting the MSVC ABI on Windows. Removing the old default flags requires a policy because existing projects may rely on string processing to edit them and choose a runtime library under the old behavior. Add policy CMP0091 to provide compatibility. Fixes: #19108 diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst index ca8fc77..0bc2ca3 100644 --- a/Help/command/try_compile.rst +++ b/Help/command/try_compile.rst @@ -135,6 +135,7 @@ default values: * :variable:`CMAKE_ENABLE_EXPORTS` * :variable:`CMAKE_LINK_SEARCH_START_STATIC` * :variable:`CMAKE_LINK_SEARCH_END_STATIC` +* :variable:`CMAKE_MSVC_RUNTIME_LIBRARY` * :variable:`CMAKE_POSITION_INDEPENDENT_CODE` If :policy:`CMP0056` is set to ``NEW``, then diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index e89ea3da..043fb5c 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -57,6 +57,7 @@ Policies Introduced by CMake 3.15 .. toctree:: :maxdepth: 1 + CMP0091: MSVC runtime library flags are selected by an abstraction. CMP0090: export(PACKAGE) does not populate package registry by default. CMP0089: Compiler id for IBM Clang-based XL compilers is now XLClang. diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 4d4b9ff..3da9144 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -280,6 +280,7 @@ Properties on Targets /prop_tgt/MACOSX_RPATH /prop_tgt/MANUALLY_ADDED_DEPENDENCIES /prop_tgt/MAP_IMPORTED_CONFIG_CONFIG + /prop_tgt/MSVC_RUNTIME_LIBRARY /prop_tgt/NAME /prop_tgt/NO_SONAME /prop_tgt/NO_SYSTEM_FROM_IMPORTED diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 18dd9d7..22e8add 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -386,6 +386,7 @@ Variables that Control the Build /variable/CMAKE_MODULE_LINKER_FLAGS_CONFIG_INIT /variable/CMAKE_MODULE_LINKER_FLAGS_INIT /variable/CMAKE_MSVCIDE_RUN_PATH + /variable/CMAKE_MSVC_RUNTIME_LIBRARY /variable/CMAKE_NINJA_OUTPUT_PATH_PREFIX /variable/CMAKE_NO_BUILTIN_CHRPATH /variable/CMAKE_NO_SYSTEM_FROM_IMPORTED diff --git a/Help/policy/CMP0091.rst b/Help/policy/CMP0091.rst new file mode 100644 index 0000000..5b7c4e3 --- /dev/null +++ b/Help/policy/CMP0091.rst @@ -0,0 +1,47 @@ +CMP0091 +------- + +MSVC runtime library flags are selected by an abstraction. + +Compilers targeting the MSVC ABI have flags to select the MSVC runtime library. +Runtime library selection typically varies with build configuration because +there is a separate runtime library for Debug builds. + +In CMake 3.14 and below, MSVC runtime library selection flags are added to +the default :variable:`CMAKE__FLAGS_` cache entries by CMake +automatically. This allows users to edit their cache entries to adjust the +flags. However, the presence of such default flags is problematic for +projects that want to choose a different runtime library programmatically. +In particular, it requires string editing of the +:variable:`CMAKE__FLAGS_` variables with knowledge of the +CMake builtin defaults so they can be replaced. + +CMake 3.15 and above prefer to leave the MSVC runtime library selection flags +out of the default :variable:`CMAKE__FLAGS_` values and instead +offer a first-class abstraction. The :variable:`CMAKE_MSVC_RUNTIME_LIBRARY` +variable and :prop_tgt:`MSVC_RUNTIME_LIBRARY` target property may be set to +select the MSVC runtime library. + +This policy provides compatibility with projects that have not been updated +to be aware of the abstraction. The policy setting takes effect as of the +first :command:`project` or :command:`enable_language` command that enables +a language whose compiler targets the MSVC ABI. + +.. note:: + + Once the policy has taken effect at the top of a project, that choice + must be used throughout the tree. In projects that have nested projects + in subdirectories, be sure to convert everything together. + +The ``OLD`` behavior for this policy is to place MSVC runtime library +flags in the default :variable:`CMAKE__FLAGS_` cache +entries and ignore the :variable:`CMAKE_MSVC_RUNTIME_LIBRARY` abstraction. +The ``NEW`` behavior for this policy is to *not* place MSVC runtime +library flags in the default cache entries and use the abstraction instead. + +This policy was introduced in CMake version 3.15. Use the +:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. +Unlike many policies, CMake version |release| does *not* warn +when this policy is not set and simply uses ``OLD`` behavior. + +.. include:: DEPRECATED.txt diff --git a/Help/prop_tgt/MSVC_RUNTIME_LIBRARY-VALUES.txt b/Help/prop_tgt/MSVC_RUNTIME_LIBRARY-VALUES.txt new file mode 100644 index 0000000..2bf71a9 --- /dev/null +++ b/Help/prop_tgt/MSVC_RUNTIME_LIBRARY-VALUES.txt @@ -0,0 +1,15 @@ +``MultiThreaded`` + Compile with ``-MT`` or equivalent flag(s) to use a multi-threaded + statically-linked runtime library. +``MultiThreadedDLL`` + Compile with ``-MD`` or equivalent flag(s) to use a multi-threaded + dynamically-linked runtime library. +``MultiThreadedDebug`` + Compile with ``-MTd`` or equivalent flag(s) to use a multi-threaded + statically-linked runtime library. +``MultiThreadedDebugDLL`` + Compile with ``-MDd`` or equivalent flag(s) to use a multi-threaded + dynamically-linked runtime library. + +The value is ignored on non-MSVC compilers but an unsupported value will +be rejected as an error when using a compiler targeting the MSVC ABI. diff --git a/Help/prop_tgt/MSVC_RUNTIME_LIBRARY.rst b/Help/prop_tgt/MSVC_RUNTIME_LIBRARY.rst new file mode 100644 index 0000000..1e3f5e9 --- /dev/null +++ b/Help/prop_tgt/MSVC_RUNTIME_LIBRARY.rst @@ -0,0 +1,26 @@ +MSVC_RUNTIME_LIBRARY +-------------------- + +Select the MSVC runtime library for use by compilers targeting the MSVC ABI. + +The allowed values are: + +.. include:: MSVC_RUNTIME_LIBRARY-VALUES.txt + +Use :manual:`generator expressions ` to +support per-configuration specification. For example, the code: + +.. code-block:: cmake + + add_executable(foo foo.c) + set_property(TARGET foo PROPERTY + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + +selects for the target ``foo`` a multi-threaded statically-linked runtime +library with or without debug information depending on the configuration. + +.. note:: + + This property has effect only when policy :policy:`CMP0091` is set to ``NEW`` + prior to the first :command:`project` or :command:`enable_language` command + that enables a language using a compiler targeting the MSVC ABI. diff --git a/Help/release/dev/msvc-runtime-library.rst b/Help/release/dev/msvc-runtime-library.rst new file mode 100644 index 0000000..4dddac2 --- /dev/null +++ b/Help/release/dev/msvc-runtime-library.rst @@ -0,0 +1,7 @@ +msvc-runtime-library +-------------------- + +* The :variable:`CMAKE_MSVC_RUNTIME_LIBRARY` variable and + :prop_tgt:`MSVC_RUNTIME_LIBRARY` target property were introduced to + select the runtime library used by compilers targeting the MSVC ABI. + See policy :policy:`CMP0091`. diff --git a/Help/variable/CMAKE_MSVC_RUNTIME_LIBRARY.rst b/Help/variable/CMAKE_MSVC_RUNTIME_LIBRARY.rst new file mode 100644 index 0000000..6ed68c9 --- /dev/null +++ b/Help/variable/CMAKE_MSVC_RUNTIME_LIBRARY.rst @@ -0,0 +1,27 @@ +CMAKE_MSVC_RUNTIME_LIBRARY +-------------------------- + +Select the MSVC runtime library for use by compilers targeting the MSVC ABI. +This variable is used to initialize the :prop_tgt:`MSVC_RUNTIME_LIBRARY` +property on all targets as they are created. It is also propagated by +calls to the :command:`try_compile` command into the test project. + +The allowed values are: + +.. include:: ../prop_tgt/MSVC_RUNTIME_LIBRARY-VALUES.txt + +Use :manual:`generator expressions ` to +support per-configuration specification. For example, the code: + +.. code-block:: cmake + + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + +selects for all following targets a multi-threaded statically-linked runtime +library with or without debug information depending on the configuration. + +.. note:: + + This variable has effect only when policy :policy:`CMP0091` is set to ``NEW`` + prior to the first :command:`project` or :command:`enable_language` command + that enables a language using a compiler targeting the MSVC ABI. diff --git a/Modules/Platform/Windows-Intel-Fortran.cmake b/Modules/Platform/Windows-Intel-Fortran.cmake index 3981a09..f00a8e4 100644 --- a/Modules/Platform/Windows-Intel-Fortran.cmake +++ b/Modules/Platform/Windows-Intel-Fortran.cmake @@ -4,8 +4,34 @@ set(_COMPILE_Fortran " /fpp") set(CMAKE_Fortran_MODDIR_FLAG "-module:") set(CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib") __windows_compiler_intel(Fortran) -string(APPEND CMAKE_Fortran_FLAGS_INIT " /W1 /nologo /fpp /libs:dll /threads") -string(APPEND CMAKE_Fortran_FLAGS_DEBUG_INIT " /Od /debug:full /dbglibs") +if(CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT) + set(_LIBSDLL "") + set(_DBGLIBS "") + set(_THREADS "") +else() + set(_LIBSDLL " /libs:dll") + set(_DBGLIBS " /dbglibs") + set(_THREADS " /threads") +endif() +string(APPEND CMAKE_Fortran_FLAGS_INIT " /W1 /nologo /fpp${_LIBSDLL}${_THREADS}") +string(APPEND CMAKE_Fortran_FLAGS_DEBUG_INIT " /Od /debug:full${_DBGLIBS}") string(APPEND CMAKE_Fortran_FLAGS_MINSIZEREL_INIT " /O1 /DNDEBUG") string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " /O2 /DNDEBUG") string(APPEND CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT " /O2 /debug:full /DNDEBUG") +unset(_LIBSDLL) +unset(_DBGLIBS) +unset(_THREADS) + +set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded -threads -libs:static) +set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL -threads -libs:dll) +set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug -threads -libs:static -dbglibs) +set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL -threads -libs:dll -dbglibs) + +# Intel Fortran for Windows supports single-threaded RTL but it is +# not implemented by the Visual Studio integration. +if(NOT CMAKE_GENERATOR MATCHES "Visual Studio") + set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_SingleThreaded -libs:static) + set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_SingleThreadedDLL -libs:dll) + set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_SingleThreadedDebug -libs:static -dbglibs) + set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_SingleThreadedDebugDLL -libs:dll -dbglibs) +endif() diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index df3bd1e..4279a74 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -298,6 +298,14 @@ endforeach() string(APPEND CMAKE_STATIC_LINKER_FLAGS_INIT " ${_MACHINE_ARCH_FLAG}") unset(_MACHINE_ARCH_FLAG) +cmake_policy(GET CMP0091 __WINDOWS_MSVC_CMP0091) +if(__WINDOWS_MSVC_CMP0091 STREQUAL "NEW") + set(CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT "MultiThreaded$<$:Debug>DLL") +else() + set(CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT "") +endif() +unset(__WINDOWS_MSVC_CMP0091) + macro(__windows_compiler_msvc lang) if(NOT MSVC_VERSION LESS 1400) # for 2005 make sure the manifest is put in the dll with mt @@ -351,21 +359,35 @@ macro(__windows_compiler_msvc lang) if("x${lang}" STREQUAL "xC" OR "x${lang}" STREQUAL "xCXX") + if(CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT) + set(_MDd "") + set(_MD "") + else() + set(_MDd " /MDd") + set(_MD " /MD") + endif() if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*") # note: MSVC 14 2015 Update 1 sets -fno-ms-compatibility by default, but this does not allow one to compile many projects # that include MS's own headers. CMake itself is affected project too. string(APPEND CMAKE_${lang}_FLAGS_INIT " ${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} -fms-extensions -fms-compatibility -D_WINDOWS -Wall${_FLAGS_${lang}}") - string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " /MDd -gline-tables-only -fno-inline -O0 ${_RTC1}") - string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " /MD -O2 -DNDEBUG") - string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " /MD -gline-tables-only -O2 -fno-inline -DNDEBUG") - string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " /MD -DNDEBUG") # TODO: Add '-Os' once VS generator maps it properly for Clang + string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT "${_MDd} -gline-tables-only -fno-inline -O0 ${_RTC1}") + string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT "${_MD} -O2 -DNDEBUG") + string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "${_MD} -gline-tables-only -O2 -fno-inline -DNDEBUG") + string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "${_MD} -DNDEBUG") # TODO: Add '-Os' once VS generator maps it properly for Clang else() string(APPEND CMAKE_${lang}_FLAGS_INIT " ${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3${_FLAGS_${lang}}") - string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " /MDd /Zi /Ob0 /Od ${_RTC1}") - string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " /MD /O2 /Ob2 /DNDEBUG") - string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " /MD /Zi /O2 /Ob1 /DNDEBUG") - string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " /MD /O1 /Ob1 /DNDEBUG") + string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT "${_MDd} /Zi /Ob0 /Od ${_RTC1}") + string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT "${_MD} /O2 /Ob2 /DNDEBUG") + string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "${_MD} /Zi /O2 /Ob1 /DNDEBUG") + string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "${_MD} /O1 /Ob1 /DNDEBUG") endif() + unset(_MDd) + unset(_MD) + + set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded -MT) + set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL -MD) + set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug -MTd) + set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL -MDd) endif() set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON) set(CMAKE_NINJA_DEPTYPE_${lang} msvc) diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index dcb1ff5..897f7a8 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -20,6 +20,7 @@ #include "cmSystemTools.h" #include "cmTarget.h" #include "cmVersion.h" +#include "cm_static_string_view.hxx" #include "cmake.h" static std::string const kCMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN = @@ -42,6 +43,8 @@ static std::string const kCMAKE_LINK_SEARCH_END_STATIC = "CMAKE_LINK_SEARCH_END_STATIC"; static std::string const kCMAKE_LINK_SEARCH_START_STATIC = "CMAKE_LINK_SEARCH_START_STATIC"; +static std::string const kCMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT = + "CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT"; static std::string const kCMAKE_OSX_ARCHITECTURES = "CMAKE_OSX_ARCHITECTURES"; static std::string const kCMAKE_OSX_DEPLOYMENT_TARGET = "CMAKE_OSX_DEPLOYMENT_TARGET"; @@ -500,6 +503,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, fprintf(fout, "set(CMAKE_MODULE_PATH \"%s\")\n", def); } + /* Set MSVC runtime library policy to match our selection. */ + if (const char* msvcRuntimeLibraryDefault = + this->Makefile->GetDefinition(kCMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT)) { + fprintf(fout, "cmake_policy(SET CMP0091 %s)\n", + *msvcRuntimeLibraryDefault ? "NEW" : "OLD"); + } + std::string projectLangs; for (std::string const& li : testLangs) { projectLangs += " " + li; @@ -660,6 +670,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, vars.insert(kCMAKE_SYSROOT_COMPILE); vars.insert(kCMAKE_SYSROOT_LINK); vars.insert(kCMAKE_WARN_DEPRECATED); + vars.emplace("CMAKE_MSVC_RUNTIME_LIBRARY"_s); if (const char* varListStr = this->Makefile->GetDefinition( kCMAKE_TRY_COMPILE_PLATFORM_VARIABLES)) { diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 67763d4..8b51834 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -6,6 +6,7 @@ #include "cmComputeLinkInformation.h" #include "cmCustomCommandGenerator.h" #include "cmGeneratedFileStream.h" +#include "cmGeneratorExpression.h" #include "cmGeneratorExpressionEvaluationFile.h" #include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" @@ -1519,8 +1520,40 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags, flagsVar += "_FLAGS"; this->AddConfigVariableFlags(flags, flagsVar, config); - // Placeholder for possible future per-target flags. - static_cast(target); + // Add MSVC runtime library flags. This is activated by the presence + // of a default selection whether or not it is overridden by a property. + const char* msvcRuntimeLibraryDefault = + this->Makefile->GetDefinition("CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT"); + if (msvcRuntimeLibraryDefault && *msvcRuntimeLibraryDefault) { + const char* msvcRuntimeLibraryValue = + target->GetProperty("MSVC_RUNTIME_LIBRARY"); + if (!msvcRuntimeLibraryValue) { + msvcRuntimeLibraryValue = msvcRuntimeLibraryDefault; + } + cmGeneratorExpression ge; + std::unique_ptr cge = + ge.Parse(msvcRuntimeLibraryValue); + std::string const msvcRuntimeLibrary = + cge->Evaluate(this, config, false, target); + if (!msvcRuntimeLibrary.empty()) { + if (const char* msvcRuntimeLibraryOptions = + this->Makefile->GetDefinition( + "CMAKE_" + lang + "_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_" + + msvcRuntimeLibrary)) { + this->AppendCompileOptions(flags, msvcRuntimeLibraryOptions); + } else if ((this->Makefile->GetSafeDefinition( + "CMAKE_" + lang + "_COMPILER_ID") == "MSVC" || + this->Makefile->GetSafeDefinition( + "CMAKE_" + lang + "_SIMULATE_ID") == "MSVC") && + !cmSystemTools::GetErrorOccuredFlag()) { + // The compiler uses the MSVC ABI so it needs a known runtime library. + this->IssueMessage(MessageType::FATAL_ERROR, + "MSVC_RUNTIME_LIBRARY value '" + + msvcRuntimeLibrary + "' not known for this " + + lang + " compiler."); + } + } + } } void cmLocalGenerator::AddLanguageFlagsForLinking( diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 02a6295..113dd35 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -267,7 +267,10 @@ class cmMakefile; 15, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0090, \ "export(PACKAGE) does not populate package registry by default.", 3, \ - 15, 0, cmPolicies::WARN) + 15, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0091, \ + "MSVC runtime library flags are selected by an abstraction.", 3, 15, \ + 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/Source/cmTarget.cxx b/Source/cmTarget.cxx index dc9b6d2..9598a3f 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -304,6 +304,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, InitProperty("AUTORCC_OPTIONS", nullptr); InitProperty("LINK_DEPENDS_NO_SHARED", nullptr); InitProperty("LINK_INTERFACE_LIBRARIES", nullptr); + InitProperty("MSVC_RUNTIME_LIBRARY", nullptr); InitProperty("WIN32_EXECUTABLE", nullptr); InitProperty("MACOSX_BUNDLE", nullptr); InitProperty("MACOSX_RPATH", nullptr); diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 3746965..4114a67 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1995,6 +1995,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang") ADD_TEST_MACRO(PrecompiledHeader foo) endif() + ADD_TEST_MACRO(MSVCRuntimeLibrary) + if(CMAKE_Fortran_COMPILER) + ADD_TEST_MACRO(MSVCRuntimeLibrary.Fortran) + endif() endif() if(MSVC OR "${CMAKE_GENERATOR}" MATCHES "(MSYS|MinGW) Makefiles") diff --git a/Tests/MSVCRuntimeLibrary/CMakeLists.txt b/Tests/MSVCRuntimeLibrary/CMakeLists.txt new file mode 100644 index 0000000..b7a6e86 --- /dev/null +++ b/Tests/MSVCRuntimeLibrary/CMakeLists.txt @@ -0,0 +1,49 @@ +cmake_minimum_required(VERSION 3.14) +cmake_policy(SET CMP0091 NEW) +project(MSVCRuntimeLibrary) + +function(verify_combinations threads lang src) + set(verify_tc_config_ Release) + set(verify_tc_config_Debug Debug) + set(verify_def_MultiThreaded -DVERIFY_MT) + set(verify_def_Debug -DVERIFY_DEBUG) + set(verify_def_DLL -DVERIFY_DLL) + foreach(dbg "" Debug) + foreach(dll "" DLL) + # Construct the name of this runtime library combination. + set(rtl "${threads}${dbg}${dll}") + + # Test that try_compile builds with this RTL. + set(CMAKE_MSVC_RUNTIME_LIBRARY "${rtl}") + set(CMAKE_TRY_COMPILE_CONFIGURATION "${verify_tc_config_${dbg}}") + set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY") + try_compile(${rtl}_COMPILES + ${CMAKE_CURRENT_BINARY_DIR}/try_compile/${rtl} + ${CMAKE_CURRENT_SOURCE_DIR}/${src} + COMPILE_DEFINITIONS ${verify_def_${threads}} ${verify_def_${dbg}} ${verify_def_${dll}} + OUTPUT_VARIABLE ${rtl}_OUTPUT + ) + if(${rtl}_COMPILES) + message(STATUS "try_compile with ${rtl} worked") + else() + string(REPLACE "\n" "\n " ${rtl}_OUTPUT " ${${rtl}_OUTPUT}") + message(SEND_ERROR "try_compile with ${rtl} failed:\n${${rtl}_OUTPUT}") + endif() + + # Test that targets build with this RTL. + set(CMAKE_MSVC_RUNTIME_LIBRARY "$<$>:${rtl}>$<$>:BadContent>") + add_library(${rtl}-${lang} ${src}) + set_property(TARGET ${rtl}-${lang} PROPERTY BOOL_TRUE TRUE) + target_compile_definitions(${rtl}-${lang} PRIVATE ${verify_def_${threads}} ${verify_def_${dbg}} ${verify_def_${dll}}) + endforeach() + endforeach() +endfunction() + +function(verify lang src) + add_library(default-${lang} ${src}) + target_compile_definitions(default-${lang} PRIVATE VERIFY_MT VERIFY_DLL "$<$:VERIFY_DEBUG>") + verify_combinations(MultiThreaded ${lang} ${src}) +endfunction() + +verify(C verify.c) +verify(CXX verify.cxx) diff --git a/Tests/MSVCRuntimeLibrary/Fortran/CMakeLists.txt b/Tests/MSVCRuntimeLibrary/Fortran/CMakeLists.txt new file mode 100644 index 0000000..169ba07 --- /dev/null +++ b/Tests/MSVCRuntimeLibrary/Fortran/CMakeLists.txt @@ -0,0 +1,50 @@ +cmake_minimum_required(VERSION 3.14) +cmake_policy(SET CMP0091 NEW) +project(MSVCRuntimeLibraryFortran Fortran) + +foreach(t MultiThreaded SingleThreaded) + foreach(dbg "" Debug) + foreach(dll "" DLL) + set(var "CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_${t}${dbg}${dll}") + # ifort does not actually define these, so inject them + string(REPLACE "-threads" "-threads;-D_MT" "${var}" "${${var}}") + string(REPLACE "-dbglibs" "-dbglibs;-D_DEBUG" "${var}" "${${var}}") + endforeach() + endforeach() +endforeach() +string(APPEND CMAKE_Fortran_FLAGS " -w") + +function(verify_combinations threads lang src) + set(verify_tc_config_ Release) + set(verify_tc_config_Debug Debug) + set(verify_def_MultiThreaded -DVERIFY_MT) + set(verify_def_Debug -DVERIFY_DEBUG) + set(verify_def_DLL -DVERIFY_DLL) + foreach(dbg "" Debug) + foreach(dll "" DLL) + # Construct the name of this runtime library combination. + set(rtl "${threads}${dbg}${dll}") + + # Test that targets build with this RTL. + set(CMAKE_MSVC_RUNTIME_LIBRARY "$<$>:${rtl}>$<$>:BadContent>") + add_library(${rtl}-${lang} ${src}) + set_property(TARGET ${rtl}-${lang} PROPERTY BOOL_TRUE TRUE) + target_compile_definitions(${rtl}-${lang} PRIVATE ${verify_def_${threads}} ${verify_def_${dbg}} ${verify_def_${dll}}) + endforeach() + endforeach() +endfunction() + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +function(verify lang src) + add_library(default-${lang} ${src}) + target_compile_definitions(default-${lang} PRIVATE VERIFY_MT VERIFY_DLL "$<$:VERIFY_DEBUG>") + verify_combinations(MultiThreaded ${lang} ${src}) +endfunction() + +verify(Fortran verify.F90) +# Intel Fortran for Windows supports single-threaded RTL but it is +# not implemented by the Visual Studio integration. +if(NOT CMAKE_GENERATOR MATCHES "Visual Studio") + verify_combinations(SingleThreaded Fortran verify.F90) +endif() diff --git a/Tests/MSVCRuntimeLibrary/Fortran/verify.F90 b/Tests/MSVCRuntimeLibrary/Fortran/verify.F90 new file mode 100644 index 0000000..6fe5e05 --- /dev/null +++ b/Tests/MSVCRuntimeLibrary/Fortran/verify.F90 @@ -0,0 +1 @@ +#include "../verify.h" diff --git a/Tests/MSVCRuntimeLibrary/verify.c b/Tests/MSVCRuntimeLibrary/verify.c new file mode 100644 index 0000000..741bca6 --- /dev/null +++ b/Tests/MSVCRuntimeLibrary/verify.c @@ -0,0 +1 @@ +#include "verify.h" diff --git a/Tests/MSVCRuntimeLibrary/verify.cxx b/Tests/MSVCRuntimeLibrary/verify.cxx new file mode 100644 index 0000000..741bca6 --- /dev/null +++ b/Tests/MSVCRuntimeLibrary/verify.cxx @@ -0,0 +1 @@ +#include "verify.h" diff --git a/Tests/MSVCRuntimeLibrary/verify.h b/Tests/MSVCRuntimeLibrary/verify.h new file mode 100644 index 0000000..58d65fe --- /dev/null +++ b/Tests/MSVCRuntimeLibrary/verify.h @@ -0,0 +1,29 @@ +#ifdef VERIFY_DEBUG +# ifndef _DEBUG +# error "_DEBUG not defined by debug runtime library selection" +# endif +#else +# ifdef _DEBUG +# error "_DEBUG defined by non-debug runtime library selection" +# endif +#endif + +#ifdef VERIFY_DLL +# ifndef _DLL +# error "_DLL not defined by DLL runtime library selection" +# endif +#else +# ifdef _DLL +# error "_DLL defined by non-DLL runtime library selection" +# endif +#endif + +#ifdef VERIFY_MT +# ifndef _MT +# error "_MT not defined by multi-threaded runtime library selection" +# endif +#else +# ifdef _MT +# error "_MT defined by single-threaded runtime library selection" +# endif +#endif diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 68411d6..a8dcb4b 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -195,6 +195,9 @@ add_RunCMake_test(LinkStatic) if(CMAKE_CXX_COMPILER_ID MATCHES "^(Cray|PGI|XL|XLClang)$") add_RunCMake_test(MetaCompileFeatures) endif() +if(MSVC) + add_RunCMake_test(MSVCRuntimeLibrary) +endif() add_RunCMake_test(ObjectLibrary) add_RunCMake_test(ParseImplicitIncludeInfo) if(UNIX AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG AND CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF") diff --git a/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-NEW-result.txt b/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-NEW-stderr.txt b/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-NEW-stderr.txt new file mode 100644 index 0000000..803058d --- /dev/null +++ b/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-NEW-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error in CMakeLists.txt: + MSVC_RUNTIME_LIBRARY value 'BogusValue' not known for this C compiler.$ diff --git a/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-NEW.cmake b/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-NEW.cmake new file mode 100644 index 0000000..c3ea2fd --- /dev/null +++ b/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0091 NEW) +include(CMP0091-common.cmake) diff --git a/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-OLD.cmake b/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-OLD.cmake new file mode 100644 index 0000000..734cc9f --- /dev/null +++ b/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0091 OLD) +include(CMP0091-common.cmake) diff --git a/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-WARN.cmake b/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-WARN.cmake new file mode 100644 index 0000000..26f86a0 --- /dev/null +++ b/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-WARN.cmake @@ -0,0 +1,2 @@ + +include(CMP0091-common.cmake) diff --git a/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-common.cmake b/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-common.cmake new file mode 100644 index 0000000..7827d2a --- /dev/null +++ b/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-common.cmake @@ -0,0 +1,37 @@ +enable_language(C) + +cmake_policy(GET CMP0091 cmp0091) +if(cmp0091 STREQUAL "NEW") + if(NOT CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT) + message(SEND_ERROR "CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT not set under NEW behavior") + endif() +else() + if(CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT) + message(SEND_ERROR "CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT is set under OLD behavior") + endif() +endif() + +if(CMAKE_C_COMPILER_ID STREQUAL "MSVC") + if(CMAKE_C_FLAGS_DEBUG MATCHES "[/-]MDd( |$)") + set(have_MDd 1) + else() + set(have_MDd 0) + endif() + if(CMAKE_C_FLAGS_RELEASE MATCHES "[/-]MD( |$)") + set(have_MD 1) + else() + set(have_MD 0) + endif() + if(cmp0091 STREQUAL "NEW") + if(have_MDd OR have_MD) + message(SEND_ERROR "Have a -MD* flag under NEW behavior.") + endif() + else() + if(NOT (have_MDd AND have_MD)) + message(SEND_ERROR "Do not have -MD* flags under OLD behavior.") + endif() + endif() +endif() + +set(CMAKE_MSVC_RUNTIME_LIBRARY BogusValue) +add_library(foo empty.c) diff --git a/Tests/RunCMake/MSVCRuntimeLibrary/CMakeLists.txt b/Tests/RunCMake/MSVCRuntimeLibrary/CMakeLists.txt new file mode 100644 index 0000000..3e470a2 --- /dev/null +++ b/Tests/RunCMake/MSVCRuntimeLibrary/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.14) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/MSVCRuntimeLibrary/RunCMakeTest.cmake b/Tests/RunCMake/MSVCRuntimeLibrary/RunCMakeTest.cmake new file mode 100644 index 0000000..fad18da --- /dev/null +++ b/Tests/RunCMake/MSVCRuntimeLibrary/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0091-WARN) +run_cmake(CMP0091-OLD) +run_cmake(CMP0091-NEW) diff --git a/Tests/RunCMake/MSVCRuntimeLibrary/empty.c b/Tests/RunCMake/MSVCRuntimeLibrary/empty.c new file mode 100644 index 0000000..e69de29 diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index df253a9..988312b 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -2,6 +2,7 @@ include(RunCMake) run_cmake(VsCSharpCompilerOpts) run_cmake(ExplicitCMakeLists) +run_cmake(RuntimeLibrary) run_cmake(SourceGroupCMakeLists) run_cmake(VsConfigurationType) diff --git a/Tests/RunCMake/VS10Project/RuntimeLibrary-check.cmake b/Tests/RunCMake/VS10Project/RuntimeLibrary-check.cmake new file mode 100644 index 0000000..6b43d47 --- /dev/null +++ b/Tests/RunCMake/VS10Project/RuntimeLibrary-check.cmake @@ -0,0 +1,34 @@ +macro(RuntimeLibrary_check tgt rtl_expect) + set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/${tgt}.vcxproj") + if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not exist.") + return() + endif() + + set(HAVE_Runtimelibrary 0) + + file(STRINGS "${vcProjectFile}" lines) + foreach(line IN LISTS lines) + if(line MATCHES "^ *([^<>]+)") + set(rtl_actual "${CMAKE_MATCH_1}") + if(NOT "${rtl_actual}" STREQUAL "${rtl_expect}") + set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj has RuntimeLibrary '${rtl_actual}', not '${rtl_expect}'.") + return() + endif() + set(HAVE_Runtimelibrary 1) + break() + endif() + endforeach() + + if(NOT HAVE_Runtimelibrary) + set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a RuntimeLibrary field.") + return() + endif() +endmacro() + +RuntimeLibrary_check(default-C MultiThreadedDebugDLL) +RuntimeLibrary_check(default-CXX MultiThreadedDebugDLL) +RuntimeLibrary_check(MTd-C MultiThreadedDebug) +RuntimeLibrary_check(MTd-CXX MultiThreadedDebug) +RuntimeLibrary_check(MT-C MultiThreaded) +RuntimeLibrary_check(MT-CXX MultiThreaded) diff --git a/Tests/RunCMake/VS10Project/RuntimeLibrary.cmake b/Tests/RunCMake/VS10Project/RuntimeLibrary.cmake new file mode 100644 index 0000000..6c77a25 --- /dev/null +++ b/Tests/RunCMake/VS10Project/RuntimeLibrary.cmake @@ -0,0 +1,16 @@ +set(CMAKE_CONFIGURATION_TYPES Debug) +cmake_policy(SET CMP0091 NEW) +enable_language(C) +enable_language(CXX) + +add_library(default-C empty.c) +add_library(default-CXX empty.cxx) + +set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDebug") +add_library(MTd-C empty.c) +add_library(MTd-CXX empty.cxx) + +add_library(MT-C empty.c) +set_property(TARGET MT-C PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded") +add_library(MT-CXX empty.cxx) +set_property(TARGET MT-CXX PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded") diff --git a/Tests/RunCMake/VS10Project/empty.c b/Tests/RunCMake/VS10Project/empty.c new file mode 100644 index 0000000..e69de29 diff --git a/Tests/RunCMake/VS10Project/empty.cxx b/Tests/RunCMake/VS10Project/empty.cxx new file mode 100644 index 0000000..e69de29 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5cd187147ecbd29a0afc5a6b49f2232b61a1ab8c commit 5cd187147ecbd29a0afc5a6b49f2232b61a1ab8c Merge: 0238295 8e4899f Author: Brad King AuthorDate: Wed Apr 17 14:58:18 2019 +0000 Commit: Kitware Robot CommitDate: Wed Apr 17 10:58:49 2019 -0400 Merge topic 'memorize_msvc_like_compilers_C_support' 8e4899fd6c CompileFeatures: Record which C features the MSVC compiler supports Acked-by: Kitware Robot Merge-request: !3226 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0238295c7e9d19340e968b766d6d0cf07fc5af50 commit 0238295c7e9d19340e968b766d6d0cf07fc5af50 Merge: 87609ee c648551 Author: Brad King AuthorDate: Wed Apr 17 10:57:47 2019 -0400 Commit: Brad King CommitDate: Wed Apr 17 10:57:47 2019 -0400 Merge branch 'release-3.14' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8e4899fd6cb3518723710f7ba57d28ef058518c0 commit 8e4899fd6cb3518723710f7ba57d28ef058518c0 Author: Robert Maynard AuthorDate: Fri Apr 12 14:39:57 2019 -0400 Commit: Robert Maynard CommitDate: Fri Apr 12 14:39:57 2019 -0400 CompileFeatures: Record which C features the MSVC compiler supports Use the infrastructure added by commit f92ccbc306c20554af (CompileFeatures: memoize C compilers with full language level support) to avoid using a `try_compile` to check for C 90/99/11 feature support when the running compiler is known to have a fixed set of feature support. diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake index ff51d30..0448965 100644 --- a/Modules/Compiler/Clang-C.cmake +++ b/Modules/Compiler/Clang-C.cmake @@ -23,12 +23,15 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) # clang-cl doesn't have any of these set(CMAKE_C90_STANDARD_COMPILE_OPTION "") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "") + set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_C99_STANDARD_COMPILE_OPTION "") set(CMAKE_C99_EXTENSION_COMPILE_OPTION "") + set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_C11_STANDARD_COMPILE_OPTION "") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "") + set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) endif() endif() diff --git a/Modules/Compiler/MSVC-C.cmake b/Modules/Compiler/MSVC-C.cmake index 22c34f8..a722130 100644 --- a/Modules/Compiler/MSVC-C.cmake +++ b/Modules/Compiler/MSVC-C.cmake @@ -11,8 +11,8 @@ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "") # There is no meaningful default for this set(CMAKE_C_STANDARD_DEFAULT "") -# There are no C compiler modes so we only need to test features once. -# Override the default macro for this special case. Pretend that +# There are no C compiler modes so we hard-code the known compiler supported +# features. Override the default macro for this special case. Pretend that # all language standards are available so that at least compilation # can be attempted. macro(cmake_record_c_compile_features) @@ -20,6 +20,10 @@ macro(cmake_record_c_compile_features) c_std_90 c_std_99 c_std_11 + c_function_prototypes + c_variadic_macros ) - _record_compiler_features(C "" CMAKE_C_COMPILE_FEATURES) + list(APPEND CMAKE_C90_COMPILE_FEATURES c_std_90 c_function_prototypes) + list(APPEND CMAKE_C99_COMPILE_FEATURES c_std_99 c_variadic_macros) + list(APPEND CMAKE_C11_COMPILE_FEATURES c_std_11) endmacro() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f621e7fa5df8d35cc379f9f7825f3d75b8489876 commit f621e7fa5df8d35cc379f9f7825f3d75b8489876 Author: Brad King AuthorDate: Fri Apr 5 17:48:06 2019 -0400 Commit: Brad King CommitDate: Wed Apr 10 13:40:25 2019 -0400 VS: Fix Fortran runtime library flag map special case for '-' options diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index e8b2668..e1b0c70 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -374,19 +374,19 @@ void cmVisualStudioGeneratorOptions::StoreUnknownFlag(std::string const& flag) { // Look for Intel Fortran flags that do not map well in the flag table. if (this->CurrentTool == FortranCompiler) { - if (flag == "/dbglibs") { + if (flag == "/dbglibs" || flag == "-dbglibs") { this->FortranRuntimeDebug = true; return; } - if (flag == "/threads") { + if (flag == "/threads" || flag == "-threads") { this->FortranRuntimeMT = true; return; } - if (flag == "/libs:dll") { + if (flag == "/libs:dll" || flag == "-libs:dll") { this->FortranRuntimeDLL = true; return; } - if (flag == "/libs:static") { + if (flag == "/libs:static" || flag == "-libs:static") { this->FortranRuntimeDLL = false; return; } ----------------------------------------------------------------------- Summary of changes: Help/command/try_compile.rst | 1 + Help/manual/cmake-policies.7.rst | 1 + Help/manual/cmake-properties.7.rst | 1 + Help/manual/cmake-variables.7.rst | 1 + Help/policy/CMP0091.rst | 47 ++++++++++++++++++++ Help/prop_tgt/MSVC_RUNTIME_LIBRARY-VALUES.txt | 15 +++++++ Help/prop_tgt/MSVC_RUNTIME_LIBRARY.rst | 26 +++++++++++ Help/release/dev/msvc-runtime-library.rst | 7 +++ Help/variable/CMAKE_MSVC_RUNTIME_LIBRARY.rst | 27 ++++++++++++ Modules/Compiler/Clang-C.cmake | 3 ++ Modules/Compiler/MSVC-C.cmake | 10 +++-- Modules/Platform/Windows-Intel-Fortran.cmake | 30 ++++++++++++- Modules/Platform/Windows-MSVC.cmake | 38 ++++++++++++---- Source/cmCoreTryCompile.cxx | 11 +++++ Source/cmLocalGenerator.cxx | 37 +++++++++++++++- Source/cmPolicies.h | 5 ++- Source/cmTarget.cxx | 1 + Source/cmVisualStudioGeneratorOptions.cxx | 8 ++-- Tests/CMakeLists.txt | 4 ++ Tests/MSVCRuntimeLibrary/CMakeLists.txt | 49 +++++++++++++++++++++ Tests/MSVCRuntimeLibrary/Fortran/CMakeLists.txt | 50 ++++++++++++++++++++++ Tests/MSVCRuntimeLibrary/Fortran/verify.F90 | 1 + Tests/MSVCRuntimeLibrary/verify.c | 1 + Tests/MSVCRuntimeLibrary/verify.cxx | 1 + Tests/MSVCRuntimeLibrary/verify.h | 29 +++++++++++++ Tests/RunCMake/CMakeLists.txt | 3 ++ .../CMP0091-NEW-result.txt} | 0 .../MSVCRuntimeLibrary/CMP0091-NEW-stderr.txt | 2 + .../RunCMake/MSVCRuntimeLibrary/CMP0091-NEW.cmake | 2 + .../RunCMake/MSVCRuntimeLibrary/CMP0091-OLD.cmake | 2 + .../RunCMake/MSVCRuntimeLibrary/CMP0091-WARN.cmake | 2 + .../MSVCRuntimeLibrary/CMP0091-common.cmake | 37 ++++++++++++++++ .../CMakeLists.txt | 0 .../RunCMake/MSVCRuntimeLibrary/RunCMakeTest.cmake | 5 +++ .../empty.c | 0 Tests/RunCMake/VS10Project/RunCMakeTest.cmake | 1 + .../VS10Project/RuntimeLibrary-check.cmake | 34 +++++++++++++++ Tests/RunCMake/VS10Project/RuntimeLibrary.cmake | 16 +++++++ .../{target_link_libraries => VS10Project}/empty.c | 0 .../VS10Project/empty.cxx} | 0 40 files changed, 488 insertions(+), 20 deletions(-) create mode 100644 Help/policy/CMP0091.rst create mode 100644 Help/prop_tgt/MSVC_RUNTIME_LIBRARY-VALUES.txt create mode 100644 Help/prop_tgt/MSVC_RUNTIME_LIBRARY.rst create mode 100644 Help/release/dev/msvc-runtime-library.rst create mode 100644 Help/variable/CMAKE_MSVC_RUNTIME_LIBRARY.rst create mode 100644 Tests/MSVCRuntimeLibrary/CMakeLists.txt create mode 100644 Tests/MSVCRuntimeLibrary/Fortran/CMakeLists.txt create mode 100644 Tests/MSVCRuntimeLibrary/Fortran/verify.F90 create mode 100644 Tests/MSVCRuntimeLibrary/verify.c create mode 100644 Tests/MSVCRuntimeLibrary/verify.cxx create mode 100644 Tests/MSVCRuntimeLibrary/verify.h copy Tests/RunCMake/{while/MissingArgument-result.txt => MSVCRuntimeLibrary/CMP0091-NEW-result.txt} (100%) create mode 100644 Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-NEW-stderr.txt create mode 100644 Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-NEW.cmake create mode 100644 Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-OLD.cmake create mode 100644 Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-WARN.cmake create mode 100644 Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-common.cmake copy Tests/RunCMake/{MetaCompileFeatures => MSVCRuntimeLibrary}/CMakeLists.txt (100%) create mode 100644 Tests/RunCMake/MSVCRuntimeLibrary/RunCMakeTest.cmake copy Tests/RunCMake/{target_link_libraries => MSVCRuntimeLibrary}/empty.c (100%) create mode 100644 Tests/RunCMake/VS10Project/RuntimeLibrary-check.cmake create mode 100644 Tests/RunCMake/VS10Project/RuntimeLibrary.cmake copy Tests/RunCMake/{target_link_libraries => VS10Project}/empty.c (100%) copy Tests/{Wrapping/vtkIncluded.cxx => RunCMake/VS10Project/empty.cxx} (100%) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Apr 17 11:03:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 17 Apr 2019 11:03:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.14.2-8-gc648551 Message-ID: <20190417150304.5E512FA993@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 c648551bea65c6457f21b608f31c4ccd5b69a0fa (commit) via 844050adaf4ff28356a14b34d3ec73f36e843339 (commit) from 09fba6146fa726a83cbbccc3d5fb288f7f14f111 (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/FindOpenGL.cmake | 3 +++ 1 file changed, 3 insertions(+) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Apr 18 00:03:07 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 18 Apr 2019 00:03:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.2-742-g44c6acc Message-ID: <20190418040307.F3997102ED0@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 44c6acc053ebaf0565408a1395ea1bde5d105305 (commit) from 2ed688a863671d58513055ad56ab04d6be05295b (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=44c6acc053ebaf0565408a1395ea1bde5d105305 commit 44c6acc053ebaf0565408a1395ea1bde5d105305 Author: Kitware Robot AuthorDate: Thu Apr 18 00:01:03 2019 -0400 Commit: Kitware Robot CommitDate: Thu Apr 18 00:01:03 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b7b278b..d4d5da5 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 14) -set(CMake_VERSION_PATCH 20190417) +set(CMake_VERSION_PATCH 20190418) #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 Apr 18 11:03:08 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 18 Apr 2019 11:03:08 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.2-746-g52ef218 Message-ID: <20190418150308.7CE2FFAA7C@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 52ef218664ff3bb4c162cf9e722756a22e6dc2e3 (commit) via 0e4739140028932879643609e88b90eb0145dcbe (commit) via fb15c27562856e01565d6903d38b9c4ab73c3fa8 (commit) via 0225b05afea1d291e37e29b361f4252c4313aab2 (commit) from 44c6acc053ebaf0565408a1395ea1bde5d105305 (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=52ef218664ff3bb4c162cf9e722756a22e6dc2e3 commit 52ef218664ff3bb4c162cf9e722756a22e6dc2e3 Merge: 44c6acc 0e47391 Author: Brad King AuthorDate: Thu Apr 18 15:01:35 2019 +0000 Commit: Kitware Robot CommitDate: Thu Apr 18 11:01:50 2019 -0400 Merge topic 'update-kwsys' 0e47391400 bootstrap: Update for new KWSys configuration option fb15c27562 Merge branch 'upstream-KWSys' into update-kwsys 0225b05afe KWSys 2019-04-17 (c42b92f0) Acked-by: Kitware Robot Merge-request: !3242 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0e4739140028932879643609e88b90eb0145dcbe commit 0e4739140028932879643609e88b90eb0145dcbe Author: Brad King AuthorDate: Wed Apr 17 10:13:19 2019 -0400 Commit: Brad King CommitDate: Wed Apr 17 10:13:19 2019 -0400 bootstrap: Update for new KWSys configuration option diff --git a/bootstrap b/bootstrap index d46b8a8..8b9c404 100755 --- a/bootstrap +++ b/bootstrap @@ -685,6 +685,7 @@ cmake_kwsys_config_replace_string () s/@KWSYS_NAME_IS_KWSYS@/${KWSYS_NAME_IS_KWSYS}/g; s/@KWSYS_STL_HAS_WSTRING@/${KWSYS_STL_HAS_WSTRING}/g; s/@KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H@/${KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H}/g; + s/@KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP@/${KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP}/g; }" "${INFILE}" >> "${OUTFILE}${_tmp}" if [ -f "${OUTFILE}${_tmp}" ]; then if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then @@ -1217,6 +1218,7 @@ KWSYS_CXX_HAS_UNSETENV=0 KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=0 KWSYS_CXX_HAS_UTIMENSAT=0 KWSYS_CXX_HAS_UTIMES=0 +KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP=1 if cmake_try_run "${cmake_cxx_compiler}" \ "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_SETENV" \ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fb15c27562856e01565d6903d38b9c4ab73c3fa8 commit fb15c27562856e01565d6903d38b9c4ab73c3fa8 Merge: 8d5eb97 0225b05 Author: Brad King AuthorDate: Wed Apr 17 09:50:14 2019 -0400 Commit: Brad King CommitDate: Wed Apr 17 09:50:14 2019 -0400 Merge branch 'upstream-KWSys' into update-kwsys * upstream-KWSys: KWSys 2019-04-17 (c42b92f0) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0225b05afea1d291e37e29b361f4252c4313aab2 commit 0225b05afea1d291e37e29b361f4252c4313aab2 Author: KWSys Upstream AuthorDate: Wed Apr 17 09:49:30 2019 -0400 Commit: Brad King CommitDate: Wed Apr 17 09:50:13 2019 -0400 KWSys 2019-04-17 (c42b92f0) Code extracted from: https://gitlab.kitware.com/utils/kwsys.git at commit c42b92f0fe01cf588aacc1984501b4fdcc58994e (master). Upstream Shortlog ----------------- Ben Boeckel (1): 84bd7c9e SystemTools: support hiding the translation map Sebastian Holtermann (8): 00a3a436 SystemTools: Update buffered env value string only on a change d6235796 SystemTools: Optimize iterator lifetime in JoinPath 9992f69b SystemTools: Optimize range loop in FindName method 8c9ca162 SystemTools: Optimize range loop in FindProgram method c7e3ab12 SystemTools: Optimize range loop in FindProgram method ac8d2033 SystemTools: Optimize range loop in FindLibrary method 815cc593 SystemTools: Optimize range loop in FindProgramPath method 5d8af0d6 SystemTools: Optimize range loop in RelativePath method diff --git a/CMakeLists.txt b/CMakeLists.txt index db4ef90..1302c64 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -465,6 +465,14 @@ IF(KWSYS_USE_DynamicLoader) ENDIF() IF(KWSYS_USE_SystemTools) + if (NOT DEFINED KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP) + set(KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP 1) + endif () + if (KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP) + set(KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP 1) + else () + set(KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP 0) + endif () KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_SETENV "Checking whether CXX compiler has setenv" DIRECT) KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_UNSETENV diff --git a/Configure.hxx.in b/Configure.hxx.in index d1e7464..92ffea3 100644 --- a/Configure.hxx.in +++ b/Configure.hxx.in @@ -11,6 +11,9 @@ /* Whether is available. */ #define @KWSYS_NAMESPACE at _CXX_HAS_EXT_STDIO_FILEBUF_H \ @KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H@ +/* Whether the translation map is available or not. */ +#define @KWSYS_NAMESPACE at _SYSTEMTOOLS_USE_TRANSLATION_MAP \ + @KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP@ #if defined(__SUNPRO_CC) && __SUNPRO_CC > 0x5130 && defined(__has_attribute) # define @KWSYS_NAMESPACE at __has_cpp_attribute(x) __has_attribute(x) @@ -56,6 +59,8 @@ @KWSYS_NAMESPACE at _CXX_HAS_EXT_STDIO_FILEBUF_H # define KWSYS_FALLTHROUGH @KWSYS_NAMESPACE at _FALLTHROUGH # define KWSYS_NULLPTR @KWSYS_NAMESPACE at _NULLPTR +# define KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP \ + @KWSYS_NAMESPACE at _SYSTEMTOOLS_USE_TRANSLATION_MAP #endif #endif diff --git a/SystemTools.cxx b/SystemTools.cxx index 87da80e..e756cdc 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -453,11 +453,13 @@ class SystemToolsStatic { public: typedef std::map StringMap; +#if KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP /** * Path translation table from dir to refdir * Each time 'dir' will be found it will be replace by 'refdir' */ StringMap TranslationMap; +#endif #ifdef _WIN32 static std::string GetCasePathName(std::string const& pathIn); static std::string GetActualCaseForPathCached(std::string const& path); @@ -623,7 +625,9 @@ const char* SystemToolsStatic::GetEnvBuffered(const char* key) std::string env; if (SystemTools::GetEnv(key, env)) { std::string& menv = SystemTools::Statics->EnvMap[key]; - menv = std::move(env); + if (menv != env) { + menv = std::move(env); + } return menv.c_str(); } return KWSYS_NULLPTR; @@ -2810,27 +2814,15 @@ std::string SystemToolsStatic::FindName( SystemTools::GetPath(path); } // now add the additional paths - { - for (std::vector::const_iterator i = userPaths.begin(); - i != userPaths.end(); ++i) { - path.push_back(*i); - } - } - // Add a trailing slash to all paths to aid the search process. - { - for (std::vector::iterator i = path.begin(); i != path.end(); - ++i) { - std::string& p = *i; - if (p.empty() || p.back() != '/') { - p += "/"; - } - } - } + path.reserve(path.size() + userPaths.size()); + path.insert(path.end(), userPaths.begin(), userPaths.end()); // now look for the file std::string tryPath; - for (std::vector::const_iterator p = path.begin(); - p != path.end(); ++p) { - tryPath = *p; + for (std::string const& p : path) { + tryPath = p; + if (tryPath.empty() || tryPath.back() != '/') { + tryPath += '/'; + } tryPath += name; if (SystemTools::FileExists(tryPath)) { return tryPath; @@ -2904,14 +2896,13 @@ std::string SystemTools::FindProgram(const std::string& name, // the end of it // on windows try .com then .exe if (name.size() <= 3 || name[name.size() - 4] != '.') { - extensions.push_back(".com"); - extensions.push_back(".exe"); + extensions.emplace_back(".com"); + extensions.emplace_back(".exe"); // first try with extensions if the os supports them - for (std::vector::iterator i = extensions.begin(); - i != extensions.end(); ++i) { + for (std::string const& ext : extensions) { tryPath = name; - tryPath += *i; + tryPath += ext; if (SystemTools::FileExists(tryPath, true)) { return SystemTools::CollapseFullPath(tryPath); } @@ -2930,43 +2921,33 @@ std::string SystemTools::FindProgram(const std::string& name, SystemTools::GetPath(path); } // now add the additional paths - { - for (std::vector::const_iterator i = userPaths.begin(); - i != userPaths.end(); ++i) { - path.push_back(*i); - } - } + path.reserve(path.size() + userPaths.size()); + path.insert(path.end(), userPaths.begin(), userPaths.end()); // Add a trailing slash to all paths to aid the search process. - { - for (std::vector::iterator i = path.begin(); i != path.end(); - ++i) { - std::string& p = *i; - if (p.empty() || p.back() != '/') { - p += "/"; - } + for (std::string& p : path) { + if (p.empty() || p.back() != '/') { + p += '/'; } } // Try each path - for (std::vector::iterator p = path.begin(); p != path.end(); - ++p) { + for (std::string& p : path) { #ifdef _WIN32 // Remove double quotes from the path on windows - SystemTools::ReplaceString(*p, "\"", ""); + SystemTools::ReplaceString(p, "\"", ""); #endif #if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) // first try with extensions - for (std::vector::iterator ext = extensions.begin(); - ext != extensions.end(); ++ext) { - tryPath = *p; + for (std::string const& ext : extensions) { + tryPath = p; tryPath += name; - tryPath += *ext; + tryPath += ext; if (SystemTools::FileExists(tryPath, true)) { return SystemTools::CollapseFullPath(tryPath); } } #endif // now try it without them - tryPath = *p; + tryPath = p; tryPath += name; if (SystemTools::FileExists(tryPath, true)) { return SystemTools::CollapseFullPath(tryPath); @@ -2980,10 +2961,9 @@ std::string SystemTools::FindProgram(const std::vector& names, const std::vector& path, bool noSystemPath) { - for (std::vector::const_iterator it = names.begin(); - it != names.end(); ++it) { + for (std::string const& name : names) { // Try to find the program. - std::string result = SystemTools::FindProgram(*it, path, noSystemPath); + std::string result = SystemTools::FindProgram(name, path, noSystemPath); if (!result.empty()) { return result; } @@ -3008,27 +2988,18 @@ std::string SystemTools::FindLibrary(const std::string& name, std::vector path; SystemTools::GetPath(path); // now add the additional paths - { - for (std::vector::const_iterator i = userPaths.begin(); - i != userPaths.end(); ++i) { - path.push_back(*i); - } - } + path.reserve(path.size() + userPaths.size()); + path.insert(path.end(), userPaths.begin(), userPaths.end()); // Add a trailing slash to all paths to aid the search process. - { - for (std::vector::iterator i = path.begin(); i != path.end(); - ++i) { - std::string& p = *i; - if (p.empty() || p.back() != '/') { - p += "/"; - } + for (std::string& p : path) { + if (p.empty() || p.back() != '/') { + p += '/'; } } std::string tryPath; - for (std::vector::const_iterator p = path.begin(); - p != path.end(); ++p) { + for (std::string const& p : path) { #if defined(__APPLE__) - tryPath = *p; + tryPath = p; tryPath += name; tryPath += ".framework"; if (SystemTools::FileIsDirectory(tryPath)) { @@ -3036,42 +3007,42 @@ std::string SystemTools::FindLibrary(const std::string& name, } #endif #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__) - tryPath = *p; + tryPath = p; tryPath += name; tryPath += ".lib"; if (SystemTools::FileExists(tryPath, true)) { return SystemTools::CollapseFullPath(tryPath); } #else - tryPath = *p; + tryPath = p; tryPath += "lib"; tryPath += name; tryPath += ".so"; if (SystemTools::FileExists(tryPath, true)) { return SystemTools::CollapseFullPath(tryPath); } - tryPath = *p; + tryPath = p; tryPath += "lib"; tryPath += name; tryPath += ".a"; if (SystemTools::FileExists(tryPath, true)) { return SystemTools::CollapseFullPath(tryPath); } - tryPath = *p; + tryPath = p; tryPath += "lib"; tryPath += name; tryPath += ".sl"; if (SystemTools::FileExists(tryPath, true)) { return SystemTools::CollapseFullPath(tryPath); } - tryPath = *p; + tryPath = p; tryPath += "lib"; tryPath += name; tryPath += ".dylib"; if (SystemTools::FileExists(tryPath, true)) { return SystemTools::CollapseFullPath(tryPath); } - tryPath = *p; + tryPath = p; tryPath += "lib"; tryPath += name; tryPath += ".dll"; @@ -3333,9 +3304,8 @@ bool SystemTools::FindProgramPath(const char* argv0, std::string& pathOut, msg << " argv[0] = \"" << argv0 << "\"\n"; } msg << " Attempted paths:\n"; - std::vector::iterator i; - for (i = failures.begin(); i != failures.end(); ++i) { - msg << " \"" << *i << "\"\n"; + for (std::string const& ff : failures) { + msg << " \"" << ff << "\"\n"; } errorMsg = msg.str(); return false; @@ -3349,6 +3319,7 @@ std::string SystemTools::CollapseFullPath(const std::string& in_relative) return SystemTools::CollapseFullPath(in_relative, KWSYS_NULLPTR); } +#if KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP void SystemTools::AddTranslationPath(const std::string& a, const std::string& b) { @@ -3412,6 +3383,7 @@ void SystemTools::CheckTranslationPath(std::string& path) // Remove the trailing slash we added before. path.pop_back(); } +#endif static void SystemToolsAppendComponents( std::vector& out_components, @@ -3482,6 +3454,7 @@ std::string SystemTools::CollapseFullPath(const std::string& in_path, // Transform the path back to a string. std::string newPath = SystemTools::JoinPath(out_components); +#if KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP // Update the translation table with this potentially new path. I am not // sure why this line is here, it seems really questionable, but yet I // would put good money that if I remove it something will break, basically @@ -3497,6 +3470,7 @@ std::string SystemTools::CollapseFullPath(const std::string& in_path, // SystemTools::AddTranslationPath(newPath, in_path); SystemTools::CheckTranslationPath(newPath); +#endif #ifdef _WIN32 newPath = SystemTools::Statics->GetActualCaseForPathCached(newPath); SystemTools::ConvertToUnixSlashes(newPath); @@ -3558,28 +3532,26 @@ std::string SystemTools::RelativePath(const std::string& local, // for each entry that is not common in the local path // add a ../ to the finalpath array, this gets us out of the local // path into the remote dir - for (unsigned int i = 0; i < localSplit.size(); ++i) { - if (!localSplit[i].empty()) { - finalPath.push_back("../"); + for (std::string const& lp : localSplit) { + if (!lp.empty()) { + finalPath.emplace_back("../"); } } // for each entry that is not common in the remote path add it // to the final path. - for (std::vector::iterator vit = remoteSplit.begin(); - vit != remoteSplit.end(); ++vit) { - if (!vit->empty()) { - finalPath.push_back(*vit); + for (std::string const& rp : remoteSplit) { + if (!rp.empty()) { + finalPath.push_back(rp); } } std::string relativePath; // result string // now turn the array of directories into a unix path by puttint / // between each entry that does not already have one - for (std::vector::iterator vit1 = finalPath.begin(); - vit1 != finalPath.end(); ++vit1) { + for (std::string const& fp : finalPath) { if (!relativePath.empty() && relativePath.back() != '/') { - relativePath += "/"; + relativePath += '/'; } - relativePath += *vit1; + relativePath += fp; } return relativePath; } @@ -3727,8 +3699,7 @@ std::string SystemTools::JoinPath( // Construct result in a single string. std::string result; size_t len = 0; - std::vector::const_iterator i; - for (i = first; i != last; ++i) { + for (std::vector::const_iterator i = first; i != last; ++i) { len += 1 + i->size(); } result.reserve(len); @@ -4737,10 +4708,11 @@ void SystemTools::ClassInitialize() // Create statics singleton instance SystemTools::Statics = new SystemToolsStatic; +#if KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP // Add some special translation paths for unix. These are not added // for windows because drive letters need to be maintained. Also, // there are not sym-links and mount points on windows anyway. -#if !defined(_WIN32) || defined(__CYGWIN__) +# if !defined(_WIN32) || defined(__CYGWIN__) // The tmp path is frequently a logical path so always keep it: SystemTools::AddKeepPath("/tmp/"); @@ -4778,6 +4750,7 @@ void SystemTools::ClassInitialize() } } } +# endif #endif } diff --git a/SystemTools.hxx.in b/SystemTools.hxx.in index cdc9483..dd1266b 100644 --- a/SystemTools.hxx.in +++ b/SystemTools.hxx.in @@ -891,6 +891,7 @@ public: */ static int GetTerminalWidth(); +#if @KWSYS_NAMESPACE at _SYSTEMTOOLS_USE_TRANSLATION_MAP /** * Add an entry in the path translation table. */ @@ -907,6 +908,7 @@ public: * Update path by going through the Path Translation table; */ static void CheckTranslationPath(std::string& path); +#endif /** * Delay the execution for a specified amount of time specified ----------------------------------------------------------------------- Summary of changes: Source/kwsys/CMakeLists.txt | 8 +++ Source/kwsys/Configure.hxx.in | 5 ++ Source/kwsys/SystemTools.cxx | 149 ++++++++++++++++------------------------ Source/kwsys/SystemTools.hxx.in | 2 + bootstrap | 2 + 5 files changed, 78 insertions(+), 88 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Apr 18 11:13:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 18 Apr 2019 11:13:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.2-750-g2e94c11 Message-ID: <20190418151306.06402F8F43@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 2e94c1185b09cc56e9874969b159836606d0c983 (commit) via 9ecb3f8d5c82a86734ee3af3c17a3a08e6b8daa2 (commit) via a000ec7a087b8d221f52960abc5a9785e27551e2 (commit) via 458ea9d76c42b982b48104e700d844a50dc4978c (commit) from 52ef218664ff3bb4c162cf9e722756a22e6dc2e3 (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=2e94c1185b09cc56e9874969b159836606d0c983 commit 2e94c1185b09cc56e9874969b159836606d0c983 Merge: a000ec7 9ecb3f8 Author: Brad King AuthorDate: Thu Apr 18 15:06:58 2019 +0000 Commit: Kitware Robot CommitDate: Thu Apr 18 11:07:07 2019 -0400 Merge topic 'unique' 9ecb3f8d5c Ninja,Makefile: use `unique_ptr` for memory management Acked-by: Kitware Robot Merge-request: !3230 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9ecb3f8d5c82a86734ee3af3c17a3a08e6b8daa2 commit 9ecb3f8d5c82a86734ee3af3c17a3a08e6b8daa2 Author: Saleem Abdulrasool AuthorDate: Sat Apr 13 13:01:49 2019 -0700 Commit: Brad King CommitDate: Thu Apr 18 11:05:25 2019 -0400 Ninja,Makefile: use `unique_ptr` for memory management Use a `unique_ptr` to manage the lifetime of the `MacOSXContentGenerator` and 'OSXBundleGenerator` rather than manually handling the lifetime. diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 984cd85..ebf5fc2 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -9,6 +9,7 @@ #include #include +#include "cmAlgorithms.h" #include "cmGeneratedFileStream.h" #include "cmGeneratorTarget.h" #include "cmGlobalUnixMakefileGenerator3.h" @@ -35,14 +36,12 @@ cmMakefileExecutableTargetGenerator::cmMakefileExecutableTargetGenerator( this->GeneratorTarget->GetExecutableNames(this->ConfigName); this->OSXBundleGenerator = - new cmOSXBundleGenerator(target, this->ConfigName); + cm::make_unique(target, this->ConfigName); this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders); } -cmMakefileExecutableTargetGenerator::~cmMakefileExecutableTargetGenerator() -{ - delete this->OSXBundleGenerator; -} +cmMakefileExecutableTargetGenerator::~cmMakefileExecutableTargetGenerator() = + default; void cmMakefileExecutableTargetGenerator::WriteRuleFiles() { diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 44e6547..0393e22 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -9,6 +9,7 @@ #include #include +#include "cmAlgorithms.h" #include "cmGeneratedFileStream.h" #include "cmGeneratorTarget.h" #include "cmGlobalUnixMakefileGenerator3.h" @@ -37,14 +38,12 @@ cmMakefileLibraryTargetGenerator::cmMakefileLibraryTargetGenerator( } this->OSXBundleGenerator = - new cmOSXBundleGenerator(target, this->ConfigName); + cm::make_unique(target, this->ConfigName); this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders); } -cmMakefileLibraryTargetGenerator::~cmMakefileLibraryTargetGenerator() -{ - delete this->OSXBundleGenerator; -} +cmMakefileLibraryTargetGenerator::~cmMakefileLibraryTargetGenerator() = + default; void cmMakefileLibraryTargetGenerator::WriteRuleFiles() { diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index c053d5b..ec58d17 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -235,7 +235,7 @@ protected: // macOS content info. std::set MacContentFolders; - cmOSXBundleGenerator* OSXBundleGenerator; + std::unique_ptr OSXBundleGenerator; MacOSXContentGeneratorType* MacOSXContentGenerator; }; diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx index 8fbd5d2..4236995 100644 --- a/Source/cmMakefileUtilityTargetGenerator.cxx +++ b/Source/cmMakefileUtilityTargetGenerator.cxx @@ -7,6 +7,7 @@ #include #include +#include "cmAlgorithms.h" #include "cmGeneratedFileStream.h" #include "cmGeneratorTarget.h" #include "cmGlobalUnixMakefileGenerator3.h" @@ -21,14 +22,12 @@ cmMakefileUtilityTargetGenerator::cmMakefileUtilityTargetGenerator( { this->CustomCommandDriver = OnUtility; this->OSXBundleGenerator = - new cmOSXBundleGenerator(target, this->ConfigName); + cm::make_unique(target, this->ConfigName); this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders); } -cmMakefileUtilityTargetGenerator::~cmMakefileUtilityTargetGenerator() -{ - delete this->OSXBundleGenerator; -} +cmMakefileUtilityTargetGenerator::~cmMakefileUtilityTargetGenerator() = + default; void cmMakefileUtilityTargetGenerator::WriteRuleFiles() { diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 3300fef..af47fa7 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -54,14 +54,11 @@ cmNinjaNormalTargetGenerator::cmNinjaNormalTargetGenerator( } this->OSXBundleGenerator = - new cmOSXBundleGenerator(target, this->GetConfigName()); + cm::make_unique(target, this->GetConfigName()); this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders); } -cmNinjaNormalTargetGenerator::~cmNinjaNormalTargetGenerator() -{ - delete this->OSXBundleGenerator; -} +cmNinjaNormalTargetGenerator::~cmNinjaNormalTargetGenerator() = default; void cmNinjaNormalTargetGenerator::Generate() { diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 1ad26dd..2324839 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -59,13 +59,10 @@ cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target) , LocalGenerator( static_cast(target->GetLocalGenerator())) { - MacOSXContentGenerator = new MacOSXContentGeneratorType(this); + MacOSXContentGenerator = cm::make_unique(this); } -cmNinjaTargetGenerator::~cmNinjaTargetGenerator() -{ - delete this->MacOSXContentGenerator; -} +cmNinjaTargetGenerator::~cmNinjaTargetGenerator() = default; cmGeneratedFileStream& cmNinjaTargetGenerator::GetBuildFileStream() const { @@ -813,11 +810,11 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements() std::vector headerSources; this->GeneratorTarget->GetHeaderSources(headerSources, config); this->OSXBundleGenerator->GenerateMacOSXContentStatements( - headerSources, this->MacOSXContentGenerator); + headerSources, this->MacOSXContentGenerator.get()); std::vector extraSources; this->GeneratorTarget->GetExtraSources(extraSources, config); this->OSXBundleGenerator->GenerateMacOSXContentStatements( - extraSources, this->MacOSXContentGenerator); + extraSources, this->MacOSXContentGenerator.get()); std::vector externalObjects; this->GeneratorTarget->GetExternalObjects(externalObjects, config); for (cmSourceFile const* sf : externalObjects) { diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 6a42da0..51c9ac7 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -153,9 +153,9 @@ protected: }; friend struct MacOSXContentGeneratorType; - MacOSXContentGeneratorType* MacOSXContentGenerator; + std::unique_ptr MacOSXContentGenerator; // Properly initialized by sub-classes. - cmOSXBundleGenerator* OSXBundleGenerator; + std::unique_ptr OSXBundleGenerator; std::set MacContentFolders; void addPoolNinjaVariable(const std::string& pool_property, https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a000ec7a087b8d221f52960abc5a9785e27551e2 commit a000ec7a087b8d221f52960abc5a9785e27551e2 Merge: 52ef218 458ea9d Author: Brad King AuthorDate: Thu Apr 18 15:03:01 2019 +0000 Commit: Kitware Robot CommitDate: Thu Apr 18 11:03:12 2019 -0400 Merge topic 'add_xl_cxx14_support' 458ea9d76c XL: Add C++14 language level flags Acked-by: Kitware Robot Merge-request: !3235 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=458ea9d76c42b982b48104e700d844a50dc4978c commit 458ea9d76c42b982b48104e700d844a50dc4978c Author: Robert Maynard AuthorDate: Mon Apr 15 12:38:03 2019 -0400 Commit: Robert Maynard CommitDate: Mon Apr 15 12:38:03 2019 -0400 XL: Add C++14 language level flags diff --git a/Help/release/dev/xl-supports-cxx14.rst b/Help/release/dev/xl-supports-cxx14.rst new file mode 100644 index 0000000..a18e0ad --- /dev/null +++ b/Help/release/dev/xl-supports-cxx14.rst @@ -0,0 +1,4 @@ +xlc-supports-cxx14 +---------------------- + +* IBM AIX XL compiler have learned how to compile C++14. diff --git a/Modules/Compiler/XL-CXX.cmake b/Modules/Compiler/XL-CXX.cmake index ec3f1f8..3037851 100644 --- a/Modules/Compiler/XL-CXX.cmake +++ b/Modules/Compiler/XL-CXX.cmake @@ -18,6 +18,11 @@ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x") set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.1.0) + set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-qlanglvl=extended1y") + set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-qlanglvl=extended1y") + set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) + endif() endif () __compiler_check_default_language_standard(CXX 10.1 98) diff --git a/Modules/Compiler/XLClang-CXX.cmake b/Modules/Compiler/XLClang-CXX.cmake index 03c7c7b..9ea3d7c 100644 --- a/Modules/Compiler/XLClang-CXX.cmake +++ b/Modules/Compiler/XLClang-CXX.cmake @@ -15,6 +15,10 @@ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1) set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) endif () + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.1.0) + set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14") + set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14") + endif() endif() __compiler_check_default_language_standard(CXX 13.1.1 98) ----------------------------------------------------------------------- Summary of changes: Help/release/dev/xl-supports-cxx14.rst | 4 ++++ Modules/Compiler/XL-CXX.cmake | 5 +++++ Modules/Compiler/XLClang-CXX.cmake | 4 ++++ Source/cmMakefileExecutableTargetGenerator.cxx | 9 ++++----- Source/cmMakefileLibraryTargetGenerator.cxx | 9 ++++----- Source/cmMakefileTargetGenerator.h | 2 +- Source/cmMakefileUtilityTargetGenerator.cxx | 9 ++++----- Source/cmNinjaNormalTargetGenerator.cxx | 7 ++----- Source/cmNinjaTargetGenerator.cxx | 11 ++++------- Source/cmNinjaTargetGenerator.h | 4 ++-- 10 files changed, 34 insertions(+), 30 deletions(-) create mode 100644 Help/release/dev/xl-supports-cxx14.rst hooks/post-receive -- CMake From kwrobot at kitware.com Fri Apr 19 00:03:07 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 19 Apr 2019 00:03:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.2-751-gbf64e50 Message-ID: <20190419040307.976241121F8@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 bf64e50da4a36e17ea0e27a45a5277226e123210 (commit) from 2e94c1185b09cc56e9874969b159836606d0c983 (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=bf64e50da4a36e17ea0e27a45a5277226e123210 commit bf64e50da4a36e17ea0e27a45a5277226e123210 Author: Kitware Robot AuthorDate: Fri Apr 19 00:01:04 2019 -0400 Commit: Kitware Robot CommitDate: Fri Apr 19 00:01:04 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d4d5da5..e14fe71 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 14) -set(CMake_VERSION_PATCH 20190418) +set(CMake_VERSION_PATCH 20190419) #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 Apr 19 07:33:07 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 19 Apr 2019 07:33:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.2-754-g8542152 Message-ID: <20190419113307.C6F99113663@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 8542152626590db6a13b20aa3d36214186c6b40d (commit) via a9428fc473ca6eff749bd9868e2caabf7f84cc39 (commit) via e27437d0e0180fc03c44621b0918b559ee393efb (commit) from bf64e50da4a36e17ea0e27a45a5277226e123210 (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=8542152626590db6a13b20aa3d36214186c6b40d commit 8542152626590db6a13b20aa3d36214186c6b40d Merge: bf64e50 a9428fc Author: Brad King AuthorDate: Fri Apr 19 11:23:36 2019 +0000 Commit: Kitware Robot CommitDate: Fri Apr 19 07:23:48 2019 -0400 Merge topic 'test-find_package-resolve-symlinks' a9428fc473 Tests: Fix FindPackageTest when path to source has a symlink e27437d0e0 Tests/FindPackageTest: Tell Git to ignore temporary symlink path Acked-by: Kitware Robot Merge-request: !3244 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a9428fc473ca6eff749bd9868e2caabf7f84cc39 commit a9428fc473ca6eff749bd9868e2caabf7f84cc39 Author: Brad King AuthorDate: Thu Apr 18 16:01:33 2019 -0400 Commit: Brad King CommitDate: Thu Apr 18 16:01:33 2019 -0400 Tests: Fix FindPackageTest when path to source has a symlink Exclude a portion of the test that does not work in this case. diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index 972580c..6c876a7 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -205,15 +205,20 @@ if(UNIX) message(SEND_ERROR "SetFoundResolved_DIR set by find_package() is set to \"${SetFoundResolved_DIR}\" (expected \"${SetFoundResolved_EXPECTED}\")") endif() - # Resolve symlinks when finding the package. - set(CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS TRUE) - set(SetFoundResolved_DIR "") - find_package(SetFoundResolved) - # ./symlink points back here so it should be gone when resolved. - set(SetFoundResolved_EXPECTED "${CMAKE_CURRENT_SOURCE_DIR}/cmake") - if(NOT "${SetFoundResolved_DIR}" STREQUAL "${SetFoundResolved_EXPECTED}") - message(SEND_ERROR "SetFoundResolved_DIR set by find_package() is set to \"${SetFoundResolved_DIR}\" (expected \"${SetFoundResolved_EXPECTED}\")") + # This part of the test only works if there are no symlinks in our path. + get_filename_component(real_src_dir "${CMAKE_CURRENT_SOURCE_DIR}" REALPATH) + if(real_src_dir STREQUAL CMAKE_CURRENT_SOURCE_DIR) + # Resolve symlinks when finding the package. + set(CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS TRUE) + set(SetFoundResolved_DIR "") + find_package(SetFoundResolved) + # ./symlink points back here so it should be gone when resolved. + set(SetFoundResolved_EXPECTED "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + if(NOT "${SetFoundResolved_DIR}" STREQUAL "${SetFoundResolved_EXPECTED}") + message(SEND_ERROR "SetFoundResolved_DIR set by find_package() is set to \"${SetFoundResolved_DIR}\" (expected \"${SetFoundResolved_EXPECTED}\")") + endif() endif() + # Cleanup. unset(CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS) file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/symlink") https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e27437d0e0180fc03c44621b0918b559ee393efb commit e27437d0e0180fc03c44621b0918b559ee393efb Author: Brad King AuthorDate: Thu Apr 18 16:00:50 2019 -0400 Commit: Brad King CommitDate: Thu Apr 18 16:00:50 2019 -0400 Tests/FindPackageTest: Tell Git to ignore temporary symlink path diff --git a/Tests/FindPackageTest/.gitignore b/Tests/FindPackageTest/.gitignore new file mode 100644 index 0000000..3aaef13 --- /dev/null +++ b/Tests/FindPackageTest/.gitignore @@ -0,0 +1 @@ +/symlink ----------------------------------------------------------------------- Summary of changes: Tests/FindPackageTest/.gitignore | 1 + Tests/FindPackageTest/CMakeLists.txt | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 Tests/FindPackageTest/.gitignore hooks/post-receive -- CMake From kwrobot at kitware.com Sat Apr 20 00:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 20 Apr 2019 00:03:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.2-755-g0116bb1 Message-ID: <20190420040305.CFFD7112F03@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 0116bb19d354f1bdc8ae1152202ff5d829b4acf7 (commit) from 8542152626590db6a13b20aa3d36214186c6b40d (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=0116bb19d354f1bdc8ae1152202ff5d829b4acf7 commit 0116bb19d354f1bdc8ae1152202ff5d829b4acf7 Author: Kitware Robot AuthorDate: Sat Apr 20 00:01:04 2019 -0400 Commit: Kitware Robot CommitDate: Sat Apr 20 00:01:04 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e14fe71..9ae2990 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 14) -set(CMake_VERSION_PATCH 20190419) +set(CMake_VERSION_PATCH 20190420) #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 Apr 21 00:03:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 21 Apr 2019 00:03:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.2-756-g77ae6ae Message-ID: <20190421040304.36C73112D91@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 77ae6ae8601e41028fa3bd9454dfbf63ed7b876a (commit) from 0116bb19d354f1bdc8ae1152202ff5d829b4acf7 (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=77ae6ae8601e41028fa3bd9454dfbf63ed7b876a commit 77ae6ae8601e41028fa3bd9454dfbf63ed7b876a Author: Kitware Robot AuthorDate: Sun Apr 21 00:01:03 2019 -0400 Commit: Kitware Robot CommitDate: Sun Apr 21 00:01:03 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9ae2990..ce5b3cd 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 14) -set(CMake_VERSION_PATCH 20190420) +set(CMake_VERSION_PATCH 20190421) #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 Apr 22 00:03:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 22 Apr 2019 00:03:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.2-757-g8c322f9 Message-ID: <20190422040306.AE22E11356A@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 8c322f9313e60af28d2deee739a88a683885e484 (commit) from 77ae6ae8601e41028fa3bd9454dfbf63ed7b876a (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=8c322f9313e60af28d2deee739a88a683885e484 commit 8c322f9313e60af28d2deee739a88a683885e484 Author: Kitware Robot AuthorDate: Mon Apr 22 00:01:04 2019 -0400 Commit: Kitware Robot CommitDate: Mon Apr 22 00:01:04 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ce5b3cd..af246df 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 14) -set(CMake_VERSION_PATCH 20190421) +set(CMake_VERSION_PATCH 20190422) #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 Apr 22 07:43:11 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 22 Apr 2019 07:43:11 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.14.2-12-gbc6f442 Message-ID: <20190422114312.0FBF011F61C@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 bc6f442b565318fec648c5dad15dfc3d6e855dc0 (commit) via c298c4553becd799d924a58a33a6f59910477aad (commit) via cb733eb4a6e2c0246af55e3080e541d36aec3db6 (commit) via db02be85a0bcccb633b31f087cde96d95fd21e8f (commit) from c648551bea65c6457f21b608f31c4ccd5b69a0fa (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/generator/Visual Studio 16 2019.rst | 3 ++- Help/manual/cmake-variables.7.rst | 1 + Help/release/3.14.rst | 11 +++++++++++ Help/variable/CMAKE_VS_PLATFORM_NAME.rst | 4 +++- Help/variable/CMAKE_VS_PLATFORM_NAME_DEFAULT.rst | 9 +++++++++ Modules/FindQt3.cmake | 12 +++++++----- Source/cmGlobalVisualStudio7Generator.cxx | 2 +- Source/cmGlobalVisualStudioGenerator.cxx | 8 ++++++++ Source/cmGlobalVisualStudioGenerator.h | 3 +++ .../RunCMake/GeneratorPlatform/TestPlatform-toolchain.cmake | 1 + .../GeneratorPlatform/TestPlatformToolchain-stderr.txt | 1 + 11 files changed, 47 insertions(+), 8 deletions(-) create mode 100644 Help/variable/CMAKE_VS_PLATFORM_NAME_DEFAULT.rst hooks/post-receive -- CMake From kwrobot at kitware.com Mon Apr 22 07:43:11 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 22 Apr 2019 07:43:11 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.2-764-g246fdcc Message-ID: <20190422114311.8FFBA11F61B@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 246fdcc049caf19cc85f3ed7a6c20940c6c3cb00 (commit) via 637292a3a9b60ff4a6febe8080f47d20af787a17 (commit) via cb23f2ac8b2484c9bf1e0db78831b3ea8d54766c (commit) via bc6f442b565318fec648c5dad15dfc3d6e855dc0 (commit) via c298c4553becd799d924a58a33a6f59910477aad (commit) via cb733eb4a6e2c0246af55e3080e541d36aec3db6 (commit) via db02be85a0bcccb633b31f087cde96d95fd21e8f (commit) from 8c322f9313e60af28d2deee739a88a683885e484 (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=246fdcc049caf19cc85f3ed7a6c20940c6c3cb00 commit 246fdcc049caf19cc85f3ed7a6c20940c6c3cb00 Merge: 637292a bc6f442 Author: Brad King AuthorDate: Mon Apr 22 07:40:45 2019 -0400 Commit: Brad King CommitDate: Mon Apr 22 07:40:45 2019 -0400 Merge branch 'release-3.14' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=637292a3a9b60ff4a6febe8080f47d20af787a17 commit 637292a3a9b60ff4a6febe8080f47d20af787a17 Merge: cb23f2a c298c45 Author: Brad King AuthorDate: Mon Apr 22 11:39:02 2019 +0000 Commit: Kitware Robot CommitDate: Mon Apr 22 07:39:34 2019 -0400 Merge topic 'findqt3-hints-fix' c298c4553b FindQt3: Restore missing lib and bin path suffixes Acked-by: Kitware Robot Merge-request: !3254 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cb23f2ac8b2484c9bf1e0db78831b3ea8d54766c commit cb23f2ac8b2484c9bf1e0db78831b3ea8d54766c Merge: 8c322f9 db02be8 Author: Brad King AuthorDate: Mon Apr 22 11:38:20 2019 +0000 Commit: Kitware Robot CommitDate: Mon Apr 22 07:38:33 2019 -0400 Merge topic 'vs-default-platform' db02be85a0 VS: Provide the default platform name to project code Acked-by: Kitware Robot Merge-request: !3246 ----------------------------------------------------------------------- Summary of changes: Help/generator/Visual Studio 16 2019.rst | 3 ++- Help/manual/cmake-variables.7.rst | 1 + Help/release/3.14.rst | 11 +++++++++++ Help/variable/CMAKE_VS_PLATFORM_NAME.rst | 4 +++- Help/variable/CMAKE_VS_PLATFORM_NAME_DEFAULT.rst | 9 +++++++++ Modules/FindQt3.cmake | 12 +++++++----- Source/cmGlobalVisualStudio7Generator.cxx | 2 +- Source/cmGlobalVisualStudioGenerator.cxx | 8 ++++++++ Source/cmGlobalVisualStudioGenerator.h | 3 +++ .../RunCMake/GeneratorPlatform/TestPlatform-toolchain.cmake | 1 + .../GeneratorPlatform/TestPlatformToolchain-stderr.txt | 1 + 11 files changed, 47 insertions(+), 8 deletions(-) create mode 100644 Help/variable/CMAKE_VS_PLATFORM_NAME_DEFAULT.rst hooks/post-receive -- CMake From kwrobot at kitware.com Mon Apr 22 07:53:07 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 22 Apr 2019 07:53:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.2-766-gd0e3701 Message-ID: <20190422115307.54DA2125093@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 d0e37018616d43defbc16c752ca9b2be72261fb6 (commit) via 1baf122cd41d6500139649661052236b8e684565 (commit) from 246fdcc049caf19cc85f3ed7a6c20940c6c3cb00 (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=d0e37018616d43defbc16c752ca9b2be72261fb6 commit d0e37018616d43defbc16c752ca9b2be72261fb6 Merge: 246fdcc 1baf122 Author: Brad King AuthorDate: Mon Apr 22 11:50:53 2019 +0000 Commit: Kitware Robot CommitDate: Mon Apr 22 07:51:01 2019 -0400 Merge topic 'msvc-warning-flags' 1baf122cd4 MSVC: Do not add /W3 to CMAKE__FLAGS by default Acked-by: Kitware Robot Merge-request: !3250 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1baf122cd41d6500139649661052236b8e684565 commit 1baf122cd41d6500139649661052236b8e684565 Author: Brad King AuthorDate: Fri Apr 19 11:11:53 2019 -0400 Commit: Brad King CommitDate: Fri Apr 19 12:56:49 2019 -0400 MSVC: Do not add /W3 to CMAKE__FLAGS by default We do not add default warning flags on other compilers, and having a warning flag in the default flags makes it hard for projects to customize the warning level. They need to use string processing to remove `/W3` from `CMAKE_{C,CXX}_FLAGS`. Therefore we should drop it. However, projects may be using string processing to replace `/W3` with another flag, so we cannot simply drop it. Add a policy to drop it in a compatible way. Fixes: #18317 diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 043fb5c..8fcd386 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -57,6 +57,7 @@ Policies Introduced by CMake 3.15 .. toctree:: :maxdepth: 1 + CMP0092: MSVC warning flags are not in CMAKE_{C,CXX}_FLAGS by default. CMP0091: MSVC runtime library flags are selected by an abstraction. CMP0090: export(PACKAGE) does not populate package registry by default. CMP0089: Compiler id for IBM Clang-based XL compilers is now XLClang. diff --git a/Help/policy/CMP0092.rst b/Help/policy/CMP0092.rst new file mode 100644 index 0000000..8d3a288 --- /dev/null +++ b/Help/policy/CMP0092.rst @@ -0,0 +1,38 @@ +CMP0092 +------- + +MSVC warning flags are not in :variable:`CMAKE__FLAGS` by default. + +When using MSVC-like compilers in CMake 3.14 and below, warning flags +like ``/W3`` are added to :variable:`CMAKE__FLAGS` by default. +This is problematic for projects that want to choose a different warning +level programmatically. In particular, it requires string editing of the +:variable:`CMAKE__FLAGS` variables with knowledge of the +CMake builtin defaults so they can be replaced. + +CMake 3.15 and above prefer to leave out warning flags from the value of +:variable:`CMAKE__FLAGS` by default. + +This policy provides compatibility with projects that have not been updated +to expect the lack of warning flags. The policy setting takes effect as of +the first :command:`project` or :command:`enable_language` command that +initializes :variable:`CMAKE__FLAGS` for a given lanuage ````. + +.. note:: + + Once the policy has taken effect at the top of a project for a given + language, that choice must be used throughout the tree for that language. + In projects that have nested projects in subdirectories, be sure to + convert everything together. + +The ``OLD`` behavior for this policy is to place MSVC warning flags in the +default :variable:`CMAKE__FLAGS` cache entries. The ``NEW`` behavior +for this policy is to *not* place MSVC warning flags in the default cache +entries. + +This policy was introduced in CMake version 3.15. Use the +:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. +Unlike many policies, CMake version |release| does *not* warn +when this policy is not set and simply uses ``OLD`` behavior. + +.. include:: DEPRECATED.txt diff --git a/Help/release/dev/msvc-warning-flags.rst b/Help/release/dev/msvc-warning-flags.rst new file mode 100644 index 0000000..b89d6fa --- /dev/null +++ b/Help/release/dev/msvc-warning-flags.rst @@ -0,0 +1,6 @@ +msvc-warning-flags +------------------ + +* With MSVC-like compilers the value of :variable:`CMAKE__FLAGS` + no longer contains warning flags like ``/W3`` by default. + See policy :policy:`CMP0092`. diff --git a/Modules/Platform/Windows-Intel-Fortran.cmake b/Modules/Platform/Windows-Intel-Fortran.cmake index f00a8e4..e3804fb 100644 --- a/Modules/Platform/Windows-Intel-Fortran.cmake +++ b/Modules/Platform/Windows-Intel-Fortran.cmake @@ -13,7 +13,14 @@ else() set(_DBGLIBS " /dbglibs") set(_THREADS " /threads") endif() -string(APPEND CMAKE_Fortran_FLAGS_INIT " /W1 /nologo /fpp${_LIBSDLL}${_THREADS}") + +cmake_policy(GET CMP0092 _cmp0092) +if(NOT _cmp0092 STREQUAL "NEW") + string(APPEND CMAKE_Fortran_FLAGS_INIT " /W1") +endif() +unset(_cmp0092) + +string(APPEND CMAKE_Fortran_FLAGS_INIT " /nologo /fpp${_LIBSDLL}${_THREADS}") string(APPEND CMAKE_Fortran_FLAGS_DEBUG_INIT " /Od /debug:full${_DBGLIBS}") string(APPEND CMAKE_Fortran_FLAGS_MINSIZEREL_INIT " /O1 /DNDEBUG") string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " /O2 /DNDEBUG") diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 4279a74..ed0e7fb 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -366,21 +366,34 @@ macro(__windows_compiler_msvc lang) set(_MDd " /MDd") set(_MD " /MD") endif() + + cmake_policy(GET CMP0092 _cmp0092) + if(_cmp0092 STREQUAL "NEW") + set(_W3 "") + set(_Wall "") + else() + set(_W3 " /W3") + set(_Wall " -Wall") + endif() + unset(_cmp0092) + if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*") # note: MSVC 14 2015 Update 1 sets -fno-ms-compatibility by default, but this does not allow one to compile many projects # that include MS's own headers. CMake itself is affected project too. - string(APPEND CMAKE_${lang}_FLAGS_INIT " ${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} -fms-extensions -fms-compatibility -D_WINDOWS -Wall${_FLAGS_${lang}}") + string(APPEND CMAKE_${lang}_FLAGS_INIT " ${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} -fms-extensions -fms-compatibility -D_WINDOWS${_Wall}${_FLAGS_${lang}}") string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT "${_MDd} -gline-tables-only -fno-inline -O0 ${_RTC1}") string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT "${_MD} -O2 -DNDEBUG") string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "${_MD} -gline-tables-only -O2 -fno-inline -DNDEBUG") string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "${_MD} -DNDEBUG") # TODO: Add '-Os' once VS generator maps it properly for Clang else() - string(APPEND CMAKE_${lang}_FLAGS_INIT " ${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3${_FLAGS_${lang}}") + string(APPEND CMAKE_${lang}_FLAGS_INIT " ${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS${_W3}${_FLAGS_${lang}}") string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT "${_MDd} /Zi /Ob0 /Od ${_RTC1}") string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT "${_MD} /O2 /Ob2 /DNDEBUG") string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "${_MD} /Zi /O2 /Ob1 /DNDEBUG") string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "${_MD} /O1 /Ob1 /DNDEBUG") endif() + unset(_Wall) + unset(_W3) unset(_MDd) unset(_MD) diff --git a/Modules/Platform/Windows-NVIDIA-CUDA.cmake b/Modules/Platform/Windows-NVIDIA-CUDA.cmake index 6a2667a..f160c7b 100644 --- a/Modules/Platform/Windows-NVIDIA-CUDA.cmake +++ b/Modules/Platform/Windows-NVIDIA-CUDA.cmake @@ -60,11 +60,20 @@ unset(__IMPLICT_DLINK_FLAGS) string(REPLACE "/D" "-D" _PLATFORM_DEFINES_CUDA "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_CXX}") -string(APPEND CMAKE_CUDA_FLAGS_INIT " ${PLATFORM_DEFINES_CUDA} -D_WINDOWS -Xcompiler=\"/W3${_FLAGS_CXX}\"") +cmake_policy(GET CMP0092 _cmp0092) +if(_cmp0092 STREQUAL "NEW") + set(_W3 "") +else() + set(_W3 "/W3") +endif() +unset(_cmp0092) + +string(APPEND CMAKE_CUDA_FLAGS_INIT " ${PLATFORM_DEFINES_CUDA} -D_WINDOWS -Xcompiler=\"${_W3}${_FLAGS_CXX}\"") string(APPEND CMAKE_CUDA_FLAGS_DEBUG_INIT " -Xcompiler=\"-MDd -Zi -Ob0 -Od ${_RTC1}\"") string(APPEND CMAKE_CUDA_FLAGS_RELEASE_INIT " -Xcompiler=\"-MD -O2 -Ob2\" -DNDEBUG") string(APPEND CMAKE_CUDA_FLAGS_RELWITHDEBINFO_INIT " -Xcompiler=\"-MD -Zi -O2 -Ob1\" -DNDEBUG") string(APPEND CMAKE_CUDA_FLAGS_MINSIZEREL_INIT " -Xcompiler=\"-MD -O1 -Ob1\" -DNDEBUG") +unset(_W3) set(CMAKE_CUDA_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 113dd35..0e42295 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -270,7 +270,10 @@ class cmMakefile; 15, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0091, \ "MSVC runtime library flags are selected by an abstraction.", 3, 15, \ - 0, cmPolicies::WARN) + 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0092, \ + "MSVC warning flags are not in CMAKE__FLAGS by default.", 3, \ + 15, 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 a8dcb4b..4973e55 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -197,6 +197,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "^(Cray|PGI|XL|XLClang)$") endif() if(MSVC) add_RunCMake_test(MSVCRuntimeLibrary) + add_RunCMake_test(MSVCWarningFlags) endif() add_RunCMake_test(ObjectLibrary) add_RunCMake_test(ParseImplicitIncludeInfo) diff --git a/Tests/RunCMake/MSVCWarningFlags/CMP0092-NEW.cmake b/Tests/RunCMake/MSVCWarningFlags/CMP0092-NEW.cmake new file mode 100644 index 0000000..15c52d2 --- /dev/null +++ b/Tests/RunCMake/MSVCWarningFlags/CMP0092-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0092 NEW) +include(CMP0092-common.cmake) diff --git a/Tests/RunCMake/MSVCWarningFlags/CMP0092-OLD.cmake b/Tests/RunCMake/MSVCWarningFlags/CMP0092-OLD.cmake new file mode 100644 index 0000000..ea75445 --- /dev/null +++ b/Tests/RunCMake/MSVCWarningFlags/CMP0092-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0092 OLD) +include(CMP0092-common.cmake) diff --git a/Tests/RunCMake/MSVCWarningFlags/CMP0092-WARN.cmake b/Tests/RunCMake/MSVCWarningFlags/CMP0092-WARN.cmake new file mode 100644 index 0000000..45e183f --- /dev/null +++ b/Tests/RunCMake/MSVCWarningFlags/CMP0092-WARN.cmake @@ -0,0 +1,2 @@ + +include(CMP0092-common.cmake) diff --git a/Tests/RunCMake/MSVCWarningFlags/CMP0092-common.cmake b/Tests/RunCMake/MSVCWarningFlags/CMP0092-common.cmake new file mode 100644 index 0000000..87d7f67 --- /dev/null +++ b/Tests/RunCMake/MSVCWarningFlags/CMP0092-common.cmake @@ -0,0 +1,12 @@ +enable_language(C) + +cmake_policy(GET CMP0092 cmp0092) +if(cmp0092 STREQUAL "NEW") + if("${CMAKE_C_FLAGS}" MATCHES "([/-]W[0-9])") + message(SEND_ERROR "CMAKE_C_FLAGS has '${CMAKE_MATCH_1}' under NEW behavior") + endif() +else() + if(NOT " ${CMAKE_C_FLAGS} " MATCHES " /W3 ") + message(SEND_ERROR "CMAKE_C_FLAGS does not have '/W3' under OLD behavior") + endif() +endif() diff --git a/Tests/RunCMake/MSVCWarningFlags/CMakeLists.txt b/Tests/RunCMake/MSVCWarningFlags/CMakeLists.txt new file mode 100644 index 0000000..3e470a2 --- /dev/null +++ b/Tests/RunCMake/MSVCWarningFlags/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.14) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/MSVCWarningFlags/RunCMakeTest.cmake b/Tests/RunCMake/MSVCWarningFlags/RunCMakeTest.cmake new file mode 100644 index 0000000..7ce448d --- /dev/null +++ b/Tests/RunCMake/MSVCWarningFlags/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0092-WARN) +run_cmake(CMP0092-OLD) +run_cmake(CMP0092-NEW) ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-policies.7.rst | 1 + Help/policy/CMP0092.rst | 38 ++++++++++++++++++++++ Help/release/dev/msvc-warning-flags.rst | 6 ++++ Modules/Platform/Windows-Intel-Fortran.cmake | 9 ++++- Modules/Platform/Windows-MSVC.cmake | 17 ++++++++-- Modules/Platform/Windows-NVIDIA-CUDA.cmake | 11 ++++++- Source/cmPolicies.h | 5 ++- Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/MSVCWarningFlags/CMP0092-NEW.cmake | 2 ++ Tests/RunCMake/MSVCWarningFlags/CMP0092-OLD.cmake | 2 ++ Tests/RunCMake/MSVCWarningFlags/CMP0092-WARN.cmake | 2 ++ .../RunCMake/MSVCWarningFlags/CMP0092-common.cmake | 12 +++++++ .../CMakeLists.txt | 0 Tests/RunCMake/MSVCWarningFlags/RunCMakeTest.cmake | 5 +++ 14 files changed, 106 insertions(+), 5 deletions(-) create mode 100644 Help/policy/CMP0092.rst create mode 100644 Help/release/dev/msvc-warning-flags.rst create mode 100644 Tests/RunCMake/MSVCWarningFlags/CMP0092-NEW.cmake create mode 100644 Tests/RunCMake/MSVCWarningFlags/CMP0092-OLD.cmake create mode 100644 Tests/RunCMake/MSVCWarningFlags/CMP0092-WARN.cmake create mode 100644 Tests/RunCMake/MSVCWarningFlags/CMP0092-common.cmake copy Tests/RunCMake/{MetaCompileFeatures => MSVCWarningFlags}/CMakeLists.txt (100%) create mode 100644 Tests/RunCMake/MSVCWarningFlags/RunCMakeTest.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Mon Apr 22 08:33:03 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 22 Apr 2019 08:33:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.2-768-g800b2aa Message-ID: <20190422123303.95CCEFAAE3@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 800b2aad13ec36c61c6d4bfe825aed6afaacd301 (commit) via 66f3f11af5ecea17680077c39c6e0fe7738ca34a (commit) from d0e37018616d43defbc16c752ca9b2be72261fb6 (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=800b2aad13ec36c61c6d4bfe825aed6afaacd301 commit 800b2aad13ec36c61c6d4bfe825aed6afaacd301 Merge: d0e3701 66f3f11 Author: Brad King AuthorDate: Mon Apr 22 12:26:49 2019 +0000 Commit: Kitware Robot CommitDate: Mon Apr 22 08:26:56 2019 -0400 Merge topic 'sunpro-cxx14-features' 66f3f11af5 SunPro: Record support for C++14 features by SunPro 5.{14,15} Acked-by: Kitware Robot Merge-request: !3248 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=66f3f11af5ecea17680077c39c6e0fe7738ca34a commit 66f3f11af5ecea17680077c39c6e0fe7738ca34a Author: Brad King AuthorDate: Fri Apr 19 08:44:51 2019 -0400 Commit: Brad King CommitDate: Fri Apr 19 09:14:00 2019 -0400 SunPro: Record support for C++14 features by SunPro 5.{14,15} SunPro 5.15 supports `-std=c++14` and several C++14 features. SunPro 5.14 accepts `-std=c++14` but does not update its definition of `__cplusplus` or any other macro to distinguish it from `-std=c++11`, so we need to blacklist a couple features that do work but that we cannot report for that version. We can still support `cxx_std_14`. Co-Author: Robert Maynard diff --git a/Modules/Compiler/SunPro-CXX-FeatureTests.cmake b/Modules/Compiler/SunPro-CXX-FeatureTests.cmake index 279d875..e7133c1 100644 --- a/Modules/Compiler/SunPro-CXX-FeatureTests.cmake +++ b/Modules/Compiler/SunPro-CXX-FeatureTests.cmake @@ -6,6 +6,14 @@ set(_cmake_oldestSupported "__SUNPRO_CC >= 0x5130") +set(SolarisStudio126_CXX14 "(__SUNPRO_CC >= 0x5150) && __cplusplus >= 201402L") +set(_cmake_feature_test_cxx_aggregate_default_initializers "${SolarisStudio126_CXX14}") +set(_cmake_feature_test_cxx_digit_separators "${SolarisStudio126_CXX14}") +set(_cmake_feature_test_cxx_generic_lambdas "${SolarisStudio126_CXX14}") +set(_cmake_feature_test_cxx_lambda_init_captures "${SolarisStudio126_CXX14}") +set(_cmake_feature_test_cxx_return_type_deduction "${SolarisStudio126_CXX14}") +set(_cmake_feature_test_cxx_variable_templates "${SolarisStudio126_CXX14}") + set(SolarisStudio126_CXX11 "(__SUNPRO_CC >= 0x5150) && __cplusplus >= 201103L") set(_cmake_feature_test_cxx_decltype_auto "${SolarisStudio126_CXX11}") diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake index c2f6d1d..c946c64 100644 --- a/Modules/Compiler/SunPro-CXX.cmake +++ b/Modules/Compiler/SunPro-CXX.cmake @@ -52,6 +52,11 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=c++11") set(CMAKE_CXX_LINK_WITH_STANDARD_COMPILE_OPTION 1) + + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.14) + set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14") + set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=c++14") + endif() else() set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-library=stlport4") set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-library=stlport4") diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index 2dd8917..060fb49 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -52,6 +52,16 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" endif() if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro) + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.15) + # SunPro 5.14 accepts -std=c++14 and compiles two features but does + # not define __cplusplus to a value different than with -std=c++11. + list(REMOVE_ITEM CXX_non_features + cxx_aggregate_default_initializers + cxx_digit_separators + ) + endif() + + # FIXME: Do any of these work correctly on SunPro 5.13 or above? list(REMOVE_ITEM CXX_non_features cxx_attribute_deprecated cxx_contextual_conversions ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/SunPro-CXX-FeatureTests.cmake | 8 ++++++++ Modules/Compiler/SunPro-CXX.cmake | 5 +++++ Tests/CompileFeatures/CMakeLists.txt | 10 ++++++++++ 3 files changed, 23 insertions(+) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Apr 22 09:23:02 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 22 Apr 2019 09:23:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.2-770-g955f7f4 Message-ID: <20190422132302.756641134EE@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 955f7f41c08b90553fb4bcf364c12c072802d925 (commit) via 7700df9b1ef66761cad08cfc08344d5b27660e9f (commit) from 800b2aad13ec36c61c6d4bfe825aed6afaacd301 (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=955f7f41c08b90553fb4bcf364c12c072802d925 commit 955f7f41c08b90553fb4bcf364c12c072802d925 Merge: 800b2aa 7700df9 Author: Brad King AuthorDate: Mon Apr 22 09:22:04 2019 -0400 Commit: Brad King CommitDate: Mon Apr 22 09:22:04 2019 -0400 Merge branch 'release-3.14' ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Mon Apr 22 09:23:02 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 22 Apr 2019 09:23:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.14.2-13-g7700df9 Message-ID: <20190422132302.8558E11356A@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 7700df9b1ef66761cad08cfc08344d5b27660e9f (commit) from bc6f442b565318fec648c5dad15dfc3d6e855dc0 (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 Apr 22 09:33:02 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 22 Apr 2019 09:33:02 -0400 (EDT) Subject: [Cmake-commits] CMake annotated tag, v3.14.3, created. v3.14.3 Message-ID: <20190422133302.A12241134EE@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.14.3 has been created at f39a6e3dfdabddc2f05fc978f870704818215947 (tag) tagging 7700df9b1ef66761cad08cfc08344d5b27660e9f (commit) replaces v3.14.2 tagged by Brad King on Mon Apr 22 08:58:11 2019 -0400 - Log ----------------------------------------------------------------- CMake 3.14.3 -----BEGIN PGP SIGNATURE----- iQJKBAABCgA0FiEExsJlMku+vcNQtRPQLSzvEDSSFoQFAly9umMWHGJyYWQua2lu Z0BraXR3YXJlLmNvbQAKCRAtLO8QNJIWhO5wD/sFsqwYHRAJKabk7ws2bhyd+Few 0Qis4dV5/zaMtekfISXqrd3o9A40wrK+JsqGr5Le57ZMed+FK6Jfa/2SWC9RwYgj YoiPHSq4uB1qDl/G2rK0tOT7TXGdvHRZ0LmYREIo7k7LxUltjkdlJ+kfvSfVYVR1 uj0CYeFzlK9LHsVoRVOMUJWYCVJeKipKIpP3SBP8bMAMyNxqPH1UHyEqpRl7FoG4 1ALGJsn2ljZJVW7qWwSmCjkExEcqzst0lW3qEYUvzLJjdoFVtBZLqKGwKiNNjMZ4 5n1RL/kTRr7hRHY3q1mdtePrqpbVVkAKSu7+wp+HVIL0Cc2lAhsuL8QkKJkeQWx6 kzVmVJG6r+yBR+4Eh4gIWIM+vLeK2fRWDJU2wxIldnFs+rll/LAwPUrikk4Klwsz WHywecuVs220W9id9uv5DNSu70+A91e5cMoIUHI/vAQoqCsa/X32NNGNVJDT/yPq WZxedfjQ6f3UqbbB/9Oy0h360ytewZTPvpS8uHwjfde3pxoysodhmPfYlQ9cNDcf xPsmB/Htk0db337bswpUXMKEkuBDBIl7i7aFJQGqcCN4dclB+r4LfPxs340ivtvR h9V/TOeSZL3r0VqPfmJS8PONRAUcWnp1BwTvlrOMiu7sFljdafYA1dJEDKXpKYnV 6jwLdYLShiWsv5x5xA== =vKAO -----END PGP SIGNATURE----- Ben Boeckel (1): FindOpenGL: look for GLVND libraries with a libglvnd suffix Brad King (10): FindBoost: Add support for MSVC toolset version 14.2 Merge branch 'backport-FindBoost-msvc-toolset-14.2' into release-3.14 IRSL: Update redist directory for VS 2019 update 1 Merge branch 'vs2019-redist' into release-3.14 Merge branch 'Boost-Gentoo' into release-3.14 Merge branch 'FindOpenGL-libglvnd-subdir' into release-3.14 VS: Provide the default platform name to project code Merge branch 'vs-default-platform' into release-3.14 Merge branch 'findqt3-hints-fix' into release-3.14 CMake 3.14.3 Christian Pfeiffer (1): FindQt3: Restore missing lib and bin path suffixes Rolf Eike Beer (1): FindBoost: Fix detection with version suffixes on Gentoo ----------------------------------------------------------------------- hooks/post-receive -- CMake From kwrobot at kitware.com Tue Apr 23 00:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 23 Apr 2019 00:03:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.3-758-gd170a31 Message-ID: <20190423040305.DAB7F107376@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 d170a3177fdc57c96034f8a2ecf5d0f9aff70af4 (commit) from 955f7f41c08b90553fb4bcf364c12c072802d925 (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=d170a3177fdc57c96034f8a2ecf5d0f9aff70af4 commit d170a3177fdc57c96034f8a2ecf5d0f9aff70af4 Author: Kitware Robot AuthorDate: Tue Apr 23 00:01:04 2019 -0400 Commit: Kitware Robot CommitDate: Tue Apr 23 00:01:04 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index af246df..84e26df 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 14) -set(CMake_VERSION_PATCH 20190422) +set(CMake_VERSION_PATCH 20190423) #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 Apr 24 00:03:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 24 Apr 2019 00:03:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.3-759-g993dfa8 Message-ID: <20190424040306.54D7C11388C@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 993dfa89d8f49e06d44e86c97502a5d7630f3dcf (commit) from d170a3177fdc57c96034f8a2ecf5d0f9aff70af4 (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=993dfa89d8f49e06d44e86c97502a5d7630f3dcf commit 993dfa89d8f49e06d44e86c97502a5d7630f3dcf Author: Kitware Robot AuthorDate: Wed Apr 24 00:01:04 2019 -0400 Commit: Kitware Robot CommitDate: Wed Apr 24 00:01:04 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 84e26df..fa9ebda 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 14) -set(CMake_VERSION_PATCH 20190423) +set(CMake_VERSION_PATCH 20190424) #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 Apr 24 09:33:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 24 Apr 2019 09:33:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.3-762-ga7eb287 Message-ID: <20190424133306.45C4A10306B@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 a7eb2877b87117fb02ae4d3b730361defca4a96d (commit) via d8af0700a3cf1391f33c5585c4d19e331d968d4a (commit) via 95db11fdb189a08a8530a767dea2c272e3605077 (commit) from 993dfa89d8f49e06d44e86c97502a5d7630f3dcf (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=a7eb2877b87117fb02ae4d3b730361defca4a96d commit a7eb2877b87117fb02ae4d3b730361defca4a96d Merge: 993dfa8 d8af070 Author: Kyle Edwards AuthorDate: Wed Apr 24 13:30:30 2019 +0000 Commit: Kitware Robot CommitDate: Wed Apr 24 09:30:42 2019 -0400 Merge topic 'ctest_xml_tweaks' d8af0700a3 ctest: consistently format generator name 95db11fdb1 ctest: Include ChangeId in Update.xml Acked-by: Kitware Robot Merge-request: !3259 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d8af0700a3cf1391f33c5585c4d19e331d968d4a commit d8af0700a3cf1391f33c5585c4d19e331d968d4a Author: Zack Galbreath AuthorDate: Tue Apr 23 15:02:14 2019 -0400 Commit: Zack Galbreath CommitDate: Tue Apr 23 15:02:14 2019 -0400 ctest: consistently format generator name Notes.xml and Upload.xml were missing a hyphen that the rest of our XML files included. ctest3.14.0-rc1 vs. ctest-3.14.0-rc1 diff --git a/Source/CTest/cmCTestUploadHandler.cxx b/Source/CTest/cmCTestUploadHandler.cxx index ee9ee91..9efdf70 100644 --- a/Source/CTest/cmCTestUploadHandler.cxx +++ b/Source/CTest/cmCTestUploadHandler.cxx @@ -51,7 +51,7 @@ int cmCTestUploadHandler::ProcessHandler() this->CTest->GetTestModelString()); xml.Attribute("Name", this->CTest->GetCTestConfiguration("Site")); xml.Attribute("Generator", - std::string("ctest") + cmVersion::GetCMakeVersion()); + std::string("ctest-") + cmVersion::GetCMakeVersion()); this->CTest->AddSiteProperties(xml); xml.StartElement("Upload"); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 709feac..003ebdc 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1523,7 +1523,7 @@ int cmCTest::GenerateCTestNotesOutput(cmXMLWriter& xml, this->Impl->CurrentTag + "-" + this->GetTestModelString()); xml.Attribute("Name", this->GetCTestConfiguration("Site")); xml.Attribute("Generator", - std::string("ctest") + cmVersion::GetCMakeVersion()); + std::string("ctest-") + cmVersion::GetCMakeVersion()); this->AddSiteProperties(xml); xml.StartElement("Notes"); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=95db11fdb189a08a8530a767dea2c272e3605077 commit 95db11fdb189a08a8530a767dea2c272e3605077 Author: Zack Galbreath AuthorDate: Tue Apr 23 14:28:28 2019 -0400 Commit: Zack Galbreath CommitDate: Tue Apr 23 14:56:46 2019 -0400 ctest: Include ChangeId in Update.xml diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index e3b7e9e..5cfc4a7 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -199,6 +199,10 @@ int cmCTestUpdateHandler::ProcessHandler() xml.Element("UpdateCommand", vc->GetUpdateCommandLine()); xml.Element("UpdateType", cmCTestUpdateHandlerUpdateToString(this->UpdateType)); + std::string changeId = this->CTest->GetCTestConfiguration("ChangeId"); + if (!changeId.empty()) { + xml.Element("ChangeId", changeId); + } bool loadedMods = vc->WriteXML(xml); diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 4973e55..2b78171 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -259,6 +259,7 @@ add_RunCMake_test(ctest_submit) add_RunCMake_test(ctest_test) add_RunCMake_test(ctest_disabled_test) add_RunCMake_test(ctest_skipped_test) +add_RunCMake_test(ctest_update -DGIT_EXECUTABLE=${GIT_EXECUTABLE}) add_RunCMake_test(ctest_upload) add_RunCMake_test(ctest_fixtures) add_RunCMake_test(file) diff --git a/Tests/RunCMake/ctest_update/CMakeLists.txt.in b/Tests/RunCMake/ctest_update/CMakeLists.txt.in new file mode 100644 index 0000000..ecf0e54 --- /dev/null +++ b/Tests/RunCMake/ctest_update/CMakeLists.txt.in @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.1) +project(CTestTest at CASE_NAME@ NONE) +include(CTest) + at CASE_CMAKELISTS_SUFFIX_CODE@ diff --git a/Tests/RunCMake/ctest_update/RunCMakeTest.cmake b/Tests/RunCMake/ctest_update/RunCMakeTest.cmake new file mode 100644 index 0000000..0e1748f --- /dev/null +++ b/Tests/RunCMake/ctest_update/RunCMakeTest.cmake @@ -0,0 +1,17 @@ +include(RunCTest) +set(CASE_CTEST_UPDATE_ARGS "") +function(run_ctest_update CASE_NAME) + set(CASE_CTEST_UPDATE_ARGS "${ARGN}") + run_ctest(${CASE_NAME}) +endfunction() + +run_ctest_update(TestQuiet QUIET) + +function(run_TestChangeId) + set(CASE_TEST_PREFIX_CODE [[ + set(CTEST_CHANGE_ID "<>1") + ]]) + + run_ctest(TestChangeId) +endfunction() +run_TestChangeId() diff --git a/Tests/RunCMake/ctest_update/UpdateChangeId-check.cmake b/Tests/RunCMake/ctest_update/UpdateChangeId-check.cmake new file mode 100644 index 0000000..9269fbc --- /dev/null +++ b/Tests/RunCMake/ctest_update/UpdateChangeId-check.cmake @@ -0,0 +1,12 @@ +file(GLOB update_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Update.xml") +if(update_xml_file) + file(READ "${update_xml_file}" update_xml LIMIT 4096) + if(NOT update_xml MATCHES [[ChangeId="<>1"]]) + string(REPLACE "\n" "\n " update_xml " ${update_xml}") + set(RunCMake_TEST_FAILED + "Update.xml does not have expected ChangeId:\n${update_xml}" + ) + endif() +else() + set(RunCMake_TEST_FAILED "Update.xml not found") +endif() diff --git a/Tests/RunCMake/ctest_update/test.cmake.in b/Tests/RunCMake/ctest_update/test.cmake.in new file mode 100644 index 0000000..abbef74 --- /dev/null +++ b/Tests/RunCMake/ctest_update/test.cmake.in @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.1) + at CASE_TEST_PREFIX_CODE@ + +set(CTEST_SITE "test-site") +set(CTEST_BUILD_NAME "test-build-name") +set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@") +set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME at -build") +set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_UPDATE_COMMAND "@GIT_EXECUTABLE@") + +set(ctest_test_args "@CASE_CTEST_UPDATE_ARGS@") +ctest_start(Experimental) +ctest_update(${ctest_update_args}) ----------------------------------------------------------------------- Summary of changes: Source/CTest/cmCTestUpdateHandler.cxx | 4 ++++ Source/CTest/cmCTestUploadHandler.cxx | 2 +- Source/cmCTest.cxx | 2 +- Tests/RunCMake/CMakeLists.txt | 1 + .../{ctest_test => ctest_update}/CMakeLists.txt.in | 1 - Tests/RunCMake/ctest_update/RunCMakeTest.cmake | 17 +++++++++++++++++ Tests/RunCMake/ctest_update/UpdateChangeId-check.cmake | 12 ++++++++++++ .../{ctest_configure => ctest_update}/test.cmake.in | 6 ++++-- 8 files changed, 40 insertions(+), 5 deletions(-) copy Tests/RunCMake/{ctest_test => ctest_update}/CMakeLists.txt.in (63%) create mode 100644 Tests/RunCMake/ctest_update/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/ctest_update/UpdateChangeId-check.cmake copy Tests/RunCMake/{ctest_configure => ctest_update}/test.cmake.in (78%) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Apr 24 10:33:07 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 24 Apr 2019 10:33:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.3-764-gc3ef567 Message-ID: <20190424143307.3139AFD3B8@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 c3ef56795102516c2d5c86b5d90808e854cda514 (commit) via cb811d11cee1e2873cc2bf506cd081769e894ac3 (commit) from a7eb2877b87117fb02ae4d3b730361defca4a96d (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=c3ef56795102516c2d5c86b5d90808e854cda514 commit c3ef56795102516c2d5c86b5d90808e854cda514 Merge: a7eb287 cb811d1 Author: Kyle Edwards AuthorDate: Wed Apr 24 14:23:28 2019 +0000 Commit: Kitware Robot CommitDate: Wed Apr 24 10:23:39 2019 -0400 Merge topic 'update-documentation' cb811d11ce Help: Improve description of modules Acked-by: Kitware Robot Merge-request: !3222 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cb811d11cee1e2873cc2bf506cd081769e894ac3 commit cb811d11cee1e2873cc2bf506cd081769e894ac3 Author: Bartosz Kosiorek AuthorDate: Fri Apr 12 16:37:05 2019 +0200 Commit: Bartosz Kosiorek CommitDate: Tue Apr 23 10:39:34 2019 +0200 Help: Improve description of modules diff --git a/Help/command/add_definitions.rst b/Help/command/add_definitions.rst index 39a43f4..d06b01c 100644 --- a/Help/command/add_definitions.rst +++ b/Help/command/add_definitions.rst @@ -20,7 +20,7 @@ preprocessor definitions. * Use :command:`include_directories` to add include directories. * Use :command:`add_compile_options` to add other options. -Flags beginning in -D or /D that look like preprocessor definitions are +Flags beginning in ``-D`` or ``/D`` that look like preprocessor definitions are automatically added to the :prop_dir:`COMPILE_DEFINITIONS` directory property for the current directory. Definitions with non-trivial values may be left in the set of flags instead of being converted for reasons of diff --git a/Help/command/cmake_policy.rst b/Help/command/cmake_policy.rst index a80f982..4bc7807 100644 --- a/Help/command/cmake_policy.rst +++ b/Help/command/cmake_policy.rst @@ -80,7 +80,7 @@ CMake Policy Stack ^^^^^^^^^^^^^^^^^^ CMake keeps policy settings on a stack, so changes made by the -cmake_policy command affect only the top of the stack. A new entry on +``cmake_policy`` command affect only the top of the stack. A new entry on the policy stack is managed automatically for each subdirectory to protect its parents and siblings. CMake also manages a new entry for scripts loaded by :command:`include` and :command:`find_package` commands diff --git a/Help/command/include_external_msproject.rst b/Help/command/include_external_msproject.rst index 88bb2c6..540a13a 100644 --- a/Help/command/include_external_msproject.rst +++ b/Help/command/include_external_msproject.rst @@ -17,7 +17,7 @@ named ``[projectname]``. This can be used in the :command:`add_dependencies` command to make things depend on the external project. ``TYPE``, ``GUID`` and ``PLATFORM`` are optional parameters that allow one to -specify the type of project, id (GUID) of the project and the name of +specify the type of project, id (``GUID``) of the project and the name of the target platform. This is useful for projects requiring values other than the default (e.g. WIX projects). diff --git a/Help/command/message.rst b/Help/command/message.rst index 2b4b1aa..a3c3a89 100644 --- a/Help/command/message.rst +++ b/Help/command/message.rst @@ -25,7 +25,7 @@ The optional ```` keyword determines the type of message: The CMake command-line tool displays STATUS messages on stdout and all other message types on stderr. The CMake GUI displays all messages in its log area. The interactive dialogs (ccmake and CMakeSetup) show -STATUS messages one at a time on a status line and other messages in +``STATUS`` messages one at a time on a status line and other messages in interactive pop-up boxes. CMake Warning and Error message text displays using a simple markup diff --git a/Help/command/set_property.rst b/Help/command/set_property.rst index 2624b4b..ec08c8f 100644 --- a/Help/command/set_property.rst +++ b/Help/command/set_property.rst @@ -35,7 +35,7 @@ It must be one of the following: ``SOURCE`` Scope may name zero or more source files. Note that source file properties are visible only to targets added in the same - directory (CMakeLists.txt). + directory (``CMakeLists.txt``). See also the :command:`set_source_files_properties` command. ``INSTALL`` @@ -48,7 +48,7 @@ It must be one of the following: Path components have to be separated by forward slashes, must be normalized and are case sensitive. - To reference the installation prefix itself with a relative path use ".". + To reference the installation prefix itself with a relative path use ``.``. Currently installed file properties are only defined for the WIX generator where the given paths are relative diff --git a/Help/command/set_source_files_properties.rst b/Help/command/set_source_files_properties.rst index 91f995c..ab95d70 100644 --- a/Help/command/set_source_files_properties.rst +++ b/Help/command/set_source_files_properties.rst @@ -16,4 +16,4 @@ See also the :command:`set_property(SOURCE)` command. See :ref:`Source File Properties` for the list of properties known to CMake. Source file properties are visible only to targets added -in the same directory (CMakeLists.txt). +in the same directory (``CMakeLists.txt``). diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake index 50b2807..2613569 100644 --- a/Modules/CMakeAddFortranSubdirectory.cmake +++ b/Modules/CMakeAddFortranSubdirectory.cmake @@ -16,7 +16,7 @@ build with the MinGW tools. It will also create imported targets for the libraries created. This will only work if the fortran code is built into a dll, so :variable:`BUILD_SHARED_LIBS` is turned on in the project. In addition the :variable:`CMAKE_GNUtoMS` option is set -to on, so that Microsoft .lib files are created. Usage is as follows: +to on, so that Microsoft ``.lib`` files are created. Usage is as follows: :: @@ -32,15 +32,15 @@ to on, so that Microsoft .lib files are created. Usage is as follows: NO_EXTERNAL_INSTALL # skip installation of external project ) -Relative paths in ARCHIVE_DIR and RUNTIME_DIR are interpreted with +Relative paths in ``ARCHIVE_DIR`` and ``RUNTIME_DIR`` are interpreted with respect to the build directory corresponding to the source directory in which the function is invoked. Limitations: -NO_EXTERNAL_INSTALL is required for forward compatibility with a +``NO_EXTERNAL_INSTALL`` is required for forward compatibility with a future version that supports installation of the external project -binaries during "make install". +binaries during ``make install``. #]=======================================================================] set(_MS_MINGW_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}) diff --git a/Modules/CMakeAddNewLanguage.txt b/Modules/CMakeAddNewLanguage.txt index 612e1a3..6baadc3 100644 --- a/Modules/CMakeAddNewLanguage.txt +++ b/Modules/CMakeAddNewLanguage.txt @@ -1,7 +1,7 @@ This file provides a few notes to CMake developers about how to add support for a new language to CMake. It is also possible to place -these files in CMAKE_MODULE_PATH within an outside project to add -languages not supported by upstream CMake. However, this is not +these files in :variable:`CMAKE_MODULE_PATH` within an outside project +to add languages not supported by upstream CMake. However, this is not a fully supported use case. The implementation behind the scenes of project/enable_language, @@ -29,5 +29,3 @@ CMake(LANG)Information.cmake -> set up rule variables for LANG : CMAKE_(LANG)_CREATE_STATIC_LIBRARY CMAKE_(LANG)_COMPILE_OBJECT CMAKE_(LANG)_LINK_EXECUTABLE - - diff --git a/Modules/CMakeForceCompiler.cmake b/Modules/CMakeForceCompiler.cmake index 7ac09dc..7048806 100644 --- a/Modules/CMakeForceCompiler.cmake +++ b/Modules/CMakeForceCompiler.cmake @@ -25,38 +25,41 @@ toolchain file instead. ------------------------------------------------------------------------- -Macro CMAKE_FORCE_C_COMPILER has the following signature: +Macro ``CMAKE_FORCE_C_COMPILER`` has the following signature: :: CMAKE_FORCE_C_COMPILER( ) -It sets CMAKE_C_COMPILER to the given compiler and the cmake internal -variable CMAKE_C_COMPILER_ID to the given compiler-id. It also -bypasses the check for working compiler and basic compiler information -tests. +It sets :variable:`CMAKE_C_COMPILER _COMPILER>` to +the given compiler and the cmake internal variable +:variable:`CMAKE_C_COMPILER_ID _COMPILER_ID>` to the given +compiler-id. It also bypasses the check for working compiler and basic +compiler information tests. -Macro CMAKE_FORCE_CXX_COMPILER has the following signature: +Macro ``CMAKE_FORCE_CXX_COMPILER`` has the following signature: :: CMAKE_FORCE_CXX_COMPILER( ) -It sets CMAKE_CXX_COMPILER to the given compiler and the cmake -internal variable CMAKE_CXX_COMPILER_ID to the given compiler-id. It -also bypasses the check for working compiler and basic compiler -information tests. +It sets :variable:`CMAKE_CXX_COMPILER _COMPILER>` to +the given compiler and the cmake internal variable +:variable:`CMAKE_CXX_COMPILER_ID _COMPILER_ID>` to the given +compiler-id. It also bypasses the check for working compiler and basic +compiler information tests. -Macro CMAKE_FORCE_Fortran_COMPILER has the following signature: +Macro ``CMAKE_FORCE_Fortran_COMPILER`` has the following signature: :: CMAKE_FORCE_Fortran_COMPILER( ) -It sets CMAKE_Fortran_COMPILER to the given compiler and the cmake -internal variable CMAKE_Fortran_COMPILER_ID to the given compiler-id. -It also bypasses the check for working compiler and basic compiler -information tests. +It sets :variable:`CMAKE_Fortran_COMPILER _COMPILER>` to +the given compiler and the cmake internal variable +:variable:`CMAKE_Fortran_COMPILER_ID _COMPILER_ID>` to the given +compiler-id. It also bypasses the check for working compiler and basic +compiler information tests. So a simple toolchain file could look like this: diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake index efa88bd..d096849 100644 --- a/Modules/CheckLanguage.cmake +++ b/Modules/CheckLanguage.cmake @@ -13,11 +13,11 @@ Usage: check_language() -where is a language that may be passed to enable_language() -such as "Fortran". If CMAKE__COMPILER is already defined the -check does nothing. Otherwise it tries enabling the language in a -test project. The result is cached in CMAKE__COMPILER as the -compiler that was found, or NOTFOUND if the language cannot be +where ```` is a language that may be passed to :command:`enable_language` +such as ``Fortran``. If :variable:`CMAKE__COMPILER` is already defined +the check does nothing. Otherwise it tries enabling the language in a +test project. The result is cached in :variable:`CMAKE__COMPILER` +as the compiler that was found, or ``NOTFOUND`` if the language cannot be enabled. Example: diff --git a/Modules/CheckPIESupported.cmake b/Modules/CheckPIESupported.cmake index 720217d..6d63f0b 100644 --- a/Modules/CheckPIESupported.cmake +++ b/Modules/CheckPIESupported.cmake @@ -5,8 +5,8 @@ CheckPIESupported ----------------- -Check whether the linker supports position independent code (PIE) or no -position independent code (NO_PIE) for executables. +Check whether the linker supports Position Independent Code (PIE) or No +Position Independent Code (NO_PIE) for executables. Use this to ensure that the :prop_tgt:`POSITION_INDEPENDENT_CODE` target property for executables will be honored at link time. diff --git a/Modules/FindALSA.cmake b/Modules/FindALSA.cmake index f27d7fe..88e2681 100644 --- a/Modules/FindALSA.cmake +++ b/Modules/FindALSA.cmake @@ -5,9 +5,9 @@ FindALSA -------- -Find alsa +Find Advanced Linux Sound Architecture (ALSA) -Find the alsa libraries (asound) +Find the alsa libraries (``asound``) IMPORTED Targets ^^^^^^^^^^^^^^^^ diff --git a/Modules/FindAVIFile.cmake b/Modules/FindAVIFile.cmake index c12512f..9655440 100644 --- a/Modules/FindAVIFile.cmake +++ b/Modules/FindAVIFile.cmake @@ -7,7 +7,7 @@ FindAVIFile Locate AVIFILE library and include paths -AVIFILE (http://avifile.sourceforge.net/)is a set of libraries for +AVIFILE (http://avifile.sourceforge.net/) is a set of libraries for i386 machines to use various AVI codecs. Support is limited beyond Linux. Windows provides native AVI support, and so doesn't need this library. This module defines diff --git a/Modules/FindArmadillo.cmake b/Modules/FindArmadillo.cmake index ce76c99..c4e55ce 100644 --- a/Modules/FindArmadillo.cmake +++ b/Modules/FindArmadillo.cmake @@ -5,9 +5,8 @@ FindArmadillo ------------- -Find Armadillo - -Find the Armadillo C++ library +Find the Armadillo C++ library. +Armadillo is library for linear algebra & scientific computing. Using Armadillo: diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake index b0e25dc..e75981c 100644 --- a/Modules/FindBISON.cmake +++ b/Modules/FindBISON.cmake @@ -16,7 +16,7 @@ The module defines the following variables: version of ``bison`` ``BISON_FOUND`` - true if the program was found + "True" if the program was found The minimum required version of ``bison`` can be specified using the standard CMake syntax, e.g. :command:`find_package(BISON 2.1.3)`. diff --git a/Modules/FindBacktrace.cmake b/Modules/FindBacktrace.cmake index e1f45f7..cf1632a 100644 --- a/Modules/FindBacktrace.cmake +++ b/Modules/FindBacktrace.cmake @@ -5,30 +5,30 @@ FindBacktrace ------------- -Find provider for backtrace(3). +Find provider for `backtrace(3) `__. -Checks if OS supports backtrace(3) via either libc or custom library. +Checks if OS supports ``backtrace(3)`` via either ``libc`` or custom library. This module defines the following variables: ``Backtrace_HEADER`` - The header file needed for backtrace(3). Cached. + The header file needed for ``backtrace(3)``. Cached. Could be forcibly set by user. ``Backtrace_INCLUDE_DIRS`` - The include directories needed to use backtrace(3) header. + The include directories needed to use ``backtrace(3)`` header. ``Backtrace_LIBRARIES`` - The libraries (linker flags) needed to use backtrace(3), if any. + The libraries (linker flags) needed to use ``backtrace(3)``, if any. ``Backtrace_FOUND`` - Is set if and only if backtrace(3) support detected. + Is set if and only if ``backtrace(3)`` support detected. The following cache variables are also available to set or use: ``Backtrace_LIBRARY`` The external library providing backtrace, if any. ``Backtrace_INCLUDE_DIR`` - The directory holding the backtrace(3) header. + The directory holding the ``backtrace(3)`` header. -Typical usage is to generate of header file using configure_file() with the -contents like the following:: +Typical usage is to generate of header file using :command:`configure_file` +with the contents like the following:: #cmakedefine01 Backtrace_FOUND #if Backtrace_FOUND diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake index b1989b1..aeebc84 100644 --- a/Modules/FindCURL.cmake +++ b/Modules/FindCURL.cmake @@ -27,16 +27,16 @@ Result Variables This module defines the following variables: ``CURL_FOUND`` - True if curl found. + "True" if ``curl`` found. ``CURL_INCLUDE_DIRS`` - where to find curl/curl.h, etc. + where to find ``curl``/``curl.h``, etc. ``CURL_LIBRARIES`` - List of libraries when using curl. + List of libraries when using ``curl``. ``CURL_VERSION_STRING`` - The version of curl found. + The version of ``curl`` found. #]=======================================================================] find_package(PkgConfig QUIET) diff --git a/Modules/FindCVS.cmake b/Modules/FindCVS.cmake index 89dbc0e..f819800 100644 --- a/Modules/FindCVS.cmake +++ b/Modules/FindCVS.cmake @@ -5,7 +5,7 @@ FindCVS ------- - +Find the Concurrent Versions System (CVS). The module defines the following variables: diff --git a/Modules/FindCups.cmake b/Modules/FindCups.cmake index 2c79911..4e8232d 100644 --- a/Modules/FindCups.cmake +++ b/Modules/FindCups.cmake @@ -5,7 +5,7 @@ FindCups -------- -Find the CUPS printing system. +Find the Common UNIX Printing System (CUPS). Set ``CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE`` to ``TRUE`` if you need a version which features this function (i.e. at least ``1.1.19``) diff --git a/Modules/FindCxxTest.cmake b/Modules/FindCxxTest.cmake index 4eec5fc..321f004 100644 --- a/Modules/FindCxxTest.cmake +++ b/Modules/FindCxxTest.cmake @@ -5,7 +5,7 @@ FindCxxTest ----------- -Find CxxTest +Find CxxTest unit testing framework. Find the CxxTest suite and declare a helper macro for creating unit tests and integrating them with CTest. For more details on CxxTest diff --git a/Modules/FindCygwin.cmake b/Modules/FindCygwin.cmake index 8811623..5bbc802 100644 --- a/Modules/FindCygwin.cmake +++ b/Modules/FindCygwin.cmake @@ -5,7 +5,8 @@ FindCygwin ---------- -this module looks for Cygwin +Find Cygwin, a POSIX-compatible environment that runs natively +on Microsoft Windows #]=======================================================================] if (WIN32) diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake index 111e0ff..d48de08 100644 --- a/Modules/FindDCMTK.cmake +++ b/Modules/FindDCMTK.cmake @@ -5,7 +5,7 @@ FindDCMTK --------- -Find DCMTK libraries and applications +Find DICOM ToolKit (DCMTK) libraries and applications The module defines the following variables:: diff --git a/Modules/FindEXPAT.cmake b/Modules/FindEXPAT.cmake index 58e0841..15b419a 100644 --- a/Modules/FindEXPAT.cmake +++ b/Modules/FindEXPAT.cmake @@ -6,6 +6,7 @@ FindEXPAT --------- Find the native Expat headers and library. +Expat is a stream-oriented XML parser library written in C. Imported Targets ^^^^^^^^^^^^^^^^ diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake index 68eb9c8..09d57d2 100644 --- a/Modules/FindFLEX.cmake +++ b/Modules/FindFLEX.cmake @@ -5,7 +5,8 @@ FindFLEX -------- -Find flex executable and provides a macro to generate custom build rules +Find Fast Lexical Analyzer (Flex) executable and provides a macro +to generate custom build rules @@ -22,7 +23,7 @@ The module defines the following variables: The minimum required version of flex can be specified using the -standard syntax, e.g. find_package(FLEX 2.5.13) +standard syntax, e.g. :command:`find_package(FLEX 2.5.13)` diff --git a/Modules/FindFLTK.cmake b/Modules/FindFLTK.cmake index 89122c0..e273642 100644 --- a/Modules/FindFLTK.cmake +++ b/Modules/FindFLTK.cmake @@ -5,14 +5,14 @@ FindFLTK -------- -Find the FLTK library +Find the Fast Light Toolkit (FLTK) library Input Variables ^^^^^^^^^^^^^^^ By default this module will search for all of the FLTK components and -add them to the FLTK_LIBRARIES variable. You can limit the components -which get placed in FLTK_LIBRARIES by defining one or more of the +add them to the ``FLTK_LIBRARIES`` variable. You can limit the components +which get placed in ``FLTK_LIBRARIES`` by defining one or more of the following three options: ``FLTK_SKIP_OPENGL`` diff --git a/Modules/FindFLTK2.cmake b/Modules/FindFLTK2.cmake index 161d15c..a43f7a4 100644 --- a/Modules/FindFLTK2.cmake +++ b/Modules/FindFLTK2.cmake @@ -5,7 +5,7 @@ FindFLTK2 --------- -Find the native FLTK2 includes and library +Find the native FLTK 2.0 includes and library The following settings are defined @@ -243,4 +243,3 @@ else() endif() endif() endif() - diff --git a/Modules/FindGDAL.cmake b/Modules/FindGDAL.cmake index 8522f9b..fde84d4 100644 --- a/Modules/FindGDAL.cmake +++ b/Modules/FindGDAL.cmake @@ -5,7 +5,7 @@ FindGDAL -------- -Find GDAL. +Find Geospatial Data Abstraction Library (GDAL). IMPORTED Targets ^^^^^^^^^^^^^^^^ diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake index 9687b57..d5a143e 100644 --- a/Modules/FindGIF.cmake +++ b/Modules/FindGIF.cmake @@ -5,7 +5,7 @@ FindGIF ------- -This finds the GIF library (giflib) +This finds the Graphics Interchange Format (GIF) library (``giflib``) Imported targets ^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ Imported targets This module defines the following :prop_tgt:`IMPORTED` target: ``GIF::GIF`` - The giflib library, if found. + The ``giflib`` library, if found. Result variables ^^^^^^^^^^^^^^^^ diff --git a/Modules/FindGLU.cmake b/Modules/FindGLU.cmake index dbec6d1..9892805 100644 --- a/Modules/FindGLU.cmake +++ b/Modules/FindGLU.cmake @@ -15,4 +15,3 @@ if (OPENGL_GLU_FOUND) set (GLU_LIBRARY ${OPENGL_LIBRARIES}) set (GLU_INCLUDE_PATH ${OPENGL_INCLUDE_DIR}) endif () - diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake index d42db53..a22bf5b 100644 --- a/Modules/FindGLUT.cmake +++ b/Modules/FindGLUT.cmake @@ -5,7 +5,7 @@ FindGLUT -------- -try to find glut library and include files. +Find OpenGL Utility Toolkit (GLUT) library and include files. IMPORTED Targets ^^^^^^^^^^^^^^^^ diff --git a/Modules/FindGSL.cmake b/Modules/FindGSL.cmake index db05121..da1b3c4 100644 --- a/Modules/FindGSL.cmake +++ b/Modules/FindGSL.cmake @@ -5,7 +5,7 @@ FindGSL -------- -Find the native GSL includes and libraries. +Find the native GNU Scientific Library (GSL) includes and libraries. The GNU Scientific Library (GSL) is a numerical library for C and C++ programmers. It is free software under the GNU General Public diff --git a/Modules/FindGTK.cmake b/Modules/FindGTK.cmake index 8cc6c97..552b19a 100644 --- a/Modules/FindGTK.cmake +++ b/Modules/FindGTK.cmake @@ -5,7 +5,7 @@ FindGTK ------- -try to find GTK (and glib) and GTKGLArea +Find GTK, glib and GTKGLArea :: @@ -151,6 +151,3 @@ if(UNIX) ) endif() - - - diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index 3bd61a9..02e96c6 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -5,10 +5,8 @@ FindGTK2 -------- -FindGTK2.cmake - -This module can find the GTK2 widget libraries and several of its -other optional components like gtkmm, glade, and glademm. +Find the GTK2 widget libraries and several of its +other optional components like ``gtkmm``, ``glade``, and ``glademm``. NOTE: If you intend to use version checking, CMake 2.6.2 or later is diff --git a/Modules/FindGnuTLS.cmake b/Modules/FindGnuTLS.cmake index 9c07444..4b4019c 100644 --- a/Modules/FindGnuTLS.cmake +++ b/Modules/FindGnuTLS.cmake @@ -5,7 +5,7 @@ FindGnuTLS ---------- -Try to find the GNU Transport Layer Security library (gnutls) +Find the GNU Transport Layer Security library (gnutls) diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index 70bfc96..08863c8 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -5,43 +5,44 @@ FindHDF5 -------- -Find HDF5, a library for reading and writing self describing array data. +Find Hierarchical Data Format (HDF5), a library for reading and writing +self describing array data. -This module invokes the HDF5 wrapper compiler that should be installed -alongside HDF5. Depending upon the HDF5 Configuration, the wrapper -compiler is called either h5cc or h5pcc. If this succeeds, the module -will then call the compiler with the -show argument to see what flags -are used when compiling an HDF5 client application. +This module invokes the ``HDF5`` wrapper compiler that should be installed +alongside ``HDF5``. Depending upon the ``HDF5`` Configuration, the wrapper +compiler is called either ``h5cc`` or ``h5pcc``. If this succeeds, the module +will then call the compiler with the show argument to see what flags +are used when compiling an ``HDF5`` client application. -The module will optionally accept the COMPONENTS argument. If no -COMPONENTS are specified, then the find module will default to finding -only the HDF5 C library. If one or more COMPONENTS are specified, the +The module will optionally accept the ``COMPONENTS`` argument. If no +``COMPONENTS`` are specified, then the find module will default to finding +only the ``HDF5`` C library. If one or more ``COMPONENTS`` are specified, the module will attempt to find the language bindings for the specified -components. The only valid components are C, CXX, Fortran, HL, and -Fortran_HL. If the COMPONENTS argument is not given, the module will +components. The only valid components are ``C``, ``CXX``, ``Fortran``, ``HL``, +and ``Fortran_HL``. If the ``COMPONENTS`` argument is not given, the module will attempt to find only the C bindings. This module will read the variable -HDF5_USE_STATIC_LIBRARIES to determine whether or not to prefer a -static link to a dynamic link for HDF5 and all of it's dependencies. -To use this feature, make sure that the HDF5_USE_STATIC_LIBRARIES +``HDF5_USE_STATIC_LIBRARIES`` to determine whether or not to prefer a +static link to a dynamic link for ``HDF5`` and all of it's dependencies. +To use this feature, make sure that the ``HDF5_USE_STATIC_LIBRARIES`` variable is set before the call to find_package. -To provide the module with a hint about where to find your HDF5 -installation, you can set the environment variable HDF5_ROOT. The -Find module will then look in this path when searching for HDF5 +To provide the module with a hint about where to find your ``HDF5`` +installation, you can set the environment variable ``HDF5_ROOT``. The +Find module will then look in this path when searching for ``HDF5`` executables, paths, and libraries. -Both the serial and parallel HDF5 wrappers are considered and the first +Both the serial and parallel ``HDF5`` wrappers are considered and the first directory to contain either one will be used. In the event that both appear in the same directory the serial version is preferentially selected. This -behavior can be reversed by setting the variable HDF5_PREFER_PARALLEL to -true. +behavior can be reversed by setting the variable ``HDF5_PREFER_PARALLEL`` to +``True``. In addition to finding the includes and libraries required to compile -an HDF5 client application, this module also makes an effort to find -tools that come with the HDF5 distribution that may be useful for +an ``HDF5`` client application, this module also makes an effort to find +tools that come with the ``HDF5`` distribution that may be useful for regression testing. Result Variables diff --git a/Modules/FindHSPELL.cmake b/Modules/FindHSPELL.cmake index ec077a5..9724d2c 100644 --- a/Modules/FindHSPELL.cmake +++ b/Modules/FindHSPELL.cmake @@ -5,7 +5,7 @@ FindHSPELL ---------- -Try to find Hspell +Try to find Hebrew spell-checker (Hspell) and morphology engine. Once done this will define diff --git a/Modules/FindIcotool.cmake b/Modules/FindIcotool.cmake index 32fc4ae..d19c145 100644 --- a/Modules/FindIcotool.cmake +++ b/Modules/FindIcotool.cmake @@ -7,8 +7,8 @@ FindIcotool Find icotool -This module looks for icotool. This module defines the following -values: +This module looks for icotool. Convert and create Win32 icon and cursor files. +This module defines the following values: :: diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake index 2ddd11c..8bf5123 100644 --- a/Modules/FindImageMagick.cmake +++ b/Modules/FindImageMagick.cmake @@ -5,11 +5,11 @@ FindImageMagick --------------- -Find the ImageMagick binary suite. +Find ImageMagick binary suite. This module will search for a set of ImageMagick tools specified as -components in the FIND_PACKAGE call. Typical components include, but -are not limited to (future versions of ImageMagick might have +components in the :command:`find_package` call. Typical components include, +but are not limited to (future versions of ImageMagick might have additional components not listed here): :: @@ -28,7 +28,7 @@ additional components not listed here): -If no component is specified in the FIND_PACKAGE call, then it only +If no component is specified in the :command:`find_package` call, then it only searches for the ImageMagick executable directory. This code defines the following variables: @@ -43,7 +43,7 @@ the following variables: -ImageMagick_VERSION_STRING will not work for old versions like 5.2.3. +``ImageMagick_VERSION_STRING`` will not work for old versions like 5.2.3. There are also components for the following ImageMagick APIs: @@ -80,8 +80,8 @@ Example Usages: -Note that the standard FIND_PACKAGE features are supported (i.e., -QUIET, REQUIRED, etc.). +Note that the standard :command:`find_package` features are supported (i.e., +``QUIET``, ``REQUIRED``, etc.). #]=======================================================================] find_package(PkgConfig QUIET) diff --git a/Modules/FindJPEG.cmake b/Modules/FindJPEG.cmake index f50f79e..0bb6989 100644 --- a/Modules/FindJPEG.cmake +++ b/Modules/FindJPEG.cmake @@ -5,7 +5,7 @@ FindJPEG -------- -Find the JPEG library (libjpeg) +Find the Joint Photographic Experts Group (JPEG) library (``libjpeg``) Imported targets ^^^^^^^^^^^^^^^^ diff --git a/Modules/FindKDE3.cmake b/Modules/FindKDE3.cmake index c7ad6e1..f916359 100644 --- a/Modules/FindKDE3.cmake +++ b/Modules/FindKDE3.cmake @@ -35,7 +35,7 @@ The following user adjustable options are provided: ``KDE3_BUILD_TESTS`` enable this to build KDE testcases -It also adds the following macros (from KDE3Macros.cmake) SRCS_VAR is +It also adds the following macros (from ``KDE3Macros.cmake``) ``SRCS_VAR`` is always the variable which contains the list of source files for your application or library. @@ -358,4 +358,3 @@ endif () #add the found Qt and KDE include directories to the current include path set(KDE3_INCLUDE_DIRS ${QT_INCLUDE_DIR} ${KDE3_INCLUDE_DIR}) - diff --git a/Modules/FindKDE4.cmake b/Modules/FindKDE4.cmake index c04804b..2a1838f 100644 --- a/Modules/FindKDE4.cmake +++ b/Modules/FindKDE4.cmake @@ -19,7 +19,7 @@ the given order: -Please look in FindKDE4Internal.cmake and KDE4Macros.cmake for more +Please look in ``FindKDE4Internal.cmake`` and ``KDE4Macros.cmake`` for more information. They are installed with the KDE 4 libraries in $KDEDIRS/share/apps/cmake/modules/. diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index d6646ea..6582eea 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -5,13 +5,13 @@ FindLAPACK ---------- -Find LAPACK library +Find Linear Algebra PACKage (LAPACK) library This module finds an installed fortran library that implements the LAPACK linear-algebra interface (see http://www.netlib.org/lapack/). The approach follows that taken for the autoconf macro file, -acx_lapack.m4 (distributed at +``acx_lapack.m4`` (distributed at http://ac-archive.sourceforge.net/ac-archive/acx_lapack.html). Input Variables diff --git a/Modules/FindLATEX.cmake b/Modules/FindLATEX.cmake index 01f4793..b365d63 100644 --- a/Modules/FindLATEX.cmake +++ b/Modules/FindLATEX.cmake @@ -5,9 +5,9 @@ FindLATEX --------- -Find Latex +Find LaTeX -This module finds an installed Latex and determines the location +This module finds an installed LaTeX and determines the location of the compiler. Additionally the module looks for Latex-related software like BibTeX. diff --git a/Modules/FindLTTngUST.cmake b/Modules/FindLTTngUST.cmake index a074187..9cd17eb 100644 --- a/Modules/FindLTTngUST.cmake +++ b/Modules/FindLTTngUST.cmake @@ -5,7 +5,8 @@ FindLTTngUST ------------ -This module finds the `LTTng-UST `__ library. +Find +`Linux Trace Toolkit Next Generation (LTTng-UST) `__ library. Imported target ^^^^^^^^^^^^^^^ diff --git a/Modules/FindLibArchive.cmake b/Modules/FindLibArchive.cmake index 34fc2e2..ef27b7d 100644 --- a/Modules/FindLibArchive.cmake +++ b/Modules/FindLibArchive.cmake @@ -5,7 +5,8 @@ FindLibArchive -------------- -Find libarchive library and headers +Find libarchive library and headers. +Libarchive is multi-format archive and compression library. The module defines the following variables: diff --git a/Modules/FindLibXslt.cmake b/Modules/FindLibXslt.cmake index 4cca64f..01a9d8b 100644 --- a/Modules/FindLibXslt.cmake +++ b/Modules/FindLibXslt.cmake @@ -5,7 +5,8 @@ FindLibXslt ----------- -Try to find the LibXslt library +Find the XSL Transformations, Extensible Stylesheet Language +Transformations (XSLT) library (LibXslt) Once done this will define diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake index eb3b5fb..d229e18 100644 --- a/Modules/FindLua.cmake +++ b/Modules/FindLua.cmake @@ -7,7 +7,9 @@ FindLua -Locate Lua library This module defines +Locate Lua library. + +This module defines:: :: diff --git a/Modules/FindLua50.cmake b/Modules/FindLua50.cmake index 52a54e7..0575caa 100644 --- a/Modules/FindLua50.cmake +++ b/Modules/FindLua50.cmake @@ -7,7 +7,8 @@ FindLua50 -Locate Lua library This module defines +Locate Lua library. +This module defines:: :: @@ -87,4 +88,3 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua50 DEFAULT_MSG LUA_LIBRARIES LUA_INCLUDE_DIR) mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES) - diff --git a/Modules/FindLua51.cmake b/Modules/FindLua51.cmake index 1c9029b..283a3eb 100644 --- a/Modules/FindLua51.cmake +++ b/Modules/FindLua51.cmake @@ -7,7 +7,8 @@ FindLua51 -Locate Lua library This module defines +Locate Lua library. +This module defines:: :: @@ -81,4 +82,3 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua51 VERSION_VAR LUA_VERSION_STRING) mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY) - diff --git a/Modules/FindMFC.cmake b/Modules/FindMFC.cmake index 9738ac5..e366619 100644 --- a/Modules/FindMFC.cmake +++ b/Modules/FindMFC.cmake @@ -5,7 +5,7 @@ FindMFC ------- -Find MFC on Windows +Find Microsoft Foundation Class Library (MFC) on Windows Find the native MFC - i.e. decide if an application can link to the MFC libraries. diff --git a/Modules/FindOpenAL.cmake b/Modules/FindOpenAL.cmake index 18f3ff6..27dcaf5 100644 --- a/Modules/FindOpenAL.cmake +++ b/Modules/FindOpenAL.cmake @@ -6,15 +6,15 @@ FindOpenAL ---------- +Finds Open Audio Library (OpenAL). +This module defines ``OPENAL_LIBRARY OPENAL_FOUND``, if +false, do not try to link to OpenAL ``OPENAL_INCLUDE_DIR``, where to find +the headers. -Locate OpenAL This module defines OPENAL_LIBRARY OPENAL_FOUND, if -false, do not try to link to OpenAL OPENAL_INCLUDE_DIR, where to find -the headers +``$OPENALDIR`` is an environment variable that would correspond to the +``./configure --prefix=$OPENALDIR`` used in building OpenAL. -$OPENALDIR is an environment variable that would correspond to the -./configure --prefix=$OPENALDIR used in building OpenAL. - -Created by Eric Wing. This was influenced by the FindSDL.cmake +Created by Eric Wing. This was influenced by the ``FindSDL.cmake`` module. #]=======================================================================] diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake index 79c0382..9891724 100644 --- a/Modules/FindOpenCL.cmake +++ b/Modules/FindOpenCL.cmake @@ -5,7 +5,7 @@ FindOpenCL ---------- -Try to find OpenCL +Finds Open Computing Language (OpenCL) IMPORTED Targets ^^^^^^^^^^^^^^^^ diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake index 832dca2..afc872d 100644 --- a/Modules/FindOpenGL.cmake +++ b/Modules/FindOpenGL.cmake @@ -5,7 +5,7 @@ FindOpenGL ---------- -FindModule for OpenGL and GLU. +FindModule for OpenGL and OpenGL Utility Library (GLU). Optional COMPONENTS ^^^^^^^^^^^^^^^^^^^ @@ -23,9 +23,9 @@ This module defines the :prop_tgt:`IMPORTED` targets: ``OpenGL::OpenGL`` Defined to libOpenGL if the system is GLVND-based. ``OpenGL::GLU`` - Defined if the system has GLU. + Defined if the system has OpenGL Utility Library (GLU). ``OpenGL::GLX`` - Defined if the system has GLX. + Defined if the system has OpenGL Extension to the X Window System (GLX). ``OpenGL::EGL`` Defined if the system has EGL. diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index 5a34b9e..b909db8 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -5,7 +5,7 @@ FindOpenMP ---------- -Finds OpenMP support +Finds Open Multi-Processing (OpenMP) support. This module can be used to detect OpenMP support in a compiler. If the compiler supports OpenMP, the flags required to compile with diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake index 6f7d3c8..27909bc 100644 --- a/Modules/FindOpenSceneGraph.cmake +++ b/Modules/FindOpenSceneGraph.cmake @@ -5,11 +5,11 @@ FindOpenSceneGraph ------------------ -Find OpenSceneGraph +Find OpenSceneGraph (3D graphics application programming interface) This module searches for the OpenSceneGraph core "osg" library as well -as OpenThreads, and whatever additional COMPONENTS (nodekits) that you -specify. +as :module:`FindOpenThreads`, and whatever additional ``COMPONENTS`` +(nodekits) that you specify. :: @@ -17,10 +17,11 @@ specify. -NOTE: To use this module effectively you must either require CMake >= -2.6.3 with cmake_minimum_required(VERSION 2.6.3) or download and place -FindOpenThreads.cmake, Findosg_functions.cmake, Findosg.cmake, and -Find.cmake files into your CMAKE_MODULE_PATH. +NOTE: To use this module effectively you must either require ``CMake >= +2.6.3`` with :command:`cmake_minimum_required(VERSION 2.6.3)` or download +and place :module:`FindOpenThreads`, :module:`Findosg` functions, +:module:`Findosg` and ``Find.cmake`` files into your +:variable:`CMAKE_MODULE_PATH`. ================================== @@ -40,11 +41,12 @@ This module accepts the following variables (note mixed case) The following environment variables are also respected for finding the -OSG and it's various components. CMAKE_PREFIX_PATH can also be used -for this (see find_library() CMake documentation). +OSG and it's various components. :variable:`CMAKE_PREFIX_PATH` can also be +used for this (see :command:`find_library` CMake documentation). ``_DIR`` - (where MODULE is of the form "OSGVOLUME" and there is a FindosgVolume.cmake file) + (where ``MODULE`` is of the form "OSGVOLUME" and there is + a :module:`FindosgVolume`.cmake` file) ``OSG_DIR`` .. ``OSGDIR`` @@ -53,7 +55,7 @@ for this (see find_library() CMake documentation). .. -[CMake 2.8.10]: The CMake variable OSG_DIR can now be used as well to +[CMake 2.8.10]: The CMake variable ``OSG_DIR`` can now be used as well to influence detection, instead of needing to specify an environment variable. diff --git a/Modules/FindSWIG.cmake b/Modules/FindSWIG.cmake index 49f303e..a5e3a37 100644 --- a/Modules/FindSWIG.cmake +++ b/Modules/FindSWIG.cmake @@ -5,13 +5,13 @@ FindSWIG -------- -Find SWIG +Find Simplified Wrapper and Interface Generator (SWIG) This module finds an installed SWIG. It sets the following variables: :: - SWIG_FOUND - set to true if SWIG is found + SWIG_FOUND - set to "True" if SWIG is found SWIG_DIR - the directory where swig is installed SWIG_EXECUTABLE - the path to the swig executable SWIG_VERSION - the version number of the swig executable diff --git a/Modules/FindVulkan.cmake b/Modules/FindVulkan.cmake index b1201b4..ae8d72d 100644 --- a/Modules/FindVulkan.cmake +++ b/Modules/FindVulkan.cmake @@ -5,7 +5,8 @@ FindVulkan ---------- -Try to find Vulkan +Find Vulkan, which isis a low-overhead, cross-platform 3D graphics +and computing API. IMPORTED Targets ^^^^^^^^^^^^^^^^ @@ -18,7 +19,7 @@ Result Variables This module defines the following variables:: - Vulkan_FOUND - True if Vulkan was found + Vulkan_FOUND - "True" if Vulkan was found Vulkan_INCLUDE_DIRS - include directories for Vulkan Vulkan_LIBRARIES - link against this library to use Vulkan diff --git a/Modules/Findosg.cmake b/Modules/Findosg.cmake index bb28454..027f315 100644 --- a/Modules/Findosg.cmake +++ b/Modules/Findosg.cmake @@ -7,8 +7,6 @@ Findosg - - NOTE: It is highly recommended that you use the new FindOpenSceneGraph.cmake introduced in CMake 2.6.3 and not use this Find module directly. diff --git a/Modules/FindosgDB.cmake b/Modules/FindosgDB.cmake index d0789ba..a28f650 100644 --- a/Modules/FindosgDB.cmake +++ b/Modules/FindosgDB.cmake @@ -7,30 +7,38 @@ FindosgDB -This is part of the Findosg* suite used to find OpenSceneGraph +This is part of the ``Findosg*`` suite used to find OpenSceneGraph components. Each component is separate and you must opt in to each module. You must also opt into OpenGL and OpenThreads (and Producer if needed) as these modules won't do it for you. This is to allow you control over your own system piece by piece in case you need to opt out of certain components or change the Find behavior for a particular -module (perhaps because the default FindOpenGL.cmake module doesn't +module (perhaps because the default :module:`FindOpenGL` module doesn't work with your system as an example). If you want to use a more convenient module that includes everything, use the -FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +:module:`FindOpenSceneGraph` instead of the ``Findosg*.cmake`` modules. -Locate osgDB This module defines +Locate osgDB This module defines: -OSGDB_FOUND - Was osgDB found? OSGDB_INCLUDE_DIR - Where to find the -headers OSGDB_LIBRARIES - The libraries to link against for the osgDB -(use this) +``OSGDB_FOUND`` + Was osgDB found? -OSGDB_LIBRARY - The osgDB library OSGDB_LIBRARY_DEBUG - The osgDB -debug library +``OSGDB_INCLUDE_DIR`` + Where to find the headers -$OSGDIR is an environment variable that would correspond to the -./configure --prefix=$OSGDIR used in building osg. +``OSGDB_LIBRARIES`` + The libraries to link against for the osgDB + +``OSGDB_LIBRARY`` + The osgDB library + +``OSGDB_LIBRARY_DEBUG`` + The osgDB debug library + +``$OSGDIR`` is an environment variable that would correspond to:: + + ./configure --prefix=$OSGDIR used in building osg. -Created by Eric Wing. #]=======================================================================] # Header files are presumed to be included like ----------------------------------------------------------------------- Summary of changes: Help/command/add_definitions.rst | 2 +- Help/command/cmake_policy.rst | 2 +- Help/command/include_external_msproject.rst | 2 +- Help/command/message.rst | 2 +- Help/command/set_property.rst | 4 +-- Help/command/set_source_files_properties.rst | 2 +- Modules/CMakeAddFortranSubdirectory.cmake | 8 ++--- Modules/CMakeAddNewLanguage.txt | 6 ++-- Modules/CMakeForceCompiler.cmake | 33 ++++++++++---------- Modules/CheckLanguage.cmake | 10 +++---- Modules/CheckPIESupported.cmake | 4 +-- Modules/FindALSA.cmake | 4 +-- Modules/FindAVIFile.cmake | 2 +- Modules/FindArmadillo.cmake | 5 ++-- Modules/FindBISON.cmake | 2 +- Modules/FindBacktrace.cmake | 18 +++++------ Modules/FindCURL.cmake | 8 ++--- Modules/FindCVS.cmake | 2 +- Modules/FindCups.cmake | 2 +- Modules/FindCxxTest.cmake | 2 +- Modules/FindCygwin.cmake | 3 +- Modules/FindDCMTK.cmake | 2 +- Modules/FindEXPAT.cmake | 1 + Modules/FindFLEX.cmake | 5 ++-- Modules/FindFLTK.cmake | 6 ++-- Modules/FindFLTK2.cmake | 3 +- Modules/FindGDAL.cmake | 2 +- Modules/FindGIF.cmake | 4 +-- Modules/FindGLU.cmake | 1 - Modules/FindGLUT.cmake | 2 +- Modules/FindGSL.cmake | 2 +- Modules/FindGTK.cmake | 5 +--- Modules/FindGTK2.cmake | 6 ++-- Modules/FindGnuTLS.cmake | 2 +- Modules/FindHDF5.cmake | 45 ++++++++++++++-------------- Modules/FindHSPELL.cmake | 2 +- Modules/FindIcotool.cmake | 4 +-- Modules/FindImageMagick.cmake | 14 ++++----- Modules/FindJPEG.cmake | 2 +- Modules/FindKDE3.cmake | 3 +- Modules/FindKDE4.cmake | 2 +- Modules/FindLAPACK.cmake | 4 +-- Modules/FindLATEX.cmake | 4 +-- Modules/FindLTTngUST.cmake | 3 +- Modules/FindLibArchive.cmake | 3 +- Modules/FindLibXslt.cmake | 3 +- Modules/FindLua.cmake | 4 ++- Modules/FindLua50.cmake | 4 +-- Modules/FindLua51.cmake | 4 +-- Modules/FindMFC.cmake | 2 +- Modules/FindOpenAL.cmake | 14 ++++----- Modules/FindOpenCL.cmake | 2 +- Modules/FindOpenGL.cmake | 6 ++-- Modules/FindOpenMP.cmake | 2 +- Modules/FindOpenSceneGraph.cmake | 24 ++++++++------- Modules/FindSWIG.cmake | 4 +-- Modules/FindVulkan.cmake | 5 ++-- Modules/Findosg.cmake | 2 -- Modules/FindosgDB.cmake | 32 ++++++++++++-------- 59 files changed, 184 insertions(+), 174 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Apr 25 00:03:07 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 25 Apr 2019 00:03:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.3-765-g4ccf40e Message-ID: <20190425040307.96A8FF8F43@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 4ccf40e61e02cffb28b549a3de6f4794ea3e3d92 (commit) from c3ef56795102516c2d5c86b5d90808e854cda514 (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=4ccf40e61e02cffb28b549a3de6f4794ea3e3d92 commit 4ccf40e61e02cffb28b549a3de6f4794ea3e3d92 Author: Kitware Robot AuthorDate: Thu Apr 25 00:01:07 2019 -0400 Commit: Kitware Robot CommitDate: Thu Apr 25 00:01:07 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index fa9ebda..21505c5 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 14) -set(CMake_VERSION_PATCH 20190424) +set(CMake_VERSION_PATCH 20190425) #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 Apr 25 15:43:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 25 Apr 2019 15:43:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.3-768-g1ddce8f Message-ID: <20190425194306.54149D6254@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 1ddce8fd6de1a88af6e81f6cfa36b48b7948a53d (commit) via 56890ede2a6eed4db074e3fe6c56e5d03dc42b6e (commit) via 9794b72d38d4aadef352d3ae80d7dee2fbfcb7fb (commit) from 4ccf40e61e02cffb28b549a3de6f4794ea3e3d92 (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=1ddce8fd6de1a88af6e81f6cfa36b48b7948a53d commit 1ddce8fd6de1a88af6e81f6cfa36b48b7948a53d Merge: 4ccf40e 56890ed Author: Kyle Edwards AuthorDate: Thu Apr 25 19:33:50 2019 +0000 Commit: Kitware Robot CommitDate: Thu Apr 25 15:34:12 2019 -0400 Merge topic 'cmWorkerPool_Tweaks' 56890ede2a cmWorkerPool: Factor our worker thread class (internals) 9794b72d38 cmWorkerPool: Set worker thread count separately to Process() Acked-by: Kitware Robot Merge-request: !3260 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=56890ede2a6eed4db074e3fe6c56e5d03dc42b6e commit 56890ede2a6eed4db074e3fe6c56e5d03dc42b6e Author: Sebastian Holtermann AuthorDate: Wed Apr 24 11:54:56 2019 +0200 Commit: Sebastian Holtermann CommitDate: Wed Apr 24 12:54:19 2019 +0200 cmWorkerPool: Factor our worker thread class (internals) This moves the `cmWorkerPoolInternal::WorkerT` class to `cmWorkerPoolWorker` and changes the thread start interface to make it independent of the `cmWorkerPoolInternal` type. diff --git a/Source/cmWorkerPool.cxx b/Source/cmWorkerPool.cxx index 75ca47a..cbf070e 100644 --- a/Source/cmWorkerPool.cxx +++ b/Source/cmWorkerPool.cxx @@ -371,138 +371,62 @@ void cmUVReadOnlyProcess::UVTryFinish() } /** - * @brief Private worker pool internals + * @brief Worker pool worker thread */ -class cmWorkerPoolInternal +class cmWorkerPoolWorker { public: - // -- Types - - /** - * @brief Worker thread - */ - class WorkerT - { - public: - WorkerT(unsigned int index); - ~WorkerT(); - - WorkerT(WorkerT const&) = delete; - WorkerT& operator=(WorkerT const&) = delete; - - /** - * Start the thread - */ - void Start(cmWorkerPoolInternal* internal); - - /** - * @brief Run an external process - */ - bool RunProcess(cmWorkerPool::ProcessResultT& result, - std::vector const& command, - std::string const& workingDirectory); - - // -- Accessors - unsigned int Index() const { return Index_; } - cmWorkerPool::JobHandleT& JobHandle() { return JobHandle_; } - - private: - // -- Libuv callbacks - static void UVProcessStart(uv_async_t* handle); - void UVProcessFinished(); - - private: - //! @brief Job handle - cmWorkerPool::JobHandleT JobHandle_; - //! @brief Worker index - unsigned int Index_; - // -- Process management - struct - { - std::mutex Mutex; - cm::uv_async_ptr Request; - std::condition_variable Condition; - std::unique_ptr ROP; - } Proc_; - // -- System thread - std::thread Thread_; - }; - -public: - // -- Constructors - cmWorkerPoolInternal(cmWorkerPool* pool); - ~cmWorkerPoolInternal(); + cmWorkerPoolWorker(uv_loop_t& uvLoop); + ~cmWorkerPoolWorker(); - /** - * @brief Runs the libuv loop - */ - bool Process(); - - /** - * @brief Clear queue and abort threads - */ - void Abort(); + cmWorkerPoolWorker(cmWorkerPoolWorker const&) = delete; + cmWorkerPoolWorker& operator=(cmWorkerPoolWorker const&) = delete; /** - * @brief Push a job to the queue and notify a worker + * Set the internal thread */ - bool PushJob(cmWorkerPool::JobHandleT&& jobHandle); + void SetThread(std::thread&& aThread) { Thread_ = std::move(aThread); } /** - * @brief Worker thread main loop method + * Run an external process */ - void Work(WorkerT* worker); + bool RunProcess(cmWorkerPool::ProcessResultT& result, + std::vector const& command, + std::string const& workingDirectory); - // -- Request slots - static void UVSlotBegin(uv_async_t* handle); - static void UVSlotEnd(uv_async_t* handle); - -public: - // -- UV loop -#ifdef CMAKE_UV_SIGNAL_HACK - std::unique_ptr UVHackRAII; -#endif - std::unique_ptr UVLoop; - cm::uv_async_ptr UVRequestBegin; - cm::uv_async_ptr UVRequestEnd; - - // -- Thread pool and job queue - std::mutex Mutex; - bool Processing = false; - bool Aborting = false; - bool FenceProcessing = false; - unsigned int WorkersRunning = 0; - unsigned int WorkersIdle = 0; - unsigned int JobsProcessing = 0; - std::deque Queue; - std::condition_variable Condition; - std::vector> Workers; +private: + // -- Libuv callbacks + static void UVProcessStart(uv_async_t* handle); + void UVProcessFinished(); - // -- References - cmWorkerPool* Pool = nullptr; +private: + // -- Process management + struct + { + std::mutex Mutex; + cm::uv_async_ptr Request; + std::condition_variable Condition; + std::unique_ptr ROP; + } Proc_; + // -- System thread + std::thread Thread_; }; -cmWorkerPoolInternal::WorkerT::WorkerT(unsigned int index) - : Index_(index) +cmWorkerPoolWorker::cmWorkerPoolWorker(uv_loop_t& uvLoop) { + Proc_.Request.init(uvLoop, &cmWorkerPoolWorker::UVProcessStart, this); } -cmWorkerPoolInternal::WorkerT::~WorkerT() +cmWorkerPoolWorker::~cmWorkerPoolWorker() { if (Thread_.joinable()) { Thread_.join(); } } -void cmWorkerPoolInternal::WorkerT::Start(cmWorkerPoolInternal* internal) -{ - Proc_.Request.init(*(internal->UVLoop), &WorkerT::UVProcessStart, this); - Thread_ = std::thread(&cmWorkerPoolInternal::Work, internal, this); -} - -bool cmWorkerPoolInternal::WorkerT::RunProcess( - cmWorkerPool::ProcessResultT& result, - std::vector const& command, std::string const& workingDirectory) +bool cmWorkerPoolWorker::RunProcess(cmWorkerPool::ProcessResultT& result, + std::vector const& command, + std::string const& workingDirectory) { if (command.empty()) { return false; @@ -525,9 +449,9 @@ bool cmWorkerPoolInternal::WorkerT::RunProcess( return !result.error(); } -void cmWorkerPoolInternal::WorkerT::UVProcessStart(uv_async_t* handle) +void cmWorkerPoolWorker::UVProcessStart(uv_async_t* handle) { - auto* wrk = reinterpret_cast(handle->data); + auto* wrk = reinterpret_cast(handle->data); bool startFailed = false; { auto& Proc = wrk->Proc_; @@ -543,7 +467,7 @@ void cmWorkerPoolInternal::WorkerT::UVProcessStart(uv_async_t* handle) } } -void cmWorkerPoolInternal::WorkerT::UVProcessFinished() +void cmWorkerPoolWorker::UVProcessFinished() { { std::lock_guard lock(Proc_.Mutex); @@ -555,6 +479,65 @@ void cmWorkerPoolInternal::WorkerT::UVProcessFinished() Proc_.Condition.notify_one(); } +/** + * @brief Private worker pool internals + */ +class cmWorkerPoolInternal +{ +public: + // -- Constructors + cmWorkerPoolInternal(cmWorkerPool* pool); + ~cmWorkerPoolInternal(); + + /** + * Runs the libuv loop. + */ + bool Process(); + + /** + * Clear queue and abort threads. + */ + void Abort(); + + /** + * Push a job to the queue and notify a worker. + */ + bool PushJob(cmWorkerPool::JobHandleT&& jobHandle); + + /** + * Worker thread main loop method. + */ + void Work(unsigned int workerIndex); + + // -- Request slots + static void UVSlotBegin(uv_async_t* handle); + static void UVSlotEnd(uv_async_t* handle); + +public: + // -- UV loop +#ifdef CMAKE_UV_SIGNAL_HACK + std::unique_ptr UVHackRAII; +#endif + std::unique_ptr UVLoop; + cm::uv_async_ptr UVRequestBegin; + cm::uv_async_ptr UVRequestEnd; + + // -- Thread pool and job queue + std::mutex Mutex; + bool Processing = false; + bool Aborting = false; + bool FenceProcessing = false; + unsigned int WorkersRunning = 0; + unsigned int WorkersIdle = 0; + unsigned int JobsProcessing = 0; + std::deque Queue; + std::condition_variable Condition; + std::vector> Workers; + + // -- References + cmWorkerPool* Pool = nullptr; +}; + void cmWorkerPool::ProcessResultT::reset() { ExitStatus = 0; @@ -652,11 +635,13 @@ void cmWorkerPoolInternal::UVSlotBegin(uv_async_t* handle) // Create workers gint.Workers.reserve(num); for (unsigned int ii = 0; ii != num; ++ii) { - gint.Workers.emplace_back(cm::make_unique(ii)); + gint.Workers.emplace_back( + cm::make_unique(*gint.UVLoop)); } - // Start workers - for (auto& wrk : gint.Workers) { - wrk->Start(&gint); + // Start worker threads + for (unsigned int ii = 0; ii != num; ++ii) { + gint.Workers[ii]->SetThread( + std::thread(&cmWorkerPoolInternal::Work, &gint, ii)); } } // Destroy begin request @@ -672,8 +657,9 @@ void cmWorkerPoolInternal::UVSlotEnd(uv_async_t* handle) gint.UVRequestEnd.reset(); } -void cmWorkerPoolInternal::Work(WorkerT* worker) +void cmWorkerPoolInternal::Work(unsigned int workerIndex) { + cmWorkerPool::JobHandleT jobHandle; std::unique_lock uLock(Mutex); // Increment running workers count ++WorkersRunning; @@ -702,15 +688,15 @@ void cmWorkerPoolInternal::Work(WorkerT* worker) } // Pop next job from queue - worker->JobHandle() = std::move(Queue.front()); + jobHandle = std::move(Queue.front()); Queue.pop_front(); // Unlocked scope for job processing ++JobsProcessing; { uLock.unlock(); - worker->JobHandle()->Work(Pool, worker->Index()); // Process job - worker->JobHandle().reset(); // Destroy job + jobHandle->Work(Pool, workerIndex); // Process job + jobHandle.reset(); // Destroy job uLock.lock(); } --JobsProcessing; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9794b72d38d4aadef352d3ae80d7dee2fbfcb7fb commit 9794b72d38d4aadef352d3ae80d7dee2fbfcb7fb Author: Sebastian Holtermann AuthorDate: Sun Apr 21 11:14:11 2019 +0200 Commit: Sebastian Holtermann CommitDate: Wed Apr 24 12:32:58 2019 +0200 cmWorkerPool: Set worker thread count separately to Process() Don't pass the desired worker thread count to the `cmWorkerPool::Process()` method but set it separately with the new `cmWorkerPool::SetThreadCount` method. This allows calling `cmWorkerPool::Process()` repeatedly without having to pass the thread count every time. diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index 75c5d8a..005c27d 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -1186,6 +1186,7 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile) num = std::min(num, ParallelMax); Base_.NumThreads = static_cast(num); } + WorkerPool_.SetThreadCount(Base_.NumThreads); } // - Files and directories @@ -1482,15 +1483,12 @@ bool cmQtAutoMocUic::Process() if (!CreateDirectories()) { return false; } - - if (!WorkerPool_.Process(Base().NumThreads, this)) { + if (!WorkerPool_.Process(this)) { return false; } - if (JobError_) { return false; } - return SettingsFileWrite(); } diff --git a/Source/cmWorkerPool.cxx b/Source/cmWorkerPool.cxx index 464182c..75ca47a 100644 --- a/Source/cmWorkerPool.cxx +++ b/Source/cmWorkerPool.cxx @@ -468,6 +468,7 @@ public: // -- Thread pool and job queue std::mutex Mutex; + bool Processing = false; bool Aborting = false; bool FenceProcessing = false; unsigned int WorkersRunning = 0; @@ -591,7 +592,8 @@ cmWorkerPoolInternal::~cmWorkerPoolInternal() bool cmWorkerPoolInternal::Process() { - // Reset state + // Reset state flags + Processing = true; Aborting = false; // Initialize libuv asynchronous request UVRequestBegin.init(*UVLoop, &cmWorkerPoolInternal::UVSlotBegin, this); @@ -599,23 +601,27 @@ bool cmWorkerPoolInternal::Process() // Send begin request UVRequestBegin.send(); // Run libuv loop - return (uv_run(UVLoop.get(), UV_RUN_DEFAULT) == 0); + bool success = (uv_run(UVLoop.get(), UV_RUN_DEFAULT) == 0); + // Update state flags + Processing = false; + Aborting = false; + return success; } void cmWorkerPoolInternal::Abort() { - bool firstCall = false; + bool notifyThreads = false; // Clear all jobs and set abort flag { std::lock_guard guard(Mutex); - if (!Aborting) { + if (Processing && !Aborting) { // Register abort and clear queue Aborting = true; Queue.clear(); - firstCall = true; + notifyThreads = true; } } - if (firstCall) { + if (notifyThreads) { // Wake threads Condition.notify_all(); } @@ -627,15 +633,13 @@ inline bool cmWorkerPoolInternal::PushJob(cmWorkerPool::JobHandleT&& jobHandle) if (Aborting) { return false; } - // Append the job to the queue Queue.emplace_back(std::move(jobHandle)); - // Notify an idle worker if there's one if (WorkersIdle != 0) { Condition.notify_one(); } - + // Return success return true; } @@ -743,19 +747,22 @@ cmWorkerPool::cmWorkerPool() cmWorkerPool::~cmWorkerPool() = default; -bool cmWorkerPool::Process(unsigned int threadCount, void* userData) +void cmWorkerPool::SetThreadCount(unsigned int threadCount) +{ + if (!Int_->Processing) { + ThreadCount_ = (threadCount > 0) ? threadCount : 1u; + } +} + +bool cmWorkerPool::Process(void* userData) { // Setup user data UserData_ = userData; - ThreadCount_ = (threadCount > 0) ? threadCount : 1u; - // Run libuv loop bool success = Int_->Process(); - // Clear user data UserData_ = nullptr; - ThreadCount_ = 0; - + // Return return success; } diff --git a/Source/cmWorkerPool.h b/Source/cmWorkerPool.h index 71c7d84..f08bb4f 100644 --- a/Source/cmWorkerPool.h +++ b/Source/cmWorkerPool.h @@ -50,12 +50,12 @@ public: JobT& operator=(JobT const&) = delete; /** - * @brief Virtual destructor. + * Virtual destructor. */ virtual ~JobT(); /** - * @brief Fence job flag + * Fence job flag * * Fence jobs require that: * - all jobs before in the queue have been processed @@ -66,7 +66,7 @@ public: protected: /** - * @brief Protected default constructor + * Protected default constructor */ JobT(bool fence = false) : Fence_(fence) @@ -125,12 +125,12 @@ public: }; /** - * @brief Job handle type + * Job handle type */ typedef std::unique_ptr JobHandleT; /** - * @brief Fence job base class + * Fence job base class */ class JobFenceT : public JobT { @@ -144,8 +144,9 @@ public: }; /** - * @brief Fence job that aborts the worker pool. - * This class is useful as the last job in the job queue. + * Fence job that aborts the worker pool. + * + * Useful as the last job in the job queue. */ class JobEndT : JobFenceT { @@ -160,23 +161,29 @@ public: ~cmWorkerPool(); /** - * @brief Blocking function that starts threads to process all Jobs in - * the queue. + * Number of worker threads. + */ + unsigned int ThreadCount() const { return ThreadCount_; } + + /** + * Set the number of worker threads. * - * This method blocks until a job calls the Abort() method. - * @arg threadCount Number of threads to process jobs. - * @arg userData Common user data pointer available in all Jobs. + * Calling this method during Process() has no effect. */ - bool Process(unsigned int threadCount, void* userData = nullptr); + void SetThreadCount(unsigned int threadCount); /** - * Number of worker threads passed to Process(). - * Only valid during Process(). + * Blocking function that starts threads to process all Jobs in the queue. + * + * This method blocks until a job calls the Abort() method. + * @arg threadCount Number of threads to process jobs. + * @arg userData Common user data pointer available in all Jobs. */ - unsigned int ThreadCount() const { return ThreadCount_; } + bool Process(void* userData = nullptr); /** * User data reference passed to Process(). + * * Only valid during Process(). */ void* UserData() const { return UserData_; } @@ -184,14 +191,14 @@ public: // -- Job processing interface /** - * @brief Clears the job queue and aborts all worker threads. + * Clears the job queue and aborts all worker threads. * * This method is thread safe and can be called from inside a job. */ void Abort(); /** - * @brief Push job to the queue. + * Push job to the queue. * * This method is thread safe and can be called from inside a job or before * Process(). @@ -199,7 +206,7 @@ public: bool PushJob(JobHandleT&& jobHandle); /** - * @brief Push job to the queue + * Push job to the queue * * This method is thread safe and can be called from inside a job or before * Process(). @@ -212,7 +219,7 @@ public: private: void* UserData_ = nullptr; - unsigned int ThreadCount_ = 0; + unsigned int ThreadCount_ = 1; std::unique_ptr Int_; }; ----------------------------------------------------------------------- Summary of changes: Source/cmQtAutoMocUic.cxx | 6 +- Source/cmWorkerPool.cxx | 261 ++++++++++++++++++++++------------------------ Source/cmWorkerPool.h | 47 +++++---- 3 files changed, 156 insertions(+), 158 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Apr 26 00:03:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 26 Apr 2019 00:03:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.3-769-g68031b4 Message-ID: <20190426040306.65125FA033@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 68031b4fdd2ec2eff7338b8f44bb563678299f8a (commit) from 1ddce8fd6de1a88af6e81f6cfa36b48b7948a53d (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=68031b4fdd2ec2eff7338b8f44bb563678299f8a commit 68031b4fdd2ec2eff7338b8f44bb563678299f8a Author: Kitware Robot AuthorDate: Fri Apr 26 00:01:07 2019 -0400 Commit: Kitware Robot CommitDate: Fri Apr 26 00:01:07 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 21505c5..0ab4f76 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 14) -set(CMake_VERSION_PATCH 20190425) +set(CMake_VERSION_PATCH 20190426) #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 Sat Apr 27 00:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 27 Apr 2019 00:03:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.3-770-ga9c113f Message-ID: <20190427040305.E75C5113482@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 a9c113fd3e24f95908fedfb6cd2601d8a4795105 (commit) from 68031b4fdd2ec2eff7338b8f44bb563678299f8a (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=a9c113fd3e24f95908fedfb6cd2601d8a4795105 commit a9c113fd3e24f95908fedfb6cd2601d8a4795105 Author: Kitware Robot AuthorDate: Sat Apr 27 00:01:04 2019 -0400 Commit: Kitware Robot CommitDate: Sat Apr 27 00:01:04 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0ab4f76..63ca76a 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 14) -set(CMake_VERSION_PATCH 20190426) +set(CMake_VERSION_PATCH 20190427) #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 Apr 28 00:03:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 28 Apr 2019 00:03:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.3-771-gd8426b5 Message-ID: <20190428040304.1C618A83C8@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 d8426b57a66d7a420f28b0b0309d1502e7bcfea8 (commit) from a9c113fd3e24f95908fedfb6cd2601d8a4795105 (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=d8426b57a66d7a420f28b0b0309d1502e7bcfea8 commit d8426b57a66d7a420f28b0b0309d1502e7bcfea8 Author: Kitware Robot AuthorDate: Sun Apr 28 00:01:04 2019 -0400 Commit: Kitware Robot CommitDate: Sun Apr 28 00:01:04 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 63ca76a..9a43492 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 14) -set(CMake_VERSION_PATCH 20190427) +set(CMake_VERSION_PATCH 20190428) #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 Apr 29 00:03:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 29 Apr 2019 00:03:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.3-772-ga40c982 Message-ID: <20190429040304.AB4BCFB814@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 a40c9825bbb1ce5ac43b041bcd54a5cea85f4a92 (commit) from d8426b57a66d7a420f28b0b0309d1502e7bcfea8 (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=a40c9825bbb1ce5ac43b041bcd54a5cea85f4a92 commit a40c9825bbb1ce5ac43b041bcd54a5cea85f4a92 Author: Kitware Robot AuthorDate: Mon Apr 29 00:01:05 2019 -0400 Commit: Kitware Robot CommitDate: Mon Apr 29 00:01:05 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9a43492..51b69ba 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 14) -set(CMake_VERSION_PATCH 20190428) +set(CMake_VERSION_PATCH 20190429) #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 Apr 29 10:43:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 29 Apr 2019 10:43:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.3-774-g1c7863a Message-ID: <20190429144304.AA184102A38@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 1c7863a7654724af0afca6d20b80a50153f6d5f7 (commit) via a893018c47dba503caca0c8e2e22d12aaa9b6752 (commit) from a40c9825bbb1ce5ac43b041bcd54a5cea85f4a92 (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=1c7863a7654724af0afca6d20b80a50153f6d5f7 commit 1c7863a7654724af0afca6d20b80a50153f6d5f7 Merge: a40c982 a893018 Author: Kyle Edwards AuthorDate: Mon Apr 29 14:40:31 2019 +0000 Commit: Kitware Robot CommitDate: Mon Apr 29 10:40:39 2019 -0400 Merge topic 'intel_simulate' a893018c47 Project: Report intel's simulation of gcc. Acked-by: Kitware Robot Merge-request: !3264 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a893018c47dba503caca0c8e2e22d12aaa9b6752 commit a893018c47dba503caca0c8e2e22d12aaa9b6752 Author: R. Andrew Ohana AuthorDate: Mon Apr 1 13:56:17 2019 -0700 Commit: R. Andrew Ohana CommitDate: Thu Apr 25 13:37:44 2019 -0700 Project: Report intel's simulation of gcc. diff --git a/Modules/Compiler/Intel-DetermineCompiler.cmake b/Modules/Compiler/Intel-DetermineCompiler.cmake index d7e4532..c31aa77 100644 --- a/Modules/Compiler/Intel-DetermineCompiler.cmake +++ b/Modules/Compiler/Intel-DetermineCompiler.cmake @@ -18,9 +18,23 @@ set(_compiler_id_version_compute " /* _MSC_VER = VVRR */ # define @PREFIX at SIMULATE_VERSION_MAJOR @MACRO_DEC@(_MSC_VER / 100) # define @PREFIX at SIMULATE_VERSION_MINOR @MACRO_DEC@(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define @PREFIX at SIMULATE_VERSION_MAJOR @MACRO_DEC@(__GNUC__) +# elif defined(__GNUG__) +# define @PREFIX at SIMULATE_VERSION_MAJOR @MACRO_DEC@(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define @PREFIX at SIMULATE_VERSION_MINOR @MACRO_DEC@(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define @PREFIX at SIMULATE_VERSION_PATCH @MACRO_DEC@(__GNUC_PATCHLEVEL__) # endif") set(_compiler_id_simulate " # if defined(_MSC_VER) # define @PREFIX at SIMULATE_ID \"MSVC\" +# endif +# if defined(__GNUC__) +# define @PREFIX at SIMULATE_ID \"GNU\" # endif") ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/Intel-DetermineCompiler.cmake | 14 ++++++++++++++ 1 file changed, 14 insertions(+) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Apr 30 00:03:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 30 Apr 2019 00:03:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.3-775-g4eebc52 Message-ID: <20190430040304.9F7E111D8C4@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 4eebc52eca3d551423d7e512284a3b71e13d30a0 (commit) from 1c7863a7654724af0afca6d20b80a50153f6d5f7 (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=4eebc52eca3d551423d7e512284a3b71e13d30a0 commit 4eebc52eca3d551423d7e512284a3b71e13d30a0 Author: Kitware Robot AuthorDate: Tue Apr 30 00:01:05 2019 -0400 Commit: Kitware Robot CommitDate: Tue Apr 30 00:01:05 2019 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 51b69ba..a7e8ee1 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 14) -set(CMake_VERSION_PATCH 20190429) +set(CMake_VERSION_PATCH 20190430) #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 Apr 30 10:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 30 Apr 2019 10:03:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.3-777-g71371e3 Message-ID: <20190430140305.F40251135DD@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 71371e3d936c89945e4369c0daebe9c7e13dec31 (commit) via eca275f63d1ef03c366cf498db4f4ffd393a5245 (commit) from 4eebc52eca3d551423d7e512284a3b71e13d30a0 (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=71371e3d936c89945e4369c0daebe9c7e13dec31 commit 71371e3d936c89945e4369c0daebe9c7e13dec31 Merge: 4eebc52 eca275f Author: Brad King AuthorDate: Tue Apr 30 13:59:44 2019 +0000 Commit: Kitware Robot CommitDate: Tue Apr 30 09:59:57 2019 -0400 Merge topic 'msvc-c-features' eca275f63d CompileFeatures: Fix hard-coded MSVC C features Acked-by: Kitware Robot Merge-request: !3247 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=eca275f63d1ef03c366cf498db4f4ffd393a5245 commit eca275f63d1ef03c366cf498db4f4ffd393a5245 Author: Brad King AuthorDate: Fri Apr 19 08:10:02 2019 -0400 Commit: Brad King CommitDate: Mon Apr 22 08:22:54 2019 -0400 CompileFeatures: Fix hard-coded MSVC C features In commit 8e4899fd6c (CompileFeatures: Record which C features the MSVC compiler supports, 2019-04-12) our `cmake_record_c_compile_features` macro was accidentally left not setting the `_result` variable, which had previously been set by `_record_compiler_features`. The variable is expected by the call site in `cmake_determine_compile_features` and used to switch between "failed" and "done" reports. Set it now. Also record `c_variadic_macros` only for cl 14 (VS 2005) and higher because it is not supported before that version. diff --git a/Modules/Compiler/MSVC-C.cmake b/Modules/Compiler/MSVC-C.cmake index a722130..f56227b 100644 --- a/Modules/Compiler/MSVC-C.cmake +++ b/Modules/Compiler/MSVC-C.cmake @@ -21,9 +21,13 @@ macro(cmake_record_c_compile_features) c_std_99 c_std_11 c_function_prototypes - c_variadic_macros ) list(APPEND CMAKE_C90_COMPILE_FEATURES c_std_90 c_function_prototypes) - list(APPEND CMAKE_C99_COMPILE_FEATURES c_std_99 c_variadic_macros) + list(APPEND CMAKE_C99_COMPILE_FEATURES c_std_99) list(APPEND CMAKE_C11_COMPILE_FEATURES c_std_11) + if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 14.0) + list(APPEND CMAKE_C_COMPILE_FEATURES c_variadic_macros) + list(APPEND CMAKE_C99_COMPILE_FEATURES c_variadic_macros) + endif() + set(_result 0) # expected by cmake_determine_compile_features endmacro() ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/MSVC-C.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Apr 30 10:13:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 30 Apr 2019 10:13:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.3-788-gd0e6fc2 Message-ID: <20190430141305.1424EFA14F@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 d0e6fc28334023a42fbae797ece8c8e8526dc1c3 (commit) via 60515b205e0151fa0194a984850e652a04a9a165 (commit) via d9a4da453fb6fe2a5f16eb35a0d3756f88801ba1 (commit) via 60b28de5c8c364d26824dbe2c2666ea47e8870a2 (commit) via b74061ba386a46d273bea37f377998a4e1936a65 (commit) via 996e1885c4995e2d73712a7d0aaa0d615be5fdf0 (commit) via 61f70e81a708db126ba5e2d1135ff0e2a5ffba25 (commit) via 7db32efbab1c61e4b8032702eba5ac6d7768d531 (commit) via ce078dda79df1c8d9f142e45d2fa3cf971a09594 (commit) via 044dcf9f8d2bfb10825627f7e18456a1679d5ab6 (commit) via d350fb688954f476d8df79bf582cf366b5861dd2 (commit) from 71371e3d936c89945e4369c0daebe9c7e13dec31 (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=d0e6fc28334023a42fbae797ece8c8e8526dc1c3 commit d0e6fc28334023a42fbae797ece8c8e8526dc1c3 Merge: 60515b2 ce078dd Author: Brad King AuthorDate: Tue Apr 30 14:09:39 2019 +0000 Commit: Kitware Robot CommitDate: Tue Apr 30 10:09:52 2019 -0400 Merge topic 'relax_TARGET_OBJECT_generator_expr' ce078dda79 Relax the usage of TARGET_OBJECTS generator expression Acked-by: Kitware Robot Merge-request: !3178 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=60515b205e0151fa0194a984850e652a04a9a165 commit 60515b205e0151fa0194a984850e652a04a9a165 Merge: d9a4da4 7db32ef Author: Brad King AuthorDate: Tue Apr 30 14:07:38 2019 +0000 Commit: Kitware Robot CommitDate: Tue Apr 30 10:08:22 2019 -0400 Merge topic 'findmpi-msvc-nolibdir' 7db32efbab FindMPI: Don't retain libdirs for Win32 Acked-by: Kitware Robot Merge-request: !3253 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d9a4da453fb6fe2a5f16eb35a0d3756f88801ba1 commit d9a4da453fb6fe2a5f16eb35a0d3756f88801ba1 Merge: 60b28de 996e188 Author: Brad King AuthorDate: Tue Apr 30 14:07:20 2019 +0000 Commit: Kitware Robot CommitDate: Tue Apr 30 10:07:27 2019 -0400 Merge topic 'server-deprecate' 996e1885c4 server: deprecate in favor of the file-api Acked-by: Kitware Robot Acked-by: Kyle Edwards Merge-request: !3251 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=60b28de5c8c364d26824dbe2c2666ea47e8870a2 commit 60b28de5c8c364d26824dbe2c2666ea47e8870a2 Merge: b74061b 044dcf9 Author: Brad King AuthorDate: Tue Apr 30 14:04:42 2019 +0000 Commit: Kitware Robot CommitDate: Tue Apr 30 10:05:09 2019 -0400 Merge topic 'add-execute_process-command-echo' 044dcf9f8d execute_process: Add option to echo command lines d350fb6889 execute_process: Manage KWSys Process lifetime with unique_ptr Acked-by: Kitware Robot Merge-request: !3165 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b74061ba386a46d273bea37f377998a4e1936a65 commit b74061ba386a46d273bea37f377998a4e1936a65 Merge: 71371e3 61f70e8 Author: Brad King AuthorDate: Tue Apr 30 14:03:12 2019 +0000 Commit: Kitware Robot CommitDate: Tue Apr 30 10:03:20 2019 -0400 Merge topic 'msvc-runtime-library' 61f70e81a7 MSVC: Document and test behavior of empty MSVC_RUNTIME_LIBRARY Acked-by: Kitware Robot Merge-request: !3249 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=996e1885c4995e2d73712a7d0aaa0d615be5fdf0 commit 996e1885c4995e2d73712a7d0aaa0d615be5fdf0 Author: Brad King AuthorDate: Fri Apr 19 13:43:57 2019 -0400 Commit: Brad King CommitDate: Mon Apr 22 09:38:44 2019 -0400 server: deprecate in favor of the file-api Document the server mode as deprecated. Add a deprecation message to the configure step output when invoked through server mode. Closes: #19101 diff --git a/Help/manual/cmake-server.7.rst b/Help/manual/cmake-server.7.rst index 25d364c..8f10b9f 100644 --- a/Help/manual/cmake-server.7.rst +++ b/Help/manual/cmake-server.7.rst @@ -7,6 +7,11 @@ cmake-server(7) .. contents:: +.. deprecated:: 3.15 + + This will be removed from a future version of CMake. + Clients should use the :manual:`cmake-file-api(7)` instead. + Introduction ============ diff --git a/Help/release/dev/server-deprecate.rst b/Help/release/dev/server-deprecate.rst new file mode 100644 index 0000000..65c86e1 --- /dev/null +++ b/Help/release/dev/server-deprecate.rst @@ -0,0 +1,6 @@ +server-deprecate +---------------- + +* The :manual:`cmake-server(7)` mode has been deprecated and will be + removed from a future version of CMake. Please port clients to use + the :manual:`cmake-file-api(7)` instead. diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index 203ee93..dad8821 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -8,6 +8,7 @@ #include "cmGlobalGenerator.h" #include "cmJsonObjectDictionary.h" #include "cmJsonObjects.h" +#include "cmMessageType.h" #include "cmServer.h" #include "cmServerDictionary.h" #include "cmState.h" @@ -600,6 +601,10 @@ cmServerResponse cmServerProtocol1::ProcessConfigure( } int ret = cm->Configure(); + cm->IssueMessage( + MessageType::DEPRECATION_WARNING, + "The 'cmake-server(7)' is deprecated. " + "Please port clients to use the 'cmake-file-api(7)' instead."); if (ret < 0) { return request.ReportError("Configuration failed."); } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=61f70e81a708db126ba5e2d1135ff0e2a5ffba25 commit 61f70e81a708db126ba5e2d1135ff0e2a5ffba25 Author: Brad King AuthorDate: Fri Apr 19 11:32:40 2019 -0400 Commit: Brad King CommitDate: Mon Apr 22 08:48:44 2019 -0400 MSVC: Document and test behavior of empty MSVC_RUNTIME_LIBRARY Extend tests added by commit fb3370b6a1 (MSVC: Add abstraction for runtime library selection, 2019-04-10) to cover an empty value for the property. It should result in no specific setting. Issue: #19108 diff --git a/Help/prop_tgt/MSVC_RUNTIME_LIBRARY-VALUES.txt b/Help/prop_tgt/MSVC_RUNTIME_LIBRARY-VALUES.txt index 2bf71a9..6c61341 100644 --- a/Help/prop_tgt/MSVC_RUNTIME_LIBRARY-VALUES.txt +++ b/Help/prop_tgt/MSVC_RUNTIME_LIBRARY-VALUES.txt @@ -13,3 +13,8 @@ The value is ignored on non-MSVC compilers but an unsupported value will be rejected as an error when using a compiler targeting the MSVC ABI. + +The value may also be the empty string (``""``) in which case no runtime +library selection flag will be added explicitly by CMake. Note that with +:ref:`Visual Studio Generators` the native build system may choose to +add its own default runtime library selection flag. diff --git a/Tests/MSVCRuntimeLibrary/CMakeLists.txt b/Tests/MSVCRuntimeLibrary/CMakeLists.txt index b7a6e86..6994d8d 100644 --- a/Tests/MSVCRuntimeLibrary/CMakeLists.txt +++ b/Tests/MSVCRuntimeLibrary/CMakeLists.txt @@ -42,7 +42,22 @@ endfunction() function(verify lang src) add_library(default-${lang} ${src}) target_compile_definitions(default-${lang} PRIVATE VERIFY_MT VERIFY_DLL "$<$:VERIFY_DEBUG>") + verify_combinations(MultiThreaded ${lang} ${src}) + + # Test known MSVC default behavior when no flag is given. + if(CMAKE_${lang}_COMPILER_ID STREQUAL "MSVC") + set(CMAKE_MSVC_RUNTIME_LIBRARY "") + add_library(empty-${lang} ${src}) + if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 14) + # VS 2005 and above default to multi-threaded. + target_compile_definitions(empty-${lang} PRIVATE VERIFY_MT) + endif() + if(CMAKE_GENERATOR MATCHES "Visual Studio ([^9]|9[0-9])") + # VS 2010 and above have a different default runtime library for projects than 'cl'. + target_compile_definitions(empty-${lang} PRIVATE VERIFY_DLL) + endif() + endif() endfunction() verify(C verify.c) diff --git a/Tests/RunCMake/VS10Project/RuntimeLibrary-check.cmake b/Tests/RunCMake/VS10Project/RuntimeLibrary-check.cmake index 6b43d47..689b35f 100644 --- a/Tests/RunCMake/VS10Project/RuntimeLibrary-check.cmake +++ b/Tests/RunCMake/VS10Project/RuntimeLibrary-check.cmake @@ -20,7 +20,7 @@ macro(RuntimeLibrary_check tgt rtl_expect) endif() endforeach() - if(NOT HAVE_Runtimelibrary) + if(NOT HAVE_Runtimelibrary AND NOT "${rtl_expect}" STREQUAL "") set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a RuntimeLibrary field.") return() endif() @@ -28,6 +28,8 @@ endmacro() RuntimeLibrary_check(default-C MultiThreadedDebugDLL) RuntimeLibrary_check(default-CXX MultiThreadedDebugDLL) +RuntimeLibrary_check(empty-C "") +RuntimeLibrary_check(empty-CXX "") RuntimeLibrary_check(MTd-C MultiThreadedDebug) RuntimeLibrary_check(MTd-CXX MultiThreadedDebug) RuntimeLibrary_check(MT-C MultiThreaded) diff --git a/Tests/RunCMake/VS10Project/RuntimeLibrary.cmake b/Tests/RunCMake/VS10Project/RuntimeLibrary.cmake index 6c77a25..d7787c8 100644 --- a/Tests/RunCMake/VS10Project/RuntimeLibrary.cmake +++ b/Tests/RunCMake/VS10Project/RuntimeLibrary.cmake @@ -6,6 +6,10 @@ enable_language(CXX) add_library(default-C empty.c) add_library(default-CXX empty.cxx) +set(CMAKE_MSVC_RUNTIME_LIBRARY "") +add_library(empty-C empty.c) +add_library(empty-CXX empty.cxx) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDebug") add_library(MTd-C empty.c) add_library(MTd-CXX empty.cxx) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7db32efbab1c61e4b8032702eba5ac6d7768d531 commit 7db32efbab1c61e4b8032702eba5ac6d7768d531 Author: Christian Pfeiffer AuthorDate: Sat Apr 20 20:45:09 2019 +0200 Commit: Christian Pfeiffer CommitDate: Sat Apr 20 20:45:09 2019 +0200 FindMPI: Don't retain libdirs for Win32 On Windows systems, the need to retain library directories should not nomrally occur. This can only occur on Unix like systems where a shared library is being linked that has a dependency on another library which is not being found in the default directories (e.g. libgfortran on BSD) This also works around an issue introduced by !1694 in that the Visual Studio generator does not handle link flags passed in `INTERFACE_LINK_LIBRARIES` correctly, causing problems when using that generator with Intel MPI in certain circumstances. diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 8c45a8c..5288640 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -770,18 +770,20 @@ function (_MPI_interrogate_compiler LANG) endforeach() # Add the link directories given explicitly that we haven't used back as linker directories. - foreach(_MPI_LINK_DIRECTORY IN LISTS MPI_LINK_DIRECTORIES_LEFTOVER) - file(TO_NATIVE_PATH "${_MPI_LINK_DIRECTORY}" _MPI_LINK_DIRECTORY_ACTUAL) - string(FIND "${_MPI_LINK_DIRECTORY_ACTUAL}" " " _MPI_LINK_DIRECTORY_CONTAINS_SPACE) - if(NOT _MPI_LINK_DIRECTORY_CONTAINS_SPACE EQUAL -1) - set(_MPI_LINK_DIRECTORY_ACTUAL "\"${_MPI_LINK_DIRECTORY_ACTUAL}\"") - endif() - if(MPI_LINK_FLAGS_WORK) - string(APPEND MPI_LINK_FLAGS_WORK " ${CMAKE_LIBRARY_PATH_FLAG}${_MPI_LINK_DIRECTORY_ACTUAL}") - else() - set(MPI_LINK_FLAGS_WORK "${CMAKE_LIBRARY_PATH_FLAG}${_MPI_LINK_DIRECTORY_ACTUAL}") - endif() - endforeach() + if(NOT WIN32) + foreach(_MPI_LINK_DIRECTORY IN LISTS MPI_LINK_DIRECTORIES_LEFTOVER) + file(TO_NATIVE_PATH "${_MPI_LINK_DIRECTORY}" _MPI_LINK_DIRECTORY_ACTUAL) + string(FIND "${_MPI_LINK_DIRECTORY_ACTUAL}" " " _MPI_LINK_DIRECTORY_CONTAINS_SPACE) + if(NOT _MPI_LINK_DIRECTORY_CONTAINS_SPACE EQUAL -1) + set(_MPI_LINK_DIRECTORY_ACTUAL "\"${_MPI_LINK_DIRECTORY_ACTUAL}\"") + endif() + if(MPI_LINK_FLAGS_WORK) + string(APPEND MPI_LINK_FLAGS_WORK " ${CMAKE_LIBRARY_PATH_FLAG}${_MPI_LINK_DIRECTORY_ACTUAL}") + else() + set(MPI_LINK_FLAGS_WORK "${CMAKE_LIBRARY_PATH_FLAG}${_MPI_LINK_DIRECTORY_ACTUAL}") + endif() + endforeach() + endif() # Deal with the libraries given with full path next unset(MPI_DIRECT_LIB_NAMES_WORK) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ce078dda79df1c8d9f142e45d2fa3cf971a09594 commit ce078dda79df1c8d9f142e45d2fa3cf971a09594 Author: Robert Maynard AuthorDate: Wed Apr 3 14:42:35 2019 -0400 Commit: Robert Maynard CommitDate: Fri Apr 19 13:52:50 2019 -0400 Relax the usage of TARGET_OBJECTS generator expression The geneator expression can now be used with static, shared, and module libraries and executables. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 8cb0fe7..d1f779b 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -461,8 +461,7 @@ Output-Related Expressions Content of ``...`` converted to a C identifier. The conversion follows the same behavior as :command:`string(MAKE_C_IDENTIFIER)`. ``$`` - List of objects resulting from build of ``objLib``. ``objLib`` must be an - object of type ``OBJECT_LIBRARY``. + List of objects resulting from build of ``objLib``. ``$`` Content of ``...`` converted to shell path style. For example, slashes are converted to backslashes in Windows shells and drive letters are converted diff --git a/Help/release/dev/relax-TARGET_OBJECTS-generator-expression.rst b/Help/release/dev/relax-TARGET_OBJECTS-generator-expression.rst new file mode 100644 index 0000000..25ca0c9 --- /dev/null +++ b/Help/release/dev/relax-TARGET_OBJECTS-generator-expression.rst @@ -0,0 +1,5 @@ +relax-TARGET_OBJECTS-generator-expression +----------------------------------------- + +* The ``TARGET_OBJECTS`` :manual:`generator expression ` + is now supported on ``SHARED``, ``STATIC``, ``MODULE`` libraries and executables. diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 50413c8..7cef1c3 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1525,10 +1525,16 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode reportError(context, content->GetOriginalExpression(), e.str()); return std::string(); } - if (gt->GetType() != cmStateEnums::OBJECT_LIBRARY) { + cmStateEnums::TargetType type = gt->GetType(); + if (type != cmStateEnums::EXECUTABLE && + type != cmStateEnums::STATIC_LIBRARY && + type != cmStateEnums::SHARED_LIBRARY && + type != cmStateEnums::MODULE_LIBRARY && + type != cmStateEnums::OBJECT_LIBRARY) { std::ostringstream e; e << "Objects of target \"" << tgtName - << "\" referenced but is not an OBJECT library."; + << "\" referenced but is not an allowed library types (EXECUTABLE, " + << "STATIC, SHARED, MODULE, OBJECT)."; reportError(context, content->GetOriginalExpression(), e.str()); return std::string(); } diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index df0c78d..5ba0dc0 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -374,4 +374,49 @@ if(NOT CMAKE_GENERATOR STREQUAL Xcode OR NOT CMAKE_OSX_ARCHITECTURES MATCHES "[; -P "${CMAKE_CURRENT_SOURCE_DIR}/check_object_files.cmake" DEPENDS objlib ) + + + add_library(sharedlib SHARED objlib1.c objlib2.c) + file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/sharedlib_files_$" + CONTENT "$,\n>\n" + ) + + add_custom_target(check_sharedlib_objs ALL + COMMAND ${CMAKE_COMMAND} + "-DOBJLIB_LISTFILE=${CMAKE_CURRENT_BINARY_DIR}/sharedlib_files_$" + -DEXPECTED_NUM_OBJECTFILES=2 + -P "${CMAKE_CURRENT_SOURCE_DIR}/check_object_files.cmake" + DEPENDS sharedlib + ) + + + add_library(staticlib STATIC objlib1.c objlib2.c) + file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/staticlib_files_$" + CONTENT "$,\n>\n" + ) + + add_custom_target(check_staticlib_objs ALL + COMMAND ${CMAKE_COMMAND} + "-DOBJLIB_LISTFILE=${CMAKE_CURRENT_BINARY_DIR}/staticlib_files_$" + -DEXPECTED_NUM_OBJECTFILES=2 + -P "${CMAKE_CURRENT_SOURCE_DIR}/check_object_files.cmake" + DEPENDS staticlib + ) + + + add_executable(execobjs objlib1.c objlib2.c echo.c) + file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/execobjs_files_$" + CONTENT "$,\n>\n" + ) + + add_custom_target(check_exec_objs ALL + COMMAND ${CMAKE_COMMAND} + "-DOBJLIB_LISTFILE=${CMAKE_CURRENT_BINARY_DIR}/execobjs_files_$" + -DEXPECTED_NUM_OBJECTFILES=3 + -P "${CMAKE_CURRENT_SOURCE_DIR}/check_object_files.cmake" + DEPENDS execobjs + ) endif() diff --git a/Tests/ObjectLibrary/CMakeLists.txt b/Tests/ObjectLibrary/CMakeLists.txt index 4bffd12..7897ab9 100644 --- a/Tests/ObjectLibrary/CMakeLists.txt +++ b/Tests/ObjectLibrary/CMakeLists.txt @@ -62,4 +62,14 @@ add_custom_target(UseABinternalDep COMMAND ${CMAKE_COMMAND} -E touch UseABintern add_custom_command(TARGET UseABinternal POST_BUILD COMMAND ${CMAKE_COMMAND} -P UseABinternalDep.cmake) add_dependencies(UseABinternal UseABinternalDep) +# Test a static library with sources from a different static library +add_library(UseCstaticObjs STATIC $ $ $) + +# Test a shared library with sources from a different shared library +add_library(UseCsharedObjs SHARED $ $ $) + +# Test a shared executable with sources from a different shared library +add_executable(UseABstaticObjs $) +target_link_libraries(UseABstaticObjs ABstatic) + add_subdirectory(ExportLanguages) diff --git a/Tests/RunCMake/File_Generate/OutputNameMatchesObjects-stderr.txt b/Tests/RunCMake/File_Generate/OutputNameMatchesObjects-stderr.txt index b08ef5a..4c2e35f 100644 --- a/Tests/RunCMake/File_Generate/OutputNameMatchesObjects-stderr.txt +++ b/Tests/RunCMake/File_Generate/OutputNameMatchesObjects-stderr.txt @@ -3,6 +3,7 @@ CMake Error at OutputNameMatchesObjects.cmake:[0-9]+ \(file\): \$ - Objects of target "foo" referenced but is not an OBJECT library. + Objects of target "foo" referenced but is not an allowed library types + \(EXECUTABLE, STATIC, SHARED, MODULE, OBJECT\). Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/File_Generate/OutputNameMatchesObjects.cmake b/Tests/RunCMake/File_Generate/OutputNameMatchesObjects.cmake index daa7c49..84825fe 100644 --- a/Tests/RunCMake/File_Generate/OutputNameMatchesObjects.cmake +++ b/Tests/RunCMake/File_Generate/OutputNameMatchesObjects.cmake @@ -1,11 +1,8 @@ enable_language(CXX) file(GENERATE - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/$>somefile.cpp" + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/$/somefile.cpp" CONTENT "static const char content[] = \"$\";\n" ) -add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/input.txt" - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/input.txt" "${CMAKE_CURRENT_BINARY_DIR}") - -add_executable(foo empty.cpp "${CMAKE_CURRENT_BINARY_DIR}/1somefile.cpp" "${CMAKE_CURRENT_BINARY_DIR}/input.txt") +add_library(foo INTERFACE ) diff --git a/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt b/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt index 838b3d8..4dbd861 100644 --- a/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt +++ b/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt @@ -3,6 +3,7 @@ CMake Error at BadSourceExpression3.cmake:2 \(add_library\): \$ - Objects of target "NotObjLib" referenced but is not an OBJECT library. + Objects of target "NotObjLib" referenced but is not an allowed library + types \(EXECUTABLE, STATIC, SHARED, MODULE, OBJECT\). Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/BadSourceExpression3.cmake b/Tests/RunCMake/ObjectLibrary/BadSourceExpression3.cmake index c3d9a62..4e07ea6 100644 --- a/Tests/RunCMake/ObjectLibrary/BadSourceExpression3.cmake +++ b/Tests/RunCMake/ObjectLibrary/BadSourceExpression3.cmake @@ -1,2 +1,2 @@ -add_library(NotObjLib STATIC a.c) +add_library(NotObjLib INTERFACE) add_library(A STATIC a.c $) diff --git a/Tests/RunCMake/ObjectLibrary/CheckTargetObjects.cmake b/Tests/RunCMake/ObjectLibrary/CheckTargetObjects.cmake new file mode 100644 index 0000000..0c85c72 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/CheckTargetObjects.cmake @@ -0,0 +1,32 @@ +add_library(StaticLib STATIC a.c) + +add_custom_command(TARGET StaticLib POST_BUILD + VERBATIM + COMMAND ${CMAKE_COMMAND} + "-DTARGET_OBJECTS=$" + -DEXPECTED_NUM_OBJECTFILES=2 + -P "${CMAKE_CURRENT_SOURCE_DIR}/check_object_files.cmake" + ) + +add_library(SharedLib SHARED a.c b.c) +target_compile_definitions(SharedLib PRIVATE REQUIRED) + +add_custom_command(TARGET SharedLib POST_BUILD + VERBATIM + COMMAND ${CMAKE_COMMAND} + "-DTARGET_OBJECTS:STRING=$" + -DEXPECTED_NUM_OBJECTFILES=2 + -P "${CMAKE_CURRENT_SOURCE_DIR}/check_object_files.cmake" + ) + +add_executable(ExecObjs a.c b.c exe.c) +target_compile_definitions(ExecObjs PRIVATE REQUIRED) + +add_custom_target(check_exec_objs ALL + VERBATIM + COMMAND ${CMAKE_COMMAND} + "-DTARGET_OBJECTS=$" + -DEXPECTED_NUM_OBJECTFILES=3 + -P "${CMAKE_CURRENT_SOURCE_DIR}/check_object_files.cmake" + DEPENDS ExecObjs + ) diff --git a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake index 6ca33b8..5ec4018 100644 --- a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake +++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake @@ -37,6 +37,10 @@ function (run_object_lib_build2 name) run_cmake_command(${name}-build ${CMAKE_COMMAND} --build .) endfunction () +if(NOT (RunCMake_GENERATOR STREQUAL "Xcode" AND "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]")) + run_object_lib_build(CheckTargetObjects) +endif() + run_object_lib_build(LinkObjLHSShared) run_object_lib_build(LinkObjLHSStatic) run_object_lib_build(LinkObjRHSShared) @@ -54,6 +58,7 @@ run_cmake(PostBuild) run_cmake(PreBuild) run_cmake(PreLink) + function(run_Dependencies) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Dependencies-build) set(RunCMake_TEST_NO_CLEAN 1) diff --git a/Tests/RunCMake/ObjectLibrary/check_object_files.cmake b/Tests/RunCMake/ObjectLibrary/check_object_files.cmake new file mode 100644 index 0000000..3c34229 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/check_object_files.cmake @@ -0,0 +1,17 @@ + +if (NOT TARGET_OBJECTS) + message(SEND_ERROR "Object not passed as -DTARGET_OBJECTS") +endif() + +foreach(objlib_file IN LISTS objects) + message(STATUS "objlib_file: =${objlib_file}=") + + set(file_exists False) + if (EXISTS "${objlib_file}") + set(file_exists True) + endif() + + if (NOT file_exists) + message(SEND_ERROR "File \"${objlib_file}\" does not exist!${tried}") + endif() +endforeach() diff --git a/Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt b/Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt index a66794c..77c4afd 100644 --- a/Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt +++ b/Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt @@ -1,8 +1,9 @@ -CMake Error at NotObjlibTarget.cmake:3 \(file\): +CMake Error at NotObjlibTarget.cmake:[0-9]+ \(file\): Error evaluating generator expression: - \$ + \$ - Objects of target "StaticLib" referenced but is not an OBJECT library. + Objects of target "IFaceLib" referenced but is not an allowed library types + \(EXECUTABLE, STATIC, SHARED, MODULE, OBJECT\). Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake b/Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake index 3bb3e37..9fec369 100644 --- a/Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake +++ b/Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake @@ -1,3 +1,3 @@ -add_library(StaticLib empty.cpp) +add_library(IFaceLib INTERFACE ) -file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_output CONTENT $) +file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_output CONTENT $) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=044dcf9f8d2bfb10825627f7e18456a1679d5ab6 commit 044dcf9f8d2bfb10825627f7e18456a1679d5ab6 Author: Bill Hoffman AuthorDate: Fri Mar 29 16:39:44 2019 -0400 Commit: Brad King CommitDate: Fri Apr 19 13:32:08 2019 -0400 execute_process: Add option to echo command lines Add COMMAND_ECHO option to the execute_process command. This will allow execute_process to show the command it will run. Also add a cmake variable CMAKE_EXECUTE_PROCESS_COMMAND_ECHO. Both the option and the variable can be set to one of the following: STDERR|STDOUT|NONE. The command will be printed to stderr or stdout or not at all. Fixes: #18933 diff --git a/Help/command/execute_process.rst b/Help/command/execute_process.rst index 2d71352..e6ad037 100644 --- a/Help/command/execute_process.rst +++ b/Help/command/execute_process.rst @@ -18,6 +18,7 @@ Execute one or more child processes. [ERROR_FILE ] [OUTPUT_QUIET] [ERROR_QUIET] + [COMMAND_ECHO ] [OUTPUT_STRIP_TRAILING_WHITESPACE] [ERROR_STRIP_TRAILING_WHITESPACE] [ENCODING ]) @@ -77,6 +78,10 @@ Options: ``OUTPUT_QUIET``, ``ERROR_QUIET`` The standard output or standard error results will be quietly ignored. +``COMMAND_ECHO `` + The command being run will be echo'ed to ```` with ```` + being set to ``STDERR``|``STDOUT``|``NONE``. + ``ENCODING `` On Windows, the encoding that is used to decode output from the process. Ignored on other platforms. diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 18dd9d7..0863c15 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -158,6 +158,7 @@ Variables that Change Behavior /variable/CMAKE_ECLIPSE_VERSION /variable/CMAKE_ERROR_DEPRECATED /variable/CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION + /variable/CMAKE_EXECUTE_PROCESS_COMMAND_ECHO /variable/CMAKE_EXPORT_COMPILE_COMMANDS /variable/CMAKE_EXPORT_PACKAGE_REGISTRY /variable/CMAKE_EXPORT_NO_PACKAGE_REGISTRY diff --git a/Help/release/dev/add-execute_process-command-echo.rst b/Help/release/dev/add-execute_process-command-echo.rst new file mode 100644 index 0000000..a44e40e --- /dev/null +++ b/Help/release/dev/add-execute_process-command-echo.rst @@ -0,0 +1,6 @@ +add-execute_process-command-echo +-------------------------------- + +* The :command:`execute_process` command gained a `COMMAND_ECHO` option + and supporting :variable:`CMAKE_EXECUTE_PROCESS_COMMAND_ECHO` variable + to enable echoing of the command-line string before execution. diff --git a/Help/variable/CMAKE_EXECUTE_PROCESS_COMMAND_ECHO.rst b/Help/variable/CMAKE_EXECUTE_PROCESS_COMMAND_ECHO.rst new file mode 100644 index 0000000..4a3121c --- /dev/null +++ b/Help/variable/CMAKE_EXECUTE_PROCESS_COMMAND_ECHO.rst @@ -0,0 +1,6 @@ +CMAKE_EXECUTE_PROCESS_COMMAND_ECHO +---------------------------------- + +If this variable is set to ``STDERR``|``STDOUT``|``NONE`` then commands in +:command:`execute_process` calls will be printed to either stderr or stdout +or not at all. diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx index de58c0b..0d9859e 100644 --- a/Source/cmExecuteProcessCommand.cxx +++ b/Source/cmExecuteProcessCommand.cxx @@ -6,11 +6,13 @@ #include "cmsys/Process.h" #include #include /* isspace */ +#include #include #include "cmAlgorithms.h" #include "cmArgumentParser.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmProcessOutput.h" #include "cmSystemTools.h" @@ -47,6 +49,7 @@ bool cmExecuteProcessCommand::InitialPass(std::vector const& args, std::string OutputFile; std::string ErrorFile; std::string Timeout; + std::string CommandEcho; bool OutputQuiet = false; bool ErrorQuiet = false; bool OutputStripTrailingWhitespace = false; @@ -57,6 +60,7 @@ bool cmExecuteProcessCommand::InitialPass(std::vector const& args, static auto const parser = cmArgumentParser{} .Bind("COMMAND"_s, &Arguments::Commands) + .Bind("COMMAND_ECHO"_s, &Arguments::CommandEcho) .Bind("OUTPUT_VARIABLE"_s, &Arguments::OutputVariable) .Bind("ERROR_VARIABLE"_s, &Arguments::ErrorVariable) .Bind("RESULT_VARIABLE"_s, &Arguments::ResultVariable) @@ -117,7 +121,6 @@ bool cmExecuteProcessCommand::InitialPass(std::vector const& args, return false; } } - // Create a process instance. std::unique_ptr cp_ptr( cmsysProcess_New(), cmsysProcess_Delete); @@ -171,6 +174,51 @@ bool cmExecuteProcessCommand::InitialPass(std::vector const& args, cmsysProcess_SetTimeout(cp, timeout); } + bool echo_stdout = false; + bool echo_stderr = false; + bool echo_output_from_variable = true; + std::string echo_output = + this->Makefile->GetSafeDefinition("CMAKE_EXECUTE_PROCESS_COMMAND_ECHO"); + if (!arguments.CommandEcho.empty()) { + echo_output_from_variable = false; + echo_output = arguments.CommandEcho; + } + + if (!echo_output.empty()) { + if (echo_output == "STDERR") { + echo_stderr = true; + } else if (echo_output == "STDOUT") { + echo_stdout = true; + } else if (echo_output != "NONE") { + std::string error; + if (echo_output_from_variable) { + error = "CMAKE_EXECUTE_PROCESS_COMMAND_ECHO set to '"; + } else { + error = " called with '"; + } + error += echo_output; + error += "' expected STDERR|STDOUT|NONE"; + if (!echo_output_from_variable) { + error += " for COMMAND_ECHO."; + } + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, error); + return true; + } + } + if (echo_stdout || echo_stderr) { + std::string command; + for (auto& cmd : arguments.Commands) { + command += "'"; + command += cmJoin(cmd, "' '"); + command += "'"; + command += "\n"; + } + if (echo_stdout) { + std::cout << command; + } else if (echo_stderr) { + std::cerr << command; + } + } // Start the process. cmsysProcess_Execute(cp); diff --git a/Tests/RunCMake/execute_process/EchoCommand-result.txt b/Tests/RunCMake/execute_process/EchoCommand-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/execute_process/EchoCommand-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/execute_process/EchoCommand-stderr.txt b/Tests/RunCMake/execute_process/EchoCommand-stderr.txt new file mode 100644 index 0000000..f10ece8 --- /dev/null +++ b/Tests/RunCMake/execute_process/EchoCommand-stderr.txt @@ -0,0 +1,5 @@ +.*cmake.*-E' 'echo' '-- 2 COMMAND_ECHO STDERR' +.*cmake.*-E' 'echo' '-- 4 COMMAND_ECHO STDERR' +.*cmake.*-E' 'echo' '-- 8 COMMAND_ECHO STDOUT COMMAND_ECHO STDERR' +CMake Error at .*EchoCommand.cmake:.* \(execute_process\): + CMAKE_EXECUTE_PROCESS_COMMAND_ECHO set to 'BAD' expected STDERR|STDOUT|NONE$ diff --git a/Tests/RunCMake/execute_process/EchoCommand-stdout.txt b/Tests/RunCMake/execute_process/EchoCommand-stdout.txt new file mode 100644 index 0000000..0954b3b --- /dev/null +++ b/Tests/RunCMake/execute_process/EchoCommand-stdout.txt @@ -0,0 +1,12 @@ +.*cmake.*-E' 'echo' '-- 1 COMMAND_ECHO STDOUT' +-- 1 COMMAND_ECHO STDOUT +-- 2 COMMAND_ECHO STDERR +.*cmake.* '-E' 'echo' '-- 3 COMMAND_ECHO STDOUT' +-- 3 COMMAND_ECHO STDOUT +-- 4 COMMAND_ECHO STDERR +.*cmake.* '-E' 'echo' '-- 5 COMMAND_ECHO STDOUT' +-- 5 COMMAND_ECHO STDOUT +-- 6 COMMAND_ECHO NONE +.*cmake.* '-E' 'echo' '-- 7 COMMAND_ECHO STDERR COMMAND_ECHO STDOUT' +-- 7 COMMAND_ECHO STDERR COMMAND_ECHO STDOUT +-- 8 COMMAND_ECHO STDOUT COMMAND_ECHO STDERR$ diff --git a/Tests/RunCMake/execute_process/EchoCommand.cmake b/Tests/RunCMake/execute_process/EchoCommand.cmake new file mode 100644 index 0000000..9c7d13d --- /dev/null +++ b/Tests/RunCMake/execute_process/EchoCommand.cmake @@ -0,0 +1,41 @@ +if(CHECK_ERROR_OUTPUT_LOCATION) + execute_process(COMMAND ${CMAKE_COMMAND} -E echo + "-- 1 COMMAND_ECHO " COMMAND_ECHO ) +endif() +# test COMMAND_ECHO STDOUT +execute_process(COMMAND ${CMAKE_COMMAND} -E echo + "-- 1 COMMAND_ECHO STDOUT" COMMAND_ECHO STDOUT ) +# test COMMAND_ECHO STDERR +execute_process(COMMAND ${CMAKE_COMMAND} -E echo + "-- 2 COMMAND_ECHO STDERR" COMMAND_ECHO STDERR ) +# test CMAKE_EXECUTE_PROCESS_COMMAND_ECHO STDOUT +set(CMAKE_EXECUTE_PROCESS_COMMAND_ECHO STDOUT) +execute_process(COMMAND ${CMAKE_COMMAND} -E echo + "-- 3 COMMAND_ECHO STDOUT" ) +# test CMAKE_EXECUTE_PROCESS_COMMAND_ECHO STDERR +set(CMAKE_EXECUTE_PROCESS_COMMAND_ECHO STDERR) +execute_process(COMMAND ${CMAKE_COMMAND} -E echo + "-- 4 COMMAND_ECHO STDERR" ) +# make sure local will override global settings +execute_process(COMMAND ${CMAKE_COMMAND} -E echo + "-- 5 COMMAND_ECHO STDOUT" COMMAND_ECHO STDOUT ) +execute_process(COMMAND ${CMAKE_COMMAND} -E echo + "-- 6 COMMAND_ECHO NONE" COMMAND_ECHO NONE) +# test both and make sure override works +execute_process(COMMAND ${CMAKE_COMMAND} -E echo + "-- 7 COMMAND_ECHO STDERR COMMAND_ECHO STDOUT" COMMAND_ECHO STDERR + COMMAND_ECHO STDOUT) +execute_process(COMMAND ${CMAKE_COMMAND} -E echo + "-- 8 COMMAND_ECHO STDOUT COMMAND_ECHO STDERR" COMMAND_ECHO STDOUT + COMMAND_ECHO STDERR) + +# check for bad arguments to global and local +if(CHECK_GLOBAL) + # make sure a non STDERR or STDOUT value is an error + set(CMAKE_EXECUTE_PROCESS_COMMAND_ECHO BAD) + execute_process(COMMAND ${CMAKE_COMMAND} -E echo + "-- 9 - 1 CMAKE_EXECUTE_PROCESS_COMMAND_ECHO BAD" ) +else() + execute_process(COMMAND ${CMAKE_COMMAND} -E echo + "-- 9 - 2 COMMAND_ECHO BAD" COMMAND_ECHO BAD) +endif() diff --git a/Tests/RunCMake/execute_process/EchoCommand2-result.txt b/Tests/RunCMake/execute_process/EchoCommand2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/execute_process/EchoCommand2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/execute_process/EchoCommand2-stderr.txt b/Tests/RunCMake/execute_process/EchoCommand2-stderr.txt new file mode 100644 index 0000000..4ae01c4 --- /dev/null +++ b/Tests/RunCMake/execute_process/EchoCommand2-stderr.txt @@ -0,0 +1,5 @@ +.*cmake.*-E' 'echo' '-- 2 COMMAND_ECHO STDERR' +.*cmake.*-E' 'echo' '-- 4 COMMAND_ECHO STDERR' +.*cmake.*-E' 'echo' '-- 8 COMMAND_ECHO STDOUT COMMAND_ECHO STDERR' +CMake Error at .*EchoCommand.cmake:.* \(execute_process\): + called with 'BAD' expected STDERR|STDOUT|NONE for COMMAND_ECHO.$ diff --git a/Tests/RunCMake/execute_process/EchoCommand2-stdout.txt b/Tests/RunCMake/execute_process/EchoCommand2-stdout.txt new file mode 100644 index 0000000..0954b3b --- /dev/null +++ b/Tests/RunCMake/execute_process/EchoCommand2-stdout.txt @@ -0,0 +1,12 @@ +.*cmake.*-E' 'echo' '-- 1 COMMAND_ECHO STDOUT' +-- 1 COMMAND_ECHO STDOUT +-- 2 COMMAND_ECHO STDERR +.*cmake.* '-E' 'echo' '-- 3 COMMAND_ECHO STDOUT' +-- 3 COMMAND_ECHO STDOUT +-- 4 COMMAND_ECHO STDERR +.*cmake.* '-E' 'echo' '-- 5 COMMAND_ECHO STDOUT' +-- 5 COMMAND_ECHO STDOUT +-- 6 COMMAND_ECHO NONE +.*cmake.* '-E' 'echo' '-- 7 COMMAND_ECHO STDERR COMMAND_ECHO STDOUT' +-- 7 COMMAND_ECHO STDERR COMMAND_ECHO STDOUT +-- 8 COMMAND_ECHO STDOUT COMMAND_ECHO STDERR$ diff --git a/Tests/RunCMake/execute_process/EchoCommand3-result.txt b/Tests/RunCMake/execute_process/EchoCommand3-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/execute_process/EchoCommand3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/execute_process/EchoCommand3-stderr.txt b/Tests/RunCMake/execute_process/EchoCommand3-stderr.txt new file mode 100644 index 0000000..e27f1e6 --- /dev/null +++ b/Tests/RunCMake/execute_process/EchoCommand3-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*EchoCommand.cmake:.*\(execute_process\): + execute_process called with no value for COMMAND_ECHO. diff --git a/Tests/RunCMake/execute_process/RunCMakeTest.cmake b/Tests/RunCMake/execute_process/RunCMakeTest.cmake index cb40b40..b203aab 100644 --- a/Tests/RunCMake/execute_process/RunCMakeTest.cmake +++ b/Tests/RunCMake/execute_process/RunCMakeTest.cmake @@ -16,3 +16,11 @@ endif() if(EXIT_CODE_EXE) run_cmake_command(ExitValues ${CMAKE_COMMAND} -DEXIT_CODE_EXE=${EXIT_CODE_EXE} -P ${RunCMake_SOURCE_DIR}/ExitValues.cmake) endif() + +run_cmake_command(EchoCommand ${CMAKE_COMMAND} -DCHECK_GLOBAL=TRUE + -P ${RunCMake_SOURCE_DIR}/EchoCommand.cmake) +run_cmake_command(EchoCommand2 ${CMAKE_COMMAND} -P + ${RunCMake_SOURCE_DIR}/EchoCommand.cmake) +run_cmake_command(EchoCommand3 ${CMAKE_COMMAND} + -DCHECK_ERROR_OUTPUT_LOCATION=TRUE -P + ${RunCMake_SOURCE_DIR}/EchoCommand.cmake) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d350fb688954f476d8df79bf582cf366b5861dd2 commit d350fb688954f476d8df79bf582cf366b5861dd2 Author: Brad King AuthorDate: Fri Apr 19 13:31:52 2019 -0400 Commit: Brad King CommitDate: Fri Apr 19 13:32:08 2019 -0400 execute_process: Manage KWSys Process lifetime with unique_ptr diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx index ff6340f..de58c0b 100644 --- a/Source/cmExecuteProcessCommand.cxx +++ b/Source/cmExecuteProcessCommand.cxx @@ -119,7 +119,9 @@ bool cmExecuteProcessCommand::InitialPass(std::vector const& args, } // Create a process instance. - cmsysProcess* cp = cmsysProcess_New(); + std::unique_ptr cp_ptr( + cmsysProcess_New(), cmsysProcess_Delete); + cmsysProcess* cp = cp_ptr.get(); // Set the command sequence. for (std::vector const& cmd : arguments.Commands) { @@ -297,9 +299,6 @@ bool cmExecuteProcessCommand::InitialPass(std::vector const& args, } } - // Delete the process instance. - cmsysProcess_Delete(cp); - return true; } ----------------------------------------------------------------------- Summary of changes: Help/command/execute_process.rst | 5 ++ Help/manual/cmake-generator-expressions.7.rst | 3 +- Help/manual/cmake-server.7.rst | 5 ++ Help/manual/cmake-variables.7.rst | 1 + Help/prop_tgt/MSVC_RUNTIME_LIBRARY-VALUES.txt | 5 ++ .../dev/add-execute_process-command-echo.rst | 6 +++ .../relax-TARGET_OBJECTS-generator-expression.rst | 5 ++ Help/release/dev/server-deprecate.rst | 6 +++ .../CMAKE_EXECUTE_PROCESS_COMMAND_ECHO.rst | 6 +++ Modules/FindMPI.cmake | 26 +++++----- Source/cmExecuteProcessCommand.cxx | 57 ++++++++++++++++++++-- Source/cmGeneratorExpressionNode.cxx | 10 +++- Source/cmServerProtocol.cxx | 5 ++ Tests/GeneratorExpression/CMakeLists.txt | 45 +++++++++++++++++ Tests/MSVCRuntimeLibrary/CMakeLists.txt | 15 ++++++ Tests/ObjectLibrary/CMakeLists.txt | 10 ++++ .../OutputNameMatchesObjects-stderr.txt | 3 +- .../File_Generate/OutputNameMatchesObjects.cmake | 7 +-- .../ObjectLibrary/BadSourceExpression3-stderr.txt | 5 +- .../ObjectLibrary/BadSourceExpression3.cmake | 2 +- .../ObjectLibrary/CheckTargetObjects.cmake | 32 ++++++++++++ Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake | 5 ++ .../ObjectLibrary/check_object_files.cmake | 17 +++++++ .../TargetObjects/NotObjlibTarget-stderr.txt | 9 ++-- Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake | 4 +- .../VS10Project/RuntimeLibrary-check.cmake | 4 +- Tests/RunCMake/VS10Project/RuntimeLibrary.cmake | 4 ++ .../EchoCommand-result.txt} | 0 .../execute_process/EchoCommand-stderr.txt | 5 ++ .../execute_process/EchoCommand-stdout.txt | 12 +++++ Tests/RunCMake/execute_process/EchoCommand.cmake | 41 ++++++++++++++++ .../EchoCommand2-result.txt} | 0 .../execute_process/EchoCommand2-stderr.txt | 5 ++ .../execute_process/EchoCommand2-stdout.txt | 12 +++++ .../EchoCommand3-result.txt} | 0 .../execute_process/EchoCommand3-stderr.txt | 2 + Tests/RunCMake/execute_process/RunCMakeTest.cmake | 8 +++ 37 files changed, 350 insertions(+), 37 deletions(-) create mode 100644 Help/release/dev/add-execute_process-command-echo.rst create mode 100644 Help/release/dev/relax-TARGET_OBJECTS-generator-expression.rst create mode 100644 Help/release/dev/server-deprecate.rst create mode 100644 Help/variable/CMAKE_EXECUTE_PROCESS_COMMAND_ECHO.rst create mode 100644 Tests/RunCMake/ObjectLibrary/CheckTargetObjects.cmake create mode 100644 Tests/RunCMake/ObjectLibrary/check_object_files.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => execute_process/EchoCommand-result.txt} (100%) create mode 100644 Tests/RunCMake/execute_process/EchoCommand-stderr.txt create mode 100644 Tests/RunCMake/execute_process/EchoCommand-stdout.txt create mode 100644 Tests/RunCMake/execute_process/EchoCommand.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => execute_process/EchoCommand2-result.txt} (100%) create mode 100644 Tests/RunCMake/execute_process/EchoCommand2-stderr.txt create mode 100644 Tests/RunCMake/execute_process/EchoCommand2-stdout.txt copy Tests/RunCMake/{while/MissingArgument-result.txt => execute_process/EchoCommand3-result.txt} (100%) create mode 100644 Tests/RunCMake/execute_process/EchoCommand3-stderr.txt hooks/post-receive -- CMake From kwrobot at kitware.com Tue Apr 30 10:33:02 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 30 Apr 2019 10:33:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.3-790-g40852ee Message-ID: <20190430143302.8F97110F38F@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 40852eed8e304dffd7254d6790850e0a73766d9e (commit) via 8d93815d204b4827ff9f1280a73e55861c00f47c (commit) from d0e6fc28334023a42fbae797ece8c8e8526dc1c3 (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=40852eed8e304dffd7254d6790850e0a73766d9e commit 40852eed8e304dffd7254d6790850e0a73766d9e Merge: d0e6fc2 8d93815 Author: Kyle Edwards AuthorDate: Tue Apr 30 14:30:26 2019 +0000 Commit: Kitware Robot CommitDate: Tue Apr 30 10:30:35 2019 -0400 Merge topic 'source_group-tree-files' 8d93815d20 source_group command ensures that FILES arguments are actually files Acked-by: Kitware Robot Merge-request: !3265 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8d93815d204b4827ff9f1280a73e55861c00f47c commit 8d93815d204b4827ff9f1280a73e55861c00f47c Author: Mateusz Janek AuthorDate: Thu Apr 25 20:51:40 2019 +0200 Commit: Mateusz Janek CommitDate: Thu Apr 25 20:51:40 2019 +0200 source_group command ensures that FILES arguments are actually files diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx index 2bc4c39..5cdacaa 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/Source/cmSourceGroupCommand.cxx @@ -80,7 +80,10 @@ std::vector prepareFilesPathsForTree( prepared.reserve(filesPaths.size()); for (auto const& filePath : filesPaths) { - prepared.push_back(prepareFilePathForTree(filePath, currentSourceDir)); + // If provided file path is actually not a file, silently ignore it. + if (cmSystemTools::FileExists(filePath, /*isFile=*/true)) { + prepared.push_back(prepareFilePathForTree(filePath, currentSourceDir)); + } } return prepared; diff --git a/Tests/SourceGroups/CMakeLists.txt b/Tests/SourceGroups/CMakeLists.txt index 813774d..a5740bb 100644 --- a/Tests/SourceGroups/CMakeLists.txt +++ b/Tests/SourceGroups/CMakeLists.txt @@ -42,8 +42,16 @@ set(tree_files_with_prefix ${root}/tree_prefix_foo.c set(tree_files_with_empty_prefix ${root}/tree_empty_prefix_foo.c tree_empty_prefix_bar.c) +set(tree_files_which_are_actually_directories ${root} + ${root}/ + ${root}/sub1 + ${root}/sub1/) + source_group(TREE ${root} FILES ${tree_files_without_prefix}) +# Should not crash and not add any files - just silently ignore the directories +source_group(TREE ${root} FILES ${tree_files_which_are_actually_directories}) + source_group(FILES ${tree_files_with_prefix} PREFIX tree_root/subgroup TREE ${root}) source_group(PREFIX "" FILES ${tree_files_with_empty_prefix} TREE ${root}) ----------------------------------------------------------------------- Summary of changes: Source/cmSourceGroupCommand.cxx | 5 ++++- Tests/SourceGroups/CMakeLists.txt | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Apr 30 10:43:08 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 30 Apr 2019 10:43:08 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.3-794-gea026fb Message-ID: <20190430144308.25179FA993@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 ea026fb2198ebd47353270461059183bbff867bd (commit) via c74698cb75b9923517f7f87eacf04ca0eefc8e72 (commit) via 8cfd25db711c22f9478e565a496145577df24d77 (commit) via c0e6b22d0a81c0e0dc1ee87366790882a3d54667 (commit) from 40852eed8e304dffd7254d6790850e0a73766d9e (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=ea026fb2198ebd47353270461059183bbff867bd commit ea026fb2198ebd47353270461059183bbff867bd Merge: 40852ee c74698c Author: Brad King AuthorDate: Tue Apr 30 14:34:59 2019 +0000 Commit: Kitware Robot CommitDate: Tue Apr 30 10:35:11 2019 -0400 Merge topic 'cmuvstreambuf' c74698cb75 cmUVStreambuf: Add std::streambuf implementation for uv_stream_t 8cfd25db71 cmUVHandlePtr: Add cm::uv_loop_ptr c0e6b22d0a Refactor: Move/rename cmProcessGetPipes() to cmGetPipes() Acked-by: Kitware Robot Merge-request: !3240 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c74698cb75b9923517f7f87eacf04ca0eefc8e72 commit c74698cb75b9923517f7f87eacf04ca0eefc8e72 Author: Kyle Edwards AuthorDate: Tue Apr 16 17:58:02 2019 -0400 Commit: Kyle Edwards CommitDate: Thu Apr 25 12:14:00 2019 -0400 cmUVStreambuf: Add std::streambuf implementation for uv_stream_t This will allow std::istream/std::ostream-based interaction with processes spawned by libuv. diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 6fa046c..01c6cd7 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -388,6 +388,7 @@ set(SRCS cmUuid.cxx cmUVHandlePtr.cxx cmUVHandlePtr.h + cmUVStreambuf.h cmUVSignalHackRAII.h cmVariableWatch.cxx cmVariableWatch.h diff --git a/Source/cmUVStreambuf.h b/Source/cmUVStreambuf.h new file mode 100644 index 0000000..29e4fde --- /dev/null +++ b/Source/cmUVStreambuf.h @@ -0,0 +1,219 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cmUVStreambuf_h +#define cmUVStreambuf_h + +#include "cmUVHandlePtr.h" + +#include "cm_uv.h" + +#include +#include +#include +#include + +/* + * This file is based on example code from: + * + * http://www.voidcn.com/article/p-vjnlygmc-gy.html + * + * The example code was distributed under the following license: + * + * Copyright 2007 Edd Dawson. + * Distributed under the Boost Software License, Version 1.0. + * + * Boost Software License - Version 1.0 - August 17th, 2003 + * + * Permission is hereby granted, free of charge, to any person or organization + * obtaining a copy of the software and accompanying documentation covered by + * this license (the "Software") to use, reproduce, display, distribute, + * execute, and transmit the Software, and to prepare derivative works of the + * Software, and to permit third-parties to whom the Software is furnished to + * do so, all subject to the following: + * + * The copyright notices in the Software and this entire statement, including + * the above license grant, this restriction and the following disclaimer, + * must be included in all copies of the Software, in whole or in part, and + * all derivative works of the Software, unless such copies or derivative + * works are solely in the form of machine-executable object code generated by + * a source language processor. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT + * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE + * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +template > +class cmBasicUVStreambuf : public std::basic_streambuf +{ +public: + cmBasicUVStreambuf(std::size_t bufSize = 256, std::size_t putBack = 8); + ~cmBasicUVStreambuf() override; + + bool is_open() const; + + cmBasicUVStreambuf* open(uv_stream_t* stream); + + cmBasicUVStreambuf* close(); + +protected: + typename cmBasicUVStreambuf::int_type underflow() override; + std::streamsize showmanyc() override; + + // FIXME: Add write support + +private: + uv_stream_t* Stream = nullptr; + void* OldStreamData; + const std::size_t PutBack; + std::vector InputBuffer; + bool EndOfFile; + + void StreamReadStartStop(); + + void StreamRead(ssize_t nread); + void HandleAlloc(uv_buf_t* buf); +}; + +template +cmBasicUVStreambuf::cmBasicUVStreambuf(std::size_t bufSize, + std::size_t putBack) + : PutBack(std::max(putBack, 1)) + , InputBuffer(std::max(this->PutBack, bufSize) + this->PutBack) +{ + this->close(); +} + +template +cmBasicUVStreambuf::~cmBasicUVStreambuf() +{ + this->close(); +} + +template +bool cmBasicUVStreambuf::is_open() const +{ + return this->Stream != nullptr; +} + +template +cmBasicUVStreambuf* cmBasicUVStreambuf::open( + uv_stream_t* stream) +{ + this->close(); + this->Stream = stream; + this->EndOfFile = false; + if (this->Stream) { + this->OldStreamData = this->Stream->data; + this->Stream->data = this; + } + this->StreamReadStartStop(); + return this; +} + +template +cmBasicUVStreambuf* cmBasicUVStreambuf::close() +{ + if (this->Stream) { + uv_read_stop(this->Stream); + this->Stream->data = this->OldStreamData; + } + this->Stream = nullptr; + CharT* readEnd = this->InputBuffer.data() + this->InputBuffer.size(); + this->setg(readEnd, readEnd, readEnd); + return this; +} + +template +typename cmBasicUVStreambuf::int_type +cmBasicUVStreambuf::underflow() +{ + if (!this->is_open()) { + return Traits::eof(); + } + + if (this->gptr() < this->egptr()) { + return Traits::to_int_type(*this->gptr()); + } + + this->StreamReadStartStop(); + while (this->in_avail() == 0) { + uv_run(this->Stream->loop, UV_RUN_ONCE); + } + if (this->in_avail() == -1) { + return Traits::eof(); + } + return Traits::to_int_type(*this->gptr()); +} + +template +std::streamsize cmBasicUVStreambuf::showmanyc() +{ + if (!this->is_open() || this->EndOfFile) { + return -1; + } + return 0; +} + +template +void cmBasicUVStreambuf::StreamReadStartStop() +{ + if (this->Stream) { + uv_read_stop(this->Stream); + if (this->gptr() >= this->egptr()) { + uv_read_start( + this->Stream, + [](uv_handle_t* handle, size_t /* unused */, uv_buf_t* buf) { + auto streambuf = + static_cast*>(handle->data); + streambuf->HandleAlloc(buf); + }, + [](uv_stream_t* stream2, ssize_t nread, const uv_buf_t* /* unused */) { + auto streambuf = + static_cast*>(stream2->data); + streambuf->StreamRead(nread); + }); + } + } +} + +template +void cmBasicUVStreambuf::HandleAlloc(uv_buf_t* buf) +{ + auto size = this->egptr() - this->gptr(); + std::memmove(this->InputBuffer.data(), this->gptr(), + this->egptr() - this->gptr()); + this->setg(this->InputBuffer.data(), this->InputBuffer.data(), + this->InputBuffer.data() + size); + buf->base = this->egptr(); +#ifdef _WIN32 +# define BUF_LEN_TYPE ULONG +#else +# define BUF_LEN_TYPE size_t +#endif + buf->len = BUF_LEN_TYPE( + (this->InputBuffer.data() + this->InputBuffer.size() - this->egptr()) * + sizeof(CharT)); +#undef BUF_LEN_TYPE +} + +template +void cmBasicUVStreambuf::StreamRead(ssize_t nread) +{ + if (nread > 0) { + this->setg(this->eback(), this->gptr(), + this->egptr() + nread / sizeof(CharT)); + uv_read_stop(this->Stream); + } else if (nread < 0 || nread == UV_EOF) { + this->EndOfFile = true; + uv_read_stop(this->Stream); + } +} + +using cmUVStreambuf = cmBasicUVStreambuf; + +#endif diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt index 031ab01..e04bba2 100644 --- a/Tests/CMakeLib/CMakeLists.txt +++ b/Tests/CMakeLib/CMakeLists.txt @@ -16,9 +16,11 @@ set(CMakeLib_TESTS testXMLSafe.cxx testFindPackageCommand.cxx testUVRAII.cxx + testUVStreambuf.cxx ) set(testRST_ARGS ${CMAKE_CURRENT_SOURCE_DIR}) +set(testUVStreambuf_ARGS $) if(WIN32) list(APPEND CMakeLib_TESTS @@ -43,7 +45,7 @@ target_link_libraries(testEncoding cmsys) foreach(testfile ${CMakeLib_TESTS}) get_filename_component(test "${testfile}" NAME_WE) - add_test(CMakeLib.${test} CMakeLibTests ${test} ${${test}_ARGS}) + add_test(NAME CMakeLib.${test} COMMAND CMakeLibTests ${test} ${${test}_ARGS}) endforeach() if(TEST_CompileCommandOutput) diff --git a/Tests/CMakeLib/testUVStreambuf.cxx b/Tests/CMakeLib/testUVStreambuf.cxx new file mode 100644 index 0000000..39655f3 --- /dev/null +++ b/Tests/CMakeLib/testUVStreambuf.cxx @@ -0,0 +1,457 @@ +#include "cmUVStreambuf.h" + +#include "cmGetPipes.h" +#include "cmUVHandlePtr.h" + +#include "cm_uv.h" + +#include +#include +#include + +#include + +#include + +#define TEST_STR_LINE_1 "This string must be exactly 128 characters long so" +#define TEST_STR_LINE_2 "that we can test CMake's std::streambuf integration" +#define TEST_STR_LINE_3 "with libuv's uv_stream_t." +#define TEST_STR TEST_STR_LINE_1 "\n" TEST_STR_LINE_2 "\n" TEST_STR_LINE_3 + +bool writeDataToStreamPipe(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe, + char* outputData, unsigned int outputDataLength, + const char* /* unused */) +{ + int err; + + // Create the pipe + int pipeHandles[2]; + if (cmGetPipes(pipeHandles) < 0) { + std::cout << "Could not open pipe" << std::endl; + return false; + } + + cm::uv_pipe_ptr outputPipe; + inputPipe.init(loop, 0); + outputPipe.init(loop, 0); + uv_pipe_open(inputPipe, pipeHandles[0]); + uv_pipe_open(outputPipe, pipeHandles[1]); + + // Write data for reading + uv_write_t writeReq; + struct WriteCallbackData + { + bool Finished = false; + int Status; + } writeData; + writeReq.data = &writeData; + uv_buf_t outputBuf; + outputBuf.base = outputData; + outputBuf.len = outputDataLength; + if ((err = uv_write(&writeReq, outputPipe, &outputBuf, 1, + [](uv_write_t* req, int status) { + auto data = static_cast(req->data); + data->Finished = true; + data->Status = status; + })) < 0) { + std::cout << "Could not write to pipe: " << uv_strerror(err) << std::endl; + return false; + } + while (!writeData.Finished) { + uv_run(&loop, UV_RUN_ONCE); + } + if (writeData.Status < 0) { + std::cout << "Status is " << uv_strerror(writeData.Status) + << ", should be 0" << std::endl; + return false; + } + + return true; +} + +bool writeDataToStreamProcess(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe, + char* outputData, unsigned int /* unused */, + const char* cmakeCommand) +{ + int err; + + inputPipe.init(loop, 0); + std::vector arguments = { cmakeCommand, "-E", "echo_append", + outputData }; + std::vector processArgs; + for (auto const& arg : arguments) { + processArgs.push_back(arg.c_str()); + } + processArgs.push_back(nullptr); + std::vector stdio(3); + stdio[0].flags = UV_IGNORE; + stdio[0].data.stream = nullptr; + stdio[1].flags = + static_cast(UV_CREATE_PIPE | UV_WRITABLE_PIPE); + stdio[1].data.stream = inputPipe; + stdio[2].flags = UV_IGNORE; + stdio[2].data.stream = nullptr; + + struct ProcessExitData + { + bool Finished = false; + int64_t ExitStatus; + int TermSignal; + } exitData; + cm::uv_process_ptr process; + auto options = uv_process_options_t(); + options.file = cmakeCommand; + options.args = const_cast(processArgs.data()); + options.flags = UV_PROCESS_WINDOWS_HIDE; + options.stdio = stdio.data(); + options.stdio_count = static_cast(stdio.size()); + options.exit_cb = [](uv_process_t* handle, int64_t exitStatus, + int termSignal) { + auto data = static_cast(handle->data); + data->Finished = true; + data->ExitStatus = exitStatus; + data->TermSignal = termSignal; + }; + if ((err = process.spawn(loop, options, &exitData)) < 0) { + std::cout << "Could not spawn process: " << uv_strerror(err) << std::endl; + return false; + } + while (!exitData.Finished) { + uv_run(&loop, UV_RUN_ONCE); + } + if (exitData.ExitStatus != 0) { + std::cout << "Process exit status is " << exitData.ExitStatus + << ", should be 0" << std::endl; + return false; + } + if (exitData.TermSignal != 0) { + std::cout << "Process term signal is " << exitData.TermSignal + << ", should be 0" << std::endl; + return false; + } + + return true; +} + +bool testUVStreambufRead( + bool (*cb)(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe, char* outputData, + unsigned int outputDataLength, const char* cmakeCommand), + const char* cmakeCommand) +{ + char outputData[] = TEST_STR; + bool success = false; + cm::uv_loop_ptr loop; + loop.init(); + cm::uv_pipe_ptr inputPipe; + std::vector inputData(128); + std::streamsize readLen; + std::string line; + cm::uv_timer_ptr timer; + + // Create the streambuf + cmUVStreambuf inputBuf(64); + std::istream inputStream(&inputBuf); + if (inputBuf.is_open()) { + std::cout << "is_open() is true, should be false" << std::endl; + goto end; + } + if ((readLen = inputBuf.in_avail()) != -1) { + std::cout << "in_avail() returned " << readLen << ", should be -1" + << std::endl; + goto end; + } + if ((readLen = inputBuf.sgetn(inputData.data(), 128)) != 0) { + std::cout << "sgetn() returned " << readLen << ", should be 0" + << std::endl; + goto end; + } + + // Perform first read test - read all the data + if (!cb(*loop, inputPipe, outputData, 128, cmakeCommand)) { + goto end; + } + inputBuf.open(inputPipe); + if (!inputBuf.is_open()) { + std::cout << "is_open() is false, should be true" << std::endl; + goto end; + } + if ((readLen = inputBuf.in_avail()) != 0) { + std::cout << "in_avail() returned " << readLen << ", should be 0" + << std::endl; + goto end; + } + if ((readLen = inputBuf.sgetn(inputData.data(), 128)) != 128) { + std::cout << "sgetn() returned " << readLen << ", should be 128" + << std::endl; + goto end; + } + if ((readLen = inputBuf.in_avail()) != 0) { + std::cout << "in_avail() returned " << readLen << ", should be 0" + << std::endl; + goto end; + } + if (std::memcmp(inputData.data(), outputData, 128)) { + std::cout << "Read data does not match write data" << std::endl; + goto end; + } + if ((readLen = inputBuf.sgetn(inputData.data(), 128)) != 0) { + std::cout << "sgetn() returned " << readLen << ", should be 0" + << std::endl; + goto end; + } + if ((readLen = inputBuf.in_avail()) != -1) { + std::cout << "in_avail() returned " << readLen << ", should be -1" + << std::endl; + goto end; + } + inputData.assign(128, char{}); + inputBuf.close(); + if (inputBuf.is_open()) { + std::cout << "is_open() is true, should be false" << std::endl; + goto end; + } + if ((readLen = inputBuf.sgetn(inputData.data(), 128)) != 0) { + std::cout << "sgetn() returned " << readLen << ", should be 0" + << std::endl; + goto end; + } + if ((readLen = inputBuf.in_avail()) != -1) { + std::cout << "in_avail() returned " << readLen << ", should be -1" + << std::endl; + goto end; + } + + // Perform second read test - read some data and then close + if (!cb(*loop, inputPipe, outputData, 128, cmakeCommand)) { + goto end; + } + inputBuf.open(inputPipe); + if (!inputBuf.is_open()) { + std::cout << "is_open() is false, should be true" << std::endl; + goto end; + } + if ((readLen = inputBuf.in_avail()) != 0) { + std::cout << "in_avail() returned " << readLen << ", should be 0" + << std::endl; + goto end; + } + if ((readLen = inputBuf.sgetn(inputData.data(), 64)) != 64) { + std::cout << "sgetn() returned " << readLen << ", should be 64" + << std::endl; + goto end; + } + if (std::memcmp(inputData.data(), outputData, 64)) { + std::cout << "Read data does not match write data" << std::endl; + goto end; + } + if ((readLen = inputBuf.in_avail()) != 8) { + std::cout << "in_avail() returned " << readLen << ", should be 8" + << std::endl; + goto end; + } + inputData.assign(128, char{}); + inputBuf.close(); + if (inputBuf.is_open()) { + std::cout << "is_open() is true, should be false" << std::endl; + goto end; + } + if ((readLen = inputBuf.in_avail()) != -1) { + std::cout << "in_avail() returned " << readLen << ", should be -1" + << std::endl; + goto end; + } + if ((readLen = inputBuf.sgetn(inputData.data(), 128)) != 0) { + std::cout << "sgetn() returned " << readLen << ", should be 0" + << std::endl; + goto end; + } + + // Perform third read test - read line by line + if (!cb(*loop, inputPipe, outputData, 128, cmakeCommand)) { + goto end; + } + inputBuf.open(inputPipe); + if (!inputBuf.is_open()) { + std::cout << "is_open() is false, should be true" << std::endl; + goto end; + } + if ((readLen = inputBuf.in_avail()) != 0) { + std::cout << "in_avail() returned " << readLen << ", should be 0" + << std::endl; + goto end; + } + + if (!std::getline(inputStream, line)) { + std::cout << "getline returned false, should be true" << std::endl; + goto end; + } + if (line != TEST_STR_LINE_1) { + std::cout << "Line 1 is \"" << line + << "\", should be \"" TEST_STR_LINE_1 "\"" << std::endl; + goto end; + } + + if (!std::getline(inputStream, line)) { + std::cout << "getline returned false, should be true" << std::endl; + goto end; + } + if (line != TEST_STR_LINE_2) { + std::cout << "Line 2 is \"" << line + << "\", should be \"" TEST_STR_LINE_2 "\"" << std::endl; + goto end; + } + + if (!std::getline(inputStream, line)) { + std::cout << "getline returned false, should be true" << std::endl; + goto end; + } + if (line != TEST_STR_LINE_3) { + std::cout << "Line 3 is \"" << line + << "\", should be \"" TEST_STR_LINE_3 "\"" << std::endl; + goto end; + } + + if (std::getline(inputStream, line)) { + std::cout << "getline returned true, should be false" << std::endl; + goto end; + } + + inputBuf.close(); + if (inputBuf.is_open()) { + std::cout << "is_open() is true, should be false" << std::endl; + goto end; + } + if ((readLen = inputBuf.in_avail()) != -1) { + std::cout << "in_avail() returned " << readLen << ", should be -1" + << std::endl; + goto end; + } + if ((readLen = inputBuf.sgetn(inputData.data(), 128)) != 0) { + std::cout << "sgetn() returned " << readLen << ", should be 0" + << std::endl; + goto end; + } + + // Perform fourth read test - run the event loop outside of underflow() + if (!cb(*loop, inputPipe, outputData, 128, cmakeCommand)) { + goto end; + } + inputBuf.open(inputPipe); + if (!inputBuf.is_open()) { + std::cout << "is_open() is false, should be true" << std::endl; + goto end; + } + if ((readLen = inputBuf.in_avail()) != 0) { + std::cout << "in_avail() returned " << readLen << ", should be 0" + << std::endl; + goto end; + } + uv_run(loop, UV_RUN_DEFAULT); + if ((readLen = inputBuf.in_avail()) != 72) { + std::cout << "in_avail() returned " << readLen << ", should be 72" + << std::endl; + goto end; + } + if ((readLen = inputBuf.sgetn(inputData.data(), 128)) != 128) { + std::cout << "sgetn() returned " << readLen << ", should be 128" + << std::endl; + goto end; + } + if ((readLen = inputBuf.in_avail()) != 0) { + std::cout << "in_avail() returned " << readLen << ", should be 0" + << std::endl; + goto end; + } + if ((readLen = inputBuf.sgetn(inputData.data(), 128)) != 0) { + std::cout << "sgetn() returned " << readLen << ", should be 128" + << std::endl; + goto end; + } + if ((readLen = inputBuf.in_avail()) != -1) { + std::cout << "in_avail() returned " << readLen << ", should be -1" + << std::endl; + goto end; + } + + inputBuf.close(); + if (inputBuf.is_open()) { + std::cout << "is_open() is true, should be false" << std::endl; + goto end; + } + if ((readLen = inputBuf.in_avail()) != -1) { + std::cout << "in_avail() returned " << readLen << ", should be -1" + << std::endl; + goto end; + } + if ((readLen = inputBuf.sgetn(inputData.data(), 128)) != 0) { + std::cout << "sgetn() returned " << readLen << ", should be 0" + << std::endl; + goto end; + } + + // Perform fifth read test - close the streambuf in the middle of a read + timer.init(*loop, &inputBuf); + if (!cb(*loop, inputPipe, outputData, 128, cmakeCommand)) { + goto end; + } + inputBuf.open(inputPipe); + if (!inputBuf.is_open()) { + std::cout << "is_open() is false, should be true" << std::endl; + goto end; + } + if ((readLen = inputBuf.in_avail()) != 0) { + std::cout << "in_avail() returned " << readLen << ", should be 0" + << std::endl; + goto end; + } + uv_timer_start(timer, + [](uv_timer_t* handle) { + auto buf = static_cast(handle->data); + buf->close(); + }, + 0, 0); + if ((readLen = inputBuf.sgetn(inputData.data(), 128)) != 0) { + std::cout << "sgetn() returned " << readLen << ", should be 0" + << std::endl; + goto end; + } + if (inputBuf.is_open()) { + std::cout << "is_open() is true, should be false" << std::endl; + goto end; + } + if ((readLen = inputBuf.in_avail()) != -1) { + std::cout << "in_avail() returned " << readLen << ", should be -1" + << std::endl; + goto end; + } + if ((readLen = inputBuf.sgetn(inputData.data(), 128)) != 0) { + std::cout << "sgetn() returned " << readLen << ", should be 0" + << std::endl; + goto end; + } + + success = true; + +end: + return success; +} + +int testUVStreambuf(int argc, char** const argv) +{ + if (argc < 2) { + std::cout << "Invalid arguments.\n"; + return -1; + } + + if (!testUVStreambufRead(writeDataToStreamPipe, argv[1])) { + std::cout << "While executing testUVStreambufRead() with pipe.\n"; + return -1; + } + + if (!testUVStreambufRead(writeDataToStreamProcess, argv[1])) { + std::cout << "While executing testUVStreambufRead() with process.\n"; + return -1; + } + + return 0; +} https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8cfd25db711c22f9478e565a496145577df24d77 commit 8cfd25db711c22f9478e565a496145577df24d77 Author: Kyle Edwards AuthorDate: Tue Apr 23 13:37:26 2019 -0400 Commit: Kyle Edwards CommitDate: Thu Apr 25 12:03:08 2019 -0400 cmUVHandlePtr: Add cm::uv_loop_ptr diff --git a/Source/cmUVHandlePtr.cxx b/Source/cmUVHandlePtr.cxx index fd07d2d..27069ee 100644 --- a/Source/cmUVHandlePtr.cxx +++ b/Source/cmUVHandlePtr.cxx @@ -11,19 +11,59 @@ namespace cm { -static void close_delete(uv_handle_t* h) +struct uv_loop_deleter { - free(h); + void operator()(uv_loop_t* loop) const; +}; + +void uv_loop_deleter::operator()(uv_loop_t* loop) const +{ + uv_run(loop, UV_RUN_DEFAULT); + int result = uv_loop_close(loop); + (void)result; + assert(result >= 0); + free(loop); +} + +int uv_loop_ptr::init(void* data) +{ + this->reset(); + + this->loop.reset(static_cast(calloc(1, sizeof(uv_loop_t))), + uv_loop_deleter()); + this->loop->data = data; + + return uv_loop_init(this->loop.get()); +} + +void uv_loop_ptr::reset() +{ + this->loop.reset(); +} + +uv_loop_ptr::operator uv_loop_t*() +{ + return this->loop.get(); +} + +uv_loop_t* uv_loop_ptr::operator->() const noexcept +{ + return this->loop.get(); +} + +uv_loop_t* uv_loop_ptr::get() const +{ + return this->loop.get(); } template -static void default_delete(T* type_handle) +static void handle_default_delete(T* type_handle) { auto handle = reinterpret_cast(type_handle); if (handle) { assert(!uv_is_closing(handle)); if (!uv_is_closing(handle)) { - uv_close(handle, &close_delete); + uv_close(handle, [](uv_handle_t* h) { free(h); }); } } } @@ -34,7 +74,7 @@ static void default_delete(T* type_handle) template struct uv_handle_deleter { - void operator()(T* type_handle) const { default_delete(type_handle); } + void operator()(T* type_handle) const { handle_default_delete(type_handle); } }; template @@ -107,7 +147,7 @@ struct uv_handle_deleter void operator()(uv_async_t* handle) { std::lock_guard lock(*handleMutex); - default_delete(handle); + handle_default_delete(handle); } }; @@ -136,7 +176,7 @@ struct uv_handle_deleter { if (handle) { uv_signal_stop(handle); - default_delete(handle); + handle_default_delete(handle); } } }; diff --git a/Source/cmUVHandlePtr.h b/Source/cmUVHandlePtr.h index 992c429..c09e4bf 100644 --- a/Source/cmUVHandlePtr.h +++ b/Source/cmUVHandlePtr.h @@ -30,7 +30,45 @@ namespace cm { /*** - * RAII class to simplify and insure the safe usage of uv_*_t types. This + * RAII class to simplify and ensure the safe usage of uv_loop_t. This includes + * making sure resources are properly freed. + */ +class uv_loop_ptr +{ +protected: + std::shared_ptr loop; + +public: + uv_loop_ptr(uv_loop_ptr const&) = delete; + uv_loop_ptr& operator=(uv_loop_ptr const&) = delete; + uv_loop_ptr(uv_loop_ptr&&) noexcept; + uv_loop_ptr& operator=(uv_loop_ptr&&) noexcept; + + // Dtor and ctor need to be inline defined like this for default ctors and + // dtors to work. Some compilers do not like '= default' here. + uv_loop_ptr() {} // NOLINT(modernize-use-equals-default) + uv_loop_ptr(std::nullptr_t) {} + ~uv_loop_ptr() { this->reset(); } + + int init(void* data = nullptr); + + /** + * Properly close the handle if needed and sets the inner handle to nullptr + */ + void reset(); + + /** + * Allow less verbose calling of uv_loop_* functions + * @return reinterpreted handle + */ + operator uv_loop_t*(); + + uv_loop_t* get() const; + uv_loop_t* operator->() const noexcept; +}; + +/*** + * RAII class to simplify and ensure the safe usage of uv_*_t types. This * includes making sure resources are properly freed and contains casting * operators which allow for passing into relevant uv_* functions. * diff --git a/Tests/CMakeLib/testUVRAII.cxx b/Tests/CMakeLib/testUVRAII.cxx index 1c1da76..2aeaf2c 100644 --- a/Tests/CMakeLib/testUVRAII.cxx +++ b/Tests/CMakeLib/testUVRAII.cxx @@ -171,11 +171,59 @@ static bool testAllMoves() return true; }; +static bool testLoopReset() +{ + bool closed = false; + cm::uv_loop_ptr loop; + loop.init(); + + uv_timer_t timer; + uv_timer_init(loop, &timer); + timer.data = &closed; + uv_close(reinterpret_cast(&timer), [](uv_handle_t* handle) { + auto closedPtr = static_cast(handle->data); + *closedPtr = true; + }); + + loop.reset(); + if (!closed) { + std::cerr << "uv_loop_ptr did not finish" << std::endl; + return false; + } + + return true; +}; + +static bool testLoopDestructor() +{ + bool closed = false; + + uv_timer_t timer; + { + cm::uv_loop_ptr loop; + loop.init(); + + uv_timer_init(loop, &timer); + timer.data = &closed; + uv_close(reinterpret_cast(&timer), [](uv_handle_t* handle) { + auto closedPtr = static_cast(handle->data); + *closedPtr = true; + }); + } + + if (!closed) { + std::cerr << "uv_loop_ptr did not finish" << std::endl; + return false; + } + + return true; +}; + int testUVRAII(int, char** const) { if ((testAsyncShutdown() && testAsyncDtor() & testAsyncMove() & testCrossAssignment() & - testAllMoves()) == 0) { + testAllMoves() & testLoopReset() & testLoopDestructor()) == 0) { return -1; } return 0; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c0e6b22d0a81c0e0dc1ee87366790882a3d54667 commit c0e6b22d0a81c0e0dc1ee87366790882a3d54667 Author: Kyle Edwards AuthorDate: Tue Apr 16 17:55:39 2019 -0400 Commit: Kyle Edwards CommitDate: Thu Apr 25 12:03:08 2019 -0400 Refactor: Move/rename cmProcessGetPipes() to cmGetPipes() diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 49f237f..6fa046c 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -264,6 +264,8 @@ set(SRCS cmGeneratorExpression.h cmGeneratorTarget.cxx cmGeneratorTarget.h + cmGetPipes.cxx + cmGetPipes.h cmGlobalCommonGenerator.cxx cmGlobalCommonGenerator.h cmGlobalGenerator.cxx diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index bfe8d70..a2c30bb 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -5,61 +5,19 @@ #include "cmCTest.h" #include "cmCTestRunTest.h" #include "cmCTestTestHandler.h" +#include "cmGetPipes.h" #include "cmsys/Process.h" -#include #include #include #include #if defined(_WIN32) # include "cm_kwiml.h" -#else -# include #endif #include #define CM_PROCESS_BUF_SIZE 65536 -#if defined(_WIN32) && !defined(__CYGWIN__) -# include - -static int cmProcessGetPipes(int* fds) -{ - SECURITY_ATTRIBUTES attr; - HANDLE readh, writeh; - attr.nLength = sizeof(attr); - attr.lpSecurityDescriptor = nullptr; - attr.bInheritHandle = FALSE; - if (!CreatePipe(&readh, &writeh, &attr, 0)) - return uv_translate_sys_error(GetLastError()); - fds[0] = _open_osfhandle((intptr_t)readh, 0); - fds[1] = _open_osfhandle((intptr_t)writeh, 0); - if (fds[0] == -1 || fds[1] == -1) { - CloseHandle(readh); - CloseHandle(writeh); - return uv_translate_sys_error(GetLastError()); - } - return 0; -} -#else -# include - -static int cmProcessGetPipes(int* fds) -{ - if (pipe(fds) == -1) { - return uv_translate_sys_error(errno); - } - - if (fcntl(fds[0], F_SETFD, FD_CLOEXEC) == -1 || - fcntl(fds[1], F_SETFD, FD_CLOEXEC) == -1) { - close(fds[0]); - close(fds[1]); - return uv_translate_sys_error(errno); - } - return 0; -} -#endif - cmProcess::cmProcess(cmCTestRunTest& runner) : Runner(runner) , Conv(cmProcessOutput::UTF8, CM_PROCESS_BUF_SIZE) @@ -120,7 +78,7 @@ bool cmProcess::StartProcess(uv_loop_t& loop, std::vector* affinity) pipe_reader.init(loop, 0, this); int fds[2] = { -1, -1 }; - status = cmProcessGetPipes(fds); + status = cmGetPipes(fds); if (status != 0) { cmCTestLog(this->Runner.GetCTest(), ERROR_MESSAGE, "Error initializing pipe: " << uv_strerror(status) diff --git a/Source/cmGetPipes.cxx b/Source/cmGetPipes.cxx new file mode 100644 index 0000000..ad323f7 --- /dev/null +++ b/Source/cmGetPipes.cxx @@ -0,0 +1,48 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmGetPipes.h" + +#include "cm_uv.h" + +#include + +#if defined(_WIN32) && !defined(__CYGWIN__) +# include + +int cmGetPipes(int* fds) +{ + SECURITY_ATTRIBUTES attr; + HANDLE readh, writeh; + attr.nLength = sizeof(attr); + attr.lpSecurityDescriptor = nullptr; + attr.bInheritHandle = FALSE; + if (!CreatePipe(&readh, &writeh, &attr, 0)) + return uv_translate_sys_error(GetLastError()); + fds[0] = _open_osfhandle((intptr_t)readh, 0); + fds[1] = _open_osfhandle((intptr_t)writeh, 0); + if (fds[0] == -1 || fds[1] == -1) { + CloseHandle(readh); + CloseHandle(writeh); + return uv_translate_sys_error(GetLastError()); + } + return 0; +} +#else +# include +# include + +int cmGetPipes(int* fds) +{ + if (pipe(fds) == -1) { + return uv_translate_sys_error(errno); + } + + if (fcntl(fds[0], F_SETFD, FD_CLOEXEC) == -1 || + fcntl(fds[1], F_SETFD, FD_CLOEXEC) == -1) { + close(fds[0]); + close(fds[1]); + return uv_translate_sys_error(errno); + } + return 0; +} +#endif diff --git a/Source/cmGetPipes.h b/Source/cmGetPipes.h new file mode 100644 index 0000000..2a46b51 --- /dev/null +++ b/Source/cmGetPipes.h @@ -0,0 +1,8 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cmGetPipes_h +#define cmGetPipes_h + +int cmGetPipes(int* fds); + +#endif ----------------------------------------------------------------------- Summary of changes: Source/CMakeLists.txt | 3 + Source/CTest/cmProcess.cxx | 46 +-- Source/cmGetPipes.cxx | 48 +++ .../{CPack/cmCPackConfigure.h.in => cmGetPipes.h} | 6 + Source/cmUVHandlePtr.cxx | 54 ++- Source/cmUVHandlePtr.h | 40 +- Source/cmUVStreambuf.h | 219 ++++++++++ Tests/CMakeLib/CMakeLists.txt | 4 +- Tests/CMakeLib/testUVRAII.cxx | 50 ++- Tests/CMakeLib/testUVStreambuf.cxx | 457 +++++++++++++++++++++ 10 files changed, 873 insertions(+), 54 deletions(-) create mode 100644 Source/cmGetPipes.cxx copy Source/{CPack/cmCPackConfigure.h.in => cmGetPipes.h} (65%) create mode 100644 Source/cmUVStreambuf.h create mode 100644 Tests/CMakeLib/testUVStreambuf.cxx hooks/post-receive -- CMake From kwrobot at kitware.com Tue Apr 30 18:43:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 30 Apr 2019 18:43:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.14.3-798-ge138207 Message-ID: <20190430224306.8DB91FAA7C@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 e138207c42f39e8cc49a7f954a75b2a8da522e6a (commit) via 599587feb1685eb75b7efe32cfcc16fed13d65b5 (commit) via 6cc93b370ef59208b9b468ebc9d84cc02e3cbd85 (commit) via 377d1b7896e07a171bcfe8da6d9dcda6545052c2 (commit) from ea026fb2198ebd47353270461059183bbff867bd (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=e138207c42f39e8cc49a7f954a75b2a8da522e6a commit e138207c42f39e8cc49a7f954a75b2a8da522e6a Merge: ea026fb 599587f Author: Craig Scott AuthorDate: Tue Apr 30 22:34:49 2019 +0000 Commit: Kitware Robot CommitDate: Tue Apr 30 18:35:06 2019 -0400 Merge topic 'message-new-types-and-logging' 599587feb1 message(): Minor code modernization 6cc93b370e message(): Add support for log levels 377d1b7896 cmSystemTools: Remove unused message-related code, simplify logic Acked-by: Kitware Robot Acked-by: Brad King Merge-request: !3268 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=599587feb1685eb75b7efe32cfcc16fed13d65b5 commit 599587feb1685eb75b7efe32cfcc16fed13d65b5 Author: Alex Turbov AuthorDate: Sat Apr 27 18:31:33 2019 +1000 Commit: Craig Scott CommitDate: Sun Apr 28 22:45:44 2019 +1000 message(): Minor code modernization diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index 7242037..5320ec5 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -22,11 +22,11 @@ bool cmMessageCommand::InitialPass(std::vector const& args, this->SetError("called with incorrect number of arguments"); return false; } - std::vector::const_iterator i = args.begin(); + auto i = args.cbegin(); - MessageType type = MessageType::MESSAGE; - bool status = false; - bool fatal = false; + auto type = MessageType::MESSAGE; + auto status = false; + auto fatal = false; auto level = cmake::LogLevel::LOG_UNDEFINED; if (*i == "SEND_ERROR") { type = MessageType::FATAL_ERROR; @@ -103,7 +103,7 @@ bool cmMessageCommand::InitialPass(std::vector const& args, return true; } - std::string message = cmJoin(cmMakeRange(i, args.end()), std::string()); + auto message = cmJoin(cmMakeRange(i, args.cend()), ""); if (type != MessageType::MESSAGE) { // we've overridden the message type, above, so display it directly https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6cc93b370ef59208b9b468ebc9d84cc02e3cbd85 commit 6cc93b370ef59208b9b468ebc9d84cc02e3cbd85 Author: Alex Turbov AuthorDate: Sat Apr 27 17:31:03 2019 +1000 Commit: Craig Scott CommitDate: Sun Apr 28 22:45:44 2019 +1000 message(): Add support for log levels Relates: #18943 Co-Authored-By: Craig Scott diff --git a/Auxiliary/bash-completion/cmake b/Auxiliary/bash-completion/cmake index 8c0c5e8..638b1c4 100644 --- a/Auxiliary/bash-completion/cmake +++ b/Auxiliary/bash-completion/cmake @@ -116,6 +116,9 @@ _cmake() 2>/dev/null )' -- "$quoted" ) ) return ;; + --loglevel) + COMPREPLY=( $(compgen -W 'error warning notice status verbose debug trace' -- $cur ) ) + ;; --help-command) COMPREPLY=( $( compgen -W '$( cmake --help-command-list 2>/dev/null| grep -v "^cmake version " )' -- "$cur" ) ) diff --git a/Help/command/message.rst b/Help/command/message.rst index a3c3a89..3f9216a 100644 --- a/Help/command/message.rst +++ b/Help/command/message.rst @@ -9,24 +9,56 @@ Display a message to the user. The optional ```` keyword determines the type of message: -:: - - (none) = Important information - STATUS = Incidental information - WARNING = CMake Warning, continue processing - AUTHOR_WARNING = CMake Warning (dev), continue processing - SEND_ERROR = CMake Error, continue processing, - but skip generation - FATAL_ERROR = CMake Error, stop processing and generation - DEPRECATION = CMake Deprecation Error or Warning if variable - CMAKE_ERROR_DEPRECATED or CMAKE_WARN_DEPRECATED - is enabled, respectively, else no message. - -The CMake command-line tool displays STATUS messages on stdout and all -other message types on stderr. The CMake GUI displays all messages in -its log area. The interactive dialogs (ccmake and CMakeSetup) show -``STATUS`` messages one at a time on a status line and other messages in -interactive pop-up boxes. +``FATAL_ERROR`` + CMake Error, stop processing and generation. + +``SEND_ERROR`` + CMake Error, continue processing, but skip generation. + +``WARNING`` + CMake Warning, continue processing. + +``AUTHOR_WARNING`` + CMake Warning (dev), continue processing. + +``DEPRECATION`` + CMake Deprecation Error or Warning if variable + :variable:`CMAKE_ERROR_DEPRECATED` or :variable:`CMAKE_WARN_DEPRECATED` + is enabled, respectively, else no message. + +(none) or ``NOTICE`` + Important message printed to stderr to attract user's attention. + +``STATUS`` + The main interesting messages that project users might be interested in. + Ideally these should be concise, no more than a single line, but still + informative. + +``VERBOSE`` + Detailed informational messages intended for project users. These messages + should provide additional details that won't be of interest in most cases, + but which may be useful to those building the project when they want deeper + insight into what's happening. + +``DEBUG`` + Detailed informational messages intended for developers working on the + project itself as opposed to users who just want to build it. These messages + will not typically be of interest to other users building the project and + will often be closely related to internal implementation details. + +``TRACE`` + Fine-grained messages with very low-level implementation details. Messages + using this log level would normally only be temporary and would expect to be + removed before releasing the project, packaging up the files, etc. + +The CMake command-line tool displays ``STATUS`` to ``TRACE`` messages on stdout +with the message preceded by two hyphens and a space. All other message types +are sent to stderr and are not prefixed with hyphens. The CMake GUI displays +all messages in its log area. The interactive dialogs (:manual:`ccmake(1)` +and :manual:`cmake-gui(1)`) show ``STATUS`` to ``TRACE`` messages one at a +time on a status line and other messages in interactive pop-up boxes. +The ``--loglevel`` command-line option to each of these tools can be used to +control which messages will be shown. CMake Warning and Error message text displays using a simple markup language. Non-indented text is formatted in line-wrapped paragraphs diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 5b88694..3e1680c 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -200,6 +200,12 @@ Options from the top of a binary tree for a CMake project it will dump additional information such as the cache, log files etc. +``--loglevel=`` + Set the log level. + + The :command:`message` command will only output messages of the specified + log level or higher. The default log level is ``status``. + ``--debug-trycompile`` Do not delete the :command:`try_compile` build tree. Only useful on one :command:`try_compile` at a time. diff --git a/Help/release/dev/new-message-types-and-logging.rst b/Help/release/dev/new-message-types-and-logging.rst new file mode 100644 index 0000000..cd470bb --- /dev/null +++ b/Help/release/dev/new-message-types-and-logging.rst @@ -0,0 +1,7 @@ +new-message-types-and-logging +----------------------------- + +* The :command:`message` command learned new types: ``NOTICE``, ``VERBOSE``, + ``DEBUG`` and ``TRACE``. + +* The :manual:`cmake(1)` command learned a new CLI option ``--loglevel``. diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index 2724030..7242037 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -8,6 +8,9 @@ #include "cmMessenger.h" #include "cmRange.h" #include "cmSystemTools.h" +#include "cmake.h" + +#include class cmExecutionStatus; @@ -24,41 +27,80 @@ bool cmMessageCommand::InitialPass(std::vector const& args, MessageType type = MessageType::MESSAGE; bool status = false; bool fatal = false; + auto level = cmake::LogLevel::LOG_UNDEFINED; if (*i == "SEND_ERROR") { type = MessageType::FATAL_ERROR; + level = cmake::LogLevel::LOG_ERROR; ++i; } else if (*i == "FATAL_ERROR") { fatal = true; type = MessageType::FATAL_ERROR; + level = cmake::LogLevel::LOG_ERROR; ++i; } else if (*i == "WARNING") { type = MessageType::WARNING; + level = cmake::LogLevel::LOG_WARNING; ++i; } else if (*i == "AUTHOR_WARNING") { if (this->Makefile->IsSet("CMAKE_SUPPRESS_DEVELOPER_ERRORS") && !this->Makefile->IsOn("CMAKE_SUPPRESS_DEVELOPER_ERRORS")) { fatal = true; type = MessageType::AUTHOR_ERROR; + level = cmake::LogLevel::LOG_ERROR; } else if (!this->Makefile->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS")) { type = MessageType::AUTHOR_WARNING; + level = cmake::LogLevel::LOG_WARNING; } else { return true; } ++i; } else if (*i == "STATUS") { status = true; + level = cmake::LogLevel::LOG_STATUS; + ++i; + } else if (*i == "VERBOSE") { + status = true; + level = cmake::LogLevel::LOG_VERBOSE; + ++i; + } else if (*i == "DEBUG") { + status = true; + level = cmake::LogLevel::LOG_DEBUG; + ++i; + } else if (*i == "TRACE") { + status = true; + level = cmake::LogLevel::LOG_TRACE; ++i; } else if (*i == "DEPRECATION") { if (this->Makefile->IsOn("CMAKE_ERROR_DEPRECATED")) { fatal = true; type = MessageType::DEPRECATION_ERROR; + level = cmake::LogLevel::LOG_ERROR; } else if ((!this->Makefile->IsSet("CMAKE_WARN_DEPRECATED") || this->Makefile->IsOn("CMAKE_WARN_DEPRECATED"))) { type = MessageType::DEPRECATION_WARNING; + level = cmake::LogLevel::LOG_WARNING; } else { return true; } ++i; + } else if (*i == "NOTICE") { + // `NOTICE` message type is going to be output to stderr + level = cmake::LogLevel::LOG_NOTICE; + ++i; + } else { + // Messages w/o any type are `NOTICE`s + level = cmake::LogLevel::LOG_NOTICE; + } + assert("Message log level expected to be set" && + level != cmake::LogLevel::LOG_UNDEFINED); + + auto desiredLevel = this->Makefile->GetCMakeInstance()->GetLogLevel(); + assert("Expected a valid log level here" && + desiredLevel != cmake::LogLevel::LOG_UNDEFINED); + + if (desiredLevel < level) { + // Suppress the message + return true; } std::string message = cmJoin(cmMakeRange(i, args.end()), std::string()); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index fc24ac0..121d12d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -718,6 +718,14 @@ void cmake::SetArgs(const std::vector& args) } else if (arg.find("--debug-output", 0) == 0) { std::cout << "Running with debug output on.\n"; this->SetDebugOutputOn(true); + } else if (arg.find("--loglevel=", 0) == 0) { + const auto logLevel = + StringToLogLevel(arg.substr(sizeof("--loglevel=") - 1)); + if (logLevel == LogLevel::LOG_UNDEFINED) { + cmSystemTools::Error("Invalid level specified for --loglevel"); + return; + } + this->SetLogLevel(logLevel); } else if (arg.find("--trace-expand", 0) == 0) { std::cout << "Running with expanded trace output on.\n"; this->SetTrace(true); @@ -828,6 +836,25 @@ void cmake::SetArgs(const std::vector& args) } } +cmake::LogLevel cmake::StringToLogLevel(const std::string& levelStr) +{ + using LevelsPair = std::pair; + static const std::vector levels = { + { "error", LogLevel::LOG_ERROR }, { "warning", LogLevel::LOG_WARNING }, + { "notice", LogLevel::LOG_NOTICE }, { "status", LogLevel::LOG_STATUS }, + { "verbose", LogLevel::LOG_VERBOSE }, { "debug", LogLevel::LOG_DEBUG }, + { "trace", LogLevel::LOG_TRACE } + }; + + const auto levelStrLowCase = cmSystemTools::LowerCase(levelStr); + + const auto it = std::find_if(levels.cbegin(), levels.cend(), + [&levelStrLowCase](const LevelsPair& p) { + return p.first == levelStrLowCase; + }); + return (it != levels.cend()) ? it->second : LogLevel::LOG_UNDEFINED; +} + void cmake::SetDirectoriesFromFile(const char* arg) { // Check if the argument refers to a CMakeCache.txt or diff --git a/Source/cmake.h b/Source/cmake.h index 8b4b396..4a345cf 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -96,6 +96,19 @@ public: FIND_PACKAGE_MODE }; + /** \brief Define log level constants. */ + enum LogLevel + { + LOG_UNDEFINED, + LOG_ERROR, + LOG_WARNING, + LOG_NOTICE, + LOG_STATUS, + LOG_VERBOSE, + LOG_DEBUG, + LOG_TRACE + }; + struct GeneratorInfo { std::string name; @@ -331,6 +344,11 @@ public: */ cmFileTimeCache* GetFileTimeCache() { return this->FileTimeCache; } + // Get the selected log level for `message()` commands during the cmake run. + LogLevel GetLogLevel() const { return this->MessageLogLevel; } + void SetLogLevel(LogLevel level) { this->MessageLogLevel = level; } + static LogLevel StringToLogLevel(const std::string& levelStr); + // Do we want debug output during the cmake run. bool GetDebugOutput() { return this->DebugOutput; } void SetDebugOutputOn(bool b) { this->DebugOutput = b; } @@ -524,6 +542,8 @@ private: std::vector TraceOnlyThisSources; + LogLevel MessageLogLevel = LogLevel::LOG_STATUS; + void UpdateConversionPathTable(); // Print a list of valid generators to stderr. diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index d70c9d9..5631d10 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -95,6 +95,8 @@ static const char* cmDocumentationOptions[][2] = { "Generate graphviz of dependencies, see " "CMakeGraphVizOptions.cmake for more." }, { "--system-information [file]", "Dump information about this system." }, + { "--loglevel=", + "Set the verbosity of messages from CMake files." }, { "--debug-trycompile", "Do not delete the try_compile build tree. Only " "useful on one try_compile at a time." }, diff --git a/Tests/RunCMake/message/RunCMakeTest.cmake b/Tests/RunCMake/message/RunCMakeTest.cmake index 24dad03..cecfc7f 100644 --- a/Tests/RunCMake/message/RunCMakeTest.cmake +++ b/Tests/RunCMake/message/RunCMakeTest.cmake @@ -10,3 +10,45 @@ run_cmake(warnmessage) # separately run_cmake(errormessage_deprecated) run_cmake(errormessage_dev) + +run_cmake_command( + message-loglevel-invalid + ${CMAKE_COMMAND} --loglevel=blah -P ${RunCMake_SOURCE_DIR}/message-all-loglevels.cmake + ) + +# Checking various combinations of `message(...)` and log levels `WARNING` to `TRACE` +# - no CLI option -> `WARNING` to `STATUS` output +run_cmake_command( + message-loglevel-default + ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/message-all-loglevels.cmake + ) +# - Only `WARNING` output +run_cmake_command( + message-loglevel-warning + ${CMAKE_COMMAND} --loglevel=warning -P ${RunCMake_SOURCE_DIR}/message-all-loglevels.cmake + ) +# - Only `WARNING` and `NOTICE` output +run_cmake_command( + message-loglevel-notice + ${CMAKE_COMMAND} --loglevel=notice -P ${RunCMake_SOURCE_DIR}/message-all-loglevels.cmake + ) +# - `WARNING` to `STATUS` output +run_cmake_command( + message-loglevel-status + ${CMAKE_COMMAND} --loglevel=status -P ${RunCMake_SOURCE_DIR}/message-all-loglevels.cmake + ) +# - `WARNING` to `VERBOSE` output +run_cmake_command( + message-loglevel-verbose + ${CMAKE_COMMAND} --loglevel=verbose -P ${RunCMake_SOURCE_DIR}/message-all-loglevels.cmake + ) +# - `WARNING` to `DEBUG` output +run_cmake_command( + message-loglevel-debug + ${CMAKE_COMMAND} --loglevel=debug -P ${RunCMake_SOURCE_DIR}/message-all-loglevels.cmake + ) +# - `WARNING` to `TRACE` output +run_cmake_command( + message-loglevel-trace + ${CMAKE_COMMAND} --loglevel=trace -P ${RunCMake_SOURCE_DIR}/message-all-loglevels.cmake + ) diff --git a/Tests/RunCMake/message/message-all-loglevels.cmake b/Tests/RunCMake/message/message-all-loglevels.cmake new file mode 100644 index 0000000..f8d8841 --- /dev/null +++ b/Tests/RunCMake/message/message-all-loglevels.cmake @@ -0,0 +1,10 @@ +# Produce a message for everything except FATAL_ERROR and SEND_ERROR +message(DEPRECATION "Deprecation warning") +message(AUTHOR_WARNING "Author warning message") +message(WARNING "Warning message") +message("Default NOTICE message") +message(NOTICE "NOTICE message") +message(STATUS "STATUS message") +message(VERBOSE "VERBOSE message") +message(DEBUG "DEBUG message") +message(TRACE "TRACE message") diff --git a/Tests/RunCMake/message/message-loglevel-debug-stderr.txt b/Tests/RunCMake/message/message-loglevel-debug-stderr.txt new file mode 100644 index 0000000..efec736 --- /dev/null +++ b/Tests/RunCMake/message/message-loglevel-debug-stderr.txt @@ -0,0 +1,12 @@ +^CMake Deprecation Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:2 \(message\): + Deprecation warning ++ +CMake Warning \(dev\) at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:3 \(message\): + Author warning message +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +CMake Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:4 \(message\): + Warning message ++ +Default NOTICE message +NOTICE message$ diff --git a/Tests/RunCMake/message/message-loglevel-debug-stdout.txt b/Tests/RunCMake/message/message-loglevel-debug-stdout.txt new file mode 100644 index 0000000..1452137 --- /dev/null +++ b/Tests/RunCMake/message/message-loglevel-debug-stdout.txt @@ -0,0 +1,3 @@ +-- STATUS message +-- VERBOSE message +-- DEBUG message diff --git a/Tests/RunCMake/message/message-loglevel-default-stderr.txt b/Tests/RunCMake/message/message-loglevel-default-stderr.txt new file mode 100644 index 0000000..efec736 --- /dev/null +++ b/Tests/RunCMake/message/message-loglevel-default-stderr.txt @@ -0,0 +1,12 @@ +^CMake Deprecation Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:2 \(message\): + Deprecation warning ++ +CMake Warning \(dev\) at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:3 \(message\): + Author warning message +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +CMake Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:4 \(message\): + Warning message ++ +Default NOTICE message +NOTICE message$ diff --git a/Tests/RunCMake/message/message-loglevel-default-stdout.txt b/Tests/RunCMake/message/message-loglevel-default-stdout.txt new file mode 100644 index 0000000..809f4cc --- /dev/null +++ b/Tests/RunCMake/message/message-loglevel-default-stdout.txt @@ -0,0 +1 @@ +-- STATUS message diff --git a/Tests/RunCMake/message/message-loglevel-invalid-result.txt b/Tests/RunCMake/message/message-loglevel-invalid-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/message/message-loglevel-invalid-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/message/message-loglevel-invalid-stderr.txt b/Tests/RunCMake/message/message-loglevel-invalid-stderr.txt new file mode 100644 index 0000000..f54d0f8 --- /dev/null +++ b/Tests/RunCMake/message/message-loglevel-invalid-stderr.txt @@ -0,0 +1 @@ +CMake Error: Invalid level specified for --loglevel diff --git a/Tests/RunCMake/message/message-loglevel-notice-stderr.txt b/Tests/RunCMake/message/message-loglevel-notice-stderr.txt new file mode 100644 index 0000000..efec736 --- /dev/null +++ b/Tests/RunCMake/message/message-loglevel-notice-stderr.txt @@ -0,0 +1,12 @@ +^CMake Deprecation Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:2 \(message\): + Deprecation warning ++ +CMake Warning \(dev\) at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:3 \(message\): + Author warning message +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +CMake Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:4 \(message\): + Warning message ++ +Default NOTICE message +NOTICE message$ diff --git a/Tests/RunCMake/message/message-loglevel-status-stderr.txt b/Tests/RunCMake/message/message-loglevel-status-stderr.txt new file mode 100644 index 0000000..efec736 --- /dev/null +++ b/Tests/RunCMake/message/message-loglevel-status-stderr.txt @@ -0,0 +1,12 @@ +^CMake Deprecation Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:2 \(message\): + Deprecation warning ++ +CMake Warning \(dev\) at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:3 \(message\): + Author warning message +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +CMake Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:4 \(message\): + Warning message ++ +Default NOTICE message +NOTICE message$ diff --git a/Tests/RunCMake/message/message-loglevel-status-stdout.txt b/Tests/RunCMake/message/message-loglevel-status-stdout.txt new file mode 100644 index 0000000..809f4cc --- /dev/null +++ b/Tests/RunCMake/message/message-loglevel-status-stdout.txt @@ -0,0 +1 @@ +-- STATUS message diff --git a/Tests/RunCMake/message/message-loglevel-trace-stderr.txt b/Tests/RunCMake/message/message-loglevel-trace-stderr.txt new file mode 100644 index 0000000..efec736 --- /dev/null +++ b/Tests/RunCMake/message/message-loglevel-trace-stderr.txt @@ -0,0 +1,12 @@ +^CMake Deprecation Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:2 \(message\): + Deprecation warning ++ +CMake Warning \(dev\) at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:3 \(message\): + Author warning message +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +CMake Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:4 \(message\): + Warning message ++ +Default NOTICE message +NOTICE message$ diff --git a/Tests/RunCMake/message/message-loglevel-trace-stdout.txt b/Tests/RunCMake/message/message-loglevel-trace-stdout.txt new file mode 100644 index 0000000..1cfce6f --- /dev/null +++ b/Tests/RunCMake/message/message-loglevel-trace-stdout.txt @@ -0,0 +1,4 @@ +-- STATUS message +-- VERBOSE message +-- DEBUG message +-- TRACE message diff --git a/Tests/RunCMake/message/message-loglevel-verbose-stderr.txt b/Tests/RunCMake/message/message-loglevel-verbose-stderr.txt new file mode 100644 index 0000000..efec736 --- /dev/null +++ b/Tests/RunCMake/message/message-loglevel-verbose-stderr.txt @@ -0,0 +1,12 @@ +^CMake Deprecation Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:2 \(message\): + Deprecation warning ++ +CMake Warning \(dev\) at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:3 \(message\): + Author warning message +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +CMake Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:4 \(message\): + Warning message ++ +Default NOTICE message +NOTICE message$ diff --git a/Tests/RunCMake/message/message-loglevel-verbose-stdout.txt b/Tests/RunCMake/message/message-loglevel-verbose-stdout.txt new file mode 100644 index 0000000..c15d43f --- /dev/null +++ b/Tests/RunCMake/message/message-loglevel-verbose-stdout.txt @@ -0,0 +1,2 @@ +-- STATUS message +-- VERBOSE message diff --git a/Tests/RunCMake/message/message-loglevel-warning-stderr.txt b/Tests/RunCMake/message/message-loglevel-warning-stderr.txt new file mode 100644 index 0000000..c721b06 --- /dev/null +++ b/Tests/RunCMake/message/message-loglevel-warning-stderr.txt @@ -0,0 +1,9 @@ +^CMake Deprecation Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:2 \(message\): + Deprecation warning ++ +CMake Warning \(dev\) at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:3 \(message\): + Author warning message +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +CMake Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:4 \(message\): + Warning message$ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=377d1b7896e07a171bcfe8da6d9dcda6545052c2 commit 377d1b7896e07a171bcfe8da6d9dcda6545052c2 Author: Alex Turbov AuthorDate: Tue Mar 5 23:28:23 2019 +0700 Commit: Craig Scott CommitDate: Sat Apr 27 18:36:45 2019 +1000 cmSystemTools: Remove unused message-related code, simplify logic diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 212608d..bc853b7 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -168,7 +168,6 @@ bool cmSystemTools::s_RunCommandHideConsole = false; bool cmSystemTools::s_DisableRunCommandOutput = false; bool cmSystemTools::s_ErrorOccured = false; bool cmSystemTools::s_FatalErrorOccured = false; -bool cmSystemTools::s_DisableMessages = false; bool cmSystemTools::s_ForceUnixPaths = false; // replace replace with with as many times as it shows up in source. @@ -326,14 +325,11 @@ void cmSystemTools::Stdout(const std::string& s) void cmSystemTools::Message(const std::string& m, const char* title) { - if (s_DisableMessages) { - return; - } if (s_MessageCallback) { s_MessageCallback(m, title); - return; + } else { + std::cerr << m << std::endl; } - std::cerr << m << std::endl << std::flush; } void cmSystemTools::ReportLastSystemError(const char* msg) diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index a8b2d37..05bd351 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -266,8 +266,6 @@ public: static size_t CalculateCommandLineLengthLimit(); - static void EnableMessages() { s_DisableMessages = false; } - static void DisableMessages() { s_DisableMessages = true; } static void DisableRunCommandOutput() { s_DisableRunCommandOutput = true; } static void EnableRunCommandOutput() { s_DisableRunCommandOutput = false; } static bool GetRunCommandOutput() { return s_DisableRunCommandOutput; } @@ -540,7 +538,6 @@ private: static bool s_RunCommandHideConsole; static bool s_ErrorOccured; static bool s_FatalErrorOccured; - static bool s_DisableMessages; static bool s_DisableRunCommandOutput; }; ----------------------------------------------------------------------- Summary of changes: Auxiliary/bash-completion/cmake | 3 + Help/command/message.rst | 68 ++++++++++++++++------ Help/manual/cmake.1.rst | 6 ++ Help/release/dev/new-message-types-and-logging.rst | 7 +++ Source/cmMessageCommand.cxx | 52 +++++++++++++++-- Source/cmSystemTools.cxx | 8 +-- Source/cmSystemTools.h | 3 - Source/cmake.cxx | 27 +++++++++ Source/cmake.h | 20 +++++++ Source/cmakemain.cxx | 2 + Tests/RunCMake/message/RunCMakeTest.cmake | 42 +++++++++++++ Tests/RunCMake/message/message-all-loglevels.cmake | 10 ++++ .../message/message-loglevel-debug-stderr.txt | 12 ++++ .../message/message-loglevel-debug-stdout.txt | 3 + .../message/message-loglevel-default-stderr.txt | 12 ++++ .../message/message-loglevel-default-stdout.txt | 1 + .../message-loglevel-invalid-result.txt} | 0 .../message/message-loglevel-invalid-stderr.txt | 1 + .../message/message-loglevel-notice-stderr.txt | 12 ++++ .../message/message-loglevel-status-stderr.txt | 12 ++++ .../message/message-loglevel-status-stdout.txt | 1 + .../message/message-loglevel-trace-stderr.txt | 12 ++++ .../message/message-loglevel-trace-stdout.txt | 4 ++ .../message/message-loglevel-verbose-stderr.txt | 12 ++++ .../message/message-loglevel-verbose-stdout.txt | 2 + .../message/message-loglevel-warning-stderr.txt | 9 +++ 26 files changed, 309 insertions(+), 32 deletions(-) create mode 100644 Help/release/dev/new-message-types-and-logging.rst create mode 100644 Tests/RunCMake/message/message-all-loglevels.cmake create mode 100644 Tests/RunCMake/message/message-loglevel-debug-stderr.txt create mode 100644 Tests/RunCMake/message/message-loglevel-debug-stdout.txt create mode 100644 Tests/RunCMake/message/message-loglevel-default-stderr.txt create mode 100644 Tests/RunCMake/message/message-loglevel-default-stdout.txt copy Tests/RunCMake/{while/MissingArgument-result.txt => message/message-loglevel-invalid-result.txt} (100%) create mode 100644 Tests/RunCMake/message/message-loglevel-invalid-stderr.txt create mode 100644 Tests/RunCMake/message/message-loglevel-notice-stderr.txt create mode 100644 Tests/RunCMake/message/message-loglevel-status-stderr.txt create mode 100644 Tests/RunCMake/message/message-loglevel-status-stdout.txt create mode 100644 Tests/RunCMake/message/message-loglevel-trace-stderr.txt create mode 100644 Tests/RunCMake/message/message-loglevel-trace-stdout.txt create mode 100644 Tests/RunCMake/message/message-loglevel-verbose-stderr.txt create mode 100644 Tests/RunCMake/message/message-loglevel-verbose-stdout.txt create mode 100644 Tests/RunCMake/message/message-loglevel-warning-stderr.txt hooks/post-receive -- CMake