[Cmake-commits] CMake branch, master, updated. v3.14.1-592-g0dfb056
Kitware Robot
kwrobot at kitware.com
Thu Apr 4 11:33:04 EDT 2019
This is an automated email from 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 <brad.king at kitware.com>
AuthorDate: Thu Apr 4 15:31:48 2019 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
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 <kwrobot at kitware.com>
Merge-request: !3175
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7795b3f2bfe3dbab35a494ceee37745eaff110f4
commit 7795b3f2bfe3dbab35a494ceee37745eaff110f4
Merge: dc6b76d 30bb14c
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Apr 4 15:30:15 2019 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
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 <kwrobot at kitware.com>
Merge-request: !3184
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dc6b76d1e751224c60aba5489fb62228cd8a6bad
commit dc6b76d1e751224c60aba5489fb62228cd8a6bad
Merge: d1c2f87 18f7b2e
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Apr 4 15:29:22 2019 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
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 <kwrobot at kitware.com>
Merge-request: !3182
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d1c2f8787ceb0cb5e30d433e05f774bbdd910ef9
commit d1c2f8787ceb0cb5e30d433e05f774bbdd910ef9
Merge: a63a50c 8a2f62c
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Apr 4 15:28:41 2019 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
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 <kwrobot at kitware.com>
Merge-request: !3173
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a63a50c77af65092d82b9c3a6de3ea34c63605d4
commit a63a50c77af65092d82b9c3a6de3ea34c63605d4
Merge: 3d6d7c1 abbb8a7
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Apr 4 15:27:18 2019 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Apr 4 11:27:28 2019 -0400
Merge topic 'remove_duplicates'
abbb8a7b1d Genex: Add $<REMOVE_DUPLICATES:list>
11338389e5 Help: Fix description in cmake-generator-expressions(7) manual
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !3154
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8a2f62cc18ece0ebfed0ff6abf53d419d43d2fa1
commit 8a2f62cc18ece0ebfed0ff6abf53d419d43d2fa1
Author: Marc Chevrier <marc.chevrier at gmail.com>
AuthorDate: Mon Apr 1 11:19:54 2019 +0200
Commit: Marc Chevrier <marc.chevrier at gmail.com>
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 $<CONFIGURATION>
)
+
+ add_test(NAME FindPython.VirtualEnv COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --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 $<CONFIGURATION>
+ )
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 <sebholt at xwmw.org>
AuthorDate: Tue Apr 2 19:22:35 2019 +0200
Commit: Sebastian Holtermann <sebholt at xwmw.org>
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<MUFile>();
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<std::string> 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<std::string> 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 <sebholt at xwmw.org>
AuthorDate: Tue Apr 2 19:14:27 2019 +0200
Commit: Sebastian Holtermann <sebholt at xwmw.org>
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 <sebholt at xwmw.org>
AuthorDate: Tue Apr 2 19:11:19 2019 +0200
Commit: Sebastian Holtermann <sebholt at xwmw.org>
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<std::string>& baseOpts,
unsigned int const cmQtAutoGen::ParallelMax = 64;
std::string const cmQtAutoGen::ListSep = "<<<S>>>";
-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<std::string> 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<cmLocalGenerator*> 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<cmLocalGenerator*, std::string> GlobalAutoGenTargets_;
std::map<cmLocalGenerator*, std::string> GlobalAutoRccTargets_;
std::unordered_map<std::string, std::string> ExecutableTestOutputs_;
- std::unique_ptr<Keywords> Keywords_;
+ Keywords const Keywords_;
};
#endif
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5431395d68a44d42149fb93692636f4138ddf6ed
commit 5431395d68a44d42149fb93692636f4138ddf6ed
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Tue Apr 2 18:53:34 2019 +0200
Commit: Sebastian Holtermann <sebholt at xwmw.org>
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 <memory>
#include <utility>
+cmQtAutoGenGlobalInitializer::Keywords::Keywords()
+ : AUTOMOC("AUTOMOC")
+ , AUTOUIC("AUTOUIC")
+ , AUTORCC("AUTORCC")
+{
+}
+
cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer(
std::vector<cmLocalGenerator*> 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<cmLocalGenerator*> const& localGenerators);
~cmQtAutoGenGlobalInitializer();
+ Keywords const* kw() const { return Keywords_.get(); };
+
bool generate();
private:
@@ -48,6 +62,7 @@ private:
std::map<cmLocalGenerator*, std::string> GlobalAutoGenTargets_;
std::map<cmLocalGenerator*, std::string> GlobalAutoRccTargets_;
std::unordered_map<std::string, std::string> ExecutableTestOutputs_;
+ std::unique_ptr<Keywords> Keywords_;
};
#endif
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=78eccc7836e068652ea772ec65614bc446f23b14
commit 78eccc7836e068652ea772ec65614bc446f23b14
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Tue Apr 2 18:58:58 2019 +0200
Commit: Sebastian Holtermann <sebholt at xwmw.org>
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 <artur.ryt at gmail.com>
AuthorDate: Tue Apr 2 19:59:00 2019 +0200
Commit: Artur Ryt <artur.ryt at gmail.com>
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<std::string> 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<std::string> 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 << "<?xml version=\"1.0\" encoding=\"" << encoding << "\"?>";
+ this->Output << R"(<?xml version="1.0" encoding=")" << encoding << "\"?>";
}
void cmXMLWriter::EndDocument()
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=abbb8a7b1d40b98fb1841a76efb676eea7771cf0
commit abbb8a7b1d40b98fb1841a76efb676eea7771cf0
Author: Sebastian Lipponer <mail at sebastianlipponer.de>
AuthorDate: Mon Apr 1 21:47:12 2019 +0200
Commit: Sebastian Lipponer <mail at sebastianlipponer.de>
CommitDate: Mon Apr 1 21:52:17 2019 +0200
Genex: Add $<REMOVE_DUPLICATES:list>
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
``$<IN_LIST:string,list>``
``1`` if ``string`` is member of the semicolon-separated ``list``, else ``0``.
Uses case-sensitive comparisons.
+``$<REMOVE_DUPLICATES:list>``
+ Removes duplicated items in the given ``list``.
``$<VERSION_LESS:v1,v2>``
``1`` if ``v1`` is a version less than ``v2``, else ``0``.
``$<VERSION_GREATER:v1,v2>``
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<std::string>& parameters,
+ cmGeneratorExpressionContext* context,
+ const GeneratorExpressionContent* content,
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
+ {
+ if (parameters.size() != 1) {
+ reportError(
+ context, content->GetOriginalExpression(),
+ "$<REMOVE_DUPLICATES:...> expression requires one parameter");
+ }
+
+ std::vector<std::string> 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 "$<REMOVE_DUPLICATES:1>")
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 "$<REMOVE_DUPLICATES:1$<SEMICOLON>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 "$<REMOVE_DUPLICATES:2$<SEMICOLON>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 "$<REMOVE_DUPLICATES:2$<SEMICOLON>1$<SEMICOLON>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 "$<REMOVE_DUPLICATES:>")
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 <mail at sebastianlipponer.de>
AuthorDate: Mon Apr 1 21:45:21 2019 +0200
Commit: Sebastian Lipponer <mail at sebastianlipponer.de>
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
``$<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``.
+ ``1`` if ``string`` is member of the semicolon-separated ``list``, else ``0``.
Uses case-sensitive comparisons.
``$<VERSION_LESS:v1,v2>``
``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 <ruslan_baratov at yahoo.com>
AuthorDate: Thu Mar 28 22:43:40 2019 +0300
Commit: Ruslan Baratov <ruslan_baratov at yahoo.com>
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_<PROJECT-NAME>_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<std::string> 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
More information about the Cmake-commits
mailing list