summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.clang-format2
-rw-r--r--Help/manual/cmake-policies.7.rst1
-rw-r--r--Help/manual/cmake-properties.7.rst17
-rw-r--r--Help/manual/cmake.1.rst60
-rw-r--r--Help/policy/CMP0100.rst40
-rw-r--r--Help/prop_tgt/AUTOGEN_PARALLEL.rst6
-rw-r--r--Help/prop_tgt/AUTOMOC.rst2
-rw-r--r--Help/prop_tgt/AUTOMOC_MOC_OPTIONS.rst6
-rw-r--r--Help/prop_tgt/AUTOMOC_PATH_PREFIX.rst4
-rw-r--r--Help/prop_tgt/AUTORCC.rst7
-rw-r--r--Help/prop_tgt/AUTORCC_OPTIONS.rst4
-rw-r--r--Help/prop_tgt/AUTOUIC.rst7
-rw-r--r--Help/prop_tgt/AUTOUIC_OPTIONS.rst4
-rw-r--r--Help/prop_tgt/DEPRECATION.rst7
-rw-r--r--Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst2
-rw-r--r--Help/release/dev/FindPython-SOABI.rst6
-rw-r--r--Help/release/dev/FindPythonConda-module.rst5
-rw-r--r--Help/release/dev/add_target_deprecation.rst7
-rw-r--r--Help/release/dev/autogen_hh_headers.rst6
-rw-r--r--Help/release/dev/command_debug_find.rst10
-rw-r--r--Help/release/dev/json_trace.rst7
-rw-r--r--Help/release/dev/ninja-postgen-commands.rst5
-rw-r--r--Help/release/dev/xmllint-target.rst4
-rw-r--r--Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst2
-rw-r--r--Modules/CMakeCheckCompilerFlagCommonPatterns.cmake1
-rw-r--r--Modules/CMakeOBJCInformation.cmake5
-rw-r--r--Modules/CMakeOBJCXXInformation.cmake5
-rw-r--r--Modules/CMakeSwiftInformation.cmake4
-rw-r--r--Modules/FindLibXml2.cmake32
-rw-r--r--Modules/FindOpenSSL.cmake12
-rw-r--r--Modules/FindPython.cmake19
-rw-r--r--Modules/FindPython/Support.cmake64
-rw-r--r--Modules/FindPython2.cmake12
-rw-r--r--Modules/FindPython3.cmake19
-rw-r--r--Modules/Platform/Windows-Apple-Swift.cmake1
-rw-r--r--Modules/Platform/Windows-GNU.cmake2
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/cmCPackGenerator.cxx4
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.cxx8
-rw-r--r--Source/CTest/cmCTestBuildCommand.cxx11
-rw-r--r--Source/CTest/cmCTestBuildCommand.h2
-rw-r--r--Source/CTest/cmCTestConfigureCommand.cxx7
-rw-r--r--Source/CTest/cmCTestResourceSpec.cxx79
-rw-r--r--Source/CTest/cmCTestResourceSpec.h17
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx8
-rw-r--r--Source/QtDialog/QCMake.cxx1
-rw-r--r--Source/cmCacheManager.cxx2
-rw-r--r--Source/cmComputeLinkDepends.h3
-rw-r--r--Source/cmCoreTryCompile.cxx4
-rw-r--r--Source/cmDependsC.h3
-rw-r--r--Source/cmExportBuildFileGenerator.cxx5
-rw-r--r--Source/cmExportCommand.cxx14
-rw-r--r--Source/cmExportFileGenerator.cxx6
-rw-r--r--Source/cmExportLibraryDependenciesCommand.cxx4
-rw-r--r--Source/cmExternalMakefileProjectGenerator.h9
-rw-r--r--Source/cmFileAPICodemodel.cxx2
-rw-r--r--Source/cmFindPackageCommand.cxx46
-rw-r--r--Source/cmFindPackageCommand.h1
-rw-r--r--Source/cmGeneratorTarget.cxx31
-rw-r--r--Source/cmGeneratorTarget.h7
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx4
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.h6
-rw-r--r--Source/cmGlobalGenerator.cxx75
-rw-r--r--Source/cmGlobalGenerator.h22
-rw-r--r--Source/cmGlobalGeneratorFactory.h14
-rw-r--r--Source/cmGlobalGhsMultiGenerator.h5
-rw-r--r--Source/cmGlobalJOMMakefileGenerator.h6
-rw-r--r--Source/cmGlobalMSYSMakefileGenerator.h7
-rw-r--r--Source/cmGlobalMinGWMakefileGenerator.h8
-rw-r--r--Source/cmGlobalNMakeMakefileGenerator.h7
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx63
-rw-r--r--Source/cmGlobalNinjaGenerator.h21
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx2
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.h6
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx24
-rw-r--r--Source/cmGlobalVisualStudio10Generator.h2
-rw-r--r--Source/cmGlobalVisualStudio11Generator.cxx32
-rw-r--r--Source/cmGlobalVisualStudio11Generator.h3
-rw-r--r--Source/cmGlobalVisualStudio12Generator.cxx24
-rw-r--r--Source/cmGlobalVisualStudio12Generator.h3
-rw-r--r--Source/cmGlobalVisualStudio14Generator.cxx24
-rw-r--r--Source/cmGlobalVisualStudio14Generator.h3
-rw-r--r--Source/cmGlobalVisualStudio9Generator.cxx32
-rw-r--r--Source/cmGlobalVisualStudio9Generator.h4
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.cxx46
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.h5
-rw-r--r--Source/cmGlobalWatcomWMakeGenerator.h6
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx26
-rw-r--r--Source/cmGlobalXCodeGenerator.h2
-rw-r--r--Source/cmJsonObjects.cxx7
-rw-r--r--Source/cmLinkLineDeviceComputer.cxx34
-rw-r--r--Source/cmMakefile.cxx64
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx8
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx12
-rw-r--r--Source/cmMakefileTargetGenerator.cxx8
-rw-r--r--Source/cmMakefileTargetGenerator.h2
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx4
-rw-r--r--Source/cmNinjaTargetGenerator.cxx3
-rw-r--r--Source/cmPolicies.h4
-rw-r--r--Source/cmQtAutoGenInitializer.cxx171
-rw-r--r--Source/cmQtAutoGenInitializer.h3
-rw-r--r--Source/cmServerProtocol.cxx4
-rw-r--r--Source/cmSetCommand.cxx2
-rw-r--r--Source/cmState.cxx35
-rw-r--r--Source/cmState.h8
-rw-r--r--Source/cmTarget.cxx5
-rw-r--r--Source/cmTargetPropertyComputer.cxx1
-rw-r--r--Source/cmake.cxx247
-rw-r--r--Source/cmake.h35
-rw-r--r--Source/cmakemain.cxx1
-rw-r--r--Source/cmcmd.cxx8
-rw-r--r--Templates/MSBuild/FlagTables/v10_Cuda.json20
-rw-r--r--Tests/CMakeLib/testCTestResourceSpec.cxx122
-rw-r--r--Tests/CMakeLists.txt2
-rw-r--r--Tests/Cuda/CMakeLists.txt1
-rw-r--r--Tests/Cuda/SeparableCompCXXOnly/CMakeLists.txt3
-rw-r--r--Tests/Cuda/SeparableCompCXXOnly/main.cpp5
-rw-r--r--Tests/CudaOnly/WithDefs/CMakeLists.txt2
-rw-r--r--Tests/ExportImport/Export/CMakeLists.txt6
-rw-r--r--Tests/ExportImport/Import/A/CMakeLists.txt6
-rw-r--r--Tests/FindLibXml2/Test/CMakeLists.txt4
-rw-r--r--Tests/FindPython/CMakeLists.txt41
-rw-r--r--Tests/FindPython/SOABI/CMakeLists.txt12
-rw-r--r--Tests/FindPython/VirtualEnv/CMakeLists.txt4
-rw-r--r--Tests/FindPython/VirtualEnvConda/CMakeLists.txt46
-rw-r--r--Tests/FindPython/VirtualEnvConda/VirtualEnvDefault.cmake6
-rw-r--r--Tests/FindPython/VirtualEnvConda/VirtualEnvOnly.cmake16
-rw-r--r--Tests/FindPython/VirtualEnvConda/VirtualEnvStandard.cmake7
-rw-r--r--Tests/QtAutogen/MocCMP0100/CMakeLists.txt9
-rw-r--r--Tests/QtAutogen/MocCMP0100/NEW/CMakeLists.txt10
-rw-r--r--Tests/QtAutogen/MocCMP0100/OLD/CMakeLists.txt31
-rw-r--r--Tests/QtAutogen/MocCMP0100/Obj.cpp31
-rw-r--r--Tests/QtAutogen/MocCMP0100/Obj.hh20
-rw-r--r--Tests/QtAutogen/MocCMP0100/Obj2.cpp31
-rw-r--r--Tests/QtAutogen/MocCMP0100/Obj2.hh20
-rw-r--r--Tests/QtAutogen/MocCMP0100/main.cpp9
-rw-r--r--Tests/QtAutogen/SameName/CMakeLists.txt6
-rw-r--r--Tests/QtAutogen/SameName/main.cpp2
-rw-r--r--Tests/QtAutogen/SameName/object.hh13
-rw-r--r--Tests/QtAutogen/Tests.cmake1
-rw-r--r--Tests/RunCMake/CMakeLists.txt6
-rw-r--r--Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx3
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake8
-rw-r--r--Tests/RunCMake/CommandLine/trace-json-v1-check.cmake11
-rwxr-xr-xTests/RunCMake/CommandLine/trace-json-v1-check.py72
-rw-r--r--Tests/RunCMake/CommandLine/trace-json-v1-expand-check.cmake11
-rw-r--r--Tests/RunCMake/CommandLine/trace-json-v1-expand.cmake1
-rw-r--r--Tests/RunCMake/CommandLine/trace-json-v1.cmake5
-rw-r--r--Tests/RunCMake/CompilerLauncher/OBJC-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/CompilerLauncher/OBJC-common.cmake3
-rw-r--r--Tests/RunCMake/CompilerLauncher/OBJC-env-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/CompilerLauncher/OBJC-env-launch-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/CompilerLauncher/OBJC-env.cmake1
-rw-r--r--Tests/RunCMake/CompilerLauncher/OBJC-launch-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/CompilerLauncher/OBJC-launch-env.cmake3
-rw-r--r--Tests/RunCMake/CompilerLauncher/OBJC-launch.cmake3
-rw-r--r--Tests/RunCMake/CompilerLauncher/OBJC.cmake2
-rw-r--r--Tests/RunCMake/CompilerLauncher/OBJCXX-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/CompilerLauncher/OBJCXX-common.cmake3
-rw-r--r--Tests/RunCMake/CompilerLauncher/OBJCXX-env-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/CompilerLauncher/OBJCXX-env-launch-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/CompilerLauncher/OBJCXX-env.cmake1
-rw-r--r--Tests/RunCMake/CompilerLauncher/OBJCXX-launch-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/CompilerLauncher/OBJCXX-launch-env.cmake3
-rw-r--r--Tests/RunCMake/CompilerLauncher/OBJCXX-launch.cmake3
-rw-r--r--Tests/RunCMake/CompilerLauncher/OBJCXX.cmake2
-rw-r--r--Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/CompilerLauncher/main.m4
-rw-r--r--Tests/RunCMake/CompilerLauncher/main.mm4
-rw-r--r--Tests/RunCMake/TargetProperties/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/TargetProperties/Deprecation-stderr.txt9
-rw-r--r--Tests/RunCMake/TargetProperties/Deprecation.cmake5
-rw-r--r--Tests/RunCMake/TargetProperties/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/TargetProperties/empty.cpp4
-rw-r--r--Tests/RunCMake/find_package/FromPATHEnv-stderr.txt10
-rw-r--r--Tests/RunCMake/find_package/MissingConfigDebug-stderr.txt5
-rw-r--r--Tests/RunCMake/try_compile/CleanupNoFollowSymlink.cmake21
-rw-r--r--Tests/RunCMake/try_compile/RunCMakeTest.cmake4
-rwxr-xr-xbootstrap1
179 files changed, 1889 insertions, 643 deletions
diff --git a/.clang-format b/.clang-format
index a7f049a..4bfce44 100644
--- a/.clang-format
+++ b/.clang-format
@@ -22,6 +22,8 @@ IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^[<"]cmConfigure\.h'
Priority: -1
+ - Regex: '^<queue>'
+ Priority: 1
- Regex: '^(<|")cm(ext)?/'
Priority: 2
- Regex: '^(<|")windows\.h'
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index 2118031..1fd49ed 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -57,6 +57,7 @@ Policies Introduced by CMake 3.17
.. toctree::
:maxdepth: 1
+ CMP0100: Let AUTOMOC and AUTOUIC process .hh header files. </policy/CMP0100>
CMP0099: Link properties are transitive over private dependency on static libraries. </policy/CMP0099>
CMP0098: FindFLEX runs flex in CMAKE_CURRENT_BINARY_DIR when executing. </policy/CMP0098>
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index b9db12d..b3802d1 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -27,6 +27,8 @@ Properties of Global Scope
/prop_gbl/CMAKE_ROLE
/prop_gbl/DEBUG_CONFIGURATIONS
/prop_gbl/DISABLED_FEATURES
+ /prop_gbl/ECLIPSE_EXTRA_CPROJECT_CONTENTS
+ /prop_gbl/ECLIPSE_EXTRA_NATURES
/prop_gbl/ENABLED_FEATURES
/prop_gbl/ENABLED_LANGUAGES
/prop_gbl/FIND_LIBRARY_USE_LIB32_PATHS
@@ -37,12 +39,10 @@ Properties of Global Scope
/prop_gbl/GLOBAL_DEPENDS_DEBUG_MODE
/prop_gbl/GLOBAL_DEPENDS_NO_CYCLES
/prop_gbl/IN_TRY_COMPILE
+ /prop_gbl/JOB_POOLS
/prop_gbl/PACKAGES_FOUND
/prop_gbl/PACKAGES_NOT_FOUND
- /prop_gbl/JOB_POOLS
/prop_gbl/PREDEFINED_TARGETS_FOLDER
- /prop_gbl/ECLIPSE_EXTRA_NATURES
- /prop_gbl/ECLIPSE_EXTRA_CPROJECT_CONTENTS
/prop_gbl/REPORT_UNDEFINED_PROPERTIES
/prop_gbl/RULE_LAUNCH_COMPILE
/prop_gbl/RULE_LAUNCH_CUSTOM
@@ -130,20 +130,20 @@ Properties on Targets
/prop_tgt/AUTOGEN_ORIGIN_DEPENDS
/prop_tgt/AUTOGEN_PARALLEL
/prop_tgt/AUTOGEN_TARGET_DEPENDS
+ /prop_tgt/AUTOMOC
/prop_tgt/AUTOMOC_COMPILER_PREDEFINES
/prop_tgt/AUTOMOC_DEPEND_FILTERS
/prop_tgt/AUTOMOC_EXECUTABLE
/prop_tgt/AUTOMOC_MACRO_NAMES
/prop_tgt/AUTOMOC_MOC_OPTIONS
/prop_tgt/AUTOMOC_PATH_PREFIX
- /prop_tgt/AUTOMOC
+ /prop_tgt/AUTORCC
+ /prop_tgt/AUTORCC_EXECUTABLE
+ /prop_tgt/AUTORCC_OPTIONS
/prop_tgt/AUTOUIC
/prop_tgt/AUTOUIC_EXECUTABLE
/prop_tgt/AUTOUIC_OPTIONS
/prop_tgt/AUTOUIC_SEARCH_PATHS
- /prop_tgt/AUTORCC
- /prop_tgt/AUTORCC_EXECUTABLE
- /prop_tgt/AUTORCC_OPTIONS
/prop_tgt/BINARY_DIR
/prop_tgt/BUILD_RPATH
/prop_tgt/BUILD_RPATH_USE_ORIGIN
@@ -183,6 +183,7 @@ Properties on Targets
/prop_tgt/DEFINE_SYMBOL
/prop_tgt/DEPLOYMENT_REMOTE_DIRECTORY
/prop_tgt/DEPLOYMENT_ADDITIONAL_FILES
+ /prop_tgt/DEPRECATION
/prop_tgt/DISABLE_PRECOMPILE_HEADERS
/prop_tgt/DOTNET_TARGET_FRAMEWORK_VERSION
/prop_tgt/EchoString
@@ -445,8 +446,8 @@ Properties on Source Files
:maxdepth: 1
/prop_sf/ABSTRACT
- /prop_sf/AUTOUIC_OPTIONS
/prop_sf/AUTORCC_OPTIONS
+ /prop_sf/AUTOUIC_OPTIONS
/prop_sf/COMPILE_DEFINITIONS
/prop_sf/COMPILE_FLAGS
/prop_sf/COMPILE_OPTIONS
diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index f8847f1..4315f0a 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -257,6 +257,66 @@ Options
Like ``--trace``, but with variables expanded.
+``--trace-format=<format>``
+ Put cmake in trace mode and sets the trace output format.
+
+ ``<format>`` can be one of the following values.
+
+ ``human``
+ Prints each trace line in a human-readable format. This is the
+ default format.
+
+ ``json``
+ Prints each line as a separate JSON document. Each document is
+ separated by a newline ( ``\n`` ). It is guaranteed that no
+ newline characters will be present inside a JSON document.
+
+ JSON trace format:
+
+ .. code-block:: json
+
+ {
+ "file": "/full/path/to/the/CMake/file.txt",
+ "line": 0,
+ "cmd": "add_executable",
+ "args": ["foo", "bar"]
+ }
+
+ The members are:
+
+ ``file``
+ The full path to the CMake source file where the function
+ was called.
+
+ ``line``
+ The line in `file` of the function call.
+
+ ``cmd``
+ The name of the function that was called.
+
+ ``args``
+ A string list of all function parameters.
+
+ Additionally, the first JSON document outputted contains the
+ ``version`` key for the current major and minor version of the
+
+ JSON trace format:
+
+ .. code-block:: json
+
+ {
+ "version": {
+ "major": 1,
+ "minor": 0
+ }
+ }
+
+ The members are:
+
+ ``version``
+ Indicates the version of the JSON format. The version has a
+ major and minor components following semantic version conventions.
+
``--trace-source=<file>``
Put cmake in trace mode, but output only lines of a specified file.
diff --git a/Help/policy/CMP0100.rst b/Help/policy/CMP0100.rst
new file mode 100644
index 0000000..b24d013
--- /dev/null
+++ b/Help/policy/CMP0100.rst
@@ -0,0 +1,40 @@
+CMP0100
+-------
+
+Let :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC` process
+header files that end with a ``.hh`` extension.
+
+Since version 3.17, CMake processes header files that end with a
+``.hh`` extension in :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC`.
+In earlier CMake versions, these header files were ignored by
+:prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC`.
+
+This policy affects how header files that end with a ``.hh`` extension
+get treated in :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC`.
+
+The ``OLD`` behavior for this policy is to ignore ``.hh`` header files
+in :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC`.
+
+The ``NEW`` behavior for this policy is to process ``.hh`` header files
+in :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC` just like other header files.
+
+.. note::
+
+ To silence the ``CMP0100`` warning source files can be excluded from
+ :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC` processing by setting the
+ source file properties :prop_sf:`SKIP_AUTOMOC`, :prop_sf:`SKIP_AUTOUIC` or
+ :prop_sf:`SKIP_AUTOGEN`.
+
+ .. code-block:: cmake
+
+ # Source skip example:
+ set_property(SOURCE /path/to/file1.hh PROPERTY SKIP_AUTOMOC ON)
+ set_property(SOURCE /path/to/file2.hh PROPERTY SKIP_AUTOUIC ON)
+ set_property(SOURCE /path/to/file3.hh PROPERTY SKIP_AUTOGEN ON)
+
+This policy was introduced in CMake version 3.17.0. 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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/prop_tgt/AUTOGEN_PARALLEL.rst b/Help/prop_tgt/AUTOGEN_PARALLEL.rst
index 07fbc5a..968b619 100644
--- a/Help/prop_tgt/AUTOGEN_PARALLEL.rst
+++ b/Help/prop_tgt/AUTOGEN_PARALLEL.rst
@@ -4,9 +4,9 @@ AUTOGEN_PARALLEL
Number of parallel ``moc`` or ``uic`` processes to start when using
:prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC`.
-The custom `<origin>_autogen` target starts a number of threads of which
+The custom ``<origin>_autogen`` target starts a number of threads of which
each one parses a source file and on demand starts a ``moc`` or ``uic``
-process. :prop_tgt:`AUTOGEN_PARALLEL` controls how many parallel threads
+process. ``AUTOGEN_PARALLEL`` controls how many parallel threads
(and therefore ``moc`` or ``uic`` processes) are started.
- An empty (or unset) value or the string ``AUTO`` sets the number of
@@ -14,7 +14,7 @@ process. :prop_tgt:`AUTOGEN_PARALLEL` controls how many parallel threads
- A positive non zero integer value sets the exact thread/process count.
- Otherwise a single thread/process is started.
-By default :prop_tgt:`AUTOGEN_PARALLEL` is initialized from
+By default ``AUTOGEN_PARALLEL`` is initialized from
:variable:`CMAKE_AUTOGEN_PARALLEL`.
See the :manual:`cmake-qt(7)` manual for more information on using CMake
diff --git a/Help/prop_tgt/AUTOMOC.rst b/Help/prop_tgt/AUTOMOC.rst
index f6dfabd..c18859b 100644
--- a/Help/prop_tgt/AUTOMOC.rst
+++ b/Help/prop_tgt/AUTOMOC.rst
@@ -172,7 +172,7 @@ variables. If the call is in a different context than the
then the version variables might not be available to the :prop_tgt:`AUTOMOC`
enabled target.
In that case the version variables can be forwarded from the
-`find_package(Qt[45]...)` calling context to the :command:`add_executable`
+``find_package(Qt[45]...)`` calling context to the :command:`add_executable`
or :command:`add_library` calling context as directory properties.
The following Qt5 example demonstrates the procedure.
diff --git a/Help/prop_tgt/AUTOMOC_MOC_OPTIONS.rst b/Help/prop_tgt/AUTOMOC_MOC_OPTIONS.rst
index ebd5c49..330849b 100644
--- a/Help/prop_tgt/AUTOMOC_MOC_OPTIONS.rst
+++ b/Help/prop_tgt/AUTOMOC_MOC_OPTIONS.rst
@@ -1,7 +1,7 @@
AUTOMOC_MOC_OPTIONS
-------------------
-Additional options for moc when using :prop_tgt:`AUTOMOC`
+Additional options for ``moc`` when using :prop_tgt:`AUTOMOC`
This property is only used if the :prop_tgt:`AUTOMOC` property is ``ON``
for this target. In this case, it holds additional command line
@@ -9,7 +9,9 @@ options which will be used when ``moc`` is executed during the build, i.e.
it is equivalent to the optional ``OPTIONS`` argument of the
:module:`qt4_wrap_cpp() <FindQt4>` macro.
-By default it is empty.
+This property is initialized by the value of the
+:variable:`CMAKE_AUTOMOC_MOC_OPTIONS` variable if it is set when a target
+is created, or an empty string otherwise.
See the :manual:`cmake-qt(7)` manual for more information on using CMake
with Qt.
diff --git a/Help/prop_tgt/AUTOMOC_PATH_PREFIX.rst b/Help/prop_tgt/AUTOMOC_PATH_PREFIX.rst
index e2ebb3f..3e3059d 100644
--- a/Help/prop_tgt/AUTOMOC_PATH_PREFIX.rst
+++ b/Help/prop_tgt/AUTOMOC_PATH_PREFIX.rst
@@ -21,11 +21,11 @@ with Qt.
Reproducible builds
^^^^^^^^^^^^^^^^^^^
-For reproducible builds is is recommended to keep headers that are ``moc``
+For reproducible builds it is recommended to keep headers that are ``moc``
compiled in one of the target
:command:`include directories <target_include_directories>` and set
:prop_tgt:`AUTOMOC_PATH_PREFIX` to ``ON`` (which is the default). This ensures
-that
+that:
- ``moc`` output files are identical on different build setups,
- ``moc`` output files will compile correctly when the source and/or
diff --git a/Help/prop_tgt/AUTORCC.rst b/Help/prop_tgt/AUTORCC.rst
index cca3e58..9a98f44 100644
--- a/Help/prop_tgt/AUTORCC.rst
+++ b/Help/prop_tgt/AUTORCC.rst
@@ -31,9 +31,10 @@ Modifiers
The ``rcc`` executable will be detected automatically, but can be forced to
a certain binary by setting this target property.
-:prop_sf:`AUTORCC_OPTIONS`:
-Additional command line options for ``rcc`` can be set via this ``.qrc``
-source file property.
+:prop_tgt:`AUTORCC_OPTIONS`:
+Additional command line options for ``rcc`` can be set via this target
+property. The corresponding :prop_sf:`AUTORCC_OPTIONS` source file property
+can be used to specify options to be applied only to a specific ``.qrc`` file.
:prop_sf:`SKIP_AUTORCC`:
``.qrc`` files can be excluded from :prop_tgt:`AUTORCC` processing by
diff --git a/Help/prop_tgt/AUTORCC_OPTIONS.rst b/Help/prop_tgt/AUTORCC_OPTIONS.rst
index d6ade5a..5261aff 100644
--- a/Help/prop_tgt/AUTORCC_OPTIONS.rst
+++ b/Help/prop_tgt/AUTORCC_OPTIONS.rst
@@ -8,11 +8,9 @@ when ``rcc`` is executed during the build via :prop_tgt:`AUTORCC`,
i.e. it is equivalent to the optional ``OPTIONS`` argument of the
:module:`qt4_add_resources() <FindQt4>` macro.
-By default it is empty.
-
This property is initialized by the value of the
:variable:`CMAKE_AUTORCC_OPTIONS` variable if it is set when a target is
-created.
+created, or an empty string otherwise.
The options set on the target may be overridden by :prop_sf:`AUTORCC_OPTIONS`
set on the ``.qrc`` source file.
diff --git a/Help/prop_tgt/AUTOUIC.rst b/Help/prop_tgt/AUTOUIC.rst
index 5cf8755..cd24f5e 100644
--- a/Help/prop_tgt/AUTOUIC.rst
+++ b/Help/prop_tgt/AUTOUIC.rst
@@ -52,8 +52,11 @@ Modifiers
The ``uic`` executable will be detected automatically, but can be forced to
a certain binary using this target property.
-:prop_sf:`AUTOUIC_OPTIONS`: Additional command line options for ``uic`` can
-be set via this source file property on a ``<base_name>.ui`` file.
+:prop_tgt:`AUTOUIC_OPTIONS`:
+Additional command line options for ``uic`` can be set via this target
+property. The corresponding :prop_sf:`AUTOUIC_OPTIONS` source file property
+can be used to specify options to be applied only to a specific
+``<base_name>.ui`` file.
:prop_sf:`SKIP_AUTOUIC`:
Source files can be excluded from :prop_tgt:`AUTOUIC` processing by setting
diff --git a/Help/prop_tgt/AUTOUIC_OPTIONS.rst b/Help/prop_tgt/AUTOUIC_OPTIONS.rst
index 3f613b9..425ea1c 100644
--- a/Help/prop_tgt/AUTOUIC_OPTIONS.rst
+++ b/Help/prop_tgt/AUTOUIC_OPTIONS.rst
@@ -8,11 +8,9 @@ This property holds additional command line options which will be used when
equivalent to the optional ``OPTIONS`` argument of the
:module:`qt4_wrap_ui() <FindQt4>` macro.
-By default it is empty.
-
This property is initialized by the value of the
:variable:`CMAKE_AUTOUIC_OPTIONS` variable if it is set when a target is
-created.
+created, or an empty string otherwise.
The options set on the target may be overridden by :prop_sf:`AUTOUIC_OPTIONS`
set on the ``.ui`` source file.
diff --git a/Help/prop_tgt/DEPRECATION.rst b/Help/prop_tgt/DEPRECATION.rst
new file mode 100644
index 0000000..fef2e2e
--- /dev/null
+++ b/Help/prop_tgt/DEPRECATION.rst
@@ -0,0 +1,7 @@
+DEPRECATION
+-----------
+
+Deprecation message from imported target's developer.
+
+``DEPRECATION`` is the message regarding a deprecation status to be displayed
+to downstream users of a target.
diff --git a/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst b/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst
index 23af503..a6f2b24 100644
--- a/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst
+++ b/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst
@@ -2,7 +2,7 @@
------------------------
This property is implemented only when ``<LANG>`` is ``C``, ``CXX``,
-``Fortran``, or ``CUDA``.
+``Fortran``, ``OBJC``, ``OBJCXX``, or ``CUDA``.
Specify a :ref:`semicolon-separated list <CMake Language Lists>` containing a command line
for a compiler launching tool. The :ref:`Makefile Generators` and the
diff --git a/Help/release/dev/FindPython-SOABI.rst b/Help/release/dev/FindPython-SOABI.rst
new file mode 100644
index 0000000..29f7292
--- /dev/null
+++ b/Help/release/dev/FindPython-SOABI.rst
@@ -0,0 +1,6 @@
+FindPython-SOABI
+----------------
+
+* The :module:`FindPython3` and :module:`FindPython` modules gained,
+ respectively, variable ``Python3_SOABI`` and ``Python_SOABI`` giving
+ the standard extension suffix for modules.
diff --git a/Help/release/dev/FindPythonConda-module.rst b/Help/release/dev/FindPythonConda-module.rst
new file mode 100644
index 0000000..d762fbf
--- /dev/null
+++ b/Help/release/dev/FindPythonConda-module.rst
@@ -0,0 +1,5 @@
+FindPythonConda-module
+----------------------
+
+* The :module:`FindPython` module has learned to find Python components in active
+ virtual environments managed by ``conda``.
diff --git a/Help/release/dev/add_target_deprecation.rst b/Help/release/dev/add_target_deprecation.rst
new file mode 100644
index 0000000..b91eca9
--- /dev/null
+++ b/Help/release/dev/add_target_deprecation.rst
@@ -0,0 +1,7 @@
+add_target_deprecation
+----------------------
+
+* A :prop_tgt:`DEPRECATION` target property was added to mark
+ a target as deprecated. If a linked target is marked as
+ deprecated, a warning with the deprecation message is issued
+ at generate time.
diff --git a/Help/release/dev/autogen_hh_headers.rst b/Help/release/dev/autogen_hh_headers.rst
new file mode 100644
index 0000000..35ccd61
--- /dev/null
+++ b/Help/release/dev/autogen_hh_headers.rst
@@ -0,0 +1,6 @@
+autogen_hh_headers
+------------------
+
+* :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC` learned to process headers with
+ a ``.hh`` extension. The new behavior is enabled by policy
+ :policy:`CMP0100`.
diff --git a/Help/release/dev/command_debug_find.rst b/Help/release/dev/command_debug_find.rst
new file mode 100644
index 0000000..673852c
--- /dev/null
+++ b/Help/release/dev/command_debug_find.rst
@@ -0,0 +1,10 @@
+cmake-debug-find
+----------------
+
+* :manual:`cmake(1)` gained a ``--debug-find`` command line
+ option that can be used to provide information on where find
+ commands searched.
+
+* Variable :variable:`CMAKE_FIND_DEBUG_MODE` was introduced to
+ print extra find call information during the cmake run to standard
+ error. Output is designed for human consumption and not for parsing.
diff --git a/Help/release/dev/json_trace.rst b/Help/release/dev/json_trace.rst
new file mode 100644
index 0000000..69a1fb7
--- /dev/null
+++ b/Help/release/dev/json_trace.rst
@@ -0,0 +1,7 @@
+json-trace
+----------
+
+* :manual:`cmake(1)` gained a ``--trace-format`` command line option that
+ can be used to set the ``--trace`` output format. Currently, the old
+ human readable and the new JSON format are supported. The new JSON format
+ is easier to parse automatically, than the existing format.
diff --git a/Help/release/dev/ninja-postgen-commands.rst b/Help/release/dev/ninja-postgen-commands.rst
new file mode 100644
index 0000000..85b60dc
--- /dev/null
+++ b/Help/release/dev/ninja-postgen-commands.rst
@@ -0,0 +1,5 @@
+ninja-postgen-commands
+----------------------
+
+* The :generator:`Ninja` generator learned to perform some post-processing on
+ the generated files for more consistent builds.
diff --git a/Help/release/dev/xmllint-target.rst b/Help/release/dev/xmllint-target.rst
new file mode 100644
index 0000000..19c69bf
--- /dev/null
+++ b/Help/release/dev/xmllint-target.rst
@@ -0,0 +1,4 @@
+xmllint-target
+--------------
+
+* The :module:`FindLibXml2` module now provides an imported target for the xmllint executable
diff --git a/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst b/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst
index e5dda60..c76e2d0 100644
--- a/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst
+++ b/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst
@@ -4,7 +4,7 @@ CMAKE_<LANG>_COMPILER_LAUNCHER
Default value for :prop_tgt:`<LANG>_COMPILER_LAUNCHER` target property.
This variable is used to initialize the property on each target as it is
created. This is done only when ``<LANG>`` is ``C``, ``CXX``, ``Fortran``,
-or ``CUDA``.
+``OBJC``, ``OBJCXX``, or ``CUDA``.
This variable is initialized to the :envvar:`CMAKE_<LANG>_COMPILER_LAUNCHER`
environment variable if it is set.
diff --git a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
index e1ce617..2dc75d6 100644
--- a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
+++ b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
@@ -9,6 +9,7 @@
macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR)
set(${_VAR}
FAIL_REGEX "[Uu]nrecogni[sz]ed .*option" # GNU, NAG
+ FAIL_REGEX "switch .* is no longer supported" # GNU
FAIL_REGEX "unknown .*option" # Clang
FAIL_REGEX "optimization flag .* not supported" # Clang
FAIL_REGEX "unknown argument ignored" # Clang (cl)
diff --git a/Modules/CMakeOBJCInformation.cmake b/Modules/CMakeOBJCInformation.cmake
index cb61cb8..15a3311 100644
--- a/Modules/CMakeOBJCInformation.cmake
+++ b/Modules/CMakeOBJCInformation.cmake
@@ -110,6 +110,11 @@ if(CMAKE_OBJC_STANDARD_LIBRARIES_INIT)
mark_as_advanced(CMAKE_OBJC_STANDARD_LIBRARIES)
endif()
+if(NOT CMAKE_OBJC_COMPILER_LAUNCHER AND DEFINED ENV{CMAKE_OBJC_COMPILER_LAUNCHER})
+ set(CMAKE_OBJC_COMPILER_LAUNCHER "$ENV{CMAKE_OBJC_COMPILER_LAUNCHER}"
+ CACHE STRING "Compiler launcher for OBJC.")
+endif()
+
include(CMakeCommonLanguageInclude)
# now define the following rule variables
diff --git a/Modules/CMakeOBJCXXInformation.cmake b/Modules/CMakeOBJCXXInformation.cmake
index 71ac26a..cb349d7 100644
--- a/Modules/CMakeOBJCXXInformation.cmake
+++ b/Modules/CMakeOBJCXXInformation.cmake
@@ -203,6 +203,11 @@ if(CMAKE_OBJCXX_STANDARD_LIBRARIES_INIT)
mark_as_advanced(CMAKE_OBJCXX_STANDARD_LIBRARIES)
endif()
+if(NOT CMAKE_OBJCXX_COMPILER_LAUNCHER AND DEFINED ENV{CMAKE_OBJCXX_COMPILER_LAUNCHER})
+ set(CMAKE_OBJCXX_COMPILER_LAUNCHER "$ENV{CMAKE_OBJCXX_COMPILER_LAUNCHER}"
+ CACHE STRING "Compiler launcher for OBJCXX.")
+endif()
+
include(CMakeCommonLanguageInclude)
# now define the following rules:
diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake
index 2c54da0..672d3f8 100644
--- a/Modules/CMakeSwiftInformation.cmake
+++ b/Modules/CMakeSwiftInformation.cmake
@@ -72,10 +72,6 @@ if(NOT CMAKE_Swift_NUM_THREADS MATCHES "^[0-9]+$")
cmake_host_system_information(RESULT CMAKE_Swift_NUM_THREADS QUERY NUMBER_OF_LOGICAL_CORES)
endif()
-if(CMAKE_SYSTEM_NAME STREQUAL Windows)
- set(CMAKE_Swift_IMPLIB_LINKER_FLAGS "-Xlinker -implib:<TARGET_IMPLIB>")
-endif()
-
if(NOT CMAKE_Swift_CREATE_SHARED_LIBRARY)
set(CMAKE_Swift_CREATE_SHARED_LIBRARY "<CMAKE_Swift_COMPILER> -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -j ${CMAKE_Swift_NUM_THREADS} -emit-library -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> ${CMAKE_Swift_IMPLIB_LINKER_FLAGS} <LINK_LIBRARIES>")
endif()
diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake
index da8bfe0..f551dfe 100644
--- a/Modules/FindLibXml2.cmake
+++ b/Modules/FindLibXml2.cmake
@@ -10,8 +10,12 @@ Find the XML processing library (libxml2).
IMPORTED Targets
^^^^^^^^^^^^^^^^
-This module defines :prop_tgt:`IMPORTED` target ``LibXml2::LibXml2``, if
-libxml2 has been found.
+The following :prop_tgt:`IMPORTED` targets may be defined:
+
+``LibXml2::LibXml2``
+ If the libxml2 library has been found
+``LibXml2::xmllint``
+ If the xmllint command-line executable has been found
Result variables
^^^^^^^^^^^^^^^^
@@ -48,7 +52,6 @@ The following cache variables may also be set:
# in the find_path() and find_library() calls
find_package(PkgConfig QUIET)
PKG_CHECK_MODULES(PC_LIBXML QUIET libxml-2.0)
-set(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER})
find_path(LIBXML2_INCLUDE_DIR NAMES libxml/xpath.h
HINTS
@@ -74,9 +77,7 @@ find_program(LIBXML2_XMLLINT_EXECUTABLE xmllint)
# for backwards compat. with KDE 4.0.x:
set(XMLLINT_EXECUTABLE "${LIBXML2_XMLLINT_EXECUTABLE}")
-if(PC_LIBXML_VERSION)
- set(LIBXML2_VERSION_STRING ${PC_LIBXML_VERSION})
-elseif(LIBXML2_INCLUDE_DIR AND EXISTS "${LIBXML2_INCLUDE_DIR}/libxml/xmlversion.h")
+if(LIBXML2_INCLUDE_DIR AND EXISTS "${LIBXML2_INCLUDE_DIR}/libxml/xmlversion.h")
file(STRINGS "${LIBXML2_INCLUDE_DIR}/libxml/xmlversion.h" libxml2_version_str
REGEX "^#define[\t ]+LIBXML_DOTTED_VERSION[\t ]+\".*\"")
@@ -85,9 +86,20 @@ elseif(LIBXML2_INCLUDE_DIR AND EXISTS "${LIBXML2_INCLUDE_DIR}/libxml/xmlversion.
unset(libxml2_version_str)
endif()
-set(LIBXML2_INCLUDE_DIRS ${LIBXML2_INCLUDE_DIR} ${PC_LIBXML_INCLUDE_DIRS})
+set(LIBXML2_INCLUDE_DIRS ${LIBXML2_INCLUDE_DIR})
set(LIBXML2_LIBRARIES ${LIBXML2_LIBRARY})
+# Did we find the same installation as pkg-config?
+# If so, use additional information from it.
+unset(LIBXML2_DEFINITIONS)
+foreach(libxml2_pc_lib_dir IN LISTS PC_LIBXML_LIBDIR PC_LIBXML_LIBRARY_DIRS)
+ if (LIBXML2_LIBRARY MATCHES "^${libxml2_pc_lib_dir}")
+ list(APPEND LIBXML2_INCLUDE_DIRS ${PC_LIBXML_INCLUDE_DIRS})
+ set(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER})
+ break()
+ endif()
+endforeach()
+
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2
REQUIRED_VARS LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR
@@ -98,5 +110,11 @@ mark_as_advanced(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARY LIBXML2_XMLLINT_EXECUTABLE)
if(LibXml2_FOUND AND NOT TARGET LibXml2::LibXml2)
add_library(LibXml2::LibXml2 UNKNOWN IMPORTED)
set_target_properties(LibXml2::LibXml2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBXML2_INCLUDE_DIRS}")
+ set_target_properties(LibXml2::LibXml2 PROPERTIES INTERFACE_COMPILE_OPTIONS "${LIBXML2_DEFINITIONS}")
set_property(TARGET LibXml2::LibXml2 APPEND PROPERTY IMPORTED_LOCATION "${LIBXML2_LIBRARY}")
endif()
+
+if(LIBXML2_XMLLINT_EXECUTABLE AND NOT TARGET LibXml2::xmllint)
+ add_executable(LibXml2::xmllint IMPORTED)
+ set_target_properties(LibXml2::xmllint PROPERTIES IMPORTED_LOCATION "${LIBXML2_XMLLINT_EXECUTABLE}")
+endif()
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index 3688ae9..043fc6c 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -65,7 +65,7 @@ macro(_OpenSSL_test_and_find_dependencies ssl_library crypto_library)
endif()
endmacro()
-function(_OpenSSL_add_dependencies libraries_var library)
+function(_OpenSSL_add_dependencies libraries_var)
if(CMAKE_THREAD_LIBS_INIT)
list(APPEND ${libraries_var} ${CMAKE_THREAD_LIBS_INIT})
endif()
@@ -341,13 +341,14 @@ else()
endif()
-# compat defines
set(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY})
set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
+set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARIES} )
_OpenSSL_test_and_find_dependencies("${OPENSSL_SSL_LIBRARY}" "${OPENSSL_CRYPTO_LIBRARY}")
if(_OpenSSL_has_dependencies)
- _OpenSSL_add_dependencies( OPENSSL_SSL_LIBRARIES "${OPENSSL_SSL_LIBRARY}" )
- _OpenSSL_add_dependencies( OPENSSL_CRYPTO_LIBRARIES "${OPENSSL_CRYPTO_LIBRARY}" )
+ _OpenSSL_add_dependencies( OPENSSL_SSL_LIBRARIES )
+ _OpenSSL_add_dependencies( OPENSSL_CRYPTO_LIBRARIES )
+ _OpenSSL_add_dependencies( OPENSSL_LIBRARIES )
endif()
function(from_hex HEX DEC)
@@ -417,9 +418,6 @@ if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
endif ()
endif ()
-set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARIES} )
-list(REMOVE_DUPLICATES OPENSSL_LIBRARIES)
-
foreach(_comp IN LISTS OpenSSL_FIND_COMPONENTS)
if(_comp STREQUAL "Crypto")
if(EXISTS "${OPENSSL_INCLUDE_DIR}" AND
diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake
index 2bdfaf3..be272e1 100644
--- a/Modules/FindPython.cmake
+++ b/Modules/FindPython.cmake
@@ -93,6 +93,13 @@ This module will set the following variables in your project
Information returned by
``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)``.
+``Python_SOABI``
+ Extension suffix for modules.
+
+ Information returned by
+ ``distutils.sysconfig.get_config_flag('SOABI')`` or computed from
+ ``distutils.sysconfig.get_config_flag('EXT_SUFFIX')`` or
+ ``python-config --extension-suffix``.
``Python_Compiler_FOUND``
System has the Python compiler.
``Python_COMPILER``
@@ -220,12 +227,12 @@ Hints
variable will be used, if any.
``Python_FIND_VIRTUALENV``
- This variable defines the handling of virtual environments. It is meaningfull
- only when a virtual environment is active (i.e. the ``activate`` script has
- been evaluated). In this case, it takes precedence over
- ``Python_FIND_REGISTRY`` and ``CMAKE_FIND_FRAMEWORK`` variables.
- The ``Python_FIND_VIRTUALENV`` variable can be set to empty or one of the
- following:
+ This variable defines the handling of virtual environments managed by
+ ``virtualenv`` or ``conda``. It is meaningful only when a virtual environment
+ is active (i.e. the ``activate`` script has been evaluated). In this case, it
+ takes precedence over ``Python_FIND_REGISTRY`` and ``CMAKE_FIND_FRAMEWORK``
+ variables. The ``Python_FIND_VIRTUALENV`` variable can be set to empty or
+ one of the following:
* ``FIRST``: The virtual environment is used before any other standard
paths to look-up for the interpreter. This is the default.
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index 89744ec..086b229 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -244,12 +244,16 @@ endfunction()
function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
unset (${_PYTHON_PGCV_VALUE} PARENT_SCOPE)
- if (NOT NAME MATCHES "^(PREFIX|ABIFLAGS|CONFIGDIR|INCLUDES|LIBS)$")
+ if (NOT NAME MATCHES "^(PREFIX|ABIFLAGS|CONFIGDIR|INCLUDES|LIBS|SOABI)$")
return()
endif()
if (_${_PYTHON_PREFIX}_CONFIG)
- set (config_flag "--${NAME}")
+ if (NAME STREQUAL "SOABI")
+ set (config_flag "--extension-suffix")
+ else()
+ set (config_flag "--${NAME}")
+ endif()
string (TOLOWER "${config_flag}" config_flag)
execute_process (COMMAND "${_${_PYTHON_PREFIX}_CONFIG}" ${config_flag}
RESULT_VARIABLE _result
@@ -264,6 +268,9 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
string (REGEX MATCHALL "(-I|-iwithsysroot)[ ]*[^ ]+" _values "${_values}")
string (REGEX REPLACE "(-I|-iwithsysroot)[ ]*" "" _values "${_values}")
list (REMOVE_DUPLICATES _values)
+ elseif (NAME STREQUAL "SOABI")
+ # clean-up: remove prefix character and suffix
+ string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\.(so|pyd))$" "\\1" _values "${_values}")
endif()
endif()
endif()
@@ -289,6 +296,25 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
if (_result)
unset (_values)
endif()
+ elseif (NAME STREQUAL "SOABI")
+ execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys; from distutils import sysconfig;sys.stdout.write(';'.join([sysconfig.get_config_var('SOABI') or '',sysconfig.get_config_var('EXT_SUFFIX') or '']))"
+ RESULT_VARIABLE _result
+ OUTPUT_VARIABLE _soabi
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if (_result)
+ unset (_values)
+ else()
+ list (GET _soabi 0 _values)
+ if (NOT _values)
+ # try to compute SOABI from EXT_SUFFIX
+ list (GET _soabi 1 _values)
+ if (_values)
+ # clean-up: remove prefix character and suffix
+ string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\.(so|pyd))$" "\\1" _values "${_values}")
+ endif()
+ endif()
+ endif()
else()
set (config_flag "${NAME}")
if (NAME STREQUAL "CONFIGDIR")
@@ -745,6 +771,7 @@ else()
_python_get_abiflags (_${_PYTHON_PREFIX}_ABIFLAGS)
endif()
endif()
+unset (${_PYTHON_PREFIX}_SOABI)
# Define lookup strategy
if (_${_PYTHON_PREFIX}_LOOKUP_POLICY STREQUAL "NEW")
@@ -834,8 +861,8 @@ else()
set (_${_PYTHON_PREFIX}_FIND_REGISTRY "FIRST")
endif()
-# virtual environments handling
-if (DEFINED ENV{VIRTUAL_ENV})
+# virtual environments recognition
+if (DEFINED ENV{VIRTUAL_ENV} OR DEFINED ENV{CONDA_PREFIX})
if (DEFINED ${_PYTHON_PREFIX}_FIND_VIRTUALENV)
if (NOT ${_PYTHON_PREFIX}_FIND_VIRTUALENV MATCHES "^(FIRST|ONLY|STANDARD)$")
message (AUTHOR_WARNING "Find${_PYTHON_PREFIX}: ${${_PYTHON_PREFIX}_FIND_VIRTUALENV}: invalid value for '${_PYTHON_PREFIX}_FIND_VIRTUALENV'. 'FIRST', 'ONLY' or 'STANDARD' expected. 'FIRST' will be used instead.")
@@ -930,7 +957,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
NAMES ${_${_PYTHON_PREFIX}_NAMES}
NAMES_PER_DIR
HINTS ${_${_PYTHON_PREFIX}_HINTS}
- PATHS ENV VIRTUAL_ENV
+ PATHS ENV VIRTUAL_ENV ENV CONDA_PREFIX
PATH_SUFFIXES bin Scripts
NO_CMAKE_PATH
NO_CMAKE_ENVIRONMENT_PATH
@@ -1050,7 +1077,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
NAMES ${_${_PYTHON_PREFIX}_NAMES}
NAMES_PER_DIR
HINTS ${_${_PYTHON_PREFIX}_HINTS}
- PATHS ENV VIRTUAL_ENV
+ PATHS ENV VIRTUAL_ENV ENV CONDA_PREFIX
PATH_SUFFIXES bin Scripts
NO_CMAKE_PATH
NO_CMAKE_ENVIRONMENT_PATH
@@ -1267,7 +1294,6 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
# retrieve various package installation directories
execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys; from distutils import sysconfig;sys.stdout.write(';'.join([sysconfig.get_python_lib(plat_specific=False,standard_lib=True),sysconfig.get_python_lib(plat_specific=True,standard_lib=True),sysconfig.get_python_lib(plat_specific=False,standard_lib=False),sysconfig.get_python_lib(plat_specific=True,standard_lib=False)]))"
-
RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
OUTPUT_VARIABLE _${_PYTHON_PREFIX}_LIBPATHS
ERROR_QUIET)
@@ -1282,6 +1308,10 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
unset (${_PYTHON_PREFIX}_SITELIB)
unset (${_PYTHON_PREFIX}_SITEARCH)
endif()
+
+ if (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR VERSION_GREATER_EQUAL 3)
+ _python_get_config_var (${_PYTHON_PREFIX}_SOABI SOABI)
+ endif()
else()
unset (_${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE CACHE)
unset (${_PYTHON_PREFIX}_INTERPRETER_ID)
@@ -1522,9 +1552,13 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
unset (_${_PYTHON_PREFIX}_LIBRARY_RELEASE CACHE)
unset (_${_PYTHON_PREFIX}_LIBRARY_DEBUG CACHE)
unset (_${_PYTHON_PREFIX}_INCLUDE_DIR CACHE)
- unset (_${_PYTHON_PREFIX}_DEVELOPMENT_SIGNATURE CACHE)
endif()
endif()
+ if (NOT _${_PYTHON_PREFIX}_LIBRARY_RELEASE OR NOT _${_PYTHON_PREFIX}_INCLUDE_DIR)
+ unset (_${_PYTHON_PREFIX}_CONFIG CACHE)
+ unset (_${_PYTHON_PREFIX}_DEVELOPMENT_SIGNATURE CACHE)
+ endif()
+
if (DEFINED ${_PYTHON_PREFIX}_LIBRARY
AND IS_ABSOLUTE "${${_PYTHON_PREFIX}_LIBRARY}")
set (_${_PYTHON_PREFIX}_LIBRARY_RELEASE "${${_PYTHON_PREFIX}_LIBRARY}" CACHE INTERNAL "")
@@ -1555,7 +1589,7 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
set (_${_PYTHON_PREFIX}_HINTS "${${_PYTHON_PREFIX}_ROOT_DIR}" ENV ${_PYTHON_PREFIX}_ROOT_DIR)
unset (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS)
if (_${_PYTHON_PREFIX}_FIND_VIRTUALENV MATCHES "^(FIRST|ONLY)$")
- set (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS ENV VIRTUAL_ENV)
+ set (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS ENV VIRTUAL_ENV ENV CONDA_PREFIX)
endif()
unset (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS)
@@ -1786,7 +1820,7 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
unset (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS)
if (_${_PYTHON_PREFIX}_FIND_VIRTUALENV MATCHES "^(FIRST|ONLY)$")
- set (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS ENV VIRTUAL_ENV)
+ set (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS ENV VIRTUAL_ENV ENV CONDA_PREFIX)
endif()
if (_${_PYTHON_PREFIX}_FIND_STRATEGY STREQUAL "LOCATION")
@@ -2007,7 +2041,7 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
if (NOT _${_PYTHON_PREFIX}_INCLUDE_DIR)
unset (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS)
if (_${_PYTHON_PREFIX}_FIND_VIRTUALENV MATCHES "^(FIRST|ONLY)$")
- set (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS ENV VIRTUAL_ENV)
+ set (_${_PYTHON_PREFIX}_VIRTUALENV_PATHS ENV VIRTUAL_ENV ENV CONDA_PREFIX)
endif()
unset (_${_PYTHON_PREFIX}_INCLUDE_HINTS)
@@ -2148,6 +2182,11 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
endif()
endif()
+ if (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR VERSION_GREATER_EQUAL 3
+ AND NOT DEFINED ${_PYTHON_PREFIX}_SOABI)
+ _python_get_config_var (${_PYTHON_PREFIX}_SOABI SOABI)
+ endif()
+
if (${_PYTHON_PREFIX}_Development_FOUND)
# compute and save development signature
string (MD5 __${_PYTHON_PREFIX}_DEVELOPMENT_SIGNATURE "${_${_PYTHON_PREFIX}_SIGNATURE}:${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}:${_${_PYTHON_PREFIX}_INCLUDE_DIR}")
@@ -2166,6 +2205,7 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE
${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG
_${_PYTHON_PREFIX}_INCLUDE_DIR
+ _${_PYTHON_PREFIX}_CONFIG
_${_PYTHON_PREFIX}_DEVELOPMENT_SIGNATURE)
endif()
@@ -2425,5 +2465,3 @@ if (DEFINED _${_PYTHON_PREFIX}_CMAKE_FIND_FRAMEWORK)
else()
unset (CMAKE_FIND_FRAMEWORK)
endif()
-
-unset (_${_PYTHON_PREFIX}_CONFIG CACHE)
diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake
index 3cc7d56..9d4eda2 100644
--- a/Modules/FindPython2.cmake
+++ b/Modules/FindPython2.cmake
@@ -176,12 +176,12 @@ Hints
variable will be used, if any.
``Python2_FIND_VIRTUALENV``
- This variable defines the handling of virtual environments. It is meaningfull
- only when a virtual environment is active (i.e. the ``activate`` script has
- been evaluated). In this case, it takes precedence over
- ``Python2_FIND_REGISTRY`` and ``CMAKE_FIND_FRAMEWORK`` variables.
- The ``Python2_FIND_VIRTUALENV`` variable can be set to empty or one of the
- following:
+ This variable defines the handling of virtual environments managed by
+ ``virtualenv`` or ``conda``. It is meaningful only when a virtual environment
+ is active (i.e. the ``activate`` script has been evaluated). In this case, it
+ takes precedence over ``Python2_FIND_REGISTRY`` and ``CMAKE_FIND_FRAMEWORK``
+ variables. The ``Python2_FIND_VIRTUALENV`` variable can be set to empty or
+ one of the following:
* ``FIRST``: The virtual environment is used before any other standard
paths to look-up for the interpreter. This is the default.
diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake
index 066d0df..00c354e 100644
--- a/Modules/FindPython3.cmake
+++ b/Modules/FindPython3.cmake
@@ -94,6 +94,13 @@ This module will set the following variables in your project
Information returned by
``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)``.
+``Python3_SOABI``
+ Extension suffix for modules.
+
+ Information returned by
+ ``distutils.sysconfig.get_config_flag('SOABI')`` or computed from
+ ``distutils.sysconfig.get_config_flag('EXT_SUFFIX')`` or
+ ``python3-config --extension-suffix``.
``Python3_Compiler_FOUND``
System has the Python 3 compiler.
``Python3_COMPILER``
@@ -217,12 +224,12 @@ Hints
variable will be used, if any.
``Python3_FIND_VIRTUALENV``
- This variable defines the handling of virtual environments. It is meaningfull
- only when a virtual environment is active (i.e. the ``activate`` script has
- been evaluated). In this case, it takes precedence over
- ``Python3_FIND_REGISTRY`` and ``CMAKE_FIND_FRAMEWORK`` variables.
- The ``Python3_FIND_VIRTUALENV`` variable can be set to empty or one of the
- following:
+ This variable defines the handling of virtual environments managed by
+ ``virtualenv`` or ``conda``. It is meaningful only when a virtual environment
+ is active (i.e. the ``activate`` script has been evaluated). In this case, it
+ takes precedence over ``Python3_FIND_REGISTRY`` and ``CMAKE_FIND_FRAMEWORK``
+ variables. The ``Python3_FIND_VIRTUALENV`` variable can be set to empty or
+ one of the following:
* ``FIRST``: The virtual environment is used before any other standard
paths to look-up for the interpreter. This is the default.
diff --git a/Modules/Platform/Windows-Apple-Swift.cmake b/Modules/Platform/Windows-Apple-Swift.cmake
new file mode 100644
index 0000000..1177755
--- /dev/null
+++ b/Modules/Platform/Windows-Apple-Swift.cmake
@@ -0,0 +1 @@
+set(CMAKE_Swift_IMPLIB_LINKER_FLAGS "-Xlinker -implib:<TARGET_IMPLIB>")
diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake
index cf85367..235d9ce 100644
--- a/Modules/Platform/Windows-GNU.cmake
+++ b/Modules/Platform/Windows-GNU.cmake
@@ -152,7 +152,7 @@ macro(__windows_compiler_gnu_abi lang)
# Query the VS Installer tool for locations of VS 2017 and above.
set(_vs_installer_paths "")
- foreach(vs RANGE 15 15 -1) # change the first number to the largest supported version
+ foreach(vs RANGE 16 15 -1) # change the first number to the largest supported version
cmake_host_system_information(RESULT _vs_dir QUERY VS_${vs}_DIR)
if(_vs_dir)
list(APPEND _vs_installer_paths "${_vs_dir}/VC/Auxiliary/Build")
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index f91199a..0b2979b 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 16)
-set(CMake_VERSION_PATCH 20191222)
+set(CMake_VERSION_PATCH 20200110)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 9530227..6003493 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -616,9 +616,9 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
buildConfigs.emplace_back();
}
- std::unique_ptr<cmGlobalGenerator> globalGenerator(
+ std::unique_ptr<cmGlobalGenerator> globalGenerator =
this->MakefileMap->GetCMakeInstance()->CreateGlobalGenerator(
- cmakeGenerator));
+ cmakeGenerator);
if (!globalGenerator) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Specified package generator not found. "
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index 2ad661c..5e29386 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -215,11 +215,11 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
if (this->BuildNoCMake) {
// Make the generator available for the Build call below.
- cmGlobalGenerator* gen = cm.CreateGlobalGenerator(this->BuildGenerator);
- cm.SetGlobalGenerator(gen);
+ cm.SetGlobalGenerator(cm.CreateGlobalGenerator(this->BuildGenerator));
if (!this->BuildGeneratorPlatform.empty()) {
- cmMakefile mf(gen, cm.GetCurrentSnapshot());
- if (!gen->SetGeneratorPlatform(this->BuildGeneratorPlatform, &mf)) {
+ cmMakefile mf(cm.GetGlobalGenerator(), cm.GetCurrentSnapshot());
+ if (!cm.GetGlobalGenerator()->SetGeneratorPlatform(
+ this->BuildGeneratorPlatform, &mf)) {
return 1;
}
}
diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx
index 18df214..d1b7701 100644
--- a/Source/CTest/cmCTestBuildCommand.cxx
+++ b/Source/CTest/cmCTestBuildCommand.cxx
@@ -29,13 +29,7 @@ void cmCTestBuildCommand::BindArguments()
this->Bind("PROJECT_NAME"_s, this->ProjectName);
}
-cmCTestBuildCommand::~cmCTestBuildCommand()
-{
- if (this->GlobalGenerator) {
- delete this->GlobalGenerator;
- this->GlobalGenerator = nullptr;
- }
-}
+cmCTestBuildCommand::~cmCTestBuildCommand() = default;
cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
{
@@ -79,8 +73,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
}
if (this->GlobalGenerator) {
if (this->GlobalGenerator->GetName() != cmakeGeneratorName) {
- delete this->GlobalGenerator;
- this->GlobalGenerator = nullptr;
+ this->GlobalGenerator.reset();
}
}
if (!this->GlobalGenerator) {
diff --git a/Source/CTest/cmCTestBuildCommand.h b/Source/CTest/cmCTestBuildCommand.h
index da00a43..0f82817 100644
--- a/Source/CTest/cmCTestBuildCommand.h
+++ b/Source/CTest/cmCTestBuildCommand.h
@@ -48,7 +48,7 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
- cmGlobalGenerator* GlobalGenerator = nullptr;
+ std::unique_ptr<cmGlobalGenerator> GlobalGenerator;
protected:
cmCTestBuildHandler* Handler;
diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx
index f2f42b4..3854710 100644
--- a/Source/CTest/cmCTestConfigureCommand.cxx
+++ b/Source/CTest/cmCTestConfigureCommand.cxx
@@ -69,12 +69,11 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
bool multiConfig = false;
bool cmakeBuildTypeInOptions = false;
- cmGlobalGenerator* gg =
- this->Makefile->GetCMakeInstance()->CreateGlobalGenerator(
- cmakeGeneratorName);
+ auto gg = this->Makefile->GetCMakeInstance()->CreateGlobalGenerator(
+ cmakeGeneratorName);
if (gg) {
multiConfig = gg->IsMultiConfig();
- delete gg;
+ gg.reset();
}
std::string cmakeConfigureCommand =
diff --git a/Source/CTest/cmCTestResourceSpec.cxx b/Source/CTest/cmCTestResourceSpec.cxx
index 237a745..8f91efb 100644
--- a/Source/CTest/cmCTestResourceSpec.cxx
+++ b/Source/CTest/cmCTestResourceSpec.cxx
@@ -16,21 +16,22 @@
static const cmsys::RegularExpression IdentifierRegex{ "^[a-z_][a-z0-9_]*$" };
static const cmsys::RegularExpression IdRegex{ "^[a-z0-9_]+$" };
-bool cmCTestResourceSpec::ReadFromJSONFile(const std::string& filename)
+cmCTestResourceSpec::ReadFileResult cmCTestResourceSpec::ReadFromJSONFile(
+ const std::string& filename)
{
cmsys::ifstream fin(filename.c_str());
if (!fin) {
- return false;
+ return ReadFileResult::FILE_NOT_FOUND;
}
Json::Value root;
Json::CharReaderBuilder builder;
if (!Json::parseFromStream(builder, fin, &root, nullptr)) {
- return false;
+ return ReadFileResult::JSON_PARSE_ERROR;
}
if (!root.isObject()) {
- return false;
+ return ReadFileResult::INVALID_ROOT;
}
int majorVersion = 1;
@@ -39,42 +40,42 @@ bool cmCTestResourceSpec::ReadFromJSONFile(const std::string& filename)
auto const& version = root["version"];
if (version.isObject()) {
if (!version.isMember("major") || !version.isMember("minor")) {
- return false;
+ return ReadFileResult::INVALID_VERSION;
}
auto const& major = version["major"];
auto const& minor = version["minor"];
if (!major.isInt() || !minor.isInt()) {
- return false;
+ return ReadFileResult::INVALID_VERSION;
}
majorVersion = major.asInt();
minorVersion = minor.asInt();
} else {
- return false;
+ return ReadFileResult::INVALID_VERSION;
}
} else {
- return false;
+ return ReadFileResult::NO_VERSION;
}
if (majorVersion != 1 || minorVersion != 0) {
- return false;
+ return ReadFileResult::UNSUPPORTED_VERSION;
}
auto const& local = root["local"];
if (!local.isArray()) {
- return false;
+ return ReadFileResult::INVALID_SOCKET_SPEC;
}
if (local.size() > 1) {
- return false;
+ return ReadFileResult::INVALID_SOCKET_SPEC;
}
if (local.empty()) {
this->LocalSocket.Resources.clear();
- return true;
+ return ReadFileResult::READ_OK;
}
auto const& localSocket = local[0];
if (!localSocket.isObject()) {
- return false;
+ return ReadFileResult::INVALID_SOCKET_SPEC;
}
std::map<std::string, std::vector<cmCTestResourceSpec::Resource>> resources;
cmsys::RegularExpressionMatch match;
@@ -88,21 +89,21 @@ bool cmCTestResourceSpec::ReadFromJSONFile(const std::string& filename)
cmCTestResourceSpec::Resource resource;
if (!item.isMember("id")) {
- return false;
+ return ReadFileResult::INVALID_RESOURCE;
}
auto const& id = item["id"];
if (!id.isString()) {
- return false;
+ return ReadFileResult::INVALID_RESOURCE;
}
resource.Id = id.asString();
if (!IdRegex.find(resource.Id.c_str(), match)) {
- return false;
+ return ReadFileResult::INVALID_RESOURCE;
}
if (item.isMember("slots")) {
auto const& capacity = item["slots"];
if (!capacity.isConvertibleTo(Json::uintValue)) {
- return false;
+ return ReadFileResult::INVALID_RESOURCE;
}
resource.Capacity = capacity.asUInt();
} else {
@@ -111,17 +112,55 @@ bool cmCTestResourceSpec::ReadFromJSONFile(const std::string& filename)
r.push_back(resource);
} else {
- return false;
+ return ReadFileResult::INVALID_RESOURCE;
}
}
} else {
- return false;
+ return ReadFileResult::INVALID_RESOURCE_TYPE;
}
}
}
this->LocalSocket.Resources = std::move(resources);
- return true;
+ return ReadFileResult::READ_OK;
+}
+
+const char* cmCTestResourceSpec::ResultToString(ReadFileResult result)
+{
+ switch (result) {
+ case ReadFileResult::READ_OK:
+ return "OK";
+
+ case ReadFileResult::FILE_NOT_FOUND:
+ return "File not found";
+
+ case ReadFileResult::JSON_PARSE_ERROR:
+ return "JSON parse error";
+
+ case ReadFileResult::INVALID_ROOT:
+ return "Invalid root object";
+
+ case ReadFileResult::NO_VERSION:
+ return "No version specified";
+
+ case ReadFileResult::INVALID_VERSION:
+ return "Invalid version object";
+
+ case ReadFileResult::UNSUPPORTED_VERSION:
+ return "Unsupported version";
+
+ case ReadFileResult::INVALID_SOCKET_SPEC:
+ return "Invalid socket object";
+
+ case ReadFileResult::INVALID_RESOURCE_TYPE:
+ return "Invalid resource type object";
+
+ case ReadFileResult::INVALID_RESOURCE:
+ return "Invalid resource object";
+
+ default:
+ return "Unknown";
+ }
}
bool cmCTestResourceSpec::operator==(const cmCTestResourceSpec& other) const
diff --git a/Source/CTest/cmCTestResourceSpec.h b/Source/CTest/cmCTestResourceSpec.h
index 4646db8..cb242c0 100644
--- a/Source/CTest/cmCTestResourceSpec.h
+++ b/Source/CTest/cmCTestResourceSpec.h
@@ -31,7 +31,22 @@ public:
Socket LocalSocket;
- bool ReadFromJSONFile(const std::string& filename);
+ enum class ReadFileResult
+ {
+ READ_OK,
+ FILE_NOT_FOUND,
+ JSON_PARSE_ERROR,
+ INVALID_ROOT,
+ NO_VERSION,
+ INVALID_VERSION,
+ UNSUPPORTED_VERSION,
+ INVALID_SOCKET_SPEC, // Can't be INVALID_SOCKET due to a Windows macro
+ INVALID_RESOURCE_TYPE,
+ INVALID_RESOURCE,
+ };
+
+ ReadFileResult ReadFromJSONFile(const std::string& filename);
+ static const char* ResultToString(ReadFileResult result);
bool operator==(const cmCTestResourceSpec& other) const;
bool operator!=(const cmCTestResourceSpec& other) const;
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 37c7154..e70bc5a 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -537,9 +537,13 @@ bool cmCTestTestHandler::ProcessOptions()
val = this->GetOption("ResourceSpecFile");
if (val) {
this->UseResourceSpec = true;
- if (!this->ResourceSpec.ReadFromJSONFile(val)) {
+ auto result = this->ResourceSpec.ReadFromJSONFile(val);
+ if (result != cmCTestResourceSpec::ReadFileResult::READ_OK) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Could not read resource spec file: " << val << std::endl);
+ "Could not read/parse resource spec file "
+ << val << ": "
+ << cmCTestResourceSpec::ResultToString(result)
+ << std::endl);
return false;
}
}
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index b608fcb..3b5dc04 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -6,6 +6,7 @@
#include <QDir>
#include "cmExternalMakefileProjectGenerator.h"
+#include "cmGlobalGenerator.h"
#include "cmState.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index d627465..e3536d5 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -617,7 +617,7 @@ const char* cmCacheManager::CacheEntry::GetProperty(
const std::string& prop) const
{
if (prop == "TYPE") {
- return cmState::CacheEntryTypeToString(this->Type);
+ return cmState::CacheEntryTypeToString(this->Type).c_str();
}
if (prop == "VALUE") {
return this->Value.c_str();
diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h
index 645189a..47c821b 100644
--- a/Source/cmComputeLinkDepends.h
+++ b/Source/cmComputeLinkDepends.h
@@ -7,12 +7,11 @@
#include <map>
#include <memory>
+#include <queue>
#include <set>
#include <string>
#include <vector>
-#include <queue>
-
#include "cmGraphAdjacencyList.h"
#include "cmLinkItem.h"
#include "cmTargetLinkLibraryType.h"
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 4715cfa..da04396 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -1045,7 +1045,9 @@ void cmCoreTryCompile::CleanupFiles(std::string const& binDir)
if (deletedFiles.insert(fileName).second) {
std::string const fullPath =
std::string(binDir).append("/").append(fileName);
- if (cmSystemTools::FileIsDirectory(fullPath)) {
+ if (cmSystemTools::FileIsSymlink(fullPath)) {
+ cmSystemTools::RemoveFile(fullPath);
+ } else if (cmSystemTools::FileIsDirectory(fullPath)) {
this->CleanupFiles(fullPath);
cmSystemTools::RemoveADirectory(fullPath);
} else {
diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h
index 3bb6e36..868c94a 100644
--- a/Source/cmDependsC.h
+++ b/Source/cmDependsC.h
@@ -7,12 +7,11 @@
#include <iosfwd>
#include <map>
+#include <queue>
#include <set>
#include <string>
#include <vector>
-#include <queue>
-
#include "cmsys/RegularExpression.hxx"
#include "cmDepends.h"
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index dbe5a5e..d22bd48 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -301,11 +301,10 @@ cmExportBuildFileGenerator::FindBuildExportInfo(cmGlobalGenerator* gg,
std::vector<std::string> exportFiles;
std::string ns;
- std::map<std::string, cmExportBuildFileGenerator*>& exportSets =
- gg->GetBuildExportSets();
+ auto& exportSets = gg->GetBuildExportSets();
for (auto const& exp : exportSets) {
- const cmExportBuildFileGenerator* exportSet = exp.second;
+ const auto& exportSet = exp.second;
std::vector<std::string> targets;
exportSet->GetTargets(targets);
if (cmContains(targets, name)) {
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index 2a6bf5d..b7cc193 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -6,6 +6,8 @@
#include <sstream>
#include <utility>
+#include <cm/memory>
+
#include "cmsys/RegularExpression.hxx"
#include "cm_static_string_view.hxx"
@@ -182,11 +184,11 @@ bool cmExportCommand(std::vector<std::string> const& args,
}
// Setup export file generation.
- cmExportBuildFileGenerator* ebfg = nullptr;
+ std::unique_ptr<cmExportBuildFileGenerator> ebfg = nullptr;
if (android) {
- ebfg = new cmExportBuildAndroidMKGenerator;
+ ebfg = cm::make_unique<cmExportBuildAndroidMKGenerator>();
} else {
- ebfg = new cmExportBuildFileGenerator;
+ ebfg = cm::make_unique<cmExportBuildFileGenerator>();
}
ebfg->SetExportFile(fname.c_str());
ebfg->SetNamespace(arguments.Namespace);
@@ -196,7 +198,7 @@ bool cmExportCommand(std::vector<std::string> const& args,
} else {
ebfg->SetTargets(targets);
}
- mf.AddExportBuildFileGenerator(ebfg);
+ mf.AddExportBuildFileGenerator(ebfg.get());
ebfg->SetExportOld(arguments.ExportOld);
// Compute the set of configurations exported.
@@ -209,9 +211,9 @@ bool cmExportCommand(std::vector<std::string> const& args,
ebfg->AddConfiguration(ct);
}
if (exportSet != nullptr) {
- gg->AddBuildExportExportSet(ebfg);
+ gg->AddBuildExportExportSet(std::move(ebfg));
} else {
- gg->AddBuildExportSet(ebfg);
+ gg->AddBuildExportSet(std::move(ebfg));
}
return true;
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index aeef602..7a4b887 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -1062,6 +1062,12 @@ void cmExportFileGenerator::GenerateImportTargetCode(
if (target->IsCFBundleOnApple()) {
os << "set_property(TARGET " << targetName << " PROPERTY BUNDLE 1)\n";
}
+
+ // generate DEPRECATION
+ if (target->IsDeprecated()) {
+ os << "set_property(TARGET " << targetName << " PROPERTY DEPRECATION "
+ << cmExportFileGeneratorEscape(target->GetDeprecation()) << ")\n";
+ }
os << "\n";
}
diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx
index dfc8de5..6011ba4 100644
--- a/Source/cmExportLibraryDependenciesCommand.cxx
+++ b/Source/cmExportLibraryDependenciesCommand.cxx
@@ -49,11 +49,11 @@ static void FinalAction(cmMakefile& makefile, std::string const& filename,
// the project.
cmake* cm = makefile.GetCMakeInstance();
cmGlobalGenerator* global = cm->GetGlobalGenerator();
- const std::vector<cmMakefile*>& locals = global->GetMakefiles();
+ const auto& locals = global->GetMakefiles();
std::map<std::string, std::string> libDepsOld;
std::map<std::string, std::string> libDepsNew;
std::map<std::string, std::string> libTypes;
- for (cmMakefile* local : locals) {
+ for (const auto& local : locals) {
for (auto const& tgt : local->GetTargets()) {
// Get the current target.
cmTarget const& target = tgt.second;
diff --git a/Source/cmExternalMakefileProjectGenerator.h b/Source/cmExternalMakefileProjectGenerator.h
index a472a06..2b8d505 100644
--- a/Source/cmExternalMakefileProjectGenerator.h
+++ b/Source/cmExternalMakefileProjectGenerator.h
@@ -5,6 +5,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <memory>
#include <string>
#include <vector>
@@ -78,7 +79,7 @@ public:
std::vector<std::string> GetSupportedGlobalGenerators() const;
std::vector<std::string> Aliases;
- virtual cmExternalMakefileProjectGenerator*
+ virtual std::unique_ptr<cmExternalMakefileProjectGenerator>
CreateExternalMakefileProjectGenerator() const = 0;
void AddSupportedGlobalGenerator(const std::string& base);
@@ -100,10 +101,10 @@ public:
{
}
- cmExternalMakefileProjectGenerator* CreateExternalMakefileProjectGenerator()
- const override
+ std::unique_ptr<cmExternalMakefileProjectGenerator>
+ CreateExternalMakefileProjectGenerator() const override
{
- T* p = new T;
+ std::unique_ptr<cmExternalMakefileProjectGenerator> p(new T);
p->SetName(GetName());
return p;
}
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 7a2d9d5..d13e8ec 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -427,7 +427,7 @@ Json::Value Codemodel::DumpConfigurations()
Json::Value configurations = Json::arrayValue;
cmGlobalGenerator* gg =
this->FileAPI.GetCMakeInstance()->GetGlobalGenerator();
- auto makefiles = gg->GetMakefiles();
+ const auto& makefiles = gg->GetMakefiles();
if (!makefiles.empty()) {
std::vector<std::string> const& configs =
makefiles[0]->GetGeneratorConfigs();
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 9eb256b..297c72b 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -161,6 +161,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
}
this->DebugMode = ComputeIfDebugModeWanted();
+ this->DebugBuffer.clear();
// Lookup target architecture, if any.
if (const char* arch =
@@ -575,6 +576,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
}
this->AppendSuccessInformation();
+
return loadedPackage;
}
@@ -708,7 +710,7 @@ bool cmFindPackageCommand::FindModule(bool& found)
debugBuffer =
cmStrCat(debugBuffer, "The file was found at\n ", mfile, "\n");
}
- this->DebugMessage(debugBuffer);
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
}
if (!mfile.empty()) {
@@ -841,6 +843,11 @@ bool cmFindPackageCommand::HandlePackageMode(
result = false;
}
+ if (this->DebugMode) {
+ this->DebugMessage(this->DebugBuffer);
+ this->DebugBuffer.clear();
+ }
+
// package not found
if (result && !found) {
// warn if package required or neither quiet nor in config mode
@@ -1001,6 +1008,11 @@ bool cmFindPackageCommand::FindConfig()
// Look for the project's configuration file.
bool found = false;
+ if (this->DebugMode) {
+ this->DebugBuffer = cmStrCat(this->DebugBuffer,
+ "find_package considered the following "
+ "locations for the Config module:\n");
+ }
// Search for frameworks.
if (!found && (this->SearchFrameworkFirst || this->SearchFrameworkOnly)) {
@@ -1027,6 +1039,16 @@ bool cmFindPackageCommand::FindConfig()
found = this->FindAppBundleConfig();
}
+ if (this->DebugMode) {
+ if (found) {
+ this->DebugBuffer = cmStrCat(
+ this->DebugBuffer, "The file was found at\n ", this->FileFound, "\n");
+ } else {
+ this->DebugBuffer =
+ cmStrCat(this->DebugBuffer, "The file was not found.\n");
+ }
+ }
+
// Store the entry in the cache so it can be set by the user.
std::string init;
if (found) {
@@ -1040,6 +1062,7 @@ bool cmFindPackageCommand::FindConfig()
// We force the value since we do not get here if it was already set.
this->Makefile->AddCacheDefinition(this->Variable, init.c_str(),
help.c_str(), cmStateEnums::PATH, true);
+
return found;
}
@@ -1244,7 +1267,7 @@ void cmFindPackageCommand::FillPrefixesPackageRoot()
std::string debugBuffer = "<PackageName>_ROOT CMake variable "
"[CMAKE_FIND_USE_PACKAGE_ROOT_PATH].\n";
collectPathsForDebug(debugBuffer, paths);
- this->DebugMessage(debugBuffer);
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
}
}
@@ -1280,7 +1303,7 @@ void cmFindPackageCommand::FillPrefixesCMakeEnvironment()
"\nCMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH env "
"variables [CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH].\n");
collectPathsForDebug(debugBuffer, paths, debugOffset);
- this->DebugMessage(debugBuffer);
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
}
}
@@ -1304,7 +1327,7 @@ void cmFindPackageCommand::FillPrefixesCMakeVariable()
"\nCMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH variables "
"[CMAKE_FIND_USE_CMAKE_PATH].\n");
collectPathsForDebug(debugBuffer, paths, debugOffset);
- this->DebugMessage(debugBuffer);
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
}
}
@@ -1329,7 +1352,7 @@ void cmFindPackageCommand::FillPrefixesSystemEnvironment()
std::string debugBuffer = "Standard system environment variables "
"[CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH].\n";
collectPathsForDebug(debugBuffer, paths);
- this->DebugMessage(debugBuffer);
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
}
}
@@ -1359,7 +1382,7 @@ void cmFindPackageCommand::FillPrefixesUserRegistry()
"CMake User Package Registry [CMAKE_FIND_USE_PACKAGE_REGISTRY].\n";
collectPathsForDebug(debugBuffer,
this->LabeledPaths[PathLabel::UserRegistry]);
- this->DebugMessage(debugBuffer);
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
}
}
@@ -1379,7 +1402,7 @@ void cmFindPackageCommand::FillPrefixesSystemRegistry()
"[CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY].\n";
collectPathsForDebug(debugBuffer,
this->LabeledPaths[PathLabel::SystemRegistry]);
- this->DebugMessage(debugBuffer);
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
}
}
@@ -1558,7 +1581,7 @@ void cmFindPackageCommand::FillPrefixesCMakeSystemVariable()
std::string debugBuffer = "CMake variables defined in the Platform file "
"[CMAKE_FIND_USE_CMAKE_SYSTEM_PATH].\n";
collectPathsForDebug(debugBuffer, paths);
- this->DebugMessage(debugBuffer);
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
}
}
@@ -1573,7 +1596,7 @@ void cmFindPackageCommand::FillPrefixesUserGuess()
std::string debugBuffer =
"Paths specified by the find_package PATHS option.\n";
collectPathsForDebug(debugBuffer, paths);
- this->DebugMessage(debugBuffer);
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
}
}
@@ -1588,7 +1611,7 @@ void cmFindPackageCommand::FillPrefixesUserHints()
std::string debugBuffer =
"Paths specified by the find_package HINTS option.\n";
collectPathsForDebug(debugBuffer, paths);
- this->DebugMessage(debugBuffer);
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
}
}
@@ -1634,8 +1657,7 @@ bool cmFindPackageCommand::FindConfigFile(std::string const& dir,
for (std::string const& c : this->Configs) {
file = cmStrCat(dir, '/', c);
if (this->DebugMode) {
- std::string msg = "Checking file [" + file + "]\n";
- this->DebugMessage(msg);
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, " ", file, "\n");
}
if (cmSystemTools::FileExists(file, true) && this->CheckVersion(file)) {
// Allow resolving symlinks when the config file is found through a link
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index a65a292..ae9ade7 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -183,6 +183,7 @@ private:
std::vector<std::string> Names;
std::vector<std::string> Configs;
std::set<std::string> IgnoredPaths;
+ std::string DebugBuffer;
/*! the selected sortOrder (None by default)*/
SortOrderType SortOrder;
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 19d5b4d..523083a 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -10,6 +10,7 @@
#include <cstdlib>
#include <cstring>
#include <iterator>
+#include <queue>
#include <sstream>
#include <unordered_set>
#include <utility>
@@ -17,8 +18,6 @@
#include <cm/memory>
#include <cm/string_view>
-#include <queue>
-
#include "cmsys/RegularExpression.hxx"
#include "cmAlgorithms.h"
@@ -6354,6 +6353,21 @@ std::string cmGeneratorTarget::CheckCMP0004(std::string const& item) const
return lib;
}
+bool cmGeneratorTarget::IsDeprecated() const
+{
+ const char* deprecation = this->GetProperty("DEPRECATION");
+ return deprecation && *deprecation;
+}
+
+std::string cmGeneratorTarget::GetDeprecation() const
+{
+ // find DEPRECATION property
+ if (const char* deprecation = this->GetProperty("DEPRECATION")) {
+ return deprecation;
+ }
+ return std::string();
+}
+
void cmGeneratorTarget::GetLanguages(std::set<std::string>& languages,
const std::string& config) const
{
@@ -6624,6 +6638,19 @@ cmLinkItem cmGeneratorTarget::ResolveLinkItem(
return cmLinkItem(resolved.String, bt);
}
+ // Check deprecation, issue message with `bt` backtrace.
+ if (resolved.Target->IsDeprecated()) {
+ std::ostringstream w;
+ /* clang-format off */
+ w <<
+ "The library that is being linked to, " << resolved.Target->GetName() <<
+ ", is marked as being deprecated by the owner. The message provided by "
+ "the developer is: \n" << resolved.Target->GetDeprecation() << "\n";
+ /* clang-format on */
+ this->LocalGenerator->GetCMakeInstance()->IssueMessage(
+ MessageType::AUTHOR_WARNING, w.str(), bt);
+ }
+
// Skip targets that will not really be linked. This is probably a
// name conflict between an external library and an executable
// within the project.
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index eabd3fa9..0a72cbe 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -250,6 +250,13 @@ public:
std::string GetAppBundleDirectory(const std::string& config,
BundleDirectoryLevel level) const;
+ /** Return whether this target is marked as deprecated by the
+ maintainer */
+ bool IsDeprecated() const;
+
+ /** Returns the deprecation message provided by the maintainer */
+ std::string GetDeprecation() const;
+
/** Return whether this target is an executable Bundle, a framework
or CFBundle on Apple. */
bool IsBundleOnApple() const;
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index f7c542f..5e2248e 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -279,10 +279,10 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLine(std::ostream& fout,
std::string frameworkPath;
std::string linkPath;
- std::unique_ptr<cmLinkLineComputer> linkLineComputer(
+ std::unique_ptr<cmLinkLineComputer> linkLineComputer =
this->GetGlobalGenerator()->CreateLinkLineComputer(
this->LocalGenerator,
- this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+ this->LocalGenerator->GetStateSnapshot().GetDirectory());
this->LocalGenerator->GetTargetFlags(
linkLineComputer.get(), config, linkLibraries, flags, linkFlags,
diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h
index 291220c..9af0eac 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.h
+++ b/Source/cmGlobalBorlandMakefileGenerator.h
@@ -17,10 +17,10 @@ class cmGlobalBorlandMakefileGenerator : public cmGlobalUnixMakefileGenerator3
{
public:
cmGlobalBorlandMakefileGenerator(cmake* cm);
- static cmGlobalGeneratorFactory* NewFactory()
+ static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory()
{
- return new cmGlobalGeneratorSimpleFactory<
- cmGlobalBorlandMakefileGenerator>();
+ return std::unique_ptr<cmGlobalGeneratorFactory>(
+ new cmGlobalGeneratorSimpleFactory<cmGlobalBorlandMakefileGenerator>());
}
//! Get the name for the generator.
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index bcc9050..4cbcda0 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -261,16 +261,17 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string& lang,
}
}
-void cmGlobalGenerator::AddBuildExportSet(cmExportBuildFileGenerator* gen)
+void cmGlobalGenerator::AddBuildExportSet(
+ std::unique_ptr<cmExportBuildFileGenerator> gen)
{
- this->BuildExportSets[gen->GetMainExportFileName()] = gen;
+ this->BuildExportSets[gen->GetMainExportFileName()] = std::move(gen);
}
void cmGlobalGenerator::AddBuildExportExportSet(
- cmExportBuildFileGenerator* gen)
+ std::unique_ptr<cmExportBuildFileGenerator> gen)
{
- this->BuildExportSets[gen->GetMainExportFileName()] = gen;
- this->BuildExportExportSets[gen->GetMainExportFileName()] = gen;
+ this->BuildExportExportSets[gen->GetMainExportFileName()] = gen.get();
+ this->AddBuildExportSet(std::move(gen));
}
bool cmGlobalGenerator::GenerateImportFile(const std::string& file)
@@ -280,13 +281,11 @@ bool cmGlobalGenerator::GenerateImportFile(const std::string& file)
bool result = it->second->GenerateImportFile();
if (!this->ConfigureDoneCMP0026AndCMP0024) {
- for (cmMakefile* m : this->Makefiles) {
- m->RemoveExportBuildFileGeneratorCMP0024(it->second);
+ for (const auto& m : this->Makefiles) {
+ m->RemoveExportBuildFileGeneratorCMP0024(it->second.get());
}
}
- delete it->second;
- it->second = nullptr;
this->BuildExportSets.erase(it);
return result;
}
@@ -1206,8 +1205,8 @@ void cmGlobalGenerator::CreateLocalGenerators()
this->LocalGeneratorSearchIndex.clear();
this->LocalGenerators.clear();
this->LocalGenerators.reserve(this->Makefiles.size());
- for (cmMakefile* m : this->Makefiles) {
- auto lg = this->CreateLocalGenerator(m);
+ for (const auto& m : this->Makefiles) {
+ auto lg = this->CreateLocalGenerator(m.get());
this->IndexLocalGenerator(lg.get());
this->LocalGenerators.push_back(std::move(lg));
}
@@ -1225,9 +1224,10 @@ void cmGlobalGenerator::Configure()
snapshot.GetDirectory().SetCurrentBinary(
this->CMakeInstance->GetHomeOutputDirectory());
- cmMakefile* dirMf = new cmMakefile(this, snapshot);
+ auto dirMfu = cm::make_unique<cmMakefile>(this, snapshot);
+ auto dirMf = dirMfu.get();
+ this->Makefiles.push_back(std::move(dirMfu));
dirMf->SetRecursionDepth(this->RecursionDepth);
- this->Makefiles.push_back(dirMf);
this->IndexMakefile(dirMf);
this->BinaryDirectories.insert(
@@ -1245,11 +1245,11 @@ void cmGlobalGenerator::Configure()
std::vector<GlobalTargetInfo> globalTargets;
this->CreateDefaultGlobalTargets(globalTargets);
- for (cmMakefile* mf : this->Makefiles) {
+ for (const auto& mf : this->Makefiles) {
auto& targets = mf->GetTargets();
for (GlobalTargetInfo const& globalTarget : globalTargets) {
targets.emplace(globalTarget.Name,
- this->CreateGlobalTarget(globalTarget, mf));
+ this->CreateGlobalTarget(globalTarget, mf.get()));
}
}
}
@@ -1298,7 +1298,10 @@ void cmGlobalGenerator::CreateImportedGenerationObjects(
{
this->CreateGenerationObjects(ImportedOnly);
auto const mfit =
- std::find(this->Makefiles.begin(), this->Makefiles.end(), mf);
+ std::find_if(this->Makefiles.begin(), this->Makefiles.end(),
+ [mf](const std::unique_ptr<cmMakefile>& item) {
+ return item.get() == mf;
+ });
auto& lg =
this->LocalGenerators[std::distance(this->Makefiles.begin(), mfit)];
for (std::string const& t : targets) {
@@ -1313,7 +1316,7 @@ cmExportBuildFileGenerator* cmGlobalGenerator::GetExportedTargetsFile(
const std::string& filename) const
{
auto const it = this->BuildExportSets.find(filename);
- return it == this->BuildExportSets.end() ? nullptr : it->second;
+ return it == this->BuildExportSets.end() ? nullptr : it->second.get();
}
void cmGlobalGenerator::AddCMP0042WarnTarget(const std::string& target)
@@ -1586,16 +1589,18 @@ bool cmGlobalGenerator::AddAutomaticSources()
return true;
}
-cmLinkLineComputer* cmGlobalGenerator::CreateLinkLineComputer(
+std::unique_ptr<cmLinkLineComputer> cmGlobalGenerator::CreateLinkLineComputer(
cmOutputConverter* outputConverter, cmStateDirectory const& stateDir) const
{
- return new cmLinkLineComputer(outputConverter, stateDir);
+ return cm::make_unique<cmLinkLineComputer>(outputConverter, stateDir);
}
-cmLinkLineComputer* cmGlobalGenerator::CreateMSVC60LinkLineComputer(
+std::unique_ptr<cmLinkLineComputer>
+cmGlobalGenerator::CreateMSVC60LinkLineComputer(
cmOutputConverter* outputConverter, cmStateDirectory const& stateDir) const
{
- return new cmMSVC60LinkLineComputer(outputConverter, stateDir);
+ return std::unique_ptr<cmLinkLineComputer>(
+ cm::make_unique<cmMSVC60LinkLineComputer>(outputConverter, stateDir));
}
void cmGlobalGenerator::FinalizeTargetCompileInfo()
@@ -1604,7 +1609,7 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
this->CMakeInstance->GetState()->GetEnabledLanguages();
// Construct per-target generator information.
- for (cmMakefile* mf : this->Makefiles) {
+ for (const auto& mf : this->Makefiles) {
const cmStringRange noconfig_compile_definitions =
mf->GetCompileDefinitionsEntries();
const cmBacktraceRange noconfig_compile_definitions_bts =
@@ -1681,7 +1686,7 @@ void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes)
{
std::map<cmTarget*, cmGeneratorTarget*> importedMap;
for (unsigned int i = 0; i < this->Makefiles.size(); ++i) {
- cmMakefile* mf = this->Makefiles[i];
+ auto& mf = this->Makefiles[i];
for (cmTarget* ownedImpTgt : mf->GetOwnedImportedTargets()) {
cmLocalGenerator* lg = this->LocalGenerators[i].get();
auto gt = cm::make_unique<cmGeneratorTarget>(ownedImpTgt, lg);
@@ -1692,17 +1697,15 @@ void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes)
// Construct per-target generator information.
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) {
- this->CreateGeneratorTargets(targetTypes, this->Makefiles[i],
+ this->CreateGeneratorTargets(targetTypes, this->Makefiles[i].get(),
this->LocalGenerators[i].get(), importedMap);
}
}
void cmGlobalGenerator::ClearGeneratorMembers()
{
- cmDeleteAll(this->BuildExportSets);
this->BuildExportSets.clear();
- cmDeleteAll(this->Makefiles);
this->Makefiles.clear();
this->LocalGenerators.clear();
@@ -1999,10 +2002,10 @@ std::string cmGlobalGenerator::GenerateCMakeBuildCommand(
return makeCommand;
}
-void cmGlobalGenerator::AddMakefile(cmMakefile* mf)
+void cmGlobalGenerator::AddMakefile(std::unique_ptr<cmMakefile> mf)
{
- this->Makefiles.push_back(mf);
- this->IndexMakefile(mf);
+ this->IndexMakefile(mf.get());
+ this->Makefiles.push_back(std::move(mf));
// update progress
// estimate how many lg there will be
@@ -2354,7 +2357,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(
void cmGlobalGenerator::AddGlobalTarget_Package(
std::vector<GlobalTargetInfo>& targets)
{
- cmMakefile* mf = this->Makefiles[0];
+ auto& mf = this->Makefiles[0];
std::string configFile =
cmStrCat(mf->GetCurrentBinaryDirectory(), "/CPackConfig.cmake");
if (!cmSystemTools::FileExists(configFile)) {
@@ -2403,7 +2406,7 @@ void cmGlobalGenerator::AddGlobalTarget_PackageSource(
return;
}
- cmMakefile* mf = this->Makefiles[0];
+ auto& mf = this->Makefiles[0];
std::string configFile =
cmStrCat(mf->GetCurrentBinaryDirectory(), "/CPackSourceConfig.cmake");
if (!cmSystemTools::FileExists(configFile)) {
@@ -2435,7 +2438,7 @@ void cmGlobalGenerator::AddGlobalTarget_PackageSource(
void cmGlobalGenerator::AddGlobalTarget_Test(
std::vector<GlobalTargetInfo>& targets)
{
- cmMakefile* mf = this->Makefiles[0];
+ auto& mf = this->Makefiles[0];
if (!mf->IsOn("CMAKE_TESTING_ENABLED")) {
return;
}
@@ -2523,7 +2526,7 @@ void cmGlobalGenerator::AddGlobalTarget_RebuildCache(
void cmGlobalGenerator::AddGlobalTarget_Install(
std::vector<GlobalTargetInfo>& targets)
{
- cmMakefile* mf = this->Makefiles[0];
+ auto& mf = this->Makefiles[0];
const char* cmakeCfgIntDir = this->GetCMakeCFGIntDir();
bool skipInstallRules = mf->IsOn("CMAKE_SKIP_INSTALL_RULES");
if (this->InstallTargetEnabled && skipInstallRules) {
@@ -2573,7 +2576,7 @@ void cmGlobalGenerator::AddGlobalTarget_Install(
singleLine.push_back(cmd);
if (cmakeCfgIntDir && *cmakeCfgIntDir && cmakeCfgIntDir[0] != '.') {
std::string cfgArg = "-DBUILD_TYPE=";
- bool useEPN = this->UseEffectivePlatformName(mf);
+ bool useEPN = this->UseEffectivePlatformName(mf.get());
if (useEPN) {
cfgArg += "$(CONFIGURATION)";
singleLine.push_back(cfgArg);
@@ -2740,9 +2743,9 @@ bool cmGlobalGenerator::IsReservedTarget(std::string const& name)
}
void cmGlobalGenerator::SetExternalMakefileProjectGenerator(
- cmExternalMakefileProjectGenerator* extraGenerator)
+ std::unique_ptr<cmExternalMakefileProjectGenerator> extraGenerator)
{
- this->ExtraGenerator.reset(extraGenerator);
+ this->ExtraGenerator = std::move(extraGenerator);
if (this->ExtraGenerator) {
this->ExtraGenerator->SetGlobalGenerator(this);
}
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index f3078ac..b427992 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -162,11 +162,11 @@ public:
*/
virtual void Generate();
- virtual cmLinkLineComputer* CreateLinkLineComputer(
+ virtual std::unique_ptr<cmLinkLineComputer> CreateLinkLineComputer(
cmOutputConverter* outputConverter,
cmStateDirectory const& stateDir) const;
- cmLinkLineComputer* CreateMSVC60LinkLineComputer(
+ std::unique_ptr<cmLinkLineComputer> CreateMSVC60LinkLineComputer(
cmOutputConverter* outputConverter,
cmStateDirectory const& stateDir) const;
@@ -249,7 +249,7 @@ public:
cmake* GetCMakeInstance() const { return this->CMakeInstance; }
void SetConfiguredFilesPath(cmGlobalGenerator* gen);
- const std::vector<cmMakefile*>& GetMakefiles() const
+ const std::vector<std::unique_ptr<cmMakefile>>& GetMakefiles() const
{
return this->Makefiles;
}
@@ -268,11 +268,11 @@ public:
this->CurrentConfigureMakefile = mf;
}
- void AddMakefile(cmMakefile* mf);
+ void AddMakefile(std::unique_ptr<cmMakefile> mf);
//! Set an generator for an "external makefile based project"
void SetExternalMakefileProjectGenerator(
- cmExternalMakefileProjectGenerator* extraGenerator);
+ std::unique_ptr<cmExternalMakefileProjectGenerator> extraGenerator);
std::string GetExtraGeneratorName() const;
@@ -445,12 +445,13 @@ public:
void ProcessEvaluationFiles();
- std::map<std::string, cmExportBuildFileGenerator*>& GetBuildExportSets()
+ std::map<std::string, std::unique_ptr<cmExportBuildFileGenerator>>&
+ GetBuildExportSets()
{
return this->BuildExportSets;
}
- void AddBuildExportSet(cmExportBuildFileGenerator*);
- void AddBuildExportExportSet(cmExportBuildFileGenerator*);
+ void AddBuildExportSet(std::unique_ptr<cmExportBuildFileGenerator>);
+ void AddBuildExportExportSet(std::unique_ptr<cmExportBuildFileGenerator>);
bool IsExportedTargetsFile(const std::string& filename) const;
bool GenerateImportFile(const std::string& file);
cmExportBuildFileGenerator* GetExportedTargetsFile(
@@ -549,7 +550,7 @@ protected:
std::string FindMakeProgramFile;
std::string ConfiguredFilesPath;
cmake* CMakeInstance;
- std::vector<cmMakefile*> Makefiles;
+ std::vector<std::unique_ptr<cmMakefile>> Makefiles;
LocalGeneratorVector LocalGenerators;
cmMakefile* CurrentConfigureMakefile;
// map from project name to vector of local generators in that project
@@ -559,7 +560,8 @@ protected:
std::set<std::string> InstallComponents;
// Sets of named target exports
cmExportSetMap ExportSets;
- std::map<std::string, cmExportBuildFileGenerator*> BuildExportSets;
+ std::map<std::string, std::unique_ptr<cmExportBuildFileGenerator>>
+ BuildExportSets;
std::map<std::string, cmExportBuildFileGenerator*> BuildExportExportSets;
std::map<std::string, std::string> AliasTargets;
diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h
index bb5f74c..3709365 100644
--- a/Source/cmGlobalGeneratorFactory.h
+++ b/Source/cmGlobalGeneratorFactory.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include <cm/memory>
+
class cmGlobalGenerator;
class cmake;
struct cmDocumentationEntry;
@@ -23,8 +25,8 @@ public:
virtual ~cmGlobalGeneratorFactory() = default;
/** Create a GlobalGenerator */
- virtual cmGlobalGenerator* CreateGlobalGenerator(const std::string& n,
- cmake* cm) const = 0;
+ virtual std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
+ const std::string& n, cmake* cm) const = 0;
/** Get the documentation entry for this factory */
virtual void GetDocumentation(cmDocumentationEntry& entry) const = 0;
@@ -51,13 +53,13 @@ class cmGlobalGeneratorSimpleFactory : public cmGlobalGeneratorFactory
{
public:
/** Create a GlobalGenerator */
- cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
- cmake* cm) const override
+ std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
+ const std::string& name, cmake* cm) const override
{
if (name != T::GetActualName()) {
- return nullptr;
+ return std::unique_ptr<cmGlobalGenerator>();
}
- return new T(cm);
+ return std::unique_ptr<cmGlobalGenerator>(cm::make_unique<T>(cm));
}
/** Get the documentation entry for this factory */
diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h
index 989b12c..b82e9f5 100644
--- a/Source/cmGlobalGhsMultiGenerator.h
+++ b/Source/cmGlobalGhsMultiGenerator.h
@@ -29,9 +29,10 @@ public:
cmGlobalGhsMultiGenerator(cmake* cm);
~cmGlobalGhsMultiGenerator() override;
- static cmGlobalGeneratorFactory* NewFactory()
+ static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory()
{
- return new cmGlobalGeneratorSimpleFactory<cmGlobalGhsMultiGenerator>();
+ return std::unique_ptr<cmGlobalGeneratorFactory>(
+ new cmGlobalGeneratorSimpleFactory<cmGlobalGhsMultiGenerator>());
}
//! create the correct local generator
diff --git a/Source/cmGlobalJOMMakefileGenerator.h b/Source/cmGlobalJOMMakefileGenerator.h
index fc39ddf..9f1ec8b 100644
--- a/Source/cmGlobalJOMMakefileGenerator.h
+++ b/Source/cmGlobalJOMMakefileGenerator.h
@@ -4,6 +4,7 @@
#define cmGlobalJOMMakefileGenerator_h
#include <iosfwd>
+#include <memory>
#include "cmGlobalUnixMakefileGenerator3.h"
@@ -16,9 +17,10 @@ class cmGlobalJOMMakefileGenerator : public cmGlobalUnixMakefileGenerator3
{
public:
cmGlobalJOMMakefileGenerator(cmake* cm);
- static cmGlobalGeneratorFactory* NewFactory()
+ static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory()
{
- return new cmGlobalGeneratorSimpleFactory<cmGlobalJOMMakefileGenerator>();
+ return std::unique_ptr<cmGlobalGeneratorFactory>(
+ new cmGlobalGeneratorSimpleFactory<cmGlobalJOMMakefileGenerator>());
}
//! Get the name for the generator.
std::string GetName() const override
diff --git a/Source/cmGlobalMSYSMakefileGenerator.h b/Source/cmGlobalMSYSMakefileGenerator.h
index d6e4847..b2de4ff 100644
--- a/Source/cmGlobalMSYSMakefileGenerator.h
+++ b/Source/cmGlobalMSYSMakefileGenerator.h
@@ -3,6 +3,8 @@
#ifndef cmGlobalMSYSMakefileGenerator_h
#define cmGlobalMSYSMakefileGenerator_h
+#include <memory>
+
#include "cmGlobalUnixMakefileGenerator3.h"
/** \class cmGlobalMSYSMakefileGenerator
@@ -14,9 +16,10 @@ class cmGlobalMSYSMakefileGenerator : public cmGlobalUnixMakefileGenerator3
{
public:
cmGlobalMSYSMakefileGenerator(cmake* cm);
- static cmGlobalGeneratorFactory* NewFactory()
+ static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory()
{
- return new cmGlobalGeneratorSimpleFactory<cmGlobalMSYSMakefileGenerator>();
+ return std::unique_ptr<cmGlobalGeneratorFactory>(
+ new cmGlobalGeneratorSimpleFactory<cmGlobalMSYSMakefileGenerator>());
}
//! Get the name for the generator.
diff --git a/Source/cmGlobalMinGWMakefileGenerator.h b/Source/cmGlobalMinGWMakefileGenerator.h
index 15297e3..a9f92a1 100644
--- a/Source/cmGlobalMinGWMakefileGenerator.h
+++ b/Source/cmGlobalMinGWMakefileGenerator.h
@@ -3,6 +3,8 @@
#ifndef cmGlobalMinGWMakefileGenerator_h
#define cmGlobalMinGWMakefileGenerator_h
+#include <memory>
+
#include "cmGlobalUnixMakefileGenerator3.h"
/** \class cmGlobalMinGWMakefileGenerator
@@ -14,10 +16,10 @@ class cmGlobalMinGWMakefileGenerator : public cmGlobalUnixMakefileGenerator3
{
public:
cmGlobalMinGWMakefileGenerator(cmake* cm);
- static cmGlobalGeneratorFactory* NewFactory()
+ static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory()
{
- return new cmGlobalGeneratorSimpleFactory<
- cmGlobalMinGWMakefileGenerator>();
+ return std::unique_ptr<cmGlobalGeneratorFactory>(
+ new cmGlobalGeneratorSimpleFactory<cmGlobalMinGWMakefileGenerator>());
}
//! Get the name for the generator.
virtual std::string GetName() const
diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h
index 4586b77..fdf6006 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.h
+++ b/Source/cmGlobalNMakeMakefileGenerator.h
@@ -4,6 +4,7 @@
#define cmGlobalNMakeMakefileGenerator_h
#include <iosfwd>
+#include <memory>
#include "cmGlobalUnixMakefileGenerator3.h"
@@ -16,10 +17,10 @@ class cmGlobalNMakeMakefileGenerator : public cmGlobalUnixMakefileGenerator3
{
public:
cmGlobalNMakeMakefileGenerator(cmake* cm);
- static cmGlobalGeneratorFactory* NewFactory()
+ static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory()
{
- return new cmGlobalGeneratorSimpleFactory<
- cmGlobalNMakeMakefileGenerator>();
+ return std::unique_ptr<cmGlobalGeneratorFactory>(
+ new cmGlobalGeneratorSimpleFactory<cmGlobalNMakeMakefileGenerator>());
}
//! Get the name for the generator.
std::string GetName() const override
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 2a59708..35b4f91 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -25,6 +25,7 @@
#include "cmGeneratorExpressionEvaluationFile.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
+#include "cmLinkLineComputer.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmLocalNinjaGenerator.h"
@@ -44,8 +45,6 @@
#include "cmVersion.h"
#include "cmake.h"
-class cmLinkLineComputer;
-
const char* cmGlobalNinjaGenerator::NINJA_BUILD_FILE = "build.ninja";
const char* cmGlobalNinjaGenerator::NINJA_RULES_FILE = "rules.ninja";
const char* cmGlobalNinjaGenerator::INDENT = " ";
@@ -85,13 +84,15 @@ void cmGlobalNinjaGenerator::WriteComment(std::ostream& os,
os << "# " << comment.substr(lpos) << "\n\n";
}
-cmLinkLineComputer* cmGlobalNinjaGenerator::CreateLinkLineComputer(
+std::unique_ptr<cmLinkLineComputer>
+cmGlobalNinjaGenerator::CreateLinkLineComputer(
cmOutputConverter* outputConverter,
cmStateDirectory const& /* stateDir */) const
{
- return new cmNinjaLinkLineComputer(
- outputConverter,
- this->LocalGenerators[0]->GetStateSnapshot().GetDirectory(), this);
+ return std::unique_ptr<cmLinkLineComputer>(
+ cm::make_unique<cmNinjaLinkLineComputer>(
+ outputConverter,
+ this->LocalGenerators[0]->GetStateSnapshot().GetDirectory(), this));
}
std::string cmGlobalNinjaGenerator::EncodeRuleName(std::string const& name)
@@ -529,6 +530,35 @@ void cmGlobalNinjaGenerator::Generate()
if (!this->WriteDefaultBuildFile()) {
return;
}
+
+ auto run_ninja_tool = [this](char const* tool) {
+ std::vector<std::string> command;
+ command.push_back(this->NinjaCommand);
+ command.emplace_back("-t");
+ command.emplace_back(tool);
+ std::string error;
+ if (!cmSystemTools::RunSingleCommand(command, nullptr, &error, nullptr,
+ nullptr,
+ cmSystemTools::OUTPUT_NONE)) {
+ this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR,
+ "Running\n '" +
+ cmJoin(command, "' '") +
+ "'\n"
+ "failed with:\n " +
+ error);
+ cmSystemTools::SetFatalErrorOccured();
+ }
+ };
+
+ if (this->NinjaSupportsCleanDeadTool) {
+ run_ninja_tool("cleandead");
+ }
+ if (this->NinjaSupportsUnconditionalRecompactTool) {
+ run_ninja_tool("recompact");
+ }
+ if (this->NinjaSupportsRestatTool) {
+ run_ninja_tool("restat");
+ }
}
bool cmGlobalNinjaGenerator::FindMakeProgram(cmMakefile* mf)
@@ -592,6 +622,16 @@ void cmGlobalNinjaGenerator::CheckNinjaFeatures()
}
}
}
+ this->NinjaSupportsCleanDeadTool = !cmSystemTools::VersionCompare(
+ cmSystemTools::OP_LESS, this->NinjaVersion.c_str(),
+ RequiredNinjaVersionForCleanDeadTool().c_str());
+ this->NinjaSupportsUnconditionalRecompactTool =
+ !cmSystemTools::VersionCompare(
+ cmSystemTools::OP_LESS, this->NinjaVersion.c_str(),
+ RequiredNinjaVersionForUnconditionalRecompactTool().c_str());
+ this->NinjaSupportsRestatTool = !cmSystemTools::VersionCompare(
+ cmSystemTools::OP_LESS, this->NinjaVersion.c_str(),
+ RequiredNinjaVersionForRestatTool().c_str());
}
bool cmGlobalNinjaGenerator::CheckLanguages(
@@ -2044,7 +2084,7 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile(
snapshot.GetDirectory().SetRelativePathTopBinary(dir_top_bld.c_str());
auto mfd = cm::make_unique<cmMakefile>(this, snapshot);
auto lgd = this->CreateLocalGenerator(mfd.get());
- this->Makefiles.push_back(mfd.release());
+ this->Makefiles.push_back(std::move(mfd));
this->LocalGenerators.push_back(std::move(lgd));
}
@@ -2222,12 +2262,11 @@ int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg,
cmake cm(cmake::RoleInternal, cmState::Unknown);
cm.SetHomeDirectory(dir_top_src);
cm.SetHomeOutputDirectory(dir_top_bld);
- std::unique_ptr<cmGlobalNinjaGenerator> ggd(
- static_cast<cmGlobalNinjaGenerator*>(cm.CreateGlobalGenerator("Ninja")));
+ auto ggd = cm.CreateGlobalGenerator("Ninja");
if (!ggd ||
- !ggd->WriteDyndepFile(dir_top_src, dir_top_bld, dir_cur_src, dir_cur_bld,
- arg_dd, arg_ddis, module_dir, linked_target_dirs,
- arg_lang)) {
+ !cm::static_reference_cast<cmGlobalNinjaGenerator>(ggd).WriteDyndepFile(
+ dir_top_src, dir_top_bld, dir_cur_src, dir_cur_bld, arg_dd, arg_ddis,
+ module_dir, linked_target_dirs, arg_lang)) {
return 1;
}
return 0;
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 6ebb31d..fdd9dda 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -77,7 +77,7 @@ public:
std::string EncodeLiteral(const std::string& lit);
std::string EncodePath(const std::string& path);
- cmLinkLineComputer* CreateLinkLineComputer(
+ std::unique_ptr<cmLinkLineComputer> CreateLinkLineComputer(
cmOutputConverter* outputConverter,
cmStateDirectory const& stateDir) const override;
@@ -153,9 +153,10 @@ public:
public:
cmGlobalNinjaGenerator(cmake* cm);
- static cmGlobalGeneratorFactory* NewFactory()
+ static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory()
{
- return new cmGlobalGeneratorSimpleFactory<cmGlobalNinjaGenerator>();
+ return std::unique_ptr<cmGlobalGeneratorFactory>(
+ new cmGlobalGeneratorSimpleFactory<cmGlobalNinjaGenerator>());
}
std::unique_ptr<cmLocalGenerator> CreateLocalGenerator(
@@ -348,6 +349,12 @@ public:
return "1.9";
}
static std::string RequiredNinjaVersionForDyndeps() { return "1.10"; }
+ static std::string RequiredNinjaVersionForRestatTool() { return "1.10"; }
+ static std::string RequiredNinjaVersionForUnconditionalRecompactTool()
+ {
+ return "1.10";
+ }
+ static std::string RequiredNinjaVersionForCleanDeadTool() { return "1.10"; }
bool SupportsConsolePool() const;
bool SupportsImplicitOuts() const;
bool SupportsManifestRestat() const;
@@ -488,6 +495,9 @@ private:
bool NinjaSupportsManifestRestat = false;
bool NinjaSupportsMultilineDepfile = false;
bool NinjaSupportsDyndeps = false;
+ bool NinjaSupportsRestatTool = false;
+ bool NinjaSupportsUnconditionalRecompactTool = false;
+ bool NinjaSupportsCleanDeadTool = false;
private:
void InitOutputPathPrefix();
@@ -524,9 +534,10 @@ public:
cmGlobalNinjaMultiGenerator(cmake* cm);
bool IsMultiConfig() const override { return true; }
- static cmGlobalGeneratorFactory* NewFactory()
+ static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory()
{
- return new cmGlobalGeneratorSimpleFactory<cmGlobalNinjaMultiGenerator>();
+ return std::unique_ptr<cmGlobalGeneratorFactory>(
+ new cmGlobalGeneratorSimpleFactory<cmGlobalNinjaMultiGenerator>());
}
static void GetDocumentation(cmDocumentationEntry& entry);
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index f2595ea..0591758 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -492,7 +492,7 @@ cmGlobalUnixMakefileGenerator3::GenerateBuildCommand(
std::unique_ptr<cmMakefile> mfu;
cmMakefile* mf;
if (!this->Makefiles.empty()) {
- mf = this->Makefiles[0];
+ mf = this->Makefiles[0].get();
} else {
cmStateSnapshot snapshot = this->CMakeInstance->GetCurrentSnapshot();
snapshot.GetDirectory().SetCurrentSource(
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index 5608baf..340a7ef 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -62,10 +62,10 @@ class cmGlobalUnixMakefileGenerator3 : public cmGlobalCommonGenerator
{
public:
cmGlobalUnixMakefileGenerator3(cmake* cm);
- static cmGlobalGeneratorFactory* NewFactory()
+ static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory()
{
- return new cmGlobalGeneratorSimpleFactory<
- cmGlobalUnixMakefileGenerator3>();
+ return std::unique_ptr<cmGlobalGeneratorFactory>(
+ new cmGlobalGeneratorSimpleFactory<cmGlobalUnixMakefileGenerator3>());
}
//! Get the name for the generator.
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index bdf4cf2..a720cc3 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -57,27 +57,30 @@ class cmGlobalVisualStudio10Generator::Factory
: public cmGlobalGeneratorFactory
{
public:
- cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
- cmake* cm) const override
+ std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
+ const std::string& name, cmake* cm) const override
{
std::string genName;
const char* p = cmVS10GenName(name, genName);
if (!p) {
- return 0;
+ return std::unique_ptr<cmGlobalGenerator>();
}
if (!*p) {
- return new cmGlobalVisualStudio10Generator(cm, genName, "");
+ return std::unique_ptr<cmGlobalGenerator>(
+ new cmGlobalVisualStudio10Generator(cm, genName, ""));
}
if (*p++ != ' ') {
- return 0;
+ return std::unique_ptr<cmGlobalGenerator>();
}
if (strcmp(p, "Win64") == 0) {
- return new cmGlobalVisualStudio10Generator(cm, genName, "x64");
+ return std::unique_ptr<cmGlobalGenerator>(
+ new cmGlobalVisualStudio10Generator(cm, genName, "x64"));
}
if (strcmp(p, "IA64") == 0) {
- return new cmGlobalVisualStudio10Generator(cm, genName, "Itanium");
+ return std::unique_ptr<cmGlobalGenerator>(
+ new cmGlobalVisualStudio10Generator(cm, genName, "Itanium"));
}
- return 0;
+ return std::unique_ptr<cmGlobalGenerator>();
}
void GetDocumentation(cmDocumentationEntry& entry) const override
@@ -117,9 +120,10 @@ public:
std::string GetDefaultPlatformName() const override { return "Win32"; }
};
-cmGlobalGeneratorFactory* cmGlobalVisualStudio10Generator::NewFactory()
+std::unique_ptr<cmGlobalGeneratorFactory>
+cmGlobalVisualStudio10Generator::NewFactory()
{
- return new Factory;
+ return std::unique_ptr<cmGlobalGeneratorFactory>(new Factory);
}
cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator(
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index c991c76..2120785 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -16,7 +16,7 @@
class cmGlobalVisualStudio10Generator : public cmGlobalVisualStudio8Generator
{
public:
- static cmGlobalGeneratorFactory* NewFactory();
+ static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory();
bool MatchesGeneratorName(const std::string& name) const override;
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index 4b74ef1..a385375 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalVisualStudio11Generator.h"
+#include <utility>
+
#include "cmAlgorithms.h"
#include "cmDocumentationEntry.h"
#include "cmLocalVisualStudio10Generator.h"
@@ -28,38 +30,41 @@ class cmGlobalVisualStudio11Generator::Factory
: public cmGlobalGeneratorFactory
{
public:
- cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
- cmake* cm) const override
+ std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
+ const std::string& name, cmake* cm) const override
{
std::string genName;
const char* p = cmVS11GenName(name, genName);
if (!p) {
- return 0;
+ return std::unique_ptr<cmGlobalGenerator>();
}
if (!*p) {
- return new cmGlobalVisualStudio11Generator(cm, genName, "");
+ return std::unique_ptr<cmGlobalGenerator>(
+ new cmGlobalVisualStudio11Generator(cm, genName, ""));
}
if (*p++ != ' ') {
- return 0;
+ return std::unique_ptr<cmGlobalGenerator>();
}
if (strcmp(p, "Win64") == 0) {
- return new cmGlobalVisualStudio11Generator(cm, genName, "x64");
+ return std::unique_ptr<cmGlobalGenerator>(
+ new cmGlobalVisualStudio11Generator(cm, genName, "x64"));
}
if (strcmp(p, "ARM") == 0) {
- return new cmGlobalVisualStudio11Generator(cm, genName, "ARM");
+ return std::unique_ptr<cmGlobalGenerator>(
+ new cmGlobalVisualStudio11Generator(cm, genName, "ARM"));
}
std::set<std::string> installedSDKs =
cmGlobalVisualStudio11Generator::GetInstalledWindowsCESDKs();
if (installedSDKs.find(p) == installedSDKs.end()) {
- return 0;
+ return std::unique_ptr<cmGlobalGenerator>();
}
- cmGlobalVisualStudio11Generator* ret =
- new cmGlobalVisualStudio11Generator(cm, name, p);
+ auto ret = std::unique_ptr<cmGlobalVisualStudio11Generator>(
+ new cmGlobalVisualStudio11Generator(cm, name, p));
ret->WindowsCEVersion = "8.00";
- return ret;
+ return std::unique_ptr<cmGlobalGenerator>(std::move(ret));
}
void GetDocumentation(cmDocumentationEntry& entry) const override
@@ -113,9 +118,10 @@ public:
std::string GetDefaultPlatformName() const override { return "Win32"; }
};
-cmGlobalGeneratorFactory* cmGlobalVisualStudio11Generator::NewFactory()
+std::unique_ptr<cmGlobalGeneratorFactory>
+cmGlobalVisualStudio11Generator::NewFactory()
{
- return new Factory;
+ return std::unique_ptr<cmGlobalGeneratorFactory>(new Factory);
}
cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator(
diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h
index f8cce18..5f1ff73 100644
--- a/Source/cmGlobalVisualStudio11Generator.h
+++ b/Source/cmGlobalVisualStudio11Generator.h
@@ -6,6 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <iosfwd>
+#include <memory>
#include <set>
#include <string>
@@ -20,7 +21,7 @@ class cmake;
class cmGlobalVisualStudio11Generator : public cmGlobalVisualStudio10Generator
{
public:
- static cmGlobalGeneratorFactory* NewFactory();
+ static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory();
bool MatchesGeneratorName(const std::string& name) const override;
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index d9702c9..5a27994 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -28,27 +28,30 @@ class cmGlobalVisualStudio12Generator::Factory
: public cmGlobalGeneratorFactory
{
public:
- cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
- cmake* cm) const override
+ std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
+ const std::string& name, cmake* cm) const override
{
std::string genName;
const char* p = cmVS12GenName(name, genName);
if (!p) {
- return 0;
+ return std::unique_ptr<cmGlobalGenerator>();
}
if (!*p) {
- return new cmGlobalVisualStudio12Generator(cm, genName, "");
+ return std::unique_ptr<cmGlobalGenerator>(
+ new cmGlobalVisualStudio12Generator(cm, genName, ""));
}
if (*p++ != ' ') {
- return 0;
+ return std::unique_ptr<cmGlobalGenerator>();
}
if (strcmp(p, "Win64") == 0) {
- return new cmGlobalVisualStudio12Generator(cm, genName, "x64");
+ return std::unique_ptr<cmGlobalGenerator>(
+ new cmGlobalVisualStudio12Generator(cm, genName, "x64"));
}
if (strcmp(p, "ARM") == 0) {
- return new cmGlobalVisualStudio12Generator(cm, genName, "ARM");
+ return std::unique_ptr<cmGlobalGenerator>(
+ new cmGlobalVisualStudio12Generator(cm, genName, "ARM"));
}
- return 0;
+ return std::unique_ptr<cmGlobalGenerator>();
}
void GetDocumentation(cmDocumentationEntry& entry) const override
@@ -88,9 +91,10 @@ public:
std::string GetDefaultPlatformName() const override { return "Win32"; }
};
-cmGlobalGeneratorFactory* cmGlobalVisualStudio12Generator::NewFactory()
+std::unique_ptr<cmGlobalGeneratorFactory>
+cmGlobalVisualStudio12Generator::NewFactory()
{
- return new Factory;
+ return std::unique_ptr<cmGlobalGeneratorFactory>(new Factory);
}
cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator(
diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h
index 53b7091..bdd40ff 100644
--- a/Source/cmGlobalVisualStudio12Generator.h
+++ b/Source/cmGlobalVisualStudio12Generator.h
@@ -6,6 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <iosfwd>
+#include <memory>
#include <string>
#include "cmGlobalVisualStudio11Generator.h"
@@ -18,7 +19,7 @@ class cmake;
class cmGlobalVisualStudio12Generator : public cmGlobalVisualStudio11Generator
{
public:
- static cmGlobalGeneratorFactory* NewFactory();
+ static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory();
bool MatchesGeneratorName(const std::string& name) const override;
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index cd48474..779753e 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -28,27 +28,30 @@ class cmGlobalVisualStudio14Generator::Factory
: public cmGlobalGeneratorFactory
{
public:
- cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
- cmake* cm) const override
+ std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
+ const std::string& name, cmake* cm) const override
{
std::string genName;
const char* p = cmVS14GenName(name, genName);
if (!p) {
- return 0;
+ return std::unique_ptr<cmGlobalGenerator>();
}
if (!*p) {
- return new cmGlobalVisualStudio14Generator(cm, genName, "");
+ return std::unique_ptr<cmGlobalGenerator>(
+ new cmGlobalVisualStudio14Generator(cm, genName, ""));
}
if (*p++ != ' ') {
- return 0;
+ return std::unique_ptr<cmGlobalGenerator>();
}
if (strcmp(p, "Win64") == 0) {
- return new cmGlobalVisualStudio14Generator(cm, genName, "x64");
+ return std::unique_ptr<cmGlobalGenerator>(
+ new cmGlobalVisualStudio14Generator(cm, genName, "x64"));
}
if (strcmp(p, "ARM") == 0) {
- return new cmGlobalVisualStudio14Generator(cm, genName, "ARM");
+ return std::unique_ptr<cmGlobalGenerator>(
+ new cmGlobalVisualStudio14Generator(cm, genName, "ARM"));
}
- return 0;
+ return std::unique_ptr<cmGlobalGenerator>();
}
void GetDocumentation(cmDocumentationEntry& entry) const override
@@ -88,9 +91,10 @@ public:
std::string GetDefaultPlatformName() const override { return "Win32"; }
};
-cmGlobalGeneratorFactory* cmGlobalVisualStudio14Generator::NewFactory()
+std::unique_ptr<cmGlobalGeneratorFactory>
+cmGlobalVisualStudio14Generator::NewFactory()
{
- return new Factory;
+ return std::unique_ptr<cmGlobalGeneratorFactory>(new Factory);
}
cmGlobalVisualStudio14Generator::cmGlobalVisualStudio14Generator(
diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h
index 6e12d3e..ccc2917 100644
--- a/Source/cmGlobalVisualStudio14Generator.h
+++ b/Source/cmGlobalVisualStudio14Generator.h
@@ -6,6 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <iosfwd>
+#include <memory>
#include <string>
#include "cmGlobalVisualStudio12Generator.h"
@@ -18,7 +19,7 @@ class cmake;
class cmGlobalVisualStudio14Generator : public cmGlobalVisualStudio12Generator
{
public:
- static cmGlobalGeneratorFactory* NewFactory();
+ static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory();
bool MatchesGeneratorName(const std::string& name) const override;
diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx
index 6e61d26..9f73c15 100644
--- a/Source/cmGlobalVisualStudio9Generator.cxx
+++ b/Source/cmGlobalVisualStudio9Generator.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalVisualStudio9Generator.h"
+#include <utility>
+
#include "cmDocumentationEntry.h"
#include "cmLocalVisualStudio7Generator.h"
#include "cmMakefile.h"
@@ -13,43 +15,46 @@ static const char vs9generatorName[] = "Visual Studio 9 2008";
class cmGlobalVisualStudio9Generator::Factory : public cmGlobalGeneratorFactory
{
public:
- cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
- cmake* cm) const override
+ std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
+ const std::string& name, cmake* cm) const override
{
if (strncmp(name.c_str(), vs9generatorName,
sizeof(vs9generatorName) - 1) != 0) {
- return 0;
+ return std::unique_ptr<cmGlobalGenerator>();
}
const char* p = name.c_str() + sizeof(vs9generatorName) - 1;
if (p[0] == '\0') {
- return new cmGlobalVisualStudio9Generator(cm, name, "");
+ return std::unique_ptr<cmGlobalGenerator>(
+ new cmGlobalVisualStudio9Generator(cm, name, ""));
}
if (p[0] != ' ') {
- return 0;
+ return std::unique_ptr<cmGlobalGenerator>();
}
++p;
if (!strcmp(p, "IA64")) {
- return new cmGlobalVisualStudio9Generator(cm, name, "Itanium");
+ return std::unique_ptr<cmGlobalGenerator>(
+ new cmGlobalVisualStudio9Generator(cm, name, "Itanium"));
}
if (!strcmp(p, "Win64")) {
- return new cmGlobalVisualStudio9Generator(cm, name, "x64");
+ return std::unique_ptr<cmGlobalGenerator>(
+ new cmGlobalVisualStudio9Generator(cm, name, "x64"));
}
cmVisualStudioWCEPlatformParser parser(p);
parser.ParseVersion("9.0");
if (!parser.Found()) {
- return 0;
+ return std::unique_ptr<cmGlobalGenerator>();
}
- cmGlobalVisualStudio9Generator* ret =
- new cmGlobalVisualStudio9Generator(cm, name, p);
+ auto ret = std::unique_ptr<cmGlobalVisualStudio9Generator>(
+ new cmGlobalVisualStudio9Generator(cm, name, p));
ret->WindowsCEVersion = parser.GetOSVersion();
- return ret;
+ return std::unique_ptr<cmGlobalGenerator>(std::move(ret));
}
void GetDocumentation(cmDocumentationEntry& entry) const override
@@ -103,9 +108,10 @@ public:
std::string GetDefaultPlatformName() const override { return "Win32"; }
};
-cmGlobalGeneratorFactory* cmGlobalVisualStudio9Generator::NewFactory()
+std::unique_ptr<cmGlobalGeneratorFactory>
+cmGlobalVisualStudio9Generator::NewFactory()
{
- return new Factory;
+ return std::unique_ptr<cmGlobalGeneratorFactory>(new Factory);
}
cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator(
diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h
index 7bebfd6..53318a6 100644
--- a/Source/cmGlobalVisualStudio9Generator.h
+++ b/Source/cmGlobalVisualStudio9Generator.h
@@ -3,6 +3,8 @@
#ifndef cmGlobalVisualStudio9Generator_h
#define cmGlobalVisualStudio9Generator_h
+#include <memory>
+
#include "cmGlobalVisualStudio8Generator.h"
/** \class cmGlobalVisualStudio9Generator
@@ -13,7 +15,7 @@
class cmGlobalVisualStudio9Generator : public cmGlobalVisualStudio8Generator
{
public:
- static cmGlobalGeneratorFactory* NewFactory();
+ static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory();
/**
* Where does this version of Visual Studio look for macros for the
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
index a371633..13ae32a 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
@@ -121,30 +121,33 @@ class cmGlobalVisualStudioVersionedGenerator::Factory15
: public cmGlobalGeneratorFactory
{
public:
- cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
- cmake* cm) const override
+ std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
+ const std::string& name, cmake* cm) const override
{
std::string genName;
const char* p = cmVS15GenName(name, genName);
if (!p) {
- return 0;
+ return std::unique_ptr<cmGlobalGenerator>();
}
if (!*p) {
- return new cmGlobalVisualStudioVersionedGenerator(
- cmGlobalVisualStudioGenerator::VS15, cm, genName, "");
+ return std::unique_ptr<cmGlobalGenerator>(
+ new cmGlobalVisualStudioVersionedGenerator(
+ cmGlobalVisualStudioGenerator::VS15, cm, genName, ""));
}
if (*p++ != ' ') {
- return 0;
+ return std::unique_ptr<cmGlobalGenerator>();
}
if (strcmp(p, "Win64") == 0) {
- return new cmGlobalVisualStudioVersionedGenerator(
- cmGlobalVisualStudioGenerator::VS15, cm, genName, "x64");
+ return std::unique_ptr<cmGlobalGenerator>(
+ new cmGlobalVisualStudioVersionedGenerator(
+ cmGlobalVisualStudioGenerator::VS15, cm, genName, "x64"));
}
if (strcmp(p, "ARM") == 0) {
- return new cmGlobalVisualStudioVersionedGenerator(
- cmGlobalVisualStudioGenerator::VS15, cm, genName, "ARM");
+ return std::unique_ptr<cmGlobalGenerator>(
+ new cmGlobalVisualStudioVersionedGenerator(
+ cmGlobalVisualStudioGenerator::VS15, cm, genName, "ARM"));
}
- return 0;
+ return std::unique_ptr<cmGlobalGenerator>();
}
void GetDocumentation(cmDocumentationEntry& entry) const override
@@ -185,10 +188,10 @@ public:
std::string GetDefaultPlatformName() const override { return "Win32"; }
};
-cmGlobalGeneratorFactory*
+std::unique_ptr<cmGlobalGeneratorFactory>
cmGlobalVisualStudioVersionedGenerator::NewFactory15()
{
- return new Factory15;
+ return std::unique_ptr<cmGlobalGeneratorFactory>(new Factory15);
}
static const char vs16generatorName[] = "Visual Studio 16 2019";
@@ -212,19 +215,20 @@ class cmGlobalVisualStudioVersionedGenerator::Factory16
: public cmGlobalGeneratorFactory
{
public:
- cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
- cmake* cm) const override
+ std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
+ const std::string& name, cmake* cm) const override
{
std::string genName;
const char* p = cmVS16GenName(name, genName);
if (!p) {
- return 0;
+ return std::unique_ptr<cmGlobalGenerator>();
}
if (!*p) {
- return new cmGlobalVisualStudioVersionedGenerator(
- cmGlobalVisualStudioGenerator::VS16, cm, genName, "");
+ return std::unique_ptr<cmGlobalGenerator>(
+ new cmGlobalVisualStudioVersionedGenerator(
+ cmGlobalVisualStudioGenerator::VS16, cm, genName, ""));
}
- return 0;
+ return std::unique_ptr<cmGlobalGenerator>();
}
void GetDocumentation(cmDocumentationEntry& entry) const override
@@ -265,10 +269,10 @@ public:
}
};
-cmGlobalGeneratorFactory*
+std::unique_ptr<cmGlobalGeneratorFactory>
cmGlobalVisualStudioVersionedGenerator::NewFactory16()
{
- return new Factory16;
+ return std::unique_ptr<cmGlobalGeneratorFactory>(new Factory16);
}
cmGlobalVisualStudioVersionedGenerator::cmGlobalVisualStudioVersionedGenerator(
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.h b/Source/cmGlobalVisualStudioVersionedGenerator.h
index 466816b..abb6095 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.h
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.h
@@ -6,6 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <iosfwd>
+#include <memory>
#include <string>
#include "cmGlobalVisualStudio14Generator.h"
@@ -19,8 +20,8 @@ class cmGlobalVisualStudioVersionedGenerator
: public cmGlobalVisualStudio14Generator
{
public:
- static cmGlobalGeneratorFactory* NewFactory15();
- static cmGlobalGeneratorFactory* NewFactory16();
+ static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory15();
+ static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory16();
bool MatchesGeneratorName(const std::string& name) const override;
diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h
index 64ace13..c0daf8a 100644
--- a/Source/cmGlobalWatcomWMakeGenerator.h
+++ b/Source/cmGlobalWatcomWMakeGenerator.h
@@ -6,6 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <iosfwd>
+#include <memory>
#include <string>
#include <vector>
@@ -25,9 +26,10 @@ class cmGlobalWatcomWMakeGenerator : public cmGlobalUnixMakefileGenerator3
{
public:
cmGlobalWatcomWMakeGenerator(cmake* cm);
- static cmGlobalGeneratorFactory* NewFactory()
+ static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory()
{
- return new cmGlobalGeneratorSimpleFactory<cmGlobalWatcomWMakeGenerator>();
+ return std::unique_ptr<cmGlobalGeneratorFactory>(
+ new cmGlobalGeneratorSimpleFactory<cmGlobalWatcomWMakeGenerator>());
}
//! Get the name for the generator.
std::string GetName() const override
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index dcd9705..607b2b3 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -131,8 +131,8 @@ public:
class cmGlobalXCodeGenerator::Factory : public cmGlobalGeneratorFactory
{
public:
- cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
- cmake* cm) const override;
+ std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
+ const std::string& name, cmake* cm) const override;
void GetDocumentation(cmDocumentationEntry& entry) const override
{
@@ -181,16 +181,17 @@ cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(
cm->GetState()->SetIsGeneratorMultiConfig(true);
}
-cmGlobalGeneratorFactory* cmGlobalXCodeGenerator::NewFactory()
+std::unique_ptr<cmGlobalGeneratorFactory> cmGlobalXCodeGenerator::NewFactory()
{
- return new Factory;
+ return std::unique_ptr<cmGlobalGeneratorFactory>(new Factory);
}
-cmGlobalGenerator* cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(
- const std::string& name, cmake* cm) const
+std::unique_ptr<cmGlobalGenerator>
+cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(const std::string& name,
+ cmake* cm) const
{
if (name != GetActualName()) {
- return nullptr;
+ return std::unique_ptr<cmGlobalGenerator>();
}
#if !defined(CMAKE_BOOTSTRAP)
cmXcodeVersionParser parser;
@@ -226,16 +227,17 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(
if (version_number < 50) {
cm->IssueMessage(MessageType::FATAL_ERROR,
"Xcode " + version_string + " not supported.");
- return nullptr;
+ return std::unique_ptr<cmGlobalGenerator>();
}
- auto gg = cm::make_unique<cmGlobalXCodeGenerator>(cm, version_string,
- version_number);
- return gg.release();
+ return std::unique_ptr<cmGlobalGenerator>(
+ cm::make_unique<cmGlobalXCodeGenerator>(cm, version_string,
+ version_number));
#else
std::cerr << "CMake should be built with cmake to use Xcode, "
"default to Xcode 1.5\n";
- return new cmGlobalXCodeGenerator(cm);
+ return std::unique_ptr<cmGlobalGenerator>(
+ cm::make_unique<cmGlobalXCodeGenerator>(cm));
#endif
}
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index a12021d..df68f80 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -35,7 +35,7 @@ class cmGlobalXCodeGenerator : public cmGlobalGenerator
public:
cmGlobalXCodeGenerator(cmake* cm, std::string const& version_string,
unsigned int version_number);
- static cmGlobalGeneratorFactory* NewFactory();
+ static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory();
//! Get the name for the generator.
std::string GetName() const override
diff --git a/Source/cmJsonObjects.cxx b/Source/cmJsonObjects.cxx
index 5f86d85..54edabc 100644
--- a/Source/cmJsonObjects.cxx
+++ b/Source/cmJsonObjects.cxx
@@ -8,6 +8,7 @@
#include <functional>
#include <limits>
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <unordered_map>
@@ -44,7 +45,7 @@ namespace {
std::vector<std::string> getConfigurations(const cmake* cm)
{
std::vector<std::string> configurations;
- auto makefiles = cm->GetGlobalGenerator()->GetMakefiles();
+ const auto& makefiles = cm->GetGlobalGenerator()->GetMakefiles();
if (makefiles.empty()) {
return configurations;
}
@@ -83,8 +84,8 @@ void cmGetCMakeInputs(const cmGlobalGenerator* gg,
std::vector<std::string>* tmpFiles)
{
const std::string cmakeRootDir = cmSystemTools::GetCMakeRoot() + '/';
- std::vector<cmMakefile*> const& makefiles = gg->GetMakefiles();
- for (cmMakefile const* mf : makefiles) {
+ auto const& makefiles = gg->GetMakefiles();
+ for (const auto& mf : makefiles) {
for (std::string const& lf : mf->GetListFiles()) {
const std::string startOfFile = lf.substr(0, cmakeRootDir.size());
diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx
index d845652..847334b 100644
--- a/Source/cmLinkLineDeviceComputer.cxx
+++ b/Source/cmLinkLineDeviceComputer.cxx
@@ -183,29 +183,29 @@ bool requireDeviceLinking(cmGeneratorTarget& target, cmLocalGenerator& lg,
return cmIsOn(resolveDeviceSymbols);
}
- if (const char* separableCompilation =
- target.GetProperty("CUDA_SEPARABLE_COMPILATION")) {
- if (cmIsOn(separableCompilation)) {
- bool doDeviceLinking = false;
- switch (target.GetType()) {
- case cmStateEnums::SHARED_LIBRARY:
- case cmStateEnums::MODULE_LIBRARY:
- case cmStateEnums::EXECUTABLE:
- doDeviceLinking = true;
- break;
- default:
- break;
- }
- return doDeviceLinking;
- }
- }
-
// Determine if we have any dependencies that require
// us to do a device link step
cmGeneratorTarget::LinkClosure const* closure =
target.GetLinkClosure(config);
if (cmContains(closure->Languages, "CUDA")) {
+ if (const char* separableCompilation =
+ target.GetProperty("CUDA_SEPARABLE_COMPILATION")) {
+ if (cmIsOn(separableCompilation)) {
+ bool doDeviceLinking = false;
+ switch (target.GetType()) {
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
+ case cmStateEnums::EXECUTABLE:
+ doDeviceLinking = true;
+ break;
+ default:
+ break;
+ }
+ return doDeviceLinking;
+ }
+ }
+
cmComputeLinkInformation* pcli = target.GetLinkInformation(config);
if (pcli) {
cmLinkLineDeviceComputer deviceLinkComputer(
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 2caa266..fa7bce1 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -7,6 +7,7 @@
#include <algorithm>
#include <cassert>
#include <cctype>
+#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
@@ -14,12 +15,15 @@
#include <utility>
#include <cm/iterator>
+#include <cm/memory>
#include <cm/optional>
#include <cmext/algorithm>
#include "cmsys/FStream.hxx"
#include "cmsys/RegularExpression.hxx"
+#include "cm_jsoncpp_value.h"
+#include "cm_jsoncpp_writer.h"
#include "cm_sys_stat.h"
#include "cmAlgorithms.h"
@@ -315,21 +319,51 @@ void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const
}
std::ostringstream msg;
- msg << full_path << "(" << lff.Line << "): ";
- msg << lff.Name.Original << "(";
- bool expand = this->GetCMakeInstance()->GetTraceExpand();
+ std::vector<std::string> args;
std::string temp;
+ bool expand = this->GetCMakeInstance()->GetTraceExpand();
+
+ args.reserve(lff.Arguments.size());
for (cmListFileArgument const& arg : lff.Arguments) {
if (expand) {
temp = arg.Value;
this->ExpandVariablesInString(temp);
- msg << temp;
+ args.push_back(temp);
} else {
- msg << arg.Value;
+ args.push_back(arg.Value);
+ }
+ }
+
+ switch (this->GetCMakeInstance()->GetTraceFormat()) {
+ case cmake::TraceFormat::TRACE_JSON_V1: {
+#ifndef CMAKE_BOOTSTRAP
+ Json::Value val;
+ Json::StreamWriterBuilder builder;
+ builder["indentation"] = "";
+ val["file"] = full_path;
+ val["line"] = static_cast<std::int64_t>(lff.Line);
+ val["cmd"] = lff.Name.Original;
+ val["args"] = Json::Value(Json::arrayValue);
+ for (std::string const& arg : args) {
+ val["args"].append(arg);
+ }
+ msg << Json::writeString(builder, val);
+#endif
+ break;
}
- msg << " ";
+ case cmake::TraceFormat::TRACE_HUMAN:
+ msg << full_path << "(" << lff.Line << "): ";
+ msg << lff.Name.Original << "(";
+
+ for (std::string const& arg : args) {
+ msg << arg << " ";
+ }
+ msg << ")";
+ break;
+ case cmake::TraceFormat::TRACE_UNDEFINED:
+ msg << "INTERNAL ERROR: Trace format is TRACE_UNDEFINED";
+ break;
}
- msg << ")";
auto& f = this->GetCMakeInstance()->GetTraceFile();
if (f) {
@@ -1690,8 +1724,10 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
cmSystemTools::MakeDirectory(binPath);
- cmMakefile* subMf = new cmMakefile(this->GlobalGenerator, newSnapshot);
- this->GetGlobalGenerator()->AddMakefile(subMf);
+ auto subMfu =
+ cm::make_unique<cmMakefile>(this->GlobalGenerator, newSnapshot);
+ auto subMf = subMfu.get();
+ this->GetGlobalGenerator()->AddMakefile(std::move(subMfu));
if (excludeFromAll) {
subMf->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
@@ -3582,8 +3618,7 @@ int cmMakefile::TryCompile(const std::string& srcdir,
// be run that way but the cmake object requires a vailid path
cmake cm(cmake::RoleProject, cmState::Project);
cm.SetIsInTryCompile(true);
- cmGlobalGenerator* gg =
- cm.CreateGlobalGenerator(this->GetGlobalGenerator()->GetName());
+ auto gg = cm.CreateGlobalGenerator(this->GetGlobalGenerator()->GetName());
if (!gg) {
this->IssueMessage(MessageType::INTERNAL_ERROR,
"Global generator '" +
@@ -3594,7 +3629,7 @@ int cmMakefile::TryCompile(const std::string& srcdir,
return 1;
}
gg->RecursionDepth = this->RecursionDepth;
- cm.SetGlobalGenerator(gg);
+ cm.SetGlobalGenerator(std::move(gg));
// do a configure
cm.SetHomeDirectory(srcdir);
@@ -3603,7 +3638,7 @@ int cmMakefile::TryCompile(const std::string& srcdir,
cm.SetGeneratorPlatform(this->GetSafeDefinition("CMAKE_GENERATOR_PLATFORM"));
cm.SetGeneratorToolset(this->GetSafeDefinition("CMAKE_GENERATOR_TOOLSET"));
cm.LoadCache();
- if (!gg->IsMultiConfig()) {
+ if (!cm.GetGlobalGenerator()->IsMultiConfig()) {
if (const char* config =
this->GetDefinition("CMAKE_TRY_COMPILE_CONFIGURATION")) {
// Tell the single-configuration generator which one to use.
@@ -3649,7 +3684,8 @@ int cmMakefile::TryCompile(const std::string& srcdir,
cm.SetCacheArgs(*cmakeArgs);
}
// to save time we pass the EnableLanguage info directly
- gg->EnableLanguagesFromGenerator(this->GetGlobalGenerator(), this);
+ cm.GetGlobalGenerator()->EnableLanguagesFromGenerator(
+ this->GetGlobalGenerator(), this);
if (this->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS")) {
cm.AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "TRUE", "",
cmStateEnums::INTERNAL);
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 5c9608c..1df5410 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -420,10 +420,10 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
this->GetTargetLinkFlags(linkFlags, linkLanguage);
{
- std::unique_ptr<cmLinkLineComputer> linkLineComputer(
+ std::unique_ptr<cmLinkLineComputer> linkLineComputer =
this->CreateLinkLineComputer(
this->LocalGenerator,
- this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+ this->LocalGenerator->GetStateSnapshot().GetDirectory());
this->AddModuleDefinitionFlag(linkLineComputer.get(), linkFlags,
this->GetConfigName());
@@ -509,10 +509,10 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// Set path conversion for link script shells.
this->LocalGenerator->SetLinkScriptShell(useLinkScript);
- std::unique_ptr<cmLinkLineComputer> linkLineComputer(
+ std::unique_ptr<cmLinkLineComputer> linkLineComputer =
this->CreateLinkLineComputer(
this->LocalGenerator,
- this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+ this->LocalGenerator->GetStateSnapshot().GetDirectory());
linkLineComputer->SetForResponse(useResponseFileForLibs);
linkLineComputer->SetUseWatcomQuote(useWatcomQuote);
linkLineComputer->SetRelink(relink);
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index e728b67..357e273 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -172,10 +172,10 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
this->LocalGenerator->AddConfigVariableFlags(
extraFlags, "CMAKE_SHARED_LINKER_FLAGS", this->GetConfigName());
- std::unique_ptr<cmLinkLineComputer> linkLineComputer(
+ std::unique_ptr<cmLinkLineComputer> linkLineComputer =
this->CreateLinkLineComputer(
this->LocalGenerator,
- this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+ this->LocalGenerator->GetStateSnapshot().GetDirectory());
this->AddModuleDefinitionFlag(linkLineComputer.get(), extraFlags,
this->GetConfigName());
@@ -207,10 +207,10 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
this->LocalGenerator->AddConfigVariableFlags(
extraFlags, "CMAKE_MODULE_LINKER_FLAGS", this->GetConfigName());
- std::unique_ptr<cmLinkLineComputer> linkLineComputer(
+ std::unique_ptr<cmLinkLineComputer> linkLineComputer =
this->CreateLinkLineComputer(
this->LocalGenerator,
- this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+ this->LocalGenerator->GetStateSnapshot().GetDirectory());
this->AddModuleDefinitionFlag(linkLineComputer.get(), extraFlags,
this->GetConfigName());
@@ -700,10 +700,10 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
std::string linkLibs;
if (this->GeneratorTarget->GetType() != cmStateEnums::STATIC_LIBRARY) {
- std::unique_ptr<cmLinkLineComputer> linkLineComputer(
+ std::unique_ptr<cmLinkLineComputer> linkLineComputer =
this->CreateLinkLineComputer(
this->LocalGenerator,
- this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+ this->LocalGenerator->GetStateSnapshot().GetDirectory());
linkLineComputer->SetForResponse(useResponseFileForLibs);
linkLineComputer->SetUseWatcomQuote(useWatcomQuote);
linkLineComputer->SetRelink(relink);
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 4979da5..77b6bc2 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -17,6 +17,7 @@
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalUnixMakefileGenerator3.h"
+#include "cmLinkLineComputer.h"
#include "cmLocalCommonGenerator.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
@@ -753,8 +754,8 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
// See if we need to use a compiler launcher like ccache or distcc
std::string compilerLauncher;
if (!compileCommands.empty() &&
- (lang == "C" || lang == "CXX" || lang == "Fortran" ||
- lang == "CUDA")) {
+ (lang == "C" || lang == "CXX" || lang == "Fortran" || lang == "CUDA" ||
+ lang == "OBJC" || lang == "OBJCXX")) {
std::string const clauncher_prop = lang + "_COMPILER_LAUNCHER";
const char* clauncher =
this->GeneratorTarget->GetProperty(clauncher_prop);
@@ -1634,7 +1635,8 @@ std::string cmMakefileTargetGenerator::CreateResponseFile(
return responseFileName;
}
-cmLinkLineComputer* cmMakefileTargetGenerator::CreateLinkLineComputer(
+std::unique_ptr<cmLinkLineComputer>
+cmMakefileTargetGenerator::CreateLinkLineComputer(
cmOutputConverter* outputConverter, cmStateDirectory const& stateDir)
{
if (this->Makefile->IsOn("MSVC60")) {
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index 710ef89..fd62933 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -140,7 +140,7 @@ protected:
std::vector<std::string>& makefile_commands,
std::vector<std::string>& makefile_depends);
- cmLinkLineComputer* CreateLinkLineComputer(
+ std::unique_ptr<cmLinkLineComputer> CreateLinkLineComputer(
cmOutputConverter* outputConverter, cmStateDirectory const& stateDir);
/** Create a response file with the given set of options. Returns
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 5a12855..987f241 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -884,10 +884,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
vars["TARGET_FILE"] =
localGen.ConvertToOutputFormat(targetOutputReal, cmOutputConverter::SHELL);
- std::unique_ptr<cmLinkLineComputer> linkLineComputer(
+ std::unique_ptr<cmLinkLineComputer> linkLineComputer =
globalGen->CreateLinkLineComputer(
this->GetLocalGenerator(),
- this->GetLocalGenerator()->GetStateSnapshot().GetDirectory()));
+ this->GetLocalGenerator()->GetStateSnapshot().GetDirectory());
linkLineComputer->SetUseWatcomQuote(useWatcomQuote);
linkLineComputer->SetUseNinjaMulti(globalGen->IsMultiConfig());
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 3f1dbe8..bd19b28 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -724,7 +724,8 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
// See if we need to use a compiler launcher like ccache or distcc
std::string compilerLauncher;
if (!compileCmds.empty() &&
- (lang == "C" || lang == "CXX" || lang == "Fortran" || lang == "CUDA")) {
+ (lang == "C" || lang == "CXX" || lang == "Fortran" || lang == "CUDA" ||
+ lang == "OBJC" || lang == "OBJCXX")) {
std::string const clauncher_prop = lang + "_COMPILER_LAUNCHER";
const char* clauncher = this->GeneratorTarget->GetProperty(clauncher_prop);
if (clauncher && *clauncher) {
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index ecf892b..8d292ac 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -297,7 +297,9 @@ class cmMakefile;
SELECT(POLICY, CMP0099, \
"Link properties are transitive over private dependency on static " \
"libraries.", \
- 3, 17, 0, cmPolicies::WARN)
+ 3, 17, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0100, "Let AUTOMOC and AUTOUIC process .hh files.", 3, \
+ 17, 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/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index ab47f3f..46f1716 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -42,6 +42,7 @@
#include "cmSourceGroup.h"
#include "cmState.h"
#include "cmStateTypes.h"
+#include "cmString.hxx"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
@@ -354,24 +355,38 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
}
}
- // Check status of policy CMP0071
- {
- cmPolicies::PolicyStatus const CMP0071_status =
- this->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;
- }
+ // Check status of policy CMP0071 regarding handling of GENERATED files
+ switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0071)) {
+ case cmPolicies::WARN:
+ // Ignore GENERATED files but warn
+ this->CMP0071Warn = true;
+ CM_FALLTHROUGH;
+ case cmPolicies::OLD:
+ // Ignore GENERATED files
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ // Process GENERATED files
+ this->CMP0071Accept = true;
+ break;
+ }
+
+ // Check status of policy CMP0100 regarding handling of .hh headers
+ switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0100)) {
+ case cmPolicies::WARN:
+ // Ignore but .hh files but warn
+ this->CMP0100Warn = true;
+ CM_FALLTHROUGH;
+ case cmPolicies::OLD:
+ // Ignore .hh files
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ // Process .hh file
+ this->CMP0100Accept = true;
+ break;
}
// Common directories
@@ -733,15 +748,26 @@ bool cmQtAutoGenInitializer::InitScanFiles()
return muf;
};
- auto addMUFile = [&](MUFileHandle&& muf, bool isHeader) {
+ auto addMUHeader = [this](MUFileHandle&& muf, cm::string_view extension) {
+ cmSourceFile* sf = muf->SF;
+ const bool muIt = (muf->MocIt || muf->UicIt);
+ if (this->CMP0100Accept || (extension != "hh")) {
+ // Accept
+ if (muIt && muf->Generated) {
+ this->AutogenTarget.FilesGenerated.emplace_back(muf.get());
+ }
+ this->AutogenTarget.Headers.emplace(sf, std::move(muf));
+ } else if (muIt && this->CMP0100Warn) {
+ // Store file for warning message
+ this->AutogenTarget.CMP0100HeadersWarn.push_back(sf);
+ }
+ };
+
+ auto addMUSource = [this](MUFileHandle&& muf) {
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));
- }
+ this->AutogenTarget.Sources.emplace(muf->SF, std::move(muf));
};
// Scan through target files
@@ -763,11 +789,10 @@ bool cmQtAutoGenInitializer::InitScanFiles()
// Register files that will be scanned by moc or uic
if (this->MocOrUicEnabled()) {
- // FIXME: Add a policy to include .hh files.
- if (cm->IsHeaderExtension(extLower) && extLower != "hh") {
- addMUFile(makeMUFile(sf, fullPath, true), true);
+ if (cm->IsHeaderExtension(extLower)) {
+ addMUHeader(makeMUFile(sf, fullPath, true), extLower);
} else if (cm->IsSourceExtension(extLower)) {
- addMUFile(makeMUFile(sf, fullPath, true), false);
+ addMUSource(makeMUFile(sf, fullPath, true));
}
}
@@ -801,8 +826,6 @@ bool cmQtAutoGenInitializer::InitScanFiles()
// 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
static std::initializer_list<cm::string_view> const suffixes{ "", "_p" };
auto const& exts = cm->GetHeaderExtensions();
@@ -847,16 +870,12 @@ bool cmQtAutoGenInitializer::InitScanFiles()
if (!muf.UicIt) {
eMuf->UicIt = false;
}
- extraHeaders.emplace_back(std::move(eMuf));
+ addMUHeader(std::move(eMuf), ext);
}
}
}
}
}
- // 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
@@ -876,19 +895,18 @@ bool cmQtAutoGenInitializer::InitScanFiles()
std::string const& extLower =
cmSystemTools::LowerCase(sf->GetExtension());
- // FIXME: Add a policy to include .hh files.
- if (cm->IsHeaderExtension(extLower) && extLower != "hh") {
+ if (cm->IsHeaderExtension(extLower)) {
if (!cmContains(this->AutogenTarget.Headers, sf)) {
auto muf = makeMUFile(sf, fullPath, false);
if (muf->SkipMoc || muf->SkipUic) {
- this->AutogenTarget.Headers.emplace(sf, std::move(muf));
+ addMUHeader(std::move(muf), extLower);
}
}
} else if (cm->IsSourceExtension(extLower)) {
- if (!cmContains(this->AutogenTarget.Headers, sf)) {
+ if (!cmContains(this->AutogenTarget.Sources, sf)) {
auto muf = makeMUFile(sf, fullPath, false);
if (muf->SkipMoc || muf->SkipUic) {
- this->AutogenTarget.Sources.emplace(sf, std::move(muf));
+ addMUSource(std::move(muf));
}
}
} else if (this->Uic.Enabled && (extLower == kw.ui)) {
@@ -946,6 +964,35 @@ bool cmQtAutoGenInitializer::InitScanFiles()
}
}
+ // Generate CMP0100 warning
+ if (this->MocOrUicEnabled() &&
+ !this->AutogenTarget.CMP0100HeadersWarn.empty()) {
+ cm::string_view 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";
+ }
+ std::string files;
+ for (cmSourceFile* sf : this->AutogenTarget.CMP0100HeadersWarn) {
+ files += cmStrCat(" ", Quoted(sf->GetFullPath()), '\n');
+ }
+ this->Makefile->IssueMessage(
+ MessageType::AUTHOR_WARNING,
+ cmStrCat(
+ cmPolicies::GetPolicyWarning(cmPolicies::CMP0100), '\n',
+ "For compatibility, CMake is excluding the header file(s):\n", files,
+ "from processing by ",
+ cmQtAutoGen::Tools(this->Moc.Enabled, this->Uic.Enabled, false),
+ ". If any of the files should be processed, set CMP0100 to NEW. "
+ "If any of the files should not be processed, "
+ "explicitly exclude them by setting the source file property ",
+ property, ":\n set_property(SOURCE file.hh PROPERTY ", property,
+ " ON)\n"));
+ }
+
// Process qrc files
if (!this->Rcc.Qrcs.empty()) {
const bool modernQt = (this->QtVersion.Major >= 5);
@@ -1634,21 +1681,39 @@ std::string cmQtAutoGenInitializer::GetMocBuildPath(MUFile const& muf)
if (!muf.MocIt) {
return res;
}
- {
- std::string const basePath =
- cmStrCat(this->PathCheckSum.getPart(muf.FullPath), "/moc_",
- FileNameWithoutLastExtension(muf.FullPath));
- std::string suffix;
- constexpr std::size_t num_tries_max = 256;
- for (std::size_t ii = 0; ii != num_tries_max; ++ii) {
- res = cmStrCat(basePath, suffix, ".cpp");
- if (this->Moc.EmittedBuildPaths.emplace(res).second) {
- break;
- }
- // Compute new suffix
- suffix = cmStrCat('_', ii + 1);
+
+ std::string basePath =
+ cmStrCat(this->PathCheckSum.getPart(muf.FullPath), "/moc_",
+ FileNameWithoutLastExtension(muf.FullPath));
+
+ res = cmStrCat(basePath, ".cpp");
+ if (this->Moc.EmittedBuildPaths.emplace(res).second) {
+ return res;
+ }
+
+ // File name already emitted.
+ // Try appending the header suffix to the base path.
+ basePath = cmStrCat(basePath, '_', muf.SF->GetExtension());
+ res = cmStrCat(basePath, ".cpp");
+ if (this->Moc.EmittedBuildPaths.emplace(res).second) {
+ return res;
+ }
+
+ // File name with header extension already emitted.
+ // Try adding a number to the base path.
+ constexpr std::size_t number_begin = 2;
+ constexpr std::size_t number_end = 256;
+ for (std::size_t ii = number_begin; ii != number_end; ++ii) {
+ res = cmStrCat(basePath, '_', ii, ".cpp");
+ if (this->Moc.EmittedBuildPaths.emplace(res).second) {
+ return res;
}
}
+
+ // Output file name conflict (unlikely, but still...)
+ cmSystemTools::Error(
+ cmStrCat("moc output file name conflict for ", muf.FullPath));
+
return res;
}
diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h
index 486dab7..847e4e5 100644
--- a/Source/cmQtAutoGenInitializer.h
+++ b/Source/cmQtAutoGenInitializer.h
@@ -159,6 +159,8 @@ private:
bool MultiConfig = false;
bool CMP0071Accept = false;
bool CMP0071Warn = false;
+ bool CMP0100Accept = false;
+ bool CMP0100Warn = false;
std::string ConfigDefault;
std::vector<std::string> ConfigsList;
std::string TargetsFolder;
@@ -192,6 +194,7 @@ private:
std::unordered_map<cmSourceFile*, MUFileHandle> Headers;
std::unordered_map<cmSourceFile*, MUFileHandle> Sources;
std::vector<MUFile*> FilesGenerated;
+ std::vector<cmSourceFile*> CMP0100HeadersWarn;
} AutogenTarget;
/** moc variables. */
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index 56003df..1d4ea01 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -744,7 +744,7 @@ void cmServerProtocol1::GeneratorInformation::SetupGenerator(
cm->SetHomeDirectory(SourceDirectory);
cm->SetHomeOutputDirectory(BuildDirectory);
- cmGlobalGenerator* gg = cm->CreateGlobalGenerator(fullGeneratorName);
+ auto gg = cm->CreateGlobalGenerator(fullGeneratorName);
if (!gg) {
setErrorMessage(
errorMessage,
@@ -753,7 +753,7 @@ void cmServerProtocol1::GeneratorInformation::SetupGenerator(
return;
}
- cm->SetGlobalGenerator(gg);
+ cm->SetGlobalGenerator(std::move(gg));
cm->SetGeneratorToolset(Toolset);
cm->SetGeneratorPlatform(Platform);
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 8c3a4cb..5e2a146 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -121,7 +121,7 @@ bool cmSetCommand(std::vector<std::string> const& args,
if (cache) {
std::string::size_type cacheStart = args.size() - 3 - (force ? 1 : 0);
- if (!cmState::StringToCacheEntryType(args[cacheStart + 1].c_str(), type)) {
+ if (!cmState::StringToCacheEntryType(args[cacheStart + 1], type)) {
std::string m = "implicitly converting '" + args[cacheStart + 1] +
"' to 'STRING' type.";
status.GetMakefile().IssueMessage(MessageType::AUTHOR_WARNING, m);
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 72f663d..9d83a72 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -3,9 +3,9 @@
#include "cmState.h"
#include <algorithm>
+#include <array>
#include <cassert>
#include <cstdlib>
-#include <cstring>
#include <utility>
#include <cm/memory>
@@ -60,43 +60,44 @@ const char* cmState::GetTargetTypeName(cmStateEnums::TargetType targetType)
return nullptr;
}
-const char* cmCacheEntryTypes[] = { "BOOL", "PATH", "FILEPATH",
- "STRING", "INTERNAL", "STATIC",
- "UNINITIALIZED", nullptr };
+static const std::array<std::string, 7> cmCacheEntryTypes = {
+ { "BOOL", "PATH", "FILEPATH", "STRING", "INTERNAL", "STATIC",
+ "UNINITIALIZED" }
+};
-const char* cmState::CacheEntryTypeToString(cmStateEnums::CacheEntryType type)
+const std::string& cmState::CacheEntryTypeToString(
+ cmStateEnums::CacheEntryType type)
{
- if (type > 6) {
- return cmCacheEntryTypes[6];
+ if (type < cmStateEnums::BOOL || type > cmStateEnums::UNINITIALIZED) {
+ type = cmStateEnums::UNINITIALIZED;
}
return cmCacheEntryTypes[type];
}
-cmStateEnums::CacheEntryType cmState::StringToCacheEntryType(const char* s)
+cmStateEnums::CacheEntryType cmState::StringToCacheEntryType(
+ const std::string& s)
{
cmStateEnums::CacheEntryType type = cmStateEnums::STRING;
StringToCacheEntryType(s, type);
return type;
}
-bool cmState::StringToCacheEntryType(const char* s,
+bool cmState::StringToCacheEntryType(const std::string& s,
cmStateEnums::CacheEntryType& type)
{
- int i = 0;
- while (cmCacheEntryTypes[i]) {
- if (strcmp(s, cmCacheEntryTypes[i]) == 0) {
+ for (size_t i = 0; i < cmCacheEntryTypes.size(); ++i) {
+ if (s == cmCacheEntryTypes[i]) {
type = static_cast<cmStateEnums::CacheEntryType>(i);
return true;
}
- ++i;
}
return false;
}
bool cmState::IsCacheEntryType(std::string const& key)
{
- for (int i = 0; cmCacheEntryTypes[i]; ++i) {
- if (key == cmCacheEntryTypes[i]) {
+ for (const std::string& i : cmCacheEntryTypes) {
+ if (key == i) {
return true;
}
}
@@ -1006,12 +1007,12 @@ bool cmState::ParseCacheEntry(const std::string& entry, std::string& var,
bool flag = false;
if (regQuoted.find(entry)) {
var = regQuoted.match(1);
- type = cmState::StringToCacheEntryType(regQuoted.match(2).c_str());
+ type = cmState::StringToCacheEntryType(regQuoted.match(2));
value = regQuoted.match(3);
flag = true;
} else if (reg.find(entry)) {
var = reg.match(1);
- type = cmState::StringToCacheEntryType(reg.match(2).c_str());
+ type = cmState::StringToCacheEntryType(reg.match(2));
value = reg.match(3);
flag = true;
}
diff --git a/Source/cmState.h b/Source/cmState.h
index cd871b9..a744266 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -70,10 +70,12 @@ public:
cmStateSnapshot const& originSnapshot);
cmStateSnapshot Pop(cmStateSnapshot const& originSnapshot);
- static cmStateEnums::CacheEntryType StringToCacheEntryType(const char*);
- static bool StringToCacheEntryType(const char*,
+ static cmStateEnums::CacheEntryType StringToCacheEntryType(
+ const std::string&);
+ static bool StringToCacheEntryType(const std::string&,
cmStateEnums::CacheEntryType& type);
- static const char* CacheEntryTypeToString(cmStateEnums::CacheEntryType);
+ static const std::string& CacheEntryTypeToString(
+ cmStateEnums::CacheEntryType);
static bool IsCacheEntryType(std::string const& key);
bool LoadCache(const std::string& path, bool internal,
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index d2693b8..9563321 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -336,6 +336,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
initProp("C_STANDARD");
initProp("C_STANDARD_REQUIRED");
initProp("C_EXTENSIONS");
+ initProp("OBJC_COMPILER_LAUNCHER");
initProp("OBJC_STANDARD");
initProp("OBJC_STANDARD_REQUIRED");
initProp("OBJC_EXTENSIONS");
@@ -347,6 +348,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
initProp("CXX_STANDARD");
initProp("CXX_STANDARD_REQUIRED");
initProp("CXX_EXTENSIONS");
+ initProp("OBJCXX_COMPILER_LAUNCHER");
initProp("OBJCXX_STANDARD");
initProp("OBJCXX_STANDARD_REQUIRED");
initProp("OBJCXX_EXTENSIONS");
@@ -358,7 +360,6 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
initProp("CUDA_RESOLVE_DEVICE_SYMBOLS");
initProp("LINK_SEARCH_START_STATIC");
initProp("LINK_SEARCH_END_STATIC");
- initProp("FOLDER");
initProp("Swift_LANGUAGE_VERSION");
initProp("Swift_MODULE_DIRECTORY");
initProp("VS_JUST_MY_CODE_DEBUGGING");
@@ -390,6 +391,8 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
}
if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
+ initProp("FOLDER");
+
if (this->GetGlobalGenerator()->IsXcode()) {
initProp("XCODE_GENERATE_SCHEME");
}
diff --git a/Source/cmTargetPropertyComputer.cxx b/Source/cmTargetPropertyComputer.cxx
index baab8da..f37995c 100644
--- a/Source/cmTargetPropertyComputer.cxx
+++ b/Source/cmTargetPropertyComputer.cxx
@@ -62,6 +62,7 @@ bool cmTargetPropertyComputer::WhiteListedInterfaceProperty(
"COMPATIBLE_INTERFACE_NUMBER_MAX",
"COMPATIBLE_INTERFACE_NUMBER_MIN",
"COMPATIBLE_INTERFACE_STRING",
+ "DEPRECATION",
"EXPORT_NAME",
"EXPORT_PROPERTIES",
"IMPORTED",
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 6b85937..ab76df9 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2,6 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmake.h"
+#include <algorithm>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <initializer_list>
+#include <iostream>
+#include <sstream>
+#include <utility>
+
#include <cm/memory>
#include <cm/string_view>
#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW)
@@ -10,6 +19,10 @@
#include <cmext/algorithm>
+#include "cmsys/FStream.hxx"
+#include "cmsys/Glob.hxx"
+#include "cmsys/RegularExpression.hxx"
+
#include "cm_sys_stat.h"
#include "cmAlgorithms.h"
@@ -58,6 +71,8 @@
// include the generator
#if defined(_WIN32) && !defined(__CYGWIN__)
# if !defined(CMAKE_BOOT_MINGW)
+# include <cmext/memory>
+
# include "cmGlobalBorlandMakefileGenerator.h"
# include "cmGlobalJOMMakefileGenerator.h"
# include "cmGlobalNMakeMakefileGenerator.h"
@@ -108,19 +123,6 @@
# include <sys/time.h>
#endif
-#include <algorithm>
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <initializer_list>
-#include <iostream>
-#include <sstream>
-#include <utility>
-
-#include "cmsys/FStream.hxx"
-#include "cmsys/Glob.hxx"
-#include "cmsys/RegularExpression.hxx"
-
namespace {
#if !defined(CMAKE_BOOTSTRAP)
@@ -203,14 +205,7 @@ cmake::cmake(Role role, cmState::Mode mode)
}
}
-cmake::~cmake()
-{
- if (this->GlobalGenerator) {
- delete this->GlobalGenerator;
- this->GlobalGenerator = nullptr;
- }
- cmDeleteAll(this->Generators);
-}
+cmake::~cmake() = default;
#if !defined(CMAKE_BOOTSTRAP)
Json::Value cmake::ReportVersionJson() const
@@ -463,12 +458,12 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
{
// if a generator was not yet created, temporarily create one
cmGlobalGenerator* gg = this->GetGlobalGenerator();
- bool created = false;
// if a generator was not specified use a generic one
+ std::unique_ptr<cmGlobalGenerator> gen;
if (!gg) {
- gg = new cmGlobalGenerator(this);
- created = true;
+ gen = cm::make_unique<cmGlobalGenerator>(this);
+ gg = gen.get();
}
// read in the list file to fill the cache
@@ -490,11 +485,6 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
cmSystemTools::Error("Error processing file: " + path);
}
}
-
- // free generic one if generated
- if (created) {
- delete gg;
- }
}
bool cmake::FindPackage(const std::vector<std::string>& args)
@@ -502,9 +492,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory());
this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory());
- // if a generator was not yet created, temporarily create one
- cmGlobalGenerator* gg = new cmGlobalGenerator(this);
- this->SetGlobalGenerator(gg);
+ this->SetGlobalGenerator(cm::make_unique<cmGlobalGenerator>(this));
cmStateSnapshot snapshot = this->GetCurrentSnapshot();
snapshot.GetDirectory().SetCurrentBinary(
@@ -513,8 +501,9 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
cmSystemTools::GetCurrentWorkingDirectory());
// read in the list file to fill the cache
snapshot.SetDefaultDefinitions();
- cmMakefile* mf = new cmMakefile(gg, snapshot);
- gg->AddMakefile(mf);
+ auto mfu = cm::make_unique<cmMakefile>(this->GetGlobalGenerator(), snapshot);
+ cmMakefile* mf = mfu.get();
+ this->GlobalGenerator->AddMakefile(std::move(mfu));
mf->SetArgcArgv(args);
@@ -539,8 +528,8 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
std::string includes = mf->GetSafeDefinition("PACKAGE_INCLUDE_DIRS");
std::vector<std::string> includeDirs = cmExpandedList(includes);
- gg->CreateGenerationObjects();
- const auto& lg = gg->LocalGenerators[0];
+ this->GlobalGenerator->CreateGenerationObjects();
+ const auto& lg = this->GlobalGenerator->LocalGenerators[0];
std::string includeFlags =
lg->GetIncludeFlags(includeDirs, nullptr, language);
@@ -566,8 +555,9 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
std::string linkPath;
std::string flags;
std::string linkFlags;
- gg->CreateGenerationObjects();
- cmGeneratorTarget* gtgt = gg->FindGeneratorTarget(tgt->GetName());
+ this->GlobalGenerator->CreateGenerationObjects();
+ cmGeneratorTarget* gtgt =
+ this->GlobalGenerator->FindGeneratorTarget(tgt->GetName());
cmLocalGenerator* lg = gtgt->GetLocalGenerator();
cmLinkLineComputer linkLineComputer(lg,
lg->GetStateSnapshot().GetDirectory());
@@ -587,10 +577,6 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
}*/
}
- // free generic one if generated
- // this->SetGlobalGenerator(0); // setting 0-pointer is not possible
- // delete gg; // this crashes inside the cmake instance
-
return packageFound;
}
@@ -758,6 +744,15 @@ void cmake::SetArgs(const std::vector<std::string>& args)
std::cout << "Running with expanded trace output on.\n";
this->SetTrace(true);
this->SetTraceExpand(true);
+ } else if (arg.find("--trace-format=", 0) == 0) {
+ this->SetTrace(true);
+ const auto traceFormat =
+ StringToTraceFormat(arg.substr(strlen("--trace-format=")));
+ if (traceFormat == TraceFormat::TRACE_UNDEFINED) {
+ cmSystemTools::Error("Invalid format specified for --trace-format");
+ return;
+ }
+ this->SetTraceFormat(traceFormat);
} else if (arg.find("--trace-source=", 0) == 0) {
std::string file = arg.substr(strlen("--trace-source="));
cmSystemTools::ConvertToUnixSlashes(file);
@@ -829,7 +824,7 @@ void cmake::SetArgs(const std::vector<std::string>& args)
}
value = args[i];
}
- cmGlobalGenerator* gen = this->CreateGlobalGenerator(value);
+ auto gen = this->CreateGlobalGenerator(value);
if (!gen) {
std::string kdevError;
if (value.find("KDevelop3", 0) != std::string::npos) {
@@ -841,7 +836,7 @@ void cmake::SetArgs(const std::vector<std::string>& args)
this->PrintGeneratorList();
return;
}
- this->SetGlobalGenerator(gen);
+ this->SetGlobalGenerator(std::move(gen));
}
// no option assume it is the path to the source or an existing build
else {
@@ -898,6 +893,23 @@ cmake::LogLevel cmake::StringToLogLevel(const std::string& levelStr)
return (it != levels.cend()) ? it->second : LogLevel::LOG_UNDEFINED;
}
+cmake::TraceFormat cmake::StringToTraceFormat(const std::string& traceStr)
+{
+ using TracePair = std::pair<std::string, TraceFormat>;
+ static const std::vector<TracePair> levels = {
+ { "human", TraceFormat::TRACE_HUMAN },
+ { "json-v1", TraceFormat::TRACE_JSON_V1 },
+ };
+
+ const auto traceStrLowCase = cmSystemTools::LowerCase(traceStr);
+
+ const auto it = std::find_if(levels.cbegin(), levels.cend(),
+ [&traceStrLowCase](const TracePair& p) {
+ return p.first == traceStrLowCase;
+ });
+ return (it != levels.cend()) ? it->second : TraceFormat::TRACE_UNDEFINED;
+}
+
void cmake::SetTraceFile(const std::string& file)
{
this->TraceFile.close();
@@ -912,6 +924,48 @@ void cmake::SetTraceFile(const std::string& file)
std::cout << "Trace will be written to " << file << "\n";
}
+void cmake::PrintTraceFormatVersion()
+{
+ if (!this->GetTrace()) {
+ return;
+ }
+
+ std::string msg;
+
+ switch (this->GetTraceFormat()) {
+ case TraceFormat::TRACE_JSON_V1: {
+#ifndef CMAKE_BOOTSTRAP
+ Json::Value val;
+ Json::Value version;
+ Json::StreamWriterBuilder builder;
+ builder["indentation"] = "";
+ version["major"] = 1;
+ version["minor"] = 0;
+ val["version"] = version;
+ msg = Json::writeString(builder, val);
+#endif
+ break;
+ }
+ case TraceFormat::TRACE_HUMAN:
+ msg = "";
+ break;
+ case TraceFormat::TRACE_UNDEFINED:
+ msg = "INTERNAL ERROR: Trace format is TRACE_UNDEFINED";
+ break;
+ }
+
+ if (msg.empty()) {
+ return;
+ }
+
+ auto& f = this->GetTraceFile();
+ if (f) {
+ f << msg << '\n';
+ } else {
+ cmSystemTools::Message(msg);
+ }
+}
+
void cmake::SetDirectoriesFromFile(const std::string& arg)
{
// Check if the argument refers to a CMakeCache.txt or
@@ -1050,7 +1104,7 @@ void cmake::AddDefaultExtraGenerators()
void cmake::GetRegisteredGenerators(std::vector<GeneratorInfo>& generators,
bool includeNamesWithPlatform) const
{
- for (cmGlobalGeneratorFactory* gen : this->Generators) {
+ for (const auto& gen : this->Generators) {
std::vector<std::string> names = gen->GetGeneratorNames();
if (includeNamesWithPlatform) {
@@ -1099,7 +1153,8 @@ void cmake::GetRegisteredGenerators(std::vector<GeneratorInfo>& generators,
}
}
-static std::pair<cmExternalMakefileProjectGenerator*, std::string>
+static std::pair<std::unique_ptr<cmExternalMakefileProjectGenerator>,
+ std::string>
createExtraGenerator(
const std::vector<cmExternalMakefileProjectGeneratorFactory*>& in,
const std::string& name)
@@ -1122,15 +1177,17 @@ createExtraGenerator(
return { nullptr, name };
}
-cmGlobalGenerator* cmake::CreateGlobalGenerator(const std::string& gname)
+std::unique_ptr<cmGlobalGenerator> cmake::CreateGlobalGenerator(
+ const std::string& gname)
{
- std::pair<cmExternalMakefileProjectGenerator*, std::string> extra =
- createExtraGenerator(this->ExtraGenerators, gname);
- cmExternalMakefileProjectGenerator* extraGenerator = extra.first;
- const std::string name = extra.second;
+ std::pair<std::unique_ptr<cmExternalMakefileProjectGenerator>, std::string>
+ extra = createExtraGenerator(this->ExtraGenerators, gname);
+ std::unique_ptr<cmExternalMakefileProjectGenerator>& extraGenerator =
+ extra.first;
+ const std::string& name = extra.second;
- cmGlobalGenerator* generator = nullptr;
- for (cmGlobalGeneratorFactory* g : this->Generators) {
+ std::unique_ptr<cmGlobalGenerator> generator;
+ for (const auto& g : this->Generators) {
generator = g->CreateGlobalGenerator(name, this);
if (generator) {
break;
@@ -1138,9 +1195,7 @@ cmGlobalGenerator* cmake::CreateGlobalGenerator(const std::string& gname)
}
if (generator) {
- generator->SetExternalMakefileProjectGenerator(extraGenerator);
- } else {
- delete extraGenerator;
+ generator->SetExternalMakefileProjectGenerator(std::move(extraGenerator));
}
return generator;
@@ -1192,15 +1247,13 @@ std::string cmake::FindCacheFile(const std::string& binaryDir)
return cachePath;
}
-void cmake::SetGlobalGenerator(cmGlobalGenerator* gg)
+void cmake::SetGlobalGenerator(std::unique_ptr<cmGlobalGenerator> gg)
{
if (!gg) {
cmSystemTools::Error("Error SetGlobalGenerator called with null");
return;
}
- // delete the old generator
if (this->GlobalGenerator) {
- delete this->GlobalGenerator;
// restore the original environment variables CXX and CC
// Restore CC
std::string env = "CC=";
@@ -1216,7 +1269,7 @@ void cmake::SetGlobalGenerator(cmGlobalGenerator* gg)
}
// set the new
- this->GlobalGenerator = gg;
+ this->GlobalGenerator = std::move(gg);
// set the global flag for unix style paths on cmSystemTools as soon as
// the generator is set. This allows gmake to be used on windows.
@@ -1579,7 +1632,7 @@ int cmake::ActualConfigure()
}
}
- cmMakefile* mf = this->GlobalGenerator->GetMakefiles()[0];
+ auto& mf = this->GlobalGenerator->GetMakefiles()[0];
if (mf->IsOn("CTEST_USE_LAUNCHERS") &&
!this->State->GetGlobalProperty("RULE_LAUNCH_COMPILE")) {
cmSystemTools::Error(
@@ -1600,13 +1653,12 @@ int cmake::ActualConfigure()
std::unique_ptr<cmGlobalGenerator> cmake::EvaluateDefaultGlobalGenerator()
{
if (!this->EnvironmentGenerator.empty()) {
- cmGlobalGenerator* gen =
- this->CreateGlobalGenerator(this->EnvironmentGenerator);
+ auto gen = this->CreateGlobalGenerator(this->EnvironmentGenerator);
if (!gen) {
cmSystemTools::Error("CMAKE_GENERATOR was set but the specified "
"generator doesn't exist. Using CMake default.");
} else {
- return std::unique_ptr<cmGlobalGenerator>(gen);
+ return gen;
}
}
#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW)
@@ -1656,13 +1708,14 @@ std::unique_ptr<cmGlobalGenerator> cmake::EvaluateDefaultGlobalGenerator()
}
}
}
- cmGlobalGenerator* gen = this->CreateGlobalGenerator(found);
+ auto gen = this->CreateGlobalGenerator(found);
if (!gen) {
- gen = new cmGlobalNMakeMakefileGenerator(this);
+ gen = cm::make_unique<cmGlobalNMakeMakefileGenerator>(this);
}
- return std::unique_ptr<cmGlobalGenerator>(gen);
+ return std::unique_ptr<cmGlobalGenerator>(std::move(gen));
#else
- return cm::make_unique<cmGlobalUnixMakefileGenerator3>(this);
+ return std::unique_ptr<cmGlobalGenerator>(
+ cm::make_unique<cmGlobalUnixMakefileGenerator3>(this));
#endif
}
@@ -1673,7 +1726,7 @@ void cmake::CreateDefaultGlobalGenerator()
// This print could be unified for all platforms
std::cout << "-- Building for: " << gen->GetName() << "\n";
#endif
- this->SetGlobalGenerator(gen.release());
+ this->SetGlobalGenerator(std::move(gen));
}
void cmake::PreLoadCMakeFiles()
@@ -1704,6 +1757,11 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
return -1;
}
+ // Log the trace format version to the desired output
+ if (this->GetTrace()) {
+ this->PrintTraceFormatVersion();
+ }
+
// If we are given a stamp list file check if it is really out of date.
if (!this->CheckStampList.empty() &&
cmakeCheckStampList(this->CheckStampList)) {
@@ -1771,10 +1829,11 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
cmSystemTools::Message("CMake Configure step failed. "
"Build files cannot be regenerated correctly. "
"Attempting to stop IDE build.");
- cmGlobalVisualStudioGenerator* gg =
- static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator);
- gg->CallVisualStudioMacro(cmGlobalVisualStudioGenerator::MacroStop,
- this->VSSolutionFile);
+ cmGlobalVisualStudioGenerator& gg =
+ cm::static_reference_cast<cmGlobalVisualStudioGenerator>(
+ this->GlobalGenerator);
+ gg.CallVisualStudioMacro(cmGlobalVisualStudioGenerator::MacroStop,
+ this->VSSolutionFile);
}
#endif
return ret;
@@ -2030,7 +2089,7 @@ void cmake::AppendGlobalGeneratorsDocumentation(
const std::string defaultName = defaultGenerator->GetName();
bool foundDefaultOne = false;
- for (cmGlobalGeneratorFactory* g : this->Generators) {
+ for (const auto& g : this->Generators) {
cmDocumentationEntry e;
g->GetDocumentation(e);
if (!foundDefaultOne && cmHasPrefix(e.Name, defaultName)) {
@@ -2170,8 +2229,8 @@ int cmake::CheckBuildSystem()
}
// Create the generator and use it to clear the dependencies.
- std::unique_ptr<cmGlobalGenerator> ggd(
- this->CreateGlobalGenerator(genName));
+ std::unique_ptr<cmGlobalGenerator> ggd =
+ this->CreateGlobalGenerator(genName);
if (ggd) {
cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmMakefile mfd(ggd.get(), cm.GetCurrentSnapshot());
@@ -2384,12 +2443,12 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
}
value = args[i];
}
- cmGlobalGenerator* gen = this->CreateGlobalGenerator(value);
+ auto gen = this->CreateGlobalGenerator(value);
if (!gen) {
cmSystemTools::Error("Could not create named generator " + value);
this->PrintGeneratorList();
} else {
- this->SetGlobalGenerator(gen);
+ this->SetGlobalGenerator(std::move(gen));
}
}
// no option assume it is the output file
@@ -2601,34 +2660,37 @@ int cmake::Build(int jobs, const std::string& dir,
std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n";
return 1;
}
- cmGlobalGenerator* gen = this->CreateGlobalGenerator(cachedGenerator);
+ auto gen = this->CreateGlobalGenerator(cachedGenerator);
if (!gen) {
std::cerr << "Error: could create CMAKE_GENERATOR \"" << cachedGenerator
<< "\"\n";
return 1;
}
- this->SetGlobalGenerator(gen);
+ this->SetGlobalGenerator(std::move(gen));
const char* cachedGeneratorInstance =
this->State->GetCacheEntryValue("CMAKE_GENERATOR_INSTANCE");
if (cachedGeneratorInstance) {
- cmMakefile mf(gen, this->GetCurrentSnapshot());
- if (!gen->SetGeneratorInstance(cachedGeneratorInstance, &mf)) {
+ cmMakefile mf(this->GetGlobalGenerator(), this->GetCurrentSnapshot());
+ if (!this->GlobalGenerator->SetGeneratorInstance(cachedGeneratorInstance,
+ &mf)) {
return 1;
}
}
const char* cachedGeneratorPlatform =
this->State->GetCacheEntryValue("CMAKE_GENERATOR_PLATFORM");
if (cachedGeneratorPlatform) {
- cmMakefile mf(gen, this->GetCurrentSnapshot());
- if (!gen->SetGeneratorPlatform(cachedGeneratorPlatform, &mf)) {
+ cmMakefile mf(this->GetGlobalGenerator(), this->GetCurrentSnapshot());
+ if (!this->GlobalGenerator->SetGeneratorPlatform(cachedGeneratorPlatform,
+ &mf)) {
return 1;
}
}
const char* cachedGeneratorToolset =
this->State->GetCacheEntryValue("CMAKE_GENERATOR_TOOLSET");
if (cachedGeneratorToolset) {
- cmMakefile mf(gen, this->GetCurrentSnapshot());
- if (!gen->SetGeneratorToolset(cachedGeneratorToolset, true, &mf)) {
+ cmMakefile mf(this->GetGlobalGenerator(), this->GetCurrentSnapshot());
+ if (!this->GlobalGenerator->SetGeneratorToolset(cachedGeneratorToolset,
+ true, &mf)) {
return 1;
}
}
@@ -2703,10 +2765,11 @@ int cmake::Build(int jobs, const std::string& dir,
}
#endif
- gen->PrintBuildCommandAdvice(std::cerr, jobs);
- return gen->Build(jobs, "", dir, projName, targets, output, "", config,
- clean, false, verbose, cmDuration::zero(),
- cmSystemTools::OUTPUT_PASSTHROUGH, nativeOptions);
+ this->GlobalGenerator->PrintBuildCommandAdvice(std::cerr, jobs);
+ return this->GlobalGenerator->Build(
+ jobs, "", dir, projName, targets, output, "", config, clean, false,
+ verbose, cmDuration::zero(), cmSystemTools::OUTPUT_PASSTHROUGH,
+ nativeOptions);
}
bool cmake::Open(const std::string& dir, bool dryRun)
@@ -2734,8 +2797,8 @@ bool cmake::Open(const std::string& dir, bool dryRun)
cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
genName, extraGenName ? *extraGenName : "");
- std::unique_ptr<cmGlobalGenerator> gen(
- this->CreateGlobalGenerator(fullName));
+ std::unique_ptr<cmGlobalGenerator> gen =
+ this->CreateGlobalGenerator(fullName);
if (!gen) {
std::cerr << "Error: could create CMAKE_GENERATOR \"" << fullName
<< "\"\n";
diff --git a/Source/cmake.h b/Source/cmake.h
index cb959ef..22d3c39 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -113,6 +113,14 @@ public:
LOG_TRACE
};
+ /** \brief Define supported trace formats **/
+ enum TraceFormat
+ {
+ TRACE_UNDEFINED,
+ TRACE_HUMAN,
+ TRACE_JSON_V1,
+ };
+
struct GeneratorInfo
{
std::string name;
@@ -205,21 +213,25 @@ public:
void PreLoadCMakeFiles();
//! Create a GlobalGenerator
- cmGlobalGenerator* CreateGlobalGenerator(const std::string& name);
+ std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
+ const std::string& name);
//! Return the global generator assigned to this instance of cmake
- cmGlobalGenerator* GetGlobalGenerator() { return this->GlobalGenerator; }
+ cmGlobalGenerator* GetGlobalGenerator()
+ {
+ return this->GlobalGenerator.get();
+ }
//! Return the global generator assigned to this instance of cmake, const
const cmGlobalGenerator* GetGlobalGenerator() const
{
- return this->GlobalGenerator;
+ return this->GlobalGenerator.get();
}
//! Return the full path to where the CMakeCache.txt file should be.
static std::string FindCacheFile(const std::string& binaryDir);
//! Return the global generator assigned to this instance of cmake
- void SetGlobalGenerator(cmGlobalGenerator*);
+ void SetGlobalGenerator(std::unique_ptr<cmGlobalGenerator>);
//! Get the names of the current registered generators
void GetRegisteredGenerators(std::vector<GeneratorInfo>& generators,
@@ -389,6 +401,7 @@ public:
LogLevel GetLogLevel() const { return this->MessageLogLevel; }
void SetLogLevel(LogLevel level) { this->MessageLogLevel = level; }
static LogLevel StringToLogLevel(const std::string& levelStr);
+ static TraceFormat StringToTraceFormat(const std::string& levelStr);
bool HasCheckInProgress() const
{
@@ -422,10 +435,12 @@ public:
void SetDebugFindOutputOn(bool b) { this->DebugFindOutput = b; }
//! Do we want trace output during the cmake run.
- bool GetTrace() { return this->Trace; }
+ bool GetTrace() const { return this->Trace; }
void SetTrace(bool b) { this->Trace = b; }
- bool GetTraceExpand() { return this->TraceExpand; }
+ bool GetTraceExpand() const { return this->TraceExpand; }
void SetTraceExpand(bool b) { this->TraceExpand = b; }
+ TraceFormat GetTraceFormat() const { return this->TraceFormatVar; }
+ void SetTraceFormat(TraceFormat f) { this->TraceFormatVar = f; }
void AddTraceSource(std::string const& file)
{
this->TraceOnlyThisSources.push_back(file);
@@ -436,6 +451,7 @@ public:
}
cmGeneratedFileStream& GetTraceFile() { return this->TraceFile; }
void SetTraceFile(std::string const& file);
+ void PrintTraceFormatVersion();
bool GetWarnUninitialized() { return this->WarnUninitialized; }
void SetWarnUninitialized(bool b) { this->WarnUninitialized = b; }
@@ -535,7 +551,8 @@ protected:
void RunCheckForUnusedVariables();
int HandleDeleteCacheVariables(const std::string& var);
- using RegisteredGeneratorsVector = std::vector<cmGlobalGeneratorFactory*>;
+ using RegisteredGeneratorsVector =
+ std::vector<std::unique_ptr<cmGlobalGeneratorFactory>>;
RegisteredGeneratorsVector Generators;
using RegisteredExtraGeneratorsVector =
std::vector<cmExternalMakefileProjectGeneratorFactory*>;
@@ -545,7 +562,6 @@ protected:
void AddDefaultGenerators();
void AddDefaultExtraGenerators();
- cmGlobalGenerator* GlobalGenerator = nullptr;
std::map<std::string, DiagLevel> DiagLevels;
std::string GeneratorInstance;
std::string GeneratorPlatform;
@@ -584,6 +600,7 @@ private:
bool DebugFindOutput = false;
bool Trace = false;
bool TraceExpand = false;
+ TraceFormat TraceFormatVar = TRACE_HUMAN;
cmGeneratedFileStream TraceFile;
bool WarnUninitialized = false;
bool WarnUnused = false;
@@ -625,6 +642,8 @@ private:
std::stack<std::string> CheckInProgressMessages;
+ std::unique_ptr<cmGlobalGenerator> GlobalGenerator;
+
void UpdateConversionPathTable();
//! Print a list of valid generators to stderr.
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index eafcf6b..5579ae1 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -82,6 +82,7 @@ const char* cmDocumentationOptions[][2] = {
{ "--debug-find", "Put cmake find in a debug mode." },
{ "--trace", "Put cmake in trace mode." },
{ "--trace-expand", "Put cmake in trace mode with variable expansion." },
+ { "--trace-format=<human|json-v1>", "Set the output format of the trace." },
{ "--trace-source=<file>",
"Trace only this CMake file/module. Multiple options allowed." },
{ "--trace-redirect=<file>",
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 9a07aef..67c776e 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -1080,13 +1080,13 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
cm.SetHomeDirectory(homeDir);
cm.SetHomeOutputDirectory(homeOutDir);
cm.GetCurrentSnapshot().SetDefaultDefinitions();
- if (cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen)) {
- cm.SetGlobalGenerator(ggd);
+ if (auto ggd = cm.CreateGlobalGenerator(gen)) {
+ cm.SetGlobalGenerator(std::move(ggd));
cmStateSnapshot snapshot = cm.GetCurrentSnapshot();
snapshot.GetDirectory().SetCurrentBinary(startOutDir);
snapshot.GetDirectory().SetCurrentSource(startDir);
- cmMakefile mf(ggd, snapshot);
- auto lgd = ggd->CreateLocalGenerator(&mf);
+ cmMakefile mf(cm.GetGlobalGenerator(), snapshot);
+ auto lgd = cm.GetGlobalGenerator()->CreateLocalGenerator(&mf);
// Actually scan dependencies.
return lgd->UpdateDependencies(depInfo, verbose, color) ? 0 : 2;
diff --git a/Templates/MSBuild/FlagTables/v10_Cuda.json b/Templates/MSBuild/FlagTables/v10_Cuda.json
index 1831b8a..b3230ac 100644
--- a/Templates/MSBuild/FlagTables/v10_Cuda.json
+++ b/Templates/MSBuild/FlagTables/v10_Cuda.json
@@ -20,6 +20,26 @@
]
},
{
+ "name": "AdditionalCompilerOptions",
+ "switch": "-compiler-options=",
+ "comment": "Host compiler options",
+ "value": "",
+ "flags": [
+ "UserValue",
+ "SpaceAppendable"
+ ]
+ },
+ {
+ "name": "AdditionalCompilerOptions",
+ "switch": "-compiler-options",
+ "comment": "Host compiler options",
+ "value": "",
+ "flags": [
+ "UserFollowing",
+ "SpaceAppendable"
+ ]
+ },
+ {
"name": "CudaRuntime",
"switch": "cudart=none",
"comment": "No CUDA runtime library",
diff --git a/Tests/CMakeLib/testCTestResourceSpec.cxx b/Tests/CMakeLib/testCTestResourceSpec.cxx
index 99bee56..b49f8ff 100644
--- a/Tests/CMakeLib/testCTestResourceSpec.cxx
+++ b/Tests/CMakeLib/testCTestResourceSpec.cxx
@@ -7,71 +7,89 @@
struct ExpectedSpec
{
std::string Path;
- bool ParseResult;
+ cmCTestResourceSpec::ReadFileResult ParseResult;
cmCTestResourceSpec Expected;
};
static const std::vector<ExpectedSpec> expectedResourceSpecs = {
- /* clang-format off */
- {"spec1.json", true, {{{
- {"gpus", {
- {"2", 4},
- {"e", 1},
- }},
- {"threads", {
- }},
- }}}},
- {"spec2.json", true, {}},
- {"spec3.json", false, {}},
- {"spec4.json", false, {}},
- {"spec5.json", false, {}},
- {"spec6.json", false, {}},
- {"spec7.json", false, {}},
- {"spec8.json", false, {}},
- {"spec9.json", false, {}},
- {"spec10.json", false, {}},
- {"spec11.json", false, {}},
- {"spec12.json", false, {}},
- {"spec13.json", false, {}},
- {"spec14.json", true, {}},
- {"spec15.json", true, {}},
- {"spec16.json", true, {}},
- {"spec17.json", false, {}},
- {"spec18.json", false, {}},
- {"spec19.json", false, {}},
- {"spec20.json", true, {}},
- {"spec21.json", false, {}},
- {"spec22.json", false, {}},
- {"spec23.json", false, {}},
- {"spec24.json", false, {}},
- {"spec25.json", false, {}},
- {"spec26.json", false, {}},
- {"spec27.json", false, {}},
- {"spec28.json", false, {}},
- {"spec29.json", false, {}},
- {"spec30.json", false, {}},
- {"spec31.json", false, {}},
- {"spec32.json", false, {}},
- {"spec33.json", false, {}},
- {"spec34.json", false, {}},
- {"spec35.json", false, {}},
- {"spec36.json", false, {}},
- {"noexist.json", false, {}},
- /* clang-format on */
+ { "spec1.json",
+ cmCTestResourceSpec::ReadFileResult::READ_OK,
+ { { {
+ { "gpus",
+ {
+ { "2", 4 },
+ { "e", 1 },
+ } },
+ { "threads", {} },
+ } } } },
+ { "spec2.json", cmCTestResourceSpec::ReadFileResult::READ_OK, {} },
+ { "spec3.json",
+ cmCTestResourceSpec::ReadFileResult::INVALID_SOCKET_SPEC,
+ {} },
+ { "spec4.json",
+ cmCTestResourceSpec::ReadFileResult::INVALID_SOCKET_SPEC,
+ {} },
+ { "spec5.json",
+ cmCTestResourceSpec::ReadFileResult::INVALID_SOCKET_SPEC,
+ {} },
+ { "spec6.json",
+ cmCTestResourceSpec::ReadFileResult::INVALID_SOCKET_SPEC,
+ {} },
+ { "spec7.json",
+ cmCTestResourceSpec::ReadFileResult::INVALID_RESOURCE_TYPE,
+ {} },
+ { "spec8.json", cmCTestResourceSpec::ReadFileResult::INVALID_RESOURCE, {} },
+ { "spec9.json", cmCTestResourceSpec::ReadFileResult::INVALID_RESOURCE, {} },
+ { "spec10.json", cmCTestResourceSpec::ReadFileResult::INVALID_RESOURCE, {} },
+ { "spec11.json", cmCTestResourceSpec::ReadFileResult::INVALID_RESOURCE, {} },
+ { "spec12.json", cmCTestResourceSpec::ReadFileResult::INVALID_ROOT, {} },
+ { "spec13.json", cmCTestResourceSpec::ReadFileResult::JSON_PARSE_ERROR, {} },
+ { "spec14.json", cmCTestResourceSpec::ReadFileResult::READ_OK, {} },
+ { "spec15.json", cmCTestResourceSpec::ReadFileResult::READ_OK, {} },
+ { "spec16.json", cmCTestResourceSpec::ReadFileResult::READ_OK, {} },
+ { "spec17.json", cmCTestResourceSpec::ReadFileResult::INVALID_RESOURCE, {} },
+ { "spec18.json", cmCTestResourceSpec::ReadFileResult::INVALID_RESOURCE, {} },
+ { "spec19.json", cmCTestResourceSpec::ReadFileResult::INVALID_VERSION, {} },
+ { "spec20.json", cmCTestResourceSpec::ReadFileResult::READ_OK, {} },
+ { "spec21.json", cmCTestResourceSpec::ReadFileResult::INVALID_VERSION, {} },
+ { "spec22.json", cmCTestResourceSpec::ReadFileResult::INVALID_VERSION, {} },
+ { "spec23.json", cmCTestResourceSpec::ReadFileResult::INVALID_VERSION, {} },
+ { "spec24.json", cmCTestResourceSpec::ReadFileResult::INVALID_VERSION, {} },
+ { "spec25.json",
+ cmCTestResourceSpec::ReadFileResult::UNSUPPORTED_VERSION,
+ {} },
+ { "spec26.json",
+ cmCTestResourceSpec::ReadFileResult::UNSUPPORTED_VERSION,
+ {} },
+ { "spec27.json", cmCTestResourceSpec::ReadFileResult::INVALID_VERSION, {} },
+ { "spec28.json", cmCTestResourceSpec::ReadFileResult::INVALID_VERSION, {} },
+ { "spec29.json", cmCTestResourceSpec::ReadFileResult::INVALID_VERSION, {} },
+ { "spec30.json", cmCTestResourceSpec::ReadFileResult::INVALID_VERSION, {} },
+ { "spec31.json", cmCTestResourceSpec::ReadFileResult::INVALID_VERSION, {} },
+ { "spec32.json", cmCTestResourceSpec::ReadFileResult::INVALID_VERSION, {} },
+ { "spec33.json", cmCTestResourceSpec::ReadFileResult::INVALID_VERSION, {} },
+ { "spec34.json", cmCTestResourceSpec::ReadFileResult::INVALID_VERSION, {} },
+ { "spec35.json", cmCTestResourceSpec::ReadFileResult::INVALID_VERSION, {} },
+ { "spec36.json", cmCTestResourceSpec::ReadFileResult::NO_VERSION, {} },
+ { "noexist.json", cmCTestResourceSpec::ReadFileResult::FILE_NOT_FOUND, {} },
};
-static bool testSpec(const std::string& path, bool expectedResult,
+static bool testSpec(const std::string& path,
+ cmCTestResourceSpec::ReadFileResult expectedResult,
const cmCTestResourceSpec& expected)
{
cmCTestResourceSpec actual;
- bool result = actual.ReadFromJSONFile(path);
+ auto result = actual.ReadFromJSONFile(path);
if (result != expectedResult) {
- std::cout << "ReadFromJSONFile(\"" << path << "\") returned " << result
- << ", should be " << expectedResult << std::endl;
+ std::cout << "ReadFromJSONFile(\"" << path << "\") returned \""
+ << cmCTestResourceSpec::ResultToString(result)
+ << "\", should be \""
+ << cmCTestResourceSpec::ResultToString(expectedResult) << "\""
+ << std::endl;
return false;
}
- if (result && actual != expected) {
+ if (actual != expected) {
std::cout << "ReadFromJSONFile(\"" << path
<< "\") did not give expected spec" << std::endl;
return false;
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 4b6bb98..4fdd7c8 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1470,7 +1470,7 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH
add_subdirectory(GoogleTest)
endif()
- if(CMake_TEST_FindPython OR CMake_TEST_FindPython_NumPy)
+ if(CMake_TEST_FindPython OR CMake_TEST_FindPython_NumPy OR CMake_TEST_FindPython_Conda)
add_subdirectory(FindPython)
endif()
diff --git a/Tests/Cuda/CMakeLists.txt b/Tests/Cuda/CMakeLists.txt
index 35b9022..5ba82d8 100644
--- a/Tests/Cuda/CMakeLists.txt
+++ b/Tests/Cuda/CMakeLists.txt
@@ -9,6 +9,7 @@ ADD_TEST_MACRO(Cuda.MixedStandardLevels3 MixedStandardLevels3)
ADD_TEST_MACRO(Cuda.MixedStandardLevels4 MixedStandardLevels4)
ADD_TEST_MACRO(Cuda.MixedStandardLevels5 MixedStandardLevels5)
ADD_TEST_MACRO(Cuda.NotEnabled CudaNotEnabled)
+ADD_TEST_MACRO(Cuda.SeparableCompCXXOnly SeparableCompCXXOnly)
ADD_TEST_MACRO(Cuda.Toolkit Toolkit)
ADD_TEST_MACRO(Cuda.IncludePathNoToolkit IncludePathNoToolkit)
ADD_TEST_MACRO(Cuda.ProperDeviceLibraries ProperDeviceLibraries)
diff --git a/Tests/Cuda/SeparableCompCXXOnly/CMakeLists.txt b/Tests/Cuda/SeparableCompCXXOnly/CMakeLists.txt
new file mode 100644
index 0000000..97670e3
--- /dev/null
+++ b/Tests/Cuda/SeparableCompCXXOnly/CMakeLists.txt
@@ -0,0 +1,3 @@
+project(SeparableCompCXXOnly LANGUAGES CXX CUDA)
+set(CMAKE_CUDA_SEPARABLE_COMPILATION ON)
+add_executable(SeparableCompCXXOnly main.cpp)
diff --git a/Tests/Cuda/SeparableCompCXXOnly/main.cpp b/Tests/Cuda/SeparableCompCXXOnly/main.cpp
new file mode 100644
index 0000000..8135246
--- /dev/null
+++ b/Tests/Cuda/SeparableCompCXXOnly/main.cpp
@@ -0,0 +1,5 @@
+
+int main(int, char const* [])
+{
+ return 0;
+}
diff --git a/Tests/CudaOnly/WithDefs/CMakeLists.txt b/Tests/CudaOnly/WithDefs/CMakeLists.txt
index 00fd7d2..ba9bf04 100644
--- a/Tests/CudaOnly/WithDefs/CMakeLists.txt
+++ b/Tests/CudaOnly/WithDefs/CMakeLists.txt
@@ -28,7 +28,7 @@ target_compile_options(CudaOnlyWithDefs
PRIVATE
-DFLAG_COMPILE_LANG_$<COMPILE_LANGUAGE>
-DFLAG_LANG_IS_CUDA=$<COMPILE_LANGUAGE:CUDA>
- -Xcompiler=-DHOST_DEFINE
+ --compiler-options=-DHOST_DEFINE
$<$<CONFIG:DEBUG>:$<BUILD_INTERFACE:${debug_compile_flags}>>
)
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index 4d411a9..7c81aea 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -240,6 +240,10 @@ set_property(TARGET testLibRequired APPEND PROPERTY
)
include(GenerateExportHeader)
+# Test deprecation of imported library
+add_library(testLibDeprecation STATIC testLib1.c)
+set_property(TARGET testLibDeprecation PROPERTY DEPRECATION "Deprecated version. Please use latest version")
+
add_subdirectory(renamed)
add_library(testSharedLibRequired SHARED testSharedLibRequired.cpp)
@@ -515,6 +519,7 @@ install(
testExe2lib testLib4lib testLib4libdbg testLib4libopt
testLib6 testLib7 testLib8
testLib9
+ testLibDeprecation
testLibCycleA testLibCycleB
testLibNoSONAME
cmp0022NEW cmp0022OLD
@@ -585,6 +590,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3
export(TARGETS testExe2 testLib4 testLib5 testLib6 testLib7 testExe3 testExe4 testExe2lib
testLib8
testLib9 testLib9ObjPub testLib9ObjPriv testLib9ObjIface
+ testLibDeprecation
testLib4lib testLib4libdbg testLib4libopt
testLibCycleA testLibCycleB
testLibNoSONAME
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index c5304da..3cb3833 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -51,6 +51,12 @@ checkForProperty(bld_testLib4 "EXPORTED_PROPERTY2" "EXPORTING_TESTLIB4_1")
checkForProperty(exp_testLib4 "EXPORTED_PROPERTY2" "EXPORTING_TESTLIB4_1")
checkForProperty(bld_testLib4 "EXPORTED_PROPERTY3" "EXPORTING_TESTLIB4_2")
checkForProperty(exp_testLib4 "EXPORTED_PROPERTY3" "EXPORTING_TESTLIB4_2")
+checkForProperty(bld_testLibDeprecation "DEPRECATION" "Deprecated version. Please use latest version")
+checkForProperty(exp_testLibDeprecation "DEPRECATION" "Deprecated version. Please use latest version")
+
+# Try linking to a deprecated library
+target_link_libraries(imp_testExe1 exp_testLibDeprecation)
+
# Try linking to a library imported from the install tree.
target_link_libraries(imp_testExe1
diff --git a/Tests/FindLibXml2/Test/CMakeLists.txt b/Tests/FindLibXml2/Test/CMakeLists.txt
index df5d8c3..041cc13 100644
--- a/Tests/FindLibXml2/Test/CMakeLists.txt
+++ b/Tests/FindLibXml2/Test/CMakeLists.txt
@@ -14,3 +14,7 @@ add_executable(test_var main.c)
target_include_directories(test_var PRIVATE ${LIBXML2_INCLUDE_DIRS})
target_link_libraries(test_var PRIVATE ${LIBXML2_LIBRARIES})
add_test(NAME test_var COMMAND test_var)
+
+add_test(NAME xmllint_tgt COMMAND LibXml2::xmllint --version)
+
+add_test(NAME xmllint_var COMMAND ${LIBXML2_XMLLINT_EXECUTABLE} --version)
diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt
index 10c98c5..bfec986 100644
--- a/Tests/FindPython/CMakeLists.txt
+++ b/Tests/FindPython/CMakeLists.txt
@@ -148,6 +148,34 @@ if(CMake_TEST_FindPython)
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
+ if (CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin")
+ add_test(NAME FindPython.Interpreter.SOABI COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/SOABI"
+ "${CMake_BINARY_DIR}/Tests/FindPython/SOABI.Interpreter"
+ ${build_generator_args}
+ --build-project TestSOABI
+ --build-options ${build_options} "-Dbuild_generator_args=${build_generator_args}"
+ "-DCMake_SOURCE_DIR=${CMake_SOURCE_DIR}"
+ "-DCMake_BINARY_DIR=${CMake_BINARY_DIR}"
+ "-DCMake_TEST_FindPython_COMPONENT=Interpreter"
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.Development.SOABI COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/SOABI"
+ "${CMake_BINARY_DIR}/Tests/FindPython/SOABI.Development"
+ ${build_generator_args}
+ --build-project TestSOABI
+ --build-options ${build_options} "-Dbuild_generator_args=${build_generator_args}"
+ "-DCMake_SOURCE_DIR=${CMake_SOURCE_DIR}"
+ "-DCMake_BINARY_DIR=${CMake_BINARY_DIR}"
+ "-DCMake_TEST_FindPython_COMPONENT=Development"
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ endif()
endif()
if(CMake_TEST_FindPython_NumPy)
@@ -172,3 +200,16 @@ if(CMake_TEST_FindPython_NumPy)
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
endif()
+
+ if(CMake_TEST_FindPython_Conda)
+ add_test(NAME FindPython.VirtualEnvConda COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/VirtualEnvConda"
+ "${CMake_BINARY_DIR}/Tests/FindPython/VirtualEnvConda"
+ ${build_generator_args}
+ --build-project TestVirtualEnvConda
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ endif()
diff --git a/Tests/FindPython/SOABI/CMakeLists.txt b/Tests/FindPython/SOABI/CMakeLists.txt
new file mode 100644
index 0000000..aea2baf
--- /dev/null
+++ b/Tests/FindPython/SOABI/CMakeLists.txt
@@ -0,0 +1,12 @@
+cmake_minimum_required(VERSION 3.1)
+
+project(TestSOABI C)
+
+find_package(Python3 COMPONENTS ${CMake_TEST_FindPython_COMPONENT})
+if (NOT Python3_FOUND)
+ message (FATAL_ERROR "Fail to found Python 3")
+endif()
+
+if(NOT DEFINED Python3_SOABI)
+ message(FATAL_ERROR "Python3_SOABI for ${CMake_TEST_FindPython_COMPONENT} not found")
+endif()
diff --git a/Tests/FindPython/VirtualEnv/CMakeLists.txt b/Tests/FindPython/VirtualEnv/CMakeLists.txt
index 64ba201..9e8c673 100644
--- a/Tests/FindPython/VirtualEnv/CMakeLists.txt
+++ b/Tests/FindPython/VirtualEnv/CMakeLists.txt
@@ -21,22 +21,26 @@ endif()
add_test(NAME FindPython3.VirtualEnvDefault
COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME
+ --unset=CONDA_PREFIX
"VIRTUAL_ENV=${Python3_VIRTUAL_ENV}"
"${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}"
-P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvDefault.cmake")
add_test(NAME FindPython3.VirtualEnvOnly
COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME
+ --unset=CONDA_PREFIX
"VIRTUAL_ENV=${Python3_VIRTUAL_ENV}"
"${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}"
-P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake")
add_test(NAME FindPython3.UnsetVirtualEnvOnly
COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME
--unset=VIRTUAL_ENV
+ --unset=CONDA_PREFIX
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake")
add_test(NAME FindPython3.VirtualEnvStandard
COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME
+ --unset=CONDA_PREFIX
"VIRTUAL_ENV=${Python3_VIRTUAL_ENV}"
"${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}"
-P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvStandard.cmake")
diff --git a/Tests/FindPython/VirtualEnvConda/CMakeLists.txt b/Tests/FindPython/VirtualEnvConda/CMakeLists.txt
new file mode 100644
index 0000000..565095a
--- /dev/null
+++ b/Tests/FindPython/VirtualEnvConda/CMakeLists.txt
@@ -0,0 +1,46 @@
+cmake_minimum_required(VERSION 3.1)
+
+project(TestVirtualEnvConda LANGUAGES NONE)
+
+include(CTest)
+
+find_program(CONDA_EXECUTABLE conda)
+if (CONDA_EXECUTABLE EQUAL NOTFOUND)
+ message (FATAL_ERROR "Fail to found Conda")
+endif()
+
+set (Python3_VIRTUAL_ENV "${CMAKE_CURRENT_BINARY_DIR}/condaenv")
+
+execute_process (COMMAND "${CONDA_EXECUTABLE}" create --no-default-packages --prefix "${Python3_VIRTUAL_ENV}" --yes python=3
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE outputs
+ ERROR_VARIABLE outputs)
+if (result)
+ message (FATAL_ERROR "Fail to create virtual environment: ${outputs}")
+endif()
+
+add_test(NAME FindPython3.VirtualEnvDefaultConda
+ COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME
+ --unset=VIRTUAL_ENV
+ "CONDA_PREFIX=${Python3_VIRTUAL_ENV}"
+ "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}"
+ -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvDefault.cmake")
+
+add_test(NAME FindPython3.VirtualEnvOnlyConda
+ COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME
+ --unset=VIRTUAL_ENV
+ "CONDA_PREFIX=${Python3_VIRTUAL_ENV}"
+ "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}"
+ -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake")
+add_test(NAME FindPython3.UnsetVirtualEnvOnlyConda
+ COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME
+ --unset=CONDA_PREFIX
+ --unset=VIRTUAL_ENV
+ "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake")
+
+add_test(NAME FindPython3.VirtualEnvStandardConda
+ COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME
+ --unset=VIRTUAL_ENV
+ "CONDA_PREFIX=${Python3_VIRTUAL_ENV}"
+ "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}"
+ -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvStandard.cmake")
diff --git a/Tests/FindPython/VirtualEnvConda/VirtualEnvDefault.cmake b/Tests/FindPython/VirtualEnvConda/VirtualEnvDefault.cmake
new file mode 100644
index 0000000..020ecac
--- /dev/null
+++ b/Tests/FindPython/VirtualEnvConda/VirtualEnvDefault.cmake
@@ -0,0 +1,6 @@
+
+find_package (Python3 REQUIRED)
+
+if (NOT Python3_EXECUTABLE MATCHES "^${PYTHON3_VIRTUAL_ENV}/.+")
+ message (FATAL_ERROR "Fail to use virtual environment")
+endif()
diff --git a/Tests/FindPython/VirtualEnvConda/VirtualEnvOnly.cmake b/Tests/FindPython/VirtualEnvConda/VirtualEnvOnly.cmake
new file mode 100644
index 0000000..29a4924
--- /dev/null
+++ b/Tests/FindPython/VirtualEnvConda/VirtualEnvOnly.cmake
@@ -0,0 +1,16 @@
+
+#
+# Virtual environment is defined for python3
+# Trying to find a python2 using only virtual environment
+# It is expecting to fail if a virtual environment is active and to success otherwise.
+#
+set (Python2_FIND_VIRTUALENV ONLY)
+find_package (Python2 QUIET)
+
+if (PYTHON3_VIRTUAL_ENV AND Python2_FOUND)
+ message (FATAL_ERROR "Python2 unexpectedly found.")
+endif()
+
+if (NOT PYTHON3_VIRTUAL_ENV AND NOT Python2_FOUND)
+ message (FATAL_ERROR "Fail to find Python2.")
+endif()
diff --git a/Tests/FindPython/VirtualEnvConda/VirtualEnvStandard.cmake b/Tests/FindPython/VirtualEnvConda/VirtualEnvStandard.cmake
new file mode 100644
index 0000000..89f27d8
--- /dev/null
+++ b/Tests/FindPython/VirtualEnvConda/VirtualEnvStandard.cmake
@@ -0,0 +1,7 @@
+
+set (Python3_FIND_VIRTUALENV STANDARD)
+find_package (Python3 REQUIRED)
+
+if (Python3_EXECUTABLE MATCHES "^${PYTHON3_VIRTUAL_ENV}/.+")
+ message (FATAL_ERROR "Python3 virtual env unexpectedly found.")
+endif()
diff --git a/Tests/QtAutogen/MocCMP0100/CMakeLists.txt b/Tests/QtAutogen/MocCMP0100/CMakeLists.txt
new file mode 100644
index 0000000..559cffe
--- /dev/null
+++ b/Tests/QtAutogen/MocCMP0100/CMakeLists.txt
@@ -0,0 +1,9 @@
+cmake_minimum_required(VERSION 3.10)
+project(MocCMP0100)
+include("../AutogenCoreTest.cmake")
+
+set(CMAKE_AUTOMOC ON)
+set(CSD ${CMAKE_CURRENT_SOURCE_DIR})
+
+add_subdirectory(OLD)
+add_subdirectory(NEW)
diff --git a/Tests/QtAutogen/MocCMP0100/NEW/CMakeLists.txt b/Tests/QtAutogen/MocCMP0100/NEW/CMakeLists.txt
new file mode 100644
index 0000000..654b31e
--- /dev/null
+++ b/Tests/QtAutogen/MocCMP0100/NEW/CMakeLists.txt
@@ -0,0 +1,10 @@
+cmake_minimum_required(VERSION 3.16)
+cmake_policy(SET CMP0100 NEW)
+
+add_executable(mocCMP0100New
+ ${CSD}/main.cpp
+ ${CSD}/Obj.hh # Manually include Obj.hh
+ ${CSD}/Obj.cpp
+ ${CSD}/Obj2.cpp # Let AUTOMOC detect Obj2.hh
+)
+target_link_libraries(mocCMP0100New ${QT_LIBRARIES})
diff --git a/Tests/QtAutogen/MocCMP0100/OLD/CMakeLists.txt b/Tests/QtAutogen/MocCMP0100/OLD/CMakeLists.txt
new file mode 100644
index 0000000..2be0535
--- /dev/null
+++ b/Tests/QtAutogen/MocCMP0100/OLD/CMakeLists.txt
@@ -0,0 +1,31 @@
+cmake_minimum_required(VERSION 3.16)
+cmake_policy(SET CMP0100 OLD)
+
+# Generate moc files externally.
+# If AUTOMOC generates the header moc files as well
+# (it should not in OLD behavior), the test will fail with a
+# multiple definition error when linking the executable.
+qtx_wrap_cpp(mocCMP0100OldMoc ${CSD}/Obj.hh ${CSD}/Obj2.hh)
+qtx_generate_moc(${CBD}/Obj.cpp ${CMAKE_CURRENT_BINARY_DIR}/Obj.moc)
+qtx_generate_moc(${CBD}/Obj2.cpp ${CMAKE_CURRENT_BINARY_DIR}/Obj2.moc)
+
+# Make sure AUTOGEN file skipping is disabled
+set_source_files_properties(
+ ${CSD}/Obj.hh
+ ${CBD}/Obj.cpp
+ ${CSD}/Obj2.hh
+ ${CBD}/Obj2.cpp
+ PROPERTIES
+ SKIP_AUTOGEN OFF
+ SKIP_AUTOMOC OFF
+)
+
+add_executable(mocCMP0100Old
+ ${CSD}/main.cpp
+ ${CSD}/Obj.hh # Manually include Obj.hh
+ ${CSD}/Obj.cpp
+ ${CSD}/Obj2.cpp # Let AUTOMOC detect Obj2.hh
+ ${mocCMP0100OldMoc}
+)
+target_link_libraries(mocCMP0100Old ${QT_LIBRARIES})
+target_include_directories(mocCMP0100Old PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
diff --git a/Tests/QtAutogen/MocCMP0100/Obj.cpp b/Tests/QtAutogen/MocCMP0100/Obj.cpp
new file mode 100644
index 0000000..bb6d0a0
--- /dev/null
+++ b/Tests/QtAutogen/MocCMP0100/Obj.cpp
@@ -0,0 +1,31 @@
+#include "Obj.hh"
+
+#include <QObject>
+
+class ObjPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ ObjPrivate();
+ ~ObjPrivate();
+};
+
+ObjPrivate::ObjPrivate()
+{
+}
+
+ObjPrivate::~ObjPrivate()
+{
+}
+
+Obj::Obj()
+ : d(new ObjPrivate)
+{
+}
+
+Obj::~Obj()
+{
+ delete d;
+}
+
+#include "Obj.moc"
diff --git a/Tests/QtAutogen/MocCMP0100/Obj.hh b/Tests/QtAutogen/MocCMP0100/Obj.hh
new file mode 100644
index 0000000..940bfc2
--- /dev/null
+++ b/Tests/QtAutogen/MocCMP0100/Obj.hh
@@ -0,0 +1,20 @@
+#ifndef OBJ_HH
+#define OBJ_HH
+
+#include <QObject>
+
+// Qt enabled private class
+class ObjPrivate;
+// Qt enabled class
+class Obj : public QObject
+{
+ Q_OBJECT
+public:
+ Obj();
+ ~Obj();
+
+private:
+ ObjPrivate* const d;
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocCMP0100/Obj2.cpp b/Tests/QtAutogen/MocCMP0100/Obj2.cpp
new file mode 100644
index 0000000..8a359ad
--- /dev/null
+++ b/Tests/QtAutogen/MocCMP0100/Obj2.cpp
@@ -0,0 +1,31 @@
+#include "Obj2.hh"
+
+#include <QObject>
+
+class Obj2Private : public QObject
+{
+ Q_OBJECT
+public:
+ Obj2Private();
+ ~Obj2Private();
+};
+
+Obj2Private::Obj2Private()
+{
+}
+
+Obj2Private::~Obj2Private()
+{
+}
+
+Obj2::Obj2()
+ : d(new Obj2Private)
+{
+}
+
+Obj2::~Obj2()
+{
+ delete d;
+}
+
+#include "Obj2.moc"
diff --git a/Tests/QtAutogen/MocCMP0100/Obj2.hh b/Tests/QtAutogen/MocCMP0100/Obj2.hh
new file mode 100644
index 0000000..1c74cdd
--- /dev/null
+++ b/Tests/QtAutogen/MocCMP0100/Obj2.hh
@@ -0,0 +1,20 @@
+#ifndef OBJ2_HH
+#define OBJ2_HH
+
+#include <QObject>
+
+// Qt enabled private class
+class Obj2Private;
+// Qt enabled class
+class Obj2 : public QObject
+{
+ Q_OBJECT
+public:
+ Obj2();
+ ~Obj2();
+
+private:
+ Obj2Private* const d;
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocCMP0100/main.cpp b/Tests/QtAutogen/MocCMP0100/main.cpp
new file mode 100644
index 0000000..17061da
--- /dev/null
+++ b/Tests/QtAutogen/MocCMP0100/main.cpp
@@ -0,0 +1,9 @@
+#include "Obj.hh"
+#include "Obj2.hh"
+
+int main(int argv, char** args)
+{
+ Obj obj;
+ Obj2 obj2;
+ return 0;
+}
diff --git a/Tests/QtAutogen/SameName/CMakeLists.txt b/Tests/QtAutogen/SameName/CMakeLists.txt
index cd29a2a..4ce8dbd 100644
--- a/Tests/QtAutogen/SameName/CMakeLists.txt
+++ b/Tests/QtAutogen/SameName/CMakeLists.txt
@@ -1,7 +1,10 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16.0)
project(SameName)
include("../AutogenGuiTest.cmake")
+# Process .hh headers in AUTOMOC
+cmake_policy(SET CMP0100 NEW)
+
# Test AUTOMOC and AUTORCC on source files with the same name
# but in different subdirectories
@@ -18,6 +21,7 @@ add_executable(sameName
ccc/data.qrc
item.cpp
object.h
+ object.hh
object.h++
object.hpp
object.hxx
diff --git a/Tests/QtAutogen/SameName/main.cpp b/Tests/QtAutogen/SameName/main.cpp
index 19a6f6d..725f4cd 100644
--- a/Tests/QtAutogen/SameName/main.cpp
+++ b/Tests/QtAutogen/SameName/main.cpp
@@ -6,6 +6,7 @@
#include "item.hpp"
#include "object.h"
#include "object.h++"
+#include "object.hh"
#include "object.hpp"
#include "object.hxx"
#include "object_upper_ext.H"
@@ -21,6 +22,7 @@ int main(int argv, char** args)
::ccc::Item ccc_item;
// Object instances
::Object_h obj_h;
+ ::Object_hh obj_hh;
::Object_hplpl obj_hplpl;
::Object_hpp obj_hpp;
::Object_hxx obj_hxx;
diff --git a/Tests/QtAutogen/SameName/object.hh b/Tests/QtAutogen/SameName/object.hh
new file mode 100644
index 0000000..3e16f83
--- /dev/null
+++ b/Tests/QtAutogen/SameName/object.hh
@@ -0,0 +1,13 @@
+#ifndef OBJECT_HH
+#define OBJECT_HH
+
+#include <QObject>
+
+class Object_hh : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go(){};
+};
+
+#endif
diff --git a/Tests/QtAutogen/Tests.cmake b/Tests/QtAutogen/Tests.cmake
index 2b001d4..a19a9ae 100644
--- a/Tests/QtAutogen/Tests.cmake
+++ b/Tests/QtAutogen/Tests.cmake
@@ -32,6 +32,7 @@ ADD_AUTOGEN_TEST(UicSkipSource)
if(QT_TEST_ALLOW_QT_MACROS)
ADD_AUTOGEN_TEST(MocCMP0071)
+ ADD_AUTOGEN_TEST(MocCMP0100)
ADD_AUTOGEN_TEST(MocInclude)
ADD_AUTOGEN_TEST(MocIncludeSymlink)
ADD_AUTOGEN_TEST(MocSkipSource)
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 10e4c6f..a46393e 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -217,6 +217,7 @@ add_RunCMake_test(ScriptMode)
add_RunCMake_test(Swift -DCMAKE_Swift_COMPILER=${CMAKE_Swift_COMPILER})
add_RunCMake_test(TargetObjects)
add_RunCMake_test(TargetSources)
+add_RunCMake_test(TargetProperties)
add_RunCMake_test(ToolchainFile)
add_RunCMake_test(find_dependency)
add_RunCMake_test(CompileDefinitions)
@@ -454,7 +455,7 @@ add_RunCMake_test(target_include_directories)
add_RunCMake_test(target_sources)
add_RunCMake_test(CheckModules)
add_RunCMake_test(CheckIPOSupported)
-add_RunCMake_test(CommandLine -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DCYGWIN=${CYGWIN})
+add_RunCMake_test(CommandLine -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DCYGWIN=${CYGWIN} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE})
add_RunCMake_test(CommandLineTar)
if(CMAKE_PLATFORM_NO_VERSIONED_SONAME OR (NOT CMAKE_SHARED_LIBRARY_SONAME_FLAG AND NOT CMAKE_SHARED_LIBRARY_SONAME_C_FLAG))
@@ -543,6 +544,9 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
if(CMAKE_Fortran_COMPILER)
list(APPEND CompilerLauncher_ARGS -DCMake_TEST_Fortran=1)
endif()
+ if (APPLE AND CMAKE_C_COMPILER_ID MATCHES "Clang|GNU")
+ list(APPEND CompilerLauncher_ARGS -DCMake_TEST_OBJC=1)
+ endif()
add_RunCMake_test(CompilerLauncher)
add_RunCMake_test(ctest_labels_for_subprojects)
endif()
diff --git a/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx b/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx
index 27644af..80db05e 100644
--- a/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx
+++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx
@@ -285,7 +285,8 @@ static int doVerify(int argc, char const* const* argv)
std::set<std::string> testNameSet(testNameList.begin(), testNameList.end());
cmCTestResourceSpec spec;
- if (!spec.ReadFromJSONFile(resFile)) {
+ if (spec.ReadFromJSONFile(resFile) !=
+ cmCTestResourceSpec::ReadFileResult::READ_OK) {
std::cout << "Could not read resource spec " << resFile << std::endl;
return 1;
}
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index bd368cb..4bdc759 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -607,6 +607,14 @@ set(RunCMake_TEST_OPTIONS --trace-redirect=/no/such/file.txt)
run_cmake(trace-redirect-nofile)
unset(RunCMake_TEST_OPTIONS)
+set(RunCMake_TEST_OPTIONS --trace --trace-format=json-v1 --trace-redirect=${RunCMake_BINARY_DIR}/json-v1.trace)
+run_cmake(trace-json-v1)
+unset(RunCMake_TEST_OPTIONS)
+
+set(RunCMake_TEST_OPTIONS --trace-expand --trace-format=json-v1 --trace-redirect=${RunCMake_BINARY_DIR}/json-v1-expand.trace)
+run_cmake(trace-json-v1-expand)
+unset(RunCMake_TEST_OPTIONS)
+
set(RunCMake_TEST_OPTIONS -Wno-deprecated --warn-uninitialized)
run_cmake(warn-uninitialized)
unset(RunCMake_TEST_OPTIONS)
diff --git a/Tests/RunCMake/CommandLine/trace-json-v1-check.cmake b/Tests/RunCMake/CommandLine/trace-json-v1-check.cmake
new file mode 100644
index 0000000..66af039
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/trace-json-v1-check.cmake
@@ -0,0 +1,11 @@
+if(PYTHON_EXECUTABLE)
+ execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} "${RunCMake_SOURCE_DIR}/trace-json-v1-check.py" "${RunCMake_BINARY_DIR}/json-v1.trace"
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE output
+ ERROR_VARIABLE output
+ )
+ if(NOT result EQUAL 0)
+ set(RunCMake_TEST_FAILED "JSON trace validation failed:\n${output}")
+ endif()
+endif()
diff --git a/Tests/RunCMake/CommandLine/trace-json-v1-check.py b/Tests/RunCMake/CommandLine/trace-json-v1-check.py
new file mode 100755
index 0000000..14febaf
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/trace-json-v1-check.py
@@ -0,0 +1,72 @@
+#!/usr/bin/env python3
+
+import json
+import os
+import sys
+
+if sys.version_info[0] >= 3:
+ unicode = str
+
+trace_file = None
+expand = False
+
+for i in sys.argv[1:]:
+ if trace_file is None and not i.startswith('-'):
+ trace_file = i
+ continue
+
+ if i in ['-e', '--expand']:
+ expand = True
+
+assert trace_file is not None
+assert os.path.exists(trace_file)
+
+if expand:
+ msg_args = ['STATUS', 'fff', 'fff;sss; SPACES !!! ', ' 42 space in string!', ' SPACES !!! ']
+else:
+ msg_args = ['STATUS', 'fff', '${ASDF}', ' ${FOO} ${BAR}', ' SPACES !!! ']
+
+required_traces = [
+ {
+ 'args': ['STATUS', 'JSON-V1 str', 'spaces'],
+ 'cmd': 'message',
+ },
+ {
+ 'args': ['ASDF', 'fff', 'sss', ' SPACES !!! '],
+ 'cmd': 'set',
+ },
+ {
+ 'args': ['FOO', '42'],
+ 'cmd': 'set',
+ },
+ {
+ 'args': ['BAR', ' space in string!'],
+ 'cmd': 'set',
+ },
+ {
+ 'args': msg_args,
+ 'cmd': 'message',
+ },
+]
+
+with open(trace_file, 'r') as fp:
+ # Check for version (must be the first document)
+ vers = json.loads(fp.readline())
+ assert sorted(vers.keys()) == ['version']
+ assert sorted(vers['version'].keys()) == ['major', 'minor']
+ assert vers['version']['major'] == 1
+ assert vers['version']['minor'] == 0
+
+ for i in fp.readlines():
+ line = json.loads(i)
+ assert sorted(line.keys()) == ['args', 'cmd', 'file', 'line']
+ assert isinstance(line['args'], list)
+ assert isinstance(line['cmd'], unicode)
+ assert isinstance(line['file'], unicode)
+ assert isinstance(line['line'], int)
+
+ for j in required_traces:
+ if j['cmd'] == line['cmd'] and j['args'] == line['args']:
+ j['found'] = True
+
+assert all([x.get('found', False) == True for x in required_traces])
diff --git a/Tests/RunCMake/CommandLine/trace-json-v1-expand-check.cmake b/Tests/RunCMake/CommandLine/trace-json-v1-expand-check.cmake
new file mode 100644
index 0000000..7916d2e
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/trace-json-v1-expand-check.cmake
@@ -0,0 +1,11 @@
+if(PYTHON_EXECUTABLE)
+ execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} "${RunCMake_SOURCE_DIR}/trace-json-v1-check.py" --expand "${RunCMake_BINARY_DIR}/json-v1-expand.trace"
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE output
+ ERROR_VARIABLE output
+ )
+ if(NOT result EQUAL 0)
+ set(RunCMake_TEST_FAILED "JSON trace validation failed:\n${output}")
+ endif()
+endif()
diff --git a/Tests/RunCMake/CommandLine/trace-json-v1-expand.cmake b/Tests/RunCMake/CommandLine/trace-json-v1-expand.cmake
new file mode 100644
index 0000000..5c190e6
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/trace-json-v1-expand.cmake
@@ -0,0 +1 @@
+include(trace-json-v1.cmake)
diff --git a/Tests/RunCMake/CommandLine/trace-json-v1.cmake b/Tests/RunCMake/CommandLine/trace-json-v1.cmake
new file mode 100644
index 0000000..ed0a0f9
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/trace-json-v1.cmake
@@ -0,0 +1,5 @@
+message(STATUS "JSON-V1 str" "spaces")
+set(ASDF fff sss " SPACES !!! ")
+set(FOO 42)
+set(BAR " space in string!")
+message(STATUS fff ${ASDF} " ${FOO} ${BAR}" " SPACES !!! ")
diff --git a/Tests/RunCMake/CompilerLauncher/OBJC-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/OBJC-Build-stdout.txt
new file mode 100644
index 0000000..3313e31
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/OBJC-Build-stdout.txt
@@ -0,0 +1 @@
+.*-E env USED_LAUNCHER=1.*
diff --git a/Tests/RunCMake/CompilerLauncher/OBJC-common.cmake b/Tests/RunCMake/CompilerLauncher/OBJC-common.cmake
new file mode 100644
index 0000000..7b565f4
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/OBJC-common.cmake
@@ -0,0 +1,3 @@
+enable_language(OBJC)
+set(CMAKE_VERBOSE_MAKEFILE TRUE)
+add_executable(main main.m)
diff --git a/Tests/RunCMake/CompilerLauncher/OBJC-env-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/OBJC-env-Build-stdout.txt
new file mode 100644
index 0000000..3313e31
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/OBJC-env-Build-stdout.txt
@@ -0,0 +1 @@
+.*-E env USED_LAUNCHER=1.*
diff --git a/Tests/RunCMake/CompilerLauncher/OBJC-env-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/OBJC-env-launch-Build-stdout.txt
new file mode 100644
index 0000000..3313e31
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/OBJC-env-launch-Build-stdout.txt
@@ -0,0 +1 @@
+.*-E env USED_LAUNCHER=1.*
diff --git a/Tests/RunCMake/CompilerLauncher/OBJC-env.cmake b/Tests/RunCMake/CompilerLauncher/OBJC-env.cmake
new file mode 100644
index 0000000..949e88d
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/OBJC-env.cmake
@@ -0,0 +1 @@
+include(OBJC-common.cmake)
diff --git a/Tests/RunCMake/CompilerLauncher/OBJC-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/OBJC-launch-Build-stdout.txt
new file mode 100644
index 0000000..3313e31
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/OBJC-launch-Build-stdout.txt
@@ -0,0 +1 @@
+.*-E env USED_LAUNCHER=1.*
diff --git a/Tests/RunCMake/CompilerLauncher/OBJC-launch-env.cmake b/Tests/RunCMake/CompilerLauncher/OBJC-launch-env.cmake
new file mode 100644
index 0000000..1cf13d3
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/OBJC-launch-env.cmake
@@ -0,0 +1,3 @@
+set(CTEST_USE_LAUNCHERS 1)
+include(CTestUseLaunchers)
+include(OBJC-env.cmake)
diff --git a/Tests/RunCMake/CompilerLauncher/OBJC-launch.cmake b/Tests/RunCMake/CompilerLauncher/OBJC-launch.cmake
new file mode 100644
index 0000000..43e8521
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/OBJC-launch.cmake
@@ -0,0 +1,3 @@
+set(CTEST_USE_LAUNCHERS 1)
+include(CTestUseLaunchers)
+include(OBJC.cmake)
diff --git a/Tests/RunCMake/CompilerLauncher/OBJC.cmake b/Tests/RunCMake/CompilerLauncher/OBJC.cmake
new file mode 100644
index 0000000..3374e82
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/OBJC.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_OBJC_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1")
+include(OBJC-common.cmake)
diff --git a/Tests/RunCMake/CompilerLauncher/OBJCXX-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/OBJCXX-Build-stdout.txt
new file mode 100644
index 0000000..3313e31
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/OBJCXX-Build-stdout.txt
@@ -0,0 +1 @@
+.*-E env USED_LAUNCHER=1.*
diff --git a/Tests/RunCMake/CompilerLauncher/OBJCXX-common.cmake b/Tests/RunCMake/CompilerLauncher/OBJCXX-common.cmake
new file mode 100644
index 0000000..e2ee4eb
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/OBJCXX-common.cmake
@@ -0,0 +1,3 @@
+enable_language(OBJCXX)
+set(CMAKE_VERBOSE_MAKEFILE TRUE)
+add_executable(main main.mm)
diff --git a/Tests/RunCMake/CompilerLauncher/OBJCXX-env-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/OBJCXX-env-Build-stdout.txt
new file mode 100644
index 0000000..3313e31
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/OBJCXX-env-Build-stdout.txt
@@ -0,0 +1 @@
+.*-E env USED_LAUNCHER=1.*
diff --git a/Tests/RunCMake/CompilerLauncher/OBJCXX-env-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/OBJCXX-env-launch-Build-stdout.txt
new file mode 100644
index 0000000..3313e31
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/OBJCXX-env-launch-Build-stdout.txt
@@ -0,0 +1 @@
+.*-E env USED_LAUNCHER=1.*
diff --git a/Tests/RunCMake/CompilerLauncher/OBJCXX-env.cmake b/Tests/RunCMake/CompilerLauncher/OBJCXX-env.cmake
new file mode 100644
index 0000000..3ed966d
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/OBJCXX-env.cmake
@@ -0,0 +1 @@
+include(OBJCXX-common.cmake)
diff --git a/Tests/RunCMake/CompilerLauncher/OBJCXX-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/OBJCXX-launch-Build-stdout.txt
new file mode 100644
index 0000000..3313e31
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/OBJCXX-launch-Build-stdout.txt
@@ -0,0 +1 @@
+.*-E env USED_LAUNCHER=1.*
diff --git a/Tests/RunCMake/CompilerLauncher/OBJCXX-launch-env.cmake b/Tests/RunCMake/CompilerLauncher/OBJCXX-launch-env.cmake
new file mode 100644
index 0000000..04c916a
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/OBJCXX-launch-env.cmake
@@ -0,0 +1,3 @@
+set(CTEST_USE_LAUNCHERS 1)
+include(CTestUseLaunchers)
+include(OBJCXX-env.cmake)
diff --git a/Tests/RunCMake/CompilerLauncher/OBJCXX-launch.cmake b/Tests/RunCMake/CompilerLauncher/OBJCXX-launch.cmake
new file mode 100644
index 0000000..5a54bff
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/OBJCXX-launch.cmake
@@ -0,0 +1,3 @@
+set(CTEST_USE_LAUNCHERS 1)
+include(CTestUseLaunchers)
+include(OBJCXX.cmake)
diff --git a/Tests/RunCMake/CompilerLauncher/OBJCXX.cmake b/Tests/RunCMake/CompilerLauncher/OBJCXX.cmake
new file mode 100644
index 0000000..993ec90
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/OBJCXX.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_OBJCXX_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1")
+include(OBJCXX-common.cmake)
diff --git a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake
index e9543f1..69fff20 100644
--- a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake
@@ -29,6 +29,9 @@ endif()
if(CMake_TEST_Fortran)
list(APPEND langs Fortran)
endif()
+if(CMake_TEST_OBJC)
+ list(APPEND langs OBJC OBJCXX)
+endif()
foreach(lang ${langs})
run_compiler_launcher(${lang})
diff --git a/Tests/RunCMake/CompilerLauncher/main.m b/Tests/RunCMake/CompilerLauncher/main.m
new file mode 100644
index 0000000..8488f4e
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/main.m
@@ -0,0 +1,4 @@
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CompilerLauncher/main.mm b/Tests/RunCMake/CompilerLauncher/main.mm
new file mode 100644
index 0000000..f8b643a
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/main.mm
@@ -0,0 +1,4 @@
+int main()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/TargetProperties/CMakeLists.txt b/Tests/RunCMake/TargetProperties/CMakeLists.txt
new file mode 100644
index 0000000..be9d403
--- /dev/null
+++ b/Tests/RunCMake/TargetProperties/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8.4)
+project(${RunCMake_TEST})
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/TargetProperties/Deprecation-stderr.txt b/Tests/RunCMake/TargetProperties/Deprecation-stderr.txt
new file mode 100644
index 0000000..11a4cd8
--- /dev/null
+++ b/Tests/RunCMake/TargetProperties/Deprecation-stderr.txt
@@ -0,0 +1,9 @@
+^CMake Warning \(dev\) at Deprecation\.cmake:[0-9]+ \(target_link_libraries\):
+ The library that is being linked to, testLibDeprecation, is marked as being
+ deprecated by the owner\. The message provided by the developer is:
+
+ Deprecated version\. Please use latest version
+
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/TargetProperties/Deprecation.cmake b/Tests/RunCMake/TargetProperties/Deprecation.cmake
new file mode 100644
index 0000000..9361273
--- /dev/null
+++ b/Tests/RunCMake/TargetProperties/Deprecation.cmake
@@ -0,0 +1,5 @@
+add_library(testLibDeprecation STATIC empty.cpp)
+set_property(TARGET testLibDeprecation PROPERTY DEPRECATION "Deprecated version. Please use latest version")
+
+add_executable(testExe1 empty.cpp)
+target_link_libraries(testExe1 testLibDeprecation)
diff --git a/Tests/RunCMake/TargetProperties/RunCMakeTest.cmake b/Tests/RunCMake/TargetProperties/RunCMakeTest.cmake
new file mode 100644
index 0000000..5af31da
--- /dev/null
+++ b/Tests/RunCMake/TargetProperties/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(Deprecation)
diff --git a/Tests/RunCMake/TargetProperties/empty.cpp b/Tests/RunCMake/TargetProperties/empty.cpp
new file mode 100644
index 0000000..4086dcc
--- /dev/null
+++ b/Tests/RunCMake/TargetProperties/empty.cpp
@@ -0,0 +1,4 @@
+int empty()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/find_package/FromPATHEnv-stderr.txt b/Tests/RunCMake/find_package/FromPATHEnv-stderr.txt
index 5856d56..b35f05e 100644
--- a/Tests/RunCMake/find_package/FromPATHEnv-stderr.txt
+++ b/Tests/RunCMake/find_package/FromPATHEnv-stderr.txt
@@ -1,6 +1,7 @@
CMake Debug Log at FromPATHEnv.cmake:5 \(find_package\):
- find_package considered the following paths for Resolved.cmake
-.*
+ find_package considered the following paths for Resolved.cmake.*
+.*/Modules/FindResolved.cmake.*
+ The file was not found.*
<PackageName>_ROOT CMake variable.*
CMAKE_PREFIX_PATH variable.*
CMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH variables.*
@@ -13,4 +14,7 @@ CMake Debug Log at FromPATHEnv.cmake:5 \(find_package\):
CMake variables defined in the Platform file.*
CMake System Package Registry.*
Paths specified by the find_package PATHS option.*
- Checking file.*\[.*Tests/RunCMake/find_package/PackageRoot/ResolvedConfig\.cmake\]
+ find_package considered the following locations for the Config module:.*
+.*Tests/RunCMake/find_package/PackageRoot/ResolvedConfig\.cmake.*
+ The file was found at.*
+.*Tests/RunCMake/find_package/PackageRoot/ResolvedConfig\.cmake
diff --git a/Tests/RunCMake/find_package/MissingConfigDebug-stderr.txt b/Tests/RunCMake/find_package/MissingConfigDebug-stderr.txt
index 8ff04a9..379bf7a 100644
--- a/Tests/RunCMake/find_package/MissingConfigDebug-stderr.txt
+++ b/Tests/RunCMake/find_package/MissingConfigDebug-stderr.txt
@@ -9,8 +9,9 @@
CMake System Package Registry.*
Paths specified by the find_package PATHS option.*
.*
- Checking file \[.*NotHereConfig.cmake\].*
- Checking file \[.*nothere-config.cmake\].*
+ .*NotHereConfig.cmake
+ .*nothere-config.cmake
+.*
CMake Warning at MissingConfigDebug.cmake:3 \(message\):
This warning must be reachable.
Call Stack \(most recent call first\):
diff --git a/Tests/RunCMake/try_compile/CleanupNoFollowSymlink.cmake b/Tests/RunCMake/try_compile/CleanupNoFollowSymlink.cmake
new file mode 100644
index 0000000..dea0f61
--- /dev/null
+++ b/Tests/RunCMake/try_compile/CleanupNoFollowSymlink.cmake
@@ -0,0 +1,21 @@
+enable_language(C)
+
+set(out "${CMAKE_CURRENT_BINARY_DIR}/folder")
+set(link_folder "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp")
+set(link_dir "${link_folder}/link_dir")
+file(MAKE_DIRECTORY "${out}")
+file(MAKE_DIRECTORY "${link_folder}")
+file(WRITE ${out}/empty_file "")
+file(CREATE_LINK ${out} ${link_dir} SYMBOLIC)
+
+try_compile(res ${CMAKE_CURRENT_BINARY_DIR}
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c)
+
+if(EXISTS ${link_dir})
+ message(FATAL_ERROR "did not remove ${link_dir}")
+endif()
+if(NOT EXISTS ${out})
+ message(FATAL_ERROR "should not have removed ${out}/dir")
+endif()
+
+file(REMOVE_RECURSE "${out}")
diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
index e838b2d..bee9e5b 100644
--- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
@@ -94,3 +94,7 @@ if(RunCMake_GENERATOR MATCHES "Make|Ninja")
unset(RunCMake_TEST_BINARY_DIR)
unset(RunCMake_TEST_NO_CLEAN)
endif()
+
+if(UNIX)
+ run_cmake(CleanupNoFollowSymlink)
+endif()
diff --git a/bootstrap b/bootstrap
index 1b0cb26..da73bad 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1595,6 +1595,7 @@ rebuild_cache:
echo '
# Generated by '"${cmake_source_dir}"'/bootstrap
# Default cmake settings. These may be overridden any settings below.
+set (CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build.") # not FORCE to preserve defaults specified elsewhere
set (CMAKE_INSTALL_PREFIX "'"${cmake_prefix_dir}"'" CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
set (CMAKE_DOC_DIR "'"${cmake_doc_dir}"'" CACHE PATH "Install location for documentation (relative to prefix)." FORCE)
set (CMAKE_MAN_DIR "'"${cmake_man_dir}"'" CACHE PATH "Install location for man pages (relative to prefix)." FORCE)