[Cmake-commits] CMake branch, master, updated. v3.13.0-rc2-391-g7e6b787
Kitware Robot
kwrobot at kitware.com
Wed Nov 7 07:33:06 EST 2018
This is an automated email from 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 7e6b78759904dcf31d780a6e2f14f3821f4f23df (commit)
via cf78a7df952a8d7be4228cb1c4a4b38ebc63dae8 (commit)
via bb8da283ce40d3bb06df348ea2820dd12213a2e1 (commit)
via 389002de96fdabd05b709415712b1d8d8aa264b9 (commit)
via fe40570608f43aade8f4262e9ca55d98a2b169fd (commit)
via c67ab22cdc680f6322e558b4f2c7cc74b6dbe163 (commit)
via 86c07b916557ac83cd77f6250d090fa45b4b9bc2 (commit)
via ab1d7df7575503c8eabdf6f8892b5944b06d98e5 (commit)
via e0f0f80f0286b7181b1203693799f5fcfcd8b4af (commit)
via 2b2b41f038af97b7bca2213cda0198d2a28f6c2e (commit)
via e045fb202ddf9100965ac418f4aa22e65256dd8d (commit)
via 3fa0a03b7e4094bef1b66e48ed437e1c0b41c49a (commit)
via fb423b3c49d21df851b1d4a91fddfe94d835155b (commit)
via 867c9c9c0dc2782b2d822557c8dc83c451409b48 (commit)
via a85e5e6f4d53dd158392dd74b9632d84fb583722 (commit)
via ff1db47728a37a7775a3b870ff9ffdc3249c3d40 (commit)
via fe8acf7c0540ca39300bab5b014e428e84077c7a (commit)
via 9891adf74becfa95463f6928fda9f8ac17c934bd (commit)
via 20b6561e78f5acceecae7c6fc330f7f7de4f2223 (commit)
via 873e59c0c456c2e13e66019c15f3632d06dac0f6 (commit)
via b2a798fe32ce25e5ea19f6487ce9cadf9852ea83 (commit)
via db749f404c29bc91a06f2ea2fb23d8a30c526a9a (commit)
via 53a5aec89998a58dff53946b47426ea692c5ad8d (commit)
via f92f93467ecc22419c981f8f5283c81fa9d8eb01 (commit)
from df542558c645f9a704fb5bcc2b2e304f6879ab35 (commit)
Those revisions listed 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=7e6b78759904dcf31d780a6e2f14f3821f4f23df
commit 7e6b78759904dcf31d780a6e2f14f3821f4f23df
Merge: cf78a7d c67ab22
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Nov 7 12:30:12 2018 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Nov 7 07:30:20 2018 -0500
Merge topic 'string_func_usage'
c67ab22cdc Using front() and back() instead of calculations
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !2571
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cf78a7df952a8d7be4228cb1c4a4b38ebc63dae8
commit cf78a7df952a8d7be4228cb1c4a4b38ebc63dae8
Merge: bb8da28 53a5aec
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Nov 7 12:27:49 2018 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Nov 7 07:28:02 2018 -0500
Merge topic 'fix-double-warn-uninitialized-in-script-mode'
53a5aec899 CMP0053: Fix double warning on uninitialized variables in -P mode
f92f93467e cmMakefile: Rename SuppressWatches to SuppressSideEffects
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !2565
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bb8da283ce40d3bb06df348ea2820dd12213a2e1
commit bb8da283ce40d3bb06df348ea2820dd12213a2e1
Merge: 389002d 86c07b9
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Nov 7 12:26:54 2018 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Nov 7 07:27:27 2018 -0500
Merge topic 'genex'
86c07b9165 Help: Say early on that generator expressions can be nested.
ab1d7df757 Help: add section on debugging generator expressions.
e0f0f80f02 Help: Explain conversion rules of $<BOOL:string>.
2b2b41f038 Help: Code example for case-insensitive comparison
e045fb202d Help: Terminate explanations with a dot.
3fa0a03b7e Help: Expand placeholders in string comparisons.
fb423b3c49 Help: sort conditional expressions below string-valued ones.
867c9c9c0d Help: Add deprecation date of $<CONFIGURATION>
...
Acked-by: Kitware Robot <kwrobot at kitware.com>
Acked-by: Alex Turbov <i.zaufi at gmail.com>
Merge-request: !2564
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=389002de96fdabd05b709415712b1d8d8aa264b9
commit 389002de96fdabd05b709415712b1d8d8aa264b9
Merge: df54255 fe40570
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Nov 7 12:26:35 2018 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Nov 7 07:26:46 2018 -0500
Merge topic 'FindSQLite3-module'
fe40570608 FindSQLite3: Add module to find SQLite3
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !2557
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fe40570608f43aade8f4262e9ca55d98a2b169fd
commit fe40570608f43aade8f4262e9ca55d98a2b169fd
Author: Chuck Atkins <chuck.atkins at kitware.com>
AuthorDate: Thu Nov 1 16:48:56 2018 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue Nov 6 15:05:04 2018 -0500
FindSQLite3: Add module to find SQLite3
diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst
index c0bef08..95744df 100644
--- a/Help/manual/cmake-modules.7.rst
+++ b/Help/manual/cmake-modules.7.rst
@@ -237,6 +237,7 @@ They are normally called through the :command:`find_package` command.
/module/FindSDL_ttf
/module/FindSelfPackers
/module/FindSquish
+ /module/FindSQLite3
/module/FindSubversion
/module/FindSWIG
/module/FindTCL
diff --git a/Help/module/FindSQLite3.rst b/Help/module/FindSQLite3.rst
new file mode 100644
index 0000000..d1910e5
--- /dev/null
+++ b/Help/module/FindSQLite3.rst
@@ -0,0 +1 @@
+.. cmake-module:: ../../Modules/FindSQLite3.cmake
diff --git a/Help/release/dev/FindSQLite3-module.rst b/Help/release/dev/FindSQLite3-module.rst
new file mode 100644
index 0000000..733a4d3
--- /dev/null
+++ b/Help/release/dev/FindSQLite3-module.rst
@@ -0,0 +1,4 @@
+FindSQLite3-module
+------------------
+
+* The :module:`FindSQLite3` module was added to find the SQLite v3.x library.
diff --git a/Modules/FindSQLite3.cmake b/Modules/FindSQLite3.cmake
new file mode 100644
index 0000000..374d7af
--- /dev/null
+++ b/Modules/FindSQLite3.cmake
@@ -0,0 +1,66 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#[=======================================================================[.rst:
+FindSQLite3
+-----------
+
+Find the SQLite libraries, v3
+
+IMPORTED targets
+^^^^^^^^^^^^^^^^
+
+This module defines the following :prop_tgt:`IMPORTED` target:
+
+``SQLite::SQLite3``
+
+Result variables
+^^^^^^^^^^^^^^^^
+
+This module will set the following variables if found:
+
+``SQLite3_INCLUDE_DIRS``
+ where to find sqlite3.h, etc.
+``SQLite3_LIBRARIES``
+ the libraries to link against to use SQLite3.
+``SQLite3_VERSION``
+ version of the SQLite3 library found
+``SQLite3_FOUND``
+ TRUE if found
+
+#]=======================================================================]
+
+# Look for the necessary header
+find_path(SQLite3_INCLUDE_DIR NAMES sqlite3.h)
+mark_as_advanced(SQLite3_INCLUDE_DIR)
+
+# Look for the necessary library
+find_library(SQLite3_LIBRARY NAMES sqlite3 sqlite)
+mark_as_advanced(SQLite3_LIBRARY)
+
+# Extract version information from the header file
+if(SQLite3_INCLUDE_DIR)
+ file(STRINGS ${SQLite3_INCLUDE_DIR}/sqlite3.h _ver_line
+ REGEX "^#define SQLITE_VERSION *\"[0-9]+\\.[0-9]+\\.[0-9]+\""
+ LIMIT_COUNT 1)
+ string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+"
+ SQLite3_VERSION "${_ver_line}")
+ unset(_ver_line)
+endif()
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+find_package_handle_standard_args(SQLite3
+ REQUIRED_VARS SQLite3_INCLUDE_DIR SQLite3_LIBRARY
+ VERSION_VAR SQLite3_VERSION)
+
+# Create the imported target
+if(SQLite3_FOUND)
+ set(SQLite3_INCLUDE_DIRS ${SQLite3_INCLUDE_DIR})
+ set(SQLite3_LIBRARIES ${SQLite3_LIBRARY})
+ if(NOT TARGET SQLite::SQLite3)
+ add_library(SQLite::SQLite3 UNKNOWN IMPORTED)
+ set_target_properties(SQLite::SQLite3 PROPERTIES
+ IMPORTED_LOCATION "${SQLite3_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${SQLite3_INCLUDE_DIR}")
+ endif()
+endif()
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 1c49fea..02e56eb 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1469,6 +1469,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
add_subdirectory(FindProtobuf)
endif()
+ if(CMake_TEST_FindSQLite3)
+ add_subdirectory(FindSQLite3)
+ endif()
+
if(CMake_TEST_FindTIFF)
add_subdirectory(FindTIFF)
endif()
diff --git a/Tests/FindSQLite3/CMakeLists.txt b/Tests/FindSQLite3/CMakeLists.txt
new file mode 100644
index 0000000..8bf170e
--- /dev/null
+++ b/Tests/FindSQLite3/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindSQLite3.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindSQLite3/Test"
+ "${CMake_BINARY_DIR}/Tests/FindSQLite3/Test"
+ ${build_generator_args}
+ --build-project TestFindSQLite3
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/FindSQLite3/Test/CMakeLists.txt b/Tests/FindSQLite3/Test/CMakeLists.txt
new file mode 100644
index 0000000..bcc6ebd
--- /dev/null
+++ b/Tests/FindSQLite3/Test/CMakeLists.txt
@@ -0,0 +1,16 @@
+cmake_minimum_required(VERSION 3.4)
+project(TestFindSQLite3 C)
+include(CTest)
+
+find_package(SQLite3 REQUIRED)
+
+add_definitions(-DCMAKE_EXPECTED_SQLite3_VERSION="${SQLite3_VERSION}")
+
+add_executable(test_tgt main.c)
+target_link_libraries(test_tgt SQLite::SQLite3)
+add_test(NAME test_tgt COMMAND test_tgt)
+
+add_executable(test_var main.c)
+target_include_directories(test_var PRIVATE ${SQLite3_INCLUDE_DIRS})
+target_link_libraries(test_var PRIVATE ${SQLite3_LIBRARIES})
+add_test(NAME test_var COMMAND test_var)
diff --git a/Tests/FindSQLite3/Test/main.c b/Tests/FindSQLite3/Test/main.c
new file mode 100644
index 0000000..aeb4940
--- /dev/null
+++ b/Tests/FindSQLite3/Test/main.c
@@ -0,0 +1,10 @@
+#include <string.h>
+
+#include <sqlite3.h>
+
+int main()
+{
+ char sqlite3_version[] = SQLITE_VERSION;
+
+ return strcmp(sqlite3_version, CMAKE_EXPECTED_SQLite3_VERSION);
+}
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c67ab22cdc680f6322e558b4f2c7cc74b6dbe163
commit c67ab22cdc680f6322e558b4f2c7cc74b6dbe163
Author: Cengizhan Pasaoglu <cengizhanpasaoglu at gmail.com>
AuthorDate: Tue Nov 6 09:47:40 2018 +0300
Commit: Cengizhan Pasaoglu <cengizhanpasaoglu at gmail.com>
CommitDate: Tue Nov 6 21:43:33 2018 +0300
Using front() and back() instead of calculations
diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx
index 75bd6fb..75e5aa4 100644
--- a/Source/cmAddSubDirectoryCommand.cxx
+++ b/Source/cmAddSubDirectoryCommand.cxx
@@ -20,7 +20,7 @@ bool cmAddSubDirectoryCommand::InitialPass(
}
// store the binpath
- std::string const& srcArg = args[0];
+ std::string const& srcArg = args.front();
std::string binArg;
bool excludeFromAll = false;
@@ -84,10 +84,10 @@ bool cmAddSubDirectoryCommand::InitialPass(
const std::string& bin = this->Makefile->GetCurrentBinaryDirectory();
size_t srcLen = src.length();
size_t binLen = bin.length();
- if (srcLen > 0 && src[srcLen - 1] == '/') {
+ if (srcLen > 0 && src.back() == '/') {
--srcLen;
}
- if (binLen > 0 && bin[binLen - 1] == '/') {
+ if (binLen > 0 && bin.back() == '/') {
--binLen;
}
binPath = bin.substr(0, binLen) + srcPath.substr(srcLen);
diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index 6031781..3f2e784 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/Source/cmArchiveWrite.cxx
@@ -178,7 +178,7 @@ bool cmArchiveWrite::Add(std::string path, size_t skip, const char* prefix,
bool recursive)
{
if (this->Okay()) {
- if (!path.empty() && path[path.size() - 1] == '/') {
+ if (!path.empty() && path.back() == '/') {
path.erase(path.size() - 1);
}
this->AddPath(path.c_str(), skip, prefix, recursive);
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index d0d5db6..9a046db 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -727,7 +727,7 @@ bool cmCTest::UpdateCTestConfiguration()
if (line.empty()) {
continue;
}
- while (fin && (line[line.size() - 1] == '\\')) {
+ while (fin && (line.back() == '\\')) {
line = line.substr(0, line.size() - 1);
buffer[0] = 0;
fin.getline(buffer, 1023);
@@ -2575,7 +2575,7 @@ std::string cmCTest::GetShortPathToFile(const char* cfname)
cmSystemTools::ConvertToUnixSlashes(*res);
path = "./" + *res;
- if (path[path.size() - 1] == '/') {
+ if (path.back() == '/') {
path = path.substr(0, path.size() - 1);
}
}
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index b391dc4..0305677 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -415,8 +415,7 @@ void cmCacheManager::OutputValueNoNewlines(std::ostream& fout,
std::string const& value)
{
// if value has trailing space or tab, enclose it in single quotes
- if (!value.empty() &&
- (value[value.size() - 1] == ' ' || value[value.size() - 1] == '\t')) {
+ if (!value.empty() && (value.back() == ' ' || value.back() == '\t')) {
fout << '\'' << value << '\'';
} else {
fout << value;
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 34f58ad..87ee382 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -976,9 +976,9 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
lg->GetIndividualFileTargets(objectFileTargets);
for (std::string const& f : objectFileTargets) {
const char* prefix = "[obj] ";
- if (f[f.length() - 1] == 's') {
+ if (f.back() == 's') {
prefix = "[to asm] ";
- } else if (f[f.length() - 1] == 'i') {
+ } else if (f.back() == 'i') {
prefix = "[pre] ";
}
this->AppendTarget(xml, f, make, makeArgs, subdir, prefix);
@@ -1035,8 +1035,7 @@ std::string cmExtraEclipseCDT4Generator::GetPathBasename(
{
std::string outputBasename = path;
while (!outputBasename.empty() &&
- (outputBasename[outputBasename.size() - 1] == '/' ||
- outputBasename[outputBasename.size() - 1] == '\\')) {
+ (outputBasename.back() == '/' || outputBasename.back() == '\\')) {
outputBasename.resize(outputBasename.size() - 1);
}
std::string::size_type loc = outputBasename.find_last_of("/\\");
diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx
index f5c4c93..9410690 100644
--- a/Source/cmExtraKateGenerator.cxx
+++ b/Source/cmExtraKateGenerator.cxx
@@ -294,8 +294,7 @@ std::string cmExtraKateGenerator::GetPathBasename(
{
std::string outputBasename = path;
while (!outputBasename.empty() &&
- (outputBasename[outputBasename.size() - 1] == '/' ||
- outputBasename[outputBasename.size() - 1] == '\\')) {
+ (outputBasename.back() == '/' || outputBasename.back() == '\\')) {
outputBasename.resize(outputBasename.size() - 1);
}
std::string::size_type loc = outputBasename.find_last_of("/\\");
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 1f76703..f86e5e2 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -2525,7 +2525,7 @@ bool cmFileCommand::HandleCMakePathCommand(
// remove double quotes in the path
std::string& s = *j;
- if (s.size() > 1 && s[0] == '\"' && s[s.size() - 1] == '\"') {
+ if (s.size() > 1 && s.front() == '\"' && s.back() == '\"') {
s = s.substr(1, s.size() - 2);
}
}
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index 865595b..425546a 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -129,13 +129,13 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
this->VariableDocumentation += "the (unknown) library be found";
} else if (this->Names.size() == 1) {
this->VariableDocumentation +=
- "the " + this->Names[0] + " library be found";
+ "the " + this->Names.front() + " library be found";
} else {
this->VariableDocumentation += "one of the ";
this->VariableDocumentation +=
cmJoin(cmMakeRange(this->Names).retreat(1), ", ");
this->VariableDocumentation +=
- " or " + this->Names[this->Names.size() - 1] + " libraries be found";
+ " or " + this->Names.back() + " libraries be found";
}
}
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index fbaacfc..009f0e3 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -293,13 +293,13 @@ void cmFindCommon::AddPathSuffix(std::string const& arg)
if (suffix.empty()) {
return;
}
- if (suffix[0] == '/') {
+ if (suffix.front() == '/') {
suffix = suffix.substr(1);
}
if (suffix.empty()) {
return;
}
- if (suffix[suffix.size() - 1] == '/') {
+ if (suffix.back() == '/') {
suffix = suffix.substr(0, suffix.size() - 1);
}
if (suffix.empty()) {
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 96de6ad..97c1d7d 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -1429,7 +1429,7 @@ void cmFindPackageCommand::FillPrefixesUserHints()
bool cmFindPackageCommand::SearchDirectory(std::string const& dir)
{
- assert(!dir.empty() && dir[dir.size() - 1] == '/');
+ assert(!dir.empty() && dir.back() == '/');
// Check each path suffix on this directory.
for (std::string const& s : this->SearchPathSuffixes) {
@@ -1447,7 +1447,7 @@ bool cmFindPackageCommand::SearchDirectory(std::string const& dir)
bool cmFindPackageCommand::CheckDirectory(std::string const& dir)
{
- assert(!dir.empty() && dir[dir.size() - 1] == '/');
+ assert(!dir.empty() && dir.back() == '/');
// Look for the file in this directory.
std::string d = dir.substr(0, dir.size() - 1);
@@ -2001,7 +2001,7 @@ private:
bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in)
{
- assert(!prefix_in.empty() && prefix_in[prefix_in.size() - 1] == '/');
+ assert(!prefix_in.empty() && prefix_in.back() == '/');
if (this->DebugMode) {
fprintf(stderr, "Checking prefix [%s]\n", prefix_in.c_str());
}
@@ -2157,7 +2157,7 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in)
bool cmFindPackageCommand::SearchFrameworkPrefix(std::string const& prefix_in)
{
- assert(!prefix_in.empty() && prefix_in[prefix_in.size() - 1] == '/');
+ assert(!prefix_in.empty() && prefix_in.back() == '/');
if (this->DebugMode) {
fprintf(stderr, "Checking framework prefix [%s]\n", prefix_in.c_str());
}
@@ -2218,7 +2218,7 @@ bool cmFindPackageCommand::SearchFrameworkPrefix(std::string const& prefix_in)
bool cmFindPackageCommand::SearchAppBundlePrefix(std::string const& prefix_in)
{
- assert(!prefix_in.empty() && prefix_in[prefix_in.size() - 1] == '/');
+ assert(!prefix_in.empty() && prefix_in.back() == '/');
if (this->DebugMode) {
fprintf(stderr, "Checking bundle prefix [%s]\n", prefix_in.c_str());
}
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 71947ea..1663400 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -953,7 +953,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
cmSystemTools::ExpandListArgument(entry, items);
for (std::string const& item : items) {
if (cmHasLiteralPrefix(item, "$<TARGET_OBJECTS:") &&
- item[item.size() - 1] == '>') {
+ item.back() == '>') {
continue;
}
files.push_back(item);
@@ -5612,8 +5612,7 @@ void cmGeneratorTarget::GetObjectLibrariesCMP0026(
std::vector<std::string> files;
cmSystemTools::ExpandListArgument(entry, files);
for (std::string const& li : files) {
- if (cmHasLiteralPrefix(li, "$<TARGET_OBJECTS:") &&
- li[li.size() - 1] == '>') {
+ if (cmHasLiteralPrefix(li, "$<TARGET_OBJECTS:") && li.back() == '>') {
std::string objLibName = li.substr(17, li.size() - 18);
if (cmGeneratorExpression::Find(objLibName) != std::string::npos) {
diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx
index 1b358ab..ffb895e 100644
--- a/Source/cmGetFilenameComponentCommand.cxx
+++ b/Source/cmGetFilenameComponentCommand.cxx
@@ -19,8 +19,8 @@ bool cmGetFilenameComponentCommand::InitialPass(
// Check and see if the value has been stored in the cache
// already, if so use that value
- if (args.size() >= 4 && args[args.size() - 1] == "CACHE") {
- const char* cacheValue = this->Makefile->GetDefinition(args[0]);
+ if (args.size() >= 4 && args.back() == "CACHE") {
+ const char* cacheValue = this->Makefile->GetDefinition(args.front());
if (cacheValue && !cmSystemTools::IsNOTFOUND(cacheValue)) {
return true;
}
@@ -113,20 +113,20 @@ bool cmGetFilenameComponentCommand::InitialPass(
return false;
}
- if (args.size() >= 4 && args[args.size() - 1] == "CACHE") {
+ if (args.size() >= 4 && args.back() == "CACHE") {
if (!programArgs.empty() && !storeArgs.empty()) {
this->Makefile->AddCacheDefinition(
storeArgs, programArgs.c_str(), "",
args[2] == "PATH" ? cmStateEnums::FILEPATH : cmStateEnums::STRING);
}
this->Makefile->AddCacheDefinition(
- args[0], result.c_str(), "",
+ args.front(), result.c_str(), "",
args[2] == "PATH" ? cmStateEnums::FILEPATH : cmStateEnums::STRING);
} else {
if (!programArgs.empty() && !storeArgs.empty()) {
this->Makefile->AddDefinition(storeArgs, programArgs.c_str());
}
- this->Makefile->AddDefinition(args[0], result.c_str());
+ this->Makefile->AddDefinition(args.front(), result.c_str());
}
return true;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 71e844e..cf85473 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2265,7 +2265,7 @@ bool cmGlobalGenerator::NameResolvesToFramework(
inline std::string removeQuotes(const std::string& s)
{
- if (s[0] == '\"' && s[s.size() - 1] == '\"') {
+ if (s.front() == '\"' && s.back() == '\"') {
return s.substr(1, s.size() - 2);
}
return s;
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 8c69f42..fbc756c 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -838,7 +838,7 @@ static void EnsureTrailingSlash(std::string& path)
if (path.empty()) {
return;
}
- std::string::value_type last = path[path.size() - 1];
+ std::string::value_type last = path.back();
#ifdef _WIN32
if (last != '\\') {
path += '\\';
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 596bc6b..b7a361e 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -546,7 +546,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
target->GetType() == cmStateEnums::STATIC_LIBRARY ||
target->GetType() == cmStateEnums::SHARED_LIBRARY ||
target->GetType() == cmStateEnums::MODULE_LIBRARY))) {
- makeHelper[makeHelper.size() - 1] = // fill placeholder
+ makeHelper.back() = // fill placeholder
this->PostBuildMakeTarget(target->GetName(), "$(CONFIGURATION)");
cmCustomCommandLines commandLines;
commandLines.push_back(makeHelper);
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index b2acb90..9b63d24 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -152,7 +152,7 @@ bool cmListCommand::HandleLengthCommand(std::vector<std::string> const& args)
}
const std::string& listName = args[1];
- const std::string& variableName = args[args.size() - 1];
+ const std::string& variableName = args.back();
std::vector<std::string> varArgsExpanded;
// do not check the return value here
// if the list var is not found varArgsExpanded will have size 0
@@ -174,7 +174,7 @@ bool cmListCommand::HandleGetCommand(std::vector<std::string> const& args)
}
const std::string& listName = args[1];
- const std::string& variableName = args[args.size() - 1];
+ const std::string& variableName = args.back();
// expand the variable
std::vector<std::string> varArgsExpanded;
if (!this->GetList(varArgsExpanded, listName)) {
@@ -243,7 +243,7 @@ bool cmListCommand::HandleFindCommand(std::vector<std::string> const& args)
}
const std::string& listName = args[1];
- const std::string& variableName = args[args.size() - 1];
+ const std::string& variableName = args.back();
// expand the variable
std::vector<std::string> varArgsExpanded;
if (!this->GetList(varArgsExpanded, listName)) {
@@ -1176,7 +1176,7 @@ bool cmListCommand::HandleSublistCommand(std::vector<std::string> const& args)
}
const std::string& listName = args[1];
- const std::string& variableName = args[args.size() - 1];
+ const std::string& variableName = args.back();
// expand the variable
std::vector<std::string> varArgsExpanded;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index a065408..a703f4d 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -807,19 +807,19 @@ std::string cmLocalGenerator::GetIncludeFlags(
}
std::string includePath =
this->ConvertToIncludeReference(i, shellFormat, forceFullPaths);
- if (quotePaths && !includePath.empty() && includePath[0] != '\"') {
+ if (quotePaths && !includePath.empty() && includePath.front() != '\"') {
includeFlags << "\"";
}
includeFlags << includePath;
- if (quotePaths && !includePath.empty() && includePath[0] != '\"') {
+ if (quotePaths && !includePath.empty() && includePath.front() != '\"') {
includeFlags << "\"";
}
includeFlags << sep;
}
std::string flags = includeFlags.str();
// remove trailing separators
- if ((sep[0] != ' ') && !flags.empty() && flags[flags.size() - 1] == sep[0]) {
- flags[flags.size() - 1] = ' ';
+ if ((sep[0] != ' ') && !flags.empty() && flags.back() == sep[0]) {
+ flags.back() = ' ';
}
return flags;
}
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 1da077e..7630691 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1347,7 +1347,7 @@ void cmLocalVisualStudio7Generator::OutputLibraryDirectories(
d != dirs.end(); ++d) {
// Remove any trailing slash and skip empty paths.
std::string dir = *d;
- if (dir[dir.size() - 1] == '/') {
+ if (dir.back() == '/') {
dir = dir.substr(0, dir.size() - 1);
}
if (dir.empty()) {
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index f423560..3c46784 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -590,7 +590,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
// mingw32-make incorrectly interprets 'a\ b c' as 'a b' and 'c'
// (but 'a\ b "c"' as 'a\', 'b', and 'c'!). Workaround this by
// avoiding a trailing backslash in the argument.
- targetOutPathCompilePDB[targetOutPathCompilePDB.size() - 1] = '/';
+ targetOutPathCompilePDB.back() = '/';
}
}
cmRulePlaceholderExpander::RuleVariables vars;
diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx
index 04a9318..7fd7732 100644
--- a/Source/cmOrderDirectories.cxx
+++ b/Source/cmOrderDirectories.cxx
@@ -186,7 +186,7 @@ bool cmOrderDirectoriesConstraintSOName::FindConflict(std::string const& dir)
// file name. Usually the soname starts with the library name.
std::string base = this->FileName;
std::set<std::string>::const_iterator first = files.lower_bound(base);
- ++base[base.size() - 1];
+ ++base.back();
std::set<std::string>::const_iterator last = files.upper_bound(base);
if (first != last) {
return true;
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index dbe6fa1..43a0107 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -118,11 +118,11 @@ std::string cmOutputConverter::ForceToRelativePath(
std::string const& local_path, std::string const& remote_path)
{
// The paths should never be quoted.
- assert(local_path[0] != '\"');
- assert(remote_path[0] != '\"');
+ assert(local_path.front() != '\"');
+ assert(remote_path.front() != '\"');
// The local path should never have a trailing slash.
- assert(local_path.empty() || local_path[local_path.size() - 1] != '/');
+ assert(local_path.empty() || local_path.back() != '/');
// If the path is already relative then just return the path.
if (!cmSystemTools::FileIsFullPath(remote_path)) {
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index e2de3f9..87c1ec0 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -340,7 +340,7 @@ protected:
} else {
// try to guess which include path to use
for (std::string incpath : this->IncludeDirectories) {
- if (!incpath.empty() && incpath[incpath.size() - 1] != '/') {
+ if (!incpath.empty() && incpath.back() != '/') {
incpath = incpath + "/";
}
incpath = incpath + path;
@@ -421,7 +421,7 @@ protected:
}
for (std::string path : this->IncludeDirectories) {
- if (!path.empty() && path[path.size() - 1] != '/') {
+ if (!path.empty() && path.back() != '/') {
path = path + "/";
}
path = path + fname;
@@ -435,7 +435,7 @@ protected:
if (extraPath) {
std::string path = extraPath;
- if (!path.empty() && path[path.size() - 1] != '/') {
+ if (!path.empty() && path.back() != '/') {
path = path + "/";
}
path = path + fname;
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx
index 32ad0b0..8a04c1f 100644
--- a/Source/cmRST.cxx
+++ b/Source/cmRST.cxx
@@ -228,8 +228,7 @@ void cmRST::ProcessLine(std::string const& line)
else {
this->NormalLine(line);
this->LastLineEndedInColonColon =
- (line.size() >= 2 && line[line.size() - 2] == ':' &&
- line[line.size() - 1] == ':');
+ (line.size() >= 2 && line[line.size() - 2] == ':' && line.back() == ':');
}
}
diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx
index a71861a..0dfb797 100644
--- a/Source/cmRulePlaceholderExpander.cxx
+++ b/Source/cmRulePlaceholderExpander.cxx
@@ -110,7 +110,7 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable(
if (replaceValues.Target) {
if (variable == "TARGET_QUOTED") {
std::string targetQuoted = replaceValues.Target;
- if (!targetQuoted.empty() && targetQuoted[0] != '\"') {
+ if (!targetQuoted.empty() && targetQuoted.front() != '\"') {
targetQuoted = '\"';
targetQuoted += replaceValues.Target;
targetQuoted += '\"';
@@ -120,7 +120,7 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable(
if (variable == "TARGET_UNQUOTED") {
std::string unquoted = replaceValues.Target;
std::string::size_type sz = unquoted.size();
- if (sz > 2 && unquoted[0] == '\"' && unquoted[sz - 1] == '\"') {
+ if (sz > 2 && unquoted.front() == '\"' && unquoted.back() == '\"') {
unquoted = unquoted.substr(1, sz - 2);
}
return unquoted;
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 985aac8..1a2d1c6 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -54,7 +54,7 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args,
}
// SET (VAR PARENT_SCOPE) // Removes the definition of VAR
// in the parent scope.
- if (args.size() == 2 && args[args.size() - 1] == "PARENT_SCOPE") {
+ if (args.size() == 2 && args.back() == "PARENT_SCOPE") {
this->Makefile->RaiseScope(variable, nullptr);
return true;
}
@@ -74,12 +74,12 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args,
unsigned int ignoreLastArgs = 0;
// look for PARENT_SCOPE argument
- if (args.size() > 1 && args[args.size() - 1] == "PARENT_SCOPE") {
+ if (args.size() > 1 && args.back() == "PARENT_SCOPE") {
parentScope = true;
ignoreLastArgs++;
} else {
// look for FORCE argument
- if (args.size() > 4 && args[args.size() - 1] == "FORCE") {
+ if (args.size() > 4 && args.back() == "FORCE") {
force = true;
ignoreLastArgs++;
}
@@ -103,7 +103,7 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args,
// we should be nice and try to catch some simple screwups if the last or
// next to last args are CACHE then they screwed up. If they used FORCE
// without CACHE they screwed up
- if ((args[args.size() - 1] == "CACHE") ||
+ if ((args.back() == "CACHE") ||
(args.size() > 1 && args[args.size() - 2] == "CACHE") ||
(force && !cache)) {
this->SetError("given invalid arguments for CACHE mode.");
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index a2008a0..4bbd2e0 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -867,8 +867,8 @@ static bool ParseEntryWithoutType(const std::string& entry, std::string& var,
// if value is enclosed in single quotes ('foo') then remove them
// it is used to enclose trailing space or tab
- if (flag && value.size() >= 2 && value[0] == '\'' &&
- value[value.size() - 1] == '\'') {
+ if (flag && value.size() >= 2 && value.front() == '\'' &&
+ value.back() == '\'') {
value = value.substr(1, value.size() - 2);
}
@@ -900,8 +900,8 @@ bool cmState::ParseCacheEntry(const std::string& entry, std::string& var,
// if value is enclosed in single quotes ('foo') then remove them
// it is used to enclose trailing space or tab
- if (flag && value.size() >= 2 && value[0] == '\'' &&
- value[value.size() - 1] == '\'') {
+ if (flag && value.size() >= 2 && value.front() == '\'' &&
+ value.back() == '\'') {
value = value.substr(1, value.size() - 2);
}
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index 1605fd7..91d6190 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -156,7 +156,7 @@ bool cmStringCommand::HandleAsciiCommand(std::vector<std::string> const& args)
return false;
}
std::string::size_type cc;
- std::string const& outvar = args[args.size() - 1];
+ std::string const& outvar = args.back();
std::string output;
for (cc = 1; cc < args.size() - 1; cc++) {
int ch = atoi(args[cc].c_str());
@@ -755,7 +755,7 @@ bool cmStringCommand::HandleRandomCommand(std::vector<std::string> const& args)
this->SetError("sub-command RANDOM invoked with bad length.");
return false;
}
- const std::string& variableName = args[args.size() - 1];
+ const std::string& variableName = args.back();
std::vector<char> result;
@@ -765,8 +765,7 @@ bool cmStringCommand::HandleRandomCommand(std::vector<std::string> const& args)
}
const char* alphaPtr = alphabet.c_str();
- int cc;
- for (cc = 0; cc < length; cc++) {
+ for (int cc = 0; cc < length; cc++) {
int idx = static_cast<int>(sizeofAlphabet * rand() / (RAND_MAX + 1.0));
result.push_back(*(alphaPtr + idx));
}
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 568ee82..9866d13 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1301,7 +1301,7 @@ bool cmSystemTools::SimpleGlob(const std::string& glob,
int type /* = 0 */)
{
files.clear();
- if (glob[glob.size() - 1] != '*') {
+ if (glob.back() != '*') {
return false;
}
std::string path = cmSystemTools::GetFilenamePath(glob);
@@ -1318,7 +1318,7 @@ bool cmSystemTools::SimpleGlob(const std::string& glob,
if ((std::string(d.GetFile(i)) != ".") &&
(std::string(d.GetFile(i)) != "..")) {
std::string fname = path;
- if (path[path.size() - 1] != '/') {
+ if (path.back() != '/') {
fname += "/";
}
fname += d.GetFile(i);
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 5d76a02..92d5505 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -87,7 +87,7 @@ const char* cmTargetPropertyComputer::GetSources<cmTarget>(
cmSystemTools::ExpandListArgument(entry, files);
for (std::string const& file : files) {
if (cmHasLiteralPrefix(file, "$<TARGET_OBJECTS:") &&
- file[file.size() - 1] == '>') {
+ file.back() == '>') {
std::string objLibName = file.substr(17, file.size() - 18);
if (cmGeneratorExpression::Find(objLibName) != std::string::npos) {
diff --git a/Source/cmVisualStudioSlnParser.cxx b/Source/cmVisualStudioSlnParser.cxx
index a9acb3f..9353276 100644
--- a/Source/cmVisualStudioSlnParser.cxx
+++ b/Source/cmVisualStudioSlnParser.cxx
@@ -602,8 +602,8 @@ bool cmVisualStudioSlnParser::ParseTag(const std::string& fullTag,
}
const std::string& arg = cmSystemTools::TrimWhitespace(
fullTag.substr(idxLeftParen + 1, idxRightParen - idxLeftParen - 1));
- if (arg[0] == '"') {
- if (arg[arg.size() - 1] != '"') {
+ if (arg.front() == '"') {
+ if (arg.back() != '"') {
this->LastResult.SetError(ResultErrorInputStructure,
state.GetCurrentLine());
return false;
@@ -620,7 +620,7 @@ bool cmVisualStudioSlnParser::ParseValue(const std::string& value,
const std::string& trimmed = cmSystemTools::TrimWhitespace(value);
if (trimmed.empty())
parsedLine.AddValue(trimmed);
- else if (trimmed[0] == '"' && trimmed[trimmed.size() - 1] == '"')
+ else if (trimmed.front() == '"' && trimmed.back() == '"')
parsedLine.AddQuotedValue(trimmed.substr(1, trimmed.size() - 2));
else
parsedLine.AddValue(trimmed);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 79af3e7..35730b8 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2129,7 +2129,7 @@ void cmake::TruncateOutputLog(const char* fname)
inline std::string removeQuotes(const std::string& s)
{
- if (s[0] == '\"' && s[s.size() - 1] == '\"') {
+ if (s.front() == '\"' && s.back() == '\"') {
return s.substr(1, s.size() - 2);
}
return s;
diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx
index 0c5bbe2..1a10666 100644
--- a/Source/cmcldeps.cxx
+++ b/Source/cmcldeps.cxx
@@ -221,7 +221,7 @@ static int process(const std::string& srcfilename, const std::string& dfile,
while (std::getline(ss, line)) {
if (startsWith(line, prefix)) {
std::string inc = trimLeadingSpace(line.substr(prefix.size()).c_str());
- if (inc[inc.size() - 1] == '\r') // blech, stupid \r\n
+ if (inc.back() == '\r') // blech, stupid \r\n
inc = inc.substr(0, inc.size() - 1);
includes.push_back(inc);
} else {
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 8a140e8..45881aa 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -468,18 +468,18 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// If multiple source files specified,
// then destination must be directory
if ((args.size() > 4) &&
- (!cmSystemTools::FileIsDirectory(args[args.size() - 1]))) {
- std::cerr << "Error: Target (for copy command) \""
- << args[args.size() - 1] << "\" is not a directory.\n";
+ (!cmSystemTools::FileIsDirectory(args.back()))) {
+ std::cerr << "Error: Target (for copy command) \"" << args.back()
+ << "\" is not a directory.\n";
return 1;
}
// 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::cmCopyFile(args[cc].c_str(),
- args[args.size() - 1].c_str())) {
+ args.back().c_str())) {
std::cerr << "Error copying file \"" << args[cc] << "\" to \""
- << args[args.size() - 1] << "\".\n";
+ << args.back() << "\".\n";
return_value = true;
}
}
@@ -491,18 +491,18 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// If multiple source files specified,
// then destination must be directory
if ((args.size() > 4) &&
- (!cmSystemTools::FileIsDirectory(args[args.size() - 1]))) {
+ (!cmSystemTools::FileIsDirectory(args.back()))) {
std::cerr << "Error: Target (for copy_if_different command) \""
- << args[args.size() - 1] << "\" is not a directory.\n";
+ << args.back() << "\" is not a directory.\n";
return 1;
}
// 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].c_str(), args[args.size() - 1].c_str())) {
+ if (!cmSystemTools::CopyFileIfDifferent(args[cc].c_str(),
+ args.back().c_str())) {
std::cerr << "Error copying file (if different) from \"" << args[cc]
- << "\" to \"" << args[args.size() - 1] << "\".\n";
+ << "\" to \"" << args.back() << "\".\n";
return_value = true;
}
}
@@ -514,9 +514,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& 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::CopyADirectory(args[cc], args[args.size() - 1])) {
+ if (!cmSystemTools::CopyADirectory(args[cc], args.back())) {
std::cerr << "Error copying directory from \"" << args[cc]
- << "\" to \"" << args[args.size() - 1] << "\".\n";
+ << "\" to \"" << args.back() << "\".\n";
return_value = true;
}
}
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=86c07b916557ac83cd77f6250d090fa45b4b9bc2
commit 86c07b916557ac83cd77f6250d090fa45b4b9bc2
Author: Joachim Wuttke (o) <j.wuttke at fz-juelich.de>
AuthorDate: Tue Nov 6 12:54:32 2018 +0100
Commit: Joachim Wuttke (o) <j.wuttke at fz-juelich.de>
CommitDate: Tue Nov 6 12:55:25 2018 +0100
Help: Say early on that generator expressions can be nested.
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index b5c4457..63e43e1 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -27,8 +27,10 @@ queryable information.
Generator expressions have the form ``$<...>``. To avoid confusion, this page
deviates from most of the CMake documentation in that it omits angular brackets
-``<...>`` around placeholders like ``condition``, ``true_value``, ``string``,
-and so on.
+``<...>`` around placeholders like ``condition``, ``string``, ``target``,
+among others.
+
+Generator expressions can be nested, as shown in most of the examples below.
.. _`Boolean Generator Expressions`:
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ab1d7df7575503c8eabdf6f8892b5944b06d98e5
commit ab1d7df7575503c8eabdf6f8892b5944b06d98e5
Author: Joachim Wuttke (h) <j.wuttke at fz-juelich.de>
AuthorDate: Sun Nov 4 23:13:21 2018 +0100
Commit: Joachim Wuttke (o) <j.wuttke at fz-juelich.de>
CommitDate: Tue Nov 6 12:55:25 2018 +0100
Help: add section on debugging generator expressions.
This resolves #18550.
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index eb9c9fe..b5c4457 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -440,3 +440,25 @@ Output-Related Expressions
Content of ``...`` converted to shell path style. For example, slashes are
converted to backslashes in Windows shells and drive letters are converted
to posix paths in MSYS shells. The ``...`` must be an absolute path.
+
+Debugging
+=========
+
+Since generator expressions are evaluated during generation of the buildsystem,
+and not during processing of ``CMakeLists.txt`` files, it is not possible to
+inspect their result with the :command:`message()` command.
+
+One possible way to generate debug messages is to add a custom target,
+
+.. code-block:: cmake
+
+ add_custom_target(genexdebug COMMAND ${CMAKE_COMMAND} -E echo "$<...>")
+
+The shell command ``make genexdebug`` (invoked after execution of ``cmake``)
+would then print the result of ``$<...>``.
+
+Another way is to write debug messages to a file:
+
+.. code-block:: cmake
+
+ file(GENERATE OUTPUT filename CONTENT "$<...>")
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e0f0f80f0286b7181b1203693799f5fcfcd8b4af
commit e0f0f80f0286b7181b1203693799f5fcfcd8b4af
Author: Joachim Wuttke (h) <j.wuttke at fz-juelich.de>
AuthorDate: Sun Nov 4 23:00:12 2018 +0100
Commit: Joachim Wuttke (o) <j.wuttke at fz-juelich.de>
CommitDate: Tue Nov 6 12:55:24 2018 +0100
Help: Explain conversion rules of $<BOOL:string>.
This resolves #18549.
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index c5d7a31..eb9c9fe 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -44,8 +44,16 @@ Available boolean expressions are:
Logical Operators
-----------------
-``$<BOOL:condition>``
- ``1`` if the ``condition`` is true, else ``0``
+``$<BOOL:string>``
+ Converts ``string`` to ``0`` or ``1`` according to the rules of the
+ :command:`if()` command. Evaluates to ``0`` if any of the following is true:
+
+ * ``string`` is empty,
+ * ``string`` is a case-insensitive equal of
+ ``0``, ``FALSE``, ``OFF``, ``N``, ``NO``, ``IGNORE``, or ``NOTFOUND``, or
+ * ``string`` ends in the suffix ``-NOTFOUND`` (case-sensitive).
+
+ Otherwise evaluates to ``1``.
``$<AND:conditions>``
where ``conditions`` is a comma-separated list of boolean expressions.
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2b2b41f038af97b7bca2213cda0198d2a28f6c2e
commit 2b2b41f038af97b7bca2213cda0198d2a28f6c2e
Author: Joachim Wuttke (h) <j.wuttke at fz-juelich.de>
AuthorDate: Sun Nov 4 20:03:43 2018 +0100
Commit: Joachim Wuttke (o) <j.wuttke at fz-juelich.de>
CommitDate: Tue Nov 6 12:55:24 2018 +0100
Help: Code example for case-insensitive comparison
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index bf11b05..c5d7a31 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -65,7 +65,14 @@ String Comparisons
``$<STREQUAL:string1,string2>``
``1`` if ``string1`` and ``string2`` are equal, else ``0``.
- The comparison is case-sensitive.
+ The comparison is case-sensitive. For a case-insensitive comparison,
+ combine with a :ref:`string transforming generator expression
+ <String Transforming Generator Expressions>`,
+
+ .. code-block:: cmake
+
+ $<STREQUAL:$<UPPER_CASE:${foo}>,"BAR"> # "1" if ${foo} is any of "BAR", "Bar", "bar", ...
+
``$<EQUAL:value1,value2>``
``1`` if ``value1`` and ``value2`` are numerically equal, else ``0``.
``$<IN_LIST:string,list>``
@@ -254,8 +261,10 @@ Typically, the ``condition`` is a :ref:`boolean generator expression
expands to ``DEBUG_MODE`` when the ``Debug`` configuration is used, and
otherwise expands to the empty string.
-String Operations
------------------
+.. _`String Transforming Generator Expressions`:
+
+String Transformations
+----------------------
``$<JOIN:list,string>``
Joins the list with the content of ``string``.
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e045fb202ddf9100965ac418f4aa22e65256dd8d
commit e045fb202ddf9100965ac418f4aa22e65256dd8d
Author: Joachim Wuttke (h) <j.wuttke at fz-juelich.de>
AuthorDate: Sun Nov 4 19:54:20 2018 +0100
Commit: Joachim Wuttke (o) <j.wuttke at fz-juelich.de>
CommitDate: Tue Nov 6 12:55:24 2018 +0100
Help: Terminate explanations with a dot.
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index 27bf7d1..bf11b05 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -58,7 +58,7 @@ Logical Operators
Otherwise evaluates to ``0``.
``$<NOT:condition>``
- ``0`` if ``condition`` is ``1``, else ``1``
+ ``0`` if ``condition`` is ``1``, else ``1``.
String Comparisons
------------------
@@ -67,7 +67,7 @@ String Comparisons
``1`` if ``string1`` and ``string2`` are equal, else ``0``.
The comparison is case-sensitive.
``$<EQUAL:value1,value2>``
- ``1`` if ``value1`` and ``value2`` are numerically equal, else ``0``
+ ``1`` if ``value1`` and ``value2`` are numerically equal, else ``0``.
``$<IN_LIST:string,list>``
``1`` if ``string`` is member of the comma-separated ``list``, else ``0``.
Uses case-sensitive comparisons.
@@ -258,7 +258,7 @@ String Operations
-----------------
``$<JOIN:list,string>``
- Joins the list with the content of ``string``
+ Joins the list with the content of ``string``.
``$<LOWER_CASE:string>``
Content of ``string`` converted to lower case.
``$<UPPER_CASE:string>``
@@ -308,7 +308,7 @@ Variable Queries
----------------
``$<CONFIG>``
- Configuration name
+ Configuration name.
``$<CONFIGURATION>``
Configuration name. Deprecated since CMake 3.0. Use ``CONFIG`` instead.
``$<PLATFORM_ID>``
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3fa0a03b7e4094bef1b66e48ed437e1c0b41c49a
commit 3fa0a03b7e4094bef1b66e48ed437e1c0b41c49a
Author: Joachim Wuttke (h) <j.wuttke at fz-juelich.de>
AuthorDate: Sun Nov 4 19:51:06 2018 +0100
Commit: Joachim Wuttke (o) <j.wuttke at fz-juelich.de>
CommitDate: Tue Nov 6 12:55:24 2018 +0100
Help: Expand placeholders in string comparisons.
And point out that STREQUAL is case sensitive.
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index cbeb348..27bf7d1 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -63,12 +63,14 @@ Logical Operators
String Comparisons
------------------
-``$<STREQUAL:a,b>``
- ``1`` if ``a`` is STREQUAL ``b``, else ``0``
-``$<EQUAL:a,b>``
- ``1`` if ``a`` is EQUAL ``b`` in a numeric comparison, else ``0``
-``$<IN_LIST:a,b>``
- ``1`` if ``a`` is IN_LIST ``b``, else ``0``
+``$<STREQUAL:string1,string2>``
+ ``1`` if ``string1`` and ``string2`` are equal, else ``0``.
+ The comparison is case-sensitive.
+``$<EQUAL:value1,value2>``
+ ``1`` if ``value1`` and ``value2`` are numerically equal, else ``0``
+``$<IN_LIST:string,list>``
+ ``1`` if ``string`` is member of the comma-separated ``list``, else ``0``.
+ Uses case-sensitive comparisons.
``$<VERSION_LESS:v1,v2>``
``1`` if ``v1`` is a version less than ``v2``, else ``0``.
``$<VERSION_GREATER:v1,v2>``
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fb423b3c49d21df851b1d4a91fddfe94d835155b
commit fb423b3c49d21df851b1d4a91fddfe94d835155b
Author: Joachim Wuttke (h) <j.wuttke at fz-juelich.de>
AuthorDate: Sun Nov 4 19:31:22 2018 +0100
Commit: Joachim Wuttke (o) <j.wuttke at fz-juelich.de>
CommitDate: Tue Nov 6 12:55:24 2018 +0100
Help: sort conditional expressions below string-valued ones.
Makes things yet clearer and simpler.
Also correct remnant of "informational expression".
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index 4f2036e..cbeb348 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -30,41 +30,14 @@ deviates from most of the CMake documentation in that it omits angular brackets
``<...>`` around placeholders like ``condition``, ``true_value``, ``string``,
and so on.
-.. _`Conditional Generator Expressions`:
-
-Conditional Generator Expressions
-=================================
-
-Conditional generator expressions depend on a boolean condition
-that must be ``0`` or ``1``.
-
-``$<condition:true_value>``
- Evaluates to ``true_value`` if ``condition`` is ``1``.
- Otherwise evaluates to the empty string.
-
-``$<IF:condition,true_value,false_value>``
- Evaluates to ``true_value`` if ``condition`` is ``1``.
- Otherwise evaluates to ``false_value``.
-
-Typically, the ``condition`` is a
-:ref:`boolean generator expression<Boolean Generator Expressions>`.
-For instance,
-
-.. code-block:: cmake
-
- $<$<CONFIG:Debug>:DEBUG_MODE>
-
-expands to ``DEBUG_MODE`` when the ``Debug`` configuration is used, and
-otherwise expands to the empty string.
-
.. _`Boolean Generator Expressions`:
Boolean Generator Expressions
=============================
Boolean expressions evaluate to either ``0`` or ``1``.
-They are typically used to construct the condition in a
-:ref:`conditional generator expression<Conditional Generator Expressions>`.
+They are typically used to construct the condition in a :ref:`conditional
+generator expression<Conditional Generator Expressions>`.
Available boolean expressions are:
@@ -239,7 +212,7 @@ introduce a helper variable to keep the code readable:
set(prop "$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>") # helper variable
$<$<BOOL:${prop}>:-I$<JOIN:${prop}, -I>>
-Available informational expressions are:
+The following string-valued generator expressions are available:
Escaped Characters
------------------
@@ -253,6 +226,32 @@ String literals to escape the special meaning a character would otherwise have:
``$<SEMICOLON>``
A literal ``;``. Used to prevent list expansion on an argument with ``;``.
+.. _`Conditional Generator Expressions`:
+
+Conditional Expressions
+-----------------------
+
+Conditional generator expressions depend on a boolean condition
+that must be ``0`` or ``1``.
+
+``$<condition:true_string>``
+ Evaluates to ``true_string`` if ``condition`` is ``1``.
+ Otherwise evaluates to the empty string.
+
+``$<IF:condition,true_string,false_string>``
+ Evaluates to ``true_string`` if ``condition`` is ``1``.
+ Otherwise evaluates to ``false_string``.
+
+Typically, the ``condition`` is a :ref:`boolean generator expression
+<Boolean Generator Expressions>`. For instance,
+
+.. code-block:: cmake
+
+ $<$<CONFIG:Debug>:DEBUG_MODE>
+
+expands to ``DEBUG_MODE`` when the ``Debug`` configuration is used, and
+otherwise expands to the empty string.
+
String Operations
-----------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=867c9c9c0dc2782b2d822557c8dc83c451409b48
commit 867c9c9c0dc2782b2d822557c8dc83c451409b48
Author: Joachim Wuttke (h) <j.wuttke at fz-juelich.de>
AuthorDate: Sun Nov 4 18:51:38 2018 +0100
Commit: Joachim Wuttke (o) <j.wuttke at fz-juelich.de>
CommitDate: Tue Nov 6 12:55:24 2018 +0100
Help: Add deprecation date of $<CONFIGURATION>
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index 929d120..4f2036e 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -309,7 +309,7 @@ Variable Queries
``$<CONFIG>``
Configuration name
``$<CONFIGURATION>``
- Configuration name. Deprecated. Use ``CONFIG`` instead.
+ Configuration name. Deprecated since CMake 3.0. Use ``CONFIG`` instead.
``$<PLATFORM_ID>``
The CMake-id of the platform.
See also the :variable:`CMAKE_SYSTEM_NAME` variable.
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a85e5e6f4d53dd158392dd74b9632d84fb583722
commit a85e5e6f4d53dd158392dd74b9632d84fb583722
Author: Joachim Wuttke (h) <j.wuttke at fz-juelich.de>
AuthorDate: Sun Nov 4 18:26:13 2018 +0100
Commit: Joachim Wuttke (o) <j.wuttke at fz-juelich.de>
CommitDate: Tue Nov 6 12:55:24 2018 +0100
Help: Add note on omitted <..> notation in cmake-generator-expressions(7)
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index 187f3b7..929d120 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -25,6 +25,11 @@ conditional include directories, and more. The conditions may be based on
the build configuration, target properties, platform information or any other
queryable information.
+Generator expressions have the form ``$<...>``. To avoid confusion, this page
+deviates from most of the CMake documentation in that it omits angular brackets
+``<...>`` around placeholders like ``condition``, ``true_value``, ``string``,
+and so on.
+
.. _`Conditional Generator Expressions`:
Conditional Generator Expressions
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ff1db47728a37a7775a3b870ff9ffdc3249c3d40
commit ff1db47728a37a7775a3b870ff9ffdc3249c3d40
Author: Joachim Wuttke (h) <j.wuttke at fz-juelich.de>
AuthorDate: Sun Nov 4 17:08:25 2018 +0100
Commit: Joachim Wuttke (o) <j.wuttke at fz-juelich.de>
CommitDate: Tue Nov 6 12:55:24 2018 +0100
Help: Revise documentation of string-valued generator expressions
* Consolidate examples
* Sort, and insert subsection headers
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index 099d398..187f3b7 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -102,6 +102,7 @@ String Comparisons
``$<VERSION_GREATER_EQUAL:v1,v2>``
``1`` if ``v1`` is a version greater than or equal to ``v2``, else ``0``.
+
Variable Queries
----------------
@@ -144,6 +145,9 @@ Variable Queries
for the 'head' target, an error is reported. See the
:manual:`cmake-compile-features(7)` manual for information on
compile features and a list of supported compilers.
+
+.. _`Boolean COMPILE_LANGUAGE Generator Expression`:
+
``$<COMPILE_LANGUAGE:language>``
``1`` when the language used for compilation unit matches ``language``,
otherwise ``0``. This expression may be used to specify compile options,
@@ -187,20 +191,22 @@ Variable Queries
add_executable(myapp main.cpp)
target_link_libraries(myapp myapp_c myapp_cxx)
-Informational Generator Expressions
+String-Valued Generator Expressions
===================================
-These expressions expand to some information. The information may be used
-directly, eg:
+These expressions expand to some string.
+For example,
.. code-block:: cmake
include_directories(/usr/include/$<CXX_COMPILER_ID>/)
expands to ``/usr/include/GNU/`` or ``/usr/include/Clang/`` etc, depending on
-the Id of the compiler.
+the compiler identifier.
-These expressions may also may be combined with logical expressions:
+String-valued expressions may also be combined with other expressions.
+Here an example for a string-valued expression within a boolean expressions
+within a conditional expression:
.. code-block:: cmake
@@ -210,12 +216,95 @@ expands to ``OLD_COMPILER`` if the
:variable:`CMAKE_CXX_COMPILER_VERSION <CMAKE_<LANG>_COMPILER_VERSION>` is less
than 4.2.0.
+And here two nested string-valued expressions:
+
+.. code-block:: cmake
+
+ -I$<JOIN:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>, -I>
+
+generates a string of the entries in the :prop_tgt:`INCLUDE_DIRECTORIES` target
+property with each entry preceded by ``-I``.
+
+Expanding on the previous example, if one first wants to check if the
+``INCLUDE_DIRECTORIES`` property is non-empty, then it is advisable to
+introduce a helper variable to keep the code readable:
+
+.. code-block:: cmake
+
+ set(prop "$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>") # helper variable
+ $<$<BOOL:${prop}>:-I$<JOIN:${prop}, -I>>
+
Available informational expressions are:
-``$<CONFIGURATION>``
- Configuration name. Deprecated. Use ``CONFIG`` instead.
+Escaped Characters
+------------------
+
+String literals to escape the special meaning a character would otherwise have:
+
+``$<ANGLE-R>``
+ A literal ``>``. Used for example to compare strings that contain a ``>``.
+``$<COMMA>``
+ A literal ``,``. Used for example to compare strings which contain a ``,``.
+``$<SEMICOLON>``
+ A literal ``;``. Used to prevent list expansion on an argument with ``;``.
+
+String Operations
+-----------------
+
+``$<JOIN:list,string>``
+ Joins the list with the content of ``string``
+``$<LOWER_CASE:string>``
+ Content of ``string`` converted to lower case.
+``$<UPPER_CASE:string>``
+ Content of ``string`` converted to upper case.
+
+``$<GENEX_EVAL:expr>``
+ Content of ``expr`` evaluated as a generator expression in the current
+ context. This enables consumption of generator expressions whose
+ evaluation results itself in generator expressions.
+``$<TARGET_GENEX_EVAL:tgt,expr>``
+ Content of ``expr`` evaluated as a generator expression in the context of
+ ``tgt`` target. This enables consumption of custom target properties that
+ themselves contain generator expressions.
+
+ Having the capability to evaluate generator expressions is very useful when
+ you want to manage custom properties supporting generator expressions.
+ For example:
+
+ .. code-block:: cmake
+
+ add_library(foo ...)
+
+ set_property(TARGET foo PROPERTY
+ CUSTOM_KEYS $<$<CONFIG:DEBUG>:FOO_EXTRA_THINGS>
+ )
+
+ add_custom_target(printFooKeys
+ COMMAND ${CMAKE_COMMAND} -E echo $<TARGET_PROPERTY:foo,CUSTOM_KEYS>
+ )
+
+ This naive implementation of the ``printFooKeys`` custom command is wrong
+ because ``CUSTOM_KEYS`` target property is not evaluated and the content
+ is passed as is (i.e. ``$<$<CONFIG:DEBUG>:FOO_EXTRA_THINGS>``).
+
+ To have the expected result (i.e. ``FOO_EXTRA_THINGS`` if config is
+ ``Debug``), it is required to evaluate the output of
+ ``$<TARGET_PROPERTY:foo,CUSTOM_KEYS>``:
+
+ .. code-block:: cmake
+
+ add_custom_target(printFooKeys
+ COMMAND ${CMAKE_COMMAND} -E
+ echo $<TARGET_GENEX_EVAL:foo,$<TARGET_PROPERTY:foo,CUSTOM_KEYS>>
+ )
+
+Variable Queries
+----------------
+
``$<CONFIG>``
Configuration name
+``$<CONFIGURATION>``
+ Configuration name. Deprecated. Use ``CONFIG`` instead.
``$<PLATFORM_ID>``
The CMake-id of the platform.
See also the :variable:`CMAKE_SYSTEM_NAME` variable.
@@ -231,6 +320,19 @@ Available informational expressions are:
``$<CXX_COMPILER_VERSION>``
The version of the CXX compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
+``$<COMPILE_LANGUAGE>``
+ The compile language of source files when evaluating compile options.
+ See :ref:`the related boolean expression
+ <Boolean COMPILE_LANGUAGE Generator Expression>`
+ ``$<COMPILE_LANGUAGE:language>``
+ for notes about the portability of this generator expression.
+
+Target-Dependent Queries
+------------------------
+
+``$<TARGET_NAME_IF_EXISTS:tgt>``
+ Expands to the ``tgt`` if the given target exists, an empty string
+ otherwise.
``$<TARGET_FILE:tgt>``
Full path to main file (.exe, .so.1.2, .a) where ``tgt`` is the name of a target.
``$<TARGET_FILE_NAME:tgt>``
@@ -283,54 +385,14 @@ Available informational expressions are:
``$<INSTALL_PREFIX>``
Content of the install prefix when the target is exported via
:command:`install(EXPORT)` and empty otherwise.
-``$<COMPILE_LANGUAGE>``
- The compile language of source files when evaluating compile options. See
- the unary version for notes about portability of this generator
- expression.
-Output Generator Expressions
-============================
+Output-Related Expressions
+--------------------------
-These expressions generate output, in some cases depending on an input. These
-expressions may be combined with other expressions for information or logical
-comparison:
-
-.. code-block:: cmake
-
- -I$<JOIN:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>, -I>
-
-generates a string of the entries in the :prop_tgt:`INCLUDE_DIRECTORIES` target
-property with each entry preceded by ``-I``. Note that a more-complete use
-in this situation would require first checking if the INCLUDE_DIRECTORIES
-property is non-empty:
-
-.. code-block:: cmake
-
- $<$<BOOL:${prop}>:-I$<JOIN:${prop}, -I>>
-
-where ``${prop}`` refers to a helper variable:
-
-.. code-block:: cmake
-
- set(prop "$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>")
-
-Available output expressions are:
-
-``$<JOIN:list,...>``
- Joins the list with the content of ``...``
-``$<ANGLE-R>``
- A literal ``>``. Used to compare strings which contain a ``>`` for example.
-``$<COMMA>``
- A literal ``,``. Used to compare strings which contain a ``,`` for example.
-``$<SEMICOLON>``
- A literal ``;``. Used to prevent list expansion on an argument with ``;``.
``$<TARGET_NAME:...>``
Marks ``...`` as being the name of a target. This is required if exporting
targets to multiple dependent export sets. The ``...`` must be a literal
name of a target- it may not contain generator expressions.
-``$<TARGET_NAME_IF_EXISTS:...>``
- Expands to the ``...`` if the given target exists, an empty string
- otherwise.
``$<LINK_ONLY:...>``
Content of ``...`` except when evaluated in a link interface while
propagating :ref:`Target Usage Requirements`, in which case it is the
@@ -345,10 +407,6 @@ Available output expressions are:
Content of ``...`` when the property is exported using :command:`export`, or
when the target is used by another target in the same buildsystem. Expands to
the empty string otherwise.
-``$<LOWER_CASE:...>``
- Content of ``...`` converted to lower case.
-``$<UPPER_CASE:...>``
- Content of ``...`` converted to upper case.
``$<MAKE_C_IDENTIFIER:...>``
Content of ``...`` converted to a C identifier. The conversion follows the
same behavior as :command:`string(MAKE_C_IDENTIFIER)`.
@@ -359,42 +417,3 @@ Available output expressions are:
Content of ``...`` converted to shell path style. For example, slashes are
converted to backslashes in Windows shells and drive letters are converted
to posix paths in MSYS shells. The ``...`` must be an absolute path.
-``$<GENEX_EVAL:...>``
- Content of ``...`` evaluated as a generator expression in the current
- context. This enables consumption of generator expressions
- whose evaluation results itself in generator expressions.
-``$<TARGET_GENEX_EVAL:tgt,...>``
- Content of ``...`` evaluated as a generator expression in the context of
- ``tgt`` target. This enables consumption of custom target properties that
- themselves contain generator expressions.
-
- Having the capability to evaluate generator expressions is very useful when
- you want to manage custom properties supporting generator expressions.
- For example:
-
- .. code-block:: cmake
-
- add_library(foo ...)
-
- set_property(TARGET foo PROPERTY
- CUSTOM_KEYS $<$<CONFIG:DEBUG>:FOO_EXTRA_THINGS>
- )
-
- add_custom_target(printFooKeys
- COMMAND ${CMAKE_COMMAND} -E echo $<TARGET_PROPERTY:foo,CUSTOM_KEYS>
- )
-
- This naive implementation of the ``printFooKeys`` custom command is wrong
- because ``CUSTOM_KEYS`` target property is not evaluated and the content
- is passed as is (i.e. ``$<$<CONFIG:DEBUG>:FOO_EXTRA_THINGS>``).
-
- To have the expected result (i.e. ``FOO_EXTRA_THINGS`` if config is
- ``Debug``), it is required to evaluate the output of
- ``$<TARGET_PROPERTY:foo,CUSTOM_KEYS>``:
-
- .. code-block:: cmake
-
- add_custom_target(printFooKeys
- COMMAND ${CMAKE_COMMAND} -E
- echo $<TARGET_GENEX_EVAL:foo,$<TARGET_PROPERTY:foo,CUSTOM_KEYS>>
- )
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fe8acf7c0540ca39300bab5b014e428e84077c7a
commit fe8acf7c0540ca39300bab5b014e428e84077c7a
Author: Joachim Wuttke (h) <j.wuttke at fz-juelich.de>
AuthorDate: Sun Nov 4 15:48:02 2018 +0100
Commit: Joachim Wuttke (o) <j.wuttke at fz-juelich.de>
CommitDate: Tue Nov 6 12:55:23 2018 +0100
Help: 3 subtypes of boolean generator expressions.
Main classification by return type,
subclassification by dependences
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index 1c3d3fc..099d398 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -63,6 +63,9 @@ They are typically used to construct the condition in a
Available boolean expressions are:
+Logical Operators
+-----------------
+
``$<BOOL:condition>``
``1`` if the ``condition`` is true, else ``0``
@@ -79,12 +82,29 @@ Available boolean expressions are:
``$<NOT:condition>``
``0`` if ``condition`` is ``1``, else ``1``
+String Comparisons
+------------------
+
``$<STREQUAL:a,b>``
``1`` if ``a`` is STREQUAL ``b``, else ``0``
``$<EQUAL:a,b>``
``1`` if ``a`` is EQUAL ``b`` in a numeric comparison, else ``0``
``$<IN_LIST:a,b>``
``1`` if ``a`` is IN_LIST ``b``, else ``0``
+``$<VERSION_LESS:v1,v2>``
+ ``1`` if ``v1`` is a version less than ``v2``, else ``0``.
+``$<VERSION_GREATER:v1,v2>``
+ ``1`` if ``v1`` is a version greater than ``v2``, else ``0``.
+``$<VERSION_EQUAL:v1,v2>``
+ ``1`` if ``v1`` is the same version as ``v2``, else ``0``.
+``$<VERSION_LESS_EQUAL:v1,v2>``
+ ``1`` if ``v1`` is a version less than or equal to ``v2``, else ``0``.
+``$<VERSION_GREATER_EQUAL:v1,v2>``
+ ``1`` if ``v1`` is a version greater than or equal to ``v2``, else ``0``.
+
+Variable Queries
+----------------
+
``$<TARGET_EXISTS:target>``
``1`` if ``target`` exists, else ``0``.
``$<CONFIG:cfg>``
@@ -104,16 +124,6 @@ Available boolean expressions are:
``1`` if the CMake-id of the CXX compiler matches ``compiler_id``,
otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
-``$<VERSION_LESS:v1,v2>``
- ``1`` if ``v1`` is a version less than ``v2``, else ``0``.
-``$<VERSION_GREATER:v1,v2>``
- ``1`` if ``v1`` is a version greater than ``v2``, else ``0``.
-``$<VERSION_EQUAL:v1,v2>``
- ``1`` if ``v1`` is the same version as ``v2``, else ``0``.
-``$<VERSION_LESS_EQUAL:v1,v2>``
- ``1`` if ``v1`` is a version less than or equal to ``v2``, else ``0``.
-``$<VERSION_GREATER_EQUAL:v1,v2>``
- ``1`` if ``v1`` is a version greater than or equal to ``v2``, else ``0``.
``$<C_COMPILER_VERSION:version>``
``1`` if the version of the C compiler matches ``version``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9891adf74becfa95463f6928fda9f8ac17c934bd
commit 9891adf74becfa95463f6928fda9f8ac17c934bd
Author: Joachim Wuttke (h) <j.wuttke at fz-juelich.de>
AuthorDate: Sun Nov 4 15:40:58 2018 +0100
Commit: Joachim Wuttke (o) <j.wuttke at fz-juelich.de>
CommitDate: Tue Nov 6 12:55:23 2018 +0100
Help: Cross-link conditional and boolean expressions.
Rename Logical -> Boolean Generator Expressions.
It's the return type that helps us to sort the expression zoo.
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index 094bfc1..1c3d3fc 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -25,11 +25,13 @@ conditional include directories, and more. The conditions may be based on
the build configuration, target properties, platform information or any other
queryable information.
-Conditional Expressions
-=======================
+.. _`Conditional Generator Expressions`:
-Conditional expressions depend on a boolean condition that must be
-``0`` or ``1``.
+Conditional Generator Expressions
+=================================
+
+Conditional generator expressions depend on a boolean condition
+that must be ``0`` or ``1``.
``$<condition:true_value>``
Evaluates to ``true_value`` if ``condition`` is ``1``.
@@ -39,23 +41,27 @@ Conditional expressions depend on a boolean condition that must be
Evaluates to ``true_value`` if ``condition`` is ``1``.
Otherwise evaluates to ``false_value``.
-
-Logical Expressions
-===================
-
-Logical expressions are used to create conditional output. The basic
-expressions are the ``0`` and ``1`` expressions. Because other logical
-expressions evaluate to either ``0`` or ``1``, they can be composed to
-create conditional output:
+Typically, the ``condition`` is a
+:ref:`boolean generator expression<Boolean Generator Expressions>`.
+For instance,
.. code-block:: cmake
$<$<CONFIG:Debug>:DEBUG_MODE>
expands to ``DEBUG_MODE`` when the ``Debug`` configuration is used, and
-otherwise expands to nothing.
+otherwise expands to the empty string.
+
+.. _`Boolean Generator Expressions`:
+
+Boolean Generator Expressions
+=============================
+
+Boolean expressions evaluate to either ``0`` or ``1``.
+They are typically used to construct the condition in a
+:ref:`conditional generator expression<Conditional Generator Expressions>`.
-Available logical expressions are:
+Available boolean expressions are:
``$<BOOL:condition>``
``1`` if the ``condition`` is true, else ``0``
@@ -171,8 +177,8 @@ Available logical expressions are:
add_executable(myapp main.cpp)
target_link_libraries(myapp myapp_c myapp_cxx)
-Informational Expressions
-=========================
+Informational Generator Expressions
+===================================
These expressions expand to some information. The information may be used
directly, eg:
@@ -272,8 +278,8 @@ Available informational expressions are:
the unary version for notes about portability of this generator
expression.
-Output Expressions
-==================
+Output Generator Expressions
+============================
These expressions generate output, in some cases depending on an input. These
expressions may be combined with other expressions for information or logical
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=20b6561e78f5acceecae7c6fc330f7f7de4f2223
commit 20b6561e78f5acceecae7c6fc330f7f7de4f2223
Author: Joachim Wuttke (h) <j.wuttke at fz-juelich.de>
AuthorDate: Sun Nov 4 15:23:00 2018 +0100
Commit: Joachim Wuttke (o) <j.wuttke at fz-juelich.de>
CommitDate: Tue Nov 6 12:55:23 2018 +0100
Help: new section on conditional generator expressions
Before, the closely related signatures
$<condition:true_value>
$<IF:condition,true_value,false_value>
were explained in two different sections. The former section
was badly explained, with '0' and '1' in place of the formal
parameter 'condition'.
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index 6f17812..094bfc1 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -25,6 +25,21 @@ conditional include directories, and more. The conditions may be based on
the build configuration, target properties, platform information or any other
queryable information.
+Conditional Expressions
+=======================
+
+Conditional expressions depend on a boolean condition that must be
+``0`` or ``1``.
+
+``$<condition:true_value>``
+ Evaluates to ``true_value`` if ``condition`` is ``1``.
+ Otherwise evaluates to the empty string.
+
+``$<IF:condition,true_value,false_value>``
+ Evaluates to ``true_value`` if ``condition`` is ``1``.
+ Otherwise evaluates to ``false_value``.
+
+
Logical Expressions
===================
@@ -58,10 +73,6 @@ Available logical expressions are:
``$<NOT:condition>``
``0`` if ``condition`` is ``1``, else ``1``
-``$<IF:condition,true_value,false_value>``
- ``true_value`` if ``condition`` is ``1``,
- ``false_value`` if ``condition`` is ``0``
-
``$<STREQUAL:a,b>``
``1`` if ``a`` is STREQUAL ``b``, else ``0``
``$<EQUAL:a,b>``
@@ -289,10 +300,6 @@ where ``${prop}`` refers to a helper variable:
Available output expressions are:
-``$<0:...>``
- Empty string (ignores ``...``)
-``$<1:...>``
- Content of ``...``
``$<JOIN:list,...>``
Joins the list with the content of ``...``
``$<ANGLE-R>``
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=873e59c0c456c2e13e66019c15f3632d06dac0f6
commit 873e59c0c456c2e13e66019c15f3632d06dac0f6
Author: Joachim Wuttke (h) <j.wuttke at fz-juelich.de>
AuthorDate: Sun Nov 4 15:10:40 2018 +0100
Commit: Joachim Wuttke (o) <j.wuttke at fz-juelich.de>
CommitDate: Tue Nov 6 12:55:23 2018 +0100
Help: rm unmotivated "This means that"
That generator expressions enable conditional things
has not been said before.
Amended for nicer source format.
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index 95de378..6f17812 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -20,10 +20,10 @@ commands to populate those properties, such as :command:`target_link_libraries`,
:command:`target_include_directories`, :command:`target_compile_definitions`
and others.
-This means that they enable conditional linking, conditional
-definitions used when compiling, and conditional include directories and
-more. The conditions may be based on the build configuration, target
-properties, platform information or any other queryable information.
+They enable conditional linking, conditional definitions used when compiling,
+conditional include directories, and more. The conditions may be based on
+the build configuration, target properties, platform information or any other
+queryable information.
Logical Expressions
===================
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b2a798fe32ce25e5ea19f6487ce9cadf9852ea83
commit b2a798fe32ce25e5ea19f6487ce9cadf9852ea83
Author: Joachim Wuttke (h) <j.wuttke at fz-juelich.de>
AuthorDate: Sun Nov 4 15:07:42 2018 +0100
Commit: Joachim Wuttke (o) <j.wuttke at fz-juelich.de>
CommitDate: Tue Nov 6 12:55:23 2018 +0100
Help: expand "ver", "pol", ...
No need to save a few characters on formal parameters.
Use this occasion to correct $<PLATFORM_ID:comp>:
the parameter is a platform_id, not a compiler_id.
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index 24b79d4..95de378 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -68,21 +68,24 @@ Available logical expressions are:
``1`` if ``a`` is EQUAL ``b`` in a numeric comparison, else ``0``
``$<IN_LIST:a,b>``
``1`` if ``a`` is IN_LIST ``b``, else ``0``
-``$<TARGET_EXISTS:tgt>``
- ``1`` if ``tgt`` is an existed target name, else ``0``.
+``$<TARGET_EXISTS:target>``
+ ``1`` if ``target`` exists, else ``0``.
``$<CONFIG:cfg>``
``1`` if config is ``cfg``, else ``0``. This is a case-insensitive comparison.
The mapping in :prop_tgt:`MAP_IMPORTED_CONFIG_<CONFIG>` is also considered by
this expression when it is evaluated on a property on an :prop_tgt:`IMPORTED`
target.
-``$<PLATFORM_ID:comp>``
- ``1`` if the CMake-id of the platform matches ``comp``, otherwise ``0``.
+``$<PLATFORM_ID:platform_id>``
+ ``1`` if the CMake-id of the platform matches ``platform_id``
+ otherwise ``0``.
See also the :variable:`CMAKE_SYSTEM_NAME` variable.
-``$<C_COMPILER_ID:comp>``
- ``1`` if the CMake-id of the C compiler matches ``comp``, otherwise ``0``.
+``$<C_COMPILER_ID:compiler_id>``
+ ``1`` if the CMake-id of the C compiler matches ``compiler_id``,
+ otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
-``$<CXX_COMPILER_ID:comp>``
- ``1`` if the CMake-id of the CXX compiler matches ``comp``, otherwise ``0``.
+``$<CXX_COMPILER_ID:compiler_id>``
+ ``1`` if the CMake-id of the CXX compiler matches ``compiler_id``,
+ otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
``$<VERSION_LESS:v1,v2>``
``1`` if ``v1`` is a version less than ``v2``, else ``0``.
@@ -94,27 +97,28 @@ Available logical expressions are:
``1`` if ``v1`` is a version less than or equal to ``v2``, else ``0``.
``$<VERSION_GREATER_EQUAL:v1,v2>``
``1`` if ``v1`` is a version greater than or equal to ``v2``, else ``0``.
-``$<C_COMPILER_VERSION:ver>``
- ``1`` if the version of the C compiler matches ``ver``, otherwise ``0``.
+``$<C_COMPILER_VERSION:version>``
+ ``1`` if the version of the C compiler matches ``version``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
-``$<CXX_COMPILER_VERSION:ver>``
- ``1`` if the version of the CXX compiler matches ``ver``, otherwise ``0``.
+``$<CXX_COMPILER_VERSION:version>``
+ ``1`` if the version of the CXX compiler matches ``version``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
-``$<TARGET_POLICY:pol>``
- ``1`` if the policy ``pol`` was NEW when the 'head' target was created,
- else ``0``. If the policy was not set, the warning message for the policy
+``$<TARGET_POLICY:policy>``
+ ``1`` if the ``policy`` was NEW when the 'head' target was created,
+ else ``0``. If the ``policy`` was not set, the warning message for the policy
will be emitted. This generator expression only works for a subset of
policies.
-``$<COMPILE_FEATURES:feature[,feature]...>``
- ``1`` if all of the ``feature`` features are available for the 'head'
+``$<COMPILE_FEATURES:features>``
+ where ``features`` is a comma-spearated list.
+ Evaluates to ``1`` if all of the ``features`` are available for the 'head'
target, and ``0`` otherwise. If this expression is used while evaluating
the link implementation of a target and if any dependency transitively
increases the required :prop_tgt:`C_STANDARD` or :prop_tgt:`CXX_STANDARD`
for the 'head' target, an error is reported. See the
:manual:`cmake-compile-features(7)` manual for information on
compile features and a list of supported compilers.
-``$<COMPILE_LANGUAGE:lang>``
- ``1`` when the language used for compilation unit matches ``lang``,
+``$<COMPILE_LANGUAGE:language>``
+ ``1`` when the language used for compilation unit matches ``language``,
otherwise ``0``. This expression may be used to specify compile options,
compile definitions, and include directories for source files of a
particular language in a target. For example:
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=db749f404c29bc91a06f2ea2fb23d8a30c526a9a
commit db749f404c29bc91a06f2ea2fb23d8a30c526a9a
Author: Joachim Wuttke (h) <j.wuttke at fz-juelich.de>
AuthorDate: Sun Nov 4 14:55:51 2018 +0100
Commit: Joachim Wuttke (o) <j.wuttke at fz-juelich.de>
CommitDate: Tue Nov 6 12:55:23 2018 +0100
Help: expand "..." and "?" in logical generator expressions
Expand "..." and "?", which could be mistaken as metacharacters
(and in the explanations of AND and OR actually were meant as
metacharacters).
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index bddf827..24b79d4 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -42,19 +42,26 @@ otherwise expands to nothing.
Available logical expressions are:
-``$<BOOL:...>``
- ``1`` if the ``...`` is true, else ``0``
-``$<AND:?[,?]...>``
- ``1`` if all ``?`` are ``1``, else ``0``
-
- The ``?`` must always be either ``0`` or ``1`` in boolean expressions.
-
-``$<OR:?[,?]...>``
- ``0`` if all ``?`` are ``0``, else ``1``
-``$<NOT:?>``
- ``0`` if ``?`` is ``1``, else ``1``
-``$<IF:?,true-value...,false-value...>``
- ``true-value...`` if ``?`` is ``1``, ``false-value...`` if ``?`` is ``0``
+``$<BOOL:condition>``
+ ``1`` if the ``condition`` is true, else ``0``
+
+``$<AND:conditions>``
+ where ``conditions`` is a comma-separated list of boolean expressions.
+ Evaluates to ``1`` if all conditions are ``1``.
+ Otherwise evaluates to ``0``.
+
+``$<OR:conditions>``
+ where ``conditions`` is a comma-separated list of boolean expressions.
+ Evaluates to ``1`` if at least one of the conditions is ``1``.
+ Otherwise evaluates to ``0``.
+
+``$<NOT:condition>``
+ ``0`` if ``condition`` is ``1``, else ``1``
+
+``$<IF:condition,true_value,false_value>``
+ ``true_value`` if ``condition`` is ``1``,
+ ``false_value`` if ``condition`` is ``0``
+
``$<STREQUAL:a,b>``
``1`` if ``a`` is STREQUAL ``b``, else ``0``
``$<EQUAL:a,b>``
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=53a5aec89998a58dff53946b47426ea692c5ad8d
commit 53a5aec89998a58dff53946b47426ea692c5ad8d
Author: R2RT <artur.ryt at gmail.com>
AuthorDate: Sun Nov 4 23:05:35 2018 +0100
Commit: Brad King <brad.king at kitware.com>
CommitDate: Mon Nov 5 08:31:09 2018 -0500
CMP0053: Fix double warning on uninitialized variables in -P mode
When `CMP0053` is not set to OLD or NEW then we compute both variants
in case we need to warn about a behavior change. Do not allow both
code paths to produce an uninitialized variable warning.
Fixes: #18552
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 83139ba..0d42fb0 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2766,7 +2766,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
} else {
varresult = value;
}
- } else if (!removeEmpty) {
+ } else if (!removeEmpty && !this->SuppressSideEffects) {
// check to see if we need to print a warning
// if strict mode is on and the variable has
// not been "cleared"/initialized with a set(foo ) call
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index b47abfb..ef48852 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -348,6 +348,10 @@ set(RunCMake_TEST_OPTIONS --trace-expand --warn-uninitialized)
run_cmake(trace-expand-warn-uninitialized)
unset(RunCMake_TEST_OPTIONS)
+set(RunCMake_TEST_OPTIONS --warn-uninitialized)
+run_cmake(warn-uninitialized)
+unset(RunCMake_TEST_OPTIONS)
+
set(RunCMake_TEST_OPTIONS --trace-source=trace-only-this-file.cmake)
run_cmake(trace-source)
unset(RunCMake_TEST_OPTIONS)
diff --git a/Tests/RunCMake/CommandLine/warn-uninitialized-stderr.txt b/Tests/RunCMake/CommandLine/warn-uninitialized-stderr.txt
new file mode 100644
index 0000000..a13402a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/warn-uninitialized-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Warning \(dev\) at warn-uninitialized.cmake:1 \(set\):
+ uninitialized variable 'WARN_FROM_NORMAL_CMAKE_FILE'
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/CommandLine/warn-uninitialized.cmake b/Tests/RunCMake/CommandLine/warn-uninitialized.cmake
new file mode 100644
index 0000000..f1a75c9
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/warn-uninitialized.cmake
@@ -0,0 +1 @@
+set(FOO "${WARN_FROM_NORMAL_CMAKE_FILE}")
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f92f93467ecc22419c981f8f5283c81fa9d8eb01
commit f92f93467ecc22419c981f8f5283c81fa9d8eb01
Author: R2RT <artur.ryt at gmail.com>
AuthorDate: Sun Nov 4 22:53:44 2018 +0100
Commit: Brad King <brad.king at kitware.com>
CommitDate: Mon Nov 5 08:29:10 2018 -0500
cmMakefile: Rename SuppressWatches to SuppressSideEffects
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 0a69d09..83139ba 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -67,7 +67,7 @@ cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused();
this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars();
- this->SuppressWatches = false;
+ this->SuppressSideEffects = false;
// Setup the default include complaint regular expression (match nothing).
this->ComplainFileRegularExpression = "^$";
@@ -2421,7 +2421,7 @@ const std::string* cmMakefile::GetDef(const std::string& name) const
}
#ifdef CMAKE_BUILD_WITH_CMAKE
cmVariableWatch* vv = this->GetVariableWatch();
- if (vv && !this->SuppressWatches) {
+ if (vv && !this->SuppressSideEffects) {
bool const watch_function_executed =
vv->VariableAccessed(name,
def ? cmVariableWatch::VARIABLE_READ_ACCESS
@@ -2508,11 +2508,11 @@ const std::string& cmMakefile::ExpandVariablesInString(
compareResults = true;
// Suppress variable watches to avoid calling hooks twice. Suppress new
// dereferences since the OLD behavior is still what is actually used.
- this->SuppressWatches = true;
+ this->SuppressSideEffects = true;
newError = ExpandVariablesInStringNew(
newErrorstr, newResult, escapeQuotes, noEscapes, atOnly, filename,
line, removeEmpty, replaceAt);
- this->SuppressWatches = false;
+ this->SuppressSideEffects = false;
CM_FALLTHROUGH;
}
case cmPolicies::OLD:
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index b30f281..d8176d9 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -1025,7 +1025,7 @@ private:
bool CheckCMP0000;
std::set<std::string> WarnedCMP0074;
bool IsSourceFileTryCompile;
- mutable bool SuppressWatches;
+ mutable bool SuppressSideEffects;
};
#endif
-----------------------------------------------------------------------
Summary of changes:
Help/manual/cmake-generator-expressions.7.rst | 406 +++++++++++++--------
Help/manual/cmake-modules.7.rst | 1 +
Help/module/FindSQLite3.rst | 1 +
Help/release/dev/FindSQLite3-module.rst | 4 +
Modules/FindSQLite3.cmake | 66 ++++
Source/cmAddSubDirectoryCommand.cxx | 6 +-
Source/cmArchiveWrite.cxx | 2 +-
Source/cmCTest.cxx | 4 +-
Source/cmCacheManager.cxx | 3 +-
Source/cmExtraEclipseCDT4Generator.cxx | 7 +-
Source/cmExtraKateGenerator.cxx | 3 +-
Source/cmFileCommand.cxx | 2 +-
Source/cmFindBase.cxx | 4 +-
Source/cmFindCommon.cxx | 4 +-
Source/cmFindPackageCommand.cxx | 10 +-
Source/cmGeneratorTarget.cxx | 5 +-
Source/cmGetFilenameComponentCommand.cxx | 10 +-
Source/cmGlobalGenerator.cxx | 2 +-
Source/cmGlobalNinjaGenerator.cxx | 2 +-
Source/cmGlobalXCodeGenerator.cxx | 2 +-
Source/cmListCommand.cxx | 8 +-
Source/cmLocalGenerator.cxx | 8 +-
Source/cmLocalVisualStudio7Generator.cxx | 2 +-
Source/cmMakefile.cxx | 10 +-
Source/cmMakefile.h | 2 +-
Source/cmMakefileTargetGenerator.cxx | 2 +-
Source/cmOrderDirectories.cxx | 2 +-
Source/cmOutputConverter.cxx | 6 +-
Source/cmOutputRequiredFilesCommand.cxx | 6 +-
Source/cmRST.cxx | 3 +-
Source/cmRulePlaceholderExpander.cxx | 4 +-
Source/cmSetCommand.cxx | 8 +-
Source/cmState.cxx | 8 +-
Source/cmStringCommand.cxx | 7 +-
Source/cmSystemTools.cxx | 4 +-
Source/cmTarget.cxx | 2 +-
Source/cmVisualStudioSlnParser.cxx | 6 +-
Source/cmake.cxx | 2 +-
Source/cmcldeps.cxx | 2 +-
Source/cmcmd.cxx | 24 +-
Tests/CMakeLists.txt | 4 +
Tests/{FindCURL => FindSQLite3}/CMakeLists.txt | 8 +-
Tests/FindSQLite3/Test/CMakeLists.txt | 16 +
Tests/FindSQLite3/Test/main.c | 10 +
Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 4 +
.../warn-uninitialized-stderr.txt} | 6 +-
.../RunCMake/CommandLine/warn-uninitialized.cmake | 1 +
47 files changed, 455 insertions(+), 254 deletions(-)
create mode 100644 Help/module/FindSQLite3.rst
create mode 100644 Help/release/dev/FindSQLite3-module.rst
create mode 100644 Modules/FindSQLite3.cmake
copy Tests/{FindCURL => FindSQLite3}/CMakeLists.txt (53%)
create mode 100644 Tests/FindSQLite3/Test/CMakeLists.txt
create mode 100644 Tests/FindSQLite3/Test/main.c
copy Tests/RunCMake/{include/EmptyString-stderr.txt => CommandLine/warn-uninitialized-stderr.txt} (51%)
create mode 100644 Tests/RunCMake/CommandLine/warn-uninitialized.cmake
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list