summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.clang-tidy1
-rw-r--r--Help/generator/Green Hills MULTI.rst3
-rw-r--r--Help/manual/cmake-generator-expressions.7.rst25
-rw-r--r--Help/prop_tgt/RESOURCE.rst2
-rw-r--r--Help/release/dev/genex-TARGET_OUTPUT_NAME.rst7
-rw-r--r--Help/release/dev/genex_filter.rst6
-rw-r--r--Help/release/dev/remove_duplicates.rst6
-rw-r--r--Modules/CMakeParseImplicitIncludeInfo.cmake8
-rw-r--r--Modules/Platform/GHS-MULTI-Determine.cmake (renamed from Modules/Platform/GHS-MULTI-Initialize.cmake)23
-rw-r--r--Source/CMakeLists.txt4
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/cmCPackFreeBSDGenerator.cxx2
-rw-r--r--Source/QtDialog/CMakeSetup.cxx3
-rw-r--r--Source/cmCoreTryCompile.cxx5
-rw-r--r--Source/cmGeneratorExpressionNode.cxx211
-rw-r--r--Source/cmGeneratorTarget.cxx25
-rw-r--r--Source/cmGeneratorTarget.h3
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx124
-rw-r--r--Source/cmGlobalGhsMultiGenerator.h1
-rw-r--r--Source/cmQtAutoGen.cxx118
-rw-r--r--Source/cmQtAutoGen.h53
-rw-r--r--Source/cmQtAutoGenInitializer.cxx90
-rw-r--r--Source/cmQtAutoGenInitializer.h4
-rw-r--r--Source/cmQtAutoGenerator.cxx265
-rw-r--r--Source/cmQtAutoGenerator.h51
-rw-r--r--Source/cmQtAutoGeneratorMocUic.cxx50
-rw-r--r--Source/cmQtAutoGeneratorMocUic.h17
-rw-r--r--Source/cmQtAutoGeneratorRcc.cxx666
-rw-r--r--Source/cmQtAutoRcc.cxx516
-rw-r--r--Source/cmQtAutoRcc.h (renamed from Source/cmQtAutoGeneratorRcc.h)71
-rw-r--r--Source/cmRST.cxx6
-rw-r--r--Source/cmSourceGroupCommand.cxx1
-rw-r--r--Source/cmcmd.cxx4
-rw-r--r--Tests/CMakeLib/testRST.expect4
-rw-r--r--Tests/CMakeLib/testRST.rst4
-rw-r--r--Tests/RunCMake/GeneratorExpression/FILTER-Exclude-check.cmake6
-rw-r--r--Tests/RunCMake/GeneratorExpression/FILTER-Exclude.cmake4
-rw-r--r--Tests/RunCMake/GeneratorExpression/FILTER-Include-check.cmake6
-rw-r--r--Tests/RunCMake/GeneratorExpression/FILTER-Include.cmake4
-rw-r--r--Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-stderr.txt8
-rw-r--r--Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator.cmake3
-rw-r--r--Tests/RunCMake/GeneratorExpression/FILTER-empty-check.cmake6
-rw-r--r--Tests/RunCMake/GeneratorExpression/FILTER-empty.cmake3
-rw-r--r--Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt8
-rw-r--r--Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME.cmake2
-rw-r--r--Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-stderr.txt8
-rw-r--r--Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME.cmake9
-rw-r--r--Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt9
-rw-r--r--Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME.cmake9
-rw-r--r--Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion-stderr.txt8
-rw-r--r--Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion.cmake3
-rw-r--r--Tests/RunCMake/GeneratorExpression/ResultValidator.cmake6
-rw-r--r--Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake12
-rw-r--r--Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-stderr.txt6
-rw-r--r--Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake9
-rw-r--r--Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-check.cmake2
-rw-r--r--Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target-check.cmake2
-rw-r--r--Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target.cmake79
-rw-r--r--Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-stderr.txt6
-rw-r--r--Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake9
-rw-r--r--Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME.cmake96
-rw-r--r--Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME-check.cmake7
-rw-r--r--Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME.cmake16
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake9
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-CXX-XLClang-16.1.0.1.output2
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Cray-8.7.output2
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-GNU-7.3.0.output2
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Intel-18.0.2.20180210.output2
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-CXX-AppleClang-8.0.0.8000042.output2
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-CXX-Clang-3.3.0.output2
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-empty.input (renamed from Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-C.input)0
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-empty.output (renamed from Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-CXX.output)0
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-relative.input21
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-relative.output1
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-empty.input (renamed from Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-CXX.input)0
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-empty.output (renamed from Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-C.output)0
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-relative.input21
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-relative.output1
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CUDA-NVIDIA-9.2.148.output2
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-GNU-7.3.0.output2
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-Intel-18.0.0.20170811.output2
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-PGI-18.10.1.output2
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-12.1.0.output2
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-16.1.0.0.output2
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-CXX-PGI-18.10.1.output2
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-CXX-GNU-4.9.3.output2
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-CXX-GNU-4.8.5.output2
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-CXX-Clang-5.0.1.output2
-rw-r--r--Utilities/Release/win32_release.cmake1
-rw-r--r--Utilities/Release/win64_release.cmake1
96 files changed, 1686 insertions, 1134 deletions
diff --git a/.clang-tidy b/.clang-tidy
index b87ca4b..bfcb67c 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -18,7 +18,6 @@ modernize-*,\
-modernize-use-using,\
performance-*,\
-performance-inefficient-string-concatenation,\
--performance-inefficient-vector-operation,\
readability-*,\
-readability-function-size,\
-readability-identifier-naming,\
diff --git a/Help/generator/Green Hills MULTI.rst b/Help/generator/Green Hills MULTI.rst
index 6626770..dffc679 100644
--- a/Help/generator/Green Hills MULTI.rst
+++ b/Help/generator/Green Hills MULTI.rst
@@ -41,11 +41,12 @@ Cache variables that are used for toolset and target system customization:
| Root path for RTOS searches.
| Defaults to ``C:/ghs`` in Windows or ``/usr/ghs`` in Linux.
-* ``GHS_OS_DIR``
+* ``GHS_OS_DIR`` and ``GHS_OS_DIR_OPTION``
| Sets ``-os_dir`` entry in project file.
| Defaults to latest platform OS installation at ``GHS_OS_ROOT``. Set this value if
a specific RTOS is to be used.
+ | ``GHS_OS_DIR_OPTION`` default value is ``-os_dir``.
* ``GHS_BSP_NAME``
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index f93de53..e3a96bd 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -88,8 +88,6 @@ 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>``
@@ -293,6 +291,10 @@ String Transformations
``$<JOIN:list,string>``
Joins the list with the content of ``string``.
+``$<REMOVE_DUPLICATES:list>``
+ Removes duplicated items in the given ``list``.
+``$<FILTER:list,INCLUDE|EXCLUDE,regex>``
+ Includes or removes items from ``list`` that match the regular expression ``regex``.
``$<LOWER_CASE:string>``
Content of ``string`` converted to lower case.
``$<UPPER_CASE:string>``
@@ -385,12 +387,22 @@ Target-Dependent Queries
``$<TARGET_NAME_IF_EXISTS:tgt>``
Expands to the ``tgt`` if the given target exists, an empty string
otherwise.
+``$<TARGET_OUTPUT_NAME:tgt>``
+ Base name of main file where ``tgt`` is the name of a target.
+
+ Note that ``tgt`` is not added as a dependency of the target this
+ expression is evaluated on.
``$<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>``
Name of main file (.exe, .so.1.2, .a).
``$<TARGET_FILE_DIR:tgt>``
Directory of main file (.exe, .so.1.2, .a).
+``$<TARGET_LINKER_OUTPUT_NAME:tgt>``
+ Base name of file used to link where ``tgt`` is the name of a target.
+
+ Note that ``tgt`` is not added as a dependency of the target this
+ expression is evaluated on.
``$<TARGET_LINKER_FILE:tgt>``
File used to link (.a, .lib, .so) where ``tgt`` is the name of a target.
``$<TARGET_LINKER_FILE_NAME:tgt>``
@@ -403,6 +415,15 @@ Target-Dependent Queries
Name of file with soname (.so.3).
``$<TARGET_SONAME_FILE_DIR:tgt>``
Directory of with soname (.so.3).
+``$<TARGET_PDB_OUTPUT_NAME:tgt>``
+ Base name of the linker generated program database file (.pdb)
+ where ``tgt`` is the name of a target.
+
+ See also the :prop_tgt:`PDB_NAME` target property and its configuration
+ specific variant :prop_tgt:`PDB_NAME_<CONFIG>`.
+
+ Note that ``tgt`` is not added as a dependency of the target this
+ expression is evaluated on.
``$<TARGET_PDB_FILE:tgt>``
Full path to the linker generated program database file (.pdb)
where ``tgt`` is the name of a target.
diff --git a/Help/prop_tgt/RESOURCE.rst b/Help/prop_tgt/RESOURCE.rst
index 6ada637..e5a1cb6 100644
--- a/Help/prop_tgt/RESOURCE.rst
+++ b/Help/prop_tgt/RESOURCE.rst
@@ -11,7 +11,7 @@ directory (eg. ``Resources`` directory for macOS) inside the bundle.
On non-Apple platforms these files may be installed using the ``RESOURCE``
option to the :command:`install(TARGETS)` command.
-Following example of Application Bundle::
+Following example of Application Bundle:
.. code-block:: cmake
diff --git a/Help/release/dev/genex-TARGET_OUTPUT_NAME.rst b/Help/release/dev/genex-TARGET_OUTPUT_NAME.rst
new file mode 100644
index 0000000..e3ffe57
--- /dev/null
+++ b/Help/release/dev/genex-TARGET_OUTPUT_NAME.rst
@@ -0,0 +1,7 @@
+genex-TARGET_OUTPUT_NAME
+------------------------
+
+* New ``$<TARGET_OUTPUT_NAME:...>``, ``$<TARGET_LINKER_OUTPUT_NAME:...>`` and
+ ``$<TARGET_PDB_OUTPUT_NAME:...>``
+ :manual:`generator expressions <cmake-generator-expressions(7)>` have been
+ added to retrieve the base name of various artifacts.
diff --git a/Help/release/dev/genex_filter.rst b/Help/release/dev/genex_filter.rst
new file mode 100644
index 0000000..ad23134
--- /dev/null
+++ b/Help/release/dev/genex_filter.rst
@@ -0,0 +1,6 @@
+genex_filter
+------------
+
+* A new ``$<FILTER:list,INCLUDE|EXCLUDE,regex>``
+ :manual:`generator expression <cmake-generator-expressions(7)>`
+ has been added.
diff --git a/Help/release/dev/remove_duplicates.rst b/Help/release/dev/remove_duplicates.rst
new file mode 100644
index 0000000..f6a7fff
--- /dev/null
+++ b/Help/release/dev/remove_duplicates.rst
@@ -0,0 +1,6 @@
+remove_duplicates
+-----------------
+
+* A new ``$<REMOVE_DUPLICATES:list>``
+ :manual:`generator expression <cmake-generator-expressions(7)>`
+ has been added.
diff --git a/Modules/CMakeParseImplicitIncludeInfo.cmake b/Modules/CMakeParseImplicitIncludeInfo.cmake
index 977debb..176b3ff 100644
--- a/Modules/CMakeParseImplicitIncludeInfo.cmake
+++ b/Modules/CMakeParseImplicitIncludeInfo.cmake
@@ -218,6 +218,14 @@ function(cmake_parse_implicit_include_info text lang dir_var log_var state_var)
get_filename_component(dir "${d}" ABSOLUTE)
list(APPEND implicit_dirs "${dir}")
string(APPEND log " collapse include dir [${d}] ==> [${dir}]\n")
+ elseif("${d}" MATCHES [[^\.\.[\/]\.\.[\/](.*)$]])
+ # This relative path is deep enough to get out of the CMakeFiles/CMakeTmp
+ # directory where the ABI check is done. Assume that the compiler has
+ # computed this path adaptively based on the current working directory
+ # such that the effective result is absolute.
+ get_filename_component(dir "${CMAKE_BINARY_DIR}/${CMAKE_MATCH_1}" ABSOLUTE)
+ list(APPEND implicit_dirs "${dir}")
+ string(APPEND log " collapse relative include dir [${d}] ==> [${dir}]\n")
else()
string(APPEND log " skipping relative include dir [${d}]\n")
endif()
diff --git a/Modules/Platform/GHS-MULTI-Initialize.cmake b/Modules/Platform/GHS-MULTI-Determine.cmake
index db65d14..349d906 100644
--- a/Modules/Platform/GHS-MULTI-Initialize.cmake
+++ b/Modules/Platform/GHS-MULTI-Determine.cmake
@@ -13,39 +13,40 @@ mark_as_advanced(GHS_OS_ROOT)
set(GHS_OS_DIR "NOTFOUND" CACHE PATH "GHS platform OS directory")
mark_as_advanced(GHS_OS_DIR)
-set(GHS_OS_DIR_OPTION "-os_dir " CACHE STRING "GHS compiler os option")
-mark_as_advanced(GHS_OS_DIR)
+set(GHS_OS_DIR_OPTION "-os_dir " CACHE STRING "GHS compiler OS option")
+mark_as_advanced(GHS_OS_DIR_OPTION)
#set GHS_OS_DIR if not set by user
-if ( NOT GHS_OS_DIR )
- if (EXISTS ${GHS_OS_ROOT})
+if(NOT GHS_OS_DIR)
+ if(EXISTS ${GHS_OS_ROOT})
#get all directories in root directory
FILE(GLOB GHS_CANDIDATE_OS_DIRS
LIST_DIRECTORIES true RELATIVE ${GHS_OS_ROOT} ${GHS_OS_ROOT}/*)
FILE(GLOB GHS_CANDIDATE_OS_FILES
LIST_DIRECTORIES false RELATIVE ${GHS_OS_ROOT} ${GHS_OS_ROOT}/*)
- if ( GHS_CANDIDATE_OS_FILES )
+ if(GHS_CANDIDATE_OS_FILES)
list(REMOVE_ITEM GHS_CANDIDATE_OS_DIRS ${GHS_CANDIDATE_OS_FILES})
endif ()
#filter based on platform name
- if (GHS_TARGET_PLATFORM MATCHES "integrity")
- list(FILTER GHS_CANDIDATE_OS_DIRS INCLUDE REGEX "int[0-9][0-9][0-9][0-9a-z].*")
+ if(GHS_TARGET_PLATFORM MATCHES "integrity")
+ list(FILTER GHS_CANDIDATE_OS_DIRS INCLUDE REGEX "int[0-9][0-9][0-9][0-9a-z]")
else() #fall-back for standalone
unset(GHS_CANDIDATE_OS_DIRS)
set(GHS_OS_DIR "IGNORE")
- endif ()
+ endif()
- if (GHS_CANDIDATE_OS_DIRS)
+ if(GHS_CANDIDATE_OS_DIRS)
list(SORT GHS_CANDIDATE_OS_DIRS)
list(GET GHS_CANDIDATE_OS_DIRS -1 GHS_OS_DIR)
string(CONCAT GHS_OS_DIR ${GHS_OS_ROOT} "/" ${GHS_OS_DIR})
endif()
+ #update cache with new value
set(GHS_OS_DIR "${GHS_OS_DIR}" CACHE PATH "GHS platform OS directory" FORCE)
- endif ()
-endif ()
+ endif()
+endif()
set(GHS_BSP_NAME "IGNORE" CACHE STRING "BSP name")
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 0e1cc20..924d997 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -352,8 +352,8 @@ set(SRCS
cmQtAutoGenInitializer.h
cmQtAutoGeneratorMocUic.cxx
cmQtAutoGeneratorMocUic.h
- cmQtAutoGeneratorRcc.cxx
- cmQtAutoGeneratorRcc.h
+ cmQtAutoRcc.cxx
+ cmQtAutoRcc.h
cmRST.cxx
cmRST.h
cmScriptGenerator.h
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 3ba392e..4951c02 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 14)
-set(CMake_VERSION_PATCH 20190404)
+set(CMake_VERSION_PATCH 20190409)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/cmCPackFreeBSDGenerator.cxx b/Source/CPack/cmCPackFreeBSDGenerator.cxx
index dd8127d..9fdafa4 100644
--- a/Source/CPack/cmCPackFreeBSDGenerator.cxx
+++ b/Source/CPack/cmCPackFreeBSDGenerator.cxx
@@ -181,7 +181,7 @@ public:
{
s << "{\n";
for (std::string const& elem : value) {
- s << " \"" << elem << "\": {\"origin\": \"" << elem << "\"},\n";
+ s << " \"" << elem << R"(": {"origin": ")" << elem << "\"},\n";
}
s << '}';
}
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index cd30ad5..8d9a50c 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -48,6 +48,9 @@ Q_IMPORT_PLUGIN(QXcbIntegrationPlugin);
#if defined(USE_QWindowsIntegrationPlugin)
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
+# if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
+Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin);
+# endif
#endif
int main(int argc, char** argv)
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index ffc41ba..dcb1ff5 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -60,7 +60,8 @@ static std::string const kCMAKE_WARN_DEPRECATED = "CMAKE_WARN_DEPRECATED";
/* GHS Multi platform variables */
static std::set<std::string> ghs_platform_vars{
"GHS_TARGET_PLATFORM", "GHS_PRIMARY_TARGET", "GHS_TOOLSET_ROOT",
- "GHS_OS_ROOT", "GHS_OS_DIR", "GHS_BSP_NAME"
+ "GHS_OS_ROOT", "GHS_OS_DIR", "GHS_BSP_NAME",
+ "GHS_OS_DIR_OPTION"
};
static void writeProperty(FILE* fout, std::string const& targetName,
@@ -896,7 +897,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
// Forward the GHS variables to the inner project cache.
for (std::string const& var : ghs_platform_vars) {
if (const char* val = this->Makefile->GetDefinition(var)) {
- std::string flag = "-D" + var + "=" + val;
+ std::string flag = "-D" + var + "=" + "'" + val + "'";
cmakeFlags.push_back(std::move(flag));
}
}
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 19d2b3a..d8e1c42 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -28,6 +28,7 @@
#include <algorithm>
#include <assert.h>
#include <errno.h>
+#include <iterator>
#include <map>
#include <memory> // IWYU pragma: keep
#include <set>
@@ -327,6 +328,51 @@ static const struct InListNode : public cmGeneratorExpressionNode
}
} inListNode;
+static const struct FilterNode : public cmGeneratorExpressionNode
+{
+ FilterNode() {} // NOLINT(modernize-use-equals-default)
+
+ int NumExpectedParameters() const override { return 3; }
+
+ std::string Evaluate(
+ const std::vector<std::string>& parameters,
+ cmGeneratorExpressionContext* context,
+ const GeneratorExpressionContent* content,
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
+ {
+ if (parameters.size() != 3) {
+ reportError(context, content->GetOriginalExpression(),
+ "$<FILTER:...> expression requires three parameters");
+ return {};
+ }
+
+ if (parameters[1] != "INCLUDE" && parameters[1] != "EXCLUDE") {
+ reportError(
+ context, content->GetOriginalExpression(),
+ "$<FILTER:...> second parameter must be either INCLUDE or EXCLUDE");
+ return {};
+ }
+
+ const bool exclude = parameters[1] == "EXCLUDE";
+
+ cmsys::RegularExpression re;
+ if (!re.compile(parameters[2])) {
+ reportError(context, content->GetOriginalExpression(),
+ "$<FILTER:...> failed to compile regex");
+ return {};
+ }
+
+ std::vector<std::string> values, result;
+ cmSystemTools::ExpandListArgument(parameters.front(), values, true);
+
+ std::copy_if(values.cbegin(), values.cend(), std::back_inserter(result),
+ [&re, exclude](std::string const& input) {
+ return exclude ^ re.find(input);
+ });
+ return cmJoin(cmMakeRange(result.cbegin(), result.cend()), ";");
+ }
+} filterNode;
+
static const struct RemoveDuplicatesNode : public cmGeneratorExpressionNode
{
RemoveDuplicatesNode() {} // NOLINT(modernize-use-equals-default)
@@ -2023,18 +2069,16 @@ struct TargetFilesystemArtifactResultGetter<ArtifactPathTag>
static std::string Get(const std::string& result) { return result; }
};
-template <typename ArtifactT, typename ComponentT>
-struct TargetFilesystemArtifact : public cmGeneratorExpressionNode
+struct TargetArtifactBase : public cmGeneratorExpressionNode
{
- TargetFilesystemArtifact() {} // NOLINT(modernize-use-equals-default)
-
- int NumExpectedParameters() const override { return 1; }
+ TargetArtifactBase() {} // NOLINT(modernize-use-equals-default)
- std::string Evaluate(
+protected:
+ cmGeneratorTarget* GetTarget(
const std::vector<std::string>& parameters,
cmGeneratorExpressionContext* context,
const GeneratorExpressionContent* content,
- cmGeneratorExpressionDAGChecker* dagChecker) const override
+ cmGeneratorExpressionDAGChecker* dagChecker) const
{
// Lookup the referenced target.
std::string name = parameters.front();
@@ -2042,20 +2086,20 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode
if (!cmGeneratorExpression::IsValidTargetName(name)) {
::reportError(context, content->GetOriginalExpression(),
"Expression syntax not recognized.");
- return std::string();
+ return nullptr;
}
cmGeneratorTarget* target = context->LG->FindGeneratorTargetToUse(name);
if (!target) {
::reportError(context, content->GetOriginalExpression(),
"No target \"" + name + "\"");
- return std::string();
+ return nullptr;
}
if (target->GetType() >= cmStateEnums::OBJECT_LIBRARY &&
target->GetType() != cmStateEnums::UNKNOWN_LIBRARY) {
::reportError(context, content->GetOriginalExpression(),
"Target \"" + name +
"\" is not an executable or library.");
- return std::string();
+ return nullptr;
}
if (dagChecker &&
(dagChecker->EvaluatingLinkLibraries(target) ||
@@ -2064,6 +2108,29 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode
::reportError(context, content->GetOriginalExpression(),
"Expressions which require the linker language may not "
"be used while evaluating link libraries");
+ return nullptr;
+ }
+
+ return target;
+ }
+};
+
+template <typename ArtifactT, typename ComponentT>
+struct TargetFilesystemArtifact : public TargetArtifactBase
+{
+ TargetFilesystemArtifact() {} // 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
+ {
+ cmGeneratorTarget* target =
+ this->GetTarget(parameters, context, content, dagChecker);
+ if (!target) {
return std::string();
}
context->DependTargets.insert(target);
@@ -2110,6 +2177,126 @@ static const TargetFilesystemArtifact<ArtifactBundleContentDirTag,
ArtifactPathTag>
targetBundleContentDirNode;
+//
+// To retrieve base name for various artifacts
+//
+template <typename ArtifactT>
+struct TargetOutputNameArtifactResultGetter
+{
+ static std::string Get(cmGeneratorTarget* target,
+ cmGeneratorExpressionContext* context,
+ const GeneratorExpressionContent* content);
+};
+
+template <>
+struct TargetOutputNameArtifactResultGetter<ArtifactNameTag>
+{
+ static std::string Get(cmGeneratorTarget* target,
+ cmGeneratorExpressionContext* context,
+ const GeneratorExpressionContent* /*unused*/)
+ {
+ return target->GetOutputName(context->Config,
+ cmStateEnums::RuntimeBinaryArtifact);
+ }
+};
+
+template <>
+struct TargetOutputNameArtifactResultGetter<ArtifactLinkerTag>
+{
+ static std::string Get(cmGeneratorTarget* target,
+ cmGeneratorExpressionContext* context,
+ const GeneratorExpressionContent* content)
+ {
+ // The file used to link to the target (.so, .lib, .a).
+ if (!target->IsLinkable()) {
+ ::reportError(context, content->GetOriginalExpression(),
+ "TARGET_LINKER_OUTPUT_NAME is allowed only for libraries "
+ "and executables with ENABLE_EXPORTS.");
+ return std::string();
+ }
+ cmStateEnums::ArtifactType artifact =
+ target->HasImportLibrary(context->Config)
+ ? cmStateEnums::ImportLibraryArtifact
+ : cmStateEnums::RuntimeBinaryArtifact;
+ return target->GetOutputName(context->Config, artifact);
+ }
+};
+
+template <>
+struct TargetOutputNameArtifactResultGetter<ArtifactPdbTag>
+{
+ static std::string Get(cmGeneratorTarget* target,
+ cmGeneratorExpressionContext* context,
+ const GeneratorExpressionContent* content)
+ {
+ if (target->IsImported()) {
+ ::reportError(
+ context, content->GetOriginalExpression(),
+ "TARGET_PDB_OUTPUT_NAME not allowed for IMPORTED targets.");
+ return std::string();
+ }
+
+ std::string language = target->GetLinkerLanguage(context->Config);
+
+ std::string pdbSupportVar = "CMAKE_" + language + "_LINKER_SUPPORTS_PDB";
+
+ if (!context->LG->GetMakefile()->IsOn(pdbSupportVar)) {
+ ::reportError(
+ context, content->GetOriginalExpression(),
+ "TARGET_PDB_OUTPUT_NAME is not supported by the target linker.");
+ return std::string();
+ }
+
+ cmStateEnums::TargetType targetType = target->GetType();
+
+ if (targetType != cmStateEnums::SHARED_LIBRARY &&
+ targetType != cmStateEnums::MODULE_LIBRARY &&
+ targetType != cmStateEnums::EXECUTABLE) {
+ ::reportError(context, content->GetOriginalExpression(),
+ "TARGET_PDB_OUTPUT_NAME is allowed only for "
+ "targets with linker created artifacts.");
+ return std::string();
+ }
+
+ return target->GetPDBOutputName(context->Config);
+ }
+};
+
+template <typename ArtifactT>
+struct TargetOutputNameArtifact : public TargetArtifactBase
+{
+ TargetOutputNameArtifact() {} // 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
+ {
+ cmGeneratorTarget* target =
+ this->GetTarget(parameters, context, content, dagChecker);
+ if (!target) {
+ return std::string();
+ }
+
+ std::string result = TargetOutputNameArtifactResultGetter<ArtifactT>::Get(
+ target, context, content);
+ if (context->HadError) {
+ return std::string();
+ }
+ return result;
+ }
+};
+
+static const TargetOutputNameArtifact<ArtifactNameTag> targetOutputNameNode;
+
+static const TargetOutputNameArtifact<ArtifactLinkerTag>
+ targetLinkerOutputNameNode;
+
+static const TargetOutputNameArtifact<ArtifactPdbTag> targetPdbOutputNameNode;
+
static const struct ShellPathNode : public cmGeneratorExpressionNode
{
ShellPathNode() {} // NOLINT(modernize-use-equals-default)
@@ -2184,9 +2371,13 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode(
{ "TARGET_PDB_FILE_DIR", &targetPdbNodeGroup.FileDir },
{ "TARGET_BUNDLE_DIR", &targetBundleDirNode },
{ "TARGET_BUNDLE_CONTENT_DIR", &targetBundleContentDirNode },
+ { "TARGET_OUTPUT_NAME", &targetOutputNameNode },
+ { "TARGET_LINKER_OUTPUT_NAME", &targetLinkerOutputNameNode },
+ { "TARGET_PDB_OUTPUT_NAME", &targetPdbOutputNameNode },
{ "STREQUAL", &strEqualNode },
{ "EQUAL", &equalNode },
{ "IN_LIST", &inListNode },
+ { "FILTER", &filterNode },
{ "REMOVE_DUPLICATES", &removeDuplicatesNode },
{ "LOWER_CASE", &lowerCaseNode },
{ "UPPER_CASE", &upperCaseNode },
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 23b5bcb..f8c16cc 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3884,6 +3884,31 @@ std::string cmGeneratorTarget::GetLinkerLanguage(
return this->GetLinkClosure(config)->LinkerLanguage;
}
+std::string cmGeneratorTarget::GetPDBOutputName(
+ const std::string& config) const
+{
+ std::string base =
+ this->GetOutputName(config, cmStateEnums::RuntimeBinaryArtifact);
+
+ std::vector<std::string> props;
+ std::string configUpper = cmSystemTools::UpperCase(config);
+ if (!configUpper.empty()) {
+ // PDB_NAME_<CONFIG>
+ props.push_back("PDB_NAME_" + configUpper);
+ }
+
+ // PDB_NAME
+ props.emplace_back("PDB_NAME");
+
+ for (std::string const& p : props) {
+ if (const char* outName = this->GetProperty(p)) {
+ base = outName;
+ break;
+ }
+ }
+ return base;
+}
+
std::string cmGeneratorTarget::GetPDBName(const std::string& config) const
{
std::string prefix;
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 3f2025e..065b457 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -503,6 +503,9 @@ public:
OutputInfo const* GetOutputInfo(const std::string& config) const;
+ // Get the target PDB base name.
+ std::string GetPDBOutputName(const std::string& config) const;
+
/** Get the name of the pdb file for the target. */
std::string GetPDBName(const std::string& config = "") const;
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index e6a1d78..9f361f6 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -119,10 +119,11 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p,
cmMakefile* mf)
{
+ std::string arch;
if (p.empty()) {
cmSystemTools::Message(
"Green Hills MULTI: -A <arch> not specified; defaulting to \"arm\"");
- std::string arch = "arm";
+ arch = "arm";
/* store the platform name for later use
* -- already done if -A<arch> was specified
@@ -130,19 +131,51 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p,
mf->AddCacheDefinition("CMAKE_GENERATOR_PLATFORM", arch.c_str(),
"Name of generator platform.",
cmStateEnums::INTERNAL);
+ } else {
+ arch = p;
}
- const char* tgtPlatform = mf->GetDefinition("GHS_TARGET_PLATFORM");
- if (tgtPlatform == nullptr) {
- cmSystemTools::Message("Green Hills MULTI: GHS_TARGET_PLATFORM not "
- "specified; defaulting to \"integrity\"");
- tgtPlatform = "integrity";
+ /* check if OS location has been updated by platform scripts */
+ std::string platform = mf->GetSafeDefinition("GHS_TARGET_PLATFORM");
+ std::string osdir = mf->GetSafeDefinition("GHS_OS_DIR");
+ if (cmSystemTools::IsOff(osdir.c_str()) &&
+ platform.find("integrity") != std::string::npos) {
+ if (!this->CMakeInstance->GetIsInTryCompile()) {
+ /* required OS location is not found */
+ std::string m =
+ "Green Hills MULTI: GHS_OS_DIR not specified; No OS found in \"";
+ m += mf->GetSafeDefinition("GHS_OS_ROOT");
+ m += "\"";
+ cmSystemTools::Message(m);
+ }
+ osdir = "GHS_OS_DIR-NOT-SPECIFIED";
+ } else if (!this->CMakeInstance->GetIsInTryCompile() &&
+ cmSystemTools::IsOff(this->OsDir) &&
+ !cmSystemTools::IsOff(osdir)) {
+ /* OS location was updated by auto-selection */
+ std::string m = "Green Hills MULTI: GHS_OS_DIR not specified; found \"";
+ m += osdir;
+ m += "\"";
+ cmSystemTools::Message(m);
}
+ this->OsDir = osdir;
- /* store the platform name for later use */
- mf->AddCacheDefinition("GHS_TARGET_PLATFORM", tgtPlatform,
- "Name of GHS target platform.",
- cmStateEnums::INTERNAL);
+ // Determine GHS_BSP_NAME
+ std::string bspName = mf->GetSafeDefinition("GHS_BSP_NAME");
+
+ if (cmSystemTools::IsOff(bspName.c_str()) &&
+ platform.find("integrity") != std::string::npos) {
+ bspName = "sim" + arch;
+ /* write back the calculate name for next time */
+ mf->AddCacheDefinition("GHS_BSP_NAME", bspName.c_str(),
+ "Name of GHS target platform.",
+ cmStateEnums::STRING, true);
+ std::string m =
+ "Green Hills MULTI: GHS_BSP_NAME not specified; defaulting to \"";
+ m += bspName;
+ m += "\"";
+ cmSystemTools::Message(m);
+ }
return true;
}
@@ -153,6 +186,21 @@ void cmGlobalGhsMultiGenerator::EnableLanguage(
mf->AddDefinition("CMAKE_SYSTEM_NAME", "GHS-MULTI");
mf->AddDefinition("GHSMULTI", "1"); // identifier for user CMake files
+
+ const char* tgtPlatform = mf->GetDefinition("GHS_TARGET_PLATFORM");
+ if (!tgtPlatform) {
+ cmSystemTools::Message("Green Hills MULTI: GHS_TARGET_PLATFORM not "
+ "specified; defaulting to \"integrity\"");
+ tgtPlatform = "integrity";
+ }
+
+ /* store the platform name for later use */
+ mf->AddCacheDefinition("GHS_TARGET_PLATFORM", tgtPlatform,
+ "Name of GHS target platform.", cmStateEnums::STRING);
+
+ /* store original OS location */
+ this->OsDir = mf->GetSafeDefinition("GHS_OS_DIR");
+
this->cmGlobalGenerator::EnableLanguage(l, mf, optional);
}
@@ -230,53 +278,25 @@ void cmGlobalGhsMultiGenerator::WriteTopLevelProject(
fout << "# Top Level Project File" << std::endl;
// Specify BSP option if supplied by user
- // -- not all platforms require this entry in the project file
- // integrity platforms require this field; use default if needed
- std::string platform;
- if (const char* p =
- this->GetCMakeInstance()->GetCacheDefinition("GHS_TARGET_PLATFORM")) {
- platform = p;
- }
-
- std::string bspName;
- if (char const* bspCache =
- this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME")) {
- bspName = bspCache;
- this->GetCMakeInstance()->MarkCliAsUsed("GHS_BSP_NAME");
- } else {
- bspName = "IGNORE";
- }
-
- if (platform.find("integrity") != std::string::npos &&
- cmSystemTools::IsOff(bspName.c_str())) {
- const char* a =
- this->GetCMakeInstance()->GetCacheDefinition("CMAKE_GENERATOR_PLATFORM");
- bspName = "sim";
- bspName += (a ? a : "");
- }
-
- if (!cmSystemTools::IsOff(bspName.c_str())) {
+ const char* bspName =
+ this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME");
+ if (!cmSystemTools::IsOff(bspName)) {
fout << " -bsp " << bspName << std::endl;
}
// Specify OS DIR if supplied by user
// -- not all platforms require this entry in the project file
- std::string osDir;
- std::string osDirOption;
- if (char const* osDirCache =
- this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR")) {
- osDir = osDirCache;
- }
-
- if (char const* osDirOptionCache =
- this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR_OPTION")) {
- osDirOption = osDirOptionCache;
- }
-
- if (!cmSystemTools::IsOff(osDir.c_str()) ||
- platform.find("integrity") != std::string::npos) {
- std::replace(osDir.begin(), osDir.end(), '\\', '/');
- fout << " " << osDirOption << "\"" << osDir << "\"" << std::endl;
+ if (!cmSystemTools::IsOff(this->OsDir.c_str())) {
+ const char* osDirOption =
+ this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR_OPTION");
+ std::replace(this->OsDir.begin(), this->OsDir.end(), '\\', '/');
+ fout << " ";
+ if (cmSystemTools::IsOff(osDirOption)) {
+ fout << "";
+ } else {
+ fout << osDirOption;
+ }
+ fout << "\"" << this->OsDir << "\"" << std::endl;
}
WriteSubProjects(fout, root, generators);
diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h
index ae27806..1aeb1dc 100644
--- a/Source/cmGlobalGhsMultiGenerator.h
+++ b/Source/cmGlobalGhsMultiGenerator.h
@@ -120,6 +120,7 @@ private:
std::string trimQuotes(std::string const& str);
+ std::string OsDir;
static const char* DEFAULT_BUILD_PROGRAM;
static const char* DEFAULT_TOOLSET_ROOT;
};
diff --git a/Source/cmQtAutoGen.cxx b/Source/cmQtAutoGen.cxx
index d71d82f..9918c35 100644
--- a/Source/cmQtAutoGen.cxx
+++ b/Source/cmQtAutoGen.cxx
@@ -1,9 +1,12 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmQtAutoGen.h"
+
#include "cmAlgorithms.h"
+#include "cmDuration.h"
+#include "cmProcessOutput.h"
#include "cmSystemTools.h"
-
+#include "cmsys/FStream.hxx"
#include "cmsys/RegularExpression.hxx"
#include <algorithm>
@@ -237,8 +240,8 @@ void cmQtAutoGen::RccMergeOptions(std::vector<std::string>& baseOpts,
MergeOptions(baseOpts, newOpts, valueOpts, isQt5);
}
-void cmQtAutoGen::RccListParseContent(std::string const& content,
- std::vector<std::string>& files)
+static void RccListParseContent(std::string const& content,
+ std::vector<std::string>& files)
{
cmsys::RegularExpression fileMatchRegex("(<file[^<]+)");
cmsys::RegularExpression fileReplaceRegex("(^<file[^>]*>)");
@@ -255,10 +258,10 @@ void cmQtAutoGen::RccListParseContent(std::string const& content,
}
}
-bool cmQtAutoGen::RccListParseOutput(std::string const& rccStdOut,
- std::string const& rccStdErr,
- std::vector<std::string>& files,
- std::string& error)
+static bool RccListParseOutput(std::string const& rccStdOut,
+ std::string const& rccStdErr,
+ std::vector<std::string>& files,
+ std::string& error)
{
// Lambda to strip CR characters
auto StripCR = [](std::string& line) {
@@ -305,11 +308,104 @@ bool cmQtAutoGen::RccListParseOutput(std::string const& rccStdOut,
return true;
}
-void cmQtAutoGen::RccListConvertFullPath(std::string const& qrcFileDir,
- std::vector<std::string>& files)
+cmQtAutoGen::RccLister::RccLister() = default;
+
+cmQtAutoGen::RccLister::RccLister(std::string rccExecutable,
+ std::vector<std::string> listOptions)
+ : RccExcutable_(std::move(rccExecutable))
+ , ListOptions_(std::move(listOptions))
+{
+}
+
+bool cmQtAutoGen::RccLister::list(std::string const& qrcFile,
+ std::vector<std::string>& files,
+ std::string& error, bool verbose) const
{
+ error.clear();
+
+ if (!cmSystemTools::FileExists(qrcFile, true)) {
+ error = "The resource file ";
+ error += Quoted(qrcFile);
+ error += " does not exist.";
+ return false;
+ }
+
+ // Run rcc list command in the directory of the qrc file with the pathless
+ // qrc file name argument. This way rcc prints relative paths.
+ // This avoids issues on Windows when the qrc file is in a path that
+ // contains non-ASCII characters.
+ std::string const fileDir = cmSystemTools::GetFilenamePath(qrcFile);
+
+ if (!this->RccExcutable_.empty() &&
+ cmSystemTools::FileExists(this->RccExcutable_, true) &&
+ !this->ListOptions_.empty()) {
+
+ bool result = false;
+ int retVal = 0;
+ std::string rccStdOut;
+ std::string rccStdErr;
+ {
+ std::vector<std::string> cmd;
+ cmd.emplace_back(this->RccExcutable_);
+ cmd.insert(cmd.end(), this->ListOptions_.begin(),
+ this->ListOptions_.end());
+ cmd.emplace_back(cmSystemTools::GetFilenameName(qrcFile));
+
+ // Log command
+ if (verbose) {
+ std::string msg = "Running command:\n";
+ msg += QuotedCommand(cmd);
+ msg += '\n';
+ cmSystemTools::Stdout(msg);
+ }
+
+ result = cmSystemTools::RunSingleCommand(
+ cmd, &rccStdOut, &rccStdErr, &retVal, fileDir.c_str(),
+ cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto);
+ }
+ if (!result || retVal) {
+ error = "The rcc list process failed for ";
+ error += Quoted(qrcFile);
+ error += "\n";
+ if (!rccStdOut.empty()) {
+ error += rccStdOut;
+ error += "\n";
+ }
+ if (!rccStdErr.empty()) {
+ error += rccStdErr;
+ error += "\n";
+ }
+ return false;
+ }
+ if (!RccListParseOutput(rccStdOut, rccStdErr, files, error)) {
+ return false;
+ }
+ } else {
+ // We can't use rcc for the file listing.
+ // Read the qrc file content into string and parse it.
+ {
+ std::string qrcContents;
+ {
+ cmsys::ifstream ifs(qrcFile.c_str());
+ if (ifs) {
+ std::ostringstream osst;
+ osst << ifs.rdbuf();
+ qrcContents = osst.str();
+ } else {
+ error = "The resource file ";
+ error += Quoted(qrcFile);
+ error += " is not readable\n";
+ return false;
+ }
+ }
+ // Parse string content
+ RccListParseContent(qrcContents, files);
+ }
+ }
+
+ // Convert relative paths to absolute paths
for (std::string& entry : files) {
- std::string tmp = cmSystemTools::CollapseFullPath(entry, qrcFileDir);
- entry = std::move(tmp);
+ entry = cmSystemTools::CollapseFullPath(entry, fileDir);
}
+ return true;
}
diff --git a/Source/cmQtAutoGen.h b/Source/cmQtAutoGen.h
index d127a71..3a346b5 100644
--- a/Source/cmQtAutoGen.h
+++ b/Source/cmQtAutoGen.h
@@ -85,21 +85,44 @@ public:
std::vector<std::string> const& newOpts,
bool isQt5);
- /// @brief Parses the content of a qrc file
- ///
- /// Use when rcc does not support the "--list" option
- static void RccListParseContent(std::string const& content,
- std::vector<std::string>& files);
-
- /// @brief Parses the output of the "rcc --list ..." command
- static bool RccListParseOutput(std::string const& rccStdOut,
- std::string const& rccStdErr,
- std::vector<std::string>& files,
- std::string& error);
-
- /// @brief Converts relative qrc entry paths to full paths
- static void RccListConvertFullPath(std::string const& qrcFileDir,
- std::vector<std::string>& files);
+ /** @class RccLister
+ * @brief Lists files in qrc resource files
+ */
+ class RccLister
+ {
+ public:
+ RccLister();
+ RccLister(std::string rccExecutable, std::vector<std::string> listOptions);
+
+ //! The rcc executable
+ std::string const& RccExcutable() const { return RccExcutable_; }
+ void SetRccExecutable(std::string const& rccExecutable)
+ {
+ RccExcutable_ = rccExecutable;
+ }
+
+ //! The rcc executable list options
+ std::vector<std::string> const& ListOptions() const
+ {
+ return ListOptions_;
+ }
+ void SetListOptions(std::vector<std::string> const& listOptions)
+ {
+ ListOptions_ = listOptions;
+ }
+
+ /**
+ * @brief Lists a files in the qrcFile
+ * @arg files The file names are appended to this list
+ * @arg error contains the error message when the function fails
+ */
+ bool list(std::string const& qrcFile, std::vector<std::string>& files,
+ std::string& error, bool verbose = false) const;
+
+ private:
+ std::string RccExcutable_;
+ std::vector<std::string> ListOptions_;
+ };
};
#endif
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index d80aaa2..be96f1a 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -7,7 +7,6 @@
#include "cmAlgorithms.h"
#include "cmCustomCommand.h"
#include "cmCustomCommandLines.h"
-#include "cmDuration.h"
#include "cmFilePathChecksum.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
@@ -19,7 +18,6 @@
#include "cmMessageType.h"
#include "cmOutputConverter.h"
#include "cmPolicies.h"
-#include "cmProcessOutput.h"
#include "cmSourceFile.h"
#include "cmSourceFileLocationKind.h"
#include "cmSourceGroup.h"
@@ -28,7 +26,6 @@
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmake.h"
-#include "cmsys/FStream.hxx"
#include "cmsys/SystemInformation.hxx"
#include <algorithm>
@@ -36,7 +33,6 @@
#include <deque>
#include <map>
#include <set>
-#include <sstream>
#include <string>
#include <utility>
#include <vector>
@@ -935,7 +931,8 @@ bool cmQtAutoGenInitializer::InitScanFiles()
for (Qrc& qrc : this->Rcc.Qrcs) {
if (!qrc.Generated) {
std::string error;
- if (!RccListInputs(qrc.QrcFile, qrc.Resources, error)) {
+ RccLister const lister(this->Rcc.Executable, this->Rcc.ListOptions);
+ if (!lister.list(qrc.QrcFile, qrc.Resources, error)) {
cmSystemTools::Error(error);
return false;
}
@@ -1630,86 +1627,3 @@ bool cmQtAutoGenInitializer::GetQtExecutable(GenVarsT& genVars,
return true;
}
-
-/// @brief Reads the resource files list from from a .qrc file
-/// @arg fileName Must be the absolute path of the .qrc file
-/// @return True if the rcc file was successfully read
-bool cmQtAutoGenInitializer::RccListInputs(std::string const& fileName,
- std::vector<std::string>& files,
- std::string& error)
-{
- if (!cmSystemTools::FileExists(fileName)) {
- error = "rcc resource file does not exist:\n ";
- error += Quoted(fileName);
- error += "\n";
- return false;
- }
- if (this->Rcc.ExecutableExists && !this->Rcc.ListOptions.empty()) {
- // Use rcc for file listing
- if (this->Rcc.Executable.empty()) {
- error = "rcc executable not available";
- return false;
- }
-
- // Run rcc list command in the directory of the qrc file with the
- // pathless
- // qrc file name argument. This way rcc prints relative paths.
- // This avoids issues on Windows when the qrc file is in a path that
- // contains non-ASCII characters.
- std::string const fileDir = cmSystemTools::GetFilenamePath(fileName);
- std::string const fileNameName = cmSystemTools::GetFilenameName(fileName);
-
- bool result = false;
- int retVal = 0;
- std::string rccStdOut;
- std::string rccStdErr;
- {
- std::vector<std::string> cmd;
- cmd.push_back(this->Rcc.Executable);
- cmd.insert(cmd.end(), this->Rcc.ListOptions.begin(),
- this->Rcc.ListOptions.end());
- cmd.push_back(fileNameName);
- result = cmSystemTools::RunSingleCommand(
- cmd, &rccStdOut, &rccStdErr, &retVal, fileDir.c_str(),
- cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto);
- }
- if (!result || retVal) {
- error = "rcc list process failed for:\n ";
- error += Quoted(fileName);
- error += "\n";
- error += rccStdOut;
- error += "\n";
- error += rccStdErr;
- error += "\n";
- return false;
- }
- if (!RccListParseOutput(rccStdOut, rccStdErr, files, error)) {
- return false;
- }
- } else {
- // We can't use rcc for the file listing.
- // Read the qrc file content into string and parse it.
- {
- std::string qrcContents;
- {
- cmsys::ifstream ifs(fileName.c_str());
- if (ifs) {
- std::ostringstream osst;
- osst << ifs.rdbuf();
- qrcContents = osst.str();
- } else {
- error = "rcc file not readable:\n ";
- error += Quoted(fileName);
- error += "\n";
- return false;
- }
- }
- // Parse string content
- RccListParseContent(qrcContents, files);
- }
- }
-
- // Convert relative paths to absolute paths
- RccListConvertFullPath(cmSystemTools::GetFilenamePath(fileName), files);
- return true;
-}
diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h
index e7e5db2..7ff33c3 100644
--- a/Source/cmQtAutoGenInitializer.h
+++ b/Source/cmQtAutoGenInitializer.h
@@ -149,10 +149,6 @@ private:
bool GetQtExecutable(GenVarsT& genVars, const std::string& executable,
bool ignoreMissingTarget, std::string* output) const;
- bool RccListInputs(std::string const& fileName,
- std::vector<std::string>& files,
- std::string& errorMessage);
-
private:
cmQtAutoGenGlobalInitializer* GlobalInitializer;
cmGeneratorTarget* Target;
diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx
index 27afe48..f115016 100644
--- a/Source/cmQtAutoGenerator.cxx
+++ b/Source/cmQtAutoGenerator.cxx
@@ -20,6 +20,34 @@
// -- Class methods
+cmQtAutoGenerator::Logger::Logger()
+{
+ // Initialize logger
+ {
+ std::string verbose;
+ if (cmSystemTools::GetEnv("VERBOSE", verbose) && !verbose.empty()) {
+ unsigned long iVerbose = 0;
+ if (cmSystemTools::StringToULong(verbose.c_str(), &iVerbose)) {
+ SetVerbosity(static_cast<unsigned int>(iVerbose));
+ } else {
+ // Non numeric verbosity
+ SetVerbose(cmSystemTools::IsOn(verbose));
+ }
+ }
+ }
+ {
+ std::string colorEnv;
+ cmSystemTools::GetEnv("COLOR", colorEnv);
+ if (!colorEnv.empty()) {
+ SetColorOutput(cmSystemTools::IsOn(colorEnv));
+ } else {
+ SetColorOutput(true);
+ }
+ }
+}
+
+cmQtAutoGenerator::Logger::~Logger() = default;
+
void cmQtAutoGenerator::Logger::RaiseVerbosity(std::string const& value)
{
unsigned long verbosity = 0;
@@ -152,6 +180,91 @@ void cmQtAutoGenerator::Logger::ErrorCommand(
}
}
+bool cmQtAutoGenerator::MakeParentDirectory(std::string const& filename)
+{
+ bool success = true;
+ std::string const dirName = cmSystemTools::GetFilenamePath(filename);
+ if (!dirName.empty()) {
+ success = cmSystemTools::MakeDirectory(dirName);
+ }
+ return success;
+}
+
+bool cmQtAutoGenerator::FileRead(std::string& content,
+ std::string const& filename,
+ std::string* error)
+{
+ content.clear();
+ if (!cmSystemTools::FileExists(filename, true)) {
+ if (error != nullptr) {
+ error->append("Not a file.");
+ }
+ return false;
+ }
+
+ unsigned long const length = cmSystemTools::FileLength(filename);
+ cmsys::ifstream ifs(filename.c_str(), (std::ios::in | std::ios::binary));
+
+ // Use lambda to save destructor calls of ifs
+ return [&ifs, length, &content, error]() -> bool {
+ if (!ifs) {
+ if (error != nullptr) {
+ error->append("Opening the file for reading failed.");
+ }
+ return false;
+ }
+ content.reserve(length);
+ typedef std::istreambuf_iterator<char> IsIt;
+ content.assign(IsIt{ ifs }, IsIt{});
+ if (!ifs) {
+ content.clear();
+ if (error != nullptr) {
+ error->append("Reading from the file failed.");
+ }
+ return false;
+ }
+ return true;
+ }();
+}
+
+bool cmQtAutoGenerator::FileWrite(std::string const& filename,
+ std::string const& content,
+ std::string* error)
+{
+ // Make sure the parent directory exists
+ if (!cmQtAutoGenerator::MakeParentDirectory(filename)) {
+ if (error != nullptr) {
+ error->assign("Could not create parent directory.");
+ }
+ return false;
+ }
+ cmsys::ofstream ofs;
+ ofs.open(filename.c_str(),
+ (std::ios::out | std::ios::binary | std::ios::trunc));
+
+ // Use lambda to save destructor calls of ofs
+ return [&ofs, &content, error]() -> bool {
+ if (!ofs) {
+ if (error != nullptr) {
+ error->assign("Opening file for writing failed.");
+ }
+ return false;
+ }
+ ofs << content;
+ if (!ofs.good()) {
+ if (error != nullptr) {
+ error->assign("File writing failed.");
+ }
+ return false;
+ }
+ return true;
+ }();
+}
+
+cmQtAutoGenerator::FileSystem::FileSystem() = default;
+
+cmQtAutoGenerator::FileSystem::~FileSystem() = default;
+
std::string cmQtAutoGenerator::FileSystem::GetRealPath(
std::string const& filename)
{
@@ -267,91 +380,16 @@ bool cmQtAutoGenerator::FileSystem::FileRead(std::string& content,
std::string const& filename,
std::string* error)
{
- bool success = false;
- if (FileExists(filename, true)) {
- unsigned long const length = FileLength(filename);
- {
- std::lock_guard<std::mutex> lock(Mutex_);
- cmsys::ifstream ifs(filename.c_str(), (std::ios::in | std::ios::binary));
- if (ifs) {
- content.reserve(length);
- content.assign(std::istreambuf_iterator<char>{ ifs },
- std::istreambuf_iterator<char>{});
- if (ifs) {
- success = true;
- } else {
- content.clear();
- if (error != nullptr) {
- error->append("Reading from the file failed.");
- }
- }
- } else if (error != nullptr) {
- error->append("Opening the file for reading failed.");
- }
- }
- } else if (error != nullptr) {
- error->append(
- "The file does not exist, is not readable or is a directory.");
- }
- return success;
-}
-
-bool cmQtAutoGenerator::FileSystem::FileRead(GenT genType,
- std::string& content,
- std::string const& filename)
-{
- std::string error;
- if (!FileRead(content, filename, &error)) {
- Log()->ErrorFile(genType, filename, error);
- return false;
- }
- return true;
+ std::lock_guard<std::mutex> lock(Mutex_);
+ return cmQtAutoGenerator::FileRead(content, filename, error);
}
bool cmQtAutoGenerator::FileSystem::FileWrite(std::string const& filename,
std::string const& content,
std::string* error)
{
- bool success = false;
- // Make sure the parent directory exists
- if (MakeParentDirectory(filename)) {
- std::lock_guard<std::mutex> lock(Mutex_);
- cmsys::ofstream outfile;
- outfile.open(filename.c_str(),
- (std::ios::out | std::ios::binary | std::ios::trunc));
- if (outfile) {
- outfile << content;
- // Check for write errors
- if (outfile.good()) {
- success = true;
- } else {
- if (error != nullptr) {
- error->assign("File writing failed");
- }
- }
- } else {
- if (error != nullptr) {
- error->assign("Opening file for writing failed");
- }
- }
- } else {
- if (error != nullptr) {
- error->assign("Could not create parent directory");
- }
- }
- return success;
-}
-
-bool cmQtAutoGenerator::FileSystem::FileWrite(GenT genType,
- std::string const& filename,
- std::string const& content)
-{
- std::string error;
- if (!FileWrite(filename, content, &error)) {
- Log()->ErrorFile(genType, filename, error);
- return false;
- }
- return true;
+ std::lock_guard<std::mutex> lock(Mutex_);
+ return cmQtAutoGenerator::FileWrite(filename, content, error);
}
bool cmQtAutoGenerator::FileSystem::FileDiffers(std::string const& filename,
@@ -386,35 +424,11 @@ bool cmQtAutoGenerator::FileSystem::MakeDirectory(std::string const& dirname)
return cmSystemTools::MakeDirectory(dirname);
}
-bool cmQtAutoGenerator::FileSystem::MakeDirectory(GenT genType,
- std::string const& dirname)
-{
- if (!MakeDirectory(dirname)) {
- Log()->ErrorFile(genType, dirname, "Could not create directory");
- return false;
- }
- return true;
-}
-
bool cmQtAutoGenerator::FileSystem::MakeParentDirectory(
std::string const& filename)
{
- bool success = true;
- std::string const dirName = cmSystemTools::GetFilenamePath(filename);
- if (!dirName.empty()) {
- success = MakeDirectory(dirName);
- }
- return success;
-}
-
-bool cmQtAutoGenerator::FileSystem::MakeParentDirectory(
- GenT genType, std::string const& filename)
-{
- if (!MakeParentDirectory(filename)) {
- Log()->ErrorFile(genType, filename, "Could not create parent directory");
- return false;
- }
- return true;
+ std::lock_guard<std::mutex> lock(Mutex_);
+ return cmQtAutoGenerator::MakeParentDirectory(filename);
}
int cmQtAutoGenerator::ReadOnlyProcessT::PipeT::init(uv_loop_t* uv_loop,
@@ -643,46 +657,9 @@ void cmQtAutoGenerator::ReadOnlyProcessT::UVTryFinish()
}
}
-cmQtAutoGenerator::cmQtAutoGenerator()
- : FileSys_(&Logger_)
-{
- // Initialize logger
- {
- std::string verbose;
- if (cmSystemTools::GetEnv("VERBOSE", verbose) && !verbose.empty()) {
- unsigned long iVerbose = 0;
- if (cmSystemTools::StringToULong(verbose.c_str(), &iVerbose)) {
- Logger_.SetVerbosity(static_cast<unsigned int>(iVerbose));
- } else {
- // Non numeric verbosity
- Logger_.SetVerbose(cmSystemTools::IsOn(verbose));
- }
- }
- }
- {
- std::string colorEnv;
- cmSystemTools::GetEnv("COLOR", colorEnv);
- if (!colorEnv.empty()) {
- Logger_.SetColorOutput(cmSystemTools::IsOn(colorEnv));
- } else {
- Logger_.SetColorOutput(true);
- }
- }
+cmQtAutoGenerator::cmQtAutoGenerator() = default;
- // Initialize libuv loop
- uv_disable_stdio_inheritance();
-#ifdef CMAKE_UV_SIGNAL_HACK
- UVHackRAII_ = cm::make_unique<cmUVSignalHackRAII>();
-#endif
- UVLoop_ = cm::make_unique<uv_loop_t>();
- uv_loop_init(UVLoop());
-}
-
-cmQtAutoGenerator::~cmQtAutoGenerator()
-{
- // Close libuv loop
- uv_loop_close(UVLoop());
-}
+cmQtAutoGenerator::~cmQtAutoGenerator() = default;
bool cmQtAutoGenerator::Run(std::string const& infoFile,
std::string const& config)
diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h
index b55bebc..479d357 100644
--- a/Source/cmQtAutoGenerator.h
+++ b/Source/cmQtAutoGenerator.h
@@ -8,7 +8,6 @@
#include "cmFilePathChecksum.h"
#include "cmQtAutoGen.h"
#include "cmUVHandlePtr.h"
-#include "cmUVSignalHackRAII.h" // IWYU pragma: keep
#include "cm_uv.h"
#include <array>
@@ -31,12 +30,16 @@ public:
class Logger
{
public:
+ // -- Construction
+ Logger();
+ ~Logger();
// -- Verbosity
unsigned int Verbosity() const { return this->Verbosity_; }
void SetVerbosity(unsigned int value) { this->Verbosity_ = value; }
void RaiseVerbosity(std::string const& value);
bool Verbose() const { return (this->Verbosity_ != 0); }
void SetVerbose(bool value) { this->Verbosity_ = value ? 1 : 0; }
+ // -- Color output
bool ColorOutput() const { return this->ColorOutput_; }
void SetColorOutput(bool value);
// -- Log info
@@ -62,17 +65,20 @@ public:
bool ColorOutput_ = false;
};
+ // -- File system methods
+ static bool MakeParentDirectory(std::string const& filename);
+ static bool FileRead(std::string& content, std::string const& filename,
+ std::string* error = nullptr);
+ static bool FileWrite(std::string const& filename,
+ std::string const& content,
+ std::string* error = nullptr);
+
/// @brief Thread safe file system interface
class FileSystem
{
public:
- FileSystem(Logger* log)
- : Log_(log)
- {
- }
-
- /// @brief Logger
- Logger* Log() const { return Log_; }
+ FileSystem();
+ ~FileSystem();
// -- Paths
/// @brief Wrapper for cmSystemTools::GetRealPath
@@ -113,15 +119,9 @@ public:
bool FileRead(std::string& content, std::string const& filename,
std::string* error = nullptr);
- /// @brief Error logging version
- bool FileRead(GenT genType, std::string& content,
- std::string const& filename);
bool FileWrite(std::string const& filename, std::string const& content,
std::string* error = nullptr);
- /// @brief Error logging version
- bool FileWrite(GenT genType, std::string const& filename,
- std::string const& content);
bool FileDiffers(std::string const& filename, std::string const& content);
@@ -130,17 +130,11 @@ public:
// -- Directory access
bool MakeDirectory(std::string const& dirname);
- /// @brief Error logging version
- bool MakeDirectory(GenT genType, std::string const& dirname);
-
bool MakeParentDirectory(std::string const& filename);
- /// @brief Error logging version
- bool MakeParentDirectory(GenT genType, std::string const& filename);
private:
std::mutex Mutex_;
cmFilePathChecksum FilePathChecksum_;
- Logger* Log_;
};
/// @brief Return value and output of an external process
@@ -250,18 +244,10 @@ public:
// -- Run
bool Run(std::string const& infoFile, std::string const& config);
- // -- Accessors
- // Logging
- Logger& Log() { return Logger_; }
- // File System
- FileSystem& FileSys() { return FileSys_; }
// InfoFile
std::string const& InfoFile() const { return InfoFile_; }
std::string const& InfoDir() const { return InfoDir_; }
std::string const& InfoConfig() const { return InfoConfig_; }
- // libuv loop
- uv_loop_t* UVLoop() { return UVLoop_.get(); }
- cm::uv_async_ptr& UVRequest() { return UVRequest_; }
// -- Utility
static std::string SettingsFind(std::string const& content, const char* key);
@@ -272,19 +258,10 @@ protected:
virtual bool Process() = 0;
private:
- // -- Logging
- Logger Logger_;
- FileSystem FileSys_;
// -- Info settings
std::string InfoFile_;
std::string InfoDir_;
std::string InfoConfig_;
-// -- libuv loop
-#ifdef CMAKE_UV_SIGNAL_HACK
- std::unique_ptr<cmUVSignalHackRAII> UVHackRAII_;
-#endif
- std::unique_ptr<uv_loop_t> UVLoop_;
- cm::uv_async_ptr UVRequest_;
};
#endif
diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx
index 0982473..ec1a1aa 100644
--- a/Source/cmQtAutoGeneratorMocUic.cxx
+++ b/Source/cmQtAutoGeneratorMocUic.cxx
@@ -638,13 +638,15 @@ void cmQtAutoGeneratorMocUic::JobMocPredefsT::Process(WorkerT& wrk)
if (!result.error()) {
if (!fileExists ||
wrk.FileSys().FileDiffers(wrk.Moc().PredefsFileAbs, result.StdOut)) {
- if (wrk.FileSys().FileWrite(GenT::MOC, wrk.Moc().PredefsFileAbs,
- result.StdOut)) {
+ std::string error;
+ if (wrk.FileSys().FileWrite(wrk.Moc().PredefsFileAbs, result.StdOut,
+ &error)) {
// Success
} else {
std::string emsg = "Writing ";
emsg += Quoted(wrk.Moc().PredefsFileRel);
- emsg += " failed.";
+ emsg += " failed. ";
+ emsg += error;
wrk.LogFileError(GenT::MOC, wrk.Moc().PredefsFileAbs, emsg);
}
} else {
@@ -835,7 +837,12 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk)
void cmQtAutoGeneratorMocUic::JobMocT::GenerateMoc(WorkerT& wrk)
{
// Make sure the parent directory exists
- if (wrk.FileSys().MakeParentDirectory(GenT::MOC, BuildFile)) {
+ if (!wrk.FileSys().MakeParentDirectory(BuildFile)) {
+ wrk.LogFileError(GenT::MOC, BuildFile,
+ "Could not create parent directory.");
+ return;
+ }
+ {
// Compose moc command
std::vector<std::string> cmd;
cmd.push_back(wrk.Moc().Executable);
@@ -950,7 +957,12 @@ bool cmQtAutoGeneratorMocUic::JobUicT::UpdateRequired(WorkerT& wrk)
void cmQtAutoGeneratorMocUic::JobUicT::GenerateUic(WorkerT& wrk)
{
// Make sure the parent directory exists
- if (wrk.FileSys().MakeParentDirectory(GenT::UIC, BuildFile)) {
+ if (!wrk.FileSys().MakeParentDirectory(BuildFile)) {
+ wrk.LogFileError(GenT::UIC, BuildFile,
+ "Could not create parent directory.");
+ return;
+ }
+ {
// Compose uic command
std::vector<std::string> cmd;
cmd.push_back(wrk.Uic().Executable);
@@ -1136,11 +1148,23 @@ cmQtAutoGeneratorMocUic::cmQtAutoGeneratorMocUic()
Uic_.RegExpInclude.compile("(^|\n)[ \t]*#[ \t]*include[ \t]+"
"[\"<](([^ \">]+/)?ui_[^ \">/]+\\.h)[\">]");
+ // Initialize libuv loop
+ uv_disable_stdio_inheritance();
+#ifdef CMAKE_UV_SIGNAL_HACK
+ UVHackRAII_ = cm::make_unique<cmUVSignalHackRAII>();
+#endif
+ UVLoop_ = cm::make_unique<uv_loop_t>();
+ uv_loop_init(UVLoop());
+
// Initialize libuv asynchronous iteration request
UVRequest().init(*UVLoop(), &cmQtAutoGeneratorMocUic::UVPollStage, this);
}
-cmQtAutoGeneratorMocUic::~cmQtAutoGeneratorMocUic() = default;
+cmQtAutoGeneratorMocUic::~cmQtAutoGeneratorMocUic()
+{
+ // Close libuv loop
+ uv_loop_close(UVLoop());
+}
bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile)
{
@@ -1691,9 +1715,10 @@ void cmQtAutoGeneratorMocUic::SettingsFileWrite()
SettingAppend("uic", SettingsStringUic_);
}
// Write settings file
- if (!FileSys().FileWrite(GenT::GEN, SettingsFile_, content)) {
+ std::string error;
+ if (!FileSys().FileWrite(SettingsFile_, content, &error)) {
Log().ErrorFile(GenT::GEN, SettingsFile_,
- "Settings file writing failed");
+ "Settings file writing failed. " + error);
// Remove old settings file to trigger a full rebuild on the next run
FileSys().FileRemove(SettingsFile_);
RegisterJobError();
@@ -1704,7 +1729,9 @@ void cmQtAutoGeneratorMocUic::SettingsFileWrite()
void cmQtAutoGeneratorMocUic::CreateDirectories()
{
// Create AUTOGEN include directory
- if (!FileSys().MakeDirectory(GenT::GEN, Base().AutogenIncludeDir)) {
+ if (!FileSys().MakeDirectory(Base().AutogenIncludeDir)) {
+ Log().ErrorFile(GenT::GEN, Base().AutogenIncludeDir,
+ "Could not create directory.");
RegisterJobError();
}
}
@@ -2003,9 +2030,10 @@ void cmQtAutoGeneratorMocUic::MocGenerateCompilation()
if (Log().Verbose()) {
Log().Info(GenT::MOC, "Generating MOC compilation " + compAbs);
}
- if (!FileSys().FileWrite(GenT::MOC, compAbs, content)) {
+ std::string error;
+ if (!FileSys().FileWrite(compAbs, content, &error)) {
Log().ErrorFile(GenT::MOC, compAbs,
- "mocs compilation file writing failed");
+ "mocs compilation file writing failed. " + error);
RegisterJobError();
return;
}
diff --git a/Source/cmQtAutoGeneratorMocUic.h b/Source/cmQtAutoGeneratorMocUic.h
index e48d7f3..27d73a7 100644
--- a/Source/cmQtAutoGeneratorMocUic.h
+++ b/Source/cmQtAutoGeneratorMocUic.h
@@ -8,6 +8,7 @@
#include "cmQtAutoGen.h"
#include "cmQtAutoGenerator.h"
#include "cmUVHandlePtr.h"
+#include "cmUVSignalHackRAII.h" // IWYU pragma: keep
#include "cm_uv.h"
#include "cmsys/RegularExpression.hxx"
@@ -387,6 +388,12 @@ public:
void ParallelMocAutoUpdated();
private:
+ // -- Utility accessors
+ Logger& Log() { return Logger_; }
+ FileSystem& FileSys() { return FileSys_; }
+ // -- libuv loop accessors
+ uv_loop_t* UVLoop() { return UVLoop_.get(); }
+ cm::uv_async_ptr& UVRequest() { return UVRequest_; }
// -- Abstract processing interface
bool Init(cmMakefile* makefile) override;
bool Process() override;
@@ -407,11 +414,19 @@ private:
void MocGenerateCompilation();
private:
+ // -- Utility
+ Logger Logger_;
+ FileSystem FileSys_;
// -- Settings
BaseSettingsT Base_;
MocSettingsT Moc_;
UicSettingsT Uic_;
- // -- Progress
+ // -- libuv loop
+#ifdef CMAKE_UV_SIGNAL_HACK
+ std::unique_ptr<cmUVSignalHackRAII> UVHackRAII_;
+#endif
+ std::unique_ptr<uv_loop_t> UVLoop_;
+ cm::uv_async_ptr UVRequest_;
StageT Stage_ = StageT::SETTINGS_READ;
// -- Job queues
std::mutex JobsMutex_;
diff --git a/Source/cmQtAutoGeneratorRcc.cxx b/Source/cmQtAutoGeneratorRcc.cxx
deleted file mode 100644
index 5deb532..0000000
--- a/Source/cmQtAutoGeneratorRcc.cxx
+++ /dev/null
@@ -1,666 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmQtAutoGeneratorRcc.h"
-#include "cmQtAutoGen.h"
-
-#include "cmAlgorithms.h"
-#include "cmCryptoHash.h"
-#include "cmFileLockResult.h"
-#include "cmMakefile.h"
-#include "cmSystemTools.h"
-#include "cmUVHandlePtr.h"
-
-// -- Class methods
-
-cmQtAutoGeneratorRcc::cmQtAutoGeneratorRcc()
-{
- // Initialize libuv asynchronous iteration request
- UVRequest().init(*UVLoop(), &cmQtAutoGeneratorRcc::UVPollStage, this);
-}
-
-cmQtAutoGeneratorRcc::~cmQtAutoGeneratorRcc() = default;
-
-bool cmQtAutoGeneratorRcc::Init(cmMakefile* makefile)
-{
- // -- Utility lambdas
- auto InfoGet = [makefile](std::string const& key) {
- return makefile->GetSafeDefinition(key);
- };
- auto InfoGetList =
- [makefile](std::string const& key) -> std::vector<std::string> {
- std::vector<std::string> list;
- cmSystemTools::ExpandListArgument(makefile->GetSafeDefinition(key), list);
- return list;
- };
- auto InfoGetConfig = [makefile,
- this](std::string const& key) -> std::string {
- const char* valueConf = nullptr;
- {
- std::string keyConf = key;
- keyConf += '_';
- keyConf += InfoConfig();
- valueConf = makefile->GetDefinition(keyConf);
- }
- if (valueConf == nullptr) {
- return makefile->GetSafeDefinition(key);
- }
- return std::string(valueConf);
- };
- auto InfoGetConfigList =
- [&InfoGetConfig](std::string const& key) -> std::vector<std::string> {
- std::vector<std::string> list;
- cmSystemTools::ExpandListArgument(InfoGetConfig(key), list);
- return list;
- };
-
- // -- Read info file
- if (!makefile->ReadListFile(InfoFile())) {
- Log().ErrorFile(GenT::RCC, InfoFile(), "File processing failed");
- return false;
- }
-
- // - Configurations
- Log().RaiseVerbosity(InfoGet("ARCC_VERBOSITY"));
- MultiConfig_ = makefile->IsOn("ARCC_MULTI_CONFIG");
-
- // - Directories
- AutogenBuildDir_ = InfoGet("ARCC_BUILD_DIR");
- if (AutogenBuildDir_.empty()) {
- Log().ErrorFile(GenT::RCC, InfoFile(), "Build directory empty");
- return false;
- }
-
- IncludeDir_ = InfoGetConfig("ARCC_INCLUDE_DIR");
- if (IncludeDir_.empty()) {
- Log().ErrorFile(GenT::RCC, InfoFile(), "Include directory empty");
- return false;
- }
-
- // - Rcc executable
- RccExecutable_ = InfoGet("ARCC_RCC_EXECUTABLE");
- RccListOptions_ = InfoGetList("ARCC_RCC_LIST_OPTIONS");
-
- // - Job
- LockFile_ = InfoGet("ARCC_LOCK_FILE");
- QrcFile_ = InfoGet("ARCC_SOURCE");
- QrcFileName_ = cmSystemTools::GetFilenameName(QrcFile_);
- QrcFileDir_ = cmSystemTools::GetFilenamePath(QrcFile_);
- RccPathChecksum_ = InfoGet("ARCC_OUTPUT_CHECKSUM");
- RccFileName_ = InfoGet("ARCC_OUTPUT_NAME");
- Options_ = InfoGetConfigList("ARCC_OPTIONS");
- Inputs_ = InfoGetList("ARCC_INPUTS");
-
- // - Settings file
- SettingsFile_ = InfoGetConfig("ARCC_SETTINGS_FILE");
-
- // - Validity checks
- if (LockFile_.empty()) {
- Log().ErrorFile(GenT::RCC, InfoFile(), "Lock file name missing");
- return false;
- }
- if (SettingsFile_.empty()) {
- Log().ErrorFile(GenT::RCC, InfoFile(), "Settings file name missing");
- return false;
- }
- if (AutogenBuildDir_.empty()) {
- Log().ErrorFile(GenT::RCC, InfoFile(), "Autogen build directory missing");
- return false;
- }
- if (RccExecutable_.empty()) {
- Log().ErrorFile(GenT::RCC, InfoFile(), "rcc executable missing");
- return false;
- }
- if (QrcFile_.empty()) {
- Log().ErrorFile(GenT::RCC, InfoFile(), "rcc input file missing");
- return false;
- }
- if (RccFileName_.empty()) {
- Log().ErrorFile(GenT::RCC, InfoFile(), "rcc output file missing");
- return false;
- }
-
- // Init derived information
- // ------------------------
-
- RccFilePublic_ = AutogenBuildDir_;
- RccFilePublic_ += '/';
- RccFilePublic_ += RccPathChecksum_;
- RccFilePublic_ += '/';
- RccFilePublic_ += RccFileName_;
-
- // Compute rcc output file name
- if (IsMultiConfig()) {
- RccFileOutput_ = IncludeDir_;
- RccFileOutput_ += '/';
- RccFileOutput_ += MultiConfigOutput();
- } else {
- RccFileOutput_ = RccFilePublic_;
- }
-
- return true;
-}
-
-bool cmQtAutoGeneratorRcc::Process()
-{
- // Run libuv event loop
- UVRequest().send();
- if (uv_run(UVLoop(), UV_RUN_DEFAULT) == 0) {
- if (Error_) {
- return false;
- }
- } else {
- return false;
- }
- return true;
-}
-
-void cmQtAutoGeneratorRcc::UVPollStage(uv_async_t* handle)
-{
- reinterpret_cast<cmQtAutoGeneratorRcc*>(handle->data)->PollStage();
-}
-
-void cmQtAutoGeneratorRcc::PollStage()
-{
- switch (Stage_) {
- // -- Initialize
- case StageT::SETTINGS_READ:
- if (SettingsFileRead()) {
- SetStage(StageT::TEST_QRC_RCC_FILES);
- } else {
- SetStage(StageT::FINISH);
- }
- break;
-
- // -- Change detection
- case StageT::TEST_QRC_RCC_FILES:
- if (TestQrcRccFiles()) {
- SetStage(StageT::GENERATE);
- } else {
- SetStage(StageT::TEST_RESOURCES_READ);
- }
- break;
- case StageT::TEST_RESOURCES_READ:
- if (TestResourcesRead()) {
- SetStage(StageT::TEST_RESOURCES);
- }
- break;
- case StageT::TEST_RESOURCES:
- if (TestResources()) {
- SetStage(StageT::GENERATE);
- } else {
- SetStage(StageT::TEST_INFO_FILE);
- }
- break;
- case StageT::TEST_INFO_FILE:
- TestInfoFile();
- SetStage(StageT::GENERATE_WRAPPER);
- break;
-
- // -- Generation
- case StageT::GENERATE:
- GenerateParentDir();
- SetStage(StageT::GENERATE_RCC);
- break;
- case StageT::GENERATE_RCC:
- if (GenerateRcc()) {
- SetStage(StageT::GENERATE_WRAPPER);
- }
- break;
- case StageT::GENERATE_WRAPPER:
- GenerateWrapper();
- SetStage(StageT::SETTINGS_WRITE);
- break;
-
- // -- Finalize
- case StageT::SETTINGS_WRITE:
- SettingsFileWrite();
- SetStage(StageT::FINISH);
- break;
- case StageT::FINISH:
- // Clear all libuv handles
- UVRequest().reset();
- // Set highest END stage manually
- Stage_ = StageT::END;
- break;
- case StageT::END:
- break;
- }
-}
-
-void cmQtAutoGeneratorRcc::SetStage(StageT stage)
-{
- if (Error_) {
- stage = StageT::FINISH;
- }
- // Only allow to increase the stage
- if (Stage_ < stage) {
- Stage_ = stage;
- UVRequest().send();
- }
-}
-
-std::string cmQtAutoGeneratorRcc::MultiConfigOutput() const
-{
- static std::string const suffix = "_CMAKE_";
- std::string res;
- res += RccPathChecksum_;
- res += '/';
- res += AppendFilenameSuffix(RccFileName_, suffix);
- return res;
-}
-
-bool cmQtAutoGeneratorRcc::SettingsFileRead()
-{
- // Compose current settings strings
- {
- cmCryptoHash crypt(cmCryptoHash::AlgoSHA256);
- std::string const sep(" ~~~ ");
- {
- std::string str;
- str += RccExecutable_;
- str += sep;
- str += cmJoin(RccListOptions_, ";");
- str += sep;
- str += QrcFile_;
- str += sep;
- str += RccPathChecksum_;
- str += sep;
- str += RccFileName_;
- str += sep;
- str += cmJoin(Options_, ";");
- str += sep;
- str += cmJoin(Inputs_, ";");
- str += sep;
- SettingsString_ = crypt.HashString(str);
- }
- }
-
- // Make sure the settings file exists
- if (!FileSys().FileExists(SettingsFile_, true)) {
- // Touch the settings file to make sure it exists
- FileSys().Touch(SettingsFile_, true);
- }
-
- // Lock the lock file
- {
- // Make sure the lock file exists
- if (!FileSys().FileExists(LockFile_, true)) {
- if (!FileSys().Touch(LockFile_, true)) {
- Log().ErrorFile(GenT::RCC, LockFile_, "Lock file creation failed");
- Error_ = true;
- return false;
- }
- }
- // Lock the lock file
- cmFileLockResult lockResult =
- LockFileLock_.Lock(LockFile_, static_cast<unsigned long>(-1));
- if (!lockResult.IsOk()) {
- Log().ErrorFile(GenT::RCC, LockFile_,
- "File lock failed: " + lockResult.GetOutputMessage());
- Error_ = true;
- return false;
- }
- }
-
- // Read old settings
- {
- std::string content;
- if (FileSys().FileRead(content, SettingsFile_)) {
- SettingsChanged_ = (SettingsString_ != SettingsFind(content, "rcc"));
- // In case any setting changed clear the old settings file.
- // This triggers a full rebuild on the next run if the current
- // build is aborted before writing the current settings in the end.
- if (SettingsChanged_) {
- FileSys().FileWrite(GenT::RCC, SettingsFile_, "");
- }
- } else {
- SettingsChanged_ = true;
- }
- }
-
- return true;
-}
-
-void cmQtAutoGeneratorRcc::SettingsFileWrite()
-{
- // Only write if any setting changed
- if (SettingsChanged_) {
- if (Log().Verbose()) {
- Log().Info(GenT::RCC, "Writing settings file " + Quoted(SettingsFile_));
- }
- // Write settings file
- std::string content = "rcc:";
- content += SettingsString_;
- content += '\n';
- if (!FileSys().FileWrite(GenT::RCC, SettingsFile_, content)) {
- Log().ErrorFile(GenT::RCC, SettingsFile_,
- "Settings file writing failed");
- // Remove old settings file to trigger a full rebuild on the next run
- FileSys().FileRemove(SettingsFile_);
- Error_ = true;
- }
- }
-
- // Unlock the lock file
- LockFileLock_.Release();
-}
-
-bool cmQtAutoGeneratorRcc::TestQrcRccFiles()
-{
- // Do basic checks if rcc generation is required
-
- // Test if the rcc output file exists
- if (!FileSys().FileExists(RccFileOutput_)) {
- if (Log().Verbose()) {
- std::string reason = "Generating ";
- reason += Quoted(RccFileOutput_);
- reason += " from its source file ";
- reason += Quoted(QrcFile_);
- reason += " because it doesn't exist";
- Log().Info(GenT::RCC, reason);
- }
- Generate_ = true;
- return Generate_;
- }
-
- // Test if the settings changed
- if (SettingsChanged_) {
- if (Log().Verbose()) {
- std::string reason = "Generating ";
- reason += Quoted(RccFileOutput_);
- reason += " from ";
- reason += Quoted(QrcFile_);
- reason += " because the RCC settings changed";
- Log().Info(GenT::RCC, reason);
- }
- Generate_ = true;
- return Generate_;
- }
-
- // Test if the rcc output file is older than the .qrc file
- {
- bool isOlder = false;
- {
- std::string error;
- isOlder = FileSys().FileIsOlderThan(RccFileOutput_, QrcFile_, &error);
- if (!error.empty()) {
- Log().ErrorFile(GenT::RCC, QrcFile_, error);
- Error_ = true;
- }
- }
- if (isOlder) {
- if (Log().Verbose()) {
- std::string reason = "Generating ";
- reason += Quoted(RccFileOutput_);
- reason += " because it is older than ";
- reason += Quoted(QrcFile_);
- Log().Info(GenT::RCC, reason);
- }
- Generate_ = true;
- }
- }
-
- return Generate_;
-}
-
-bool cmQtAutoGeneratorRcc::TestResourcesRead()
-{
- if (!Inputs_.empty()) {
- // Inputs are known already
- return true;
- }
-
- if (!RccListOptions_.empty()) {
- // Start a rcc list process and parse the output
- if (Process_) {
- // Process is running already
- if (Process_->IsFinished()) {
- // Process is finished
- if (!ProcessResult_.error()) {
- // Process success
- std::string parseError;
- if (!RccListParseOutput(ProcessResult_.StdOut, ProcessResult_.StdErr,
- Inputs_, parseError)) {
- Log().ErrorFile(GenT::RCC, QrcFile_, parseError);
- Error_ = true;
- }
- } else {
- Log().ErrorFile(GenT::RCC, QrcFile_, ProcessResult_.ErrorMessage);
- Error_ = true;
- }
- // Clean up
- Process_.reset();
- ProcessResult_.reset();
- } else {
- // Process is not finished, yet.
- return false;
- }
- } else {
- // Start a new process
- // rcc prints relative entry paths when started in the directory of the
- // qrc file with a pathless qrc file name argument.
- // This is important because on Windows absolute paths returned by rcc
- // might contain bad multibyte characters when the qrc file path
- // contains non-ASCII pcharacters.
- std::vector<std::string> cmd;
- cmd.push_back(RccExecutable_);
- cmd.insert(cmd.end(), RccListOptions_.begin(), RccListOptions_.end());
- cmd.push_back(QrcFileName_);
- // We're done here if the process fails to start
- return !StartProcess(QrcFileDir_, cmd, false);
- }
- } else {
- // rcc does not support the --list command.
- // Read the qrc file content and parse it.
- std::string qrcContent;
- if (FileSys().FileRead(GenT::RCC, qrcContent, QrcFile_)) {
- RccListParseContent(qrcContent, Inputs_);
- }
- }
-
- if (!Inputs_.empty()) {
- // Convert relative paths to absolute paths
- RccListConvertFullPath(QrcFileDir_, Inputs_);
- }
-
- return true;
-}
-
-bool cmQtAutoGeneratorRcc::TestResources()
-{
- if (Inputs_.empty()) {
- return true;
- }
- {
- std::string error;
- for (std::string const& resFile : Inputs_) {
- // Check if the resource file exists
- if (!FileSys().FileExists(resFile)) {
- error = "Could not find the resource file\n ";
- error += Quoted(resFile);
- error += '\n';
- Log().ErrorFile(GenT::RCC, QrcFile_, error);
- Error_ = true;
- break;
- }
- // Check if the resource file is newer than the build file
- if (FileSys().FileIsOlderThan(RccFileOutput_, resFile, &error)) {
- if (Log().Verbose()) {
- std::string reason = "Generating ";
- reason += Quoted(RccFileOutput_);
- reason += " from ";
- reason += Quoted(QrcFile_);
- reason += " because it is older than ";
- reason += Quoted(resFile);
- Log().Info(GenT::RCC, reason);
- }
- Generate_ = true;
- break;
- }
- // Print error and break on demand
- if (!error.empty()) {
- Log().ErrorFile(GenT::RCC, QrcFile_, error);
- Error_ = true;
- break;
- }
- }
- }
-
- return Generate_;
-}
-
-void cmQtAutoGeneratorRcc::TestInfoFile()
-{
- // Test if the rcc output file is older than the info file
- {
- bool isOlder = false;
- {
- std::string error;
- isOlder = FileSys().FileIsOlderThan(RccFileOutput_, InfoFile(), &error);
- if (!error.empty()) {
- Log().ErrorFile(GenT::RCC, QrcFile_, error);
- Error_ = true;
- }
- }
- if (isOlder) {
- if (Log().Verbose()) {
- std::string reason = "Touching ";
- reason += Quoted(RccFileOutput_);
- reason += " because it is older than ";
- reason += Quoted(InfoFile());
- Log().Info(GenT::RCC, reason);
- }
- // Touch build file
- FileSys().Touch(RccFileOutput_);
- BuildFileChanged_ = true;
- }
- }
-}
-
-void cmQtAutoGeneratorRcc::GenerateParentDir()
-{
- // Make sure the parent directory exists
- if (!FileSys().MakeParentDirectory(GenT::RCC, RccFileOutput_)) {
- Error_ = true;
- }
-}
-
-/**
- * @return True when finished
- */
-bool cmQtAutoGeneratorRcc::GenerateRcc()
-{
- if (!Generate_) {
- // Nothing to do
- return true;
- }
-
- if (Process_) {
- // Process is running already
- if (Process_->IsFinished()) {
- // Process is finished
- if (!ProcessResult_.error()) {
- // Rcc process success
- // Print rcc output
- if (!ProcessResult_.StdOut.empty()) {
- Log().Info(GenT::RCC, ProcessResult_.StdOut);
- }
- BuildFileChanged_ = true;
- } else {
- // Rcc process failed
- {
- std::string emsg = "The rcc process failed to compile\n ";
- emsg += Quoted(QrcFile_);
- emsg += "\ninto\n ";
- emsg += Quoted(RccFileOutput_);
- if (ProcessResult_.error()) {
- emsg += "\n";
- emsg += ProcessResult_.ErrorMessage;
- }
- Log().ErrorCommand(GenT::RCC, emsg, Process_->Setup().Command,
- ProcessResult_.StdOut);
- }
- FileSys().FileRemove(RccFileOutput_);
- Error_ = true;
- }
- // Clean up
- Process_.reset();
- ProcessResult_.reset();
- } else {
- // Process is not finished, yet.
- return false;
- }
- } else {
- // Start a rcc process
- std::vector<std::string> cmd;
- cmd.push_back(RccExecutable_);
- cmd.insert(cmd.end(), Options_.begin(), Options_.end());
- cmd.emplace_back("-o");
- cmd.push_back(RccFileOutput_);
- cmd.push_back(QrcFile_);
- // We're done here if the process fails to start
- return !StartProcess(AutogenBuildDir_, cmd, true);
- }
-
- return true;
-}
-
-void cmQtAutoGeneratorRcc::GenerateWrapper()
-{
- // Generate a wrapper source file on demand
- if (IsMultiConfig()) {
- // Wrapper file content
- std::string content;
- content += "// This is an autogenerated configuration wrapper file.\n";
- content += "// Changes will be overwritten.\n";
- content += "#include <";
- content += MultiConfigOutput();
- content += ">\n";
-
- // Write content to file
- if (FileSys().FileDiffers(RccFilePublic_, content)) {
- // Write new wrapper file
- if (Log().Verbose()) {
- Log().Info(GenT::RCC, "Generating RCC wrapper file " + RccFilePublic_);
- }
- if (!FileSys().FileWrite(GenT::RCC, RccFilePublic_, content)) {
- Log().ErrorFile(GenT::RCC, RccFilePublic_,
- "RCC wrapper file writing failed");
- Error_ = true;
- }
- } else if (BuildFileChanged_) {
- // Just touch the wrapper file
- if (Log().Verbose()) {
- Log().Info(GenT::RCC, "Touching RCC wrapper file " + RccFilePublic_);
- }
- FileSys().Touch(RccFilePublic_);
- }
- }
-}
-
-bool cmQtAutoGeneratorRcc::StartProcess(
- std::string const& workingDirectory, std::vector<std::string> const& command,
- bool mergedOutput)
-{
- // Log command
- if (Log().Verbose()) {
- std::string msg = "Running command:\n";
- msg += QuotedCommand(command);
- msg += '\n';
- Log().Info(GenT::RCC, msg);
- }
-
- // Create process handler
- Process_ = cm::make_unique<ReadOnlyProcessT>();
- Process_->setup(&ProcessResult_, mergedOutput, command, workingDirectory);
- // Start process
- if (!Process_->start(UVLoop(), [this] { UVRequest().send(); })) {
- Log().ErrorFile(GenT::RCC, QrcFile_, ProcessResult_.ErrorMessage);
- Error_ = true;
- // Clean up
- Process_.reset();
- ProcessResult_.reset();
- return false;
- }
- return true;
-}
diff --git a/Source/cmQtAutoRcc.cxx b/Source/cmQtAutoRcc.cxx
new file mode 100644
index 0000000..e58324d
--- /dev/null
+++ b/Source/cmQtAutoRcc.cxx
@@ -0,0 +1,516 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#include "cmQtAutoRcc.h"
+#include "cmQtAutoGen.h"
+
+#include "cmAlgorithms.h"
+#include "cmCryptoHash.h"
+#include "cmDuration.h"
+#include "cmFileLockResult.h"
+#include "cmMakefile.h"
+#include "cmProcessOutput.h"
+#include "cmSystemTools.h"
+
+// -- Class methods
+
+cmQtAutoRcc::cmQtAutoRcc() = default;
+
+cmQtAutoRcc::~cmQtAutoRcc() = default;
+
+bool cmQtAutoRcc::Init(cmMakefile* makefile)
+{
+ // -- Utility lambdas
+ auto InfoGet = [makefile](std::string const& key) {
+ return makefile->GetSafeDefinition(key);
+ };
+ auto InfoGetList =
+ [makefile](std::string const& key) -> std::vector<std::string> {
+ std::vector<std::string> list;
+ cmSystemTools::ExpandListArgument(makefile->GetSafeDefinition(key), list);
+ return list;
+ };
+ auto InfoGetConfig = [makefile,
+ this](std::string const& key) -> std::string {
+ const char* valueConf = nullptr;
+ {
+ std::string keyConf = key;
+ keyConf += '_';
+ keyConf += InfoConfig();
+ valueConf = makefile->GetDefinition(keyConf);
+ }
+ if (valueConf == nullptr) {
+ return makefile->GetSafeDefinition(key);
+ }
+ return std::string(valueConf);
+ };
+ auto InfoGetConfigList =
+ [&InfoGetConfig](std::string const& key) -> std::vector<std::string> {
+ std::vector<std::string> list;
+ cmSystemTools::ExpandListArgument(InfoGetConfig(key), list);
+ return list;
+ };
+
+ // -- Read info file
+ if (!makefile->ReadListFile(InfoFile())) {
+ Log().ErrorFile(GenT::RCC, InfoFile(), "File processing failed.");
+ return false;
+ }
+
+ // - Configurations
+ Log().RaiseVerbosity(InfoGet("ARCC_VERBOSITY"));
+ MultiConfig_ = makefile->IsOn("ARCC_MULTI_CONFIG");
+
+ // - Directories
+ AutogenBuildDir_ = InfoGet("ARCC_BUILD_DIR");
+ if (AutogenBuildDir_.empty()) {
+ Log().ErrorFile(GenT::RCC, InfoFile(), "Build directory empty.");
+ return false;
+ }
+
+ IncludeDir_ = InfoGetConfig("ARCC_INCLUDE_DIR");
+ if (IncludeDir_.empty()) {
+ Log().ErrorFile(GenT::RCC, InfoFile(), "Include directory empty.");
+ return false;
+ }
+
+ // - Rcc executable
+ RccExecutable_ = InfoGet("ARCC_RCC_EXECUTABLE");
+ RccListOptions_ = InfoGetList("ARCC_RCC_LIST_OPTIONS");
+
+ // - Job
+ LockFile_ = InfoGet("ARCC_LOCK_FILE");
+ QrcFile_ = InfoGet("ARCC_SOURCE");
+ QrcFileName_ = cmSystemTools::GetFilenameName(QrcFile_);
+ QrcFileDir_ = cmSystemTools::GetFilenamePath(QrcFile_);
+ RccPathChecksum_ = InfoGet("ARCC_OUTPUT_CHECKSUM");
+ RccFileName_ = InfoGet("ARCC_OUTPUT_NAME");
+ Options_ = InfoGetConfigList("ARCC_OPTIONS");
+ Inputs_ = InfoGetList("ARCC_INPUTS");
+
+ // - Settings file
+ SettingsFile_ = InfoGetConfig("ARCC_SETTINGS_FILE");
+
+ // - Validity checks
+ if (LockFile_.empty()) {
+ Log().ErrorFile(GenT::RCC, InfoFile(), "Lock file name missing.");
+ return false;
+ }
+ if (SettingsFile_.empty()) {
+ Log().ErrorFile(GenT::RCC, InfoFile(), "Settings file name missing.");
+ return false;
+ }
+ if (AutogenBuildDir_.empty()) {
+ Log().ErrorFile(GenT::RCC, InfoFile(), "Autogen build directory missing.");
+ return false;
+ }
+ if (RccExecutable_.empty()) {
+ Log().ErrorFile(GenT::RCC, InfoFile(), "rcc executable missing.");
+ return false;
+ }
+ if (QrcFile_.empty()) {
+ Log().ErrorFile(GenT::RCC, InfoFile(), "rcc input file missing.");
+ return false;
+ }
+ if (RccFileName_.empty()) {
+ Log().ErrorFile(GenT::RCC, InfoFile(), "rcc output file missing.");
+ return false;
+ }
+
+ // Init derived information
+ // ------------------------
+
+ RccFilePublic_ = AutogenBuildDir_;
+ RccFilePublic_ += '/';
+ RccFilePublic_ += RccPathChecksum_;
+ RccFilePublic_ += '/';
+ RccFilePublic_ += RccFileName_;
+
+ // Compute rcc output file name
+ if (IsMultiConfig()) {
+ RccFileOutput_ = IncludeDir_;
+ RccFileOutput_ += '/';
+ RccFileOutput_ += MultiConfigOutput();
+ } else {
+ RccFileOutput_ = RccFilePublic_;
+ }
+
+ return true;
+}
+
+bool cmQtAutoRcc::Process()
+{
+ if (!SettingsFileRead()) {
+ return false;
+ }
+
+ // Test if the rcc output needs to be regenerated
+ bool generate = false;
+ if (!TestQrcRccFiles(generate)) {
+ return false;
+ }
+ if (!generate && !TestResources(generate)) {
+ return false;
+ }
+ // Generate on demand
+ if (generate) {
+ if (!GenerateRcc()) {
+ return false;
+ }
+ } else {
+ // Test if the info file is newer than the output file
+ if (!TestInfoFile()) {
+ return false;
+ }
+ }
+
+ if (!GenerateWrapper()) {
+ return false;
+ }
+
+ return SettingsFileWrite();
+}
+
+std::string cmQtAutoRcc::MultiConfigOutput() const
+{
+ static std::string const suffix = "_CMAKE_";
+ std::string res;
+ res += RccPathChecksum_;
+ res += '/';
+ res += AppendFilenameSuffix(RccFileName_, suffix);
+ return res;
+}
+
+bool cmQtAutoRcc::SettingsFileRead()
+{
+ // Compose current settings strings
+ {
+ cmCryptoHash crypt(cmCryptoHash::AlgoSHA256);
+ std::string const sep(" ~~~ ");
+ {
+ std::string str;
+ str += RccExecutable_;
+ str += sep;
+ str += cmJoin(RccListOptions_, ";");
+ str += sep;
+ str += QrcFile_;
+ str += sep;
+ str += RccPathChecksum_;
+ str += sep;
+ str += RccFileName_;
+ str += sep;
+ str += cmJoin(Options_, ";");
+ str += sep;
+ str += cmJoin(Inputs_, ";");
+ str += sep;
+ SettingsString_ = crypt.HashString(str);
+ }
+ }
+
+ // Make sure the settings file exists
+ if (!cmSystemTools::FileExists(SettingsFile_, true)) {
+ // Touch the settings file to make sure it exists
+ if (!cmSystemTools::Touch(SettingsFile_, true)) {
+ Log().ErrorFile(GenT::RCC, SettingsFile_,
+ "Settings file creation failed.");
+ return false;
+ }
+ }
+
+ // Lock the lock file
+ {
+ // Make sure the lock file exists
+ if (!cmSystemTools::FileExists(LockFile_, true)) {
+ if (!cmSystemTools::Touch(LockFile_, true)) {
+ Log().ErrorFile(GenT::RCC, LockFile_, "Lock file creation failed.");
+ return false;
+ }
+ }
+ // Lock the lock file
+ cmFileLockResult lockResult =
+ LockFileLock_.Lock(LockFile_, static_cast<unsigned long>(-1));
+ if (!lockResult.IsOk()) {
+ Log().ErrorFile(GenT::RCC, LockFile_,
+ "File lock failed: " + lockResult.GetOutputMessage());
+ return false;
+ }
+ }
+
+ // Read old settings
+ {
+ std::string content;
+ if (FileRead(content, SettingsFile_)) {
+ SettingsChanged_ = (SettingsString_ != SettingsFind(content, "rcc"));
+ // In case any setting changed clear the old settings file.
+ // This triggers a full rebuild on the next run if the current
+ // build is aborted before writing the current settings in the end.
+ if (SettingsChanged_) {
+ std::string error;
+ if (!FileWrite(SettingsFile_, "", &error)) {
+ Log().ErrorFile(GenT::RCC, SettingsFile_,
+ "Settings file clearing failed. " + error);
+ return false;
+ }
+ }
+ } else {
+ SettingsChanged_ = true;
+ }
+ }
+
+ return true;
+}
+
+bool cmQtAutoRcc::SettingsFileWrite()
+{
+ // Only write if any setting changed
+ if (SettingsChanged_) {
+ if (Log().Verbose()) {
+ Log().Info(GenT::RCC, "Writing settings file " + Quoted(SettingsFile_));
+ }
+ // Write settings file
+ std::string content = "rcc:";
+ content += SettingsString_;
+ content += '\n';
+ std::string error;
+ if (!FileWrite(SettingsFile_, content, &error)) {
+ Log().ErrorFile(GenT::RCC, SettingsFile_,
+ "Settings file writing failed. " + error);
+ // Remove old settings file to trigger a full rebuild on the next run
+ cmSystemTools::RemoveFile(SettingsFile_);
+ return false;
+ }
+ }
+
+ // Unlock the lock file
+ LockFileLock_.Release();
+ return true;
+}
+
+/// Do basic checks if rcc generation is required
+bool cmQtAutoRcc::TestQrcRccFiles(bool& generate)
+{
+ // Test if the rcc input file exists
+ if (!QrcFileTime_.Load(QrcFile_)) {
+ std::string error;
+ error = "The resources file ";
+ error += Quoted(QrcFile_);
+ error += " does not exist";
+ Log().ErrorFile(GenT::RCC, QrcFile_, error);
+ return false;
+ }
+
+ // Test if the rcc output file exists
+ if (!RccFileTime_.Load(RccFileOutput_)) {
+ if (Log().Verbose()) {
+ std::string reason = "Generating ";
+ reason += Quoted(RccFileOutput_);
+ reason += " from its source file ";
+ reason += Quoted(QrcFile_);
+ reason += " because it doesn't exist";
+ Log().Info(GenT::RCC, reason);
+ }
+ generate = true;
+ return true;
+ }
+
+ // Test if the settings changed
+ if (SettingsChanged_) {
+ if (Log().Verbose()) {
+ std::string reason = "Generating ";
+ reason += Quoted(RccFileOutput_);
+ reason += " from ";
+ reason += Quoted(QrcFile_);
+ reason += " because the RCC settings changed";
+ Log().Info(GenT::RCC, reason);
+ }
+ generate = true;
+ return true;
+ }
+
+ // Test if the rcc output file is older than the .qrc file
+ if (RccFileTime_.Older(QrcFileTime_)) {
+ if (Log().Verbose()) {
+ std::string reason = "Generating ";
+ reason += Quoted(RccFileOutput_);
+ reason += " because it is older than ";
+ reason += Quoted(QrcFile_);
+ Log().Info(GenT::RCC, reason);
+ }
+ generate = true;
+ return true;
+ }
+
+ return true;
+}
+
+bool cmQtAutoRcc::TestResources(bool& generate)
+{
+ // Read resource files list
+ if (Inputs_.empty()) {
+ std::string error;
+ RccLister const lister(RccExecutable_, RccListOptions_);
+ if (!lister.list(QrcFile_, Inputs_, error, Log().Verbose())) {
+ Log().ErrorFile(GenT::RCC, QrcFile_, error);
+ return false;
+ }
+ }
+
+ for (std::string const& resFile : Inputs_) {
+ // Check if the resource file exists
+ cmFileTime fileTime;
+ if (!fileTime.Load(resFile)) {
+ std::string error;
+ error = "Could not find the resource file\n ";
+ error += Quoted(resFile);
+ error += '\n';
+ Log().ErrorFile(GenT::RCC, QrcFile_, error);
+ return false;
+ }
+ // Check if the resource file is newer than the build file
+ if (RccFileTime_.Older(fileTime)) {
+ if (Log().Verbose()) {
+ std::string reason = "Generating ";
+ reason += Quoted(RccFileOutput_);
+ reason += " from ";
+ reason += Quoted(QrcFile_);
+ reason += " because it is older than ";
+ reason += Quoted(resFile);
+ Log().Info(GenT::RCC, reason);
+ }
+ generate = true;
+ break;
+ }
+ }
+ return true;
+}
+
+bool cmQtAutoRcc::TestInfoFile()
+{
+ // Test if the rcc output file is older than the info file
+
+ cmFileTime infoFileTime;
+ if (!infoFileTime.Load(InfoFile())) {
+ std::string error;
+ error = "Could not find the info file ";
+ error += Quoted(InfoFile());
+ error += '\n';
+ Log().ErrorFile(GenT::RCC, QrcFile_, error);
+ return false;
+ }
+ if (RccFileTime_.Older(infoFileTime)) {
+ if (Log().Verbose()) {
+ std::string reason = "Touching ";
+ reason += Quoted(RccFileOutput_);
+ reason += " because it is older than ";
+ reason += Quoted(InfoFile());
+ Log().Info(GenT::RCC, reason);
+ }
+ // Touch build file
+ if (!cmSystemTools::Touch(RccFileOutput_, false)) {
+ Log().ErrorFile(GenT::RCC, RccFileOutput_, "Build file touch failed");
+ return false;
+ }
+ BuildFileChanged_ = true;
+ }
+
+ return true;
+}
+
+bool cmQtAutoRcc::GenerateRcc()
+{
+ // Make parent directory
+ if (!MakeParentDirectory(RccFileOutput_)) {
+ Log().ErrorFile(GenT::RCC, RccFileOutput_,
+ "Could not create parent directory");
+ return false;
+ }
+
+ // Start a rcc process
+ std::vector<std::string> cmd;
+ cmd.push_back(RccExecutable_);
+ cmd.insert(cmd.end(), Options_.begin(), Options_.end());
+ cmd.emplace_back("-o");
+ cmd.push_back(RccFileOutput_);
+ cmd.push_back(QrcFile_);
+
+ // Log command
+ if (Log().Verbose()) {
+ std::string msg = "Running command:\n";
+ msg += QuotedCommand(cmd);
+ msg += '\n';
+ cmSystemTools::Stdout(msg);
+ }
+
+ std::string rccStdOut;
+ std::string rccStdErr;
+ int retVal = 0;
+ bool result = cmSystemTools::RunSingleCommand(
+ cmd, &rccStdOut, &rccStdErr, &retVal, AutogenBuildDir_.c_str(),
+ cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto);
+ if (!result || (retVal != 0)) {
+ // rcc process failed
+ {
+ std::string err = "The rcc process failed to compile\n ";
+ err += Quoted(QrcFile_);
+ err += "\ninto\n ";
+ err += Quoted(RccFileOutput_);
+ Log().ErrorCommand(GenT::RCC, err, cmd, rccStdOut + rccStdErr);
+ }
+ cmSystemTools::RemoveFile(RccFileOutput_);
+ return false;
+ }
+
+ // rcc process success
+ // Print rcc output
+ if (!rccStdOut.empty()) {
+ Log().Info(GenT::RCC, rccStdOut);
+ }
+ BuildFileChanged_ = true;
+
+ return true;
+}
+
+bool cmQtAutoRcc::GenerateWrapper()
+{
+ // Generate a wrapper source file on demand
+ if (IsMultiConfig()) {
+ // Wrapper file content
+ std::string content;
+ content += "// This is an autogenerated configuration wrapper file.\n";
+ content += "// Changes will be overwritten.\n";
+ content += "#include <";
+ content += MultiConfigOutput();
+ content += ">\n";
+
+ // Compare with existing file content
+ bool fileDiffers = true;
+ {
+ std::string oldContents;
+ if (FileRead(oldContents, RccFilePublic_)) {
+ fileDiffers = (oldContents != content);
+ }
+ }
+ if (fileDiffers) {
+ // Write new wrapper file
+ if (Log().Verbose()) {
+ Log().Info(GenT::RCC, "Generating RCC wrapper file " + RccFilePublic_);
+ }
+ std::string error;
+ if (!FileWrite(RccFilePublic_, content, &error)) {
+ Log().ErrorFile(GenT::RCC, RccFilePublic_,
+ "RCC wrapper file writing failed. " + error);
+ return false;
+ }
+ } else if (BuildFileChanged_) {
+ // Just touch the wrapper file
+ if (Log().Verbose()) {
+ Log().Info(GenT::RCC, "Touching RCC wrapper file " + RccFilePublic_);
+ }
+ if (!cmSystemTools::Touch(RccFilePublic_, false)) {
+ Log().ErrorFile(GenT::RCC, RccFilePublic_,
+ "RCC wrapper file touch failed.");
+ return false;
+ }
+ }
+ }
+ return true;
+}
diff --git a/Source/cmQtAutoGeneratorRcc.h b/Source/cmQtAutoRcc.h
index 1ec1c4a..8dc9179 100644
--- a/Source/cmQtAutoGeneratorRcc.h
+++ b/Source/cmQtAutoRcc.h
@@ -1,13 +1,13 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmQtAutoGeneratorRcc_h
-#define cmQtAutoGeneratorRcc_h
+#ifndef cmQtAutoRcc_h
+#define cmQtAutoRcc_h
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmFileLock.h"
+#include "cmFileTime.h"
#include "cmQtAutoGenerator.h"
-#include "cm_uv.h"
#include <string>
#include <vector>
@@ -15,62 +15,38 @@
class cmMakefile;
// @brief AUTORCC generator
-class cmQtAutoGeneratorRcc : public cmQtAutoGenerator
+class cmQtAutoRcc : public cmQtAutoGenerator
{
public:
- cmQtAutoGeneratorRcc();
- ~cmQtAutoGeneratorRcc() override;
+ cmQtAutoRcc();
+ ~cmQtAutoRcc() override;
- cmQtAutoGeneratorRcc(cmQtAutoGeneratorRcc const&) = delete;
- cmQtAutoGeneratorRcc& operator=(cmQtAutoGeneratorRcc const&) = delete;
+ cmQtAutoRcc(cmQtAutoRcc const&) = delete;
+ cmQtAutoRcc& operator=(cmQtAutoRcc const&) = delete;
private:
- // -- Types
-
- /// @brief Processing stage
- enum class StageT : unsigned char
- {
- SETTINGS_READ,
- TEST_QRC_RCC_FILES,
- TEST_RESOURCES_READ,
- TEST_RESOURCES,
- TEST_INFO_FILE,
- GENERATE,
- GENERATE_RCC,
- GENERATE_WRAPPER,
- SETTINGS_WRITE,
- FINISH,
- END
- };
+ // -- Utility
+ Logger& Log() { return Logger_; }
+ bool IsMultiConfig() const { return MultiConfig_; }
+ std::string MultiConfigOutput() const;
// -- Abstract processing interface
bool Init(cmMakefile* makefile) override;
bool Process() override;
- // -- Process stage
- static void UVPollStage(uv_async_t* handle);
- void PollStage();
- void SetStage(StageT stage);
// -- Settings file
bool SettingsFileRead();
- void SettingsFileWrite();
+ bool SettingsFileWrite();
// -- Tests
- bool TestQrcRccFiles();
- bool TestResourcesRead();
- bool TestResources();
- void TestInfoFile();
+ bool TestQrcRccFiles(bool& generate);
+ bool TestResources(bool& generate);
+ bool TestInfoFile();
// -- Generation
- void GenerateParentDir();
bool GenerateRcc();
- void GenerateWrapper();
-
- // -- Utility
- bool IsMultiConfig() const { return MultiConfig_; }
- std::string MultiConfigOutput() const;
- bool StartProcess(std::string const& workingDirectory,
- std::vector<std::string> const& command,
- bool mergedOutput);
+ bool GenerateWrapper();
private:
+ // -- Logging
+ Logger Logger_;
// -- Config settings
bool MultiConfig_ = false;
// -- Directories
@@ -85,23 +61,18 @@ private:
std::string QrcFile_;
std::string QrcFileName_;
std::string QrcFileDir_;
+ cmFileTime QrcFileTime_;
std::string RccPathChecksum_;
std::string RccFileName_;
std::string RccFileOutput_;
std::string RccFilePublic_;
+ cmFileTime RccFileTime_;
std::vector<std::string> Options_;
std::vector<std::string> Inputs_;
- // -- Subprocess
- ProcessResultT ProcessResult_;
- std::unique_ptr<ReadOnlyProcessT> Process_;
// -- Settings file
std::string SettingsFile_;
std::string SettingsString_;
bool SettingsChanged_ = false;
- // -- libuv loop
- StageT Stage_ = StageT::SETTINGS_READ;
- bool Error_ = false;
- bool Generate_ = false;
bool BuildFileChanged_ = false;
};
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx
index b7216b0..2064275 100644
--- a/Source/cmRST.cxx
+++ b/Source/cmRST.cxx
@@ -457,6 +457,12 @@ void cmRST::UnindentLines(std::vector<std::string>& lines)
size_t trailingEmpty =
std::distance(rit, cmFindNot(cmReverseRange(lines), std::string()));
+ if ((leadingEmpty + trailingEmpty) >= lines.size()) {
+ // All lines are empty. The markup block is empty. Leave only one.
+ lines.resize(1);
+ return;
+ }
+
std::vector<std::string>::iterator contentEnd = cmRotate(
lines.begin(), lines.begin() + leadingEmpty, lines.end() - trailingEmpty);
lines.erase(contentEnd, lines.end());
diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx
index 34ded38..2bc4c39 100644
--- a/Source/cmSourceGroupCommand.cxx
+++ b/Source/cmSourceGroupCommand.cxx
@@ -77,6 +77,7 @@ std::vector<std::string> prepareFilesPathsForTree(
const std::string& currentSourceDir)
{
std::vector<std::string> prepared;
+ prepared.reserve(filesPaths.size());
for (auto const& filePath : filesPaths) {
prepared.push_back(prepareFilePathForTree(filePath, currentSourceDir));
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index cf9f064..c18c256 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -8,7 +8,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmQtAutoGeneratorMocUic.h"
-#include "cmQtAutoGeneratorRcc.h"
+#include "cmQtAutoRcc.h"
#include "cmRange.h"
#include "cmState.h"
#include "cmStateDirectory.h"
@@ -1024,7 +1024,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
return autoGen.Run(infoDir, config) ? 0 : 1;
}
if ((args[1] == "cmake_autorcc") && (args.size() >= 3)) {
- cmQtAutoGeneratorRcc autoGen;
+ cmQtAutoRcc autoGen;
std::string const& infoFile = args[2];
std::string config;
if (args.size() > 3) {
diff --git a/Tests/CMakeLib/testRST.expect b/Tests/CMakeLib/testRST.expect
index d7b91d1..c19ee94 100644
--- a/Tests/CMakeLib/testRST.expect
+++ b/Tests/CMakeLib/testRST.expect
@@ -83,6 +83,10 @@ or after a paragraph ending in two colons::
but not after a line ending in two colons::
in the middle of a paragraph.
+A literal block can be empty::
+
+
+
.. productionlist::
grammar: `production`
production: "content rendered"
diff --git a/Tests/CMakeLib/testRST.rst b/Tests/CMakeLib/testRST.rst
index 633219f..d2d1140 100644
--- a/Tests/CMakeLib/testRST.rst
+++ b/Tests/CMakeLib/testRST.rst
@@ -90,6 +90,10 @@ or after a paragraph ending in two colons::
but not after a line ending in two colons::
in the middle of a paragraph.
+A literal block can be empty::
+
+
+
.. productionlist::
grammar: `production`
production: "content rendered"
diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-Exclude-check.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-Exclude-check.cmake
new file mode 100644
index 0000000..605ae4d
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/FILTER-Exclude-check.cmake
@@ -0,0 +1,6 @@
+file(READ "${RunCMake_TEST_BINARY_DIR}/FILTER-generated.txt" content)
+
+set(expected "DO_NOT_FILTER_THIS;thisisanitem")
+if(NOT content STREQUAL expected)
+ set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]")
+endif()
diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-Exclude.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-Exclude.cmake
new file mode 100644
index 0000000..b879be2
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/FILTER-Exclude.cmake
@@ -0,0 +1,4 @@
+cmake_policy(VERSION 3.11)
+
+set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING)
+file(GENERATE OUTPUT "FILTER-generated.txt" CONTENT "$<FILTER:${mylist},EXCLUDE,^FILTER_THIS_.+>")
diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-Include-check.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-Include-check.cmake
new file mode 100644
index 0000000..9d48d98
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/FILTER-Include-check.cmake
@@ -0,0 +1,6 @@
+file(READ "${RunCMake_TEST_BINARY_DIR}/FILTER-generated.txt" content)
+
+set(expected "FILTER_THIS_BIT;FILTER_THIS_THING")
+if(NOT content STREQUAL expected)
+ set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]")
+endif()
diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-Include.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-Include.cmake
new file mode 100644
index 0000000..5e0260a
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/FILTER-Include.cmake
@@ -0,0 +1,4 @@
+cmake_policy(VERSION 3.11)
+
+set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING)
+file(GENERATE OUTPUT "FILTER-generated.txt" CONTENT "$<FILTER:${mylist},INCLUDE,^FILTER_THIS_.+>")
diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-result.txt b/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-stderr.txt b/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-stderr.txt
new file mode 100644
index 0000000..dd10925
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at FILTER-InvalidOperator.cmake:3 \(file\):
+ Error evaluating generator expression:
+
+ \$<FILTER:,RM,>
+
+ \$<FILTER:...> second parameter must be either INCLUDE or EXCLUDE
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator.cmake
new file mode 100644
index 0000000..26f3917
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator.cmake
@@ -0,0 +1,3 @@
+cmake_policy(VERSION 3.11)
+
+file(GENERATE OUTPUT "FILTER-generated.txt" CONTENT "$<FILTER:,RM,>")
diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-empty-check.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-empty-check.cmake
new file mode 100644
index 0000000..2844484
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/FILTER-empty-check.cmake
@@ -0,0 +1,6 @@
+file(READ "${RunCMake_TEST_BINARY_DIR}/FILTER-generated.txt" content)
+
+set(expected "")
+if(NOT content STREQUAL expected)
+ set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]")
+endif()
diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-empty.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-empty.cmake
new file mode 100644
index 0000000..e0fc671
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/FILTER-empty.cmake
@@ -0,0 +1,3 @@
+cmake_policy(VERSION 3.11)
+
+file(GENERATE OUTPUT "FILTER-generated.txt" CONTENT "$<FILTER:,INCLUDE,>")
diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-result.txt b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt
new file mode 100644
index 0000000..783bfb3
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at ImportedTarget-TARGET_PDB_OUTPUT_NAME.cmake:2 \(add_custom_target\):
+ Error evaluating generator expression:
+
+ \$<TARGET_PDB_OUTPUT_NAME:empty>
+
+ TARGET_PDB_OUTPUT_NAME not allowed for IMPORTED targets.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME.cmake b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME.cmake
new file mode 100644
index 0000000..010b38e
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME.cmake
@@ -0,0 +1,2 @@
+add_library(empty UNKNOWN IMPORTED)
+add_custom_target(custom COMMAND echo $<TARGET_PDB_OUTPUT_NAME:empty>)
diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-stderr.txt
new file mode 100644
index 0000000..00ec496
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at NonValidCompiler-TARGET_PDB_OUTPUT_NAME.cmake:6 \(file\):
+ Error evaluating generator expression:
+
+ \$<TARGET_PDB_OUTPUT_NAME:empty>
+
+ TARGET_PDB_OUTPUT_NAME is not supported by the target linker.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME.cmake b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME.cmake
new file mode 100644
index 0000000..07951de
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME.cmake
@@ -0,0 +1,9 @@
+
+enable_language(C)
+
+add_library(empty STATIC empty.c)
+
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt"
+ CONTENT "[$<TARGET_PDB_OUTPUT_NAME:empty>]"
+)
diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt
new file mode 100644
index 0000000..8ac349e
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt
@@ -0,0 +1,9 @@
+CMake Error at NonValidTarget-TARGET_PDB_OUTPUT_NAME.cmake:6 \(file\):
+ Error evaluating generator expression:
+
+ \$<TARGET_PDB_OUTPUT_NAME:empty>
+
+ TARGET_PDB_OUTPUT_NAME is allowed only for targets with linker created
+ artifacts.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME.cmake
new file mode 100644
index 0000000..07951de
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME.cmake
@@ -0,0 +1,9 @@
+
+enable_language(C)
+
+add_library(empty STATIC empty.c)
+
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt"
+ CONTENT "[$<TARGET_PDB_OUTPUT_NAME:empty>]"
+)
diff --git a/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion-stderr.txt b/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion-stderr.txt
index bf592e7..013c4f2 100644
--- a/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion-stderr.txt
+++ b/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion-stderr.txt
@@ -1,4 +1,10 @@
CMake Error at OUTPUT_NAME-recursion.cmake:[0-9]+ \(add_executable\):
- Target 'empty1' OUTPUT_NAME depends on itself.
+ Target 'empty2' OUTPUT_NAME depends on itself.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+
+
+CMake Error at OUTPUT_NAME-recursion.cmake:[0-9]+ \(add_executable\):
+ Target 'empty2' OUTPUT_NAME depends on itself.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion.cmake b/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion.cmake
index 5cb8050..775f68a 100644
--- a/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion.cmake
+++ b/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion.cmake
@@ -1,3 +1,6 @@
enable_language(C)
add_executable(empty1 empty.c)
set_property(TARGET empty1 PROPERTY OUTPUT_NAME $<TARGET_FILE_NAME:empty1>)
+
+add_executable(empty2 empty.c)
+set_property(TARGET empty2 PROPERTY OUTPUT_NAME $<TARGET_OUTPUT_NAME:empty2>)
diff --git a/Tests/RunCMake/GeneratorExpression/ResultValidator.cmake b/Tests/RunCMake/GeneratorExpression/ResultValidator.cmake
new file mode 100644
index 0000000..722ae05
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/ResultValidator.cmake
@@ -0,0 +1,6 @@
+
+function (CHECK_VALUE test_msg value expected)
+ if (NOT value STREQUAL expected)
+ string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [[${value}]]\nbut expected:\n [[${expected}]]\n")
+ endif()
+endfunction()
diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
index 63c12a9..4202064 100644
--- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
@@ -33,6 +33,10 @@ run_cmake(COMPILE_LANGUAGE-add_test)
run_cmake(COMPILE_LANGUAGE-unknown-lang)
run_cmake(TARGET_FILE-recursion)
run_cmake(OUTPUT_NAME-recursion)
+run_cmake(TARGET_OUTPUT_NAME)
+run_cmake(TARGET_OUTPUT_NAME-imported-target)
+run_cmake(TARGET_OUTPUT_NAME-non-valid-target)
+run_cmake(TARGET_LINKER_OUTPUT_NAME-non-valid-target)
run_cmake(TARGET_PROPERTY-LOCATION)
run_cmake(TARGET_PROPERTY-SOURCES)
run_cmake(LINK_ONLY-not-linking)
@@ -58,15 +62,23 @@ run_cmake(REMOVE_DUPLICATES-1)
run_cmake(REMOVE_DUPLICATES-2)
run_cmake(REMOVE_DUPLICATES-3)
run_cmake(REMOVE_DUPLICATES-4)
+run_cmake(FILTER-empty)
+run_cmake(FILTER-InvalidOperator)
+run_cmake(FILTER-Exclude)
+run_cmake(FILTER-Include)
run_cmake(ImportedTarget-TARGET_BUNDLE_DIR)
run_cmake(ImportedTarget-TARGET_BUNDLE_CONTENT_DIR)
run_cmake(ImportedTarget-TARGET_PDB_FILE)
+run_cmake(ImportedTarget-TARGET_PDB_OUTPUT_NAME)
if(LINKER_SUPPORTS_PDB)
run_cmake(NonValidTarget-TARGET_PDB_FILE)
run_cmake(ValidTarget-TARGET_PDB_FILE)
+ run_cmake(NonValidTarget-TARGET_PDB_OUTPUT_NAME)
+ run_cmake(ValidTarget-TARGET_PDB_OUTPUT_NAME)
else()
run_cmake(NonValidCompiler-TARGET_PDB_FILE)
+ run_cmake(NonValidCompiler-TARGET_PDB_OUTPUT_NAME)
endif()
set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0085:STRING=OLD)
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-stderr.txt
new file mode 100644
index 0000000..29f6211
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake:6 \(file\):
+ Error evaluating generator expression:
+
+ \$<TARGET_LINKER_OUTPUT_NAME:empty>
+
+ Target "empty" is not an executable or library\.
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake
new file mode 100644
index 0000000..e1496b4
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake
@@ -0,0 +1,9 @@
+
+enable_language(C)
+
+add_custom_target(empty)
+
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt"
+ CONTENT "[$<TARGET_LINKER_OUTPUT_NAME:empty>]"
+)
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-check.cmake
new file mode 100644
index 0000000..fa4f2b9
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-check.cmake
@@ -0,0 +1,2 @@
+
+include ("${RunCMake_TEST_BINARY_DIR}/TARGET_OUTPUT_NAME-generated.cmake")
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target-check.cmake
new file mode 100644
index 0000000..fa4f2b9
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target-check.cmake
@@ -0,0 +1,2 @@
+
+include ("${RunCMake_TEST_BINARY_DIR}/TARGET_OUTPUT_NAME-generated.cmake")
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target.cmake
new file mode 100644
index 0000000..548a2d7
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target.cmake
@@ -0,0 +1,79 @@
+
+cmake_minimum_required(VERSION 3.14)
+
+enable_language (C)
+
+set (GENERATE_CONTENT [[
+macro (CHECK_VALUE test_msg value expected)
+ if (NOT "${value}" STREQUAL "${expected}")
+ string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [${value}]\nbut expected:\n [${expected}]\n")
+ endif()
+endmacro()
+]])
+
+add_executable(exec1 IMPORTED)
+add_library (shared1 SHARED IMPORTED)
+add_library (static1 STATIC IMPORTED)
+
+string (APPEND GENERATE_CONTENT [[
+
+check_value ("TARGET_OUTPUT_NAME executable default" "$<TARGET_OUTPUT_NAME:exec1>" "exec1")
+check_value ("TARGET_OUTPUT_NAME shared default" "$<TARGET_OUTPUT_NAME:shared1>" "shared1")
+check_value ("TARGET_LINKER_OUTPUT_NAME shared linker default" "$<TARGET_LINKER_OUTPUT_NAME:shared1>" "shared1")
+check_value ("TARGET_OUTPUT_NAME static default" "$<TARGET_OUTPUT_NAME:static1>" "static1")
+check_value ("TARGET_LINKER_OUTPUT_NAME static linker default" "$<TARGET_LINKER_OUTPUT_NAME:static1>" "static1")
+]])
+
+
+add_executable (exec2 IMPORTED)
+set_property (TARGET exec2 PROPERTY OUTPUT_NAME exec2_custom)
+add_library (shared2 SHARED IMPORTED)
+set_property (TARGET shared2 PROPERTY OUTPUT_NAME shared2_custom)
+add_library (static2 STATIC IMPORTED)
+set_property (TARGET static2 PROPERTY OUTPUT_NAME static2_custom)
+
+string (APPEND GENERATE_CONTENT [[
+
+check_value ("TARGET_OUTPUT_NAME executable custom" "$<TARGET_OUTPUT_NAME:exec2>" "exec2_custom")
+check_value ("TARGET_OUTPUT_NAME shared custom" "$<TARGET_OUTPUT_NAME:shared2>" "shared2_custom")
+check_value ("TARGET_LINKER_OUTPUT_NAME shared linker custom" "$<TARGET_LINKER_OUTPUT_NAME:shared2>" "shared2_custom")
+check_value ("TARGET_OUTPUT_NAME static custom" "$<TARGET_OUTPUT_NAME:static2>" "static2_custom")
+check_value ("TARGET_LINKER_OUTPUT_NAME static linker custom" "$<TARGET_LINKER_OUTPUT_NAME:static2>" "static2_custom")
+]])
+
+
+add_executable (exec3 IMPORTED)
+set_property (TARGET exec3 PROPERTY RUNTIME_OUTPUT_NAME exec3_runtime)
+set_property (TARGET exec3 PROPERTY LIBRARY_OUTPUT_NAME exec3_library)
+set_property (TARGET exec3 PROPERTY ARCHIVE_OUTPUT_NAME exec3_archive)
+set_property (TARGET exec3 PROPERTY PDB_NAME exec3_pdb)
+add_library (shared3 SHARED IMPORTED)
+set_property (TARGET shared3 PROPERTY RUNTIME_OUTPUT_NAME shared3_runtime)
+set_property (TARGET shared3 PROPERTY LIBRARY_OUTPUT_NAME shared3_library)
+set_property (TARGET shared3 PROPERTY ARCHIVE_OUTPUT_NAME shared3_archive)
+set_property (TARGET shared3 PROPERTY PDB_NAME shared3_pdb)
+add_library (static3 STATIC IMPORTED)
+set_property (TARGET static3 PROPERTY RUNTIME_OUTPUT_NAME static3_runtime)
+set_property (TARGET static3 PROPERTY LIBRARY_OUTPUT_NAME static3_library)
+set_property (TARGET static3 PROPERTY ARCHIVE_OUTPUT_NAME static3_archive)
+set_property (TARGET static3 PROPERTY PDB_NAME static3_pdb)
+
+string (APPEND GENERATE_CONTENT [[
+
+check_value ("TARGET_OUTPUT_NAME executable all properties" "$<TARGET_OUTPUT_NAME:exec3>" "exec3_runtime")
+check_value ("TARGET_OUTPUT_NAME shared all properties" "$<TARGET_OUTPUT_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared3_runtime,shared3_library>")
+check_value ("TARGET_LINKER_OUTPUT_NAME shared linker all properties" "$<TARGET_LINKER_OUTPUT_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared3_archive,shared3_library>")
+check_value ("TARGET_OUTPUT_NAME static all properties" "$<TARGET_OUTPUT_NAME:static3>" "static3_archive")
+check_value ("TARGET_LINKER_OUTPUT_NAME static linker all properties" "$<TARGET_LINKER_OUTPUT_NAME:static3>" "static3_archive")
+]])
+
+
+unset(GENERATE_CONDITION)
+get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+if(_isMultiConfig)
+ list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG)
+ set(GENERATE_CONDITION CONDITION $<CONFIG:${FIRST_CONFIG}>)
+endif()
+
+file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_OUTPUT_NAME-generated.cmake"
+ CONTENT "${GENERATE_CONTENT}" ${GENERATE_CONDITION})
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-stderr.txt
new file mode 100644
index 0000000..e78ec01
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at TARGET_OUTPUT_NAME-non-valid-target.cmake:6 \(file\):
+ Error evaluating generator expression:
+
+ \$<TARGET_OUTPUT_NAME:empty>
+
+ Target "empty" is not an executable or library\.
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake
new file mode 100644
index 0000000..2ff733c
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake
@@ -0,0 +1,9 @@
+
+enable_language(C)
+
+add_custom_target(empty)
+
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt"
+ CONTENT "[$<TARGET_OUTPUT_NAME:empty>]"
+)
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME.cmake
new file mode 100644
index 0000000..b7bae15
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME.cmake
@@ -0,0 +1,96 @@
+
+cmake_minimum_required(VERSION 3.14)
+
+enable_language (C)
+
+set (GENERATE_CONTENT [[
+macro (CHECK_VALUE test_msg value expected)
+ if (NOT "${value}" STREQUAL "${expected}")
+ string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [${value}]\nbut expected:\n [${expected}]\n")
+ endif()
+endmacro()
+]])
+
+add_executable (exec1 empty.c)
+add_library (shared1 SHARED empty.c)
+add_library (static1 STATIC empty.c)
+
+string (APPEND GENERATE_CONTENT [[
+
+check_value ("TARGET_OUTPUT_NAME executable default" "$<TARGET_OUTPUT_NAME:exec1>" "exec1")
+check_value ("TARGET_OUTPUT_NAME shared default" "$<TARGET_OUTPUT_NAME:shared1>" "shared1")
+check_value ("TARGET_LINKER_OUTPUT_NAME shared linker default" "$<TARGET_LINKER_OUTPUT_NAME:shared1>" "shared1")
+check_value ("TARGET_OUTPUT_NAME static default" "$<TARGET_OUTPUT_NAME:static1>" "static1")
+check_value ("TARGET_LINKER_OUTPUT_NAME static linker default" "$<TARGET_LINKER_OUTPUT_NAME:static1>" "static1")
+]])
+if (CMAKE_C_LINKER_SUPPORTS_PDB)
+ string(APPEND GENERATE_CONTENT [[
+check_value ("TARGET_PDB_OUTPUT_NAME executable PDB default" "$<TARGET_PDB_OUTPUT_NAME:exec1>" "exec1")
+check_value ("TARGET_PDB_OUTPUT_NAME shared PDB default" "$<TARGET_PDB_OUTPUT_NAME:shared1>" "shared1")
+]])
+endif()
+
+
+add_executable (exec2 empty.c)
+set_property (TARGET exec2 PROPERTY OUTPUT_NAME exec2_custom)
+add_library (shared2 SHARED empty.c)
+set_property (TARGET shared2 PROPERTY OUTPUT_NAME shared2_custom)
+add_library (static2 STATIC empty.c)
+set_property (TARGET static2 PROPERTY OUTPUT_NAME static2_custom)
+
+string (APPEND GENERATE_CONTENT [[
+
+check_value ("TARGET_OUTPUT_NAME executable custom" "$<TARGET_OUTPUT_NAME:exec2>" "exec2_custom")
+check_value ("TARGET_OUTPUT_NAME shared custom" "$<TARGET_OUTPUT_NAME:shared2>" "shared2_custom")
+check_value ("TARGET_LINKER_OUTPUT_NAME shared linker custom" "$<TARGET_LINKER_OUTPUT_NAME:shared2>" "shared2_custom")
+check_value ("TARGET_OUTPUT_NAME static custom" "$<TARGET_OUTPUT_NAME:static2>" "static2_custom")
+check_value ("TARGET_LINKER_OUTPUT_NAME static linker custom" "$<TARGET_LINKER_OUTPUT_NAME:static2>" "static2_custom")
+]])
+if (CMAKE_C_LINKER_SUPPORTS_PDB)
+ string (APPEND GENERATE_CONTENT [[
+check_value ("TARGET_PDB_OUTPUT_NAME executable PDB custom" "$<TARGET_PDB_OUTPUT_NAME:exec2>" "exec2_custom")
+check_value ("TARGET_PDB_OUTPUT_NAME shared PDB custom" "$<TARGET_PDB_OUTPUT_NAME:shared2>" "shared2_custom")
+ ]])
+endif()
+
+add_executable (exec3 empty.c)
+set_property (TARGET exec3 PROPERTY RUNTIME_OUTPUT_NAME exec3_runtime)
+set_property (TARGET exec3 PROPERTY LIBRARY_OUTPUT_NAME exec3_library)
+set_property (TARGET exec3 PROPERTY ARCHIVE_OUTPUT_NAME exec3_archive)
+set_property (TARGET exec3 PROPERTY PDB_NAME exec3_pdb)
+add_library (shared3 SHARED empty.c)
+set_property (TARGET shared3 PROPERTY RUNTIME_OUTPUT_NAME shared3_runtime)
+set_property (TARGET shared3 PROPERTY LIBRARY_OUTPUT_NAME shared3_library)
+set_property (TARGET shared3 PROPERTY ARCHIVE_OUTPUT_NAME shared3_archive)
+set_property (TARGET shared3 PROPERTY PDB_NAME shared3_pdb)
+add_library (static3 STATIC empty.c)
+set_property (TARGET static3 PROPERTY RUNTIME_OUTPUT_NAME static3_runtime)
+set_property (TARGET static3 PROPERTY LIBRARY_OUTPUT_NAME static3_library)
+set_property (TARGET static3 PROPERTY ARCHIVE_OUTPUT_NAME static3_archive)
+set_property (TARGET static3 PROPERTY PDB_NAME static3_pdb)
+
+string (APPEND GENERATE_CONTENT [[
+
+check_value ("TARGET_OUTPUT_NAME executable all properties" "$<TARGET_OUTPUT_NAME:exec3>" "exec3_runtime")
+check_value ("TARGET_OUTPUT_NAME shared all properties" "$<TARGET_OUTPUT_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared3_runtime,shared3_library>")
+check_value ("TARGET_LINKER_OUTPUT_NAME shared linker all properties" "$<TARGET_LINKER_OUTPUT_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared3_archive,shared3_library>")
+check_value ("TARGET_OUTPUT_NAME static all properties" "$<TARGET_OUTPUT_NAME:static3>" "static3_archive")
+check_value ("TARGET_LINKER_OUTPUT_NAME static linker all properties" "$<TARGET_LINKER_OUTPUT_NAME:static3>" "static3_archive")
+]])
+if (CMAKE_C_LINKER_SUPPORTS_PDB)
+ string (APPEND GENERATE_CONTENT [[
+check_value ("TARGET_PDB_OUTPUT_NAME executable PDB all properties" "$<TARGET_PDB_OUTPUT_NAME:exec3>" "exec3_pdb")
+check_value ("TARGET_PDB_OUTPUT_NAME shared PDB all properties" "$<TARGET_PDB_OUTPUT_NAME:shared3>" "shared3_pdb")
+]])
+endif()
+
+
+unset(GENERATE_CONDITION)
+get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+if(_isMultiConfig)
+ list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG)
+ set(GENERATE_CONDITION CONDITION $<CONFIG:${FIRST_CONFIG}>)
+endif()
+
+file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_OUTPUT_NAME-generated.cmake"
+ CONTENT "${GENERATE_CONTENT}" ${GENERATE_CONDITION})
diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME-check.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME-check.cmake
new file mode 100644
index 0000000..8d1103e
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME-check.cmake
@@ -0,0 +1,7 @@
+file(STRINGS ${RunCMake_TEST_BINARY_DIR}/test.txt TEST_TXT ENCODING UTF-8)
+
+list(GET TEST_TXT 0 PDB_OUTPUT_NAME)
+
+if(NOT PDB_OUTPUT_NAME MATCHES "empty")
+ set(RunCMake_TEST_FAILED "unexpected PDB_OUTPUT_NAME [${PDB_OUTPUT_NAME}]")
+endif()
diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME.cmake
new file mode 100644
index 0000000..ba70b43
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME.cmake
@@ -0,0 +1,16 @@
+
+enable_language(C)
+
+add_library(empty SHARED empty.c)
+
+get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+if(_isMultiConfig)
+ list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG)
+ set(GENERATE_CONDITION CONDITION $<CONFIG:${FIRST_CONFIG}>)
+endif()
+
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt"
+ CONTENT "$<TARGET_PDB_OUTPUT_NAME:empty>"
+ ${GENERATE_CONDITION}
+)
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake b/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake
index 9e2e50d..b495d98 100644
--- a/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake
@@ -18,8 +18,9 @@ set(targets
darwin-C-AppleClang-8.0.0.8000042 darwin-CXX-AppleClang-8.0.0.8000042
darwin_nostdinc-C-AppleClang-8.0.0.8000042
darwin_nostdinc-CXX-AppleClang-8.0.0.8000042
- empty-C empty-CXX
freebsd-C-Clang-3.3.0 freebsd-CXX-Clang-3.3.0 freebsd-Fortran-GNU-4.6.4
+ hand-C-empty hand-CXX-empty
+ hand-C-relative hand-CXX-relative
linux-C-GNU-7.3.0 linux-CXX-GNU-7.3.0 linux-Fortran-GNU-7.3.0
linux-C-Intel-18.0.0.20170811 linux-CXX-Intel-18.0.0.20170811
linux-C-PGI-18.10.1 linux-CXX-PGI-18.10.1
@@ -105,12 +106,12 @@ foreach(t ${targets})
file(READ ${outfile} output)
string(STRIP "${output}" output)
cmake_parse_implicit_include_info("${input}" "${lang}" idirs log state)
- if(t MATCHES "^empty-") # empty isn't supposed to parse
+ if(t MATCHES "-empty$") # empty isn't supposed to parse
if("${state}" STREQUAL "done")
message("empty parse failed: ${idirs}, log=${log}")
endif()
- elseif(NOT "${state}" STREQUAL "done" OR NOT "${output}" STREQUAL "${idirs}")
- message("parse failed: state=${state}, ${output} != ${idirs}, log=${log}")
+ elseif(NOT "${state}" STREQUAL "done" OR NOT "${idirs}" MATCHES "^${output}$")
+ message("parse failed: state=${state}, '${idirs}' does not match '^${output}$', log=${log}")
endif()
unload_compiler_info("${cmvars}")
endforeach(t)
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-CXX-XLClang-16.1.0.1.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-CXX-XLClang-16.1.0.1.output
index e462894..7666f7e 100644
--- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-CXX-XLClang-16.1.0.1.output
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-CXX-XLClang-16.1.0.1.output
@@ -1 +1 @@
-/opt/IBM/xlC/16.1.0/include2/c++;/opt/IBM/xlC/16.1.0/include2;/opt/IBM/xlC/16.1.0/include2/aix;/opt/IBM/xlmass/9.1.0/include;/usr/include
+/opt/IBM/xlC/16.1.0/include2/c\+\+;/opt/IBM/xlC/16.1.0/include2;/opt/IBM/xlC/16.1.0/include2/aix;/opt/IBM/xlmass/9.1.0/include;/usr/include
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Cray-8.7.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Cray-8.7.output
index 259c42a..263f8cb 100644
--- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Cray-8.7.output
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Cray-8.7.output
@@ -1 +1 @@
-/opt/cray/pe/cce/8.7.4/cce/x86_64/include/craylibs;/opt/gcc/6.1.0/snos/include/g++;/opt/gcc/6.1.0/snos/include/g++/x86_64-suse-linux;/opt/gcc/6.1.0/snos/include/g++/backward;/opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0/include;/opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0/include-fixed;/opt/cray/pe/cce/8.7.4/cce/x86_64/include/c++;/opt/cray/pe/cce/8.7.4/cce/x86_64/include/basic;/opt/gcc/6.1.0/snos/include;/usr/include;/opt/cray/pe/libsci/18.07.1/CRAY/8.6/x86_64/include;/opt/cray/pe/mpt/7.7.3/gni/mpich-cray/8.6/include;/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include;/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include;/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include;/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include;/opt/cray/dmapp/7.1.1-6.0.5.0_49.8__g1125556.ari/include;/opt/cray/pe/pmi/5.0.14/include;/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include;/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include;/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include;/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include;/opt/cray-hss-devel/8.0.0/include
+/opt/cray/pe/cce/8.7.4/cce/x86_64/include/craylibs;/opt/gcc/6.1.0/snos/include/g\+\+;/opt/gcc/6.1.0/snos/include/g\+\+/x86_64-suse-linux;/opt/gcc/6.1.0/snos/include/g\+\+/backward;/opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0/include;/opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0/include-fixed;/opt/cray/pe/cce/8.7.4/cce/x86_64/include/c\+\+;/opt/cray/pe/cce/8.7.4/cce/x86_64/include/basic;/opt/gcc/6.1.0/snos/include;/usr/include;/opt/cray/pe/libsci/18.07.1/CRAY/8.6/x86_64/include;/opt/cray/pe/mpt/7.7.3/gni/mpich-cray/8.6/include;/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include;/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include;/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include;/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include;/opt/cray/dmapp/7.1.1-6.0.5.0_49.8__g1125556.ari/include;/opt/cray/pe/pmi/5.0.14/include;/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include;/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include;/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include;/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include;/opt/cray-hss-devel/8.0.0/include
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-GNU-7.3.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-GNU-7.3.0.output
index d9095f7..b76c5db 100644
--- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-GNU-7.3.0.output
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-GNU-7.3.0.output
@@ -1 +1 @@
-/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include;/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include;/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include;/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include;/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include;/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include;/opt/cray/pe/pmi/5.0.14/include;/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include;/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include;/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include;/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include;/opt/cray-hss-devel/8.0.0/include;/opt/gcc/7.3.0/snos/include/g++;/opt/gcc/7.3.0/snos/include/g++/x86_64-suse-linux;/opt/gcc/7.3.0/snos/include/g++/backward;/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/include;/usr/local/include;/opt/gcc/7.3.0/snos/include;/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/include-fixed;/usr/include
+/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include;/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include;/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include;/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include;/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include;/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include;/opt/cray/pe/pmi/5.0.14/include;/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include;/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include;/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include;/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include;/opt/cray-hss-devel/8.0.0/include;/opt/gcc/7.3.0/snos/include/g\+\+;/opt/gcc/7.3.0/snos/include/g\+\+/x86_64-suse-linux;/opt/gcc/7.3.0/snos/include/g\+\+/backward;/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/include;/usr/local/include;/opt/gcc/7.3.0/snos/include;/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/include-fixed;/usr/include
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Intel-18.0.2.20180210.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Intel-18.0.2.20180210.output
index 31f8a11..031c324 100644
--- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Intel-18.0.2.20180210.output
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Intel-18.0.2.20180210.output
@@ -1 +1 @@
-/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/include;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/intel64;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/icc;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include;/opt/gcc/6.3.0/snos/include/g++;/opt/gcc/6.3.0/snos/include/g++/x86_64-suse-linux;/opt/gcc/6.3.0/snos/include/g++/backward;/usr/local/include;/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include;/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include-fixed;/opt/gcc/6.3.0/snos/include;/usr/include
+/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/include;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/intel64;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/icc;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include;/opt/gcc/6.3.0/snos/include/g\+\+;/opt/gcc/6.3.0/snos/include/g\+\+/x86_64-suse-linux;/opt/gcc/6.3.0/snos/include/g\+\+/backward;/usr/local/include;/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include;/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include-fixed;/opt/gcc/6.3.0/snos/include;/usr/include
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-CXX-AppleClang-8.0.0.8000042.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-CXX-AppleClang-8.0.0.8000042.output
index b10b2af..de0f91f 100644
--- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-CXX-AppleClang-8.0.0.8000042.output
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-CXX-AppleClang-8.0.0.8000042.output
@@ -1 +1 @@
-/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1;/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.0.0/include;/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include;/usr/include
+/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c\+\+/v1;/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.0.0/include;/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include;/usr/include
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-CXX-Clang-3.3.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-CXX-Clang-3.3.0.output
index cd64264..97410f2 100644
--- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-CXX-Clang-3.3.0.output
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-CXX-Clang-3.3.0.output
@@ -1 +1 @@
-/usr/include/c++/v1;/usr/include/c++/4.2;/usr/include/c++/4.2/backward;/usr/include/clang/3.3;/usr/include
+/usr/include/c\+\+/v1;/usr/include/c\+\+/4.2;/usr/include/c\+\+/4.2/backward;/usr/include/clang/3.3;/usr/include
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-C.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-empty.input
index b27eb02..b27eb02 100644
--- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-C.input
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-empty.input
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-CXX.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-empty.output
index e69de29..e69de29 100644
--- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-CXX.output
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-empty.output
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-relative.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-relative.input
new file mode 100644
index 0000000..dd846e3
--- /dev/null
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-relative.input
@@ -0,0 +1,21 @@
+CMAKE_LANG=C
+CMAKE_C_COMPILER_ABI=ELF
+CMAKE_C_COMPILER_AR=/usr/bin/gcc-ar-7
+CMAKE_C_COMPILER_ARCHITECTURE_ID=
+CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN=
+CMAKE_C_COMPILER_ID=GNU
+CMAKE_C_COMPILER_LAUNCHER=
+CMAKE_C_COMPILER_LOADED=1
+CMAKE_C_COMPILER_RANLIB=/usr/bin/gcc-ranlib-7
+CMAKE_C_COMPILER_TARGET=
+CMAKE_C_COMPILER_VERSION=7.3.0
+CMAKE_C_COMPILER_VERSION_INTERAL=
+
+This is a hand-written test case.
+
+#include "..." search starts here:
+#include <...> search starts here:
+ /usr/local/include
+ ../../../adaptive/relative/include
+ /usr/include
+End of search list.
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-relative.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-relative.output
new file mode 100644
index 0000000..e43139b
--- /dev/null
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-relative.output
@@ -0,0 +1 @@
+ /usr/local/include;[^;]*/Tests/RunCMake/ParseImplicitIncludeInfo/adaptive/relative/include;/usr/include
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-CXX.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-empty.input
index b983d6b..b983d6b 100644
--- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-CXX.input
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-empty.input
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-C.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-empty.output
index e69de29..e69de29 100644
--- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-C.output
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-empty.output
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-relative.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-relative.input
new file mode 100644
index 0000000..54cc4db
--- /dev/null
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-relative.input
@@ -0,0 +1,21 @@
+CMAKE_LANG=CXX
+CMAKE_CXX_COMPILER_ABI=ELF
+CMAKE_CXX_COMPILER_AR=/usr/bin/gcc-ar-7
+CMAKE_CXX_COMPILER_ARCHITECTURE_ID=
+CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN=
+CMAKE_CXX_COMPILER_ID=GNU
+CMAKE_CXX_COMPILER_LAUNCHER=
+CMAKE_CXX_COMPILER_LOADED=1
+CMAKE_CXX_COMPILER_RANLIB=/usr/bin/gcc-ranlib-7
+CMAKE_CXX_COMPILER_TARGET=
+CMAKE_CXX_COMPILER_VERSION=7.3.0
+CMAKE_CXX_COMPILER_VERSION_INTERAL=
+
+This is a hand-written test case.
+
+#include "..." search starts here:
+#include <...> search starts here:
+ /usr/local/include
+ ../../../adaptive/relative/include
+ /usr/include
+End of search list.
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-relative.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-relative.output
new file mode 100644
index 0000000..e43139b
--- /dev/null
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-relative.output
@@ -0,0 +1 @@
+ /usr/local/include;[^;]*/Tests/RunCMake/ParseImplicitIncludeInfo/adaptive/relative/include;/usr/include
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CUDA-NVIDIA-9.2.148.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CUDA-NVIDIA-9.2.148.output
index 4f49cd1..497fb88 100644
--- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CUDA-NVIDIA-9.2.148.output
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CUDA-NVIDIA-9.2.148.output
@@ -1 +1 @@
-/usr/include/c++/5;/usr/include/x86_64-linux-gnu/c++/5;/usr/include/c++/5/backward;/usr/lib/gcc/x86_64-linux-gnu/5/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include
+/usr/include/c\+\+/5;/usr/include/x86_64-linux-gnu/c\+\+/5;/usr/include/c\+\+/5/backward;/usr/lib/gcc/x86_64-linux-gnu/5/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-GNU-7.3.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-GNU-7.3.0.output
index 6f5d071..af33ba8 100644
--- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-GNU-7.3.0.output
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-GNU-7.3.0.output
@@ -1 +1 @@
-/usr/include/c++/7;/usr/include/x86_64-linux-gnu/c++/7;/usr/include/c++/7/backward;/usr/lib/gcc/x86_64-linux-gnu/7/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include
+/usr/include/c\+\+/7;/usr/include/x86_64-linux-gnu/c\+\+/7;/usr/include/c\+\+/7/backward;/usr/lib/gcc/x86_64-linux-gnu/7/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-Intel-18.0.0.20170811.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-Intel-18.0.0.20170811.output
index 1bf5711..95bdf99 100644
--- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-Intel-18.0.0.20170811.output
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-Intel-18.0.0.20170811.output
@@ -1 +1 @@
-/opt/intel/compilers_and_libraries_2018.0.128/linux/ipp/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/pstl/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include/intel64;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include/icc;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include;/usr/include/c++/4.8.5;/usr/include/c++/4.8.5/x86_64-redhat-linux;/usr/include/c++/4.8.5/backward;/usr/local/include;/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include;/usr/include
+/opt/intel/compilers_and_libraries_2018.0.128/linux/ipp/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/pstl/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include/intel64;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include/icc;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include;/usr/include/c\+\+/4.8.5;/usr/include/c\+\+/4.8.5/x86_64-redhat-linux;/usr/include/c\+\+/4.8.5/backward;/usr/local/include;/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include;/usr/include
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-PGI-18.10.1.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-PGI-18.10.1.output
index 8c9d24a..8eb97c8 100644
--- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-PGI-18.10.1.output
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-PGI-18.10.1.output
@@ -1 +1 @@
-/mnt/pgi/linux86-64/18.10/include-gcc70;/mnt/pgi/linux86-64/18.10/include;/usr/include/c++/7;/usr/include/x86_64-linux-gnu/c++/7;/usr/include/c++/7/backward;/usr/lib/gcc/x86_64-linux-gnu/7/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include
+/mnt/pgi/linux86-64/18.10/include-gcc70;/mnt/pgi/linux86-64/18.10/include;/usr/include/c\+\+/7;/usr/include/x86_64-linux-gnu/c\+\+/7;/usr/include/c\+\+/7/backward;/usr/lib/gcc/x86_64-linux-gnu/7/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-12.1.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-12.1.0.output
index a2d8c26..d6d3e58 100644
--- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-12.1.0.output
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-12.1.0.output
@@ -1 +1 @@
-/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/include;/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include;/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/include;/usr/include/c++/4.4.7;/usr/include/c++/4.4.7/ppc64-redhat-linux;/usr/include/c++/4.4.7/backward;/usr/local/include;/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/crt/include;/usr/include
+/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/include;/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include;/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/include;/usr/include/c\+\+/4.4.7;/usr/include/c\+\+/4.4.7/ppc64-redhat-linux;/usr/include/c\+\+/4.4.7/backward;/usr/local/include;/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/crt/include;/usr/include
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-16.1.0.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-16.1.0.0.output
index 6994f3c..9e118fc 100644
--- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-16.1.0.0.output
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-16.1.0.0.output
@@ -1 +1 @@
-/opt/ibm/xlsmp/5.1.0/include;/opt/ibm/xlmass/9.1.0/include;/opt/ibm/xlC/16.1.0/include;/usr/include/c++/4.8.5;/usr/include/c++/4.8.5/ppc64le-redhat-linux;/usr/include/c++/4.8.5/backward;/usr/local/include;/usr/include
+/opt/ibm/xlsmp/5.1.0/include;/opt/ibm/xlmass/9.1.0/include;/opt/ibm/xlC/16.1.0/include;/usr/include/c\+\+/4.8.5;/usr/include/c\+\+/4.8.5/ppc64le-redhat-linux;/usr/include/c\+\+/4.8.5/backward;/usr/local/include;/usr/include
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-CXX-PGI-18.10.1.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-CXX-PGI-18.10.1.output
index 8c9d24a..8eb97c8 100644
--- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-CXX-PGI-18.10.1.output
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-CXX-PGI-18.10.1.output
@@ -1 +1 @@
-/mnt/pgi/linux86-64/18.10/include-gcc70;/mnt/pgi/linux86-64/18.10/include;/usr/include/c++/7;/usr/include/x86_64-linux-gnu/c++/7;/usr/include/c++/7/backward;/usr/lib/gcc/x86_64-linux-gnu/7/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include
+/mnt/pgi/linux86-64/18.10/include-gcc70;/mnt/pgi/linux86-64/18.10/include;/usr/include/c\+\+/7;/usr/include/x86_64-linux-gnu/c\+\+/7;/usr/include/c\+\+/7/backward;/usr/lib/gcc/x86_64-linux-gnu/7/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-CXX-GNU-4.9.3.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-CXX-GNU-4.9.3.output
index 7a5e447..9996940 100644
--- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-CXX-GNU-4.9.3.output
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-CXX-GNU-4.9.3.output
@@ -1 +1 @@
-C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include/c++;C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include/c++/mingw32;C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include/c++/backward;C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include;C:/DoesNotExist/mingw/include;C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include-fixed
+C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include/c\+\+;C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include/c\+\+/mingw32;C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include/c\+\+/backward;C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include;C:/DoesNotExist/mingw/include;C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include-fixed
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-CXX-GNU-4.8.5.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-CXX-GNU-4.8.5.output
index 7b1e11e..d2289eb 100644
--- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-CXX-GNU-4.8.5.output
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-CXX-GNU-4.8.5.output
@@ -1 +1 @@
-/usr/include/g++;/usr/include/g++/backward;/usr/include/gcc-4.8;/usr/include
+/usr/include/g\+\+;/usr/include/g\+\+/backward;/usr/include/gcc-4.8;/usr/include
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-CXX-Clang-5.0.1.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-CXX-Clang-5.0.1.output
index 6da1398..d77687b 100644
--- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-CXX-Clang-5.0.1.output
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-CXX-Clang-5.0.1.output
@@ -1 +1 @@
-/usr/include/c++/v1;/usr/lib/clang/5.0.1/include;/usr/include
+/usr/include/c\+\+/v1;/usr/lib/clang/5.0.1/include;/usr/include
diff --git a/Utilities/Release/win32_release.cmake b/Utilities/Release/win32_release.cmake
index 1e4421c..974c402 100644
--- a/Utilities/Release/win32_release.cmake
+++ b/Utilities/Release/win32_release.cmake
@@ -11,6 +11,7 @@ set(MAKE "${MAKE_PROGRAM} -j16")
set(qt_prefix "c:/Qt/5.12.1/msvc2017-32-w7-mt")
set(qt_win_libs
${qt_prefix}/plugins/platforms/qwindows.lib
+ ${qt_prefix}/plugins/styles/qwindowsvistastyle.lib
${qt_prefix}/lib/Qt5EventDispatcherSupport.lib
${qt_prefix}/lib/Qt5FontDatabaseSupport.lib
${qt_prefix}/lib/Qt5ThemeSupport.lib
diff --git a/Utilities/Release/win64_release.cmake b/Utilities/Release/win64_release.cmake
index 98eaf19..20529f0 100644
--- a/Utilities/Release/win64_release.cmake
+++ b/Utilities/Release/win64_release.cmake
@@ -11,6 +11,7 @@ set(MAKE "${MAKE_PROGRAM} -j16")
set(qt_prefix "c:/Qt/5.12.1/msvc2017-64-w7-mt")
set(qt_win_libs
${qt_prefix}/plugins/platforms/qwindows.lib
+ ${qt_prefix}/plugins/styles/qwindowsvistastyle.lib
${qt_prefix}/lib/Qt5EventDispatcherSupport.lib
${qt_prefix}/lib/Qt5FontDatabaseSupport.lib
${qt_prefix}/lib/Qt5ThemeSupport.lib