summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Auxiliary/cmake.m42
-rw-r--r--Help/command/list.rst36
-rw-r--r--Help/command/try_compile.rst44
-rw-r--r--Help/command/try_run.rst14
-rw-r--r--Help/manual/cmake-policies.7.rst8
-rw-r--r--Help/manual/ctest.1.rst5
-rw-r--r--Help/policy/CMP0083.rst7
-rw-r--r--Help/policy/CMP0089.rst30
-rw-r--r--Help/prop_tgt/EXCLUDE_FROM_ALL.rst12
-rw-r--r--Help/release/3.14.rst9
-rw-r--r--Help/release/dev/add-xlclang.rst5
-rw-r--r--Help/release/dev/deprecate-policy-old.rst8
-rw-r--r--Help/release/dev/list-prepend-and-pop-subcommands.rst4
-rw-r--r--Help/variable/CMAKE_LANG_COMPILER_ID.rst1
-rw-r--r--Help/variable/CMAKE_LANG_IMPLICIT_INCLUDE_DIRECTORIES.rst7
-rw-r--r--Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst2
-rw-r--r--Modules/CMakeCompilerIdDetection.cmake3
-rw-r--r--Modules/CMakeDetermineASMCompiler.cmake6
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake2
-rw-r--r--Modules/CMakeDetermineVSServicePack.cmake2
-rw-r--r--Modules/CMakeFortranCompilerId.F.in7
-rw-r--r--Modules/CMakeParseImplicitIncludeInfo.cmake6
-rw-r--r--Modules/CheckCXXSourceRuns.cmake7
-rw-r--r--Modules/CheckFortranSourceRuns.cmake7
-rw-r--r--Modules/Compiler/CrayPrgEnv.cmake111
-rw-r--r--Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake16
-rw-r--r--Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake16
-rw-r--r--Modules/Compiler/MIPSpro-C.cmake1
-rw-r--r--Modules/Compiler/MIPSpro-CXX.cmake1
-rw-r--r--Modules/Compiler/MIPSpro-DetermineCompiler.cmake15
-rw-r--r--Modules/Compiler/MIPSpro-Fortran.cmake3
-rw-r--r--Modules/Compiler/QCC-ASM.cmake2
-rw-r--r--Modules/Compiler/XL-C-DetermineCompiler.cmake2
-rw-r--r--Modules/Compiler/XL-C.cmake37
-rw-r--r--Modules/Compiler/XL-CXX-DetermineCompiler.cmake2
-rw-r--r--Modules/Compiler/XL-CXX.cmake39
-rw-r--r--Modules/Compiler/XL.cmake22
-rw-r--r--Modules/Compiler/XLClang-C-DetermineCompiler.cmake8
-rw-r--r--Modules/Compiler/XLClang-C.cmake17
-rw-r--r--Modules/Compiler/XLClang-CXX-DetermineCompiler.cmake8
-rw-r--r--Modules/Compiler/XLClang-CXX.cmake20
-rw-r--r--Modules/Compiler/XLClang.cmake22
-rw-r--r--Modules/FindOpenMP.cmake1
-rw-r--r--Modules/FortranCInterface/CMakeLists.txt5
-rw-r--r--Modules/Platform/AIX-XL.cmake22
-rw-r--r--Modules/Platform/AIX-XLClang-C.cmake2
-rw-r--r--Modules/Platform/AIX-XLClang-CXX.cmake2
-rw-r--r--Modules/Platform/AIX-XLClang.cmake15
-rw-r--r--Modules/Platform/CrayLinuxEnvironment.cmake72
-rw-r--r--README.rst21
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx2
-rw-r--r--Source/CPack/cmCPackGenerator.cxx6
-rw-r--r--Source/CPack/cmCPackGenerator.h3
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx5
-rw-r--r--Source/CPack/cmCPackOSXX11Generator.cxx6
-rw-r--r--Source/CPack/cmCPackPKGGenerator.cxx6
-rw-r--r--Source/CTest/cmCTestBZR.cxx2
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx11
-rw-r--r--Source/CTest/cmCTestBuildHandler.h2
-rw-r--r--Source/CTest/cmCTestCVS.cxx2
-rw-r--r--Source/CTest/cmCTestConfigureHandler.cxx2
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx4
-rw-r--r--Source/CTest/cmCTestGIT.cxx2
-rw-r--r--Source/CTest/cmCTestHG.cxx2
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx2
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx6
-rw-r--r--Source/CTest/cmCTestP4.cxx7
-rw-r--r--Source/CTest/cmCTestSVN.cxx4
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx17
-rw-r--r--Source/cmAddDependenciesCommand.cxx2
-rw-r--r--Source/cmAddSubDirectoryCommand.cxx2
-rw-r--r--Source/cmAlgorithms.h67
-rw-r--r--Source/cmCTest.cxx2
-rw-r--r--Source/cmCTest.h5
-rw-r--r--Source/cmCacheManager.cxx7
-rw-r--r--Source/cmComputeLinkDepends.cxx1
-rw-r--r--Source/cmComputeLinkInformation.cxx6
-rw-r--r--Source/cmComputeTargetDepends.cxx2
-rw-r--r--Source/cmConfigureFileCommand.cxx6
-rw-r--r--Source/cmCoreTryCompile.cxx4
-rw-r--r--Source/cmCreateTestSourceList.cxx3
-rw-r--r--Source/cmDependsC.cxx3
-rw-r--r--Source/cmExecProgramCommand.cxx4
-rw-r--r--Source/cmExportLibraryDependenciesCommand.cxx2
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx1
-rw-r--r--Source/cmFLTKWrapUICommand.cxx2
-rw-r--r--Source/cmFileCommand.cxx1
-rw-r--r--Source/cmFindBase.cxx1
-rw-r--r--Source/cmFindPackageCommand.cxx1
-rw-r--r--Source/cmForEachCommand.cxx1
-rw-r--r--Source/cmFunctionCommand.cxx1
-rw-r--r--Source/cmGeneratedFileStream.cxx6
-rw-r--r--Source/cmGeneratorTarget.cxx20
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx10
-rw-r--r--Source/cmGlobVerificationManager.cxx8
-rw-r--r--Source/cmGlobalGenerator.cxx88
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx56
-rw-r--r--Source/cmGlobalVisualStudio14Generator.cxx13
-rw-r--r--Source/cmGlobalVisualStudio14Generator.h3
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx2
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.cxx6
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx8
-rw-r--r--Source/cmInstallCommandArguments.cxx2
-rw-r--r--Source/cmInstallFilesCommand.cxx2
-rw-r--r--Source/cmInstallTargetGenerator.cxx16
-rw-r--r--Source/cmInstallTargetGenerator.h1
-rw-r--r--Source/cmListCommand.cxx139
-rw-r--r--Source/cmListCommand.h3
-rw-r--r--Source/cmLocalGenerator.cxx43
-rw-r--r--Source/cmLocalGenerator.h4
-rw-r--r--Source/cmLocalNinjaGenerator.cxx4
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx3
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx10
-rw-r--r--Source/cmMacroCommand.cxx1
-rw-r--r--Source/cmMakefile.cxx39
-rw-r--r--Source/cmMakefile.h4
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx4
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx4
-rw-r--r--Source/cmMakefileTargetGenerator.cxx1
-rw-r--r--Source/cmMessageCommand.cxx1
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx59
-rw-r--r--Source/cmNinjaTargetGenerator.cxx14
-rw-r--r--Source/cmOSXBundleGenerator.cxx8
-rw-r--r--Source/cmOutputRequiredFilesCommand.cxx4
-rw-r--r--Source/cmParseArgumentsCommand.cxx1
-rw-r--r--Source/cmPolicies.h5
-rw-r--r--Source/cmQTWrapCPPCommand.cxx2
-rw-r--r--Source/cmQTWrapUICommand.cxx2
-rw-r--r--Source/cmQtAutoGen.cxx55
-rw-r--r--Source/cmQtAutoGen.h41
-rw-r--r--Source/cmQtAutoGenGlobalInitializer.cxx64
-rw-r--r--Source/cmQtAutoGenGlobalInitializer.h6
-rw-r--r--Source/cmQtAutoGenInitializer.cxx823
-rw-r--r--Source/cmQtAutoGenInitializer.h94
-rw-r--r--Source/cmQtAutoGenerator.cxx22
-rw-r--r--Source/cmQtAutoGenerator.h20
-rw-r--r--Source/cmQtAutoGeneratorMocUic.cxx242
-rw-r--r--Source/cmQtAutoGeneratorMocUic.h28
-rw-r--r--Source/cmQtAutoGeneratorRcc.cxx78
-rw-r--r--Source/cmRST.cxx1
-rw-r--r--Source/cmRange.h239
-rw-r--r--Source/cmRulePlaceholderExpander.cxx25
-rw-r--r--Source/cmRulePlaceholderExpander.h5
-rw-r--r--Source/cmServerConnection.cxx4
-rw-r--r--Source/cmSetCommand.cxx1
-rw-r--r--Source/cmSetPropertyCommand.cxx2
-rw-r--r--Source/cmStateDirectory.cxx1
-rw-r--r--Source/cmStringCommand.cxx1
-rw-r--r--Source/cmSystemTools.cxx25
-rw-r--r--Source/cmSystemTools.h8
-rw-r--r--Source/cmTarget.cxx1
-rw-r--r--Source/cmTestGenerator.cxx2
-rw-r--r--Source/cmTryRunCommand.cxx7
-rw-r--r--Source/cmUseMangledMesaCommand.cxx8
-rw-r--r--Source/cmUuid.cxx18
-rw-r--r--Source/cmUuid.h4
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx21
-rw-r--r--Source/cmake.cxx19
-rw-r--r--Source/cmcmd.cxx21
-rw-r--r--Source/kwsys/CMakeLists.txt34
-rw-r--r--Source/kwsys/Configure.h.in37
-rw-r--r--Source/kwsys/kwsysPlatformTestsCXX.cxx42
-rw-r--r--Tests/CMakeLib/CMakeLists.txt1
-rw-r--r--Tests/CMakeLib/testRange.cxx45
-rw-r--r--Tests/Fortran/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake1
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-C-XLClang-16.1.0.1.input40
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-C-XLClang-16.1.0.1.output1
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-CXX-XLClang-16.1.0.1.input44
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-CXX-XLClang-16.1.0.1.output1
-rw-r--r--Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt1
-rw-r--r--Tests/RunCMake/list/POP_BACK-NoArgs-result.txt1
-rw-r--r--Tests/RunCMake/list/POP_BACK-NoArgs-stderr.txt1
-rw-r--r--Tests/RunCMake/list/POP_BACK-NoArgs.cmake1
-rw-r--r--Tests/RunCMake/list/POP_BACK.cmake79
-rw-r--r--Tests/RunCMake/list/POP_FRONT-NoArgs-result.txt1
-rw-r--r--Tests/RunCMake/list/POP_FRONT-NoArgs-stderr.txt1
-rw-r--r--Tests/RunCMake/list/POP_FRONT-NoArgs.cmake1
-rw-r--r--Tests/RunCMake/list/POP_FRONT.cmake79
-rw-r--r--Tests/RunCMake/list/PREPEND-NoArgs-result.txt1
-rw-r--r--Tests/RunCMake/list/PREPEND-NoArgs-stderr.txt1
-rw-r--r--Tests/RunCMake/list/PREPEND-NoArgs.cmake1
-rw-r--r--Tests/RunCMake/list/PREPEND.cmake33
-rw-r--r--Tests/RunCMake/list/RunCMakeTest.cmake12
-rw-r--r--Tests/RunCMake/try_compile/CMP0066-stderr.txt13
-rw-r--r--Utilities/cmcurl/CMakeLists.txt2
-rw-r--r--Utilities/cmexpat/CMakeLists.txt2
-rw-r--r--Utilities/cmjsoncpp/CMakeLists.txt2
-rw-r--r--Utilities/cmjsoncpp/include/json/config.h7
-rw-r--r--Utilities/cmlibarchive/CMakeLists.txt2
-rw-r--r--Utilities/cmliblzma/CMakeLists.txt2
-rw-r--r--Utilities/cmlibrhash/CMakeLists.txt2
-rw-r--r--Utilities/cmlibuv/CMakeLists.txt2
-rw-r--r--Utilities/cmlibuv/src/unix/atomic-ops.h4
-rw-r--r--Utilities/cmzlib/CMakeLists.txt2
198 files changed, 2460 insertions, 1461 deletions
diff --git a/Auxiliary/cmake.m4 b/Auxiliary/cmake.m4
index 7beff41..a40c0ae 100644
--- a/Auxiliary/cmake.m4
+++ b/Auxiliary/cmake.m4
@@ -13,7 +13,7 @@ fi
# $2: language (e.g. C/CXX/Fortran)
# $3: The compiler ID, defaults to GNU.
# Possible values are: GNU, Intel, Clang, SunPro, HP, XL, VisualAge, PGI,
-# PathScale, Cray, SCO, MIPSpro, MSVC
+# PathScale, Cray, SCO, MSVC
# $4: optional extra arguments to cmake, e.g. "-DCMAKE_SIZEOF_VOID_P=8"
# $5: optional path to cmake binary
AC_DEFUN([CMAKE_FIND_PACKAGE], [
diff --git a/Help/command/list.rst b/Help/command/list.rst
index bfcdf34..6c86c2a 100644
--- a/Help/command/list.rst
+++ b/Help/command/list.rst
@@ -21,6 +21,9 @@ Synopsis
list(`APPEND`_ <list> [<element>...])
list(`FILTER`_ <list> {INCLUDE | EXCLUDE} REGEX <regex>)
list(`INSERT`_ <list> <index> [<element>...])
+ list(`POP_BACK`_ <list> [<out-var>...])
+ list(`POP_FRONT`_ <list> [<out-var>...])
+ list(`PREPEND`_ <list> [<element>...])
list(`REMOVE_ITEM`_ <list> <value>...)
list(`REMOVE_AT`_ <list> <index>...)
list(`REMOVE_DUPLICATES`_ <list>)
@@ -33,8 +36,9 @@ Synopsis
Introduction
^^^^^^^^^^^^
-The list subcommands ``APPEND``, ``INSERT``, ``FILTER``, ``REMOVE_AT``,
-``REMOVE_ITEM``, ``REMOVE_DUPLICATES``, ``REVERSE`` and ``SORT`` may create
+The list subcommands ``APPEND``, ``INSERT``, ``FILTER``, ``PREPEND``,
+``POP_BACK``, ``POP_FRONT``, ``REMOVE_AT``, ``REMOVE_ITEM``,
+``REMOVE_DUPLICATES``, ``REVERSE`` and ``SORT`` may create
new values for the list within the current CMake variable scope. Similar to
the :command:`set` command, the LIST command creates new variable values in
the current scope, even if the list itself is actually defined in a parent
@@ -142,6 +146,34 @@ For more information on regular expressions see also the
Inserts elements to the list to the specified location.
+.. _POP_BACK:
+
+.. code-block:: cmake
+
+ list(POP_BACK <list> [<out-var>...])
+
+If no variable name is given, removes exactly one element. Otherwise,
+assign the last element's value to the given variable and removes it,
+up to the last variable name given.
+
+.. _POP_FRONT:
+
+.. code-block:: cmake
+
+ list(POP_FRONT <list> [<out-var>...])
+
+If no variable name is given, removes exactly one element. Otherwise,
+assign the first element's value to the given variable and removes it,
+up to the last variable name given.
+
+.. _PREPEND:
+
+.. code-block:: cmake
+
+ list(PREPEND <list> [<element> ...])
+
+Insert elements to the 0th position in the list.
+
.. _REMOVE_ITEM:
.. code-block:: cmake
diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst
index 77f42a1..ca8fc77 100644
--- a/Help/command/try_compile.rst
+++ b/Help/command/try_compile.rst
@@ -12,12 +12,12 @@ Try Compiling Whole Projects
.. code-block:: cmake
- try_compile(RESULT_VAR <bindir> <srcdir>
+ try_compile(<resultVar> <bindir> <srcdir>
<projectName> [<targetName>] [CMAKE_FLAGS <flags>...]
[OUTPUT_VARIABLE <var>])
Try building a project. The success or failure of the ``try_compile``,
-i.e. ``TRUE`` or ``FALSE`` respectively, is returned in ``RESULT_VAR``.
+i.e. ``TRUE`` or ``FALSE`` respectively, is returned in ``<resultVar>``.
In this form, ``<srcdir>`` should contain a complete CMake project with a
``CMakeLists.txt`` file and all sources. The ``<bindir>`` and ``<srcdir>``
@@ -30,7 +30,7 @@ Try Compiling Source Files
.. code-block:: cmake
- try_compile(RESULT_VAR <bindir> <srcfile|SOURCES srcfile...>
+ try_compile(<resultVar> <bindir> <srcfile|SOURCES srcfile...>
[CMAKE_FLAGS <flags>...]
[COMPILE_DEFINITIONS <defs>...]
[LINK_OPTIONS <options>...]
@@ -42,13 +42,19 @@ Try Compiling Source Files
[<LANG>_EXTENSIONS <bool>]
)
-Try building an executable from one or more source files. The success or
-failure of the ``try_compile``, i.e. ``TRUE`` or ``FALSE`` respectively, is
-returned in ``RESULT_VAR``.
+Try building an executable or static library from one or more source files
+(which one is determined by the :variable:`CMAKE_TRY_COMPILE_TARGET_TYPE`
+variable). The success or failure of the ``try_compile``, i.e. ``TRUE`` or
+``FALSE`` respectively, is returned in ``<resultVar>``.
-In this form the user need only supply one or more source files that include a
-definition for ``main``. CMake will create a ``CMakeLists.txt`` file to build
-the source(s) as an executable that looks something like this:
+In this form, one or more source files must be provided. If
+:variable:`CMAKE_TRY_COMPILE_TARGET_TYPE` is unset or is set to ``EXECUTABLE``,
+the sources must include a definition for ``main`` and CMake will create a
+``CMakeLists.txt`` file to build the source(s) as an executable.
+If :variable:`CMAKE_TRY_COMPILE_TARGET_TYPE` is set to ``STATIC_LIBRARY``,
+a static library will be built instead and no definition for ``main`` is
+required. For an executable, the generated ``CMakeLists.txt`` file would
+contain something like the following:
.. code-block:: cmake
@@ -73,7 +79,7 @@ The options are:
in the generated test project.
``COPY_FILE <fileName>``
- Copy the linked executable to the given ``<fileName>``.
+ Copy the built executable or static library to the given ``<fileName>``.
``COPY_FILE_ERROR <var>``
Use after ``COPY_FILE`` to capture into variable ``<var>`` any error
@@ -88,12 +94,12 @@ The options are:
given to the ``CMAKE_FLAGS`` option will be ignored.
``LINK_OPTIONS <options>...``
- Specify link step options to pass to :command:`target_link_options` or
- to :prop_tgt:`STATIC_LIBRARY_OPTIONS` target property in the generated
- project, depending of the :variable:`CMAKE_TRY_COMPILE_TARGET_TYPE` variable.
+ Specify link step options to pass to :command:`target_link_options` or to
+ set the :prop_tgt:`STATIC_LIBRARY_OPTIONS` target property in the generated
+ project, depending on the :variable:`CMAKE_TRY_COMPILE_TARGET_TYPE` variable.
``OUTPUT_VARIABLE <var>``
- Store the output from the build process the given variable.
+ Store the output from the build process in the given variable.
``<LANG>_STANDARD <std>``
Specify the :prop_tgt:`C_STANDARD`, :prop_tgt:`CXX_STANDARD`,
@@ -114,7 +120,7 @@ passed to ``cmake`` to avoid this clean. However, multiple sequential
``try_compile`` operations reuse this single output directory. If you use
``--debug-trycompile``, you can only debug one ``try_compile`` call at a time.
The recommended procedure is to protect all ``try_compile`` calls in your
-project by ``if(NOT DEFINED RESULT_VAR)`` logic, configure with cmake
+project by ``if(NOT DEFINED <resultVar>)`` logic, configure with cmake
all the way through once, then delete the cache entry associated with
the try_compile call of interest, and then re-run cmake again with
``--debug-trycompile``.
@@ -139,8 +145,8 @@ behavior at link time, the ``check_pie_supported()`` command from the
:module:`CheckPIESupported` module must be called before using the
:command:`try_compile` command.
-The current settings of :policy:`CMP0065` and :policy:`CMP0083` are set in the
-generated project.
+The current settings of :policy:`CMP0065` and :policy:`CMP0083` are propagated
+through to the generated test project.
Set the :variable:`CMAKE_TRY_COMPILE_CONFIGURATION` variable to choose
a build configuration.
@@ -150,7 +156,9 @@ the type of target used for the source file signature.
Set the :variable:`CMAKE_TRY_COMPILE_PLATFORM_VARIABLES` variable to specify
variables that must be propagated into the test project. This variable is
-meant for use only in toolchain files.
+meant for use only in toolchain files and is only honored by the
+``try_compile()`` command for the source files form, not when given a whole
+project.
If :policy:`CMP0067` is set to ``NEW``, or any of the ``<LANG>_STANDARD``,
``<LANG>_STANDARD_REQUIRED``, or ``<LANG>_EXTENSIONS`` options are used,
diff --git a/Help/command/try_run.rst b/Help/command/try_run.rst
index 137402f..d401ebe 100644
--- a/Help/command/try_run.rst
+++ b/Help/command/try_run.rst
@@ -12,8 +12,8 @@ Try Compiling and Running Source Files
.. code-block:: cmake
- try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR
- bindir srcfile [CMAKE_FLAGS <flags>...]
+ try_run(<runResultVar> <compileResultVar>
+ <bindir> <srcfile> [CMAKE_FLAGS <flags>...]
[COMPILE_DEFINITIONS <defs>...]
[LINK_OPTIONS <options>...]
[LINK_LIBRARIES <libs>...]
@@ -23,9 +23,9 @@ Try Compiling and Running Source Files
[ARGS <args>...])
Try compiling a ``<srcfile>``. Returns ``TRUE`` or ``FALSE`` for success
-or failure in ``COMPILE_RESULT_VAR``. If the compile succeeded, runs the
-executable and returns its exit code in ``RUN_RESULT_VAR``. If the
-executable was built, but failed to run, then ``RUN_RESULT_VAR`` will be
+or failure in ``<compileResultVar>``. If the compile succeeded, runs the
+executable and returns its exit code in ``<runResultVar>``. If the
+executable was built, but failed to run, then ``<runResultVar>`` will be
set to ``FAILED_TO_RUN``. See the :command:`try_compile` command for
information on how the test project is constructed to build the source file.
@@ -85,10 +85,10 @@ presetting them in some CMake script file to the values the executable
would have produced if it had been run on its actual target platform.
These cache entries are:
-``<RUN_RESULT_VAR>``
+``<runResultVar>``
Exit code if the executable were to be run on the target platform.
-``<RUN_RESULT_VAR>__TRYRUN_OUTPUT``
+``<runResultVar>__TRYRUN_OUTPUT``
Output from stdout and stderr if the executable were to be run on
the target platform. This is created only if the
``RUN_OUTPUT_VARIABLE`` or ``OUTPUT_VARIABLE`` option was used.
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index 409b5b1..9470d6c 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -51,6 +51,14 @@ The :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable may also be used
to determine whether to report an error on use of deprecated macros or
functions.
+Policies Introduced by CMake 3.15
+=================================
+
+.. toctree::
+ :maxdepth: 1
+
+ CMP0089: Compiler id for IBM Clang-based XL compilers is now XLClang. </policy/CMP0089>
+
Policies Introduced by CMake 3.14
=================================
diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst
index bcf75ac..d1bd69b 100644
--- a/Help/manual/ctest.1.rst
+++ b/Help/manual/ctest.1.rst
@@ -11,8 +11,9 @@ Synopsis
.. parsed-literal::
ctest [<options>]
- ctest <path-to-source> <path-to-build> --build-generator <generator>
- [<options>...] [-- <build-options>...] [--test-command <test>]
+ ctest --build-and-test <path-to-source> <path-to-build>
+ --build-generator <generator> [<options>...]
+ [--build-options <opts>...] [--test-command <command> [<args>...]]
ctest {-D <dashboard> | -M <model> -T <action> | -S <script> | -SP <script>}
[-- <dashboard-options>...]
diff --git a/Help/policy/CMP0083.rst b/Help/policy/CMP0083.rst
index b26d6c8..32acf1f 100644
--- a/Help/policy/CMP0083.rst
+++ b/Help/policy/CMP0083.rst
@@ -23,9 +23,10 @@ which it is used, it is the project's responsibility to use the
:prop_tgt:`POSITION_INDEPENDENT_CODE` target property for executables will be
honored at link time.
-This policy was introduced in CMake version 3.14. CMake version
-|release| warns when the policy is not set and uses ``OLD`` behavior. Use
-the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.
+This policy was introduced in CMake version 3.14. Use the
+:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.
+Unlike most policies, CMake version |release| does not warn when this policy is
+not set and simply uses ``OLD`` behavior.
.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0089.rst b/Help/policy/CMP0089.rst
new file mode 100644
index 0000000..e549e0c
--- /dev/null
+++ b/Help/policy/CMP0089.rst
@@ -0,0 +1,30 @@
+CMP0089
+-------
+
+Compiler id for IBM Clang-based XL compilers is now ``XLClang``.
+
+CMake 3.15 and above recognize that IBM's Clang-based XL compilers
+that define ``__ibmxl__`` are a new front-end distinct from ``xlc``
+with a different command line and set of capabilities.
+CMake now prefers to present this to projects by setting the
+:variable:`CMAKE_<LANG>_COMPILER_ID` variable to ``XLClang`` instead
+of ``XL``. However, existing projects may assume the compiler id for
+Clang-based XL is just ``XL`` as it was in CMake versions prior to 3.15.
+Therefore this policy determines for Clang-based XL compilers which
+compiler id to report in the :variable:`CMAKE_<LANG>_COMPILER_ID`
+variable after language ``<LANG>`` is enabled by the :command:`project`
+or :command:`enable_language` command. The policy must be set prior
+to the invocation of either command.
+
+The OLD behavior for this policy is to use compiler id ``XL``. The
+NEW behavior for this policy is to use compiler id ``XLClang``.
+
+This policy was introduced in CMake version 3.15. Use the
+:command:`cmake_policy` command to set this policy to OLD or NEW explicitly.
+Unlike most policies, CMake version |release| does *not* warn
+by default when this policy is not set and simply uses OLD behavior.
+See documentation of the
+:variable:`CMAKE_POLICY_WARNING_CMP0089 <CMAKE_POLICY_WARNING_CMP<NNNN>>`
+variable to control the warning.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/prop_tgt/EXCLUDE_FROM_ALL.rst b/Help/prop_tgt/EXCLUDE_FROM_ALL.rst
index e7457e1..0eee297 100644
--- a/Help/prop_tgt/EXCLUDE_FROM_ALL.rst
+++ b/Help/prop_tgt/EXCLUDE_FROM_ALL.rst
@@ -6,8 +6,16 @@ Exclude the target from the all target.
A property on a target that indicates if the target is excluded from
the default build target. If it is not, then with a Makefile for
example typing make will cause this target to be built. The same
-concept applies to the default build of other generators. Installing
-a target with EXCLUDE_FROM_ALL set to true has undefined behavior.
+concept applies to the default build of other generators.
+
+With ``EXCLUDE_FROM_ALL`` set to false or not set at all, the target
+will be brought up to date as part of doing a ``make install`` or its
+equivalent for the CMake generator being used. If a target has
+``EXCLUDE_FROM_ALL`` set to true, then any attempt to install that
+target has undefined behavior. Note that such a target can still safely
+be listed in an :command:`install(TARGETS)` command as long as the install
+components the target belongs to are not part of the set of components
+that anything tries to install.
This property is enabled by default for targets that are created in
directories that have :prop_dir:`EXCLUDE_FROM_ALL` set to ``TRUE``.
diff --git a/Help/release/3.14.rst b/Help/release/3.14.rst
index a04005c..0246071 100644
--- a/Help/release/3.14.rst
+++ b/Help/release/3.14.rst
@@ -166,6 +166,11 @@ Modules
:command:`check_fortran_source_runs` command to check if a Fortran
source snippet compiles and runs.
+* The :module:`CMakePackageConfigHelpers` module's
+ :command:`write_basic_package_version_file` command gained a new
+ ``ARCH_INDEPENDENT`` option for supporting architecture-independent
+ packages.
+
* The :module:`ExternalProject` module :command:`ExternalProject_Add` command
gained ``LOG_DIR`` and ``LOG_MERGED_STDOUTERR`` options to control logging.
@@ -370,3 +375,7 @@ Other Changes
:variable:`CPACK_DEBIAN_ARCHIVE_TYPE` variable, because ``dpkg`` has
never supported the PAX tar format. The ``paxr`` value will be mapped
to ``gnutar`` and a deprecation message emitted.
+
+* CMake no longer issues a warning if a target listed in an
+ :command:`install(TARGETS)` command has its :prop_tgt:`EXCLUDE_FROM_ALL`
+ property set to true.
diff --git a/Help/release/dev/add-xlclang.rst b/Help/release/dev/add-xlclang.rst
new file mode 100644
index 0000000..77ff938
--- /dev/null
+++ b/Help/release/dev/add-xlclang.rst
@@ -0,0 +1,5 @@
+add-xlclang
+-----------
+
+* IBM Clang-based XL compilers that define ``__ibmxl__`` now use the
+ compiler id ``XLClang`` instead of ``XL``. See policy :policy:`CMP0089`.
diff --git a/Help/release/dev/deprecate-policy-old.rst b/Help/release/dev/deprecate-policy-old.rst
new file mode 100644
index 0000000..b94f4b7
--- /dev/null
+++ b/Help/release/dev/deprecate-policy-old.rst
@@ -0,0 +1,8 @@
+deprecate-policy-old
+--------------------
+
+* An explicit deprecation diagnostic was added for policy ``CMP0066``
+ (``CMP0065`` and below were already deprecated).
+ The :manual:`cmake-policies(7)` manual explains that the OLD behaviors
+ of all policies are deprecated and that projects should port to the
+ NEW behaviors.
diff --git a/Help/release/dev/list-prepend-and-pop-subcommands.rst b/Help/release/dev/list-prepend-and-pop-subcommands.rst
new file mode 100644
index 0000000..16b14f1
--- /dev/null
+++ b/Help/release/dev/list-prepend-and-pop-subcommands.rst
@@ -0,0 +1,4 @@
+list-prepend-and-pop-subcommands
+--------------------------------
+
+* :command:`list` learned new sub-commands ``PREPEND``, ``POP_FRONT`` and ``POP_BACK``.
diff --git a/Help/variable/CMAKE_LANG_COMPILER_ID.rst b/Help/variable/CMAKE_LANG_COMPILER_ID.rst
index 5323880..2bb3979 100644
--- a/Help/variable/CMAKE_LANG_COMPILER_ID.rst
+++ b/Help/variable/CMAKE_LANG_COMPILER_ID.rst
@@ -24,7 +24,6 @@ include:
HP = Hewlett-Packard Compiler (hp.com)
IAR = IAR Systems (iar.com)
Intel = Intel Compiler (intel.com)
- MIPSpro = SGI MIPSpro (sgi.com)
MSVC = Microsoft Visual Studio (microsoft.com)
NVIDIA = NVIDIA CUDA Compiler (nvidia.com)
OpenWatcom = Open Watcom (openwatcom.org)
diff --git a/Help/variable/CMAKE_LANG_IMPLICIT_INCLUDE_DIRECTORIES.rst b/Help/variable/CMAKE_LANG_IMPLICIT_INCLUDE_DIRECTORIES.rst
index cc80851..e361fd9 100644
--- a/Help/variable/CMAKE_LANG_IMPLICIT_INCLUDE_DIRECTORIES.rst
+++ b/Help/variable/CMAKE_LANG_IMPLICIT_INCLUDE_DIRECTORIES.rst
@@ -6,4 +6,9 @@ Directories implicitly searched by the compiler for header files.
CMake does not explicitly specify these directories on compiler
command lines for language ``<LANG>``. This prevents system include
directories from being treated as user include directories on some
-compilers.
+compilers, which is important for ``C``, ``CXX``, and ``CUDA`` to
+avoid overriding standard library headers.
+
+This value is not used for ``Fortran`` because it has no standard
+library headers and some compilers do not search their implicit
+include directories for module ``.mod`` files.
diff --git a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst
index d179728..fc52e7b 100644
--- a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst
+++ b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst
@@ -21,6 +21,8 @@ warn by default:
policy :policy:`CMP0067`.
* ``CMAKE_POLICY_WARNING_CMP0082`` controls the warning for
policy :policy:`CMP0082`.
+* ``CMAKE_POLICY_WARNING_CMP0089`` controls the warning for
+ policy :policy:`CMP0089`.
This variable should not be set by a project in CMake code. Project
developers running CMake may set this variable in their cache to
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
index 4d0c681..96a14f7 100644
--- a/Modules/CMakeCompilerIdDetection.cmake
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -57,6 +57,7 @@ function(compiler_id_detection outvar lang)
HP
Compaq
zOS
+ XLClang
XL
VisualAge
PGI
@@ -86,8 +87,6 @@ function(compiler_id_detection outvar lang)
SDCC
)
endif()
- list(APPEND ordered_compilers
- MIPSpro)
#Currently the only CUDA compilers are NVIDIA
if(lang STREQUAL CUDA)
diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake
index dbc41c8..b8c8c5d 100644
--- a/Modules/CMakeDetermineASMCompiler.cmake
+++ b/Modules/CMakeDetermineASMCompiler.cmake
@@ -83,7 +83,7 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_XL "XL C")
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS MSVC )
- set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_MSVC "/?")
+ set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_MSVC "-?")
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_MSVC "Microsoft")
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS TI )
@@ -110,6 +110,10 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_ADSP "-version")
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_ADSP "Analog Devices")
+ list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS QCC)
+ set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_QCC "-V")
+ set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_QCC "gcc_nto")
+
include(CMakeDetermineCompilerId)
set(userflags)
CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT} "${userflags}")
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 83ce392..8ba4246 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -824,7 +824,7 @@ function(CMAKE_DIAGNOSE_UNSUPPORTED_CLANG lang envvar)
endif()
# Test whether an MSVC-like command-line option works.
- execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" /?
+ execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" -?
RESULT_VARIABLE _clang_result
OUTPUT_VARIABLE _clang_stdout
ERROR_VARIABLE _clang_stderr)
diff --git a/Modules/CMakeDetermineVSServicePack.cmake b/Modules/CMakeDetermineVSServicePack.cmake
index 9edc309..a3c4d9c 100644
--- a/Modules/CMakeDetermineVSServicePack.cmake
+++ b/Modules/CMakeDetermineVSServicePack.cmake
@@ -79,7 +79,7 @@ endfunction()
function(_DetermineVSServicePack_FastCheckVersionWithCompiler _SUCCESS_VAR _VERSION_VAR)
if(EXISTS ${CMAKE_CXX_COMPILER})
execute_process(
- COMMAND ${CMAKE_CXX_COMPILER} /?
+ COMMAND ${CMAKE_CXX_COMPILER} -?
ERROR_VARIABLE _output
OUTPUT_QUIET
)
diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in
index 5995694..30f8d4c 100644
--- a/Modules/CMakeFortranCompilerId.F.in
+++ b/Modules/CMakeFortranCompilerId.F.in
@@ -96,13 +96,6 @@
# if defined(__FLANG_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__FLANG_PATCHLEVEL__)
# endif
-#elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
- PRINT *, 'INFO:compiler[MIPSpro]'
-# if 0
-! This compiler is either not known or is too old to define an
-! identification macro. Try to identify the platform and guess that
-! it is the native compiler.
-# endif
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
PRINT *, 'INFO:compiler[VisualAge]'
#elif defined(__hpux) || defined(__hpux__)
diff --git a/Modules/CMakeParseImplicitIncludeInfo.cmake b/Modules/CMakeParseImplicitIncludeInfo.cmake
index 21e24b7..6d7732d 100644
--- a/Modules/CMakeParseImplicitIncludeInfo.cmake
+++ b/Modules/CMakeParseImplicitIncludeInfo.cmake
@@ -92,13 +92,15 @@ function(cmake_parse_implicit_include_line line lang id_var log_var state_var)
endif()
# XL compiler
- if("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "XL" AND "${line}" MATCHES "^/"
+ if(("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "XL"
+ OR "${CMAKE_${lang}_COMPILER_ID}" STREQUAL "XLClang")
+ AND "${line}" MATCHES "^/"
AND ( ("${lang}" STREQUAL "Fortran" AND
"${line}" MATCHES "/xl[fF]entry " AND
"${line}" MATCHES "OSVAR\\([^ ]+\\)")
OR
( ("${lang}" STREQUAL "C" OR "${lang}" STREQUAL "CXX") AND
- "${line}" MATCHES "/xl[cC]entry " AND
+ "${line}" MATCHES "/xl[cC]2?entry " AND
"${line}" MATCHES " -qosvar=")
) )
# -qnostdinc cancels other stdinc flags, even if present
diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake
index 7db976b..5e3f195 100644
--- a/Modules/CheckCXXSourceRuns.cmake
+++ b/Modules/CheckCXXSourceRuns.cmake
@@ -103,7 +103,8 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
-DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH}
"${CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES}"
- COMPILE_OUTPUT_VARIABLE OUTPUT)
+ COMPILE_OUTPUT_VARIABLE OUTPUT
+ RUN_OUTPUT_VARIABLE RUN_OUTPUT)
# if it did not compile make the return value fail code of 1
if(NOT ${VAR}_COMPILED)
@@ -118,6 +119,8 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Performing C++ SOURCE FILE Test ${VAR} succeeded with the following output:\n"
"${OUTPUT}\n"
+ "...and run output:\n"
+ "${RUN_OUTPUT}\n"
"Return value: ${${VAR}}\n"
"Source file was:\n${SOURCE}\n")
else()
@@ -133,6 +136,8 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n"
"${OUTPUT}\n"
+ "...and run output:\n"
+ "${RUN_OUTPUT}\n"
"Return value: ${${VAR}_EXITCODE}\n"
"Source file was:\n${SOURCE}\n")
endif()
diff --git a/Modules/CheckFortranSourceRuns.cmake b/Modules/CheckFortranSourceRuns.cmake
index 13fdb0b..a80c13d 100644
--- a/Modules/CheckFortranSourceRuns.cmake
+++ b/Modules/CheckFortranSourceRuns.cmake
@@ -133,7 +133,8 @@ macro(CHECK_Fortran_SOURCE_RUNS SOURCE VAR)
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
-DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH}
"${CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES}"
- COMPILE_OUTPUT_VARIABLE OUTPUT)
+ COMPILE_OUTPUT_VARIABLE OUTPUT
+ RUN_OUTPUT_VARIABLE RUN_OUTPUT)
# if it did not compile make the return value fail code of 1
if(NOT ${VAR}_COMPILED)
@@ -148,6 +149,8 @@ macro(CHECK_Fortran_SOURCE_RUNS SOURCE VAR)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Performing Fortran SOURCE FILE Test ${VAR} succeeded with the following output:\n"
"${OUTPUT}\n"
+ "...and run output:\n"
+ "${RUN_OUTPUT}\n"
"Return value: ${${VAR}}\n"
"Source file was:\n${SOURCE}\n")
else()
@@ -163,6 +166,8 @@ macro(CHECK_Fortran_SOURCE_RUNS SOURCE VAR)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing Fortran SOURCE FILE Test ${VAR} failed with the following output:\n"
"${OUTPUT}\n"
+ "...and run output:\n"
+ "${RUN_OUTPUT}\n"
"Return value: ${${VAR}_EXITCODE}\n"
"Source file was:\n${SOURCE}\n")
endif()
diff --git a/Modules/Compiler/CrayPrgEnv.cmake b/Modules/Compiler/CrayPrgEnv.cmake
index 6c1c770..e55e587 100644
--- a/Modules/Compiler/CrayPrgEnv.cmake
+++ b/Modules/Compiler/CrayPrgEnv.cmake
@@ -1,8 +1,93 @@
# Guard against multiple inclusions
-if(__craylinux_crayprgenv)
+if(__cmake_craype_crayprgenv)
return()
endif()
-set(__craylinux_crayprgenv 1)
+set(__cmake_craype_crayprgenv 1)
+
+# CrayPrgEnv: loaded when compiling through the Cray compiler wrapper.
+# The compiler wrapper can run on a front-end node or a compute node.
+
+cmake_policy(PUSH)
+cmake_policy(SET CMP0057 NEW) # if IN_LIST
+
+# One-time setup of the craype environment. First, check the wrapper config.
+# The wrapper's selection of a compiler (gcc, clang, intel, etc.) and
+# default include/library paths is selected using the "module" command.
+# The CRAYPE_LINK_TYPE environment variable partly controls if static
+# or dynamic binaries are generated (see __cmake_craype_linktype below).
+# Running cmake and then changing module and/or linktype configuration
+# may cause build problems (since the data in the cmake cache may no
+# longer be correct after the change). We can look for this and warn
+# the user about it. Second, use the "module" provided PKG_CONFIG_PATH-like
+# environment variable to add additional prefixes to the system prefix
+# path.
+function(__cmake_craype_setupenv)
+ if(NOT DEFINED __cmake_craype_setupenv_done) # only done once per run
+ set(__cmake_craype_setupenv_done 1 PARENT_SCOPE)
+ unset(__cmake_check)
+ set(CMAKE_CRAYPE_LINKTYPE "$ENV{CRAYPE_LINK_TYPE}" CACHE STRING
+ "saved value of CRAYPE_LINK_TYPE environment variable")
+ set(CMAKE_CRAYPE_LOADEDMODULES "$ENV{LOADEDMODULES}" CACHE STRING
+ "saved value of LOADEDMODULES environment variable")
+ mark_as_advanced(CMAKE_CRAYPE_LINKTYPE CMAKE_CRAYPE_LOADEDMODULES)
+ if (NOT "${CMAKE_CRAYPE_LINKTYPE}" STREQUAL "$ENV{CRAYPE_LINK_TYPE}")
+ string(APPEND __cmake_check "CRAYPE_LINK_TYPE ")
+ endif()
+ if (NOT "${CMAKE_CRAYPE_LOADEDMODULES}" STREQUAL "$ENV{LOADEDMODULES}")
+ string(APPEND __cmake_check "LOADEDMODULES ")
+ endif()
+ if(DEFINED __cmake_check)
+ message(STATUS "NOTE: ${__cmake_check}changed since initial config!")
+ message(STATUS "NOTE: this may cause unexpected build errors.")
+ endif()
+ # loop over variables of interest
+ foreach(pkgcfgvar PKG_CONFIG_PATH PKG_CONFIG_PATH_DEFAULT
+ PE_PKG_CONFIG_PATH)
+ file(TO_CMAKE_PATH "$ENV{${pkgcfgvar}}" pkgcfg)
+ foreach(path ${pkgcfg})
+ string(REGEX REPLACE "(.*)/lib[^/]*/pkgconfig$" "\\1" path "${path}")
+ if(NOT "${path}" STREQUAL "" AND
+ NOT "${path}" IN_LIST CMAKE_SYSTEM_PREFIX_PATH)
+ list(APPEND CMAKE_SYSTEM_PREFIX_PATH "${path}")
+ endif()
+ endforeach()
+ endforeach()
+ # push it up out of this function into the parent scope
+ set(CMAKE_SYSTEM_PREFIX_PATH "${CMAKE_SYSTEM_PREFIX_PATH}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+# The wrapper disables dynamic linking by default. Dynamic linking is
+# enabled either by setting $ENV{CRAYPE_LINK_TYPE} to "dynamic" or by
+# specifying "-dynamic" to the wrapper when linking. Specifying "-static"
+# to the wrapper when linking takes priority over $ENV{CRAYPE_LINK_TYPE}.
+# Furthermore, if you specify multiple "-dynamic" and "-static" flags to
+# the wrapper when linking, the last one will win. In this case, the
+# wrapper will also print a warning like:
+# Warning: -dynamic was already seen on command line, overriding with -static.
+#
+# note that cmake applies both CMAKE_${lang}_FLAGS and CMAKE_EXE_LINKER_FLAGS
+# (in that order) to the linking command, so -dynamic can appear in either
+# variable.
+function(__cmake_craype_linktype lang rv)
+ # start with ENV, but allow flags to override
+ if("$ENV{CRAYPE_LINK_TYPE}" STREQUAL "dynamic")
+ set(linktype dynamic)
+ else()
+ set(linktype static)
+ endif()
+ # combine flags and convert to a list so we can apply the flags in order
+ set(linkflags "${CMAKE_${lang}_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}")
+ string(REPLACE " " ";" linkflags "${linkflags}")
+ foreach(flag IN LISTS linkflags)
+ if("${flag}" STREQUAL "-dynamic")
+ set(linktype dynamic)
+ elseif("${flag}" STREQUAL "-static")
+ set(linktype static)
+ endif()
+ endforeach()
+ set(${rv} ${linktype} PARENT_SCOPE)
+endfunction()
macro(__CrayPrgEnv_setup lang)
if(DEFINED ENV{CRAYPE_VERSION})
@@ -13,25 +98,25 @@ macro(__CrayPrgEnv_setup lang)
message(STATUS "Cray Programming Environment (unknown version) ${lang}")
endif()
+ # setup the craype environment
+ __cmake_craype_setupenv()
+
# Flags for the Cray wrappers
set(CMAKE_STATIC_LIBRARY_LINK_${lang}_FLAGS "-static")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-dynamic")
- # If the link type is not explicitly specified in the environment then
- # the Cray wrappers assume that the code will be built statically so
- # we check the following condition(s) are NOT met
- # Compiler flags are explicitly dynamic
- # Env var is dynamic and compiler flags are not explicitly static
- if(NOT (((CMAKE_${lang}_FLAGS MATCHES "(^| )-dynamic($| )") OR
- (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-dynamic($| )"))
- OR
- (("$ENV{CRAYPE_LINK_TYPE}" STREQUAL "dynamic") AND
- NOT ((CMAKE_${lang}_FLAGS MATCHES "(^| )-static($| )") OR
- (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-static($| )")))))
+ # determine linktype from environment and compiler flags
+ __cmake_craype_linktype(${lang} __cmake_craype_${lang}_linktype)
+
+ # switch off shared libs if we get a static linktype
+ if("${__cmake_craype_${lang}_linktype}" STREQUAL "static")
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
set(BUILD_SHARED_LIBS FALSE CACHE BOOL "")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(CMAKE_LINK_SEARCH_START_STATIC TRUE)
endif()
+
endmacro()
+
+cmake_policy(POP)
diff --git a/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake b/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake
index e5b9741..899e284 100644
--- a/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake
+++ b/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake
@@ -1,14 +1,6 @@
set(_compiler_id_version_compute "
-# if defined(__ibmxl__)
-# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ibmxl_version__)
-# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ibmxl_release__)
-# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ibmxl_modification__)
-# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__ibmxl_ptf_fix_level__)
-# else
- /* __IBMC__ = VRP */
-# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__IBMC__/100)
-# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__IBMC__/10 % 10)
-# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__IBMC__ % 10)
-# endif
-")
+ /* __IBMC__ = VRP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__IBMC__/100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__IBMC__/10 % 10)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__IBMC__ % 10)")
diff --git a/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake b/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake
index 63c3e32..73aa2b4 100644
--- a/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake
+++ b/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake
@@ -1,14 +1,6 @@
set(_compiler_id_version_compute "
-# if defined(__ibmxl__)
-# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ibmxl_version__)
-# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ibmxl_release__)
-# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ibmxl_modification__)
-# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__ibmxl_ptf_fix_level__)
-# else
- /* __IBMCPP__ = VRP */
-# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__IBMCPP__/100)
-# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__IBMCPP__/10 % 10)
-# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__IBMCPP__ % 10)
-# endif
-")
+ /* __IBMCPP__ = VRP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__IBMCPP__/100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__IBMCPP__/10 % 10)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__IBMCPP__ % 10)")
diff --git a/Modules/Compiler/MIPSpro-C.cmake b/Modules/Compiler/MIPSpro-C.cmake
deleted file mode 100644
index 675560c..0000000
--- a/Modules/Compiler/MIPSpro-C.cmake
+++ /dev/null
@@ -1 +0,0 @@
-set(CMAKE_C_VERBOSE_FLAG "-v")
diff --git a/Modules/Compiler/MIPSpro-CXX.cmake b/Modules/Compiler/MIPSpro-CXX.cmake
deleted file mode 100644
index 9fb191c..0000000
--- a/Modules/Compiler/MIPSpro-CXX.cmake
+++ /dev/null
@@ -1 +0,0 @@
-set(CMAKE_CXX_VERBOSE_FLAG "-v")
diff --git a/Modules/Compiler/MIPSpro-DetermineCompiler.cmake b/Modules/Compiler/MIPSpro-DetermineCompiler.cmake
deleted file mode 100644
index 9e48553..0000000
--- a/Modules/Compiler/MIPSpro-DetermineCompiler.cmake
+++ /dev/null
@@ -1,15 +0,0 @@
-
-set(_compiler_id_pp_test "defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)")
-
-set(_compiler_id_version_compute "
-# if defined(_SGI_COMPILER_VERSION)
- /* _SGI_COMPILER_VERSION = VRP */
-# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_SGI_COMPILER_VERSION/100)
-# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_SGI_COMPILER_VERSION/10 % 10)
-# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_SGI_COMPILER_VERSION % 10)
-# else
- /* _COMPILER_VERSION = VRP */
-# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_COMPILER_VERSION/100)
-# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_COMPILER_VERSION/10 % 10)
-# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_COMPILER_VERSION % 10)
-# endif")
diff --git a/Modules/Compiler/MIPSpro-Fortran.cmake b/Modules/Compiler/MIPSpro-Fortran.cmake
deleted file mode 100644
index ffceea8..0000000
--- a/Modules/Compiler/MIPSpro-Fortran.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-set(CMAKE_Fortran_VERBOSE_FLAG "-v")
-set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixedform")
-set(CMAKE_Fortran_FORMAT_FREE_FLAG "-freeform")
diff --git a/Modules/Compiler/QCC-ASM.cmake b/Modules/Compiler/QCC-ASM.cmake
new file mode 100644
index 0000000..9a9935b
--- /dev/null
+++ b/Modules/Compiler/QCC-ASM.cmake
@@ -0,0 +1,2 @@
+include(Compiler/QCC)
+__compiler_qcc(ASM)
diff --git a/Modules/Compiler/XL-C-DetermineCompiler.cmake b/Modules/Compiler/XL-C-DetermineCompiler.cmake
index 484811e..3f4e05c 100644
--- a/Modules/Compiler/XL-C-DetermineCompiler.cmake
+++ b/Modules/Compiler/XL-C-DetermineCompiler.cmake
@@ -1,4 +1,4 @@
-set(_compiler_id_pp_test "defined(__ibmxl__) || (defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800)")
+set(_compiler_id_pp_test "defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800")
include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-C-DetermineVersionInternal.cmake")
diff --git a/Modules/Compiler/XL-C.cmake b/Modules/Compiler/XL-C.cmake
index 5dc8bc1..6fc9728 100644
--- a/Modules/Compiler/XL-C.cmake
+++ b/Modules/Compiler/XL-C.cmake
@@ -6,36 +6,15 @@ string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
# -qthreaded = Ensures that all optimizations will be thread-safe
string(APPEND CMAKE_C_FLAGS_INIT " -qthreaded")
-# XL v13.1.1 for Linux ppc64 little-endian switched to using a clang based
-# front end and accepts the -std= option while only reserving -qlanglevel= for
-# compatibility. All other versions (previous versions on Linux ppc64
-# little-endian, all versions on Linux ppc64 big-endian, all versions on AIX
-# and BGQ, etc) are derived from the UNIX compiler and only accept the
-# -qlanglvl option.
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1)
- if (CMAKE_SYSTEM MATCHES "Linux.*ppc64le" AND
- CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1)
- set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89")
- set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu89")
- set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
- set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
- if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2)
- set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
- set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
- else ()
- set(CMAKE_C11_STANDARD_COMPILE_OPTION "-qlanglvl=extc1x")
- set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-qlanglvl=extc1x")
- endif ()
- else ()
- set(CMAKE_C90_STANDARD_COMPILE_OPTION "-qlanglvl=stdc89")
- set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-qlanglvl=extc89")
- set(CMAKE_C99_STANDARD_COMPILE_OPTION "-qlanglvl=stdc99")
- set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-qlanglvl=extc99")
- if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12.1)
- set(CMAKE_C11_STANDARD_COMPILE_OPTION "-qlanglvl=extc1x")
- set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-qlanglvl=extc1x")
- endif ()
+ set(CMAKE_C90_STANDARD_COMPILE_OPTION "-qlanglvl=stdc89")
+ set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-qlanglvl=extc89")
+ set(CMAKE_C99_STANDARD_COMPILE_OPTION "-qlanglvl=stdc99")
+ set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-qlanglvl=extc99")
+ if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12.1)
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "-qlanglvl=extc1x")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-qlanglvl=extc1x")
endif ()
endif()
-__compiler_check_default_language_standard(C 10.1 90)
+__compiler_check_default_language_standard(C 10.1 90 11.1 99)
diff --git a/Modules/Compiler/XL-CXX-DetermineCompiler.cmake b/Modules/Compiler/XL-CXX-DetermineCompiler.cmake
index 2bf1ec6..dffa4bc 100644
--- a/Modules/Compiler/XL-CXX-DetermineCompiler.cmake
+++ b/Modules/Compiler/XL-CXX-DetermineCompiler.cmake
@@ -1,4 +1,4 @@
-set(_compiler_id_pp_test "defined(__ibmxl__) || (defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800)")
+set(_compiler_id_pp_test "defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800")
include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-CXX-DetermineVersionInternal.cmake")
diff --git a/Modules/Compiler/XL-CXX.cmake b/Modules/Compiler/XL-CXX.cmake
index b87e923..0026b4a 100644
--- a/Modules/Compiler/XL-CXX.cmake
+++ b/Modules/Compiler/XL-CXX.cmake
@@ -6,41 +6,16 @@ string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
# -qthreaded = Ensures that all optimizations will be thread-safe
string(APPEND CMAKE_CXX_FLAGS_INIT " -qthreaded")
-# XL v13.1.1 for Linux ppc64 little-endian switched to using a clang based
-# front end and accepts the -std= option while only reserving -qlanglevel= for
-# compatibility. All other versions (previous versions on Linux ppc64
-# little-endian, all versions on Linux ppc64 big-endian, all versions on AIX
-# and BGQ, etc) are derived from the UNIX compiler and only accept the
-# -qlanglvl option.
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1)
- if (CMAKE_SYSTEM MATCHES "Linux.*ppc64")
- if (CMAKE_SYSTEM MATCHES "Linux.*ppc64le" AND
- CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1)
- set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
- set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
- if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2)
- set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
- set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
- set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
- set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-qlanglvl=extended1y")
- else ()
- set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x")
- set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x")
- endif ()
- else ()
- # The non-clang based Linux ppc64 compiler, both big-endian and
- # little-endian lacks, the non-extension language level flags
- set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-qlanglvl=extended")
- set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-qlanglvl=extended")
- set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x")
- set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x")
- endif ()
- else ()
+ if(CMAKE_SYSTEM MATCHES "Linux")
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "")
+ else()
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-qlanglvl=strict98")
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-qlanglvl=extended")
- set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x")
- set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x")
- endif ()
+ endif()
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x")
endif ()
__compiler_check_default_language_standard(CXX 10.1 98)
diff --git a/Modules/Compiler/XL.cmake b/Modules/Compiler/XL.cmake
index 68dc28a..a9cec11 100644
--- a/Modules/Compiler/XL.cmake
+++ b/Modules/Compiler/XL.cmake
@@ -10,12 +10,6 @@ set(__COMPILER_XL 1)
include(Compiler/CMakeCommonCompilerMacros)
-# Find the CreateExportList program that comes with this toolchain.
-find_program(CMAKE_XL_CreateExportList
- NAMES CreateExportList
- DOC "IBM XL CreateExportList tool"
- )
-
macro(__compiler_xl lang)
# Feature flags.
set(CMAKE_${lang}_VERBOSE_FLAG "-V")
@@ -35,20 +29,4 @@ macro(__compiler_xl lang)
set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
set(CMAKE_DEPFILE_FLAGS_${lang} "-MF <DEPFILE> -qmakedep=gcc")
-
- # CMAKE_XL_CreateExportList is part of the AIX XL compilers but not the linux ones.
- # If we found the tool, we'll use it to create exports, otherwise stick with the regular
- # create shared library compile line.
- if (CMAKE_XL_CreateExportList)
- # The compiler front-end passes all object files, archive files, and shared
- # library files named on the command line to CreateExportList to create a
- # list of all symbols to be exported from the shared library. This causes
- # all archive members to be copied into the shared library whether they are
- # needed or not. Instead we run the tool ourselves to pass only the object
- # files so that we export only the symbols actually provided by the sources.
- set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
- "${CMAKE_XL_CreateExportList} <OBJECT_DIR>/objects.exp <OBJECTS>"
- "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/objects.exp <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
- )
- endif()
endmacro()
diff --git a/Modules/Compiler/XLClang-C-DetermineCompiler.cmake b/Modules/Compiler/XLClang-C-DetermineCompiler.cmake
new file mode 100644
index 0000000..4d89921
--- /dev/null
+++ b/Modules/Compiler/XLClang-C-DetermineCompiler.cmake
@@ -0,0 +1,8 @@
+set(_compiler_id_pp_test "defined(__ibmxl__) && defined(__clang__)")
+
+set(_compiler_id_version_compute "
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ibmxl_version__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ibmxl_release__)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ibmxl_modification__)
+# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__ibmxl_ptf_fix_level__)
+")
diff --git a/Modules/Compiler/XLClang-C.cmake b/Modules/Compiler/XLClang-C.cmake
new file mode 100644
index 0000000..8e8fcf2
--- /dev/null
+++ b/Modules/Compiler/XLClang-C.cmake
@@ -0,0 +1,17 @@
+include(Compiler/XLClang)
+__compiler_xlclang(C)
+
+if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1)
+ set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89")
+ set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu89")
+ set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
+ set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "-qlanglvl=extc1x")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-qlanglvl=extc1x")
+ if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2)
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
+ endif ()
+endif()
+
+__compiler_check_default_language_standard(C 13.1.1 99)
diff --git a/Modules/Compiler/XLClang-CXX-DetermineCompiler.cmake b/Modules/Compiler/XLClang-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..4d89921
--- /dev/null
+++ b/Modules/Compiler/XLClang-CXX-DetermineCompiler.cmake
@@ -0,0 +1,8 @@
+set(_compiler_id_pp_test "defined(__ibmxl__) && defined(__clang__)")
+
+set(_compiler_id_version_compute "
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ibmxl_version__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ibmxl_release__)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ibmxl_modification__)
+# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__ibmxl_ptf_fix_level__)
+")
diff --git a/Modules/Compiler/XLClang-CXX.cmake b/Modules/Compiler/XLClang-CXX.cmake
new file mode 100644
index 0000000..f535ebc
--- /dev/null
+++ b/Modules/Compiler/XLClang-CXX.cmake
@@ -0,0 +1,20 @@
+include(Compiler/XLClang)
+__compiler_xlclang(CXX)
+
+if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1)
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x")
+ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2)
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
+ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
+ set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
+ endif ()
+endif()
+
+__compiler_check_default_language_standard(CXX 13.1.1 98)
+
+set(CMAKE_CXX_COMPILE_OBJECT
+ "<CMAKE_CXX_COMPILER> -x c++ <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
diff --git a/Modules/Compiler/XLClang.cmake b/Modules/Compiler/XLClang.cmake
new file mode 100644
index 0000000..cdf0fdc
--- /dev/null
+++ b/Modules/Compiler/XLClang.cmake
@@ -0,0 +1,22 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+
+# This module is shared by multiple languages; use include blocker.
+if(__COMPILER_XLCLANG)
+ return()
+endif()
+set(__COMPILER_XLCLANG 1)
+
+include(Compiler/XL)
+
+macro(__compiler_xlclang lang)
+ __compiler_xl(${lang})
+
+ # Feature flags.
+ set(CMAKE_${lang}_VERBOSE_FLAG "-V")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIC")
+ set(CMAKE_${lang}_RESPONSE_FILE_FLAG "@")
+ set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "@")
+endmacro()
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
index 7e37212..5a34b9e 100644
--- a/Modules/FindOpenMP.cmake
+++ b/Modules/FindOpenMP.cmake
@@ -96,7 +96,6 @@ function(_OPENMP_FLAG_CANDIDATES LANG)
else()
set(OMP_FLAG_Intel "-qopenmp")
endif()
- set(OMP_FLAG_MIPSpro "-mp")
set(OMP_FLAG_MSVC "-openmp")
set(OMP_FLAG_PathScale "-openmp")
set(OMP_FLAG_NAG "-openmp")
diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt
index e3b81d7..381080b 100644
--- a/Modules/FortranCInterface/CMakeLists.txt
+++ b/Modules/FortranCInterface/CMakeLists.txt
@@ -15,11 +15,11 @@ int main() { return 0; }
# List manglings of global symbol names to try.
set(global_symbols
my_sub # VisualAge
- my_sub_ # GNU, Intel, HP, SunPro, MIPSpro, PGI
+ my_sub_ # GNU, Intel, HP, SunPro, PGI
my_sub__ # GNU g77
MY_SUB # Intel on Windows
mysub # VisualAge
- mysub_ # GNU, Intel, HP, SunPro, MIPSpro, PGI
+ mysub_ # GNU, Intel, HP, SunPro, PGI
MYSUB # Intel on Windows
${FortranCInterface_GLOBAL_SYMBOLS}
)
@@ -48,7 +48,6 @@ set(module_symbols
list(REMOVE_DUPLICATES module_symbols)
# Note that some compiler manglings cannot be invoked from C:
-# MIPSpro uses "MY_SUB.in.MY_MODULE"
# SunPro uses "my_module.my_sub_"
# PathScale uses "MY_SUB.in.MY_MODULE"
diff --git a/Modules/Platform/AIX-XL.cmake b/Modules/Platform/AIX-XL.cmake
index b3078ff..06a806b 100644
--- a/Modules/Platform/AIX-XL.cmake
+++ b/Modules/Platform/AIX-XL.cmake
@@ -25,4 +25,26 @@ macro(__aix_compiler_xl lang)
set(CMAKE_SHARED_MODULE_${lang}_FLAGS " ")
set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath")
+
+ # Find the CreateExportList program that comes with this toolchain.
+ find_program(CMAKE_XL_CreateExportList
+ NAMES CreateExportList
+ DOC "IBM XL CreateExportList tool"
+ )
+
+ # CMAKE_XL_CreateExportList is part of the AIX XL compilers but not the linux ones.
+ # If we found the tool, we'll use it to create exports, otherwise stick with the regular
+ # create shared library compile line.
+ if (CMAKE_XL_CreateExportList)
+ # The compiler front-end passes all object files, archive files, and shared
+ # library files named on the command line to CreateExportList to create a
+ # list of all symbols to be exported from the shared library. This causes
+ # all archive members to be copied into the shared library whether they are
+ # needed or not. Instead we run the tool ourselves to pass only the object
+ # files so that we export only the symbols actually provided by the sources.
+ set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
+ "${CMAKE_XL_CreateExportList} <OBJECT_DIR>/objects.exp <OBJECTS>"
+ "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/objects.exp <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
+ )
+ endif()
endmacro()
diff --git a/Modules/Platform/AIX-XLClang-C.cmake b/Modules/Platform/AIX-XLClang-C.cmake
new file mode 100644
index 0000000..f0bedc5
--- /dev/null
+++ b/Modules/Platform/AIX-XLClang-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/AIX-XLClang)
+__aix_compiler_xlclang(C)
diff --git a/Modules/Platform/AIX-XLClang-CXX.cmake b/Modules/Platform/AIX-XLClang-CXX.cmake
new file mode 100644
index 0000000..cceb576
--- /dev/null
+++ b/Modules/Platform/AIX-XLClang-CXX.cmake
@@ -0,0 +1,2 @@
+include(Platform/AIX-XLClang)
+__aix_compiler_xlclang(CXX)
diff --git a/Modules/Platform/AIX-XLClang.cmake b/Modules/Platform/AIX-XLClang.cmake
new file mode 100644
index 0000000..c932095
--- /dev/null
+++ b/Modules/Platform/AIX-XLClang.cmake
@@ -0,0 +1,15 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+
+# This module is shared by multiple languages; use include blocker.
+if(__AIX_COMPILER_XLCLANG)
+ return()
+endif()
+set(__AIX_COMPILER_XLCLANG 1)
+
+include(Platform/AIX-XL)
+
+macro(__aix_compiler_xlclang lang)
+ __aix_compiler_xl(${lang})
+endmacro()
diff --git a/Modules/Platform/CrayLinuxEnvironment.cmake b/Modules/Platform/CrayLinuxEnvironment.cmake
index a1a3d3f..f2aaf3f 100644
--- a/Modules/Platform/CrayLinuxEnvironment.cmake
+++ b/Modules/Platform/CrayLinuxEnvironment.cmake
@@ -1,6 +1,5 @@
-# Compute Node Linux doesn't quite work the same as native Linux so all of this
-# needs to be custom. We use the variables defined through Cray's environment
-# modules to set up the right paths for things.
+# CrayLinuxEnvironment: loaded by users cross-compiling on a Cray front-end
+# node by specifying "-DCMAKE_SYSTEM_NAME=CrayLinuxEnvironment" to cmake
set(UNIX 1)
@@ -30,13 +29,6 @@ endif()
# Note: this may need to change in the future with 64-bit ARM
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
-set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
-set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
-set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
-set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
-
-set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
-
# Don't override shared lib support if it's already been set and possibly
# overridden elsewhere by the CrayPrgEnv module
if(NOT CMAKE_FIND_LIBRARY_SUFFIXES)
@@ -44,12 +36,9 @@ if(NOT CMAKE_FIND_LIBRARY_SUFFIXES)
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
endif()
-set(CMAKE_DL_LIBS dl)
+# The rest of this file is based on UnixPaths.cmake, adjusted for Cray
-# Note: Much of this is pulled from UnixPaths.cmake but adjusted to the Cray
-# environment accordingly
-
-# Get the install directory of the running cmake to the search directories
+# add the install directory of the running cmake to the search directories
# CMAKE_ROOT is CMAKE_INSTALL_PREFIX/share/cmake, so we need to go two levels up
get_filename_component(__cmake_install_dir "${CMAKE_ROOT}" PATH)
get_filename_component(__cmake_install_dir "${__cmake_install_dir}" PATH)
@@ -81,7 +70,6 @@ if (NOT CMAKE_FIND_NO_INSTALL_PREFIX)
endif()
list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
- $ENV{SYSROOT_DIR}/usr/include
$ENV{SYSROOT_DIR}/usr/include/X11
)
list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
@@ -95,57 +83,5 @@ list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
$ENV{SYSROOT_DIR}/lib64
)
-# Compute the intersection of several lists
-function(__cray_list_intersect OUTPUT INPUT0)
- if(ARGC EQUAL 2)
- list(APPEND ${OUTPUT} ${${INPUT0}})
- else()
- foreach(I IN LISTS ${INPUT0})
- set(__is_common 1)
- foreach(L IN LISTS ARGN)
- list(FIND ${L} "${I}" __idx)
- if(__idx EQUAL -1)
- set(__is_common 0)
- break()
- endif()
- endforeach()
- if(__is_common)
- list(APPEND ${OUTPUT} "${I}")
- endif()
- endforeach()
- endif()
- set(${OUTPUT} ${${OUTPUT}} PARENT_SCOPE)
-endfunction()
-
-macro(__list_clean_dupes var)
- if(${var})
- list(REMOVE_DUPLICATES ${var})
- endif()
-endmacro()
-
-get_property(__langs GLOBAL PROPERTY ENABLED_LANGUAGES)
-set(__cray_inc_path_vars)
-set(__cray_lib_path_vars)
-foreach(__lang IN LISTS __langs)
- list(APPEND __cray_inc_path_vars CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES)
- list(APPEND __cray_lib_path_vars CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES)
-endforeach()
-if(__cray_inc_path_vars)
- __cray_list_intersect(__cray_implicit_include_dirs ${__cray_inc_path_vars})
- if(__cray_implicit_include_dirs)
- list(INSERT CMAKE_SYSTEM_INCLUDE_PATH 0 ${__cray_implicit_include_dirs})
- endif()
-endif()
-if(__cray_lib_path_vars)
- __cray_list_intersect(__cray_implicit_library_dirs ${__cray_lib_path_vars})
- if(__cray_implicit_library_dirs)
- list(INSERT CMAKE_SYSTEM_LIBRARY_PATH 0 ${__cray_implicit_library_dirs})
- endif()
-endif()
-__list_clean_dupes(CMAKE_SYSTEM_PREFIX_PATH)
-__list_clean_dupes(CMAKE_SYSTEM_INCLUDE_PATH)
-__list_clean_dupes(CMAKE_SYSTEM_LIBRARY_PATH)
-__list_clean_dupes(CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES)
-
# Enable use of lib64 search path variants by default.
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE)
diff --git a/README.rst b/README.rst
index 11bafca..76783ec 100644
--- a/README.rst
+++ b/README.rst
@@ -57,12 +57,19 @@ You need to have a C++ compiler (supporting C++11) and a ``make`` installed.
Run the ``bootstrap`` script you find in the source directory of CMake.
You can use the ``--help`` option to see the supported options.
You may use the ``--prefix=<install_prefix>`` option to specify a custom
-installation directory for CMake. You can run the ``bootstrap`` script from
-within the CMake source directory or any other build directory of your
-choice. Once this has finished successfully, run ``make`` and
-``make install``. In summary::
+installation directory for CMake. Once this has finished successfully,
+run ``make`` and ``make install``.
- $ ./bootstrap && make && sudo make install
+For example, if you simply want to build and install CMake from source,
+you can build directly in the source tree::
+
+ $ ./bootstrap && make && sudo make install
+
+Or, if you plan to develop CMake or otherwise run the test suite, create
+a separate build tree::
+
+ $ mkdir cmake-build && cd cmake-build
+ $ ../cmake-source/bootstrap && make
Windows
^^^^^^^
@@ -79,9 +86,7 @@ There are two ways for building CMake under Windows:
$ pacman -S --needed git base-devel mingw-w64-x86_64-gcc
- and bootstrap as above::
-
- $ ./bootstrap && make
+ and bootstrap as above.
.. _`CMake Download Page`: https://cmake.org/cmake/resources/software.html
.. _`MSYS2`: https://www.msys2.org/
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 9c45022..268efa5 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 20190219)
+set(CMake_VERSION_PATCH 20190226)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index f522ce2..045d93d 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -618,7 +618,7 @@ bool cmCPackWIXGenerator::GenerateMainSourceFileFromTemplate()
std::string mainSourceFilePath = this->CPackTopLevel + "/main.wxs";
- if (!ConfigureFile(wixTemplate.c_str(), mainSourceFilePath.c_str())) {
+ if (!ConfigureFile(wixTemplate, mainSourceFilePath)) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Failed creating '" << mainSourceFilePath
<< "'' from template." << std::endl);
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index fc34ef8..127bcf9 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -1245,7 +1245,8 @@ bool cmCPackGenerator::ConfigureString(const std::string& inString,
return true;
}
-bool cmCPackGenerator::ConfigureFile(const char* inName, const char* outName,
+bool cmCPackGenerator::ConfigureFile(const std::string& inName,
+ const std::string& outName,
bool copyOnly /* = false */)
{
return this->MakefileMap->ConfigureFile(inName, outName, copyOnly, true,
@@ -1254,9 +1255,8 @@ bool cmCPackGenerator::ConfigureFile(const char* inName, const char* outName,
int cmCPackGenerator::CleanTemporaryDirectory()
{
- std::string tempInstallDirectoryWithPostfix =
+ std::string tempInstallDirectory =
this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
- const char* tempInstallDirectory = tempInstallDirectoryWithPostfix.c_str();
if (cmsys::SystemTools::FileExists(tempInstallDirectory)) {
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"- Clean temporary : " << tempInstallDirectory << std::endl);
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index 9e4bf43..3c06d41 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -169,7 +169,8 @@ protected:
virtual const char* GetPackagingInstallPrefix();
virtual std::string FindTemplate(const char* name);
- virtual bool ConfigureFile(const char* inName, const char* outName,
+ virtual bool ConfigureFile(const std::string& inName,
+ const std::string& outName,
bool copyOnly = false);
virtual bool ConfigureString(const std::string& input, std::string& output);
virtual int InitializeInternal();
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index c77eebc..6afd7d5 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -292,9 +292,8 @@ int cmCPackNSISGenerator::PackageFiles()
this->SetOption("CPACK_NSIS_DEFINES", defines.c_str());
}
- this->ConfigureFile(nsisInInstallOptions.c_str(),
- nsisInstallOptions.c_str());
- this->ConfigureFile(nsisInFileName.c_str(), nsisFileName.c_str());
+ this->ConfigureFile(nsisInInstallOptions, nsisInstallOptions);
+ this->ConfigureFile(nsisInFileName, nsisFileName);
std::string nsisCmd = "\"";
nsisCmd += this->GetOption("CPACK_INSTALLER_PROGRAM");
nsisCmd += "\" \"" + nsisFileName + "\"";
diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx
index 85248c6..90e0afe 100644
--- a/Source/CPack/cmCPackOSXX11Generator.cxx
+++ b/Source/CPack/cmCPackOSXX11Generator.cxx
@@ -83,7 +83,7 @@ int cmCPackOSXX11Generator::PackageFiles()
return 0;
}
std::string destFileName = resourcesDirectory + "/" + iconFileName;
- this->ConfigureFile(iconFile, destFileName.c_str(), true);
+ this->ConfigureFile(iconFile, destFileName, true);
this->SetOptionIfNotSet("CPACK_APPLE_GUI_ICON", iconFileName.c_str());
}
@@ -236,7 +236,7 @@ bool cmCPackOSXX11Generator::CopyCreateResourceFile(const std::string& name)
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: "
<< (inFileName ? inFileName : "(NULL)")
<< " to " << destFileName << std::endl);
- this->ConfigureFile(inFileName, destFileName.c_str());
+ this->ConfigureFile(inFileName, destFileName);
return true;
}
*/
@@ -266,7 +266,7 @@ bool cmCPackOSXX11Generator::CopyResourcePlistFile(
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Configure file: " << inFileName << " to " << destFileName
<< std::endl);
- this->ConfigureFile(inFileName.c_str(), destFileName.c_str(), copyOnly);
+ this->ConfigureFile(inFileName, destFileName, copyOnly);
return true;
}
diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx
index d54ab56..8c22c65 100644
--- a/Source/CPack/cmCPackPKGGenerator.cxx
+++ b/Source/CPack/cmCPackPKGGenerator.cxx
@@ -105,7 +105,7 @@ void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile)
// Create the distribution.dist file in the metapackage to turn it
// into a distribution package.
- this->ConfigureFile(distributionTemplate.c_str(), distributionFile.c_str());
+ this->ConfigureFile(distributionTemplate, distributionFile);
}
void cmCPackPKGGenerator::CreateChoiceOutline(
@@ -294,7 +294,7 @@ bool cmCPackPKGGenerator::CopyCreateResourceFile(const std::string& name,
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Configure file: " << (inFileName ? inFileName : "(NULL)")
<< " to " << destFileName << std::endl);
- this->ConfigureFile(inFileName, destFileName.c_str());
+ this->ConfigureFile(inFileName, destFileName);
return true;
}
@@ -322,7 +322,7 @@ bool cmCPackPKGGenerator::CopyResourcePlistFile(const std::string& name,
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Configure file: " << inFileName << " to " << destFileName
<< std::endl);
- this->ConfigureFile(inFileName.c_str(), destFileName.c_str());
+ this->ConfigureFile(inFileName, destFileName);
return true;
}
diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx
index b154caf..83aeb64 100644
--- a/Source/CTest/cmCTestBZR.cxx
+++ b/Source/CTest/cmCTestBZR.cxx
@@ -365,7 +365,7 @@ bool cmCTestBZR::UpdateImpl()
if (opts.empty()) {
opts = this->CTest->GetCTestConfiguration("BZRUpdateOptions");
}
- std::vector<std::string> args = cmSystemTools::ParseArguments(opts.c_str());
+ std::vector<std::string> args = cmSystemTools::ParseArguments(opts);
// TODO: if(this->CTest->GetTestModel() == cmCTest::NIGHTLY)
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index c75f4d4..07bc7e7 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -418,8 +418,8 @@ int cmCTestBuildHandler::ProcessHandler()
int retVal = 0;
int res = cmsysProcess_State_Exited;
if (!this->CTest->GetShowOnly()) {
- res = this->RunMakeCommand(makeCommand.c_str(), &retVal,
- buildDirectory.c_str(), 0, ofs);
+ res = this->RunMakeCommand(makeCommand, &retVal, buildDirectory.c_str(), 0,
+ ofs);
} else {
cmCTestOptionalLog(this->CTest, DEBUG,
"Build with command: " << makeCommand << std::endl,
@@ -766,9 +766,10 @@ void cmCTestBuildHandler::LaunchHelper::WriteScrapeMatchers(
}
}
-int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal,
- const char* dir, int timeout,
- std::ostream& ofs, Encoding encoding)
+int cmCTestBuildHandler::RunMakeCommand(const std::string& command,
+ int* retVal, const char* dir,
+ int timeout, std::ostream& ofs,
+ Encoding encoding)
{
// First generate the command and arguments
std::vector<std::string> args = cmSystemTools::ParseArguments(command);
diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h
index a9b121b..722c590 100644
--- a/Source/CTest/cmCTestBuildHandler.h
+++ b/Source/CTest/cmCTestBuildHandler.h
@@ -52,7 +52,7 @@ private:
//! Run command specialized for make and configure. Returns process status
// and retVal is return value or exception.
- int RunMakeCommand(const char* command, int* retVal, const char* dir,
+ int RunMakeCommand(const std::string& command, int* retVal, const char* dir,
int timeout, std::ostream& ofs,
Encoding encoding = cmProcessOutput::Auto);
diff --git a/Source/CTest/cmCTestCVS.cxx b/Source/CTest/cmCTestCVS.cxx
index 6e8f73f..9c03839 100644
--- a/Source/CTest/cmCTestCVS.cxx
+++ b/Source/CTest/cmCTestCVS.cxx
@@ -78,7 +78,7 @@ bool cmCTestCVS::UpdateImpl()
opts = "-dP";
}
}
- std::vector<std::string> args = cmSystemTools::ParseArguments(opts.c_str());
+ std::vector<std::string> args = cmSystemTools::ParseArguments(opts);
// Specify the start time for nightly testing.
if (this->CTest->GetTestModel() == cmCTest::NIGHTLY) {
diff --git a/Source/CTest/cmCTestConfigureHandler.cxx b/Source/CTest/cmCTestConfigureHandler.cxx
index 6b7601b..7e93189 100644
--- a/Source/CTest/cmCTestConfigureHandler.cxx
+++ b/Source/CTest/cmCTestConfigureHandler.cxx
@@ -61,7 +61,7 @@ int cmCTestConfigureHandler::ProcessHandler()
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Configure with command: " << cCommand << std::endl,
this->Quiet);
- res = this->CTest->RunMakeCommand(cCommand.c_str(), output, &retVal,
+ res = this->CTest->RunMakeCommand(cCommand, output, &retVal,
buildDirectory.c_str(),
cmDuration::zero(), ofs);
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 4dda9ad..d76bd2a 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -1004,7 +1004,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
static_cast<void>(locale_C);
std::vector<std::string> basecovargs =
- cmSystemTools::ParseArguments(gcovExtraFlags.c_str());
+ cmSystemTools::ParseArguments(gcovExtraFlags);
basecovargs.insert(basecovargs.begin(), gcovCommand);
basecovargs.emplace_back("-o");
@@ -1377,7 +1377,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
static_cast<void>(locale_C);
std::vector<std::string> covargs =
- cmSystemTools::ParseArguments(lcovExtraFlags.c_str());
+ cmSystemTools::ParseArguments(lcovExtraFlags);
covargs.insert(covargs.begin(), lcovCommand);
const std::string command = joinCommandLine(covargs);
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index 210abe5..11cd005 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -162,7 +162,7 @@ bool cmCTestGIT::UpdateByFetchAndReset()
if (opts.empty()) {
opts = this->CTest->GetCTestConfiguration("GITUpdateOptions");
}
- std::vector<std::string> args = cmSystemTools::ParseArguments(opts.c_str());
+ std::vector<std::string> args = cmSystemTools::ParseArguments(opts);
for (std::string const& arg : args) {
git_fetch.push_back(arg.c_str());
}
diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx
index 6fb99d8..727c59c 100644
--- a/Source/CTest/cmCTestHG.cxx
+++ b/Source/CTest/cmCTestHG.cxx
@@ -144,7 +144,7 @@ bool cmCTestHG::UpdateImpl()
if (opts.empty()) {
opts = this->CTest->GetCTestConfiguration("HGUpdateOptions");
}
- std::vector<std::string> args = cmSystemTools::ParseArguments(opts.c_str());
+ std::vector<std::string> args = cmSystemTools::ParseArguments(opts);
for (std::string const& arg : args) {
hg_update.push_back(arg.c_str());
}
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 954f5bb..22c8469 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -520,7 +520,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
this->CTest->GetCTestConfiguration("ValgrindCommandOptions");
}
this->MemoryTesterOptions =
- cmSystemTools::ParseArguments(memoryTesterOptions.c_str());
+ cmSystemTools::ParseArguments(memoryTesterOptions);
this->MemoryTesterOutputFile =
this->CTest->GetBinaryDir() + "/Testing/Temporary/MemoryChecker.??.log";
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index 63c2fcc..477161a 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -3,12 +3,12 @@
#include "cmCTestMultiProcessHandler.h"
#include "cmAffinity.h"
-#include "cmAlgorithms.h"
#include "cmCTest.h"
#include "cmCTestRunTest.h"
#include "cmCTestTestHandler.h"
#include "cmDuration.h"
#include "cmListFileCache.h"
+#include "cmRange.h"
#include "cmSystemTools.h"
#include "cmWorkingDirectory.h"
@@ -109,8 +109,8 @@ void cmCTestMultiProcessHandler::SetTestLoad(unsigned long load)
fake_load_value)) {
if (!cmSystemTools::StringToULong(fake_load_value.c_str(),
&this->FakeLoadForTesting)) {
- cmSystemTools::Error("Failed to parse fake load value: ",
- fake_load_value.c_str());
+ cmSystemTools::Error("Failed to parse fake load value: " +
+ fake_load_value);
}
}
}
diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx
index ac4753c..7adf640 100644
--- a/Source/CTest/cmCTestP4.cxx
+++ b/Source/CTest/cmCTestP4.cxx
@@ -2,10 +2,10 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestP4.h"
-#include "cmAlgorithms.h"
#include "cmCTest.h"
#include "cmCTestVC.h"
#include "cmProcessTools.h"
+#include "cmRange.h"
#include "cmSystemTools.h"
#include "cmsys/RegularExpression.hxx"
@@ -324,8 +324,7 @@ void cmCTestP4::SetP4Options(std::vector<char const*>& CommandOptions)
// The CTEST_P4_OPTIONS variable adds additional Perforce command line
// options before the main command
std::string opts = this->CTest->GetCTestConfiguration("P4Options");
- std::vector<std::string> args =
- cmSystemTools::ParseArguments(opts.c_str());
+ std::vector<std::string> args = cmSystemTools::ParseArguments(opts);
P4Options.insert(P4Options.end(), args.begin(), args.end());
}
@@ -501,7 +500,7 @@ bool cmCTestP4::UpdateImpl()
if (opts.empty()) {
opts = this->CTest->GetCTestConfiguration("P4UpdateOptions");
}
- std::vector<std::string> args = cmSystemTools::ParseArguments(opts.c_str());
+ std::vector<std::string> args = cmSystemTools::ParseArguments(opts);
for (std::string const& arg : args) {
p4_sync.push_back(arg.c_str());
}
diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx
index 3bf66ca..b7a4e4c 100644
--- a/Source/CTest/cmCTestSVN.cxx
+++ b/Source/CTest/cmCTestSVN.cxx
@@ -242,7 +242,7 @@ bool cmCTestSVN::UpdateImpl()
if (opts.empty()) {
opts = this->CTest->GetCTestConfiguration("SVNUpdateOptions");
}
- std::vector<std::string> args = cmSystemTools::ParseArguments(opts.c_str());
+ std::vector<std::string> args = cmSystemTools::ParseArguments(opts);
// Specify the start time for nightly testing.
if (this->CTest->GetTestModel() == cmCTest::NIGHTLY) {
@@ -277,7 +277,7 @@ bool cmCTestSVN::RunSVNCommand(std::vector<char const*> const& parameters,
std::string userOptions = this->CTest->GetCTestConfiguration("SVNOptions");
std::vector<std::string> parsedUserOptions =
- cmSystemTools::ParseArguments(userOptions.c_str());
+ cmSystemTools::ParseArguments(userOptions);
for (std::string const& opt : parsedUserOptions) {
args.push_back(opt.c_str());
}
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index a714abe..43cfe16 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -331,7 +331,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
}
// make sure the file exists
if (!cmSystemTools::FileExists(script)) {
- cmSystemTools::Error("Cannot find file: ", script.c_str());
+ cmSystemTools::Error("Cannot find file: " + script);
return 1;
}
@@ -471,8 +471,8 @@ int cmCTestScriptHandler::ExtractVariables()
msg += "\nCTEST_COMMAND = ";
msg += (!this->CTestCmd.empty()) ? this->CTestCmd.c_str() : "(Null)";
cmSystemTools::Error(
- "Some required settings in the configuration file were missing:\n",
- msg.c_str());
+ "Some required settings in the configuration file were missing:\n" +
+ msg);
return 4;
}
@@ -611,8 +611,7 @@ int cmCTestScriptHandler::CheckOutSourceDir()
this->CVSCheckOut, &output, &output, &retVal, this->CTestRoot.c_str(),
this->HandlerVerbose, cmDuration::zero() /*this->TimeOut*/);
if (!res || retVal != 0) {
- cmSystemTools::Error("Unable to perform cvs checkout:\n",
- output.c_str());
+ cmSystemTools::Error("Unable to perform cvs checkout:\n" + output);
return 6;
}
}
@@ -678,8 +677,8 @@ int cmCTestScriptHandler::PerformExtraUpdates()
fullCommand, &output, &output, &retVal, cvsArgs[0].c_str(),
this->HandlerVerbose, cmDuration::zero() /*this->TimeOut*/);
if (!res || retVal != 0) {
- cmSystemTools::Error("Unable to perform extra updates:\n", eu.c_str(),
- "\nWith output:\n", output.c_str());
+ cmSystemTools::Error("Unable to perform extra updates:\n" + eu +
+ "\nWith output:\n" + output);
return 0;
}
}
@@ -721,8 +720,8 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
if (!cmSystemTools::FileExists(this->BinaryDir) &&
this->SourceDir != this->BinaryDir) {
if (!cmSystemTools::MakeDirectory(this->BinaryDir)) {
- cmSystemTools::Error("Unable to create the binary directory:\n",
- this->BinaryDir.c_str());
+ cmSystemTools::Error("Unable to create the binary directory:\n" +
+ this->BinaryDir);
this->RestoreBackupDirectories();
return 7;
}
diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx
index 1023808..4956a47 100644
--- a/Source/cmAddDependenciesCommand.cxx
+++ b/Source/cmAddDependenciesCommand.cxx
@@ -4,9 +4,9 @@
#include <sstream>
-#include "cmAlgorithms.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmRange.h"
#include "cmTarget.h"
class cmExecutionStatus;
diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx
index c47092a..7947188 100644
--- a/Source/cmAddSubDirectoryCommand.cxx
+++ b/Source/cmAddSubDirectoryCommand.cxx
@@ -5,8 +5,8 @@
#include <sstream>
#include <string.h>
-#include "cmAlgorithms.h"
#include "cmMakefile.h"
+#include "cmRange.h"
#include "cmSystemTools.h"
class cmExecutionStatus;
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index 1c4160b..2ff1ed0 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -5,6 +5,8 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmRange.h"
+
#include "cm_kwiml.h"
#include <algorithm>
#include <functional>
@@ -156,69 +158,12 @@ private:
};
}
-template <typename const_iterator_>
-struct cmRange
-{
- typedef const_iterator_ const_iterator;
- typedef typename std::iterator_traits<const_iterator>::value_type value_type;
- typedef typename std::iterator_traits<const_iterator>::difference_type
- difference_type;
- cmRange(const_iterator begin_, const_iterator end_)
- : Begin(begin_)
- , End(end_)
- {
- }
- const_iterator begin() const { return Begin; }
- const_iterator end() const { return End; }
- bool empty() const { return std::distance(Begin, End) == 0; }
- difference_type size() const { return std::distance(Begin, End); }
-
- cmRange& advance(KWIML_INT_intptr_t amount) &
- {
- std::advance(this->Begin, amount);
- return *this;
- }
- cmRange advance(KWIML_INT_intptr_t amount) &&
- {
- std::advance(this->Begin, amount);
- return std::move(*this);
- }
-
- cmRange& retreat(KWIML_INT_intptr_t amount) &
- {
- std::advance(End, -amount);
- return *this;
- }
-
- cmRange retreat(KWIML_INT_intptr_t amount) &&
- {
- std::advance(End, -amount);
- return std::move(*this);
- }
-
-private:
- const_iterator Begin;
- const_iterator End;
-};
-
typedef cmRange<std::vector<std::string>::const_iterator> cmStringRange;
class cmListFileBacktrace;
typedef cmRange<std::vector<cmListFileBacktrace>::const_iterator>
cmBacktraceRange;
-template <typename Iter1, typename Iter2>
-cmRange<Iter1> cmMakeRange(Iter1 begin, Iter2 end)
-{
- return cmRange<Iter1>(begin, end);
-}
-
-template <typename Range>
-cmRange<typename Range::const_iterator> cmMakeRange(Range const& range)
-{
- return cmRange<typename Range::const_iterator>(range.begin(), range.end());
-}
-
template <typename Range>
void cmDeleteAll(Range const& r)
{
@@ -334,14 +279,6 @@ typename Range::const_iterator cmFindNot(Range const& r, T const& t)
return std::find_if(r.begin(), r.end(), [&t](T const& i) { return i != t; });
}
-template <typename Range>
-cmRange<typename Range::const_reverse_iterator> cmReverseRange(
- Range const& range)
-{
- return cmRange<typename Range::const_reverse_iterator>(range.rbegin(),
- range.rend());
-}
-
template <class Iter>
std::reverse_iterator<Iter> cmMakeReverseIterator(Iter it)
{
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index ba2fe6c..c77bb97 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -1009,7 +1009,7 @@ int cmCTest::GetTestModelFromString(const char* str)
//######################################################################
//######################################################################
-int cmCTest::RunMakeCommand(const char* command, std::string& output,
+int cmCTest::RunMakeCommand(const std::string& command, std::string& output,
int* retVal, const char* dir, cmDuration timeout,
std::ostream& ofs, Encoding encoding)
{
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index 7dbf4d5..a765fed 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -280,8 +280,9 @@ public:
* Run command specialized for make and configure. Returns process status
* and retVal is return value or exception.
*/
- int RunMakeCommand(const char* command, std::string& output, int* retVal,
- const char* dir, cmDuration timeout, std::ostream& ofs,
+ int RunMakeCommand(const std::string& command, std::string& output,
+ int* retVal, const char* dir, cmDuration timeout,
+ std::ostream& ofs,
Encoding encoding = cmProcessOutput::Auto);
/** Return the current tag */
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 2728f0f..6116de0 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -239,8 +239,7 @@ bool cmCacheManager::SaveCache(const std::string& path, cmMessenger* messenger)
cmGeneratedFileStream fout(cacheFile);
fout.SetCopyIfDifferent(true);
if (!fout) {
- cmSystemTools::Error("Unable to open cache file for save. ",
- cacheFile.c_str());
+ cmSystemTools::Error("Unable to open cache file for save. " + cacheFile);
cmSystemTools::ReportLastSystemError("");
return false;
}
@@ -364,8 +363,8 @@ bool cmCacheManager::SaveCache(const std::string& path, cmMessenger* messenger)
checkCacheFile += "/cmake.check_cache";
cmsys::ofstream checkCache(checkCacheFile.c_str());
if (!checkCache) {
- cmSystemTools::Error("Unable to open check cache file for write. ",
- checkCacheFile.c_str());
+ cmSystemTools::Error("Unable to open check cache file for write. " +
+ checkCacheFile);
return false;
}
checkCache << "# This file is generated by cmake for dependency checking "
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 5ed6c29..186deb6 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -9,6 +9,7 @@
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmRange.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 3d61665..44d8615 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -457,8 +457,8 @@ bool cmComputeLinkInformation::Compute()
// We require a link language for the target.
if (this->LinkLanguage.empty()) {
cmSystemTools::Error(
- "CMake can not determine linker language for target: ",
- this->Target->GetName().c_str());
+ "CMake can not determine linker language for target: " +
+ this->Target->GetName());
return false;
}
@@ -1266,7 +1266,7 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item)
void cmComputeLinkInformation::AddDirectoryItem(std::string const& item)
{
if (this->Makefile->IsOn("APPLE") &&
- cmSystemTools::IsPathToFramework(item.c_str())) {
+ cmSystemTools::IsPathToFramework(item)) {
this->AddFrameworkItem(item);
} else {
this->DropDirectoryItem(item);
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index 70d1675..01d4c07 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmComputeTargetDepends.h"
-#include "cmAlgorithms.h"
#include "cmComputeComponentGraph.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
@@ -12,6 +11,7 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
+#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmState.h"
#include "cmStateTypes.h"
diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx
index 8224a0f..0917d11 100644
--- a/Source/cmConfigureFileCommand.cxx
+++ b/Source/cmConfigureFileCommand.cxx
@@ -102,7 +102,7 @@ bool cmConfigureFileCommand::InitialPass(std::vector<std::string> const& args,
int cmConfigureFileCommand::ConfigureFile()
{
- return this->Makefile->ConfigureFile(
- this->InputFile.c_str(), this->OutputFile.c_str(), this->CopyOnly,
- this->AtOnly, this->EscapeQuotes, this->NewLineStyle);
+ return this->Makefile->ConfigureFile(this->InputFile, this->OutputFile,
+ this->CopyOnly, this->AtOnly,
+ this->EscapeQuotes, this->NewLineStyle);
}
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index eb52895..69d4374 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -950,8 +950,8 @@ void cmCoreTryCompile::CleanupFiles(std::string const& binDir)
if (binDir.find("CMakeTmp") == std::string::npos) {
cmSystemTools::Error(
"TRY_COMPILE attempt to remove -rf directory that does not contain "
- "CMakeTmp:",
- binDir.c_str());
+ "CMakeTmp:" +
+ binDir);
return;
}
diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx
index 69532e6..b78493f 100644
--- a/Source/cmCreateTestSourceList.cxx
+++ b/Source/cmCreateTestSourceList.cxx
@@ -136,8 +136,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args,
this->Makefile->AddDefinition("CMAKE_FUNCTION_TABLE_ENTIRES",
functionMapCode.c_str());
bool res = true;
- if (!this->Makefile->ConfigureFile(configFile.c_str(), driver.c_str(), false,
- true, false)) {
+ if (!this->Makefile->ConfigureFile(configFile, driver, false, true, false)) {
res = false;
}
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index b1630f9..f5c106c 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -173,8 +173,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
// regex.
if (fullName.empty() &&
this->IncludeRegexComplain.find(current.FileName)) {
- cmSystemTools::Error("Cannot find file \"", current.FileName.c_str(),
- "\".");
+ cmSystemTools::Error("Cannot find file \"" + current.FileName + "\".");
return false;
}
diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx
index 75a7786..36651af 100644
--- a/Source/cmExecProgramCommand.cxx
+++ b/Source/cmExecProgramCommand.cxx
@@ -67,7 +67,7 @@ bool cmExecProgramCommand::InitialPass(std::vector<std::string> const& args,
std::string command;
if (!arguments.empty()) {
- command = cmSystemTools::ConvertToRunCommandPath(args[0].c_str());
+ command = cmSystemTools::ConvertToRunCommandPath(args[0]);
command += " ";
command += arguments;
} else {
@@ -152,7 +152,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, std::string& output,
if (!cmSystemTools::FileExists(cmd)) {
shortCmd = cmd;
} else if (!cmSystemTools::GetShortPath(cmd.c_str(), shortCmd)) {
- cmSystemTools::Error("GetShortPath failed for ", cmd.c_str());
+ cmSystemTools::Error("GetShortPath failed for " + cmd);
return false;
}
shortCmd += " ";
diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx
index e542e50..0a0646c 100644
--- a/Source/cmExportLibraryDependenciesCommand.cxx
+++ b/Source/cmExportLibraryDependenciesCommand.cxx
@@ -62,7 +62,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const
std::ostream& fout = *foutPtr;
if (!fout) {
- cmSystemTools::Error("Error Writing ", this->Filename.c_str());
+ cmSystemTools::Error("Error Writing " + this->Filename);
cmSystemTools::ReportLastSystemError("");
return;
}
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 9e90547..93ff8f4 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -13,6 +13,7 @@
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx
index 1b509ef..89629c7 100644
--- a/Source/cmFLTKWrapUICommand.cxx
+++ b/Source/cmFLTKWrapUICommand.cxx
@@ -4,9 +4,9 @@
#include <stddef.h>
-#include "cmAlgorithms.h"
#include "cmCustomCommandLines.h"
#include "cmMakefile.h"
+#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmSystemTools.h"
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 96c9e15..59ef48d 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -34,6 +34,7 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
+#include "cmRange.h"
#include "cmSystemTools.h"
#include "cmTimestamp.h"
#include "cm_sys_stat.h"
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index f92f66e..2e5e29c 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -9,6 +9,7 @@
#include "cmAlgorithms.h"
#include "cmMakefile.h"
+#include "cmRange.h"
#include "cmSearchPath.h"
#include "cmState.h"
#include "cmStateTypes.h"
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 0d22ed8..7ebd211 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -23,6 +23,7 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
+#include "cmRange.h"
#include "cmSearchPath.h"
#include "cmState.h"
#include "cmStateTypes.h"
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
index 39430d0..08003eb 100644
--- a/Source/cmForEachCommand.cxx
+++ b/Source/cmForEachCommand.cxx
@@ -11,6 +11,7 @@
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmRange.h"
#include "cmSystemTools.h"
cmForEachFunctionBlocker::cmForEachFunctionBlocker(cmMakefile* mf)
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index 264a338..9d75b72 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -8,6 +8,7 @@
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmPolicies.h"
+#include "cmRange.h"
#include "cmState.h"
// define the class for function commands
diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx
index 4fe1587..2f47788 100644
--- a/Source/cmGeneratedFileStream.cxx
+++ b/Source/cmGeneratedFileStream.cxx
@@ -29,8 +29,7 @@ cmGeneratedFileStream::cmGeneratedFileStream(std::string const& name,
{
// Check if the file opened.
if (!*this && !quiet) {
- cmSystemTools::Error("Cannot open file for write: ",
- this->TempName.c_str());
+ cmSystemTools::Error("Cannot open file for write: " + this->TempName);
cmSystemTools::ReportLastSystemError("");
}
#ifdef CMAKE_BUILD_WITH_CMAKE
@@ -68,8 +67,7 @@ cmGeneratedFileStream& cmGeneratedFileStream::Open(std::string const& name,
// Check if the file opened.
if (!*this && !quiet) {
- cmSystemTools::Error("Cannot open file for write: ",
- this->TempName.c_str());
+ cmSystemTools::Error("Cannot open file for write: " + this->TempName);
cmSystemTools::ReportLastSystemError("");
}
return *this;
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 6f5e9bd..624333c 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -28,6 +28,7 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPropertyMap.h"
+#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmSourceFileLocation.h"
#include "cmState.h"
@@ -510,21 +511,10 @@ const char* cmGeneratorTarget::GetLinkPIEProperty(
return nullptr;
}
- switch (this->GetPolicyStatusCMP0083()) {
- case cmPolicies::WARN: {
- std::ostringstream e;
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0083);
- this->LocalGenerator->IssueMessage(MessageType::AUTHOR_WARNING, e.str());
- CM_FALLTHROUGH;
- }
- case cmPolicies::OLD:
- return nullptr;
- default:
- // nothing to do
- break;
- }
-
- return PICValue.c_str();
+ auto status = this->GetPolicyStatusCMP0083();
+ return (status != cmPolicies::WARN && status != cmPolicies::OLD)
+ ? PICValue.c_str()
+ : nullptr;
}
bool cmGeneratorTarget::IsIPOEnabled(std::string const& lang,
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index c63e01a..9f8f12b 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -210,7 +210,7 @@ void cmGhsMultiTargetGenerator::WriteCompilerFlags(std::ostream& fout,
if (flagsByLangI != this->FlagsByLanguage.end()) {
if (!flagsByLangI->second.empty()) {
std::vector<std::string> ghsCompFlags =
- cmSystemTools::ParseArguments(flagsByLangI->second.c_str());
+ cmSystemTools::ParseArguments(flagsByLangI->second);
for (auto& f : ghsCompFlags) {
fout << " " << f << std::endl;
}
@@ -265,16 +265,14 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLine(std::ostream& fout,
frameworkPath, linkPath, this->GeneratorTarget);
// write out link options
- std::vector<std::string> lopts =
- cmSystemTools::ParseArguments(linkFlags.c_str());
+ std::vector<std::string> lopts = cmSystemTools::ParseArguments(linkFlags);
for (auto& l : lopts) {
fout << " " << l << std::endl;
}
// write out link search paths
// must be quoted for paths that contain spaces
- std::vector<std::string> lpath =
- cmSystemTools::ParseArguments(linkPath.c_str());
+ std::vector<std::string> lpath = cmSystemTools::ParseArguments(linkPath);
for (auto& l : lpath) {
fout << " -L\"" << l << "\"" << std::endl;
}
@@ -284,7 +282,7 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLine(std::ostream& fout,
std::string cbd = this->LocalGenerator->GetCurrentBinaryDirectory();
std::vector<std::string> llibs =
- cmSystemTools::ParseArguments(linkLibraries.c_str());
+ cmSystemTools::ParseArguments(linkLibraries);
for (auto& l : llibs) {
if (l.compare(0, 2, "-l") == 0) {
fout << " \"" << l << "\"" << std::endl;
diff --git a/Source/cmGlobVerificationManager.cxx b/Source/cmGlobVerificationManager.cxx
index 5fd890e..9fb4170 100644
--- a/Source/cmGlobVerificationManager.cxx
+++ b/Source/cmGlobVerificationManager.cxx
@@ -25,8 +25,8 @@ bool cmGlobVerificationManager::SaveVerificationScript(const std::string& path)
cmGeneratedFileStream verifyScriptFile(scriptFile);
verifyScriptFile.SetCopyIfDifferent(true);
if (!verifyScriptFile) {
- cmSystemTools::Error("Unable to open verification script file for save. ",
- scriptFile.c_str());
+ cmSystemTools::Error("Unable to open verification script file for save. " +
+ scriptFile);
cmSystemTools::ReportLastSystemError("");
return false;
}
@@ -71,8 +71,8 @@ bool cmGlobVerificationManager::SaveVerificationScript(const std::string& path)
cmsys::ofstream verifyStampFile(stampFile.c_str());
if (!verifyStampFile) {
- cmSystemTools::Error("Unable to open verification stamp file for write. ",
- stampFile.c_str());
+ cmSystemTools::Error("Unable to open verification stamp file for write. " +
+ stampFile);
return false;
}
verifyStampFile << "# This file is generated by CMake for checking of the "
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index fa0ffcc..c7b3591 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -35,6 +35,7 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
+#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmState.h"
#include "cmStateDirectory.h"
@@ -212,7 +213,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string& lang,
if (!mf->GetDefinition(langComp)) {
if (!optional) {
- cmSystemTools::Error(langComp.c_str(), " not set, after EnableLanguage");
+ cmSystemTools::Error(langComp + " not set, after EnableLanguage");
}
return;
}
@@ -638,8 +639,7 @@ void cmGlobalGenerator::EnableLanguage(
// to avoid duplicate compiler tests.
if (cmSystemTools::FileExists(fpath)) {
if (!mf->ReadListFile(fpath)) {
- cmSystemTools::Error("Could not find cmake module file: ",
- fpath.c_str());
+ cmSystemTools::Error("Could not find cmake module file: " + fpath);
}
// if this file was found then the language was already determined
// to be working
@@ -664,8 +664,8 @@ void cmGlobalGenerator::EnableLanguage(
determineCompiler += "Compiler.cmake";
std::string determineFile = mf->GetModulesFile(determineCompiler);
if (!mf->ReadListFile(determineFile)) {
- cmSystemTools::Error("Could not find cmake module file: ",
- determineCompiler.c_str());
+ cmSystemTools::Error("Could not find cmake module file: " +
+ determineCompiler);
}
if (cmSystemTools::GetFatalErrorOccured()) {
return;
@@ -699,8 +699,7 @@ void cmGlobalGenerator::EnableLanguage(
fpath += lang;
fpath += "Compiler.cmake";
if (!mf->ReadListFile(fpath)) {
- cmSystemTools::Error("Could not find cmake module file: ",
- fpath.c_str());
+ cmSystemTools::Error("Could not find cmake module file: " + fpath);
}
this->SetLanguageEnabledFlag(lang, mf);
needSetLanguageEnabledMaps[lang] = true;
@@ -792,11 +791,10 @@ void cmGlobalGenerator::EnableLanguage(
fpath += "Information.cmake";
std::string informationFile = mf->GetModulesFile(fpath);
if (informationFile.empty()) {
- cmSystemTools::Error("Could not find cmake module file: ",
- fpath.c_str());
+ cmSystemTools::Error("Could not find cmake module file: " + fpath);
} else if (!mf->ReadListFile(informationFile)) {
- cmSystemTools::Error("Could not process cmake module file: ",
- informationFile.c_str());
+ cmSystemTools::Error("Could not process cmake module file: " +
+ informationFile);
}
}
if (needSetLanguageEnabledMaps[lang]) {
@@ -816,8 +814,8 @@ void cmGlobalGenerator::EnableLanguage(
testLang += "Compiler.cmake";
std::string ifpath = mf->GetModulesFile(testLang);
if (!mf->ReadListFile(ifpath)) {
- cmSystemTools::Error("Could not find cmake module file: ",
- testLang.c_str());
+ cmSystemTools::Error("Could not find cmake module file: " +
+ testLang);
}
std::string compilerWorks = "CMAKE_";
compilerWorks += lang;
@@ -958,6 +956,36 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(
break;
}
}
+
+ if (strcmp(compilerId, "XLClang") == 0) {
+ switch (mf->GetPolicyStatus(cmPolicies::CMP0089)) {
+ case cmPolicies::WARN:
+ if (!this->CMakeInstance->GetIsInTryCompile() &&
+ mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0089")) {
+ std::ostringstream w;
+ /* clang-format off */
+ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0089) << "\n"
+ "Converting " << lang <<
+ " compiler id \"XLClang\" to \"XL\" for compatibility."
+ ;
+ /* clang-format on */
+ mf->IssueMessage(MessageType::AUTHOR_WARNING, w.str());
+ }
+ CM_FALLTHROUGH;
+ case cmPolicies::OLD:
+ // OLD behavior is to convert XLClang to XL.
+ mf->AddDefinition(compilerIdVar, "XL");
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ mf->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0089));
+ case cmPolicies::NEW:
+ // NEW behavior is to keep AppleClang.
+ break;
+ }
+ }
}
std::string cmGlobalGenerator::GetLanguageOutputExtension(
@@ -1706,8 +1734,8 @@ void cmGlobalGenerator::CheckTargetProperties()
cmSystemTools::Error("The following variables are used in this project, "
"but they are set to NOTFOUND.\n"
"Please set them or make sure they are set and "
- "tested correctly in the CMake files:\n",
- notFoundVars.c_str());
+ "tested correctly in the CMake files:\n" +
+ notFoundVars);
}
}
@@ -1851,8 +1879,8 @@ int cmGlobalGenerator::Build(int jobs, const std::string& /*unused*/,
timeout)) {
cmSystemTools::SetRunCommandHideConsole(hideconsole);
cmSystemTools::Error(
- "Generator: execution of make failed. Make command was: ",
- makeCommandStr.c_str());
+ "Generator: execution of make failed. Make command was: " +
+ makeCommandStr);
output += *outputPtr;
output += "\nGenerator: execution of make failed. Make command was: " +
makeCommandStr + "\n";
@@ -1862,13 +1890,6 @@ int cmGlobalGenerator::Build(int jobs, const std::string& /*unused*/,
output += *outputPtr;
cmSystemTools::SetRunCommandHideConsole(hideconsole);
- // The SGI MipsPro 7.3 compiler does not return an error code when
- // the source has a #error in it! This is a work-around for such
- // compilers.
- if ((retVal == 0) && (output.find("#error") != std::string::npos)) {
- retVal = 1;
- }
-
// The OpenWatcom tools do not return an error code when a link
// library is not found!
if (this->CMakeInstance->GetState()->UseWatcomWMake() && retVal == 0 &&
@@ -2118,17 +2139,24 @@ void cmGlobalGenerator::IndexGeneratorTarget(cmGeneratorTarget* gt)
}
}
+static char const hexDigits[] = "0123456789abcdef";
+
std::string cmGlobalGenerator::IndexGeneratorTargetUniquely(
cmGeneratorTarget const* gt)
{
// Use the pointer value to uniquely identify the target instance.
- // Use a "T" prefix to indicate that this identifier is for a target.
+ // Use a ":" prefix to avoid conflict with project-defined targets.
// We must satisfy cmGeneratorExpression::IsValidTargetName so use no
// other special characters.
- char buf[64];
- sprintf(buf, "::T%p",
- static_cast<void const*>(gt)); // cast avoids format warning
- std::string id = gt->GetName() + buf;
+ char buf[1 + sizeof(gt) * 2];
+ char* b = buf;
+ *b++ = ':';
+ for (size_t i = 0; i < sizeof(gt); ++i) {
+ unsigned char const c = reinterpret_cast<unsigned char const*>(&gt)[i];
+ *b++ = hexDigits[(c & 0xf0) >> 4];
+ *b++ = hexDigits[(c & 0x0f)];
+ }
+ std::string id(buf, sizeof(buf));
// We internally index pointers to non-const generator targets
// but our callers only have pointers to const generator targets.
// They will give up non-const privileges when looking up anyway.
@@ -2200,7 +2228,7 @@ cmGeneratorTarget* cmGlobalGenerator::FindGeneratorTarget(
bool cmGlobalGenerator::NameResolvesToFramework(
const std::string& libname) const
{
- if (cmSystemTools::IsPathToFramework(libname.c_str())) {
+ if (cmSystemTools::IsPathToFramework(libname)) {
return true;
}
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 31bcacf..018606c 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -26,6 +26,7 @@
#include "cmMessageType.h"
#include "cmNinjaLinkLineComputer.h"
#include "cmOutputConverter.h"
+#include "cmRange.h"
#include "cmState.h"
#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
@@ -136,16 +137,16 @@ void cmGlobalNinjaGenerator::WriteBuild(
// Make sure there is a rule.
if (rule.empty()) {
cmSystemTools::Error("No rule for WriteBuildStatement! called "
- "with comment: ",
- comment.c_str());
+ "with comment: " +
+ comment);
return;
}
// Make sure there is at least one output file.
if (outputs.empty()) {
cmSystemTools::Error("No output files for WriteBuildStatement! called "
- "with comment: ",
- comment.c_str());
+ "with comment: " +
+ comment);
return;
}
@@ -334,16 +335,16 @@ void cmGlobalNinjaGenerator::WriteRule(
// Make sure the rule has a name.
if (name.empty()) {
cmSystemTools::Error("No name given for WriteRuleStatement! called "
- "with comment: ",
- comment.c_str());
+ "with comment: " +
+ comment);
return;
}
// Make sure a command is given.
if (command.empty()) {
cmSystemTools::Error("No command given for WriteRuleStatement! called "
- "with comment: ",
- comment.c_str());
+ "with comment: " +
+ comment);
return;
}
@@ -376,7 +377,7 @@ void cmGlobalNinjaGenerator::WriteRule(
if (!rspfile.empty()) {
if (rspcontent.empty()) {
- cmSystemTools::Error("No rspfile_content given!", comment.c_str());
+ cmSystemTools::Error("No rspfile_content given!" + comment);
return;
}
cmGlobalNinjaGenerator::Indent(os, 1);
@@ -407,8 +408,8 @@ void cmGlobalNinjaGenerator::WriteVariable(std::ostream& os,
// Make sure we have a name.
if (name.empty()) {
cmSystemTools::Error("No name given for WriteVariable! called "
- "with comment: ",
- comment.c_str());
+ "with comment: " +
+ comment);
return;
}
@@ -1652,8 +1653,7 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg,
} else if (cmHasLiteralPrefix(arg, "--ddi=")) {
arg_ddi = arg.substr(6);
} else {
- cmSystemTools::Error("-E cmake_ninja_depends unknown argument: ",
- arg.c_str());
+ cmSystemTools::Error("-E cmake_ninja_depends unknown argument: " + arg);
return 1;
}
}
@@ -1687,9 +1687,8 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg,
cmsys::ifstream tdif(arg_tdi.c_str(), std::ios::in | std::ios::binary);
Json::Reader reader;
if (!reader.parse(tdif, tdio, false)) {
- cmSystemTools::Error("-E cmake_ninja_depends failed to parse ",
- arg_tdi.c_str(),
- reader.getFormattedErrorMessages().c_str());
+ cmSystemTools::Error("-E cmake_ninja_depends failed to parse " +
+ arg_tdi + reader.getFormattedErrorMessages());
return 1;
}
}
@@ -1715,8 +1714,7 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg,
std::set<std::string> defines;
cmFortranParser parser(fc, includes, defines, info);
if (!cmFortranParser_FilePush(&parser, arg_pp.c_str())) {
- cmSystemTools::Error("-E cmake_ninja_depends failed to open ",
- arg_pp.c_str());
+ cmSystemTools::Error("-E cmake_ninja_depends failed to open " + arg_pp);
return 1;
}
if (cmFortran_yyparse(parser.Scanner) != 0) {
@@ -1751,8 +1749,7 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg,
cmGeneratedFileStream ddif(arg_ddi);
ddif << ddi;
if (!ddif) {
- cmSystemTools::Error("-E cmake_ninja_depends failed to write ",
- arg_ddi.c_str());
+ cmSystemTools::Error("-E cmake_ninja_depends failed to write " + arg_ddi);
return 1;
}
return 0;
@@ -1795,9 +1792,8 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile(
cmsys::ifstream ddif(arg_ddi.c_str(), std::ios::in | std::ios::binary);
Json::Reader reader;
if (!reader.parse(ddif, ddio, false)) {
- cmSystemTools::Error("-E cmake_ninja_dyndep failed to parse ",
- arg_ddi.c_str(),
- reader.getFormattedErrorMessages().c_str());
+ cmSystemTools::Error("-E cmake_ninja_dyndep failed to parse " + arg_ddi +
+ reader.getFormattedErrorMessages());
return false;
}
@@ -1828,9 +1824,9 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile(
cmsys::ifstream ltmf(ltmn.c_str(), std::ios::in | std::ios::binary);
Json::Reader reader;
if (ltmf && !reader.parse(ltmf, ltm, false)) {
- cmSystemTools::Error("-E cmake_ninja_dyndep failed to parse ",
- linked_target_dir.c_str(),
- reader.getFormattedErrorMessages().c_str());
+ cmSystemTools::Error("-E cmake_ninja_dyndep failed to parse " +
+ linked_target_dir +
+ reader.getFormattedErrorMessages());
return false;
}
if (ltm.isObject()) {
@@ -1911,8 +1907,7 @@ int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg,
cmHasLiteralSuffix(arg, ".ddi")) {
arg_ddis.push_back(arg);
} else {
- cmSystemTools::Error("-E cmake_ninja_dyndep unknown argument: ",
- arg.c_str());
+ cmSystemTools::Error("-E cmake_ninja_dyndep unknown argument: " + arg);
return 1;
}
}
@@ -1931,9 +1926,8 @@ int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg,
cmsys::ifstream tdif(arg_tdi.c_str(), std::ios::in | std::ios::binary);
Json::Reader reader;
if (!reader.parse(tdif, tdio, false)) {
- cmSystemTools::Error("-E cmake_ninja_dyndep failed to parse ",
- arg_tdi.c_str(),
- reader.getFormattedErrorMessages().c_str());
+ cmSystemTools::Error("-E cmake_ninja_dyndep failed to parse " + arg_tdi +
+ reader.getFormattedErrorMessages());
return 1;
}
}
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index 2d54c33..6509b56 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -158,14 +158,22 @@ bool cmGlobalVisualStudio14Generator::SelectWindows10SDK(cmMakefile* mf,
bool required)
{
// Find the default version of the Windows 10 SDK.
- this->WindowsTargetPlatformVersion = this->GetWindows10SDKVersion();
- if (required && this->WindowsTargetPlatformVersion.empty()) {
+ std::string const version = this->GetWindows10SDKVersion();
+ if (required && version.empty()) {
std::ostringstream e;
e << "Could not find an appropriate version of the Windows 10 SDK"
<< " installed on this machine";
mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
return false;
}
+ this->SetWindowsTargetPlatformVersion(version, mf);
+ return true;
+}
+
+void cmGlobalVisualStudio14Generator::SetWindowsTargetPlatformVersion(
+ std::string const& version, cmMakefile* mf)
+{
+ this->WindowsTargetPlatformVersion = version;
if (!cmSystemTools::VersionCompareEqual(this->WindowsTargetPlatformVersion,
this->SystemVersion)) {
std::ostringstream e;
@@ -175,7 +183,6 @@ bool cmGlobalVisualStudio14Generator::SelectWindows10SDK(cmMakefile* mf,
}
mf->AddDefinition("CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION",
this->WindowsTargetPlatformVersion.c_str());
- return true;
}
bool cmGlobalVisualStudio14Generator::SelectWindowsStoreToolset(
diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h
index 32008b0..6e12d3e 100644
--- a/Source/cmGlobalVisualStudio14Generator.h
+++ b/Source/cmGlobalVisualStudio14Generator.h
@@ -40,6 +40,9 @@ protected:
virtual bool SelectWindows10SDK(cmMakefile* mf, bool required);
+ void SetWindowsTargetPlatformVersion(std::string const& version,
+ cmMakefile* mf);
+
// Used to verify that the Desktop toolset for the current generator is
// installed on the machine.
bool IsWindowsDesktopToolsetInstalled() const override;
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index f3e73d3..21abdf7 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -205,7 +205,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
"Checking Build System", no_working_directory, true, false)) {
gt->AddSource(file->GetFullPath());
} else {
- cmSystemTools::Error("Error adding rule for ", stamps[0].c_str());
+ cmSystemTools::Error("Error adding rule for " + stamps[0]);
}
}
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 1922906..45927c9 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -918,7 +918,7 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand(
cmdl.push_back(objs_file);
cmGeneratedFileStream fout(objs_file.c_str());
if (!fout) {
- cmSystemTools::Error("could not open ", objs_file.c_str());
+ cmSystemTools::Error("could not open " + objs_file);
return;
}
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
index 913fc4a..2f9eb3f 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
@@ -401,6 +401,12 @@ bool cmGlobalVisualStudioVersionedGenerator::InitializeWindows(cmMakefile* mf)
// If the Win 8.1 SDK is installed then we can select a SDK matching
// the target Windows version.
if (this->IsWin81SDKInstalled()) {
+ // VS 2019 does not default to 8.1 so specify it explicitly when needed.
+ if (this->Version >= cmGlobalVisualStudioGenerator::VS16 &&
+ !cmSystemTools::VersionCompareGreater(this->SystemVersion, "8.1")) {
+ this->SetWindowsTargetPlatformVersion("8.1", mf);
+ return true;
+ }
return cmGlobalVisualStudio14Generator::InitializeWindows(mf);
}
// Otherwise we must choose a Win 10 SDK even if we are not targeting
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 4e4e1bb..11cc98e 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1976,7 +1976,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// so let it replace the framework name. This avoids creating
// a per-configuration Info.plist file.
this->CurrentLocalGenerator->GenerateFrameworkInfoPList(
- gtgt, "$(EXECUTABLE_NAME)", plist.c_str());
+ gtgt, "$(EXECUTABLE_NAME)", plist);
buildSettings->AddAttribute("INFOPLIST_FILE",
this->CreateString(plist));
buildSettings->AddAttribute("MACH_O_TYPE",
@@ -2017,7 +2017,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// a per-configuration Info.plist file. The cfbundle plist
// is very similar to the application bundle plist
this->CurrentLocalGenerator->GenerateAppleInfoPList(
- gtgt, "$(EXECUTABLE_NAME)", plist.c_str());
+ gtgt, "$(EXECUTABLE_NAME)", plist);
buildSettings->AddAttribute("INFOPLIST_FILE",
this->CreateString(plist));
} else {
@@ -2051,7 +2051,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// so let it replace the framework name. This avoids creating
// a per-configuration Info.plist file.
this->CurrentLocalGenerator->GenerateFrameworkInfoPList(
- gtgt, "$(EXECUTABLE_NAME)", plist.c_str());
+ gtgt, "$(EXECUTABLE_NAME)", plist);
buildSettings->AddAttribute("INFOPLIST_FILE",
this->CreateString(plist));
} else {
@@ -2089,7 +2089,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// so let it replace the executable name. This avoids creating
// a per-configuration Info.plist file.
this->CurrentLocalGenerator->GenerateAppleInfoPList(
- gtgt, "$(EXECUTABLE_NAME)", plist.c_str());
+ gtgt, "$(EXECUTABLE_NAME)", plist);
buildSettings->AddAttribute("INFOPLIST_FILE",
this->CreateString(plist));
}
diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx
index 647c786..c64bd8a 100644
--- a/Source/cmInstallCommandArguments.cxx
+++ b/Source/cmInstallCommandArguments.cxx
@@ -2,7 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmInstallCommandArguments.h"
-#include "cmAlgorithms.h"
+#include "cmRange.h"
#include "cmSystemTools.h"
#include <utility>
diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx
index 1b72ce6..b068e46 100644
--- a/Source/cmInstallFilesCommand.cxx
+++ b/Source/cmInstallFilesCommand.cxx
@@ -2,12 +2,12 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmInstallFilesCommand.h"
-#include "cmAlgorithms.h"
#include "cmGeneratorExpression.h"
#include "cmGlobalGenerator.h"
#include "cmInstallFilesGenerator.h"
#include "cmInstallGenerator.h"
#include "cmMakefile.h"
+#include "cmRange.h"
#include "cmSystemTools.h"
class cmExecutionStatus;
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 7053e99..4fefe23 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -41,22 +41,6 @@ cmInstallTargetGenerator::cmInstallTargetGenerator(
cmInstallTargetGenerator::~cmInstallTargetGenerator() = default;
-void cmInstallTargetGenerator::GenerateScript(std::ostream& os)
-{
- // Warn if installing an exclude-from-all target.
- if (this->Target->GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
- std::ostringstream msg;
- msg << "WARNING: Target \"" << this->Target->GetName()
- << "\" has EXCLUDE_FROM_ALL set and will not be built by default "
- << "but an install rule has been provided for it. CMake does "
- << "not define behavior for this case.";
- cmSystemTools::Message(msg.str(), "Warning");
- }
-
- // Perform the main install script generation.
- this->cmInstallGenerator::GenerateScript(os);
-}
-
void cmInstallTargetGenerator::GenerateScriptForConfig(
std::ostream& os, const std::string& config, Indent indent)
{
diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h
index 715b4ae..6df5b1a 100644
--- a/Source/cmInstallTargetGenerator.h
+++ b/Source/cmInstallTargetGenerator.h
@@ -69,7 +69,6 @@ public:
cmListFileBacktrace const& GetBacktrace() const { return this->Backtrace; }
protected:
- void GenerateScript(std::ostream& os) override;
void GenerateScriptForConfig(std::ostream& os, const std::string& config,
Indent indent) override;
void GenerateScriptForConfigObjectLibrary(std::ostream& os,
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index 297babf..5474afa 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -19,6 +19,7 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
+#include "cmRange.h"
#include "cmStringReplaceHelper.h"
#include "cmSystemTools.h"
@@ -42,6 +43,15 @@ bool cmListCommand::InitialPass(std::vector<std::string> const& args,
if (subCommand == "APPEND") {
return this->HandleAppendCommand(args);
}
+ if (subCommand == "PREPEND") {
+ return this->HandlePrependCommand(args);
+ }
+ if (subCommand == "POP_BACK") {
+ return this->HandlePopBackCommand(args);
+ }
+ if (subCommand == "POP_FRONT") {
+ return this->HandlePopFrontCommand(args);
+ }
if (subCommand == "FIND") {
return this->HandleFindCommand(args);
}
@@ -222,20 +232,141 @@ bool cmListCommand::HandleAppendCommand(std::vector<std::string> const& args)
return true;
}
- const std::string& listName = args[1];
+ std::string const& listName = args[1];
// expand the variable
std::string listString;
this->GetListString(listString, listName);
- if (!listString.empty() && !args.empty()) {
- listString += ";";
+ // If `listString` or `args` is empty, no need to append `;`,
+ // then index is going to be `1` and points to the end-of-string ";"
+ auto const offset =
+ std::string::size_type(listString.empty() || args.empty());
+ listString += &";"[offset] + cmJoin(cmMakeRange(args).advance(2), ";");
+
+ this->Makefile->AddDefinition(listName, listString.c_str());
+ return true;
+}
+
+bool cmListCommand::HandlePrependCommand(std::vector<std::string> const& args)
+{
+ assert(args.size() >= 2);
+
+ // Skip if nothing to prepend.
+ if (args.size() < 3) {
+ return true;
}
- listString += cmJoin(cmMakeRange(args).advance(2), ";");
+
+ std::string const& listName = args[1];
+ // expand the variable
+ std::string listString;
+ this->GetListString(listString, listName);
+
+ // If `listString` or `args` is empty, no need to append `;`,
+ // then `offset` is going to be `1` and points to the end-of-string ";"
+ auto const offset =
+ std::string::size_type(listString.empty() || args.empty());
+ listString.insert(0,
+ cmJoin(cmMakeRange(args).advance(2), ";") + &";"[offset]);
this->Makefile->AddDefinition(listName, listString.c_str());
return true;
}
+bool cmListCommand::HandlePopBackCommand(std::vector<std::string> const& args)
+{
+ assert(args.size() >= 2);
+
+ auto ai = args.cbegin();
+ ++ai; // Skip subcommand name
+ std::string const& listName = *ai++;
+ std::vector<std::string> varArgsExpanded;
+ if (!this->GetList(varArgsExpanded, listName)) {
+ // Can't get the list definition... undefine any vars given after.
+ for (; ai != args.cend(); ++ai) {
+ this->Makefile->RemoveDefinition(*ai);
+ }
+ return true;
+ }
+
+ if (!varArgsExpanded.empty()) {
+ if (ai == args.cend()) {
+ // No variables are given... Just remove one element.
+ varArgsExpanded.pop_back();
+ } else {
+ // Ok, assign elements to be removed to the given variables
+ for (; !varArgsExpanded.empty() && ai != args.cend(); ++ai) {
+ assert(!ai->empty());
+ this->Makefile->AddDefinition(*ai, varArgsExpanded.back().c_str());
+ varArgsExpanded.pop_back();
+ }
+ // Undefine the rest variables if the list gets empty earlier...
+ for (; ai != args.cend(); ++ai) {
+ this->Makefile->RemoveDefinition(*ai);
+ }
+ }
+
+ this->Makefile->AddDefinition(listName,
+ cmJoin(varArgsExpanded, ";").c_str());
+
+ } else if (ai !=
+ args.cend()) { // The list is empty, but some args were given
+ // Need to *undefine* 'em all, cuz there are no items to assign...
+ for (; ai != args.cend(); ++ai) {
+ this->Makefile->RemoveDefinition(*ai);
+ }
+ }
+
+ return true;
+}
+
+bool cmListCommand::HandlePopFrontCommand(std::vector<std::string> const& args)
+{
+ assert(args.size() >= 2);
+
+ auto ai = args.cbegin();
+ ++ai; // Skip subcommand name
+ std::string const& listName = *ai++;
+ std::vector<std::string> varArgsExpanded;
+ if (!this->GetList(varArgsExpanded, listName)) {
+ // Can't get the list definition... undefine any vars given after.
+ for (; ai != args.cend(); ++ai) {
+ this->Makefile->RemoveDefinition(*ai);
+ }
+ return true;
+ }
+
+ if (!varArgsExpanded.empty()) {
+ if (ai == args.cend()) {
+ // No variables are given... Just remove one element.
+ varArgsExpanded.erase(varArgsExpanded.begin());
+ } else {
+ // Ok, assign elements to be removed to the given variables
+ auto vi = varArgsExpanded.begin();
+ for (; vi != varArgsExpanded.end() && ai != args.cend(); ++ai, ++vi) {
+ assert(!ai->empty());
+ this->Makefile->AddDefinition(*ai, varArgsExpanded.front().c_str());
+ }
+ varArgsExpanded.erase(varArgsExpanded.begin(), vi);
+ // Undefine the rest variables if the list gets empty earlier...
+ for (; ai != args.cend(); ++ai) {
+ this->Makefile->RemoveDefinition(*ai);
+ }
+ }
+
+ this->Makefile->AddDefinition(listName,
+ cmJoin(varArgsExpanded, ";").c_str());
+
+ } else if (ai !=
+ args.cend()) { // The list is empty, but some args were given
+ // Need to *undefine* 'em all, cuz there are no items to assign...
+ for (; ai != args.cend(); ++ai) {
+ this->Makefile->RemoveDefinition(*ai);
+ }
+ }
+
+ return true;
+}
+
bool cmListCommand::HandleFindCommand(std::vector<std::string> const& args)
{
if (args.size() != 4) {
diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h
index 76a9856..ea3d643 100644
--- a/Source/cmListCommand.h
+++ b/Source/cmListCommand.h
@@ -35,6 +35,9 @@ protected:
bool HandleLengthCommand(std::vector<std::string> const& args);
bool HandleGetCommand(std::vector<std::string> const& args);
bool HandleAppendCommand(std::vector<std::string> const& args);
+ bool HandlePrependCommand(std::vector<std::string> const& args);
+ bool HandlePopBackCommand(std::vector<std::string> const& args);
+ bool HandlePopFrontCommand(std::vector<std::string> const& args);
bool HandleFindCommand(std::vector<std::string> const& args);
bool HandleInsertCommand(std::vector<std::string> const& args);
bool HandleJoinCommand(std::vector<std::string> const& args);
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 57b34a9..a14fd7d 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -366,8 +366,8 @@ void cmLocalGenerator::ProcessEvaluationFiles(
std::back_inserter(intersection));
if (!intersection.empty()) {
cmSystemTools::Error("Files to be generated by multiple different "
- "commands: ",
- cmWrap('"', intersection, '"', " ").c_str());
+ "commands: " +
+ cmWrap('"', intersection, '"', " "));
return;
}
@@ -776,7 +776,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
#endif
for (std::string const& i : includes) {
if (fwSearchFlag && *fwSearchFlag && this->Makefile->IsOn("APPLE") &&
- cmSystemTools::IsPathToFramework(i.c_str())) {
+ cmSystemTools::IsPathToFramework(i)) {
std::string frameworkDir = i;
frameworkDir += "/../";
frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir);
@@ -944,15 +944,21 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
std::vector<std::string> impDirVec = userStandardDirs;
// Load implicit include directories for this language.
- std::string key = "CMAKE_";
- key += lang;
- key += "_IMPLICIT_INCLUDE_DIRECTORIES";
- if (const char* value = this->Makefile->GetDefinition(key)) {
- size_t const impDirVecOldSize = impDirVec.size();
- cmSystemTools::ExpandListArgument(value, impDirVec);
- // FIXME: Use cmRange with 'advance()' when it supports non-const.
- for (size_t i = impDirVecOldSize; i < impDirVec.size(); ++i) {
- cmSystemTools::ConvertToUnixSlashes(impDirVec[i]);
+ // We ignore this for Fortran because:
+ // * There are no standard library headers to avoid overriding.
+ // * Compilers like gfortran do not search their own implicit include
+ // directories for modules ('.mod' files).
+ if (lang != "Fortran") {
+ std::string key = "CMAKE_";
+ key += lang;
+ key += "_IMPLICIT_INCLUDE_DIRECTORIES";
+ if (const char* value = this->Makefile->GetDefinition(key)) {
+ size_t const impDirVecOldSize = impDirVec.size();
+ cmSystemTools::ExpandListArgument(value, impDirVec);
+ // FIXME: Use cmRange with 'advance()' when it supports non-const.
+ for (size_t i = impDirVecOldSize; i < impDirVec.size(); ++i) {
+ cmSystemTools::ConvertToUnixSlashes(impDirVec[i]);
+ }
}
}
@@ -1168,8 +1174,8 @@ void cmLocalGenerator::GetTargetFlags(
}
if (linkLanguage.empty()) {
cmSystemTools::Error(
- "CMake can not determine linker language for target: ",
- target->GetName().c_str());
+ "CMake can not determine linker language for target: " +
+ target->GetName());
return;
}
this->AddLanguageFlagsForLinking(flags, target, linkLanguage, buildType);
@@ -2812,7 +2818,7 @@ static void cmLGInfoProp(cmMakefile* mf, cmGeneratorTarget* target,
void cmLocalGenerator::GenerateAppleInfoPList(cmGeneratorTarget* target,
const std::string& targetName,
- const char* fname)
+ const std::string& fname)
{
// Find the Info.plist template.
const char* in = target->GetProperty("MACOSX_BUNDLE_INFO_PLIST");
@@ -2846,11 +2852,12 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmGeneratorTarget* target,
cmLGInfoProp(mf, target, "MACOSX_BUNDLE_SHORT_VERSION_STRING");
cmLGInfoProp(mf, target, "MACOSX_BUNDLE_BUNDLE_VERSION");
cmLGInfoProp(mf, target, "MACOSX_BUNDLE_COPYRIGHT");
- mf->ConfigureFile(inFile.c_str(), fname, false, false, false);
+ mf->ConfigureFile(inFile, fname, false, false, false);
}
void cmLocalGenerator::GenerateFrameworkInfoPList(
- cmGeneratorTarget* target, const std::string& targetName, const char* fname)
+ cmGeneratorTarget* target, const std::string& targetName,
+ const std::string& fname)
{
// Find the Info.plist template.
const char* in = target->GetProperty("MACOSX_FRAMEWORK_INFO_PLIST");
@@ -2880,5 +2887,5 @@ void cmLocalGenerator::GenerateFrameworkInfoPList(
cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_IDENTIFIER");
cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_SHORT_VERSION_STRING");
cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_BUNDLE_VERSION");
- mf->ConfigureFile(inFile.c_str(), fname, false, false, false);
+ mf->ConfigureFile(inFile, fname, false, false, false);
}
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index f9839f6..de12190 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -340,14 +340,14 @@ public:
*/
void GenerateAppleInfoPList(cmGeneratorTarget* target,
const std::string& targetName,
- const char* fname);
+ const std::string& fname);
/**
* Generate a macOS framework Info.plist file.
*/
void GenerateFrameworkInfoPList(cmGeneratorTarget* target,
const std::string& targetName,
- const char* fname);
+ const std::string& fname);
/** Construct a comment for a custom command. */
std::string ConstructComment(cmCustomCommandGenerator const& ccg,
const char* default_comment = "");
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 4dc04d5..f4e3ed8 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -232,8 +232,8 @@ void cmLocalNinjaGenerator::WritePools(std::ostream& os)
os << " depth = " << jobs << std::endl;
os << std::endl;
} else {
- cmSystemTools::Error("Invalid pool defined by property 'JOB_POOLS': ",
- pool.c_str());
+ cmSystemTools::Error("Invalid pool defined by property 'JOB_POOLS': " +
+ pool);
}
}
}
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 7eb4a03..33a31dd 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -22,6 +22,7 @@
#include "cmMakefile.h"
#include "cmMakefileTargetGenerator.h"
#include "cmOutputConverter.h"
+#include "cmRange.h"
#include "cmRulePlaceholderExpander.h"
#include "cmSourceFile.h"
#include "cmState.h"
@@ -1054,7 +1055,7 @@ void cmLocalUnixMakefileGenerator3::AppendCleanCommand(
std::string cleanfilePath = cmSystemTools::CollapseFullPath(cleanfile);
cmsys::ofstream fout(cleanfilePath.c_str());
if (!fout) {
- cmSystemTools::Error("Could not create ", cleanfilePath.c_str());
+ cmSystemTools::Error("Could not create " + cleanfilePath);
}
if (!files.empty()) {
fout << "file(REMOVE_RECURSE\n";
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 9f18e8f..a497308 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -118,8 +118,8 @@ void cmLocalVisualStudio7Generator::WriteProjectFiles()
// If not an in source build, then create the output directory
if (this->GetCurrentBinaryDirectory() != this->GetSourceDirectory()) {
if (!cmSystemTools::MakeDirectory(this->GetCurrentBinaryDirectory())) {
- cmSystemTools::Error("Error creating directory ",
- this->GetCurrentBinaryDirectory().c_str());
+ cmSystemTools::Error("Error creating directory " +
+ this->GetCurrentBinaryDirectory());
}
}
@@ -283,7 +283,7 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
file->GetFullPath();
return file;
} else {
- cmSystemTools::Error("Error adding rule for ", makefileIn.c_str());
+ cmSystemTools::Error("Error adding rule for " + makefileIn);
return nullptr;
}
}
@@ -654,8 +654,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
: target->GetLinkerLanguage(configName));
if (linkLanguage.empty()) {
cmSystemTools::Error(
- "CMake can not determine linker language for target: ",
- target->GetName().c_str());
+ "CMake can not determine linker language for target: " +
+ target->GetName());
return;
}
langForClCompile = linkLanguage;
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 7279d5f..6565f02 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -10,6 +10,7 @@
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmPolicies.h"
+#include "cmRange.h"
#include "cmState.h"
#include "cmSystemTools.h"
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 560181f..a0b09da 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -31,6 +31,7 @@
#include "cmInstallSubdirectoryGenerator.h"
#include "cmListFileCache.h"
#include "cmMessageType.h"
+#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmSourceFileLocation.h"
#include "cmState.h"
@@ -959,9 +960,8 @@ cmSourceFile* cmMakefile::AddCustomCommandToOutput(
if (file && file->GetCustomCommand() && !replace) {
// The rule file already exists.
if (commandLines != file->GetCustomCommand()->GetCommandLines()) {
- cmSystemTools::Error("Attempt to add a custom rule to output \"",
- outName.c_str(),
- "\" which already has a custom rule.");
+ cmSystemTools::Error("Attempt to add a custom rule to output \"" +
+ outName + "\" which already has a custom rule.");
}
return file;
}
@@ -1101,8 +1101,8 @@ void cmMakefile::AddCustomCommandOldStyle(
ti->second.AddSource(sf->GetFullPath());
} else {
cmSystemTools::Error("Attempt to add a custom rule to a target "
- "that does not exist yet for target ",
- target.c_str());
+ "that does not exist yet for target " +
+ target);
return;
}
}
@@ -1189,8 +1189,7 @@ cmTarget* cmMakefile::AddUtilityCommand(
if (sf) {
sf->SetProperty("SYMBOLIC", "1");
} else {
- cmSystemTools::Error("Could not get source file entry for ",
- force.c_str());
+ cmSystemTools::Error("Could not get source file entry for " + force);
}
// Always create the byproduct sources and mark them generated.
@@ -2445,8 +2444,9 @@ const std::string& cmMakefile::GetRequiredDefinition(
const std::string* def = GetDef(name);
if (!def) {
cmSystemTools::Error("Error required internal CMake variable not "
- "set, cmake may not be built correctly.\n",
- "Missing variable is:\n", name.c_str());
+ "set, cmake may not be built correctly.\n"
+ "Missing variable is:\n" +
+ name);
return empty;
}
return *def;
@@ -3729,22 +3729,23 @@ void cmMakefile::ConfigureString(const std::string& input, std::string& output,
lineNumber, true, true);
}
-int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
- bool copyonly, bool atOnly, bool escapeQuotes,
+int cmMakefile::ConfigureFile(const std::string& infile,
+ const std::string& outfile, bool copyonly,
+ bool atOnly, bool escapeQuotes,
cmNewLineStyle newLine)
{
int res = 1;
if (!this->CanIWriteThisFile(outfile)) {
- cmSystemTools::Error("Attempt to write file: ", outfile,
+ cmSystemTools::Error("Attempt to write file: " + outfile +
" into a source directory.");
return 0;
}
if (!cmSystemTools::FileExists(infile)) {
- cmSystemTools::Error("File ", infile, " does not exist.");
+ cmSystemTools::Error("File " + infile + " does not exist.");
return 0;
}
std::string soutfile = outfile;
- std::string sinfile = infile;
+ const std::string& sinfile = infile;
this->AddCMakeDependFile(sinfile);
cmSystemTools::ConvertToUnixSlashes(soutfile);
@@ -3778,15 +3779,15 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
tempOutputFile += ".tmp";
cmsys::ofstream fout(tempOutputFile.c_str(), omode);
if (!fout) {
- cmSystemTools::Error("Could not open file for write in copy operation ",
- tempOutputFile.c_str());
+ cmSystemTools::Error("Could not open file for write in copy operation " +
+ tempOutputFile);
cmSystemTools::ReportLastSystemError("");
return 0;
}
cmsys::ifstream fin(sinfile.c_str());
if (!fin) {
- cmSystemTools::Error("Could not open file for read in copy operation ",
- sinfile.c_str());
+ cmSystemTools::Error("Could not open file for read in copy operation " +
+ sinfile);
return 0;
}
@@ -4286,7 +4287,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
// Deprecate old policies, especially those that require a lot
// of code to maintain the old behavior.
- if (status == cmPolicies::OLD && id <= cmPolicies::CMP0065 &&
+ if (status == cmPolicies::OLD && id <= cmPolicies::CMP0066 &&
!(this->GetCMakeInstance()->GetIsInTryCompile() &&
(
// Policies set by cmCoreTryCompile::TryCompileCode.
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 0800ce4..88b4c2f 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -610,8 +610,8 @@ public:
/**
* Copy file but change lines according to ConfigureString
*/
- int ConfigureFile(const char* infile, const char* outfile, bool copyonly,
- bool atOnly, bool escapeQuotes,
+ int ConfigureFile(const std::string& infile, const std::string& outfile,
+ bool copyonly, bool atOnly, bool escapeQuotes,
cmNewLineStyle = cmNewLineStyle());
/**
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 572270a..984cd85 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -370,8 +370,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// Make sure we have a link language.
if (linkLanguage.empty()) {
- cmSystemTools::Error("Cannot determine link language for target \"",
- this->GeneratorTarget->GetName().c_str(), "\".");
+ cmSystemTools::Error("Cannot determine link language for target \"" +
+ this->GeneratorTarget->GetName() + "\".");
return;
}
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index ed2fd68..44e6547 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -462,8 +462,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// Make sure we have a link language.
if (linkLanguage.empty()) {
- cmSystemTools::Error("Cannot determine link language for target \"",
- this->GeneratorTarget->GetName().c_str(), "\".");
+ cmSystemTools::Error("Cannot determine link language for target \"" +
+ this->GeneratorTarget->GetName() + "\".");
return;
}
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index cb595fd..340e405 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -21,6 +21,7 @@
#include "cmMakefileLibraryTargetGenerator.h"
#include "cmMakefileUtilityTargetGenerator.h"
#include "cmOutputConverter.h"
+#include "cmRange.h"
#include "cmRulePlaceholderExpander.h"
#include "cmSourceFile.h"
#include "cmState.h"
diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx
index 1a21ae4..2724030 100644
--- a/Source/cmMessageCommand.cxx
+++ b/Source/cmMessageCommand.cxx
@@ -6,6 +6,7 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmMessenger.h"
+#include "cmRange.h"
#include "cmSystemTools.h"
class cmExecutionStatus;
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 3874f48..b38d410 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -68,8 +68,8 @@ void cmNinjaNormalTargetGenerator::Generate()
{
if (this->TargetLinkLanguage.empty()) {
cmSystemTools::Error("CMake can not determine linker language for "
- "target: ",
- this->GetGeneratorTarget()->GetName().c_str());
+ "target: " +
+ this->GetGeneratorTarget()->GetName());
return;
}
@@ -283,6 +283,11 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType());
vars.Language = this->TargetLinkLanguage.c_str();
+ if (this->TargetLinkLanguage == "Swift") {
+ vars.SwiftPartialModules = "$SWIFT_PARTIAL_MODULES";
+ vars.TargetSwiftModule = "$TARGET_SWIFT_MODULE";
+ vars.TargetSwiftDoc = "$TARGET_SWIFT_DOC";
+ }
std::string responseFlag;
if (!useResponseFile) {
@@ -787,6 +792,34 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
cmNinjaDeps outputs;
outputs.push_back(targetOutputReal);
+ if (this->TargetLinkLanguage == "Swift") {
+ if (const char* name = gt.GetProperty("SWIFT_MODULE_NAME")) {
+ vars["TARGET_SWIFT_DOC"] = std::string(name) + ".swiftdoc";
+ vars["TARGET_SWIFT_MODULE"] = std::string(name) + ".swiftmodule";
+ } else {
+ vars["TARGET_SWIFT_DOC"] = gt.GetName() + ".swiftdoc";
+ vars["TARGET_SWIFT_MODULE"] = gt.GetName() + ".swiftmodule";
+ }
+ outputs.push_back(vars["TARGET_SWIFT_DOC"]);
+ outputs.push_back(vars["TARGET_SWIFT_MODULE"]);
+
+ cmLocalNinjaGenerator& localGen = *this->GetLocalGenerator();
+
+ std::string partials;
+ std::vector<cmSourceFile const*> sources;
+ gt.GetObjectSources(sources, this->GetConfigName());
+ for (cmSourceFile const* source : sources) {
+ partials += " ";
+ if (const char* partial = source->GetProperty("SWIFT_PARTIAL_MODULE")) {
+ partials += partial;
+ } else {
+ partials += localGen.GetTargetDirectory(&gt) + "/" +
+ gt.GetObjectName(source) + ".swiftmodule";
+ }
+ }
+ vars["SWIFT_PARTIAL_MODULES"] = partials;
+ }
+
// Compute specific libraries to link with.
cmNinjaDeps explicitDeps = this->GetObjects();
cmNinjaDeps implicitDeps = this->ComputeLinkDeps(this->TargetLinkLanguage);
@@ -799,10 +832,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
std::string frameworkPath;
std::string linkPath;
- cmGeneratorTarget& genTarget = *this->GetGeneratorTarget();
- std::string createRule = genTarget.GetCreateRuleVariable(
- this->TargetLinkLanguage, this->GetConfigName());
+ std::string createRule =
+ gt.GetCreateRuleVariable(this->TargetLinkLanguage, this->GetConfigName());
bool useWatcomQuote = mf->IsOn(createRule + "_USE_WATCOM_QUOTE");
cmLocalNinjaGenerator& localGen = *this->GetLocalGenerator();
@@ -815,9 +847,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
this->GetLocalGenerator()->GetStateSnapshot().GetDirectory()));
linkLineComputer->SetUseWatcomQuote(useWatcomQuote);
- localGen.GetTargetFlags(
- linkLineComputer.get(), this->GetConfigName(), vars["LINK_LIBRARIES"],
- vars["FLAGS"], vars["LINK_FLAGS"], frameworkPath, linkPath, &genTarget);
+ localGen.GetTargetFlags(linkLineComputer.get(), this->GetConfigName(),
+ vars["LINK_LIBRARIES"], vars["FLAGS"],
+ vars["LINK_FLAGS"], frameworkPath, linkPath, &gt);
// Add OS X version flags, if any.
if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY ||
@@ -838,7 +870,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
vars["LINK_PATH"] = frameworkPath + linkPath;
std::string lwyuFlags;
- if (genTarget.GetPropertyAsBool("LINK_WHAT_YOU_USE")) {
+ if (gt.GetPropertyAsBool("LINK_WHAT_YOU_USE")) {
lwyuFlags = " -Wl,--no-as-needed";
}
@@ -847,17 +879,16 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
// code between the Makefile executable and library generators.
if (targetType == cmStateEnums::EXECUTABLE) {
std::string t = vars["FLAGS"];
- localGen.AddArchitectureFlags(t, &genTarget, TargetLinkLanguage, cfgName);
+ localGen.AddArchitectureFlags(t, &gt, TargetLinkLanguage, cfgName);
t += lwyuFlags;
vars["FLAGS"] = t;
} else {
std::string t = vars["ARCH_FLAGS"];
- localGen.AddArchitectureFlags(t, &genTarget, TargetLinkLanguage, cfgName);
+ localGen.AddArchitectureFlags(t, &gt, TargetLinkLanguage, cfgName);
vars["ARCH_FLAGS"] = t;
t.clear();
t += lwyuFlags;
- localGen.AddLanguageFlagsForLinking(t, &genTarget, TargetLinkLanguage,
- cfgName);
+ localGen.AddLanguageFlagsForLinking(t, &gt, TargetLinkLanguage, cfgName);
vars["LANGUAGE_COMPILE_FLAGS"] = t;
}
if (this->GetGeneratorTarget()->HasSOName(cfgName)) {
@@ -880,7 +911,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
targetOutputImplib, cmOutputConverter::SHELL);
vars["TARGET_IMPLIB"] = impLibPath;
EnsureParentDirectoryExists(impLibPath);
- if (genTarget.HasImportLibrary(cfgName)) {
+ if (gt.HasImportLibrary(cfgName)) {
byproducts.push_back(targetOutputImplib);
}
}
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 8d2586d..6013cd0 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -455,6 +455,8 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
vars.SwiftAuxiliarySources = "$SWIFT_AUXILIARY_SOURCES";
vars.SwiftModuleName = "$SWIFT_MODULE_NAME";
vars.SwiftLibraryName = "$SWIFT_LIBRARY_NAME";
+ vars.SwiftPartialModule = "$SWIFT_PARTIAL_MODULE";
+ vars.SwiftPartialDoc = "$SWIFT_PARTIAL_DOC";
}
// For some cases we do an explicit preprocessor invocation.
@@ -945,6 +947,18 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
cmGeneratorTarget::Names targetNames =
this->GeneratorTarget->GetLibraryNames(this->GetConfigName());
vars["SWIFT_LIBRARY_NAME"] = targetNames.Base;
+
+ if (const char* partial = source->GetProperty("SWIFT_PARTIAL_MODULE")) {
+ vars["SWIFT_PARTIAL_MODULE"] = partial;
+ } else {
+ vars["SWIFT_PARTIAL_MODULE"] = objectFileName + ".swiftmodule";
+ }
+
+ if (const char* partial = source->GetProperty("SWIFT_PARTIAL_DOC")) {
+ vars["SWIFT_PARTIAL_DOC"] = partial;
+ } else {
+ vars["SWIFT_PARTIAL_DOC"] = objectFileName + ".swiftdoc";
+ }
}
if (!this->NeedDepTypeMSVC(language)) {
diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx
index 6857d5a..47a8df4 100644
--- a/Source/cmOSXBundleGenerator.cxx
+++ b/Source/cmOSXBundleGenerator.cxx
@@ -54,8 +54,7 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName,
plist += this->GT->GetAppBundleDirectory(this->ConfigName,
cmGeneratorTarget::ContentLevel);
plist += "/Info.plist";
- this->LocalGenerator->GenerateAppleInfoPList(this->GT, targetName,
- plist.c_str());
+ this->LocalGenerator->GenerateAppleInfoPList(this->GT, targetName, plist);
this->Makefile->AddCMakeOutputFile(plist);
outpath = out;
}
@@ -90,8 +89,7 @@ void cmOSXBundleGenerator::CreateFramework(const std::string& targetName,
}
plist += "/Info.plist";
std::string name = cmSystemTools::GetFilenameName(targetName);
- this->LocalGenerator->GenerateFrameworkInfoPList(this->GT, name,
- plist.c_str());
+ this->LocalGenerator->GenerateFrameworkInfoPList(this->GT, name, plist);
// Generate Versions directory only for MacOSX frameworks
if (this->Makefile->PlatformIsAppleEmbedded()) {
@@ -184,7 +182,7 @@ void cmOSXBundleGenerator::CreateCFBundle(const std::string& targetName,
cmGeneratorTarget::ContentLevel);
plist += "/Info.plist";
std::string name = cmSystemTools::GetFilenameName(targetName);
- this->LocalGenerator->GenerateAppleInfoPList(this->GT, name, plist.c_str());
+ this->LocalGenerator->GenerateAppleInfoPList(this->GT, name, plist);
this->Makefile->AddCMakeOutputFile(plist);
}
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index e0c1dad..cb9433f 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -166,7 +166,7 @@ protected:
{
cmsys::ifstream fin(info->FullPath.c_str());
if (!fin) {
- cmSystemTools::Error("error can not open ", info->FullPath.c_str());
+ cmSystemTools::Error("error can not open " + info->FullPath);
return;
}
@@ -181,7 +181,7 @@ protected:
qstart = line.find('<', 8);
// if a < is not found then move on
if (qstart == std::string::npos) {
- cmSystemTools::Error("unknown include directive ", line.c_str());
+ cmSystemTools::Error("unknown include directive " + line);
continue;
}
qend = line.find('>', qstart + 1);
diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx
index 6231aab..ab8d103 100644
--- a/Source/cmParseArgumentsCommand.cxx
+++ b/Source/cmParseArgumentsCommand.cxx
@@ -10,6 +10,7 @@
#include "cmAlgorithms.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmRange.h"
#include "cmSystemTools.h"
class cmExecutionStatus;
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 314f27d..8b21166 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -261,7 +261,10 @@ class cmMakefile;
3, 14, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0088, \
"FindBISON runs bison in CMAKE_CURRENT_BINARY_DIR when executing.", \
- 3, 14, 0, cmPolicies::WARN)
+ 3, 14, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0089, \
+ "Compiler id for IBM Clang-based XL compilers is now XLClang.", 3, \
+ 15, 0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
#define CM_FOR_EACH_POLICY_ID(POLICY) \
diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx
index 8b42119..9a764c6 100644
--- a/Source/cmQTWrapCPPCommand.cxx
+++ b/Source/cmQTWrapCPPCommand.cxx
@@ -2,9 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmQTWrapCPPCommand.h"
-#include "cmAlgorithms.h"
#include "cmCustomCommandLines.h"
#include "cmMakefile.h"
+#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmSystemTools.h"
diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx
index 6a620c1..2223e2d 100644
--- a/Source/cmQTWrapUICommand.cxx
+++ b/Source/cmQTWrapUICommand.cxx
@@ -2,9 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmQTWrapUICommand.h"
-#include "cmAlgorithms.h"
#include "cmCustomCommandLines.h"
#include "cmMakefile.h"
+#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmSystemTools.h"
diff --git a/Source/cmQtAutoGen.cxx b/Source/cmQtAutoGen.cxx
index f437138..25ef4fc 100644
--- a/Source/cmQtAutoGen.cxx
+++ b/Source/cmQtAutoGen.cxx
@@ -11,13 +11,6 @@
#include <sstream>
#include <utility>
-// - Static variables
-
-std::string const genNameGen = "AutoGen";
-std::string const genNameMoc = "AutoMoc";
-std::string const genNameUic = "AutoUic";
-std::string const genNameRcc = "AutoRcc";
-
// - Static functions
/// @brief Merges newOpts into baseOpts
@@ -77,27 +70,47 @@ void MergeOptions(std::vector<std::string>& baseOpts,
// - Class definitions
-std::string const cmQtAutoGen::ListSep = "<<<S>>>";
unsigned int const cmQtAutoGen::ParallelMax = 64;
+std::string const cmQtAutoGen::ListSep = "<<<S>>>";
-std::string const& cmQtAutoGen::GeneratorName(GeneratorT type)
+std::string const cmQtAutoGen::GenNameGen = "AutoGen";
+std::string const cmQtAutoGen::GenNameMoc = "AutoMoc";
+std::string const cmQtAutoGen::GenNameUic = "AutoUic";
+std::string const cmQtAutoGen::GenNameRcc = "AutoRcc";
+
+std::string const cmQtAutoGen::GenNameGenUpper = "AUTOGEN";
+std::string const cmQtAutoGen::GenNameMocUpper = "AUTOMOC";
+std::string const cmQtAutoGen::GenNameUicUpper = "AUTOUIC";
+std::string const cmQtAutoGen::GenNameRccUpper = "AUTORCC";
+
+std::string const& cmQtAutoGen::GeneratorName(GenT genType)
{
- switch (type) {
- case GeneratorT::GEN:
- return genNameGen;
- case GeneratorT::MOC:
- return genNameMoc;
- case GeneratorT::UIC:
- return genNameUic;
- case GeneratorT::RCC:
- return genNameRcc;
+ switch (genType) {
+ case GenT::GEN:
+ return GenNameGen;
+ case GenT::MOC:
+ return GenNameMoc;
+ case GenT::UIC:
+ return GenNameUic;
+ case GenT::RCC:
+ return GenNameRcc;
}
- return genNameGen;
+ return GenNameGen;
}
-std::string cmQtAutoGen::GeneratorNameUpper(GeneratorT genType)
+std::string const& cmQtAutoGen::GeneratorNameUpper(GenT genType)
{
- return cmSystemTools::UpperCase(cmQtAutoGen::GeneratorName(genType));
+ switch (genType) {
+ case GenT::GEN:
+ return GenNameGenUpper;
+ case GenT::MOC:
+ return GenNameMocUpper;
+ case GenT::UIC:
+ return GenNameUicUpper;
+ case GenT::RCC:
+ return GenNameRccUpper;
+ }
+ return GenNameGenUpper;
}
std::string cmQtAutoGen::Tools(bool moc, bool uic, bool rcc)
diff --git a/Source/cmQtAutoGen.h b/Source/cmQtAutoGen.h
index 96d1946..e62a947 100644
--- a/Source/cmQtAutoGen.h
+++ b/Source/cmQtAutoGen.h
@@ -14,20 +14,6 @@
class cmQtAutoGen
{
public:
- /// @brief Nested lists separator
- static std::string const ListSep;
- /// @brief Maximum number of parallel threads/processes in a generator
- static unsigned int const ParallelMax;
-
- /// @brief AutoGen generator type
- enum class GeneratorT
- {
- GEN, // General
- MOC,
- UIC,
- RCC
- };
-
/// @brief Integer version
struct IntegerVersion
{
@@ -54,11 +40,34 @@ public:
}
};
+ /// @brief AutoGen generator type
+ enum class GenT
+ {
+ GEN, // AUTOGEN
+ MOC, // AUTOMOC
+ UIC, // AUTOUIC
+ RCC // AUTORCC
+ };
+
+ /// @brief Nested lists separator
+ static std::string const ListSep;
+ // Generator names
+ static std::string const GenNameGen;
+ static std::string const GenNameMoc;
+ static std::string const GenNameUic;
+ static std::string const GenNameRcc;
+ static std::string const GenNameGenUpper;
+ static std::string const GenNameMocUpper;
+ static std::string const GenNameUicUpper;
+ static std::string const GenNameRccUpper;
+ /// @brief Maximum number of parallel threads/processes in a generator
+ static unsigned int const ParallelMax;
+
public:
/// @brief Returns the generator name
- static std::string const& GeneratorName(GeneratorT genType);
+ static std::string const& GeneratorName(GenT genType);
/// @brief Returns the generator name in upper case
- static std::string GeneratorNameUpper(GeneratorT genType);
+ static std::string const& GeneratorNameUpper(GenT genType);
/// @brief Returns a string with the requested tool names
static std::string Tools(bool moc, bool uic, bool rcc);
diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx
index 95a297c..3ad91ee 100644
--- a/Source/cmQtAutoGenGlobalInitializer.cxx
+++ b/Source/cmQtAutoGenGlobalInitializer.cxx
@@ -6,10 +6,12 @@
#include "cmAlgorithms.h"
#include "cmCustomCommandLines.h"
+#include "cmDuration.h"
#include "cmGeneratorTarget.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmProcessOutput.h"
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
@@ -183,6 +185,68 @@ void cmQtAutoGenGlobalInitializer::AddToGlobalAutoRcc(
}
}
+bool cmQtAutoGenGlobalInitializer::GetExecutableTestOutput(
+ std::string const& generator, std::string const& executable,
+ std::string& error, std::string* output)
+{
+ // Check if we have cached output
+ {
+ auto it = this->ExecutableTestOutputs_.find(executable);
+ if (it != this->ExecutableTestOutputs_.end()) {
+ // Return output on demand
+ if (output != nullptr) {
+ *output = it->second;
+ }
+ return true;
+ }
+ }
+
+ // Check if the executable exists
+ if (!cmSystemTools::FileExists(executable, true)) {
+ error = "The \"";
+ error += generator;
+ error += "\" executable ";
+ error += cmQtAutoGen::Quoted(executable);
+ error += " does not exist.";
+ return false;
+ }
+
+ // Test the executable
+ std::string stdOut;
+ {
+ std::string stdErr;
+ std::vector<std::string> command;
+ command.push_back(executable);
+ command.emplace_back("-h");
+ int retVal = 0;
+ const bool runResult = cmSystemTools::RunSingleCommand(
+ command, &stdOut, &stdErr, &retVal, nullptr, cmSystemTools::OUTPUT_NONE,
+ cmDuration::zero(), cmProcessOutput::Auto);
+ if (!runResult) {
+ error = "Test run of \"";
+ error += generator;
+ error += "\" executable ";
+ error += cmQtAutoGen::Quoted(executable) + " failed.\n";
+ error += cmQtAutoGen::QuotedCommand(command);
+ error += "\n";
+ error += stdOut;
+ error += "\n";
+ error += stdErr;
+ return false;
+ }
+ }
+
+ // Return executable output on demand
+ if (output != nullptr) {
+ *output = stdOut;
+ }
+
+ // Register executable and output
+ this->ExecutableTestOutputs_.emplace(executable, std::move(stdOut));
+
+ return true;
+}
+
bool cmQtAutoGenGlobalInitializer::generate()
{
return (InitializeCustomTargets() && SetupCustomTargets());
diff --git a/Source/cmQtAutoGenGlobalInitializer.h b/Source/cmQtAutoGenGlobalInitializer.h
index 9e6bac0..74184a0 100644
--- a/Source/cmQtAutoGenGlobalInitializer.h
+++ b/Source/cmQtAutoGenGlobalInitializer.h
@@ -8,6 +8,7 @@
#include <map>
#include <memory> // IWYU pragma: keep
#include <string>
+#include <unordered_map>
#include <vector>
class cmLocalGenerator;
@@ -38,10 +39,15 @@ private:
void AddToGlobalAutoRcc(cmLocalGenerator* localGen,
std::string const& targetName);
+ bool GetExecutableTestOutput(std::string const& generator,
+ std::string const& executable,
+ std::string& error, std::string* output);
+
private:
std::vector<std::unique_ptr<cmQtAutoGenInitializer>> Initializers_;
std::map<cmLocalGenerator*, std::string> GlobalAutoGenTargets_;
std::map<cmLocalGenerator*, std::string> GlobalAutoRccTargets_;
+ std::unordered_map<std::string, std::string> ExecutableTestOutputs_;
};
#endif
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index a96d574..2fb6fdf 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -21,11 +21,13 @@
#include "cmPolicies.h"
#include "cmProcessOutput.h"
#include "cmSourceFile.h"
+#include "cmSourceFileLocationKind.h"
#include "cmSourceGroup.h"
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
+#include "cmake.h"
#include "cmsys/FStream.hxx"
#include "cmsys/SystemInformation.hxx"
@@ -36,25 +38,9 @@
#include <set>
#include <sstream>
#include <string>
-#include <type_traits>
#include <utility>
#include <vector>
-std::string GetQtExecutableTargetName(
- const cmQtAutoGen::IntegerVersion& qtVersion, std::string const& executable)
-{
- if (qtVersion.Major == 6) {
- return ("Qt6::" + executable);
- }
- if (qtVersion.Major == 5) {
- return ("Qt5::" + executable);
- }
- if (qtVersion.Major == 4) {
- return ("Qt4::" + executable);
- }
- return ("");
-}
-
static std::size_t GetParallelCPUCount()
{
static std::size_t count = 0;
@@ -69,58 +55,6 @@ static std::size_t GetParallelCPUCount()
return count;
}
-static bool AddToSourceGroup(cmMakefile* makefile, std::string const& fileName,
- cmQtAutoGen::GeneratorT genType)
-{
- cmSourceGroup* sourceGroup = nullptr;
- // Acquire source group
- {
- std::string property;
- std::string groupName;
- {
- std::array<std::string, 2> props;
- // Use generator specific group name
- switch (genType) {
- case cmQtAutoGen::GeneratorT::MOC:
- props[0] = "AUTOMOC_SOURCE_GROUP";
- break;
- case cmQtAutoGen::GeneratorT::RCC:
- props[0] = "AUTORCC_SOURCE_GROUP";
- break;
- default:
- props[0] = "AUTOGEN_SOURCE_GROUP";
- break;
- }
- props[1] = "AUTOGEN_SOURCE_GROUP";
- for (std::string& prop : props) {
- const char* propName = makefile->GetState()->GetGlobalProperty(prop);
- if ((propName != nullptr) && (*propName != '\0')) {
- groupName = propName;
- property = std::move(prop);
- break;
- }
- }
- }
- // Generate a source group on demand
- if (!groupName.empty()) {
- sourceGroup = makefile->GetOrCreateSourceGroup(groupName);
- if (sourceGroup == nullptr) {
- std::ostringstream ost;
- ost << cmQtAutoGen::GeneratorNameUpper(genType);
- ost << ": " << property;
- ost << ": Could not find or create the source group ";
- ost << cmQtAutoGen::Quoted(groupName);
- cmSystemTools::Error(ost.str());
- return false;
- }
- }
- }
- if (sourceGroup != nullptr) {
- sourceGroup->AddGroupFile(fileName);
- }
- return true;
-}
-
static void AddCleanFile(cmMakefile* makefile, std::string const& fileName)
{
makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", fileName.c_str(),
@@ -343,6 +277,26 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
}
}
+ // Check status of policy CMP0071
+ {
+ cmPolicies::PolicyStatus const CMP0071_status =
+ makefile->GetPolicyStatus(cmPolicies::CMP0071);
+ switch (CMP0071_status) {
+ case cmPolicies::WARN:
+ this->CMP0071Warn = true;
+ CM_FALLTHROUGH;
+ case cmPolicies::OLD:
+ // Ignore GENERATED file
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ // Process GENERATED file
+ this->CMP0071Accept = true;
+ break;
+ }
+ }
+
// Common directories
{
// Collapsed current binary directory
@@ -392,23 +346,15 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
}
// Moc, Uic and _autogen target settings
- if (this->Moc.Enabled || this->Uic.Enabled) {
+ if (this->MocOrUicEnabled()) {
// Init moc specific settings
if (this->Moc.Enabled && !InitMoc()) {
return false;
}
// Init uic specific settings
- if (this->Uic.Enabled) {
- if (InitUic()) {
- auto* uicTarget = makefile->FindTargetToUse(
- GetQtExecutableTargetName(this->QtVersion, "uic"));
- if (uicTarget != nullptr) {
- this->AutogenTarget.DependTargets.insert(uicTarget);
- }
- } else {
- return false;
- }
+ if (this->Uic.Enabled && !InitUic()) {
+ return false;
}
// Autogen target name
@@ -449,12 +395,6 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
this->AutogenTarget.DependOrigin =
this->Target->GetPropertyAsBool("AUTOGEN_ORIGIN_DEPENDS");
- auto* mocTarget = makefile->FindTargetToUse(
- GetQtExecutableTargetName(this->QtVersion, "moc"));
- if (mocTarget != nullptr) {
- this->AutogenTarget.DependTargets.insert(mocTarget);
- }
-
std::string const deps =
this->Target->GetSafeProperty("AUTOGEN_TARGET_DEPENDS");
if (!deps.empty()) {
@@ -479,8 +419,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
}
// Add autogen include directory to the origin target INCLUDE_DIRECTORIES
- if (this->Moc.Enabled || this->Uic.Enabled ||
- (this->Rcc.Enabled && this->MultiConfig)) {
+ if (this->MocOrUicEnabled() || (this->Rcc.Enabled && this->MultiConfig)) {
this->Target->AddIncludeDirectory(this->Dir.Include, true);
}
@@ -490,7 +429,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
}
// Create autogen target
- if ((this->Moc.Enabled || this->Uic.Enabled) && !this->InitAutogenTarget()) {
+ if (this->MocOrUicEnabled() && !this->InitAutogenTarget()) {
return false;
}
@@ -575,7 +514,18 @@ bool cmQtAutoGenInitializer::InitMoc()
}
// Moc executable
- return GetMocExecutable();
+ {
+ if (!this->GetQtExecutable(this->Moc, "moc", false, nullptr)) {
+ return false;
+ }
+ // Let the _autogen target depend on the moc executable
+ if (this->Moc.ExecutableTarget != nullptr) {
+ this->AutogenTarget.DependTargets.insert(
+ this->Moc.ExecutableTarget->Target);
+ }
+ }
+
+ return true;
}
bool cmQtAutoGenInitializer::InitUic()
@@ -618,12 +568,39 @@ bool cmQtAutoGenInitializer::InitUic()
}
// Uic executable
- return GetUicExecutable();
+ {
+ if (!this->GetQtExecutable(this->Uic, "uic", true, nullptr)) {
+ return false;
+ }
+ // Let the _autogen target depend on the uic executable
+ if (this->Uic.ExecutableTarget != nullptr) {
+ this->AutogenTarget.DependTargets.insert(
+ this->Uic.ExecutableTarget->Target);
+ }
+ }
+
+ return true;
}
bool cmQtAutoGenInitializer::InitRcc()
{
- return GetRccExecutable();
+ // Rcc executable
+ {
+ std::string stdOut;
+ if (!this->GetQtExecutable(this->Rcc, "rcc", false, &stdOut)) {
+ return false;
+ }
+ // Evaluate test output
+ if (this->QtVersion.Major == 5 || this->QtVersion.Major == 6) {
+ if (stdOut.find("--list") != std::string::npos) {
+ this->Rcc.ListOptions.emplace_back("--list");
+ } else {
+ this->Rcc.ListOptions.emplace_back("-list");
+ }
+ }
+ }
+
+ return true;
}
bool cmQtAutoGenInitializer::InitScanFiles()
@@ -634,61 +611,78 @@ bool cmQtAutoGenInitializer::InitScanFiles()
std::string const SKIP_AUTOGEN_str = "SKIP_AUTOGEN";
std::string const SKIP_AUTOMOC_str = "SKIP_AUTOMOC";
std::string const SKIP_AUTOUIC_str = "SKIP_AUTOUIC";
+ std::string const SKIP_AUTORCC_str = "SKIP_AUTORCC";
+ std::string const AUTOUIC_OPTIONS_str = "AUTOUIC_OPTIONS";
+ std::string const AUTORCC_OPTIONS_str = "AUTORCC_OPTIONS";
+ std::string const qrc_str = "qrc";
+ std::string const ui_str = "ui";
+
+ auto makeMUFile = [&](cmSourceFile* sf, std::string const& fullPath,
+ bool muIt) -> MUFileHandle {
+ MUFileHandle muf = cm::make_unique<MUFile>();
+ muf->RealPath = cmSystemTools::GetRealPath(fullPath);
+ muf->SF = sf;
+ muf->Generated = sf->GetIsGenerated();
+ bool const skipAutogen = sf->GetPropertyAsBool(SKIP_AUTOGEN_str);
+ muf->SkipMoc = this->Moc.Enabled &&
+ (skipAutogen || sf->GetPropertyAsBool(SKIP_AUTOMOC_str));
+ muf->SkipUic = this->Uic.Enabled &&
+ (skipAutogen || sf->GetPropertyAsBool(SKIP_AUTOUIC_str));
+ if (muIt) {
+ muf->MocIt = this->Moc.Enabled && !muf->SkipMoc;
+ muf->UicIt = this->Uic.Enabled && !muf->SkipUic;
+ }
+ return muf;
+ };
+
+ auto addMUFile = [&](MUFileHandle&& muf, bool isHeader) {
+ if ((muf->MocIt || muf->UicIt) && muf->Generated) {
+ this->AutogenTarget.FilesGenerated.emplace_back(muf.get());
+ }
+ if (isHeader) {
+ this->AutogenTarget.Headers.emplace(muf->SF, std::move(muf));
+ } else {
+ this->AutogenTarget.Sources.emplace(muf->SF, std::move(muf));
+ }
+ };
// Scan through target files
{
- // String constants
- std::string const qrc_str = "qrc";
- std::string const SKIP_AUTORCC_str = "SKIP_AUTORCC";
- std::string const AUTORCC_OPTIONS_str = "AUTORCC_OPTIONS";
-
// Scan through target files
std::vector<cmSourceFile*> srcFiles;
this->Target->GetConfigCommonSourceFiles(srcFiles);
for (cmSourceFile* sf : srcFiles) {
- if (sf->GetPropertyAsBool(SKIP_AUTOGEN_str)) {
+ // sf->GetExtension() is only valid after sf->GetFullPath() ...
+ // Since we're iterating over source files that might be not in the
+ // target we need to check for path errors (not existing files).
+ std::string pathError;
+ std::string const& fullPath = sf->GetFullPath(&pathError);
+ if (!pathError.empty() || fullPath.empty()) {
continue;
}
-
- // sf->GetExtension() is only valid after sf->GetFullPath() ...
- std::string const& fPath = sf->GetFullPath();
std::string const& ext = sf->GetExtension();
- // Register generated files that will be scanned by moc or uic
- if (this->Moc.Enabled || this->Uic.Enabled) {
- cmSystemTools::FileFormat const fileType =
- cmSystemTools::GetFileFormat(ext);
- if ((fileType == cmSystemTools::CXX_FILE_FORMAT) ||
- (fileType == cmSystemTools::HEADER_FILE_FORMAT)) {
- std::string const absPath = cmSystemTools::GetRealPath(fPath);
- if ((this->Moc.Enabled &&
- !sf->GetPropertyAsBool(SKIP_AUTOMOC_str)) ||
- (this->Uic.Enabled &&
- !sf->GetPropertyAsBool(SKIP_AUTOUIC_str))) {
- // Register source
- const bool generated = sf->GetIsGenerated();
- if (fileType == cmSystemTools::HEADER_FILE_FORMAT) {
- if (generated) {
- this->AutogenTarget.HeadersGenerated.push_back(absPath);
- } else {
- this->AutogenTarget.Headers.push_back(absPath);
- }
- } else {
- if (generated) {
- this->AutogenTarget.SourcesGenerated.push_back(absPath);
- } else {
- this->AutogenTarget.Sources.push_back(absPath);
- }
- }
- }
+ // Register files that will be scanned by moc or uic
+ if (this->MocOrUicEnabled()) {
+ switch (cmSystemTools::GetFileFormat(ext)) {
+ case cmSystemTools::HEADER_FILE_FORMAT:
+ addMUFile(makeMUFile(sf, fullPath, true), true);
+ break;
+ case cmSystemTools::CXX_FILE_FORMAT:
+ addMUFile(makeMUFile(sf, fullPath, true), false);
+ break;
+ default:
+ break;
}
}
+
// Register rcc enabled files
if (this->Rcc.Enabled) {
- if ((ext == qrc_str) && !sf->GetPropertyAsBool(SKIP_AUTORCC_str)) {
+ if ((ext == qrc_str) && !sf->GetPropertyAsBool(SKIP_AUTOGEN_str) &&
+ !sf->GetPropertyAsBool(SKIP_AUTORCC_str)) {
// Register qrc file
Qrc qrc;
- qrc.QrcFile = cmSystemTools::GetRealPath(fPath);
+ qrc.QrcFile = cmSystemTools::GetRealPath(fullPath);
qrc.QrcName =
cmSystemTools::GetFilenameWithoutLastExtension(qrc.QrcFile);
qrc.Generated = sf->GetIsGenerated();
@@ -710,15 +704,72 @@ bool cmQtAutoGenInitializer::InitScanFiles()
// mocs_compilation.cpp source acknowledged by this target.
this->Target->ClearSourcesCache();
+ // For source files find additional headers and private headers
+ if (this->MocOrUicEnabled()) {
+ std::vector<MUFileHandle> extraHeaders;
+ extraHeaders.reserve(this->AutogenTarget.Sources.size() * 2);
+ // Header search suffixes and extensions
+ std::array<std::string, 2> const suffixes{ { "", "_p" } };
+ auto const& exts = makefile->GetCMakeInstance()->GetHeaderExtensions();
+ // Scan through sources
+ for (auto const& pair : this->AutogenTarget.Sources) {
+ MUFile const& muf = *pair.second;
+ if (muf.MocIt || muf.UicIt) {
+ // Search for the default header file and a private header
+ std::string const& realPath = muf.RealPath;
+ std::string basePath = cmQtAutoGen::SubDirPrefix(realPath);
+ basePath += cmSystemTools::GetFilenameWithoutLastExtension(realPath);
+ for (auto const& suffix : suffixes) {
+ std::string const suffixedPath = basePath + suffix;
+ for (auto const& ext : exts) {
+ std::string fullPath = suffixedPath;
+ fullPath += '.';
+ fullPath += ext;
+
+ auto constexpr locationKind = cmSourceFileLocationKind::Known;
+ cmSourceFile* sf = makefile->GetSource(fullPath, locationKind);
+ if (sf != nullptr) {
+ // Check if we know about this header already
+ if (this->AutogenTarget.Headers.find(sf) !=
+ this->AutogenTarget.Headers.end()) {
+ continue;
+ }
+ // We only accept not-GENERATED files that do exist.
+ if (!sf->GetIsGenerated() &&
+ !cmSystemTools::FileExists(fullPath)) {
+ continue;
+ }
+ } else if (cmSystemTools::FileExists(fullPath)) {
+ // Create a new source file for the existing file
+ sf = makefile->CreateSource(fullPath, false, locationKind);
+ }
+
+ if (sf != nullptr) {
+ auto eMuf = makeMUFile(sf, fullPath, true);
+ // Ony process moc/uic when the parent is processed as well
+ if (!muf.MocIt) {
+ eMuf->MocIt = false;
+ }
+ if (!muf.UicIt) {
+ eMuf->UicIt = false;
+ }
+ extraHeaders.emplace_back(std::move(eMuf));
+ }
+ }
+ }
+ }
+ }
+ // Move generated files to main headers list
+ for (auto& eMuf : extraHeaders) {
+ addMUFile(std::move(eMuf), true);
+ }
+ }
+
// Scan through all source files in the makefile to extract moc and uic
// parameters. Historically we support non target source file parameters.
// The reason is that their file names might be discovered from source files
// at generation time.
- if (this->Moc.Enabled || this->Uic.Enabled) {
- // String constants
- std::string const ui_str = "ui";
- std::string const AUTOUIC_OPTIONS_str = "AUTOUIC_OPTIONS";
-
+ if (this->MocOrUicEnabled()) {
for (cmSourceFile* sf : makefile->GetSourceFiles()) {
// sf->GetExtension() is only valid after sf->GetFullPath() ...
// Since we're iterating over source files that might be not in the
@@ -728,132 +779,87 @@ bool cmQtAutoGenInitializer::InitScanFiles()
if (!pathError.empty() || fullPath.empty()) {
continue;
}
+ std::string const& ext = sf->GetExtension();
- // Check file type
- auto const fileType = cmSystemTools::GetFileFormat(sf->GetExtension());
- bool const isSource = (fileType == cmSystemTools::CXX_FILE_FORMAT) ||
- (fileType == cmSystemTools::HEADER_FILE_FORMAT);
- bool const isUi = (this->Moc.Enabled && sf->GetExtension() == ui_str);
-
- // Process only certain file types
- if (isSource || isUi) {
- std::string const absFile = cmSystemTools::GetRealPath(fullPath);
- // Acquire file properties
- bool const skipAUTOGEN = sf->GetPropertyAsBool(SKIP_AUTOGEN_str);
- bool const skipMoc = (this->Moc.Enabled && isSource) &&
- (skipAUTOGEN || sf->GetPropertyAsBool(SKIP_AUTOMOC_str));
- bool const skipUic = this->Uic.Enabled &&
- (skipAUTOGEN || sf->GetPropertyAsBool(SKIP_AUTOUIC_str));
-
- // Register moc and uic skipped file
- if (skipMoc) {
- this->Moc.Skip.insert(absFile);
+ auto const fileFormat = cmSystemTools::GetFileFormat(ext);
+ if (fileFormat == cmSystemTools::HEADER_FILE_FORMAT) {
+ if (this->AutogenTarget.Headers.find(sf) ==
+ this->AutogenTarget.Headers.end()) {
+ auto muf = makeMUFile(sf, fullPath, false);
+ if (muf->SkipMoc || muf->SkipUic) {
+ this->AutogenTarget.Headers.emplace(sf, std::move(muf));
+ }
}
- if (skipUic) {
- this->Uic.Skip.insert(absFile);
+ } else if (fileFormat == cmSystemTools::CXX_FILE_FORMAT) {
+ if (this->AutogenTarget.Sources.find(sf) ==
+ this->AutogenTarget.Sources.end()) {
+ auto muf = makeMUFile(sf, fullPath, false);
+ if (muf->SkipMoc || muf->SkipUic) {
+ this->AutogenTarget.Sources.emplace(sf, std::move(muf));
+ }
}
-
- // Check if the .ui file has uic options
- if (isUi && !skipUic) {
+ } else if (this->Uic.Enabled && (ext == ui_str)) {
+ // .ui file
+ std::string realPath = cmSystemTools::GetRealPath(fullPath);
+ bool const skipAutogen = sf->GetPropertyAsBool(SKIP_AUTOGEN_str);
+ bool const skipUic =
+ (skipAutogen || sf->GetPropertyAsBool(SKIP_AUTOUIC_str));
+ if (!skipUic) {
+ // Check if the .ui file has uic options
std::string const uicOpts = sf->GetSafeProperty(AUTOUIC_OPTIONS_str);
if (!uicOpts.empty()) {
- this->Uic.FileFiles.push_back(absFile);
+ this->Uic.FileFiles.push_back(std::move(realPath));
std::vector<std::string> optsVec;
cmSystemTools::ExpandListArgument(uicOpts, optsVec);
this->Uic.FileOptions.push_back(std::move(optsVec));
}
+ } else {
+ // Register skipped .ui file
+ this->Uic.SkipUi.insert(std::move(realPath));
}
}
}
}
// Process GENERATED sources and headers
- if (this->Moc.Enabled || this->Uic.Enabled) {
- if (!this->AutogenTarget.SourcesGenerated.empty() ||
- !this->AutogenTarget.HeadersGenerated.empty()) {
- // Check status of policy CMP0071
- bool policyAccept = false;
- bool policyWarn = false;
- cmPolicies::PolicyStatus const CMP0071_status =
- makefile->GetPolicyStatus(cmPolicies::CMP0071);
- switch (CMP0071_status) {
- case cmPolicies::WARN:
- policyWarn = true;
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- // Ignore GENERATED file
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::NEW:
- // Process GENERATED file
- policyAccept = true;
- break;
+ if (this->MocOrUicEnabled() && !this->AutogenTarget.FilesGenerated.empty()) {
+ if (this->CMP0071Accept) {
+ // Let the autogen target depend on the GENERATED files
+ for (MUFile* muf : this->AutogenTarget.FilesGenerated) {
+ this->AutogenTarget.DependFiles.insert(muf->RealPath);
}
-
- if (policyAccept) {
- // Accept GENERATED sources
- for (std::string const& absFile :
- this->AutogenTarget.HeadersGenerated) {
- this->AutogenTarget.Headers.push_back(absFile);
- this->AutogenTarget.DependFiles.insert(absFile);
- }
- for (std::string const& absFile :
- this->AutogenTarget.SourcesGenerated) {
- this->AutogenTarget.Sources.push_back(absFile);
- this->AutogenTarget.DependFiles.insert(absFile);
- }
- } else {
- if (policyWarn) {
- std::string msg;
- msg += cmPolicies::GetPolicyWarning(cmPolicies::CMP0071);
- msg += "\n";
- std::string tools;
- std::string property;
- if (this->Moc.Enabled && this->Uic.Enabled) {
- tools = "AUTOMOC and AUTOUIC";
- property = "SKIP_AUTOGEN";
- } else if (this->Moc.Enabled) {
- tools = "AUTOMOC";
- property = "SKIP_AUTOMOC";
- } else if (this->Uic.Enabled) {
- tools = "AUTOUIC";
- property = "SKIP_AUTOUIC";
- }
- msg += "For compatibility, CMake is excluding the GENERATED source "
- "file(s):\n";
- for (const std::string& absFile :
- this->AutogenTarget.HeadersGenerated) {
- msg.append(" ").append(Quoted(absFile)).append("\n");
- }
- for (const std::string& absFile :
- this->AutogenTarget.SourcesGenerated) {
- msg.append(" ").append(Quoted(absFile)).append("\n");
- }
- msg += "from processing by ";
- msg += tools;
- msg +=
- ". If any of the files should be processed, set CMP0071 to NEW. "
- "If any of the files should not be processed, "
- "explicitly exclude them by setting the source file property ";
- msg += property;
- msg += ":\n set_property(SOURCE file.h PROPERTY ";
- msg += property;
- msg += " ON)\n";
- makefile->IssueMessage(MessageType::AUTHOR_WARNING, msg);
- }
+ } else if (this->CMP0071Warn) {
+ std::string msg;
+ msg += cmPolicies::GetPolicyWarning(cmPolicies::CMP0071);
+ msg += '\n';
+ std::string property;
+ if (this->Moc.Enabled && this->Uic.Enabled) {
+ property = "SKIP_AUTOGEN";
+ } else if (this->Moc.Enabled) {
+ property = "SKIP_AUTOMOC";
+ } else if (this->Uic.Enabled) {
+ property = "SKIP_AUTOUIC";
}
+ msg += "For compatibility, CMake is excluding the GENERATED source "
+ "file(s):\n";
+ for (MUFile* muf : this->AutogenTarget.FilesGenerated) {
+ msg += " ";
+ msg += Quoted(muf->RealPath);
+ msg += '\n';
+ }
+ msg += "from processing by ";
+ msg += cmQtAutoGen::Tools(this->Moc.Enabled, this->Uic.Enabled, false);
+ msg += ". If any of the files should be processed, set CMP0071 to NEW. "
+ "If any of the files should not be processed, "
+ "explicitly exclude them by setting the source file property ";
+ msg += property;
+ msg += ":\n set_property(SOURCE file.h PROPERTY ";
+ msg += property;
+ msg += " ON)\n";
+ makefile->IssueMessage(MessageType::AUTHOR_WARNING, msg);
}
}
- // Sort headers and sources
- if (this->Moc.Enabled || this->Uic.Enabled) {
- std::sort(this->AutogenTarget.Headers.begin(),
- this->AutogenTarget.Headers.end());
- std::sort(this->AutogenTarget.Sources.begin(),
- this->AutogenTarget.Sources.end());
- }
-
// Process qrc files
if (!this->Rcc.Qrcs.empty()) {
const bool modernQt = (this->QtVersion.Major >= 5);
@@ -961,7 +967,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
// Files provided by the autogen target
std::vector<std::string> autogenProvides;
if (this->Moc.Enabled) {
- this->AddGeneratedSource(this->Moc.MocsCompilation, GeneratorT::MOC, true);
+ this->AddGeneratedSource(this->Moc.MocsCompilation, this->Moc, true);
autogenProvides.push_back(this->Moc.MocsCompilation);
}
@@ -1109,13 +1115,12 @@ bool cmQtAutoGenInitializer::InitRccTargets()
{
cmMakefile* makefile = this->Target->Target->GetMakefile();
cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
- auto rccTargetName = GetQtExecutableTargetName(this->QtVersion, "rcc");
for (Qrc const& qrc : this->Rcc.Qrcs) {
// Register info file as generated by CMake
makefile->AddCMakeOutputFile(qrc.InfoFile);
// Register file at target
- this->AddGeneratedSource(qrc.RccFile, GeneratorT::RCC);
+ this->AddGeneratedSource(qrc.RccFile, this->Rcc);
std::vector<std::string> ccOutput;
ccOutput.push_back(qrc.RccFile);
@@ -1174,8 +1179,8 @@ bool cmQtAutoGenInitializer::InitRccTargets()
if (!this->TargetsFolder.empty()) {
autoRccTarget->SetProperty("FOLDER", this->TargetsFolder.c_str());
}
- if (!rccTargetName.empty()) {
- autoRccTarget->AddUtility(rccTargetName, makefile);
+ if (!this->Rcc.ExecutableTargetName.empty()) {
+ autoRccTarget->AddUtility(this->Rcc.ExecutableTargetName, makefile);
}
}
// Add autogen target to the origin target dependencies
@@ -1195,8 +1200,8 @@ bool cmQtAutoGenInitializer::InitRccTargets()
// Add resource file to the custom command dependencies
ccDepends.push_back(fileName);
}
- if (!rccTargetName.empty()) {
- ccDepends.push_back(rccTargetName);
+ if (!this->Rcc.ExecutableTargetName.empty()) {
+ ccDepends.push_back(this->Rcc.ExecutableTargetName);
}
makefile->AddCustomCommandToOutput(ccOutput, ccByproducts, ccDepends,
/*main_dependency*/ std::string(),
@@ -1222,7 +1227,7 @@ bool cmQtAutoGenInitializer::SetupCustomTargets()
}
// Generate autogen target info file
- if (this->Moc.Enabled || this->Uic.Enabled) {
+ if (this->MocOrUicEnabled()) {
// Write autogen target info files
if (!this->SetupWriteAutogenInfo()) {
return false;
@@ -1262,22 +1267,74 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
ofs.Write("AM_INCLUDE_DIR", this->Dir.Include);
ofs.WriteConfig("AM_INCLUDE_DIR", this->Dir.ConfigInclude);
- ofs.Write("# Files\n");
- ofs.WriteStrings("AM_SOURCES", this->AutogenTarget.Sources);
- ofs.WriteStrings("AM_HEADERS", this->AutogenTarget.Headers);
- ofs.Write("AM_SETTINGS_FILE", this->AutogenTarget.SettingsFile);
- ofs.WriteConfig("AM_SETTINGS_FILE",
- this->AutogenTarget.ConfigSettingsFile);
+ // Use sorted sets
+ std::set<std::string> headers;
+ std::set<std::string> sources;
+ std::set<std::string> moc_headers;
+ std::set<std::string> moc_sources;
+ std::set<std::string> moc_skip;
+ std::set<std::string> uic_headers;
+ std::set<std::string> uic_sources;
+ std::set<std::string> uic_skip;
+ // Filter headers
+ for (auto const& pair : this->AutogenTarget.Headers) {
+ MUFile const& muf = *pair.second;
+ if (muf.Generated && !this->CMP0071Accept) {
+ continue;
+ }
+ if (muf.SkipMoc) {
+ moc_skip.insert(muf.RealPath);
+ }
+ if (muf.SkipUic) {
+ uic_skip.insert(muf.RealPath);
+ }
+ if (muf.MocIt && muf.UicIt) {
+ headers.insert(muf.RealPath);
+ } else if (muf.MocIt) {
+ moc_headers.insert(muf.RealPath);
+ } else if (muf.UicIt) {
+ uic_headers.insert(muf.RealPath);
+ }
+ }
+ // Filter sources
+ for (auto const& pair : this->AutogenTarget.Sources) {
+ MUFile const& muf = *pair.second;
+ if (muf.Generated && !this->CMP0071Accept) {
+ continue;
+ }
+ if (muf.SkipMoc) {
+ moc_skip.insert(muf.RealPath);
+ }
+ if (muf.SkipUic) {
+ uic_skip.insert(muf.RealPath);
+ }
+ if (muf.MocIt && muf.UicIt) {
+ sources.insert(muf.RealPath);
+ } else if (muf.MocIt) {
+ moc_sources.insert(muf.RealPath);
+ } else if (muf.UicIt) {
+ uic_sources.insert(muf.RealPath);
+ }
+ }
ofs.Write("# Qt\n");
ofs.WriteUInt("AM_QT_VERSION_MAJOR", this->QtVersion.Major);
ofs.Write("AM_QT_MOC_EXECUTABLE", this->Moc.Executable);
ofs.Write("AM_QT_UIC_EXECUTABLE", this->Uic.Executable);
+ ofs.Write("# Files\n");
+ ofs.Write("AM_SETTINGS_FILE", this->AutogenTarget.SettingsFile);
+ ofs.WriteConfig("AM_SETTINGS_FILE",
+ this->AutogenTarget.ConfigSettingsFile);
+ ofs.WriteStrings("AM_HEADERS", headers);
+ ofs.WriteStrings("AM_SOURCES", sources);
+
// Write moc settings
if (this->Moc.Enabled) {
ofs.Write("# MOC settings\n");
- ofs.WriteStrings("AM_MOC_SKIP", this->Moc.Skip);
+ ofs.WriteStrings("AM_MOC_HEADERS", moc_headers);
+ ofs.WriteStrings("AM_MOC_SOURCES", moc_sources);
+ ofs.WriteStrings("AM_MOC_SKIP", moc_skip);
ofs.WriteStrings("AM_MOC_DEFINITIONS", this->Moc.Defines);
ofs.WriteConfigStrings("AM_MOC_DEFINITIONS", this->Moc.ConfigDefines);
ofs.WriteStrings("AM_MOC_INCLUDES", this->Moc.Includes);
@@ -1294,8 +1351,13 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
// Write uic settings
if (this->Uic.Enabled) {
+ // Add skipped .ui files
+ uic_skip.insert(this->Uic.SkipUi.begin(), this->Uic.SkipUi.end());
+
ofs.Write("# UIC settings\n");
- ofs.WriteStrings("AM_UIC_SKIP", this->Uic.Skip);
+ ofs.WriteStrings("AM_UIC_HEADERS", uic_headers);
+ ofs.WriteStrings("AM_UIC_SOURCES", uic_sources);
+ ofs.WriteStrings("AM_UIC_SKIP", uic_skip);
ofs.WriteStrings("AM_UIC_TARGET_OPTIONS", this->Uic.Options);
ofs.WriteConfigStrings("AM_UIC_TARGET_OPTIONS", this->Uic.ConfigOptions);
ofs.WriteStrings("AM_UIC_OPTIONS_FILES", this->Uic.FileFiles);
@@ -1353,23 +1415,68 @@ bool cmQtAutoGenInitializer::SetupWriteRccInfo()
return true;
}
-void cmQtAutoGenInitializer::AddGeneratedSource(std::string const& filename,
- GeneratorT genType,
- bool prepend)
+void cmQtAutoGenInitializer::RegisterGeneratedSource(
+ std::string const& filename)
{
- // Register source file in makefile
cmMakefile* makefile = this->Target->Target->GetMakefile();
- {
- cmSourceFile* gFile = makefile->GetOrCreateSource(filename, true);
- gFile->SetProperty("GENERATED", "1");
- gFile->SetProperty("SKIP_AUTOGEN", "On");
- }
-
- // Add source file to source group
- AddToSourceGroup(makefile, filename, genType);
+ cmSourceFile* gFile = makefile->GetOrCreateSource(filename, true);
+ gFile->SetProperty("GENERATED", "1");
+ gFile->SetProperty("SKIP_AUTOGEN", "1");
+}
+bool cmQtAutoGenInitializer::AddGeneratedSource(std::string const& filename,
+ GenVarsT const& genVars,
+ bool prepend)
+{
+ // Register source at makefile
+ this->RegisterGeneratedSource(filename);
// Add source file to target
this->Target->AddSource(filename, prepend);
+ // Add source file to source group
+ return this->AddToSourceGroup(filename, genVars.GenNameUpper);
+}
+
+bool cmQtAutoGenInitializer::AddToSourceGroup(std::string const& fileName,
+ std::string const& genNameUpper)
+{
+ cmMakefile* makefile = this->Target->Target->GetMakefile();
+ cmSourceGroup* sourceGroup = nullptr;
+ // Acquire source group
+ {
+ std::string property;
+ std::string groupName;
+ {
+ // Prefer generator specific source group name
+ std::array<std::string, 2> props{ { genNameUpper + "_SOURCE_GROUP",
+ "AUTOGEN_SOURCE_GROUP" } };
+ for (std::string& prop : props) {
+ const char* propName = makefile->GetState()->GetGlobalProperty(prop);
+ if ((propName != nullptr) && (*propName != '\0')) {
+ groupName = propName;
+ property = std::move(prop);
+ break;
+ }
+ }
+ }
+ // Generate a source group on demand
+ if (!groupName.empty()) {
+ sourceGroup = makefile->GetOrCreateSourceGroup(groupName);
+ if (sourceGroup == nullptr) {
+ std::string err;
+ err += genNameUpper;
+ err += " error in ";
+ err += property;
+ err += ": Could not find or create the source group ";
+ err += cmQtAutoGen::Quoted(groupName);
+ cmSystemTools::Error(err);
+ return false;
+ }
+ }
+ }
+ if (sourceGroup != nullptr) {
+ sourceGroup->AddGroupFile(fileName);
+ }
+ return true;
}
static unsigned int CharPtrToUInt(const char* const input)
@@ -1384,8 +1491,12 @@ static unsigned int CharPtrToUInt(const char* const input)
static std::vector<cmQtAutoGen::IntegerVersion> GetKnownQtVersions(
cmGeneratorTarget const* target)
{
- cmMakefile* makefile = target->Target->GetMakefile();
+ // Qt version variable prefixes
+ static std::array<std::string, 3> const prefixes{ { "Qt6Core", "Qt5Core",
+ "QT" } };
+
std::vector<cmQtAutoGen::IntegerVersion> result;
+ result.reserve(prefixes.size() * 2);
// Adds a version to the result (nullptr safe)
auto addVersion = [&result](const char* major, const char* minor) {
cmQtAutoGen::IntegerVersion ver(CharPtrToUInt(major),
@@ -1394,8 +1505,7 @@ static std::vector<cmQtAutoGen::IntegerVersion> GetKnownQtVersions(
result.emplace_back(ver);
}
};
- // Qt version variable prefixes
- std::array<std::string, 3> const prefixes{ { "Qt6Core", "Qt5Core", "QT" } };
+ cmMakefile* makefile = target->Target->GetMakefile();
// Read versions from variables
for (const std::string& prefix : prefixes) {
@@ -1439,124 +1549,89 @@ cmQtAutoGenInitializer::GetQtVersion(cmGeneratorTarget const* target)
return res;
}
-std::pair<bool, std::string> GetQtExecutable(
- const cmQtAutoGen::IntegerVersion& qtVersion, cmGeneratorTarget* target,
- const std::string& executable, bool ignoreMissingTarget, std::string* output)
+bool cmQtAutoGenInitializer::GetQtExecutable(GenVarsT& genVars,
+ const std::string& executable,
+ bool ignoreMissingTarget,
+ std::string* output) const
{
- const std::string upperExecutable = cmSystemTools::UpperCase(executable);
- std::string result =
- target->Target->GetSafeProperty("AUTO" + upperExecutable + "_EXECUTABLE");
- if (!result.empty()) {
- cmListFileBacktrace lfbt = target->Target->GetMakefile()->GetBacktrace();
- cmGeneratorExpression ge(lfbt);
- std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(result);
- result = cge->Evaluate(target->GetLocalGenerator(), "");
-
- return std::make_pair(true, result);
- }
-
- std::string err;
+ auto print_err = [this, &genVars](std::string const& err) {
+ std::string msg = genVars.GenNameUpper;
+ msg += " for target ";
+ msg += this->Target->GetName();
+ msg += ": ";
+ msg += err;
+ cmSystemTools::Error(msg);
+ };
- // Find executable
+ // Custom executable
{
- const std::string targetName =
- GetQtExecutableTargetName(qtVersion, executable);
- if (targetName.empty()) {
- err = "The AUTO" + upperExecutable + " feature ";
- err += "supports only Qt 4, Qt 5 and Qt 6.";
- } else {
- cmLocalGenerator* localGen = target->GetLocalGenerator();
- cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName);
- if (tgt != nullptr) {
- if (tgt->IsImported()) {
- result = tgt->ImportedGetLocation("");
- } else {
- result = tgt->GetLocation("");
- }
- } else {
- if (ignoreMissingTarget) {
- return std::make_pair(true, "");
- }
-
- err = "Could not find target " + targetName;
+ std::string const prop = genVars.GenNameUpper + "_EXECUTABLE";
+ std::string const val = this->Target->Target->GetSafeProperty(prop);
+ if (!val.empty()) {
+ // Evaluate generator expression
+ {
+ cmListFileBacktrace lfbt =
+ this->Target->Target->GetMakefile()->GetBacktrace();
+ cmGeneratorExpression ge(lfbt);
+ std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(val);
+ genVars.Executable =
+ cge->Evaluate(this->Target->GetLocalGenerator(), "");
}
+ if (genVars.Executable.empty() && !ignoreMissingTarget) {
+ print_err(prop + " evaluates to an empty value");
+ return false;
+ }
+ return true;
}
}
- // Test executable
- if (err.empty()) {
- if (cmSystemTools::FileExists(result, true)) {
- std::vector<std::string> command;
- command.push_back(result);
- command.emplace_back("-h");
- std::string stdOut;
- std::string stdErr;
- int retVal = 0;
- const bool runResult = cmSystemTools::RunSingleCommand(
- command, &stdOut, &stdErr, &retVal, nullptr,
- cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto);
- if (!runResult) {
- err = "Test of \"" + executable + "\" binary ";
- err += cmQtAutoGen::Quoted(result) + " failed: ";
- err += cmQtAutoGen::QuotedCommand(command);
+ // Find executable target
+ {
+ // Find executable target name
+ std::string targetName;
+ if (this->QtVersion.Major == 4) {
+ targetName = "Qt4::";
+ } else if (this->QtVersion.Major == 5) {
+ targetName = "Qt5::";
+ } else if (this->QtVersion.Major == 6) {
+ targetName = "Qt6::";
+ }
+ targetName += executable;
+
+ // Find target
+ cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
+ cmGeneratorTarget* target = localGen->FindGeneratorTargetToUse(targetName);
+ if (target != nullptr) {
+ genVars.ExecutableTargetName = targetName;
+ genVars.ExecutableTarget = target;
+ if (target->IsImported()) {
+ genVars.Executable = target->ImportedGetLocation("");
} else {
- if (output != nullptr) {
- *output = stdOut;
- }
+ genVars.Executable = target->GetLocation("");
}
} else {
- err = "The \"" + executable + "\" binary ";
- err += cmQtAutoGen::Quoted(result);
- err += " does not exist";
+ if (ignoreMissingTarget) {
+ return true;
+ }
+ std::string err = "Could not find ";
+ err += executable;
+ err += " executable target ";
+ err += targetName;
+ print_err(err);
+ return false;
}
}
- // Print error
- if (!err.empty()) {
- std::string msg = "AutoGen (";
- msg += target->GetName();
- msg += "): ";
- msg += err;
- cmSystemTools::Error(msg);
- return std::make_pair(false, "");
- }
-
- return std::make_pair(true, result);
-}
-
-bool cmQtAutoGenInitializer::GetMocExecutable()
-{
- const auto result =
- GetQtExecutable(this->QtVersion, this->Target, "moc", false, nullptr);
- this->Moc.Executable = result.second;
- return result.first;
-}
-
-bool cmQtAutoGenInitializer::GetUicExecutable()
-{
- const auto result =
- GetQtExecutable(this->QtVersion, this->Target, "uic", true, nullptr);
- this->Uic.Executable = result.second;
- return result.first;
-}
-
-bool cmQtAutoGenInitializer::GetRccExecutable()
-{
- std::string stdOut;
- const auto result =
- GetQtExecutable(this->QtVersion, this->Target, "rcc", false, &stdOut);
- this->Rcc.Executable = result.second;
- if (!result.first) {
- return false;
- }
-
- if (this->QtVersion.Major == 5 || this->QtVersion.Major == 6) {
- if (stdOut.find("--list") != std::string::npos) {
- this->Rcc.ListOptions.emplace_back("--list");
- } else {
- this->Rcc.ListOptions.emplace_back("-list");
+ // Test executable
+ {
+ std::string err;
+ if (!this->GlobalInitializer->GetExecutableTestOutput(
+ executable, genVars.Executable, err, output)) {
+ print_err(err);
+ return false;
}
}
+
return true;
}
diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h
index 10f0bf3..a8c7960 100644
--- a/Source/cmQtAutoGenInitializer.h
+++ b/Source/cmQtAutoGenInitializer.h
@@ -8,15 +8,18 @@
#include "cmQtAutoGen.h"
#include <map>
+#include <memory> // IWYU pragma: keep
#include <ostream>
#include <set>
#include <string>
+#include <unordered_map>
#include <utility>
#include <vector>
class cmGeneratorTarget;
class cmTarget;
class cmQtAutoGenGlobalInitializer;
+class cmSourceFile;
/// @brief Initializes the QtAutoGen generators
class cmQtAutoGenInitializer : public cmQtAutoGen
@@ -40,6 +43,40 @@ public:
std::vector<std::string> Resources;
};
+ /// @brief Moc/Uic file
+ struct MUFile
+ {
+ std::string RealPath;
+ cmSourceFile* SF = nullptr;
+ bool Generated = false;
+ bool SkipMoc = false;
+ bool SkipUic = false;
+ bool MocIt = false;
+ bool UicIt = false;
+ };
+ typedef std::unique_ptr<MUFile> MUFileHandle;
+
+ /// @brief Abstract moc/uic/rcc generator variables base class
+ struct GenVarsT
+ {
+ bool Enabled = false;
+ // Generator type/name
+ GenT Gen;
+ std::string const& GenName;
+ std::string const& GenNameUpper;
+ // Executable
+ std::string ExecutableTargetName;
+ cmGeneratorTarget* ExecutableTarget = nullptr;
+ std::string Executable;
+
+ /// @brief Constructor
+ GenVarsT(GenT gen, std::string const& genName,
+ std::string const& genNameUpper)
+ : Gen(gen)
+ , GenName(genName)
+ , GenNameUpper(genNameUpper){};
+ };
+
/// @brief Writes a CMake info file
class InfoWriter
{
@@ -88,6 +125,12 @@ public:
bool SetupCustomTargets();
private:
+ /// @brief If moc or uic is enabled, the autogen target will be generated
+ bool MocOrUicEnabled() const
+ {
+ return (this->Moc.Enabled || this->Uic.Enabled);
+ }
+
bool InitMoc();
bool InitUic();
bool InitRcc();
@@ -99,12 +142,14 @@ private:
bool SetupWriteAutogenInfo();
bool SetupWriteRccInfo();
- void AddGeneratedSource(std::string const& filename, GeneratorT genType,
+ void RegisterGeneratedSource(std::string const& filename);
+ bool AddGeneratedSource(std::string const& filename, GenVarsT const& genVars,
bool prepend = false);
+ bool AddToSourceGroup(std::string const& fileName,
+ std::string const& genNameUpper);
- bool GetMocExecutable();
- bool GetUicExecutable();
- bool GetRccExecutable();
+ 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,
@@ -121,6 +166,8 @@ private:
std::vector<std::string> ConfigsList;
std::string Verbosity;
std::string TargetsFolder;
+ bool CMP0071Accept = false;
+ bool CMP0071Warn = false;
/// @brief Common directories
struct
@@ -148,47 +195,54 @@ private:
std::set<std::string> DependFiles;
std::set<cmTarget*> DependTargets;
// Sources to process
- std::vector<std::string> Headers;
- std::vector<std::string> Sources;
- std::vector<std::string> HeadersGenerated;
- std::vector<std::string> SourcesGenerated;
+ std::unordered_map<cmSourceFile*, MUFileHandle> Headers;
+ std::unordered_map<cmSourceFile*, MUFileHandle> Sources;
+ std::vector<MUFile*> FilesGenerated;
} AutogenTarget;
/// @brief Moc only variables
- struct
+ struct MocT : public GenVarsT
{
- bool Enabled = false;
- std::string Executable;
std::string PredefsCmd;
- std::set<std::string> Skip;
std::vector<std::string> Includes;
std::map<std::string, std::vector<std::string>> ConfigIncludes;
std::set<std::string> Defines;
std::map<std::string, std::set<std::string>> ConfigDefines;
std::string MocsCompilation;
+
+ /// @brief Constructor
+ MocT()
+ : GenVarsT(cmQtAutoGen::GenT::MOC, cmQtAutoGen::GenNameMoc,
+ cmQtAutoGen::GenNameMocUpper){};
} Moc;
- ///@brief Uic only variables
- struct
+ /// @brief Uic only variables
+ struct UicT : public GenVarsT
{
- bool Enabled = false;
- std::string Executable;
- std::set<std::string> Skip;
+ std::set<std::string> SkipUi;
std::vector<std::string> SearchPaths;
std::vector<std::string> Options;
std::map<std::string, std::vector<std::string>> ConfigOptions;
std::vector<std::string> FileFiles;
std::vector<std::vector<std::string>> FileOptions;
+
+ /// @brief Constructor
+ UicT()
+ : GenVarsT(cmQtAutoGen::GenT::UIC, cmQtAutoGen::GenNameUic,
+ cmQtAutoGen::GenNameUicUpper){};
} Uic;
/// @brief Rcc only variables
- struct
+ struct RccT : public GenVarsT
{
- bool Enabled = false;
bool GlobalTarget = false;
- std::string Executable;
std::vector<std::string> ListOptions;
std::vector<Qrc> Qrcs;
+
+ /// @brief Constructor
+ RccT()
+ : GenVarsT(cmQtAutoGen::GenT::RCC, cmQtAutoGen::GenNameRcc,
+ cmQtAutoGen::GenNameRccUpper){};
} Rcc;
};
diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx
index fbb9df3..af50c1d 100644
--- a/Source/cmQtAutoGenerator.cxx
+++ b/Source/cmQtAutoGenerator.cxx
@@ -43,8 +43,7 @@ std::string cmQtAutoGenerator::Logger::HeadLine(std::string const& title)
return head;
}
-void cmQtAutoGenerator::Logger::Info(GeneratorT genType,
- std::string const& message)
+void cmQtAutoGenerator::Logger::Info(GenT genType, std::string const& message)
{
std::string msg = GeneratorName(genType);
msg += ": ";
@@ -58,7 +57,7 @@ void cmQtAutoGenerator::Logger::Info(GeneratorT genType,
}
}
-void cmQtAutoGenerator::Logger::Warning(GeneratorT genType,
+void cmQtAutoGenerator::Logger::Warning(GenT genType,
std::string const& message)
{
std::string msg;
@@ -82,7 +81,7 @@ void cmQtAutoGenerator::Logger::Warning(GeneratorT genType,
}
}
-void cmQtAutoGenerator::Logger::WarningFile(GeneratorT genType,
+void cmQtAutoGenerator::Logger::WarningFile(GenT genType,
std::string const& filename,
std::string const& message)
{
@@ -94,8 +93,7 @@ void cmQtAutoGenerator::Logger::WarningFile(GeneratorT genType,
Warning(genType, msg);
}
-void cmQtAutoGenerator::Logger::Error(GeneratorT genType,
- std::string const& message)
+void cmQtAutoGenerator::Logger::Error(GenT genType, std::string const& message)
{
std::string msg;
msg += HeadLine(GeneratorName(genType) + " error");
@@ -111,7 +109,7 @@ void cmQtAutoGenerator::Logger::Error(GeneratorT genType,
}
}
-void cmQtAutoGenerator::Logger::ErrorFile(GeneratorT genType,
+void cmQtAutoGenerator::Logger::ErrorFile(GenT genType,
std::string const& filename,
std::string const& message)
{
@@ -124,7 +122,7 @@ void cmQtAutoGenerator::Logger::ErrorFile(GeneratorT genType,
}
void cmQtAutoGenerator::Logger::ErrorCommand(
- GeneratorT genType, std::string const& message,
+ GenT genType, std::string const& message,
std::vector<std::string> const& command, std::string const& output)
{
std::string msg;
@@ -297,7 +295,7 @@ bool cmQtAutoGenerator::FileSystem::FileRead(std::string& content,
return success;
}
-bool cmQtAutoGenerator::FileSystem::FileRead(GeneratorT genType,
+bool cmQtAutoGenerator::FileSystem::FileRead(GenT genType,
std::string& content,
std::string const& filename)
{
@@ -343,7 +341,7 @@ bool cmQtAutoGenerator::FileSystem::FileWrite(std::string const& filename,
return success;
}
-bool cmQtAutoGenerator::FileSystem::FileWrite(GeneratorT genType,
+bool cmQtAutoGenerator::FileSystem::FileWrite(GenT genType,
std::string const& filename,
std::string const& content)
{
@@ -387,7 +385,7 @@ bool cmQtAutoGenerator::FileSystem::MakeDirectory(std::string const& dirname)
return cmSystemTools::MakeDirectory(dirname);
}
-bool cmQtAutoGenerator::FileSystem::MakeDirectory(GeneratorT genType,
+bool cmQtAutoGenerator::FileSystem::MakeDirectory(GenT genType,
std::string const& dirname)
{
if (!MakeDirectory(dirname)) {
@@ -409,7 +407,7 @@ bool cmQtAutoGenerator::FileSystem::MakeParentDirectory(
}
bool cmQtAutoGenerator::FileSystem::MakeParentDirectory(
- GeneratorT genType, std::string const& filename)
+ GenT genType, std::string const& filename)
{
if (!MakeParentDirectory(filename)) {
Log()->ErrorFile(genType, filename, "Could not create parent directory");
diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h
index 9956a99..6771dd8 100644
--- a/Source/cmQtAutoGenerator.h
+++ b/Source/cmQtAutoGenerator.h
@@ -40,16 +40,16 @@ public:
bool ColorOutput() const { return this->ColorOutput_; }
void SetColorOutput(bool value);
// -- Log info
- void Info(GeneratorT genType, std::string const& message);
+ void Info(GenT genType, std::string const& message);
// -- Log warning
- void Warning(GeneratorT genType, std::string const& message);
- void WarningFile(GeneratorT genType, std::string const& filename,
+ void Warning(GenT genType, std::string const& message);
+ void WarningFile(GenT genType, std::string const& filename,
std::string const& message);
// -- Log error
- void Error(GeneratorT genType, std::string const& message);
- void ErrorFile(GeneratorT genType, std::string const& filename,
+ void Error(GenT genType, std::string const& message);
+ void ErrorFile(GenT genType, std::string const& filename,
std::string const& message);
- void ErrorCommand(GeneratorT genType, std::string const& message,
+ void ErrorCommand(GenT genType, std::string const& message,
std::vector<std::string> const& command,
std::string const& output);
@@ -114,13 +114,13 @@ public:
bool FileRead(std::string& content, std::string const& filename,
std::string* error = nullptr);
/// @brief Error logging version
- bool FileRead(GeneratorT genType, std::string& content,
+ 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(GeneratorT genType, std::string const& filename,
+ bool FileWrite(GenT genType, std::string const& filename,
std::string const& content);
bool FileDiffers(std::string const& filename, std::string const& content);
@@ -131,11 +131,11 @@ public:
// -- Directory access
bool MakeDirectory(std::string const& dirname);
/// @brief Error logging version
- bool MakeDirectory(GeneratorT genType, std::string const& dirname);
+ bool MakeDirectory(GenT genType, std::string const& dirname);
bool MakeParentDirectory(std::string const& filename);
/// @brief Error logging version
- bool MakeParentDirectory(GeneratorT genType, std::string const& filename);
+ bool MakeParentDirectory(GenT genType, std::string const& filename);
private:
std::mutex Mutex_;
diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx
index 2959b7d..b02cd44 100644
--- a/Source/cmQtAutoGeneratorMocUic.cxx
+++ b/Source/cmQtAutoGeneratorMocUic.cxx
@@ -5,7 +5,6 @@
#include <algorithm>
#include <array>
#include <cstddef>
-#include <functional>
#include <list>
#include <memory>
#include <set>
@@ -184,11 +183,10 @@ void cmQtAutoGeneratorMocUic::JobParseT::Process(WorkerT& wrk)
ParseUic(wrk, meta);
}
} else {
- wrk.LogFileWarning(GeneratorT::GEN, FileName,
- "The source file is empty");
+ wrk.LogFileWarning(GenT::GEN, FileName, "The source file is empty");
}
} else {
- wrk.LogFileError(GeneratorT::GEN, FileName,
+ wrk.LogFileError(GenT::GEN, FileName,
"Could not read the file: " + error);
}
}
@@ -275,7 +273,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk,
emsg += ", but the header ";
emsg += Quoted(MocStringHeaders(wrk, mocInc.Base));
emsg += " could not be found.";
- wrk.LogFileError(GeneratorT::MOC, FileName, emsg);
+ wrk.LogFileError(GenT::MOC, FileName, emsg);
}
return false;
}
@@ -314,7 +312,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk,
emsg += Quoted("moc_" + mocInc.Base + ".cpp");
emsg += " for a compatibility with strict mode.\n"
"(CMAKE_AUTOMOC_RELAXED_MODE warning)\n";
- wrk.LogFileWarning(GeneratorT::MOC, FileName, emsg);
+ wrk.LogFileWarning(GenT::MOC, FileName, emsg);
} else {
std::string emsg = "The file includes the moc file ";
emsg += Quoted(mocInc.Inc);
@@ -326,7 +324,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk,
emsg += Quoted("moc_" + mocInc.Base + ".cpp");
emsg += " for compatibility with strict mode.\n"
"(CMAKE_AUTOMOC_RELAXED_MODE warning)\n";
- wrk.LogFileWarning(GeneratorT::MOC, FileName, emsg);
+ wrk.LogFileWarning(GenT::MOC, FileName, emsg);
}
}
} else {
@@ -338,7 +336,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk,
"matching header ";
emsg += Quoted(MocStringHeaders(wrk, mocInc.Base));
emsg += " could not be found.";
- wrk.LogFileError(GeneratorT::MOC, FileName, emsg);
+ wrk.LogFileError(GenT::MOC, FileName, emsg);
}
return false;
}
@@ -356,7 +354,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk,
emsg += ", but does not contain a ";
emsg += wrk.Moc().MacrosString();
emsg += " macro.";
- wrk.LogFileWarning(GeneratorT::MOC, FileName, emsg);
+ wrk.LogFileWarning(GenT::MOC, FileName, emsg);
}
} else {
// Don't allow <BASE>.moc include other than self in strict mode
@@ -367,7 +365,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk,
"source file.\nThis is not supported. Include ";
emsg += Quoted(meta.FileBase + ".moc");
emsg += " to run moc on this source file.";
- wrk.LogFileError(GeneratorT::MOC, FileName, emsg);
+ wrk.LogFileError(GenT::MOC, FileName, emsg);
}
return false;
}
@@ -410,7 +408,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk,
emsg += Quoted(meta.FileBase + ".moc");
emsg += " for compatibility with strict mode.\n"
"(CMAKE_AUTOMOC_RELAXED_MODE warning)";
- wrk.LogFileWarning(GeneratorT::MOC, FileName, emsg);
+ wrk.LogFileWarning(GenT::MOC, FileName, emsg);
}
// Add own source job
jobs.emplace_back(
@@ -425,7 +423,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk,
emsg += "!\nConsider to\n - add #include \"";
emsg += meta.FileBase;
emsg += ".moc\"\n - enable SKIP_AUTOMOC for this file";
- wrk.LogFileError(GeneratorT::MOC, FileName, emsg);
+ wrk.LogFileError(GenT::MOC, FileName, emsg);
}
return false;
}
@@ -433,8 +431,8 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk,
// Convert pre jobs to actual jobs
for (JobPre& jobPre : jobs) {
- JobHandleT jobHandle(new JobMocT(std::move(jobPre.SourceFile), FileName,
- std::move(jobPre.IncludeString)));
+ JobHandleT jobHandle = cm::make_unique<JobMocT>(
+ std::move(jobPre.SourceFile), FileName, std::move(jobPre.IncludeString));
if (jobPre.self) {
// Read dependencies from this source
static_cast<JobMocT&>(*jobHandle).FindDependencies(wrk, meta.Content);
@@ -452,8 +450,8 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocHeader(WorkerT& wrk,
bool success = true;
std::string const macroName = wrk.Moc().FindMacro(meta.Content);
if (!macroName.empty()) {
- JobHandleT jobHandle(
- new JobMocT(std::string(FileName), std::string(), std::string()));
+ JobHandleT jobHandle = cm::make_unique<JobMocT>(
+ std::string(FileName), std::string(), std::string());
// Read dependencies from this source
static_cast<JobMocT&>(*jobHandle).FindDependencies(wrk, meta.Content);
success = wrk.Gen().ParallelJobPushMoc(jobHandle);
@@ -519,8 +517,8 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseUicInclude(
std::string uiInputFile = UicFindIncludedFile(wrk, meta, includeString);
if (!uiInputFile.empty()) {
if (!wrk.Uic().skipped(uiInputFile)) {
- JobHandleT jobHandle(new JobUicT(std::move(uiInputFile), FileName,
- std::move(includeString)));
+ JobHandleT jobHandle = cm::make_unique<JobUicT>(
+ std::move(uiInputFile), FileName, std::move(includeString));
success = wrk.Gen().ParallelJobPushUic(jobHandle);
} else {
// A skipped file is successful
@@ -586,7 +584,7 @@ std::string cmQtAutoGeneratorMocUic::JobParseT::UicFindIncludedFile(
emsg += Quoted(testFile);
emsg += "\n";
}
- wrk.LogFileError(GeneratorT::UIC, FileName, emsg);
+ wrk.LogFileError(GenT::UIC, FileName, emsg);
}
return res;
@@ -602,7 +600,7 @@ void cmQtAutoGeneratorMocUic::JobMocPredefsT::Process(WorkerT& wrk)
std::string reason = "Generating ";
reason += Quoted(wrk.Moc().PredefsFileRel);
reason += " because it doesn't exist";
- wrk.LogInfo(GeneratorT::MOC, reason);
+ wrk.LogInfo(GenT::MOC, reason);
}
generate = true;
} else if (wrk.Moc().SettingsChanged) {
@@ -610,7 +608,7 @@ void cmQtAutoGeneratorMocUic::JobMocPredefsT::Process(WorkerT& wrk)
std::string reason = "Generating ";
reason += Quoted(wrk.Moc().PredefsFileRel);
reason += " because the settings changed.";
- wrk.LogInfo(GeneratorT::MOC, reason);
+ wrk.LogInfo(GenT::MOC, reason);
}
generate = true;
}
@@ -627,12 +625,12 @@ void cmQtAutoGeneratorMocUic::JobMocPredefsT::Process(WorkerT& wrk)
cmd.push_back("-D" + def);
}
// Execute command
- if (!wrk.RunProcess(GeneratorT::MOC, result, cmd)) {
+ if (!wrk.RunProcess(GenT::MOC, result, cmd)) {
std::string emsg = "The content generation command for ";
emsg += Quoted(wrk.Moc().PredefsFileRel);
emsg += " failed.\n";
emsg += result.ErrorMessage;
- wrk.LogCommandError(GeneratorT::MOC, emsg, cmd, result.StdOut);
+ wrk.LogCommandError(GenT::MOC, emsg, cmd, result.StdOut);
}
}
@@ -640,14 +638,14 @@ void cmQtAutoGeneratorMocUic::JobMocPredefsT::Process(WorkerT& wrk)
if (!result.error()) {
if (!fileExists ||
wrk.FileSys().FileDiffers(wrk.Moc().PredefsFileAbs, result.StdOut)) {
- if (wrk.FileSys().FileWrite(GeneratorT::MOC, wrk.Moc().PredefsFileAbs,
+ if (wrk.FileSys().FileWrite(GenT::MOC, wrk.Moc().PredefsFileAbs,
result.StdOut)) {
// Success
} else {
std::string emsg = "Writing ";
emsg += Quoted(wrk.Moc().PredefsFileRel);
emsg += " failed.";
- wrk.LogFileError(GeneratorT::MOC, wrk.Moc().PredefsFileAbs, emsg);
+ wrk.LogFileError(GenT::MOC, wrk.Moc().PredefsFileAbs, emsg);
}
} else {
// Touch to update the time stamp
@@ -655,7 +653,7 @@ void cmQtAutoGeneratorMocUic::JobMocPredefsT::Process(WorkerT& wrk)
std::string msg = "Touching ";
msg += Quoted(wrk.Moc().PredefsFileRel);
msg += ".";
- wrk.LogInfo(GeneratorT::MOC, msg);
+ wrk.LogInfo(GenT::MOC, msg);
}
wrk.FileSys().Touch(wrk.Moc().PredefsFileAbs);
}
@@ -713,7 +711,7 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk)
reason += " from its source file ";
reason += Quoted(SourceFile);
reason += " because it doesn't exist";
- wrk.LogInfo(GeneratorT::MOC, reason);
+ wrk.LogInfo(GenT::MOC, reason);
}
return true;
}
@@ -726,7 +724,7 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk)
reason += " from ";
reason += Quoted(SourceFile);
reason += " because the MOC settings changed";
- wrk.LogInfo(GeneratorT::MOC, reason);
+ wrk.LogInfo(GenT::MOC, reason);
}
return true;
}
@@ -739,7 +737,7 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk)
isOlder = wrk.FileSys().FileIsOlderThan(
BuildFile, wrk.Moc().PredefsFileAbs, &error);
if (!isOlder && !error.empty()) {
- wrk.LogError(GeneratorT::MOC, error);
+ wrk.LogError(GenT::MOC, error);
return false;
}
}
@@ -749,7 +747,7 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk)
reason += Quoted(BuildFile);
reason += " because it's older than: ";
reason += Quoted(wrk.Moc().PredefsFileAbs);
- wrk.LogInfo(GeneratorT::MOC, reason);
+ wrk.LogInfo(GenT::MOC, reason);
}
return true;
}
@@ -762,7 +760,7 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk)
std::string error;
isOlder = wrk.FileSys().FileIsOlderThan(BuildFile, SourceFile, &error);
if (!isOlder && !error.empty()) {
- wrk.LogError(GeneratorT::MOC, error);
+ wrk.LogError(GenT::MOC, error);
return false;
}
}
@@ -772,7 +770,7 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk)
reason += Quoted(BuildFile);
reason += " because it's older than its source file ";
reason += Quoted(SourceFile);
- wrk.LogInfo(GeneratorT::MOC, reason);
+ wrk.LogInfo(GenT::MOC, reason);
}
return true;
}
@@ -794,7 +792,7 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk)
emsg += Quoted(IncluderFile);
emsg += ".\n";
emsg += error;
- wrk.LogError(GeneratorT::MOC, emsg);
+ wrk.LogError(GenT::MOC, emsg);
return false;
}
}
@@ -815,18 +813,18 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk)
reason += Quoted(SourceFile);
reason += " because it is older than it's dependency file ";
reason += Quoted(depFileAbs);
- wrk.LogInfo(GeneratorT::MOC, reason);
+ wrk.LogInfo(GenT::MOC, reason);
}
return true;
}
if (!error.empty()) {
- wrk.LogError(GeneratorT::MOC, error);
+ wrk.LogError(GenT::MOC, error);
return false;
}
} else {
std::string message = "Could not find dependency file ";
message += Quoted(depFileRel);
- wrk.LogFileWarning(GeneratorT::MOC, SourceFile, message);
+ wrk.LogFileWarning(GenT::MOC, SourceFile, message);
}
}
}
@@ -837,7 +835,7 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk)
void cmQtAutoGeneratorMocUic::JobMocT::GenerateMoc(WorkerT& wrk)
{
// Make sure the parent directory exists
- if (wrk.FileSys().MakeParentDirectory(GeneratorT::MOC, BuildFile)) {
+ if (wrk.FileSys().MakeParentDirectory(GenT::MOC, BuildFile)) {
// Compose moc command
std::vector<std::string> cmd;
cmd.push_back(wrk.Moc().Executable);
@@ -855,11 +853,11 @@ void cmQtAutoGeneratorMocUic::JobMocT::GenerateMoc(WorkerT& wrk)
// Execute moc command
ProcessResultT result;
- if (wrk.RunProcess(GeneratorT::MOC, result, cmd)) {
+ if (wrk.RunProcess(GenT::MOC, result, cmd)) {
// Moc command success
// Print moc output
if (!result.StdOut.empty()) {
- wrk.LogInfo(GeneratorT::MOC, result.StdOut);
+ wrk.LogInfo(GenT::MOC, result.StdOut);
}
// Notify the generator that a not included file changed (on demand)
if (IncludeString.empty()) {
@@ -874,7 +872,7 @@ void cmQtAutoGeneratorMocUic::JobMocT::GenerateMoc(WorkerT& wrk)
emsg += Quoted(BuildFile);
emsg += ".\n";
emsg += result.ErrorMessage;
- wrk.LogCommandError(GeneratorT::MOC, emsg, cmd, result.StdOut);
+ wrk.LogCommandError(GenT::MOC, emsg, cmd, result.StdOut);
}
wrk.FileSys().FileRemove(BuildFile);
}
@@ -905,7 +903,7 @@ bool cmQtAutoGeneratorMocUic::JobUicT::UpdateRequired(WorkerT& wrk)
reason += " from its source file ";
reason += Quoted(SourceFile);
reason += " because it doesn't exist";
- wrk.LogInfo(GeneratorT::UIC, reason);
+ wrk.LogInfo(GenT::UIC, reason);
}
return true;
}
@@ -918,7 +916,7 @@ bool cmQtAutoGeneratorMocUic::JobUicT::UpdateRequired(WorkerT& wrk)
reason += " from ";
reason += Quoted(SourceFile);
reason += " because the UIC settings changed";
- wrk.LogInfo(GeneratorT::UIC, reason);
+ wrk.LogInfo(GenT::UIC, reason);
}
return true;
}
@@ -930,7 +928,7 @@ bool cmQtAutoGeneratorMocUic::JobUicT::UpdateRequired(WorkerT& wrk)
std::string error;
isOlder = wrk.FileSys().FileIsOlderThan(BuildFile, SourceFile, &error);
if (!isOlder && !error.empty()) {
- wrk.LogError(GeneratorT::UIC, error);
+ wrk.LogError(GenT::UIC, error);
return false;
}
}
@@ -940,7 +938,7 @@ bool cmQtAutoGeneratorMocUic::JobUicT::UpdateRequired(WorkerT& wrk)
reason += Quoted(BuildFile);
reason += " because it's older than its source file ";
reason += Quoted(SourceFile);
- wrk.LogInfo(GeneratorT::UIC, reason);
+ wrk.LogInfo(GenT::UIC, reason);
}
return true;
}
@@ -952,7 +950,7 @@ bool cmQtAutoGeneratorMocUic::JobUicT::UpdateRequired(WorkerT& wrk)
void cmQtAutoGeneratorMocUic::JobUicT::GenerateUic(WorkerT& wrk)
{
// Make sure the parent directory exists
- if (wrk.FileSys().MakeParentDirectory(GeneratorT::UIC, BuildFile)) {
+ if (wrk.FileSys().MakeParentDirectory(GenT::UIC, BuildFile)) {
// Compose uic command
std::vector<std::string> cmd;
cmd.push_back(wrk.Uic().Executable);
@@ -970,11 +968,11 @@ void cmQtAutoGeneratorMocUic::JobUicT::GenerateUic(WorkerT& wrk)
cmd.push_back(SourceFile);
ProcessResultT result;
- if (wrk.RunProcess(GeneratorT::UIC, result, cmd)) {
+ if (wrk.RunProcess(GenT::UIC, result, cmd)) {
// Uic command success
// Print uic output
if (!result.StdOut.empty()) {
- wrk.LogInfo(GeneratorT::UIC, result.StdOut);
+ wrk.LogInfo(GenT::UIC, result.StdOut);
}
} else {
// Uic command failed
@@ -987,18 +985,13 @@ void cmQtAutoGeneratorMocUic::JobUicT::GenerateUic(WorkerT& wrk)
emsg += Quoted(IncluderFile);
emsg += ".\n";
emsg += result.ErrorMessage;
- wrk.LogCommandError(GeneratorT::UIC, emsg, cmd, result.StdOut);
+ wrk.LogCommandError(GenT::UIC, emsg, cmd, result.StdOut);
}
wrk.FileSys().FileRemove(BuildFile);
}
}
}
-void cmQtAutoGeneratorMocUic::JobDeleterT::operator()(JobT* job)
-{
- delete job;
-}
-
cmQtAutoGeneratorMocUic::WorkerT::WorkerT(cmQtAutoGeneratorMocUic* gen,
uv_loop_t* uvLoop)
: Gen_(gen)
@@ -1018,41 +1011,39 @@ cmQtAutoGeneratorMocUic::WorkerT::~WorkerT()
}
void cmQtAutoGeneratorMocUic::WorkerT::LogInfo(
- GeneratorT genType, std::string const& message) const
+ GenT genType, std::string const& message) const
{
Log().Info(genType, message);
}
void cmQtAutoGeneratorMocUic::WorkerT::LogWarning(
- GeneratorT genType, std::string const& message) const
+ GenT genType, std::string const& message) const
{
Log().Warning(genType, message);
}
void cmQtAutoGeneratorMocUic::WorkerT::LogFileWarning(
- GeneratorT genType, std::string const& filename,
- std::string const& message) const
+ GenT genType, std::string const& filename, std::string const& message) const
{
Log().WarningFile(genType, filename, message);
}
void cmQtAutoGeneratorMocUic::WorkerT::LogError(
- GeneratorT genType, std::string const& message) const
+ GenT genType, std::string const& message) const
{
Gen().ParallelRegisterJobError();
Log().Error(genType, message);
}
void cmQtAutoGeneratorMocUic::WorkerT::LogFileError(
- GeneratorT genType, std::string const& filename,
- std::string const& message) const
+ GenT genType, std::string const& filename, std::string const& message) const
{
Gen().ParallelRegisterJobError();
Log().ErrorFile(genType, filename, message);
}
void cmQtAutoGeneratorMocUic::WorkerT::LogCommandError(
- GeneratorT genType, std::string const& message,
+ GenT genType, std::string const& message,
std::vector<std::string> const& command, std::string const& output) const
{
Gen().ParallelRegisterJobError();
@@ -1060,7 +1051,7 @@ void cmQtAutoGeneratorMocUic::WorkerT::LogCommandError(
}
bool cmQtAutoGeneratorMocUic::WorkerT::RunProcess(
- GeneratorT genType, ProcessResultT& result,
+ GenT genType, ProcessResultT& result,
std::vector<std::string> const& command)
{
if (command.empty()) {
@@ -1213,7 +1204,7 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile)
// -- Read info file
if (!makefile->ReadListFile(InfoFile())) {
- Log().ErrorFile(GeneratorT::GEN, InfoFile(), "File processing failed");
+ Log().ErrorFile(GenT::GEN, InfoFile(), "File processing failed");
return false;
}
@@ -1238,14 +1229,13 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile)
InfoGetBool("AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE");
Base_.AutogenBuildDir = InfoGet("AM_BUILD_DIR");
if (Base_.AutogenBuildDir.empty()) {
- Log().ErrorFile(GeneratorT::GEN, InfoFile(),
- "Autogen build directory missing");
+ Log().ErrorFile(GenT::GEN, InfoFile(), "Autogen build directory missing");
return false;
}
// include directory
Base_.AutogenIncludeDir = InfoGetConfig("AM_INCLUDE_DIR");
if (Base_.AutogenIncludeDir.empty()) {
- Log().ErrorFile(GeneratorT::GEN, InfoFile(),
+ Log().ErrorFile(GenT::GEN, InfoFile(),
"Autogen include directory missing");
return false;
}
@@ -1253,7 +1243,7 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile)
// - Files
SettingsFile_ = InfoGetConfig("AM_SETTINGS_FILE");
if (SettingsFile_.empty()) {
- Log().ErrorFile(GeneratorT::GEN, InfoFile(), "Settings file name missing");
+ Log().ErrorFile(GenT::GEN, InfoFile(), "Settings file name missing");
return false;
}
@@ -1270,9 +1260,8 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile)
Moc_.Executable = InfoGet("AM_QT_MOC_EXECUTABLE");
Moc_.Enabled = !Moc().Executable.empty();
if (Moc().Enabled) {
- {
- auto lst = InfoGetList("AM_MOC_SKIP");
- Moc_.SkipList.insert(lst.begin(), lst.end());
+ for (std::string& sfl : InfoGetList("AM_MOC_SKIP")) {
+ Moc_.SkipList.insert(std::move(sfl));
}
Moc_.Definitions = InfoGetConfigList("AM_MOC_DEFINITIONS");
Moc_.IncludePaths = InfoGetConfigList("AM_MOC_INCLUDES");
@@ -1334,20 +1323,20 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile)
}
} else {
Log().ErrorFile(
- GeneratorT::MOC, InfoFile(),
+ GenT::MOC, InfoFile(),
"AUTOMOC_DEPEND_FILTERS list size is not a multiple of 2");
return false;
}
}
if (!error.empty()) {
- Log().ErrorFile(GeneratorT::MOC, InfoFile(), error);
+ Log().ErrorFile(GenT::MOC, InfoFile(), error);
return false;
}
}
Moc_.PredefsCmd = InfoGetList("AM_MOC_PREDEFS_CMD");
// Install moc predefs job
if (!Moc().PredefsCmd.empty()) {
- JobQueues_.MocPredefs.emplace_back(new JobMocPredefsT());
+ JobQueues_.MocPredefs.emplace_back(cm::make_unique<JobMocPredefsT>());
}
}
@@ -1355,9 +1344,8 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile)
Uic_.Executable = InfoGet("AM_QT_UIC_EXECUTABLE");
Uic_.Enabled = !Uic().Executable.empty();
if (Uic().Enabled) {
- {
- auto lst = InfoGetList("AM_UIC_SKIP");
- Uic_.SkipList.insert(lst.begin(), lst.end());
+ for (std::string& sfl : InfoGetList("AM_UIC_SKIP")) {
+ Uic_.SkipList.insert(std::move(sfl));
}
Uic_.SearchPaths = InfoGetList("AM_UIC_SEARCH_PATHS");
Uic_.TargetOptions = InfoGetConfigList("AM_UIC_TARGET_OPTIONS");
@@ -1369,7 +1357,7 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile)
std::ostringstream ost;
ost << "files/options lists sizes mismatch (" << sources.size() << "/"
<< options.size() << ")";
- Log().ErrorFile(GeneratorT::UIC, InfoFile(), ost.str());
+ Log().ErrorFile(GenT::UIC, InfoFile(), ost.str());
return false;
}
auto fitEnd = sources.cend();
@@ -1383,53 +1371,44 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile)
}
}
- // Initialize source file jobs
+ // - Headers and sources
{
- std::hash<std::string> stringHash;
- std::set<std::size_t> uniqueHeaders;
-
- // Add header jobs
+ auto addHeader = [this](std::string&& hdr, bool moc, bool uic) {
+ this->JobQueues_.Headers.emplace_back(
+ cm::make_unique<JobParseT>(std::move(hdr), moc, uic, true));
+ };
+ auto addSource = [this](std::string&& src, bool moc, bool uic) {
+ this->JobQueues_.Sources.emplace_back(
+ cm::make_unique<JobParseT>(std::move(src), moc, uic, false));
+ };
+
+ // Add headers
for (std::string& hdr : InfoGetList("AM_HEADERS")) {
- const bool moc = !Moc().skipped(hdr);
- const bool uic = !Uic().skipped(hdr);
- if ((moc || uic) && uniqueHeaders.emplace(stringHash(hdr)).second) {
- JobQueues_.Headers.emplace_back(
- new JobParseT(std::move(hdr), moc, uic, true));
+ addHeader(std::move(hdr), true, true);
+ }
+ if (Moc().Enabled) {
+ for (std::string& hdr : InfoGetList("AM_MOC_HEADERS")) {
+ addHeader(std::move(hdr), true, false);
}
}
- // Add source jobs
- {
- std::vector<std::string> sources = InfoGetList("AM_SOURCES");
- // Add header(s) for the source file
- for (std::string& src : sources) {
- const bool srcMoc = !Moc().skipped(src);
- const bool srcUic = !Uic().skipped(src);
- if (!srcMoc && !srcUic) {
- continue;
- }
- // Search for the default header file and a private header
- {
- std::array<std::string, 2> bases;
- bases[0] = FileSys().SubDirPrefix(src);
- bases[0] += FileSys().GetFilenameWithoutLastExtension(src);
- bases[1] = bases[0];
- bases[1] += "_p";
- for (std::string const& headerBase : bases) {
- std::string header;
- if (Base().FindHeader(header, headerBase)) {
- const bool moc = srcMoc && !Moc().skipped(header);
- const bool uic = srcUic && !Uic().skipped(header);
- if ((moc || uic) &&
- uniqueHeaders.emplace(stringHash(header)).second) {
- JobQueues_.Headers.emplace_back(
- new JobParseT(std::move(header), moc, uic, true));
- }
- }
- }
- }
- // Add source job
- JobQueues_.Sources.emplace_back(
- new JobParseT(std::move(src), srcMoc, srcUic));
+ if (Uic().Enabled) {
+ for (std::string& hdr : InfoGetList("AM_UIC_HEADERS")) {
+ addHeader(std::move(hdr), false, true);
+ }
+ }
+
+ // Add sources
+ for (std::string& src : InfoGetList("AM_SOURCES")) {
+ addSource(std::move(src), true, true);
+ }
+ if (Moc().Enabled) {
+ for (std::string& src : InfoGetList("AM_MOC_SOURCES")) {
+ addSource(std::move(src), true, false);
+ }
+ }
+ if (Uic().Enabled) {
+ for (std::string& src : InfoGetList("AM_UIC_SOURCES")) {
+ addSource(std::move(src), false, true);
}
}
}
@@ -1690,8 +1669,7 @@ void cmQtAutoGeneratorMocUic::SettingsFileWrite()
// Only write if any setting changed
if (!JobError_ && (Moc().SettingsChanged || Uic().SettingsChanged)) {
if (Log().Verbose()) {
- Log().Info(GeneratorT::GEN,
- "Writing settings file " + Quoted(SettingsFile_));
+ Log().Info(GenT::GEN, "Writing settings file " + Quoted(SettingsFile_));
}
// Compose settings file content
std::string content;
@@ -1709,8 +1687,8 @@ void cmQtAutoGeneratorMocUic::SettingsFileWrite()
SettingAppend("uic", SettingsStringUic_);
}
// Write settings file
- if (!FileSys().FileWrite(GeneratorT::GEN, SettingsFile_, content)) {
- Log().ErrorFile(GeneratorT::GEN, SettingsFile_,
+ if (!FileSys().FileWrite(GenT::GEN, SettingsFile_, content)) {
+ Log().ErrorFile(GenT::GEN, SettingsFile_,
"Settings file writing failed");
// Remove old settings file to trigger a full rebuild on the next run
FileSys().FileRemove(SettingsFile_);
@@ -1722,7 +1700,7 @@ void cmQtAutoGeneratorMocUic::SettingsFileWrite()
void cmQtAutoGeneratorMocUic::CreateDirectories()
{
// Create AUTOGEN include directory
- if (!FileSys().MakeDirectory(GeneratorT::GEN, Base().AutogenIncludeDir)) {
+ if (!FileSys().MakeDirectory(GenT::GEN, Base().AutogenIncludeDir)) {
RegisterJobError();
}
}
@@ -1802,7 +1780,7 @@ void cmQtAutoGeneratorMocUic::WorkerSwapJob(JobHandleT& jobHandle)
{
bool const jobProcessed(jobHandle);
if (jobProcessed) {
- jobHandle.reset(nullptr);
+ jobHandle.reset();
}
{
std::unique_lock<std::mutex> jobsLock(JobsMutex_);
@@ -1882,7 +1860,7 @@ bool cmQtAutoGeneratorMocUic::ParallelJobPushMoc(JobHandleT& jobHandle)
"- add a directory prefix to a \"<NAME>.moc\" include "
"(e.g \"sub/<NAME>.moc\")\n"
"- rename the source file(s)\n";
- Log().Error(GeneratorT::MOC, error);
+ Log().Error(GenT::MOC, error);
RegisterJobError();
}
// Do not push this job in since the included moc file already
@@ -1932,7 +1910,7 @@ bool cmQtAutoGeneratorMocUic::ParallelJobPushUic(JobHandleT& jobHandle)
"(e.g \"sub/ui_<NAME>.h\")\n"
"- rename the <NAME>.ui file(s) and adjust the \"ui_<NAME>.h\" "
"include(s)\n";
- Log().Error(GeneratorT::UIC, error);
+ Log().Error(GenT::UIC, error);
RegisterJobError();
}
// Do not push this job in since the uic file already
@@ -2019,10 +1997,10 @@ void cmQtAutoGeneratorMocUic::MocGenerateCompilation()
if (FileSys().FileDiffers(compAbs, content)) {
// Actually write mocs compilation file
if (Log().Verbose()) {
- Log().Info(GeneratorT::MOC, "Generating MOC compilation " + compAbs);
+ Log().Info(GenT::MOC, "Generating MOC compilation " + compAbs);
}
- if (!FileSys().FileWrite(GeneratorT::MOC, compAbs, content)) {
- Log().ErrorFile(GeneratorT::MOC, compAbs,
+ if (!FileSys().FileWrite(GenT::MOC, compAbs, content)) {
+ Log().ErrorFile(GenT::MOC, compAbs,
"mocs compilation file writing failed");
RegisterJobError();
return;
@@ -2030,7 +2008,7 @@ void cmQtAutoGeneratorMocUic::MocGenerateCompilation()
} else if (MocAutoFileUpdated_) {
// Only touch mocs compilation file
if (Log().Verbose()) {
- Log().Info(GeneratorT::MOC, "Touching mocs compilation " + compAbs);
+ Log().Info(GenT::MOC, "Touching mocs compilation " + compAbs);
}
FileSys().Touch(compAbs);
}
diff --git a/Source/cmQtAutoGeneratorMocUic.h b/Source/cmQtAutoGeneratorMocUic.h
index c22df29..e48d7f3 100644
--- a/Source/cmQtAutoGeneratorMocUic.h
+++ b/Source/cmQtAutoGeneratorMocUic.h
@@ -20,6 +20,7 @@
#include <set>
#include <string>
#include <thread>
+#include <unordered_set>
#include <utility>
#include <vector>
@@ -133,7 +134,7 @@ public:
std::string CompFileAbs;
std::string PredefsFileRel;
std::string PredefsFileAbs;
- std::set<std::string> SkipList;
+ std::unordered_set<std::string> SkipList;
std::vector<std::string> IncludePaths;
std::vector<std::string> Includes;
std::vector<std::string> Definitions;
@@ -164,7 +165,7 @@ public:
bool Enabled = false;
bool SettingsChanged = false;
std::string Executable;
- std::set<std::string> SkipList;
+ std::unordered_set<std::string> SkipList;
std::vector<std::string> TargetOptions;
std::map<std::string, std::vector<std::string>> Options;
std::vector<std::string> SearchPaths;
@@ -186,15 +187,8 @@ public:
virtual void Process(WorkerT& wrk) = 0;
};
- /// @brief Deleter for classes derived from Job
- ///
- struct JobDeleterT
- {
- void operator()(JobT* job);
- };
-
// Job management types
- typedef std::unique_ptr<JobT, JobDeleterT> JobHandleT;
+ typedef std::unique_ptr<JobT> JobHandleT;
typedef std::deque<JobHandleT> JobQueueT;
/// @brief Parse source job
@@ -321,22 +315,22 @@ public:
const UicSettingsT& Uic() const { return Gen_->Uic(); }
// -- Log info
- void LogInfo(GeneratorT genType, std::string const& message) const;
+ void LogInfo(GenT genType, std::string const& message) const;
// -- Log warning
- void LogWarning(GeneratorT genType, std::string const& message) const;
- void LogFileWarning(GeneratorT genType, std::string const& filename,
+ void LogWarning(GenT genType, std::string const& message) const;
+ void LogFileWarning(GenT genType, std::string const& filename,
std::string const& message) const;
// -- Log error
- void LogError(GeneratorT genType, std::string const& message) const;
- void LogFileError(GeneratorT genType, std::string const& filename,
+ void LogError(GenT genType, std::string const& message) const;
+ void LogFileError(GenT genType, std::string const& filename,
std::string const& message) const;
- void LogCommandError(GeneratorT genType, std::string const& message,
+ void LogCommandError(GenT genType, std::string const& message,
std::vector<std::string> const& command,
std::string const& output) const;
// -- External processes
/// @brief Verbose logging version
- bool RunProcess(GeneratorT genType, ProcessResultT& result,
+ bool RunProcess(GenT genType, ProcessResultT& result,
std::vector<std::string> const& command);
private:
diff --git a/Source/cmQtAutoGeneratorRcc.cxx b/Source/cmQtAutoGeneratorRcc.cxx
index 021a15f..5deb532 100644
--- a/Source/cmQtAutoGeneratorRcc.cxx
+++ b/Source/cmQtAutoGeneratorRcc.cxx
@@ -55,7 +55,7 @@ bool cmQtAutoGeneratorRcc::Init(cmMakefile* makefile)
// -- Read info file
if (!makefile->ReadListFile(InfoFile())) {
- Log().ErrorFile(GeneratorT::RCC, InfoFile(), "File processing failed");
+ Log().ErrorFile(GenT::RCC, InfoFile(), "File processing failed");
return false;
}
@@ -66,13 +66,13 @@ bool cmQtAutoGeneratorRcc::Init(cmMakefile* makefile)
// - Directories
AutogenBuildDir_ = InfoGet("ARCC_BUILD_DIR");
if (AutogenBuildDir_.empty()) {
- Log().ErrorFile(GeneratorT::RCC, InfoFile(), "Build directory empty");
+ Log().ErrorFile(GenT::RCC, InfoFile(), "Build directory empty");
return false;
}
IncludeDir_ = InfoGetConfig("ARCC_INCLUDE_DIR");
if (IncludeDir_.empty()) {
- Log().ErrorFile(GeneratorT::RCC, InfoFile(), "Include directory empty");
+ Log().ErrorFile(GenT::RCC, InfoFile(), "Include directory empty");
return false;
}
@@ -95,28 +95,27 @@ bool cmQtAutoGeneratorRcc::Init(cmMakefile* makefile)
// - Validity checks
if (LockFile_.empty()) {
- Log().ErrorFile(GeneratorT::RCC, InfoFile(), "Lock file name missing");
+ Log().ErrorFile(GenT::RCC, InfoFile(), "Lock file name missing");
return false;
}
if (SettingsFile_.empty()) {
- Log().ErrorFile(GeneratorT::RCC, InfoFile(), "Settings file name missing");
+ Log().ErrorFile(GenT::RCC, InfoFile(), "Settings file name missing");
return false;
}
if (AutogenBuildDir_.empty()) {
- Log().ErrorFile(GeneratorT::RCC, InfoFile(),
- "Autogen build directory missing");
+ Log().ErrorFile(GenT::RCC, InfoFile(), "Autogen build directory missing");
return false;
}
if (RccExecutable_.empty()) {
- Log().ErrorFile(GeneratorT::RCC, InfoFile(), "rcc executable missing");
+ Log().ErrorFile(GenT::RCC, InfoFile(), "rcc executable missing");
return false;
}
if (QrcFile_.empty()) {
- Log().ErrorFile(GeneratorT::RCC, InfoFile(), "rcc input file missing");
+ Log().ErrorFile(GenT::RCC, InfoFile(), "rcc input file missing");
return false;
}
if (RccFileName_.empty()) {
- Log().ErrorFile(GeneratorT::RCC, InfoFile(), "rcc output file missing");
+ Log().ErrorFile(GenT::RCC, InfoFile(), "rcc output file missing");
return false;
}
@@ -287,8 +286,7 @@ bool cmQtAutoGeneratorRcc::SettingsFileRead()
// Make sure the lock file exists
if (!FileSys().FileExists(LockFile_, true)) {
if (!FileSys().Touch(LockFile_, true)) {
- Log().ErrorFile(GeneratorT::RCC, LockFile_,
- "Lock file creation failed");
+ Log().ErrorFile(GenT::RCC, LockFile_, "Lock file creation failed");
Error_ = true;
return false;
}
@@ -297,7 +295,7 @@ bool cmQtAutoGeneratorRcc::SettingsFileRead()
cmFileLockResult lockResult =
LockFileLock_.Lock(LockFile_, static_cast<unsigned long>(-1));
if (!lockResult.IsOk()) {
- Log().ErrorFile(GeneratorT::RCC, LockFile_,
+ Log().ErrorFile(GenT::RCC, LockFile_,
"File lock failed: " + lockResult.GetOutputMessage());
Error_ = true;
return false;
@@ -313,7 +311,7 @@ bool cmQtAutoGeneratorRcc::SettingsFileRead()
// 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(GeneratorT::RCC, SettingsFile_, "");
+ FileSys().FileWrite(GenT::RCC, SettingsFile_, "");
}
} else {
SettingsChanged_ = true;
@@ -328,15 +326,14 @@ void cmQtAutoGeneratorRcc::SettingsFileWrite()
// Only write if any setting changed
if (SettingsChanged_) {
if (Log().Verbose()) {
- Log().Info(GeneratorT::RCC,
- "Writing settings file " + Quoted(SettingsFile_));
+ Log().Info(GenT::RCC, "Writing settings file " + Quoted(SettingsFile_));
}
// Write settings file
std::string content = "rcc:";
content += SettingsString_;
content += '\n';
- if (!FileSys().FileWrite(GeneratorT::RCC, SettingsFile_, content)) {
- Log().ErrorFile(GeneratorT::RCC, SettingsFile_,
+ 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_);
@@ -360,7 +357,7 @@ bool cmQtAutoGeneratorRcc::TestQrcRccFiles()
reason += " from its source file ";
reason += Quoted(QrcFile_);
reason += " because it doesn't exist";
- Log().Info(GeneratorT::RCC, reason);
+ Log().Info(GenT::RCC, reason);
}
Generate_ = true;
return Generate_;
@@ -374,7 +371,7 @@ bool cmQtAutoGeneratorRcc::TestQrcRccFiles()
reason += " from ";
reason += Quoted(QrcFile_);
reason += " because the RCC settings changed";
- Log().Info(GeneratorT::RCC, reason);
+ Log().Info(GenT::RCC, reason);
}
Generate_ = true;
return Generate_;
@@ -387,7 +384,7 @@ bool cmQtAutoGeneratorRcc::TestQrcRccFiles()
std::string error;
isOlder = FileSys().FileIsOlderThan(RccFileOutput_, QrcFile_, &error);
if (!error.empty()) {
- Log().ErrorFile(GeneratorT::RCC, QrcFile_, error);
+ Log().ErrorFile(GenT::RCC, QrcFile_, error);
Error_ = true;
}
}
@@ -397,7 +394,7 @@ bool cmQtAutoGeneratorRcc::TestQrcRccFiles()
reason += Quoted(RccFileOutput_);
reason += " because it is older than ";
reason += Quoted(QrcFile_);
- Log().Info(GeneratorT::RCC, reason);
+ Log().Info(GenT::RCC, reason);
}
Generate_ = true;
}
@@ -424,12 +421,11 @@ bool cmQtAutoGeneratorRcc::TestResourcesRead()
std::string parseError;
if (!RccListParseOutput(ProcessResult_.StdOut, ProcessResult_.StdErr,
Inputs_, parseError)) {
- Log().ErrorFile(GeneratorT::RCC, QrcFile_, parseError);
+ Log().ErrorFile(GenT::RCC, QrcFile_, parseError);
Error_ = true;
}
} else {
- Log().ErrorFile(GeneratorT::RCC, QrcFile_,
- ProcessResult_.ErrorMessage);
+ Log().ErrorFile(GenT::RCC, QrcFile_, ProcessResult_.ErrorMessage);
Error_ = true;
}
// Clean up
@@ -457,7 +453,7 @@ bool cmQtAutoGeneratorRcc::TestResourcesRead()
// rcc does not support the --list command.
// Read the qrc file content and parse it.
std::string qrcContent;
- if (FileSys().FileRead(GeneratorT::RCC, qrcContent, QrcFile_)) {
+ if (FileSys().FileRead(GenT::RCC, qrcContent, QrcFile_)) {
RccListParseContent(qrcContent, Inputs_);
}
}
@@ -483,7 +479,7 @@ bool cmQtAutoGeneratorRcc::TestResources()
error = "Could not find the resource file\n ";
error += Quoted(resFile);
error += '\n';
- Log().ErrorFile(GeneratorT::RCC, QrcFile_, error);
+ Log().ErrorFile(GenT::RCC, QrcFile_, error);
Error_ = true;
break;
}
@@ -496,14 +492,14 @@ bool cmQtAutoGeneratorRcc::TestResources()
reason += Quoted(QrcFile_);
reason += " because it is older than ";
reason += Quoted(resFile);
- Log().Info(GeneratorT::RCC, reason);
+ Log().Info(GenT::RCC, reason);
}
Generate_ = true;
break;
}
// Print error and break on demand
if (!error.empty()) {
- Log().ErrorFile(GeneratorT::RCC, QrcFile_, error);
+ Log().ErrorFile(GenT::RCC, QrcFile_, error);
Error_ = true;
break;
}
@@ -522,7 +518,7 @@ void cmQtAutoGeneratorRcc::TestInfoFile()
std::string error;
isOlder = FileSys().FileIsOlderThan(RccFileOutput_, InfoFile(), &error);
if (!error.empty()) {
- Log().ErrorFile(GeneratorT::RCC, QrcFile_, error);
+ Log().ErrorFile(GenT::RCC, QrcFile_, error);
Error_ = true;
}
}
@@ -532,7 +528,7 @@ void cmQtAutoGeneratorRcc::TestInfoFile()
reason += Quoted(RccFileOutput_);
reason += " because it is older than ";
reason += Quoted(InfoFile());
- Log().Info(GeneratorT::RCC, reason);
+ Log().Info(GenT::RCC, reason);
}
// Touch build file
FileSys().Touch(RccFileOutput_);
@@ -544,7 +540,7 @@ void cmQtAutoGeneratorRcc::TestInfoFile()
void cmQtAutoGeneratorRcc::GenerateParentDir()
{
// Make sure the parent directory exists
- if (!FileSys().MakeParentDirectory(GeneratorT::RCC, RccFileOutput_)) {
+ if (!FileSys().MakeParentDirectory(GenT::RCC, RccFileOutput_)) {
Error_ = true;
}
}
@@ -567,7 +563,7 @@ bool cmQtAutoGeneratorRcc::GenerateRcc()
// Rcc process success
// Print rcc output
if (!ProcessResult_.StdOut.empty()) {
- Log().Info(GeneratorT::RCC, ProcessResult_.StdOut);
+ Log().Info(GenT::RCC, ProcessResult_.StdOut);
}
BuildFileChanged_ = true;
} else {
@@ -581,7 +577,7 @@ bool cmQtAutoGeneratorRcc::GenerateRcc()
emsg += "\n";
emsg += ProcessResult_.ErrorMessage;
}
- Log().ErrorCommand(GeneratorT::RCC, emsg, Process_->Setup().Command,
+ Log().ErrorCommand(GenT::RCC, emsg, Process_->Setup().Command,
ProcessResult_.StdOut);
}
FileSys().FileRemove(RccFileOutput_);
@@ -625,19 +621,17 @@ void cmQtAutoGeneratorRcc::GenerateWrapper()
if (FileSys().FileDiffers(RccFilePublic_, content)) {
// Write new wrapper file
if (Log().Verbose()) {
- Log().Info(GeneratorT::RCC,
- "Generating RCC wrapper file " + RccFilePublic_);
+ Log().Info(GenT::RCC, "Generating RCC wrapper file " + RccFilePublic_);
}
- if (!FileSys().FileWrite(GeneratorT::RCC, RccFilePublic_, content)) {
- Log().ErrorFile(GeneratorT::RCC, 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(GeneratorT::RCC,
- "Touching RCC wrapper file " + RccFilePublic_);
+ Log().Info(GenT::RCC, "Touching RCC wrapper file " + RccFilePublic_);
}
FileSys().Touch(RccFilePublic_);
}
@@ -653,7 +647,7 @@ bool cmQtAutoGeneratorRcc::StartProcess(
std::string msg = "Running command:\n";
msg += QuotedCommand(command);
msg += '\n';
- Log().Info(GeneratorT::RCC, msg);
+ Log().Info(GenT::RCC, msg);
}
// Create process handler
@@ -661,7 +655,7 @@ bool cmQtAutoGeneratorRcc::StartProcess(
Process_->setup(&ProcessResult_, mergedOutput, command, workingDirectory);
// Start process
if (!Process_->start(UVLoop(), [this] { UVRequest().send(); })) {
- Log().ErrorFile(GeneratorT::RCC, QrcFile_, ProcessResult_.ErrorMessage);
+ Log().ErrorFile(GenT::RCC, QrcFile_, ProcessResult_.ErrorMessage);
Error_ = true;
// Clean up
Process_.reset();
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx
index 55204d7..5917e27 100644
--- a/Source/cmRST.cxx
+++ b/Source/cmRST.cxx
@@ -3,6 +3,7 @@
#include "cmRST.h"
#include "cmAlgorithms.h"
+#include "cmRange.h"
#include "cmSystemTools.h"
#include "cmVersion.h"
diff --git a/Source/cmRange.h b/Source/cmRange.h
new file mode 100644
index 0000000..3be5193
--- /dev/null
+++ b/Source/cmRange.h
@@ -0,0 +1,239 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#ifndef cmRange_h
+#define cmRange_h
+
+#include "cmConfigure.h" // IWYU pragma: keep
+
+#include <algorithm>
+#include <functional>
+#include <iterator>
+
+namespace RangeIterators {
+
+template <typename Iter, typename UnaryPredicate>
+class FilterIterator
+{
+public:
+ using iterator_category = std::bidirectional_iterator_tag;
+ using value_type = typename std::iterator_traits<Iter>::value_type;
+ using difference_type = typename std::iterator_traits<Iter>::difference_type;
+ using pointer = typename std::iterator_traits<Iter>::pointer;
+ using reference = typename std::iterator_traits<Iter>::reference;
+
+ FilterIterator(Iter b, Iter e, UnaryPredicate p)
+ : Cur(std::move(b))
+ , End(std::move(e))
+ , Pred(std::move(p))
+ {
+ this->SatisfyPredicate();
+ }
+
+ FilterIterator& operator++()
+ {
+ ++this->Cur;
+ this->SatisfyPredicate();
+ return *this;
+ }
+
+ FilterIterator& operator--()
+ {
+ do {
+ --this->Cur;
+ } while (!this->Pred(*this->Cur));
+ return *this;
+ }
+
+ bool operator==(FilterIterator const& other) const
+ {
+ return this->Cur == other.Cur;
+ }
+
+ bool operator!=(FilterIterator const& other) const
+ {
+ return !this->operator==(other);
+ }
+
+ auto operator*() const -> decltype(*std::declval<Iter>())
+ {
+ return *this->Cur;
+ }
+
+private:
+ void SatisfyPredicate()
+ {
+ while (this->Cur != this->End && !this->Pred(*this->Cur)) {
+ ++this->Cur;
+ }
+ }
+
+ Iter Cur;
+ Iter End;
+ UnaryPredicate Pred;
+};
+
+template <typename Iter, typename UnaryFunction>
+class TransformIterator
+{
+public:
+ using iterator_category = std::bidirectional_iterator_tag;
+ using value_type =
+ typename std::remove_cv<typename std::remove_reference<decltype(
+ std::declval<UnaryFunction>()(*std::declval<Iter>()))>::type>::type;
+ using difference_type = typename std::iterator_traits<Iter>::difference_type;
+ using pointer = value_type const*;
+ using reference = value_type const&;
+
+ TransformIterator(Iter i, UnaryFunction f)
+ : Base(std::move(i))
+ , Func(std::move(f))
+ {
+ }
+
+ TransformIterator& operator++()
+ {
+ ++this->Base;
+ return *this;
+ }
+
+ TransformIterator& operator--()
+ {
+ --this->Base;
+ return *this;
+ }
+
+ bool operator==(TransformIterator const& other) const
+ {
+ return this->Base == other.Base;
+ }
+
+ bool operator!=(TransformIterator const& other) const
+ {
+ return !this->operator==(other);
+ }
+
+ auto operator*() const
+ -> decltype(std::declval<UnaryFunction>()(*std::declval<Iter>()))
+ {
+ return this->Func(*this->Base);
+ }
+
+private:
+ Iter Base;
+ UnaryFunction Func;
+};
+
+} // namespace RangeIterators
+
+template <typename Iter>
+class cmRange
+{
+public:
+ using const_iterator = Iter;
+ using value_type = typename std::iterator_traits<Iter>::value_type;
+ using difference_type = typename std::iterator_traits<Iter>::difference_type;
+
+ cmRange(Iter b, Iter e)
+ : Begin(std::move(b))
+ , End(std::move(e))
+ {
+ }
+
+ Iter begin() const { return this->Begin; }
+ Iter end() const { return this->End; }
+ bool empty() const { return this->Begin == this->End; }
+
+ difference_type size() const
+ {
+ return std::distance(this->Begin, this->End);
+ }
+
+ cmRange& advance(difference_type amount) &
+ {
+ std::advance(this->Begin, amount);
+ return *this;
+ }
+
+ cmRange advance(difference_type amount) &&
+ {
+ std::advance(this->Begin, amount);
+ return std::move(*this);
+ }
+
+ cmRange& retreat(difference_type amount) &
+ {
+ std::advance(this->End, -amount);
+ return *this;
+ }
+
+ cmRange retreat(difference_type amount) &&
+ {
+ std::advance(this->End, -amount);
+ return std::move(*this);
+ }
+
+ template <typename UnaryPredicate>
+ bool all_of(UnaryPredicate p) const
+ {
+ return std::all_of(this->Begin, this->End, std::ref(p));
+ }
+
+ template <typename UnaryPredicate>
+ bool any_of(UnaryPredicate p) const
+ {
+ return std::any_of(this->Begin, this->End, std::ref(p));
+ }
+
+ template <typename UnaryPredicate>
+ bool none_of(UnaryPredicate p) const
+ {
+ return std::none_of(this->Begin, this->End, std::ref(p));
+ }
+
+ template <typename UnaryPredicate>
+ auto filter(UnaryPredicate p) const
+ -> cmRange<RangeIterators::FilterIterator<Iter, UnaryPredicate>>
+ {
+ using It = RangeIterators::FilterIterator<Iter, UnaryPredicate>;
+ return { It(this->Begin, this->End, p), It(this->End, this->End, p) };
+ }
+
+ template <typename UnaryFunction>
+ auto transform(UnaryFunction f) const
+ -> cmRange<RangeIterators::TransformIterator<Iter, UnaryFunction>>
+ {
+ using It = RangeIterators::TransformIterator<Iter, UnaryFunction>;
+ return { It(this->Begin, f), It(this->End, f) };
+ }
+
+private:
+ Iter Begin;
+ Iter End;
+};
+
+template <typename Iter1, typename Iter2>
+bool operator==(cmRange<Iter1> const& left, cmRange<Iter2> const& right)
+{
+ return left.size() == right.size() &&
+ std::equal(left.begin(), left.end(), right.begin());
+}
+
+template <typename Iter1, typename Iter2>
+auto cmMakeRange(Iter1 begin, Iter2 end) -> cmRange<Iter1>
+{
+ return { begin, end };
+}
+
+template <typename Range>
+auto cmMakeRange(Range const& range) -> cmRange<decltype(range.begin())>
+{
+ return { range.begin(), range.end() };
+}
+
+template <typename Range>
+auto cmReverseRange(Range const& range) -> cmRange<decltype(range.rbegin())>
+{
+ return { range.rbegin(), range.rend() };
+}
+
+#endif
diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx
index 5ebdd1b..309ee30 100644
--- a/Source/cmRulePlaceholderExpander.cxx
+++ b/Source/cmRulePlaceholderExpander.cxx
@@ -177,6 +177,31 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable(
return replaceValues.SwiftLibraryName;
}
}
+ if (replaceValues.SwiftPartialDoc) {
+ if (variable == "SWIFT_PARTIAL_DOC") {
+ return replaceValues.SwiftPartialDoc;
+ }
+ }
+ if (replaceValues.SwiftPartialModule) {
+ if (variable == "SWIFT_PARTIAL_MODULE") {
+ return replaceValues.SwiftPartialModule;
+ }
+ }
+ if (replaceValues.SwiftPartialModules) {
+ if (variable == "SWIFT_PARTIAL_MODULES") {
+ return replaceValues.SwiftPartialModules;
+ }
+ }
+ if (replaceValues.TargetSwiftDoc) {
+ if (variable == "TARGET_SWIFT_DOC") {
+ return replaceValues.TargetSwiftDoc;
+ }
+ }
+ if (replaceValues.TargetSwiftModule) {
+ if (variable == "TARGET_SWIFT_MODULE") {
+ return replaceValues.TargetSwiftModule;
+ }
+ }
if (variable == "TARGET_SONAME" || variable == "SONAME_FLAG" ||
variable == "TARGET_INSTALLNAME_DIR") {
// All these variables depend on TargetSOName
diff --git a/Source/cmRulePlaceholderExpander.h b/Source/cmRulePlaceholderExpander.h
index 930eafd..ebd4d41 100644
--- a/Source/cmRulePlaceholderExpander.h
+++ b/Source/cmRulePlaceholderExpander.h
@@ -61,6 +61,11 @@ public:
const char* SwiftAuxiliarySources;
const char* SwiftModuleName;
const char* SwiftLibraryName;
+ const char* SwiftPartialModule;
+ const char* SwiftPartialDoc;
+ const char* TargetSwiftModule;
+ const char* TargetSwiftDoc;
+ const char* SwiftPartialModules;
};
// Expand rule variables in CMake of the type found in language rules
diff --git a/Source/cmServerConnection.cxx b/Source/cmServerConnection.cxx
index 844a858..a878890 100644
--- a/Source/cmServerConnection.cxx
+++ b/Source/cmServerConnection.cxx
@@ -29,7 +29,7 @@ cm::uv_stream_ptr cmStdIoConnection::SetupStream(int file_id)
tty.init(*this->Server->GetLoop(), file_id, file_id == 0,
static_cast<cmEventBasedConnection*>(this));
uv_tty_set_mode(tty, UV_TTY_MODE_NORMAL);
- return std::move(tty);
+ return { std::move(tty) };
}
case UV_FILE:
if (file_id == 0) {
@@ -43,7 +43,7 @@ cm::uv_stream_ptr cmStdIoConnection::SetupStream(int file_id)
pipe.init(*this->Server->GetLoop(), 0,
static_cast<cmEventBasedConnection*>(this));
uv_pipe_open(pipe, file_id);
- return std::move(pipe);
+ return { std::move(pipe) };
}
default:
assert(false && "Unable to determine stream type");
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 6bd071c..41555e8 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -5,6 +5,7 @@
#include "cmAlgorithms.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmRange.h"
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 2a0ccb4..0d8f1cc 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -4,11 +4,11 @@
#include <sstream>
-#include "cmAlgorithms.h"
#include "cmGlobalGenerator.h"
#include "cmInstalledFile.h"
#include "cmMakefile.h"
#include "cmProperty.h"
+#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmState.h"
#include "cmSystemTools.h"
diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx
index 15c8a61..31273cc 100644
--- a/Source/cmStateDirectory.cxx
+++ b/Source/cmStateDirectory.cxx
@@ -11,6 +11,7 @@
#include "cmAlgorithms.h"
#include "cmProperty.h"
#include "cmPropertyMap.h"
+#include "cmRange.h"
#include "cmState.h"
#include "cmStatePrivate.h"
#include "cmStateTypes.h"
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index 44ba82a..252d985 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -13,6 +13,7 @@
#include "cmCryptoHash.h"
#include "cmGeneratorExpression.h"
#include "cmMakefile.h"
+#include "cmRange.h"
#include "cmStringReplaceHelper.h"
#include "cmSystemTools.h"
#include "cmTimestamp.h"
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index f0e8077..d762106 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -5,6 +5,7 @@
#include "cmAlgorithms.h"
#include "cmDuration.h"
#include "cmProcessOutput.h"
+#include "cmRange.h"
#include "cm_sys_stat.h"
#include "cm_uv.h"
@@ -571,13 +572,14 @@ std::vector<std::string> cmSystemTools::HandleResponseFile(
return arg_full;
}
-std::vector<std::string> cmSystemTools::ParseArguments(const char* command)
+std::vector<std::string> cmSystemTools::ParseArguments(const std::string& cmd)
{
std::vector<std::string> args;
std::string arg;
bool win_path = false;
+ const char* command = cmd.c_str();
if (command[0] && command[1] &&
((command[0] != '/' && command[1] == ':' && command[2] == '\\') ||
(command[0] == '\"' && command[1] != '/' && command[2] == ':' &&
@@ -878,8 +880,7 @@ bool cmSystemTools::RunSingleCommand(const std::string& command,
outputflag = OUTPUT_NONE;
}
- std::vector<std::string> args =
- cmSystemTools::ParseArguments(command.c_str());
+ std::vector<std::string> args = cmSystemTools::ParseArguments(command);
if (args.empty()) {
return false;
@@ -1411,7 +1412,7 @@ void cmSystemTools::ConvertToOutputSlashes(std::string& path)
#endif
}
-std::string cmSystemTools::ConvertToRunCommandPath(const char* path)
+std::string cmSystemTools::ConvertToRunCommandPath(const std::string& path)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
return cmSystemTools::ConvertToWindowsOutputPath(path);
@@ -1425,12 +1426,12 @@ std::string cmSystemTools::RelativePath(std::string const& local,
std::string const& remote)
{
if (!cmSystemTools::FileIsFullPath(local)) {
- cmSystemTools::Error("RelativePath must be passed a full path to local: ",
- local.c_str());
+ cmSystemTools::Error("RelativePath must be passed a full path to local: " +
+ local);
}
if (!cmSystemTools::FileIsFullPath(remote)) {
- cmSystemTools::Error("RelativePath must be passed a full path to remote: ",
- remote.c_str());
+ cmSystemTools::Error(
+ "RelativePath must be passed a full path to remote: " + remote);
}
return cmsys::SystemTools::RelativePath(local, remote);
}
@@ -1614,7 +1615,7 @@ void cmSystemTools::EnableVSConsoleOutput()
#endif
}
-bool cmSystemTools::IsPathToFramework(const char* path)
+bool cmSystemTools::IsPathToFramework(const std::string& path)
{
return (cmSystemTools::FileIsFullPath(path) &&
cmHasLiteralSuffix(path, ".framework"));
@@ -1909,8 +1910,8 @@ bool extract_tar(const char* outFileName, bool verbose, bool extract)
else {
cmSystemTools::Error("Problem with archive_write_header(): ",
archive_error_string(ext));
- cmSystemTools::Error("Current file: ",
- cm_archive_entry_pathname(entry).c_str());
+ cmSystemTools::Error("Current file: " +
+ cm_archive_entry_pathname(entry));
break;
}
}
@@ -3005,7 +3006,7 @@ bool cmSystemTools::CheckRPath(std::string const& file,
#endif
}
-bool cmSystemTools::RepeatedRemoveDirectory(const char* dir)
+bool cmSystemTools::RepeatedRemoveDirectory(const std::string& dir)
{
// Windows sometimes locks files temporarily so try a few times.
for (int i = 0; i < 10; ++i) {
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 82e4f01..60e8c18 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -141,7 +141,7 @@ public:
///! Return true if value is NOTFOUND or ends in -NOTFOUND.
static bool IsNOTFOUND(const char* value);
///! Return true if the path is a framework
- static bool IsPathToFramework(const char* value);
+ static bool IsPathToFramework(const std::string& value);
static bool DoesFileExistWithExtensions(
const std::string& name, const std::vector<std::string>& sourceExts);
@@ -242,7 +242,7 @@ public:
/**
* Parse arguments out of a single string command
*/
- static std::vector<std::string> ParseArguments(const char* command);
+ static std::vector<std::string> ParseArguments(const std::string& command);
/** Parse arguments out of a windows command line string. */
static void ParseWindowsCommandLine(const char* command,
@@ -353,7 +353,7 @@ public:
// ConvertToRunCommandPath does not use s_ForceUnixPaths and should
// be used when RunCommand is called from cmake, because the
// running cmake needs paths to be in its format
- static std::string ConvertToRunCommandPath(const char* path);
+ static std::string ConvertToRunCommandPath(const std::string& path);
/** compute the relative path from local to remote. local must
be a directory. remote can be a file or a directory.
@@ -488,7 +488,7 @@ public:
static bool CheckRPath(std::string const& file, std::string const& newRPath);
/** Remove a directory; repeat a few times in case of locked files. */
- static bool RepeatedRemoveDirectory(const char* dir);
+ static bool RepeatedRemoveDirectory(const std::string& dir);
/** Tokenize a string */
static std::vector<std::string> tokenize(const std::string& str,
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index d1e4f06..46f930a 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -21,6 +21,7 @@
#include "cmMessageType.h"
#include "cmMessenger.h"
#include "cmProperty.h"
+#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmSourceFileLocation.h"
#include "cmSourceFileLocationKind.h"
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index a0e309d..571cd09 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -5,7 +5,6 @@
#include <ostream>
#include <utility>
-#include "cmAlgorithms.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmListFileCache.h"
@@ -13,6 +12,7 @@
#include "cmOutputConverter.h"
#include "cmProperty.h"
#include "cmPropertyMap.h"
+#include "cmRange.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTest.h"
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index d863339..4b0707b 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -5,10 +5,10 @@
#include "cmsys/FStream.hxx"
#include <stdio.h>
-#include "cmAlgorithms.h"
#include "cmDuration.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmRange.h"
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
@@ -173,7 +173,7 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs,
std::vector<std::string> emulatorWithArgs;
cmSystemTools::ExpandListArgument(emulator, emulatorWithArgs);
finalCommand +=
- cmSystemTools::ConvertToRunCommandPath(emulatorWithArgs[0].c_str());
+ cmSystemTools::ConvertToRunCommandPath(emulatorWithArgs[0]);
finalCommand += " ";
for (std::string const& arg : cmMakeRange(emulatorWithArgs).advance(1)) {
finalCommand += "\"";
@@ -182,8 +182,7 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs,
finalCommand += " ";
}
}
- finalCommand +=
- cmSystemTools::ConvertToRunCommandPath(this->OutputFile.c_str());
+ finalCommand += cmSystemTools::ConvertToRunCommandPath(this->OutputFile);
if (!runArgs.empty()) {
finalCommand += runArgs;
}
diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx
index 9648b21..e4a1b5f 100644
--- a/Source/cmUseMangledMesaCommand.cxx
+++ b/Source/cmUseMangledMesaCommand.cxx
@@ -19,7 +19,7 @@ bool cmUseMangledMesaCommand::InitialPass(std::vector<std::string> const& args,
this->SetError("called with incorrect number of arguments");
return false;
}
- const char* inputDir = args[0].c_str();
+ const std::string& inputDir = args[0];
std::string glh = inputDir;
glh += "/";
glh += "gl.h";
@@ -34,7 +34,7 @@ bool cmUseMangledMesaCommand::InitialPass(std::vector<std::string> const& args,
std::vector<std::string> files;
cmSystemTools::Glob(inputDir, "\\.h$", files);
if (files.empty()) {
- cmSystemTools::Error("Could not open Mesa Directory ", inputDir);
+ cmSystemTools::Error("Could not open Mesa Directory " + inputDir);
return false;
}
cmSystemTools::MakeDirectory(destDir);
@@ -60,8 +60,8 @@ void cmUseMangledMesaCommand::CopyAndFullPathMesaHeader(const char* source,
tempOutputFile += ".tmp";
cmsys::ofstream fout(tempOutputFile.c_str());
if (!fout) {
- cmSystemTools::Error("Could not open file for write in copy operation: ",
- tempOutputFile.c_str(), outdir);
+ cmSystemTools::Error("Could not open file for write in copy operation: " +
+ tempOutputFile + outdir);
cmSystemTools::ReportLastSystemError("");
return;
}
diff --git a/Source/cmUuid.cxx b/Source/cmUuid.cxx
index 201e1cc..51ecbd1 100644
--- a/Source/cmUuid.cxx
+++ b/Source/cmUuid.cxx
@@ -4,16 +4,10 @@
#include "cmCryptoHash.h"
+#include <array>
#include <string.h>
-cmUuid::cmUuid()
-{
- Groups.push_back(4);
- Groups.push_back(2);
- Groups.push_back(2);
- Groups.push_back(2);
- Groups.push_back(6);
-}
+static const std::array<int, 5> kUuidGroups = { { 4, 2, 2, 2, 6 } };
std::string cmUuid::FromMd5(std::vector<unsigned char> const& uuidNamespace,
std::string const& name) const
@@ -83,11 +77,11 @@ bool cmUuid::StringToBinary(std::string const& input,
return false;
}
size_t index = 0;
- for (size_t i = 0; i < this->Groups.size(); ++i) {
+ for (size_t i = 0; i < kUuidGroups.size(); ++i) {
if (i != 0 && input[index++] != '-') {
return false;
}
- size_t digits = this->Groups[i] * 2;
+ size_t digits = kUuidGroups[i] * 2;
if (!StringToBinaryImpl(input.substr(index, digits), output)) {
return false;
}
@@ -103,12 +97,12 @@ std::string cmUuid::BinaryToString(const unsigned char* input) const
std::string output;
size_t inputIndex = 0;
- for (size_t i = 0; i < this->Groups.size(); ++i) {
+ for (size_t i = 0; i < kUuidGroups.size(); ++i) {
if (i != 0) {
output += '-';
}
- size_t bytes = this->Groups[i];
+ size_t bytes = kUuidGroups[i];
for (size_t j = 0; j < bytes; ++j) {
unsigned char byte = input[inputIndex++];
output += this->ByteToHex(byte);
diff --git a/Source/cmUuid.h b/Source/cmUuid.h
index 158ce6e..7de20dd 100644
--- a/Source/cmUuid.h
+++ b/Source/cmUuid.h
@@ -15,8 +15,6 @@
class cmUuid
{
public:
- cmUuid();
-
std::string FromMd5(std::vector<unsigned char> const& uuidNamespace,
std::string const& name) const;
@@ -42,8 +40,6 @@ private:
std::string BinaryToString(const unsigned char* input) const;
bool IntFromHexDigit(char input, char& output) const;
-
- std::vector<int> Groups;
};
#endif
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 00a2d74..b655815 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -622,8 +622,8 @@ void cmVisualStudio10TargetGenerator::Generate()
propsLocal += this->DefaultArtifactDir;
propsLocal += "\\nasm.props";
ConvertToWindowsSlash(propsLocal);
- this->Makefile->ConfigureFile(propsTemplate.c_str(),
- propsLocal.c_str(), false, true, true);
+ this->Makefile->ConfigureFile(propsTemplate, propsLocal, false, true,
+ true);
Elem(e1, "Import").Attribute("Project", propsLocal);
}
}
@@ -1321,8 +1321,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule(
std::string error = "Could not create file: [";
error += sourcePath;
error += "] ";
- cmSystemTools::Error(error.c_str(),
- cmSystemTools::GetLastSystemError().c_str());
+ cmSystemTools::Error(error + cmSystemTools::GetLastSystemError());
}
}
}
@@ -2514,8 +2513,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
this->GeneratorTarget->GetLinkerLanguage(configName);
if (linkLanguage.empty()) {
cmSystemTools::Error(
- "CMake can not determine linker language for target: ",
- this->Name.c_str());
+ "CMake can not determine linker language for target: " + this->Name);
return false;
}
@@ -3345,8 +3343,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
const std::string& linkLanguage = linkClosure->LinkerLanguage;
if (linkLanguage.empty()) {
cmSystemTools::Error(
- "CMake can not determine linker language for target: ",
- this->Name.c_str());
+ "CMake can not determine linker language for target: " + this->Name);
return false;
}
@@ -3391,8 +3388,8 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
this->GeneratorTarget->GetLinkInformation(config);
if (!pcli) {
cmSystemTools::Error(
- "CMake can not compute cmComputeLinkInformation for target: ",
- this->Name.c_str());
+ "CMake can not compute cmComputeLinkInformation for target: " +
+ this->Name);
return false;
}
cmComputeLinkInformation& cli = *pcli;
@@ -3572,8 +3569,8 @@ bool cmVisualStudio10TargetGenerator::ComputeLibOptions(
this->GeneratorTarget->GetLinkInformation(config);
if (!pcli) {
cmSystemTools::Error(
- "CMake can not compute cmComputeLinkInformation for target: ",
- this->Name.c_str());
+ "CMake can not compute cmComputeLinkInformation for target: " +
+ this->Name);
return false;
}
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index ab783c7..f6f0a95 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -788,13 +788,13 @@ void cmake::SetArgs(const std::vector<std::string>& args)
}
cmGlobalGenerator* gen = this->CreateGlobalGenerator(value);
if (!gen) {
- const char* kdevError = nullptr;
+ std::string kdevError;
if (value.find("KDevelop3", 0) != std::string::npos) {
kdevError = "\nThe KDevelop3 generator is not supported anymore.";
}
- cmSystemTools::Error("Could not create named generator ",
- value.c_str(), kdevError);
+ cmSystemTools::Error("Could not create named generator " + value +
+ kdevError);
this->PrintGeneratorList();
} else {
this->SetGlobalGenerator(gen);
@@ -938,8 +938,8 @@ int cmake::AddCMakePaths()
cmSystemTools::Error(
"Could not find CMAKE_ROOT !!!\n"
"CMake has most likely not been installed correctly.\n"
- "Modules directory not found in\n",
- cmSystemTools::GetCMakeRoot().c_str());
+ "Modules directory not found in\n" +
+ cmSystemTools::GetCMakeRoot());
return 0;
}
this->AddCacheEntry("CMAKE_ROOT", cmSystemTools::GetCMakeRoot().c_str(),
@@ -2016,8 +2016,8 @@ void cmake::UpdateConversionPathTable()
if (tablepath) {
cmsys::ifstream table(tablepath->c_str());
if (!table) {
- cmSystemTools::Error("CMAKE_PATH_TRANSLATION_FILE set to ",
- tablepath->c_str(), ". CMake can not open file.");
+ cmSystemTools::Error("CMAKE_PATH_TRANSLATION_FILE set to " + *tablepath +
+ ". CMake can not open file.");
cmSystemTools::ReportLastSystemError("CMake can not open file.");
} else {
std::string a, b;
@@ -2325,8 +2325,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
}
cmGlobalGenerator* gen = this->CreateGlobalGenerator(value);
if (!gen) {
- cmSystemTools::Error("Could not create named generator ",
- value.c_str());
+ cmSystemTools::Error("Could not create named generator " + value);
this->PrintGeneratorList();
} else {
this->SetGlobalGenerator(gen);
@@ -2473,7 +2472,7 @@ static bool cmakeCheckStampFile(const std::string& stampName, bool verbose)
return true;
}
cmSystemTools::RemoveFile(stampTemp);
- cmSystemTools::Error("Cannot restore timestamp ", stampName.c_str());
+ cmSystemTools::Error("Cannot restore timestamp " + stampName);
return false;
}
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index adfce37..6e1a27c 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -9,6 +9,7 @@
#include "cmMakefile.h"
#include "cmQtAutoGeneratorMocUic.h"
#include "cmQtAutoGeneratorRcc.h"
+#include "cmRange.h"
#include "cmState.h"
#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
@@ -817,8 +818,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
if (args[1] == "chdir" && args.size() >= 4) {
std::string const& directory = args[2];
if (!cmSystemTools::FileExists(directory)) {
- cmSystemTools::Error("Directory does not exist for chdir command: ",
- args[2].c_str());
+ cmSystemTools::Error("Directory does not exist for chdir command: " +
+ args[2]);
return 1;
}
@@ -1065,12 +1066,12 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
format) != cm::cend(knownFormats);
if (!isKnown) {
- cmSystemTools::Error("Unknown -E tar --format= argument: ",
- format.c_str());
+ cmSystemTools::Error("Unknown -E tar --format= argument: " +
+ format);
return 1;
}
} else {
- cmSystemTools::Error("Unknown option to -E tar: ", arg.c_str());
+ cmSystemTools::Error("Unknown option to -E tar: " + arg);
return 1;
}
} else {
@@ -1094,8 +1095,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
++nCompress;
}
if ((format == "7zip" || format == "zip") && nCompress > 0) {
- cmSystemTools::Error("Can not use compression flags with format: ",
- format.c_str());
+ cmSystemTools::Error("Can not use compression flags with format: " +
+ format);
return 1;
}
if (nCompress > 1) {
@@ -1109,18 +1110,18 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
if (flags.find_first_of('t') != std::string::npos) {
if (!cmSystemTools::ListTar(outFile.c_str(), verbose)) {
- cmSystemTools::Error("Problem listing tar: ", outFile.c_str());
+ cmSystemTools::Error("Problem listing tar: " + outFile);
return 1;
}
} else if (flags.find_first_of('c') != std::string::npos) {
if (!cmSystemTools::CreateTar(outFile.c_str(), files, compress,
verbose, mtime, format)) {
- cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
+ cmSystemTools::Error("Problem creating tar: " + outFile);
return 1;
}
} else if (flags.find_first_of('x') != std::string::npos) {
if (!cmSystemTools::ExtractTar(outFile.c_str(), verbose)) {
- cmSystemTools::Error("Problem extracting tar: ", outFile.c_str());
+ cmSystemTools::Error("Problem extracting tar: " + outFile);
return 1;
}
#ifdef WIN32
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt
index e7da994..8577506 100644
--- a/Source/kwsys/CMakeLists.txt
+++ b/Source/kwsys/CMakeLists.txt
@@ -179,13 +179,6 @@ IF(KWSYS_USE_ConsoleBuf)
SET(KWSYS_USE_Encoding 1)
ENDIF()
-# Setup the large file support default.
-IF(KWSYS_LFS_DISABLE)
- SET(KWSYS_LFS_REQUESTED 0)
-ELSE()
- SET(KWSYS_LFS_REQUESTED 1)
-ENDIF()
-
# Specify default 8 bit encoding for Windows
IF(NOT KWSYS_ENCODING_DEFAULT_CODEPAGE)
SET(KWSYS_ENCODING_DEFAULT_CODEPAGE CP_ACP)
@@ -353,30 +346,6 @@ IF(KWSYS_STANDALONE)
ENDIF()
#-----------------------------------------------------------------------------
-# Configure Large File Support.
-KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_CSTDIO
- "Checking whether header cstdio is available" DIRECT)
-SET(KWSYS_LFS_AVAILABLE 0)
-IF(KWSYS_LFS_REQUESTED)
- # Large File Support is requested.
- SET(KWSYS_LFS_REQUESTED 1)
-
- # Check for large file support.
- SET(KWSYS_PLATFORM_CXX_TEST_DEFINES
- -DKWSYS_CXX_HAS_CSTDIO=${KWSYS_CXX_HAS_CSTDIO})
- KWSYS_PLATFORM_CXX_TEST_RUN(KWSYS_LFS_WORKS
- "Checking for Large File Support" DIRECT)
- SET(KWSYS_PLATFORM_CXX_TEST_DEFINES)
-
- IF(KWSYS_LFS_WORKS)
- SET(KWSYS_LFS_AVAILABLE 1)
- ENDIF()
-ELSE()
- # Large File Support is not requested.
- SET(KWSYS_LFS_REQUESTED 0)
-ENDIF()
-
-#-----------------------------------------------------------------------------
# Configure the standard library header wrappers based on compiler's
# capabilities and parent project's request. Enforce 0/1 as only
# possible values for configuration into Configure.hxx.
@@ -575,9 +544,6 @@ IF(KWSYS_USE_SystemInformation)
COMPILE_DEFINITIONS KWSYS_SYS_HAS_MACHINE_CPU_H=1)
ENDIF()
ENDIF()
- IF(KWSYS_LFS_AVAILABLE AND NOT KWSYS_LFS_DISABLE)
- SET(KWSYS_PLATFORM_CXX_TEST_DEFINES -DKWSYS_HAS_LFS=1)
- ENDIF()
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_RLIMIT64
"Checking whether CXX compiler has rlimit64" DIRECT)
SET(KWSYS_PLATFORM_CXX_TEST_DEFINES)
diff --git a/Source/kwsys/Configure.h.in b/Source/kwsys/Configure.h.in
index bec1abc..5323c57 100644
--- a/Source/kwsys/Configure.h.in
+++ b/Source/kwsys/Configure.h.in
@@ -28,43 +28,6 @@
/* Whether kwsys namespace is "kwsys". */
#define @KWSYS_NAMESPACE@_NAME_IS_KWSYS @KWSYS_NAME_IS_KWSYS@
-/* Whether Large File Support is requested. */
-#define @KWSYS_NAMESPACE@_LFS_REQUESTED @KWSYS_LFS_REQUESTED@
-
-/* Whether Large File Support is available. */
-#if @KWSYS_NAMESPACE@_LFS_REQUESTED
-# define @KWSYS_NAMESPACE@_LFS_AVAILABLE @KWSYS_LFS_AVAILABLE@
-#endif
-
-/* Setup Large File Support if requested. */
-#if @KWSYS_NAMESPACE@_LFS_REQUESTED
-/* Since LFS is requested this header must be included before system
- headers whether or not LFS is available. */
-# if 0 && (defined(_SYS_TYPES_H) || defined(_SYS_TYPES_INCLUDED))
-# error "@KWSYS_NAMESPACE@/Configure.h must be included before sys/types.h"
-# endif
-/* Enable the large file API if it is available. */
-# if @KWSYS_NAMESPACE@_LFS_AVAILABLE && \
- !defined(@KWSYS_NAMESPACE@_LFS_NO_DEFINES)
-# if !defined(_LARGEFILE_SOURCE) && \
- !defined(@KWSYS_NAMESPACE@_LFS_NO_DEFINE_LARGEFILE_SOURCE)
-# define _LARGEFILE_SOURCE
-# endif
-# if !defined(_LARGEFILE64_SOURCE) && \
- !defined(@KWSYS_NAMESPACE@_LFS_NO_DEFINE_LARGEFILE64_SOURCE)
-# define _LARGEFILE64_SOURCE
-# endif
-# if !defined(_LARGE_FILES) && \
- !defined(@KWSYS_NAMESPACE@_LFS_NO_DEFINE_LARGE_FILES)
-# define _LARGE_FILES
-# endif
-# if !defined(_FILE_OFFSET_BITS) && \
- !defined(@KWSYS_NAMESPACE@_LFS_NO_DEFINE_FILE_OFFSET_BITS)
-# define _FILE_OFFSET_BITS 64
-# endif
-# endif
-#endif
-
/* Setup the export macro. */
#if @KWSYS_BUILD_SHARED@
# if defined(_WIN32) || defined(__CYGWIN__)
diff --git a/Source/kwsys/kwsysPlatformTestsCXX.cxx b/Source/kwsys/kwsysPlatformTestsCXX.cxx
index b77d729..cfd5666 100644
--- a/Source/kwsys/kwsysPlatformTestsCXX.cxx
+++ b/Source/kwsys/kwsysPlatformTestsCXX.cxx
@@ -136,42 +136,6 @@ int main()
}
#endif
-#ifdef TEST_KWSYS_LFS_WORKS
-/* Return 0 when LFS is available and 1 otherwise. */
-# define _LARGEFILE_SOURCE
-# define _LARGEFILE64_SOURCE
-# define _LARGE_FILES
-# define _FILE_OFFSET_BITS 64
-# include <sys/types.h>
-
-# include <assert.h>
-# include <sys/stat.h>
-# if KWSYS_CXX_HAS_CSTDIO
-# include <cstdio>
-# endif
-# include <stdio.h>
-
-int main(int, char** argv)
-{
-/* check that off_t can hold 2^63 - 1 and perform basic operations... */
-# define OFF_T_64 (((off_t)1 << 62) - 1 + ((off_t)1 << 62))
- if (OFF_T_64 % 2147483647 != 1)
- return 1;
-
- // stat breaks on SCO OpenServer
- struct stat buf;
- stat(argv[0], &buf);
- if (!S_ISREG(buf.st_mode))
- return 2;
-
- FILE* file = fopen(argv[0], "r");
- off_t offset = ftello(file);
- fseek(file, offset, SEEK_CUR);
- fclose(file);
- return 0;
-}
-#endif
-
#ifdef TEST_KWSYS_CXX_HAS_SETENV
# include <stdlib.h>
int main()
@@ -212,12 +176,6 @@ int main()
#endif
#ifdef TEST_KWSYS_CXX_HAS_RLIMIT64
-# if defined(KWSYS_HAS_LFS)
-# define _LARGEFILE_SOURCE
-# define _LARGEFILE64_SOURCE
-# define _LARGE_FILES
-# define _FILE_OFFSET_BITS 64
-# endif
# include <sys/resource.h>
int main()
{
diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt
index f6a9153..91f7e25 100644
--- a/Tests/CMakeLib/CMakeLists.txt
+++ b/Tests/CMakeLib/CMakeLists.txt
@@ -7,6 +7,7 @@ include_directories(
set(CMakeLib_TESTS
testGeneratedFileStream.cxx
testRST.cxx
+ testRange.cxx
testString.cxx
testSystemTools.cxx
testUTF8.cxx
diff --git a/Tests/CMakeLib/testRange.cxx b/Tests/CMakeLib/testRange.cxx
new file mode 100644
index 0000000..5ae805f
--- /dev/null
+++ b/Tests/CMakeLib/testRange.cxx
@@ -0,0 +1,45 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#include "cmRange.h"
+
+#include <iostream>
+#include <string>
+#include <vector>
+
+#define ASSERT_TRUE(x) \
+ do { \
+ if (!(x)) { \
+ std::cout << "ASSERT_TRUE(" #x ") failed on line " << __LINE__ << "\n"; \
+ return false; \
+ } \
+ } while (false)
+
+int testRange(int /*unused*/, char* /*unused*/ [])
+{
+ std::vector<int> const testData = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
+
+ ASSERT_TRUE(!cmMakeRange(testData).empty());
+ ASSERT_TRUE(cmMakeRange(testData).size() == 10);
+
+ ASSERT_TRUE(!cmMakeRange(testData).advance(5).empty());
+ ASSERT_TRUE(cmMakeRange(testData).advance(5).size() == 5);
+
+ ASSERT_TRUE(cmMakeRange(testData).advance(5).retreat(5).empty());
+ ASSERT_TRUE(cmMakeRange(testData).advance(5).retreat(5).size() == 0);
+
+ ASSERT_TRUE(cmMakeRange(testData).any_of([](int n) { return n % 3 == 0; }));
+ ASSERT_TRUE(cmMakeRange(testData).all_of([](int n) { return n < 11; }));
+ ASSERT_TRUE(cmMakeRange(testData).none_of([](int n) { return n > 11; }));
+
+ std::vector<int> const evenData = { 2, 4, 6, 8, 10 };
+ ASSERT_TRUE(cmMakeRange(testData).filter([](int n) { return n % 2 == 0; }) ==
+ cmMakeRange(evenData));
+
+ std::vector<std::string> const stringRange = { "1", "2", "3", "4", "5" };
+ ASSERT_TRUE(cmMakeRange(testData)
+ .transform([](int n) { return std::to_string(n); })
+ .retreat(5) == cmMakeRange(stringRange));
+
+ return 0;
+}
diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt
index 7023615..929fa4d 100644
--- a/Tests/Fortran/CMakeLists.txt
+++ b/Tests/Fortran/CMakeLists.txt
@@ -46,7 +46,7 @@ function(test_fortran_c_interface_module)
FortranCInterface_VERIFY()
FortranCInterface_VERIFY(CXX)
if(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
- if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "SunPro|MIPSpro|PathScale|Absoft")
+ if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "SunPro|PathScale|Absoft")
set(module_expected 1)
endif()
if(FortranCInterface_MODULE_FOUND OR module_expected)
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake b/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake
index ce8d45b..869fe3d 100644
--- a/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake
@@ -10,6 +10,7 @@ project(Minimal NONE)
#
set(targets
aix-C-XL-13.1.3 aix-CXX-XL-13.1.3
+ aix-C-XLClang-16.1.0.1 aix-CXX-XLClang-16.1.0.1
craype-C-Cray-8.7 craype-CXX-Cray-8.7 craype-Fortran-Cray-8.7
craype-C-GNU-7.3.0 craype-CXX-GNU-7.3.0 craype-Fortran-GNU-7.3.0
craype-C-Intel-18.0.2.20180210 craype-CXX-Intel-18.0.2.20180210
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/CMakeLists.txt b/Tests/RunCMake/ParseImplicitIncludeInfo/data/CMakeLists.txt
index b854e2e..bffe819 100644
--- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/CMakeLists.txt
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/CMakeLists.txt
@@ -12,6 +12,9 @@
#
cmake_minimum_required(VERSION 3.3)
+if(POLICY CMP0089)
+ cmake_policy(SET CMP0089 NEW)
+endif()
set(lngs C CXX)
set(LANGUAGES "${lngs}" CACHE STRING "List of languages to generate inputs for")
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-C-XLClang-16.1.0.1.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-C-XLClang-16.1.0.1.input
new file mode 100644
index 0000000..2f018e6
--- /dev/null
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-C-XLClang-16.1.0.1.input
@@ -0,0 +1,40 @@
+CMAKE_LANG=C
+CMAKE_C_COMPILER_ABI=
+CMAKE_C_COMPILER_AR=
+CMAKE_C_COMPILER_ARCHITECTURE_ID=
+CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN=
+CMAKE_C_COMPILER_ID=XLClang
+CMAKE_C_COMPILER_LAUNCHER=
+CMAKE_C_COMPILER_LOADED=1
+CMAKE_C_COMPILER_RANLIB=
+CMAKE_C_COMPILER_TARGET=
+CMAKE_C_COMPILER_VERSION=16.1.0.1
+CMAKE_C_COMPILER_VERSION_INTERAL=
+Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
+
+Run Build Command(s):/usr/bin/gmake cmTC_fcf21/fast
+/usr/bin/gmake -f CMakeFiles/cmTC_fcf21.dir/build.make CMakeFiles/cmTC_fcf21.dir/build
+gmake[1]: Entering directory '/tmp/ii/CMakeFiles/CMakeTmp'
+Building C object CMakeFiles/cmTC_fcf21.dir/CMakeCCompilerABI.c.o
+/opt/IBM/xlC/16.1.0/bin/xlclang -V -o CMakeFiles/cmTC_fcf21.dir/CMakeCCompilerABI.c.o -c /tmp/CMake/Modules/CMakeCCompilerABI.c
+export XL_CONFIG=/opt/IBM/xlc/16.1.0/etc/xlc.cfg.72:xlclang
+export XL_ASMOBJFILES=/tmp/xlcASuz87id
+export "XL_DIS=/opt/IBM/xlc/16.1.0/exe/dis -o "CMakeFiles/cmTC_fcf21.dir/CMakeCCompilerABI.c.o" "CMakeCCompilerABI.o""
+/opt/IBM/xlC/16.1.0/exe/xlC2entry -qosvar=aix.7.2 -qalias=ansi -qthreaded -D_THREAD_SAFE -Wno-parentheses -Wno-unused-value -D_AIX -D_AIX32 -D_AIX41 -D_AIX43 -D_AIX50 -D_AIX51 -D_AIX52 -D_AIX53 -D_AIX61 -D_AIX71 -D_AIX72 -D_IBMR2 -D_POWER -xc -qasm_as=/bin/as -qc_stdinc=/opt/IBM/xlC/16.1.0/include2:/opt/IBM/xlC/16.1.0/include2/aix:/opt/IBM/xlmass/9.1.0/include:/usr/include -qvac_include_path=/opt/IBM/xlc/16.1.0/include -oCMakeFiles/cmTC_fcf21.dir/CMakeCCompilerABI.c.o /tmp/CMake/Modules/CMakeCCompilerABI.c /tmp/xlcW0tZ87ia /tmp/xlcW1ub87ib /dev/null /tmp/xlcLu487ieF.lst /dev/null /tmp/xlcW2uj87ic
+export XL_BACKEND=/opt/IBM/xlc/16.1.0/exe/xlCcode
+export XL_LINKER=/bin/ld
+/opt/IBM/xlc/16.1.0/exe/xlCcode -qalias=ansi -qthreaded /tmp/xlcW0tZ87ia /tmp/xlcW1ub87ib CMakeFiles/cmTC_fcf21.dir/CMakeCCompilerABI.c.o /tmp/xlcLu487ieB.lst /tmp/xlcW2uj87ic
+rm /tmp/xlcASuz87id
+rm /tmp/xlcLu487ie
+rm /tmp/xlcW0tZ87ia
+rm /tmp/xlcW1ub87ib
+rm /tmp/xlcW2uj87ic
+Linking C executable cmTC_fcf21
+/tmp/CMake/bin/cmake -E cmake_link_script CMakeFiles/cmTC_fcf21.dir/link.txt --verbose=1
+/opt/IBM/xlC/16.1.0/bin/xlclang -Wl,-bnoipath -Wl,-brtl -V -Wl,-bexpall CMakeFiles/cmTC_fcf21.dir/CMakeCCompilerABI.c.o -o cmTC_fcf21 -Wl,-blibpath:/usr/lib:/lib
+export XL_CONFIG=/opt/IBM/xlc/16.1.0/etc/xlc.cfg.72:xlclang
+/bin/ld -b32 /lib/crt0.o -bpT:0x10000000 -bpD:0x20000000 -bnoipath -brtl -bexpall CMakeFiles/cmTC_fcf21.dir/CMakeCCompilerABI.c.o -o cmTC_fcf21 -blibpath:/usr/lib:/lib -L/opt/IBM/xlmass/9.1.0/lib/aix61 -L/opt/IBM/xlc/16.1.0/lib -lxlopt -lxlipa -lxl -lc -lpthreads
+rm /tmp/xlcW0vJG7ia
+rm /tmp/xlcW1vNG7ib
+rm /tmp/xlcW2vRG7ic
+gmake[1]: Leaving directory '/tmp/ii/CMakeFiles/CMakeTmp'
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-C-XLClang-16.1.0.1.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-C-XLClang-16.1.0.1.output
new file mode 100644
index 0000000..85399b7
--- /dev/null
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-C-XLClang-16.1.0.1.output
@@ -0,0 +1 @@
+/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/aix-CXX-XLClang-16.1.0.1.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-CXX-XLClang-16.1.0.1.input
new file mode 100644
index 0000000..da16db3
--- /dev/null
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-CXX-XLClang-16.1.0.1.input
@@ -0,0 +1,44 @@
+CMAKE_LANG=CXX
+CMAKE_CXX_COMPILER_ABI=
+CMAKE_CXX_COMPILER_AR=
+CMAKE_CXX_COMPILER_ARCHITECTURE_ID=
+CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN=
+CMAKE_CXX_COMPILER_ID=XLClang
+CMAKE_CXX_COMPILER_LAUNCHER=
+CMAKE_CXX_COMPILER_LOADED=1
+CMAKE_CXX_COMPILER_RANLIB=
+CMAKE_CXX_COMPILER_TARGET=
+CMAKE_CXX_COMPILER_VERSION=16.1.0.1
+CMAKE_CXX_COMPILER_VERSION_INTERAL=
+Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
+
+Run Build Command(s):/usr/bin/gmake cmTC_b8490/fast
+/usr/bin/gmake -f CMakeFiles/cmTC_b8490.dir/build.make CMakeFiles/cmTC_b8490.dir/build
+gmake[1]: Entering directory '/tmp/ii/CMakeFiles/CMakeTmp'
+Building CXX object CMakeFiles/cmTC_b8490.dir/CMakeCXXCompilerABI.cpp.o
+/opt/IBM/xlC/16.1.0/bin/xlclang++ -x c++ -V -o CMakeFiles/cmTC_b8490.dir/CMakeCXXCompilerABI.cpp.o -c /tmp/CMake/Modules/CMakeCXXCompilerABI.cpp
+export XL_CONFIG=/opt/IBM/xlc/16.1.0/etc/xlc.cfg.72:xlclang++
+export XL_XLCMP_PATH=/opt/IBM/xlc/16.1.0:/opt/IBM/xlC/16.1.0
+export XL_COMPILER=xlc++
+export XL_ASMOBJFILES=/tmp/xlcAS3IXqid
+export "XL_DIS=/opt/IBM/xlc/16.1.0/exe/dis -o "CMakeFiles/cmTC_b8490.dir/CMakeCXXCompilerABI.cpp.o" "CMakeCXXCompilerABI.o""
+/opt/IBM/xlC/16.1.0/exe/xlC2entry -qosvar=aix.7.2 -qalias=ansi -qthreaded -D_THREAD_SAFE -Wno-parentheses -Wno-unused-value -D_AIX -D_AIX32 -D_AIX41 -D_AIX43 -D_AIX50 -D_AIX51 -D_AIX52 -D_AIX53 -D_AIX61 -D_AIX71 -D_AIX72 -D_IBMR2 -D_POWER -xc++ -qasm_as=/bin/as -qcpp_stdinc=/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 -qc_stdinc=/opt/IBM/xlC/16.1.0/include2:/opt/IBM/xlC/16.1.0/include2/aix:/opt/IBM/xlmass/9.1.0/include:/usr/include -oCMakeFiles/cmTC_b8490.dir/CMakeCXXCompilerABI.cpp.o /tmp/CMake/Modules/CMakeCXXCompilerABI.cpp /tmp/xlcW03uXqia /tmp/xlcW137Xqib /dev/null /tmp/xlcL3QXqieF.lst /dev/null /tmp/xlcW23AXqic
+export XL_BACKEND=/opt/IBM/xlc/16.1.0/exe/xlCcode
+export XL_LINKER=/bin/ld
+/opt/IBM/xlc/16.1.0/exe/xlCcode -qalias=ansi -qthreaded /tmp/xlcW03uXqia /tmp/xlcW137Xqib CMakeFiles/cmTC_b8490.dir/CMakeCXXCompilerABI.cpp.o /tmp/xlcL3QXqieB.lst /tmp/xlcW23AXqic
+rm /tmp/xlcAS3IXqid
+rm /tmp/xlcL3QXqie
+rm /tmp/xlcW03uXqia
+rm /tmp/xlcW137Xqib
+rm /tmp/xlcW23AXqic
+Linking CXX executable cmTC_b8490
+/tmp/CMake/bin/cmake -E cmake_link_script CMakeFiles/cmTC_b8490.dir/link.txt --verbose=1
+/opt/IBM/xlC/16.1.0/bin/xlclang++ -Wl,-bnoipath -Wl,-brtl -V -Wl,-bexpall CMakeFiles/cmTC_b8490.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_b8490 -Wl,-blibpath:/usr/lib:/lib
+export XL_CONFIG=/opt/IBM/xlc/16.1.0/etc/xlc.cfg.72:xlclang++
+/bin/ld -b32 /lib/crt0.o /lib/crti.o -bpT:0x10000000 -bpD:0x20000000 -bnoipath -brtl -bexpall CMakeFiles/cmTC_b8490.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_b8490 -blibpath:/usr/lib:/lib -bcdtors:all:0:s -btmplrename -L/opt/IBM/xlmass/9.1.0/lib/aix61 -L/opt/IBM/xlc/16.1.0/lib -lxlopt -lxlipa -lxl -L/opt/IBM/xlC/16.1.0/lib -lc++ -lCcore -lpthreads -lm -lc |
+/opt/IBM/xlC/16.1.0/bin/c++filt -S |
+/bin/sed '/317.*::virtual-fn-table-ptr$/ s/^\(.*: \)*{*\([^}]*\)\(}*.*\)::virtual-fn-table-ptr$/\1Virtual table for class "\2": Some possible causes are: first non-inline virtual function in "\2" is not defined or the class is a template instantiation and an explicit instantiation definition of the class is missing./'
+rm /tmp/xlcW05fS7ia
+rm /tmp/xlcW15rS7ib
+rm /tmp/xlcW25vS7ic
+gmake[1]: Leaving directory '/tmp/ii/CMakeFiles/CMakeTmp'
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
new file mode 100644
index 0000000..e462894
--- /dev/null
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-CXX-XLClang-16.1.0.1.output
@@ -0,0 +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
diff --git a/Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt b/Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt
deleted file mode 100644
index 86e3ec0..0000000
--- a/Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt
+++ /dev/null
@@ -1 +0,0 @@
-^WARNING: Target "notall" has EXCLUDE_FROM_ALL set and will not be built by default but an install rule has been provided for it\. CMake does not define behavior for this case\.$
diff --git a/Tests/RunCMake/list/POP_BACK-NoArgs-result.txt b/Tests/RunCMake/list/POP_BACK-NoArgs-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/list/POP_BACK-NoArgs-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/POP_BACK-NoArgs-stderr.txt b/Tests/RunCMake/list/POP_BACK-NoArgs-stderr.txt
new file mode 100644
index 0000000..83060b4
--- /dev/null
+++ b/Tests/RunCMake/list/POP_BACK-NoArgs-stderr.txt
@@ -0,0 +1 @@
+list must be called with at least two arguments
diff --git a/Tests/RunCMake/list/POP_BACK-NoArgs.cmake b/Tests/RunCMake/list/POP_BACK-NoArgs.cmake
new file mode 100644
index 0000000..518924d
--- /dev/null
+++ b/Tests/RunCMake/list/POP_BACK-NoArgs.cmake
@@ -0,0 +1 @@
+list(POP_FRONT)
diff --git a/Tests/RunCMake/list/POP_BACK.cmake b/Tests/RunCMake/list/POP_BACK.cmake
new file mode 100644
index 0000000..4794796
--- /dev/null
+++ b/Tests/RunCMake/list/POP_BACK.cmake
@@ -0,0 +1,79 @@
+cmake_policy(SET CMP0054 NEW)
+
+function(assert_expected_list_len list_var expected_size)
+ list(LENGTH ${list_var} _size)
+ if(NOT _size EQUAL ${expected_size})
+ message(FATAL_ERROR "list size expected to be `${expected_size}`, got `${_size}` instead")
+ endif()
+endfunction()
+
+# Pop from undefined list
+list(POP_BACK test)
+if(DEFINED test)
+ message(FATAL_ERROR "`test` expected to be undefined")
+endif()
+
+# Pop from empty list
+set(test)
+list(POP_BACK test)
+if(DEFINED test)
+ message(FATAL_ERROR "`test` expected to be undefined")
+endif()
+
+# Default pop from 1-item list
+list(APPEND test one)
+list(POP_BACK test)
+assert_expected_list_len(test 0)
+
+# Pop from 1-item list to var
+list(APPEND test one)
+list(POP_BACK test one)
+assert_expected_list_len(test 0)
+if(NOT DEFINED one)
+ message(FATAL_ERROR "`one` expected to be defined")
+endif()
+if(NOT one STREQUAL "one")
+ message(FATAL_ERROR "`one` has unexpected value `${one}`")
+endif()
+
+unset(one)
+unset(two)
+
+# Pop from 1-item list to vars
+list(APPEND test one)
+list(POP_BACK test one two)
+assert_expected_list_len(test 0)
+if(NOT DEFINED one)
+ message(FATAL_ERROR "`one` expected to be defined")
+endif()
+if(NOT one STREQUAL "one")
+ message(FATAL_ERROR "`one` has unexpected value `${one}`")
+endif()
+if(DEFINED two)
+ message(FATAL_ERROR "`two` expected to be undefined")
+endif()
+
+unset(one)
+unset(two)
+
+# Default pop from 2-item list
+list(APPEND test one two)
+list(POP_BACK test)
+assert_expected_list_len(test 1)
+if(NOT test STREQUAL "one")
+ message(FATAL_ERROR "`test` has unexpected value `${test}`")
+endif()
+
+# Pop from 2-item list
+list(APPEND test two)
+list(POP_BACK test two)
+assert_expected_list_len(test 1)
+if(NOT DEFINED two)
+ message(FATAL_ERROR "`two` expected to be defined")
+endif()
+if(NOT two STREQUAL "two")
+ message(FATAL_ERROR "`two` has unexpected value `${two}`")
+endif()
+if(NOT test STREQUAL "one")
+ message(FATAL_ERROR "`test` has unexpected value `${test}`")
+endif()
diff --git a/Tests/RunCMake/list/POP_FRONT-NoArgs-result.txt b/Tests/RunCMake/list/POP_FRONT-NoArgs-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/list/POP_FRONT-NoArgs-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/POP_FRONT-NoArgs-stderr.txt b/Tests/RunCMake/list/POP_FRONT-NoArgs-stderr.txt
new file mode 100644
index 0000000..83060b4
--- /dev/null
+++ b/Tests/RunCMake/list/POP_FRONT-NoArgs-stderr.txt
@@ -0,0 +1 @@
+list must be called with at least two arguments
diff --git a/Tests/RunCMake/list/POP_FRONT-NoArgs.cmake b/Tests/RunCMake/list/POP_FRONT-NoArgs.cmake
new file mode 100644
index 0000000..c5cf837
--- /dev/null
+++ b/Tests/RunCMake/list/POP_FRONT-NoArgs.cmake
@@ -0,0 +1 @@
+list(POP_BACK)
diff --git a/Tests/RunCMake/list/POP_FRONT.cmake b/Tests/RunCMake/list/POP_FRONT.cmake
new file mode 100644
index 0000000..a2f8f3c
--- /dev/null
+++ b/Tests/RunCMake/list/POP_FRONT.cmake
@@ -0,0 +1,79 @@
+cmake_policy(SET CMP0054 NEW)
+
+function(assert_expected_list_len list_var expected_size)
+ list(LENGTH ${list_var} _size)
+ if(NOT _size EQUAL ${expected_size})
+ message(FATAL_ERROR "list size expected to be `${expected_size}`, got `${_size}` instead")
+ endif()
+endfunction()
+
+# Pop from undefined list
+list(POP_FRONT test)
+if(DEFINED test)
+ message(FATAL_ERROR "`test` expected to be undefined")
+endif()
+
+# Pop from empty list
+set(test)
+list(POP_FRONT test)
+if(DEFINED test)
+ message(FATAL_ERROR "`test` expected to be undefined")
+endif()
+
+# Default pop from 1-item list
+list(APPEND test one)
+list(POP_FRONT test)
+assert_expected_list_len(test 0)
+
+# Pop from 1-item list to var
+list(APPEND test one)
+list(POP_FRONT test one)
+assert_expected_list_len(test 0)
+if(NOT DEFINED one)
+ message(FATAL_ERROR "`one` expected to be defined")
+endif()
+if(NOT one STREQUAL "one")
+ message(FATAL_ERROR "`one` has unexpected value `${one}`")
+endif()
+
+unset(one)
+unset(two)
+
+# Pop from 1-item list to vars
+list(APPEND test one)
+list(POP_FRONT test one two)
+assert_expected_list_len(test 0)
+if(NOT DEFINED one)
+ message(FATAL_ERROR "`one` expected to be defined")
+endif()
+if(NOT one STREQUAL "one")
+ message(FATAL_ERROR "`one` has unexpected value `${one}`")
+endif()
+if(DEFINED two)
+ message(FATAL_ERROR "`two` expected to be undefined")
+endif()
+
+unset(one)
+unset(two)
+
+# Default pop from 2-item list
+list(APPEND test one two)
+list(POP_FRONT test)
+assert_expected_list_len(test 1)
+if(NOT test STREQUAL "two")
+ message(FATAL_ERROR "`test` has unexpected value `${test}`")
+endif()
+
+# Pop from 2-item list
+list(PREPEND test one)
+list(POP_FRONT test one)
+assert_expected_list_len(test 1)
+if(NOT DEFINED one)
+ message(FATAL_ERROR "`one` expected to be defined")
+endif()
+if(NOT one STREQUAL "one")
+ message(FATAL_ERROR "`one` has unexpected value `${one}`")
+endif()
+if(NOT test STREQUAL "two")
+ message(FATAL_ERROR "`test` has unexpected value `${test}`")
+endif()
diff --git a/Tests/RunCMake/list/PREPEND-NoArgs-result.txt b/Tests/RunCMake/list/PREPEND-NoArgs-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/list/PREPEND-NoArgs-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/PREPEND-NoArgs-stderr.txt b/Tests/RunCMake/list/PREPEND-NoArgs-stderr.txt
new file mode 100644
index 0000000..83060b4
--- /dev/null
+++ b/Tests/RunCMake/list/PREPEND-NoArgs-stderr.txt
@@ -0,0 +1 @@
+list must be called with at least two arguments
diff --git a/Tests/RunCMake/list/PREPEND-NoArgs.cmake b/Tests/RunCMake/list/PREPEND-NoArgs.cmake
new file mode 100644
index 0000000..8935fa9
--- /dev/null
+++ b/Tests/RunCMake/list/PREPEND-NoArgs.cmake
@@ -0,0 +1 @@
+list(PREPEND)
diff --git a/Tests/RunCMake/list/PREPEND.cmake b/Tests/RunCMake/list/PREPEND.cmake
new file mode 100644
index 0000000..17b2921
--- /dev/null
+++ b/Tests/RunCMake/list/PREPEND.cmake
@@ -0,0 +1,33 @@
+list(PREPEND test)
+if(test)
+ message(FATAL_ERROR "failed")
+endif()
+
+list(PREPEND test satu)
+if(NOT test STREQUAL "satu")
+ message(FATAL_ERROR "failed")
+endif()
+
+list(PREPEND test dua)
+if(NOT test STREQUAL "dua;satu")
+ message(FATAL_ERROR "failed")
+endif()
+
+list(PREPEND test tiga)
+if(NOT test STREQUAL "tiga;dua;satu")
+ message(FATAL_ERROR "failed")
+endif()
+
+# Scope test
+function(foo)
+ list(PREPEND test empat)
+ if(NOT test STREQUAL "empat;tiga;dua;satu")
+ message(FATAL_ERROR "failed")
+ endif()
+endfunction()
+
+foo()
+
+if(NOT test STREQUAL "tiga;dua;satu")
+ message(FATAL_ERROR "failed")
+endif()
diff --git a/Tests/RunCMake/list/RunCMakeTest.cmake b/Tests/RunCMake/list/RunCMakeTest.cmake
index bf3d22d..59c7ea5 100644
--- a/Tests/RunCMake/list/RunCMakeTest.cmake
+++ b/Tests/RunCMake/list/RunCMakeTest.cmake
@@ -98,3 +98,15 @@ run_cmake(SORT-NoCaseOption)
# Successful tests
run_cmake(SORT)
+
+# argument tests
+run_cmake(PREPEND-NoArgs)
+# Successful tests
+run_cmake(PREPEND)
+
+# argument tests
+run_cmake(POP_BACK-NoArgs)
+run_cmake(POP_FRONT-NoArgs)
+# Successful tests
+run_cmake(POP_BACK)
+run_cmake(POP_FRONT)
diff --git a/Tests/RunCMake/try_compile/CMP0066-stderr.txt b/Tests/RunCMake/try_compile/CMP0066-stderr.txt
index b14e290..0b92dcf 100644
--- a/Tests/RunCMake/try_compile/CMP0066-stderr.txt
+++ b/Tests/RunCMake/try_compile/CMP0066-stderr.txt
@@ -12,4 +12,15 @@ CMake Warning \(dev\) at CMP0066.cmake:[0-9]+ \(try_compile\):
test project.
Call Stack \(most recent call first\):
CMakeLists.txt:[0-9]+ \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.$
+This warning is for project developers. Use -Wno-dev to suppress it.
+*
+CMake Deprecation Warning at CMP0066.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0066 will be removed from a future version
+ of CMake.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt
index 1c96497..8dc3b2c 100644
--- a/Utilities/cmcurl/CMakeLists.txt
+++ b/Utilities/cmcurl/CMakeLists.txt
@@ -77,7 +77,7 @@ endif(APPLE)
# Disable warnings to avoid changing 3rd party code.
if(CMAKE_C_COMPILER_ID MATCHES
- "^(GNU|Clang|AppleClang|XL|VisualAge|SunPro|MIPSpro|HP|Intel)$")
+ "^(GNU|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel)$")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
elseif(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
diff --git a/Utilities/cmexpat/CMakeLists.txt b/Utilities/cmexpat/CMakeLists.txt
index 470fcba..13eb56d 100644
--- a/Utilities/cmexpat/CMakeLists.txt
+++ b/Utilities/cmexpat/CMakeLists.txt
@@ -1,6 +1,6 @@
# Disable warnings to avoid changing 3rd party code.
IF(CMAKE_C_COMPILER_ID MATCHES
- "^(GNU|Clang|AppleClang|XL|VisualAge|SunPro|MIPSpro|HP|Intel)$")
+ "^(GNU|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel)$")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
diff --git a/Utilities/cmjsoncpp/CMakeLists.txt b/Utilities/cmjsoncpp/CMakeLists.txt
index ef370cc..764be8d 100644
--- a/Utilities/cmjsoncpp/CMakeLists.txt
+++ b/Utilities/cmjsoncpp/CMakeLists.txt
@@ -2,7 +2,7 @@ project(JsonCpp CXX)
# Disable warnings to avoid changing 3rd party code.
if(CMAKE_CXX_COMPILER_ID MATCHES
- "^(GNU|Clang|AppleClang|XL|VisualAge|SunPro|MIPSpro|HP|Intel)$")
+ "^(GNU|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel)$")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "PathScale")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -woffall")
diff --git a/Utilities/cmjsoncpp/include/json/config.h b/Utilities/cmjsoncpp/include/json/config.h
index eb52e71..34f7314 100644
--- a/Utilities/cmjsoncpp/include/json/config.h
+++ b/Utilities/cmjsoncpp/include/json/config.h
@@ -5,13 +5,14 @@
#ifndef JSON_CONFIG_H_INCLUDED
#define JSON_CONFIG_H_INCLUDED
-#include <stddef.h>
-#include <string> //typedef String
-#include <stdint.h> //typedef int64_t, uint64_t
// Include KWSys Large File Support configuration.
#include <cmsys/Configure.h>
+#include <stddef.h>
+#include <string> //typedef String
+#include <stdint.h> //typedef int64_t, uint64_t
+
#if defined(_MSC_VER)
# pragma warning(push,1)
#endif
diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt
index d7af6e2..53b3a83 100644
--- a/Utilities/cmlibarchive/CMakeLists.txt
+++ b/Utilities/cmlibarchive/CMakeLists.txt
@@ -60,7 +60,7 @@ SET(CMAKE_REQUIRED_FLAGS)
# Disable warnings to avoid changing 3rd party code.
IF(CMAKE_C_COMPILER_ID MATCHES
- "^(GNU|Clang|AppleClang|XL|VisualAge|SunPro|MIPSpro|HP|Intel)$")
+ "^(GNU|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel)$")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
diff --git a/Utilities/cmliblzma/CMakeLists.txt b/Utilities/cmliblzma/CMakeLists.txt
index e9f8826..b443fd6 100644
--- a/Utilities/cmliblzma/CMakeLists.txt
+++ b/Utilities/cmliblzma/CMakeLists.txt
@@ -183,7 +183,7 @@ INCLUDE_DIRECTORIES(
# Disable warnings to avoid changing 3rd party code.
IF(CMAKE_C_COMPILER_ID MATCHES
- "^(GNU|Clang|AppleClang|XL|VisualAge|SunPro|MIPSpro|HP|Intel)$")
+ "^(GNU|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel)$")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
diff --git a/Utilities/cmlibrhash/CMakeLists.txt b/Utilities/cmlibrhash/CMakeLists.txt
index aa28055..6067b7d 100644
--- a/Utilities/cmlibrhash/CMakeLists.txt
+++ b/Utilities/cmlibrhash/CMakeLists.txt
@@ -2,7 +2,7 @@ project(librhash C)
# Disable warnings to avoid changing 3rd party code.
if(CMAKE_C_COMPILER_ID MATCHES
- "^(GNU|Clang|AppleClang|XL|VisualAge|SunPro|MIPSpro|HP|Intel)$")
+ "^(GNU|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel)$")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
elseif(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
diff --git a/Utilities/cmlibuv/CMakeLists.txt b/Utilities/cmlibuv/CMakeLists.txt
index a62c516..2e781f1 100644
--- a/Utilities/cmlibuv/CMakeLists.txt
+++ b/Utilities/cmlibuv/CMakeLists.txt
@@ -2,7 +2,7 @@ project(libuv C)
# Disable warnings to avoid changing 3rd party code.
if(CMAKE_C_COMPILER_ID MATCHES
- "^(GNU|Clang|AppleClang|XL|VisualAge|SunPro|MIPSpro|HP|Intel)$")
+ "^(GNU|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel)$")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
elseif(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
diff --git a/Utilities/cmlibuv/src/unix/atomic-ops.h b/Utilities/cmlibuv/src/unix/atomic-ops.h
index 7cac1f9..be741dc 100644
--- a/Utilities/cmlibuv/src/unix/atomic-ops.h
+++ b/Utilities/cmlibuv/src/unix/atomic-ops.h
@@ -37,7 +37,7 @@ UV_UNUSED(static int cmpxchgi(int* ptr, int oldval, int newval)) {
: "r" (newval), "0" (oldval)
: "memory");
return out;
-#elif defined(_AIX) && defined(__xlC__)
+#elif defined(_AIX) && (defined(__xlC__) || defined(__ibmxl__))
const int out = (*(volatile int*) ptr);
__compare_and_swap(ptr, &oldval, newval);
return out;
@@ -63,7 +63,7 @@ UV_UNUSED(static long cmpxchgl(long* ptr, long oldval, long newval)) {
: "r" (newval), "0" (oldval)
: "memory");
return out;
-#elif defined(_AIX) && defined(__xlC__)
+#elif defined(_AIX) && (defined(__xlC__) || defined(__ibmxl__))
const long out = (*(volatile int*) ptr);
# if defined(__64BIT__)
__compare_and_swaplp(ptr, &oldval, newval);
diff --git a/Utilities/cmzlib/CMakeLists.txt b/Utilities/cmzlib/CMakeLists.txt
index 0be48f1..888c3ff 100644
--- a/Utilities/cmzlib/CMakeLists.txt
+++ b/Utilities/cmzlib/CMakeLists.txt
@@ -2,7 +2,7 @@ PROJECT(CMZLIB)
# Disable warnings to avoid changing 3rd party code.
if(CMAKE_C_COMPILER_ID MATCHES
- "^(GNU|Clang|AppleClang|XL|VisualAge|SunPro|MIPSpro|HP|Intel)$")
+ "^(GNU|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel)$")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
elseif(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")