summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Auxiliary/bash-completion/cmake3
-rw-r--r--Help/command/add_definitions.rst2
-rw-r--r--Help/command/cmake_policy.rst2
-rw-r--r--Help/command/execute_process.rst5
-rw-r--r--Help/command/include_external_msproject.rst2
-rw-r--r--Help/command/message.rst68
-rw-r--r--Help/command/set_property.rst4
-rw-r--r--Help/command/set_source_files_properties.rst2
-rw-r--r--Help/manual/cmake-generator-expressions.7.rst3
-rw-r--r--Help/manual/cmake-server.7.rst5
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/manual/cmake.1.rst6
-rw-r--r--Help/prop_tgt/MSVC_RUNTIME_LIBRARY-VALUES.txt5
-rw-r--r--Help/release/dev/add-execute_process-command-echo.rst6
-rw-r--r--Help/release/dev/new-message-types-and-logging.rst7
-rw-r--r--Help/release/dev/relax-TARGET_OBJECTS-generator-expression.rst5
-rw-r--r--Help/release/dev/server-deprecate.rst6
-rw-r--r--Help/variable/CMAKE_EXECUTE_PROCESS_COMMAND_ECHO.rst6
-rw-r--r--Modules/CMakeAddFortranSubdirectory.cmake8
-rw-r--r--Modules/CMakeAddNewLanguage.txt6
-rw-r--r--Modules/CMakeForceCompiler.cmake33
-rw-r--r--Modules/CheckLanguage.cmake10
-rw-r--r--Modules/CheckPIESupported.cmake4
-rw-r--r--Modules/Compiler/AppleClang-CXX.cmake5
-rw-r--r--Modules/Compiler/Clang-CXX.cmake3
-rw-r--r--Modules/Compiler/GNU-CXX.cmake6
-rw-r--r--Modules/Compiler/IAR-FindBinUtils.cmake25
-rw-r--r--Modules/Compiler/Intel-CXX.cmake4
-rw-r--r--Modules/Compiler/Intel-DetermineCompiler.cmake14
-rw-r--r--Modules/Compiler/MSVC-C.cmake8
-rw-r--r--Modules/Compiler/MSVC-CXX.cmake16
-rw-r--r--Modules/FindALSA.cmake4
-rw-r--r--Modules/FindAVIFile.cmake2
-rw-r--r--Modules/FindArmadillo.cmake5
-rw-r--r--Modules/FindBISON.cmake2
-rw-r--r--Modules/FindBacktrace.cmake18
-rw-r--r--Modules/FindBoost.cmake14
-rw-r--r--Modules/FindCURL.cmake8
-rw-r--r--Modules/FindCVS.cmake2
-rw-r--r--Modules/FindCups.cmake2
-rw-r--r--Modules/FindCxxTest.cmake2
-rw-r--r--Modules/FindCygwin.cmake3
-rw-r--r--Modules/FindDCMTK.cmake2
-rw-r--r--Modules/FindEXPAT.cmake1
-rw-r--r--Modules/FindFLEX.cmake5
-rw-r--r--Modules/FindFLTK.cmake6
-rw-r--r--Modules/FindFLTK2.cmake3
-rw-r--r--Modules/FindGDAL.cmake2
-rw-r--r--Modules/FindGIF.cmake4
-rw-r--r--Modules/FindGLU.cmake1
-rw-r--r--Modules/FindGLUT.cmake2
-rw-r--r--Modules/FindGSL.cmake2
-rw-r--r--Modules/FindGTK.cmake5
-rw-r--r--Modules/FindGTK2.cmake6
-rw-r--r--Modules/FindGnuTLS.cmake2
-rw-r--r--Modules/FindHDF5.cmake45
-rw-r--r--Modules/FindHSPELL.cmake2
-rw-r--r--Modules/FindIcotool.cmake4
-rw-r--r--Modules/FindImageMagick.cmake14
-rw-r--r--Modules/FindJPEG.cmake2
-rw-r--r--Modules/FindKDE3.cmake3
-rw-r--r--Modules/FindKDE4.cmake2
-rw-r--r--Modules/FindLAPACK.cmake4
-rw-r--r--Modules/FindLATEX.cmake4
-rw-r--r--Modules/FindLTTngUST.cmake3
-rw-r--r--Modules/FindLibArchive.cmake3
-rw-r--r--Modules/FindLibXslt.cmake3
-rw-r--r--Modules/FindLua.cmake4
-rw-r--r--Modules/FindLua50.cmake4
-rw-r--r--Modules/FindLua51.cmake4
-rw-r--r--Modules/FindMFC.cmake2
-rw-r--r--Modules/FindMPI.cmake26
-rw-r--r--Modules/FindOpenAL.cmake14
-rw-r--r--Modules/FindOpenCL.cmake2
-rw-r--r--Modules/FindOpenGL.cmake6
-rw-r--r--Modules/FindOpenMP.cmake2
-rw-r--r--Modules/FindOpenSceneGraph.cmake24
-rw-r--r--Modules/FindPython/Support.cmake22
-rw-r--r--Modules/FindSWIG.cmake4
-rw-r--r--Modules/FindVulkan.cmake5
-rw-r--r--Modules/Findosg.cmake2
-rw-r--r--Modules/FindosgDB.cmake32
-rw-r--r--Source/CMakeLists.txt3
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CTest/cmProcess.cxx46
-rw-r--r--Source/cmExecuteProcessCommand.cxx57
-rw-r--r--Source/cmGeneratorExpressionNode.cxx10
-rw-r--r--Source/cmGetPipes.cxx48
-rw-r--r--Source/cmGetPipes.h8
-rw-r--r--Source/cmMessageCommand.cxx52
-rw-r--r--Source/cmQtAutoMocUic.cxx6
-rw-r--r--Source/cmServerProtocol.cxx5
-rw-r--r--Source/cmSourceGroupCommand.cxx5
-rw-r--r--Source/cmSystemTools.cxx8
-rw-r--r--Source/cmSystemTools.h3
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx4
-rw-r--r--Source/cmUVHandlePtr.cxx54
-rw-r--r--Source/cmUVHandlePtr.h40
-rw-r--r--Source/cmUVStreambuf.h219
-rw-r--r--Source/cmWorkerPool.cxx261
-rw-r--r--Source/cmWorkerPool.h47
-rw-r--r--Source/cmake.cxx27
-rw-r--r--Source/cmake.h20
-rw-r--r--Source/cmakemain.cxx2
-rw-r--r--Tests/CMakeCommands/target_link_libraries/CMakeLists.txt4
-rw-r--r--Tests/CMakeCommands/target_link_libraries/SubDirC/CMakeLists.txt9
-rw-r--r--Tests/CMakeCommands/target_link_libraries/SubDirC/SubDirC.c11
-rw-r--r--Tests/CMakeCommands/target_link_libraries/TopDir.c6
-rw-r--r--Tests/CMakeLib/CMakeLists.txt4
-rw-r--r--Tests/CMakeLib/testUVRAII.cxx50
-rw-r--r--Tests/CMakeLib/testUVStreambuf.cxx457
-rw-r--r--Tests/GeneratorExpression/CMakeLists.txt45
-rw-r--r--Tests/MSVCRuntimeLibrary/CMakeLists.txt15
-rw-r--r--Tests/ObjectLibrary/CMakeLists.txt10
-rw-r--r--Tests/RunCMake/File_Generate/OutputNameMatchesObjects-stderr.txt3
-rw-r--r--Tests/RunCMake/File_Generate/OutputNameMatchesObjects.cmake7
-rw-r--r--Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt5
-rw-r--r--Tests/RunCMake/ObjectLibrary/BadSourceExpression3.cmake2
-rw-r--r--Tests/RunCMake/ObjectLibrary/CheckTargetObjects.cmake32
-rw-r--r--Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/ObjectLibrary/check_object_files.cmake17
-rw-r--r--Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt9
-rw-r--r--Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake4
-rw-r--r--Tests/RunCMake/VS10Project/RuntimeLibrary-check.cmake4
-rw-r--r--Tests/RunCMake/VS10Project/RuntimeLibrary.cmake4
-rw-r--r--Tests/RunCMake/execute_process/EchoCommand-result.txt1
-rw-r--r--Tests/RunCMake/execute_process/EchoCommand-stderr.txt5
-rw-r--r--Tests/RunCMake/execute_process/EchoCommand-stdout.txt12
-rw-r--r--Tests/RunCMake/execute_process/EchoCommand.cmake41
-rw-r--r--Tests/RunCMake/execute_process/EchoCommand2-result.txt1
-rw-r--r--Tests/RunCMake/execute_process/EchoCommand2-stderr.txt5
-rw-r--r--Tests/RunCMake/execute_process/EchoCommand2-stdout.txt12
-rw-r--r--Tests/RunCMake/execute_process/EchoCommand3-result.txt1
-rw-r--r--Tests/RunCMake/execute_process/EchoCommand3-stderr.txt2
-rw-r--r--Tests/RunCMake/execute_process/RunCMakeTest.cmake8
-rw-r--r--Tests/RunCMake/message/RunCMakeTest.cmake42
-rw-r--r--Tests/RunCMake/message/message-all-loglevels.cmake10
-rw-r--r--Tests/RunCMake/message/message-loglevel-debug-stderr.txt12
-rw-r--r--Tests/RunCMake/message/message-loglevel-debug-stdout.txt3
-rw-r--r--Tests/RunCMake/message/message-loglevel-default-stderr.txt12
-rw-r--r--Tests/RunCMake/message/message-loglevel-default-stdout.txt1
-rw-r--r--Tests/RunCMake/message/message-loglevel-invalid-result.txt1
-rw-r--r--Tests/RunCMake/message/message-loglevel-invalid-stderr.txt1
-rw-r--r--Tests/RunCMake/message/message-loglevel-notice-stderr.txt12
-rw-r--r--Tests/RunCMake/message/message-loglevel-status-stderr.txt12
-rw-r--r--Tests/RunCMake/message/message-loglevel-status-stdout.txt1
-rw-r--r--Tests/RunCMake/message/message-loglevel-trace-stderr.txt12
-rw-r--r--Tests/RunCMake/message/message-loglevel-trace-stdout.txt4
-rw-r--r--Tests/RunCMake/message/message-loglevel-verbose-stderr.txt12
-rw-r--r--Tests/RunCMake/message/message-loglevel-verbose-stdout.txt2
-rw-r--r--Tests/RunCMake/message/message-loglevel-warning-stderr.txt9
-rw-r--r--Tests/SourceGroups/CMakeLists.txt8
152 files changed, 1997 insertions, 500 deletions
diff --git a/Auxiliary/bash-completion/cmake b/Auxiliary/bash-completion/cmake
index 8c0c5e8..638b1c4 100644
--- a/Auxiliary/bash-completion/cmake
+++ b/Auxiliary/bash-completion/cmake
@@ -116,6 +116,9 @@ _cmake()
2>/dev/null )' -- "$quoted" ) )
return
;;
+ --loglevel)
+ COMPREPLY=( $(compgen -W 'error warning notice status verbose debug trace' -- $cur ) )
+ ;;
--help-command)
COMPREPLY=( $( compgen -W '$( cmake --help-command-list 2>/dev/null|
grep -v "^cmake version " )' -- "$cur" ) )
diff --git a/Help/command/add_definitions.rst b/Help/command/add_definitions.rst
index 39a43f4..d06b01c 100644
--- a/Help/command/add_definitions.rst
+++ b/Help/command/add_definitions.rst
@@ -20,7 +20,7 @@ preprocessor definitions.
* Use :command:`include_directories` to add include directories.
* Use :command:`add_compile_options` to add other options.
-Flags beginning in -D or /D that look like preprocessor definitions are
+Flags beginning in ``-D`` or ``/D`` that look like preprocessor definitions are
automatically added to the :prop_dir:`COMPILE_DEFINITIONS` directory
property for the current directory. Definitions with non-trivial values
may be left in the set of flags instead of being converted for reasons of
diff --git a/Help/command/cmake_policy.rst b/Help/command/cmake_policy.rst
index a80f982..4bc7807 100644
--- a/Help/command/cmake_policy.rst
+++ b/Help/command/cmake_policy.rst
@@ -80,7 +80,7 @@ CMake Policy Stack
^^^^^^^^^^^^^^^^^^
CMake keeps policy settings on a stack, so changes made by the
-cmake_policy command affect only the top of the stack. A new entry on
+``cmake_policy`` command affect only the top of the stack. A new entry on
the policy stack is managed automatically for each subdirectory to
protect its parents and siblings. CMake also manages a new entry for
scripts loaded by :command:`include` and :command:`find_package` commands
diff --git a/Help/command/execute_process.rst b/Help/command/execute_process.rst
index 2d71352..e6ad037 100644
--- a/Help/command/execute_process.rst
+++ b/Help/command/execute_process.rst
@@ -18,6 +18,7 @@ Execute one or more child processes.
[ERROR_FILE <file>]
[OUTPUT_QUIET]
[ERROR_QUIET]
+ [COMMAND_ECHO <where>]
[OUTPUT_STRIP_TRAILING_WHITESPACE]
[ERROR_STRIP_TRAILING_WHITESPACE]
[ENCODING <name>])
@@ -77,6 +78,10 @@ Options:
``OUTPUT_QUIET``, ``ERROR_QUIET``
The standard output or standard error results will be quietly ignored.
+``COMMAND_ECHO <where>``
+ The command being run will be echo'ed to ``<where>`` with ``<where>``
+ being set to ``STDERR``|``STDOUT``|``NONE``.
+
``ENCODING <name>``
On Windows, the encoding that is used to decode output from the process.
Ignored on other platforms.
diff --git a/Help/command/include_external_msproject.rst b/Help/command/include_external_msproject.rst
index 88bb2c6..540a13a 100644
--- a/Help/command/include_external_msproject.rst
+++ b/Help/command/include_external_msproject.rst
@@ -17,7 +17,7 @@ named ``[projectname]``. This can be used in the :command:`add_dependencies`
command to make things depend on the external project.
``TYPE``, ``GUID`` and ``PLATFORM`` are optional parameters that allow one to
-specify the type of project, id (GUID) of the project and the name of
+specify the type of project, id (``GUID``) of the project and the name of
the target platform. This is useful for projects requiring values
other than the default (e.g. WIX projects).
diff --git a/Help/command/message.rst b/Help/command/message.rst
index 2b4b1aa..3f9216a 100644
--- a/Help/command/message.rst
+++ b/Help/command/message.rst
@@ -9,24 +9,56 @@ Display a message to the user.
The optional ``<mode>`` keyword determines the type of message:
-::
-
- (none) = Important information
- STATUS = Incidental information
- WARNING = CMake Warning, continue processing
- AUTHOR_WARNING = CMake Warning (dev), continue processing
- SEND_ERROR = CMake Error, continue processing,
- but skip generation
- FATAL_ERROR = CMake Error, stop processing and generation
- DEPRECATION = CMake Deprecation Error or Warning if variable
- CMAKE_ERROR_DEPRECATED or CMAKE_WARN_DEPRECATED
- is enabled, respectively, else no message.
-
-The CMake command-line tool displays STATUS messages on stdout and all
-other message types on stderr. The CMake GUI displays all messages in
-its log area. The interactive dialogs (ccmake and CMakeSetup) show
-STATUS messages one at a time on a status line and other messages in
-interactive pop-up boxes.
+``FATAL_ERROR``
+ CMake Error, stop processing and generation.
+
+``SEND_ERROR``
+ CMake Error, continue processing, but skip generation.
+
+``WARNING``
+ CMake Warning, continue processing.
+
+``AUTHOR_WARNING``
+ CMake Warning (dev), continue processing.
+
+``DEPRECATION``
+ CMake Deprecation Error or Warning if variable
+ :variable:`CMAKE_ERROR_DEPRECATED` or :variable:`CMAKE_WARN_DEPRECATED`
+ is enabled, respectively, else no message.
+
+(none) or ``NOTICE``
+ Important message printed to stderr to attract user's attention.
+
+``STATUS``
+ The main interesting messages that project users might be interested in.
+ Ideally these should be concise, no more than a single line, but still
+ informative.
+
+``VERBOSE``
+ Detailed informational messages intended for project users. These messages
+ should provide additional details that won't be of interest in most cases,
+ but which may be useful to those building the project when they want deeper
+ insight into what's happening.
+
+``DEBUG``
+ Detailed informational messages intended for developers working on the
+ project itself as opposed to users who just want to build it. These messages
+ will not typically be of interest to other users building the project and
+ will often be closely related to internal implementation details.
+
+``TRACE``
+ Fine-grained messages with very low-level implementation details. Messages
+ using this log level would normally only be temporary and would expect to be
+ removed before releasing the project, packaging up the files, etc.
+
+The CMake command-line tool displays ``STATUS`` to ``TRACE`` messages on stdout
+with the message preceded by two hyphens and a space. All other message types
+are sent to stderr and are not prefixed with hyphens. The CMake GUI displays
+all messages in its log area. The interactive dialogs (:manual:`ccmake(1)`
+and :manual:`cmake-gui(1)`) show ``STATUS`` to ``TRACE`` messages one at a
+time on a status line and other messages in interactive pop-up boxes.
+The ``--loglevel`` command-line option to each of these tools can be used to
+control which messages will be shown.
CMake Warning and Error message text displays using a simple markup
language. Non-indented text is formatted in line-wrapped paragraphs
diff --git a/Help/command/set_property.rst b/Help/command/set_property.rst
index 2624b4b..ec08c8f 100644
--- a/Help/command/set_property.rst
+++ b/Help/command/set_property.rst
@@ -35,7 +35,7 @@ It must be one of the following:
``SOURCE``
Scope may name zero or more source files. Note that source
file properties are visible only to targets added in the same
- directory (CMakeLists.txt).
+ directory (``CMakeLists.txt``).
See also the :command:`set_source_files_properties` command.
``INSTALL``
@@ -48,7 +48,7 @@ It must be one of the following:
Path components have to be separated by forward slashes,
must be normalized and are case sensitive.
- To reference the installation prefix itself with a relative path use ".".
+ To reference the installation prefix itself with a relative path use ``.``.
Currently installed file properties are only defined for
the WIX generator where the given paths are relative
diff --git a/Help/command/set_source_files_properties.rst b/Help/command/set_source_files_properties.rst
index 91f995c..ab95d70 100644
--- a/Help/command/set_source_files_properties.rst
+++ b/Help/command/set_source_files_properties.rst
@@ -16,4 +16,4 @@ See also the :command:`set_property(SOURCE)` command.
See :ref:`Source File Properties` for the list of properties known
to CMake. Source file properties are visible only to targets added
-in the same directory (CMakeLists.txt).
+in the same directory (``CMakeLists.txt``).
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index 7f4761f..3dc3221 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -530,8 +530,7 @@ Output-Related Expressions
Content of ``...`` converted to a C identifier. The conversion follows the
same behavior as :command:`string(MAKE_C_IDENTIFIER)`.
``$<TARGET_OBJECTS:objLib>``
- List of objects resulting from build of ``objLib``. ``objLib`` must be an
- object of type ``OBJECT_LIBRARY``.
+ List of objects resulting from build of ``objLib``.
``$<SHELL_PATH:...>``
Content of ``...`` converted to shell path style. For example, slashes are
converted to backslashes in Windows shells and drive letters are converted
diff --git a/Help/manual/cmake-server.7.rst b/Help/manual/cmake-server.7.rst
index 25d364c..8f10b9f 100644
--- a/Help/manual/cmake-server.7.rst
+++ b/Help/manual/cmake-server.7.rst
@@ -7,6 +7,11 @@ cmake-server(7)
.. contents::
+.. deprecated:: 3.15
+
+ This will be removed from a future version of CMake.
+ Clients should use the :manual:`cmake-file-api(7)` instead.
+
Introduction
============
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 3e8c884..6d93ae9 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -159,6 +159,7 @@ Variables that Change Behavior
/variable/CMAKE_ECLIPSE_VERSION
/variable/CMAKE_ERROR_DEPRECATED
/variable/CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION
+ /variable/CMAKE_EXECUTE_PROCESS_COMMAND_ECHO
/variable/CMAKE_EXPORT_COMPILE_COMMANDS
/variable/CMAKE_EXPORT_PACKAGE_REGISTRY
/variable/CMAKE_EXPORT_NO_PACKAGE_REGISTRY
diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index 5b88694..3e1680c 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -200,6 +200,12 @@ Options
from the top of a binary tree for a CMake project it will dump
additional information such as the cache, log files etc.
+``--loglevel=<error|warning|notice|status|verbose|debug|trace>``
+ Set the log level.
+
+ The :command:`message` command will only output messages of the specified
+ log level or higher. The default log level is ``status``.
+
``--debug-trycompile``
Do not delete the :command:`try_compile` build tree.
Only useful on one :command:`try_compile` at a time.
diff --git a/Help/prop_tgt/MSVC_RUNTIME_LIBRARY-VALUES.txt b/Help/prop_tgt/MSVC_RUNTIME_LIBRARY-VALUES.txt
index 2bf71a9..6c61341 100644
--- a/Help/prop_tgt/MSVC_RUNTIME_LIBRARY-VALUES.txt
+++ b/Help/prop_tgt/MSVC_RUNTIME_LIBRARY-VALUES.txt
@@ -13,3 +13,8 @@
The value is ignored on non-MSVC compilers but an unsupported value will
be rejected as an error when using a compiler targeting the MSVC ABI.
+
+The value may also be the empty string (``""``) in which case no runtime
+library selection flag will be added explicitly by CMake. Note that with
+:ref:`Visual Studio Generators` the native build system may choose to
+add its own default runtime library selection flag.
diff --git a/Help/release/dev/add-execute_process-command-echo.rst b/Help/release/dev/add-execute_process-command-echo.rst
new file mode 100644
index 0000000..a44e40e
--- /dev/null
+++ b/Help/release/dev/add-execute_process-command-echo.rst
@@ -0,0 +1,6 @@
+add-execute_process-command-echo
+--------------------------------
+
+* The :command:`execute_process` command gained a `COMMAND_ECHO` option
+ and supporting :variable:`CMAKE_EXECUTE_PROCESS_COMMAND_ECHO` variable
+ to enable echoing of the command-line string before execution.
diff --git a/Help/release/dev/new-message-types-and-logging.rst b/Help/release/dev/new-message-types-and-logging.rst
new file mode 100644
index 0000000..cd470bb
--- /dev/null
+++ b/Help/release/dev/new-message-types-and-logging.rst
@@ -0,0 +1,7 @@
+new-message-types-and-logging
+-----------------------------
+
+* The :command:`message` command learned new types: ``NOTICE``, ``VERBOSE``,
+ ``DEBUG`` and ``TRACE``.
+
+* The :manual:`cmake(1)` command learned a new CLI option ``--loglevel``.
diff --git a/Help/release/dev/relax-TARGET_OBJECTS-generator-expression.rst b/Help/release/dev/relax-TARGET_OBJECTS-generator-expression.rst
new file mode 100644
index 0000000..25ca0c9
--- /dev/null
+++ b/Help/release/dev/relax-TARGET_OBJECTS-generator-expression.rst
@@ -0,0 +1,5 @@
+relax-TARGET_OBJECTS-generator-expression
+-----------------------------------------
+
+* The ``TARGET_OBJECTS`` :manual:`generator expression <cmake-generator-expressions(7)>`
+ is now supported on ``SHARED``, ``STATIC``, ``MODULE`` libraries and executables.
diff --git a/Help/release/dev/server-deprecate.rst b/Help/release/dev/server-deprecate.rst
new file mode 100644
index 0000000..65c86e1
--- /dev/null
+++ b/Help/release/dev/server-deprecate.rst
@@ -0,0 +1,6 @@
+server-deprecate
+----------------
+
+* The :manual:`cmake-server(7)` mode has been deprecated and will be
+ removed from a future version of CMake. Please port clients to use
+ the :manual:`cmake-file-api(7)` instead.
diff --git a/Help/variable/CMAKE_EXECUTE_PROCESS_COMMAND_ECHO.rst b/Help/variable/CMAKE_EXECUTE_PROCESS_COMMAND_ECHO.rst
new file mode 100644
index 0000000..4a3121c
--- /dev/null
+++ b/Help/variable/CMAKE_EXECUTE_PROCESS_COMMAND_ECHO.rst
@@ -0,0 +1,6 @@
+CMAKE_EXECUTE_PROCESS_COMMAND_ECHO
+----------------------------------
+
+If this variable is set to ``STDERR``|``STDOUT``|``NONE`` then commands in
+:command:`execute_process` calls will be printed to either stderr or stdout
+or not at all.
diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake
index 50b2807..2613569 100644
--- a/Modules/CMakeAddFortranSubdirectory.cmake
+++ b/Modules/CMakeAddFortranSubdirectory.cmake
@@ -16,7 +16,7 @@ build with the MinGW tools. It will also create imported targets for
the libraries created. This will only work if the fortran code is
built into a dll, so :variable:`BUILD_SHARED_LIBS` is turned on in
the project. In addition the :variable:`CMAKE_GNUtoMS` option is set
-to on, so that Microsoft .lib files are created. Usage is as follows:
+to on, so that Microsoft ``.lib`` files are created. Usage is as follows:
::
@@ -32,15 +32,15 @@ to on, so that Microsoft .lib files are created. Usage is as follows:
NO_EXTERNAL_INSTALL # skip installation of external project
)
-Relative paths in ARCHIVE_DIR and RUNTIME_DIR are interpreted with
+Relative paths in ``ARCHIVE_DIR`` and ``RUNTIME_DIR`` are interpreted with
respect to the build directory corresponding to the source directory
in which the function is invoked.
Limitations:
-NO_EXTERNAL_INSTALL is required for forward compatibility with a
+``NO_EXTERNAL_INSTALL`` is required for forward compatibility with a
future version that supports installation of the external project
-binaries during "make install".
+binaries during ``make install``.
#]=======================================================================]
set(_MS_MINGW_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR})
diff --git a/Modules/CMakeAddNewLanguage.txt b/Modules/CMakeAddNewLanguage.txt
index 612e1a3..6baadc3 100644
--- a/Modules/CMakeAddNewLanguage.txt
+++ b/Modules/CMakeAddNewLanguage.txt
@@ -1,7 +1,7 @@
This file provides a few notes to CMake developers about how to add
support for a new language to CMake. It is also possible to place
-these files in CMAKE_MODULE_PATH within an outside project to add
-languages not supported by upstream CMake. However, this is not
+these files in :variable:`CMAKE_MODULE_PATH` within an outside project
+to add languages not supported by upstream CMake. However, this is not
a fully supported use case.
The implementation behind the scenes of project/enable_language,
@@ -29,5 +29,3 @@ CMake(LANG)Information.cmake -> set up rule variables for LANG :
CMAKE_(LANG)_CREATE_STATIC_LIBRARY
CMAKE_(LANG)_COMPILE_OBJECT
CMAKE_(LANG)_LINK_EXECUTABLE
-
-
diff --git a/Modules/CMakeForceCompiler.cmake b/Modules/CMakeForceCompiler.cmake
index 7ac09dc..7048806 100644
--- a/Modules/CMakeForceCompiler.cmake
+++ b/Modules/CMakeForceCompiler.cmake
@@ -25,38 +25,41 @@ toolchain file instead.
-------------------------------------------------------------------------
-Macro CMAKE_FORCE_C_COMPILER has the following signature:
+Macro ``CMAKE_FORCE_C_COMPILER`` has the following signature:
::
CMAKE_FORCE_C_COMPILER(<compiler> <compiler-id>)
-It sets CMAKE_C_COMPILER to the given compiler and the cmake internal
-variable CMAKE_C_COMPILER_ID to the given compiler-id. It also
-bypasses the check for working compiler and basic compiler information
-tests.
+It sets :variable:`CMAKE_C_COMPILER <CMAKE_<LANG>_COMPILER>` to
+the given compiler and the cmake internal variable
+:variable:`CMAKE_C_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>` to the given
+compiler-id. It also bypasses the check for working compiler and basic
+compiler information tests.
-Macro CMAKE_FORCE_CXX_COMPILER has the following signature:
+Macro ``CMAKE_FORCE_CXX_COMPILER`` has the following signature:
::
CMAKE_FORCE_CXX_COMPILER(<compiler> <compiler-id>)
-It sets CMAKE_CXX_COMPILER to the given compiler and the cmake
-internal variable CMAKE_CXX_COMPILER_ID to the given compiler-id. It
-also bypasses the check for working compiler and basic compiler
-information tests.
+It sets :variable:`CMAKE_CXX_COMPILER <CMAKE_<LANG>_COMPILER>` to
+the given compiler and the cmake internal variable
+:variable:`CMAKE_CXX_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>` to the given
+compiler-id. It also bypasses the check for working compiler and basic
+compiler information tests.
-Macro CMAKE_FORCE_Fortran_COMPILER has the following signature:
+Macro ``CMAKE_FORCE_Fortran_COMPILER`` has the following signature:
::
CMAKE_FORCE_Fortran_COMPILER(<compiler> <compiler-id>)
-It sets CMAKE_Fortran_COMPILER to the given compiler and the cmake
-internal variable CMAKE_Fortran_COMPILER_ID to the given compiler-id.
-It also bypasses the check for working compiler and basic compiler
-information tests.
+It sets :variable:`CMAKE_Fortran_COMPILER <CMAKE_<LANG>_COMPILER>` to
+the given compiler and the cmake internal variable
+:variable:`CMAKE_Fortran_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>` to the given
+compiler-id. It also bypasses the check for working compiler and basic
+compiler information tests.
So a simple toolchain file could look like this:
diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake
index efa88bd..d096849 100644
--- a/Modules/CheckLanguage.cmake
+++ b/Modules/CheckLanguage.cmake
@@ -13,11 +13,11 @@ Usage:
check_language(<lang>)
-where <lang> is a language that may be passed to enable_language()
-such as "Fortran". If CMAKE_<lang>_COMPILER is already defined the
-check does nothing. Otherwise it tries enabling the language in a
-test project. The result is cached in CMAKE_<lang>_COMPILER as the
-compiler that was found, or NOTFOUND if the language cannot be
+where ``<lang>`` is a language that may be passed to :command:`enable_language`
+such as ``Fortran``. If :variable:`CMAKE_<LANG>_COMPILER` is already defined
+the check does nothing. Otherwise it tries enabling the language in a
+test project. The result is cached in :variable:`CMAKE_<LANG>_COMPILER`
+as the compiler that was found, or ``NOTFOUND`` if the language cannot be
enabled.
Example:
diff --git a/Modules/CheckPIESupported.cmake b/Modules/CheckPIESupported.cmake
index 720217d..6d63f0b 100644
--- a/Modules/CheckPIESupported.cmake
+++ b/Modules/CheckPIESupported.cmake
@@ -5,8 +5,8 @@
CheckPIESupported
-----------------
-Check whether the linker supports position independent code (PIE) or no
-position independent code (NO_PIE) for executables.
+Check whether the linker supports Position Independent Code (PIE) or No
+Position Independent Code (NO_PIE) for executables.
Use this to ensure that the :prop_tgt:`POSITION_INDEPENDENT_CODE` target
property for executables will be honored at link time.
diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake
index d34d494..2042360 100644
--- a/Modules/Compiler/AppleClang-CXX.cmake
+++ b/Modules/Compiler/AppleClang-CXX.cmake
@@ -28,4 +28,9 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1)
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
endif()
+
+if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
+ set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
+endif()
+
__compiler_check_default_language_standard(CXX 4.0 98)
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake
index 34ffd66..6fb0200 100644
--- a/Modules/Compiler/Clang-CXX.cmake
+++ b/Modules/Compiler/Clang-CXX.cmake
@@ -17,9 +17,10 @@ if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
endif()
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.1)
+ set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
- set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2.1)
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++0x")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++0x")
diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake
index 7202607..1253291 100644
--- a/Modules/Compiler/GNU-CXX.cmake
+++ b/Modules/Compiler/GNU-CXX.cmake
@@ -17,15 +17,19 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
+ set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
- set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
# 4.3 supports 0x variants
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++0x")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++0x")
endif()
+if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8.1)
+ set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
+endif()
+
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
diff --git a/Modules/Compiler/IAR-FindBinUtils.cmake b/Modules/Compiler/IAR-FindBinUtils.cmake
index e8f5e6b..7fc6b59 100644
--- a/Modules/Compiler/IAR-FindBinUtils.cmake
+++ b/Modules/Compiler/IAR-FindBinUtils.cmake
@@ -2,7 +2,7 @@ if(NOT DEFINED _CMAKE_PROCESSING_LANGUAGE OR _CMAKE_PROCESSING_LANGUAGE STREQUAL
message(FATAL_ERROR "Internal error: _CMAKE_PROCESSING_LANGUAGE is not set")
endif()
-# Try to find tools in the same directory as Clang itself
+# Try to find tools in the same directory as the compiler itself
get_filename_component(__iar_hint_1 "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER}" REALPATH)
get_filename_component(__iar_hint_1 "${__iar_hint_1}" DIRECTORY)
@@ -12,20 +12,23 @@ set(__iar_hints "${__iar_hint_1}" "${__iar_hint_2}")
if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM" OR
"${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RX")
- # could allow using normal binutils ar, since objects are normal ELF files?
- find_program(CMAKE_IAR_LINKER ilink${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}.exe HINTS ${__iar_hints}
+
+ string(TOLOWER "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" _archid_lower)
+
+ # Find linker
+ find_program(CMAKE_IAR_LINKER ilink${_archid_lower} HINTS ${__iar_hints}
DOC "The IAR ILINK linker")
- find_program(CMAKE_IAR_ARCHIVE iarchive.exe HINTS ${__iar_hints}
+ find_program(CMAKE_IAR_ARCHIVE iarchive HINTS ${__iar_hints}
DOC "The IAR archiver")
- # find auxiliary tools
- find_program(CMAKE_IAR_ELFTOOL ielftool.exe HINTS ${__iar_hints}
+ # Find utility tools
+ find_program(CMAKE_IAR_ELFTOOL ielftool HINTS ${__iar_hints}
DOC "The IAR ELF Tool")
- find_program(CMAKE_IAR_ELFDUMP ielfdump${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}.exe HINTS ${__iar_hints}
+ find_program(CMAKE_IAR_ELFDUMP ielfdump${_archid_lower} HINTS ${__iar_hints}
DOC "The IAR ELF Dumper")
- find_program(CMAKE_IAR_OBJMANIP iobjmanip.exe HINTS ${__iar_hints}
+ find_program(CMAKE_IAR_OBJMANIP iobjmanip HINTS ${__iar_hints}
DOC "The IAR ELF Object Tool")
- find_program(CMAKE_IAR_SYMEXPORT isymexport.exe HINTS ${__iar_hints}
+ find_program(CMAKE_IAR_SYMEXPORT isymexport HINTS ${__iar_hints}
DOC "The IAR Absolute Symbol Exporter")
mark_as_advanced(CMAKE_IAR_LINKER CMAKE_IAR_ARCHIVE CMAKE_IAR_ELFTOOL CMAKE_IAR_ELFDUMP CMAKE_IAR_OBJMANIP CMAKE_IAR_SYMEXPORT)
@@ -41,9 +44,9 @@ set(CMAKE_IAR_LINKER \"${CMAKE_IAR_LINKER}\")
elseif("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR")
# For AVR and AVR32, IAR uses the "xlink" linker and the "xar" archiver:
- find_program(CMAKE_IAR_LINKER xlink.exe HINTS ${__iar_hints}
+ find_program(CMAKE_IAR_LINKER xlink HINTS ${__iar_hints}
DOC "The IAR XLINK linker")
- find_program(CMAKE_IAR_AR xar.exe HINTS ${__iar_hints}
+ find_program(CMAKE_IAR_AR xar HINTS ${__iar_hints}
DOC "The IAR archiver")
mark_as_advanced(CMAKE_IAR_LINKER CMAKE_IAR_AR)
diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake
index 471dd4a..032071c 100644
--- a/Modules/Compiler/Intel-CXX.cmake
+++ b/Modules/Compiler/Intel-CXX.cmake
@@ -54,6 +54,10 @@ else()
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
endif()
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0)
+ set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
+ endif()
+
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0)
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
diff --git a/Modules/Compiler/Intel-DetermineCompiler.cmake b/Modules/Compiler/Intel-DetermineCompiler.cmake
index d7e4532..c31aa77 100644
--- a/Modules/Compiler/Intel-DetermineCompiler.cmake
+++ b/Modules/Compiler/Intel-DetermineCompiler.cmake
@@ -18,9 +18,23 @@ set(_compiler_id_version_compute "
/* _MSC_VER = VVRR */
# define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(_MSC_VER / 100)
# define @PREFIX@SIMULATE_VERSION_MINOR @MACRO_DEC@(_MSC_VER % 100)
+# endif
+# if defined(__GNUC__)
+# define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(__GNUC__)
+# elif defined(__GNUG__)
+# define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(__GNUG__)
+# endif
+# if defined(__GNUC_MINOR__)
+# define @PREFIX@SIMULATE_VERSION_MINOR @MACRO_DEC@(__GNUC_MINOR__)
+# endif
+# if defined(__GNUC_PATCHLEVEL__)
+# define @PREFIX@SIMULATE_VERSION_PATCH @MACRO_DEC@(__GNUC_PATCHLEVEL__)
# endif")
set(_compiler_id_simulate "
# if defined(_MSC_VER)
# define @PREFIX@SIMULATE_ID \"MSVC\"
+# endif
+# if defined(__GNUC__)
+# define @PREFIX@SIMULATE_ID \"GNU\"
# endif")
diff --git a/Modules/Compiler/MSVC-C.cmake b/Modules/Compiler/MSVC-C.cmake
index a722130..f56227b 100644
--- a/Modules/Compiler/MSVC-C.cmake
+++ b/Modules/Compiler/MSVC-C.cmake
@@ -21,9 +21,13 @@ macro(cmake_record_c_compile_features)
c_std_99
c_std_11
c_function_prototypes
- c_variadic_macros
)
list(APPEND CMAKE_C90_COMPILE_FEATURES c_std_90 c_function_prototypes)
- list(APPEND CMAKE_C99_COMPILE_FEATURES c_std_99 c_variadic_macros)
+ list(APPEND CMAKE_C99_COMPILE_FEATURES c_std_99)
list(APPEND CMAKE_C11_COMPILE_FEATURES c_std_11)
+ if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 14.0)
+ list(APPEND CMAKE_C_COMPILE_FEATURES c_variadic_macros)
+ list(APPEND CMAKE_C99_COMPILE_FEATURES c_variadic_macros)
+ endif()
+ set(_result 0) # expected by cmake_determine_compile_features
endmacro()
diff --git a/Modules/Compiler/MSVC-CXX.cmake b/Modules/Compiler/MSVC-CXX.cmake
index 691926f..787c17e 100644
--- a/Modules/Compiler/MSVC-CXX.cmake
+++ b/Modules/Compiler/MSVC-CXX.cmake
@@ -17,6 +17,7 @@ if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0.24215.1 AND
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std:c++14")
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std:c++14")
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.11.25505)
+ set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std:c++17")
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std:c++17")
else()
@@ -30,21 +31,6 @@ if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0.24215.1 AND
__compiler_check_default_language_standard(CXX 19.0 14)
- # All features that we define are available in the base mode, except
- # for meta-features for C++14 and above. Override the default macro
- # to avoid doing unnecessary work.
- macro(cmake_record_cxx_compile_features)
- if (DEFINED CMAKE_CXX20_STANDARD_COMPILE_OPTION)
- list(APPEND CMAKE_CXX20_COMPILE_FEATURES cxx_std_20)
- endif()
- # The main cmake_record_cxx_compile_features macro makes all
- # these conditional on CMAKE_CXX##_STANDARD_COMPILE_OPTION,
- # but we can skip the conditions because we set them above.
- list(APPEND CMAKE_CXX17_COMPILE_FEATURES cxx_std_17)
- list(APPEND CMAKE_CXX14_COMPILE_FEATURES cxx_std_14)
- list(APPEND CMAKE_CXX98_COMPILE_FEATURES cxx_std_11) # no flag needed for 11
- _record_compiler_features_cxx(98)
- endmacro()
elseif (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0)
# MSVC has no specific options to set language standards, but set them as
# empty strings anyways so the feature test infrastructure can at least check
diff --git a/Modules/FindALSA.cmake b/Modules/FindALSA.cmake
index f27d7fe..88e2681 100644
--- a/Modules/FindALSA.cmake
+++ b/Modules/FindALSA.cmake
@@ -5,9 +5,9 @@
FindALSA
--------
-Find alsa
+Find Advanced Linux Sound Architecture (ALSA)
-Find the alsa libraries (asound)
+Find the alsa libraries (``asound``)
IMPORTED Targets
^^^^^^^^^^^^^^^^
diff --git a/Modules/FindAVIFile.cmake b/Modules/FindAVIFile.cmake
index c12512f..9655440 100644
--- a/Modules/FindAVIFile.cmake
+++ b/Modules/FindAVIFile.cmake
@@ -7,7 +7,7 @@ FindAVIFile
Locate AVIFILE library and include paths
-AVIFILE (http://avifile.sourceforge.net/)is a set of libraries for
+AVIFILE (http://avifile.sourceforge.net/) is a set of libraries for
i386 machines to use various AVI codecs. Support is limited beyond
Linux. Windows provides native AVI support, and so doesn't need this
library. This module defines
diff --git a/Modules/FindArmadillo.cmake b/Modules/FindArmadillo.cmake
index ce76c99..c4e55ce 100644
--- a/Modules/FindArmadillo.cmake
+++ b/Modules/FindArmadillo.cmake
@@ -5,9 +5,8 @@
FindArmadillo
-------------
-Find Armadillo
-
-Find the Armadillo C++ library
+Find the Armadillo C++ library.
+Armadillo is library for linear algebra & scientific computing.
Using Armadillo:
diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake
index b0e25dc..e75981c 100644
--- a/Modules/FindBISON.cmake
+++ b/Modules/FindBISON.cmake
@@ -16,7 +16,7 @@ The module defines the following variables:
version of ``bison``
``BISON_FOUND``
- true if the program was found
+ "True" if the program was found
The minimum required version of ``bison`` can be specified using the
standard CMake syntax, e.g. :command:`find_package(BISON 2.1.3)`.
diff --git a/Modules/FindBacktrace.cmake b/Modules/FindBacktrace.cmake
index e1f45f7..cf1632a 100644
--- a/Modules/FindBacktrace.cmake
+++ b/Modules/FindBacktrace.cmake
@@ -5,30 +5,30 @@
FindBacktrace
-------------
-Find provider for backtrace(3).
+Find provider for `backtrace(3) <http://man7.org/linux/man-pages/man3/backtrace.3.html>`__.
-Checks if OS supports backtrace(3) via either libc or custom library.
+Checks if OS supports ``backtrace(3)`` via either ``libc`` or custom library.
This module defines the following variables:
``Backtrace_HEADER``
- The header file needed for backtrace(3). Cached.
+ The header file needed for ``backtrace(3)``. Cached.
Could be forcibly set by user.
``Backtrace_INCLUDE_DIRS``
- The include directories needed to use backtrace(3) header.
+ The include directories needed to use ``backtrace(3)`` header.
``Backtrace_LIBRARIES``
- The libraries (linker flags) needed to use backtrace(3), if any.
+ The libraries (linker flags) needed to use ``backtrace(3)``, if any.
``Backtrace_FOUND``
- Is set if and only if backtrace(3) support detected.
+ Is set if and only if ``backtrace(3)`` support detected.
The following cache variables are also available to set or use:
``Backtrace_LIBRARY``
The external library providing backtrace, if any.
``Backtrace_INCLUDE_DIR``
- The directory holding the backtrace(3) header.
+ The directory holding the ``backtrace(3)`` header.
-Typical usage is to generate of header file using configure_file() with the
-contents like the following::
+Typical usage is to generate of header file using :command:`configure_file`
+with the contents like the following::
#cmakedefine01 Backtrace_FOUND
#if Backtrace_FOUND
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 7325eca..023cc8d 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -1054,11 +1054,17 @@ endfunction()
# Some boost libraries may require particular set of compler features.
# The very first one was `boost::fiber` introduced in Boost 1.62.
# One can check required compiler features of it in
-# `${Boost_ROOT}/libs/fiber/build/Jamfile.v2`.
+# - `${Boost_ROOT}/libs/fiber/build/Jamfile.v2`;
+# - `${Boost_ROOT}/libs/context/build/Jamfile.v2`.
+#
+# TODO (Re)Check compiler features on (every?) release ???
+# One may use the following command to get the files to check:
+#
+# $ find . -name Jamfile.v2 | grep build | xargs grep -l cxx1
#
function(_Boost_COMPILER_FEATURES component _ret)
- # Boost >= 1.62 and < 1.67
- if(NOT Boost_VERSION VERSION_LESS 106200 AND Boost_VERSION VERSION_LESS 106700)
+ # Boost >= 1.62
+ if(NOT Boost_VERSION VERSION_LESS 106200)
set(_Boost_FIBER_COMPILER_FEATURES
cxx_alias_templates
cxx_auto_type
@@ -1072,6 +1078,8 @@ function(_Boost_COMPILER_FEATURES component _ret)
cxx_thread_local
cxx_variadic_templates
)
+ # Compiler feature for `context` same as for `fiber`.
+ set(_Boost_CONTEXT_COMPILER_FEATURES ${_Boost_FIBER_COMPILER_FEATURES})
endif()
string(TOUPPER ${component} uppercomponent)
set(${_ret} ${_Boost_${uppercomponent}_COMPILER_FEATURES} PARENT_SCOPE)
diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake
index b1989b1..aeebc84 100644
--- a/Modules/FindCURL.cmake
+++ b/Modules/FindCURL.cmake
@@ -27,16 +27,16 @@ Result Variables
This module defines the following variables:
``CURL_FOUND``
- True if curl found.
+ "True" if ``curl`` found.
``CURL_INCLUDE_DIRS``
- where to find curl/curl.h, etc.
+ where to find ``curl``/``curl.h``, etc.
``CURL_LIBRARIES``
- List of libraries when using curl.
+ List of libraries when using ``curl``.
``CURL_VERSION_STRING``
- The version of curl found.
+ The version of ``curl`` found.
#]=======================================================================]
find_package(PkgConfig QUIET)
diff --git a/Modules/FindCVS.cmake b/Modules/FindCVS.cmake
index 89dbc0e..f819800 100644
--- a/Modules/FindCVS.cmake
+++ b/Modules/FindCVS.cmake
@@ -5,7 +5,7 @@
FindCVS
-------
-
+Find the Concurrent Versions System (CVS).
The module defines the following variables:
diff --git a/Modules/FindCups.cmake b/Modules/FindCups.cmake
index 2c79911..4e8232d 100644
--- a/Modules/FindCups.cmake
+++ b/Modules/FindCups.cmake
@@ -5,7 +5,7 @@
FindCups
--------
-Find the CUPS printing system.
+Find the Common UNIX Printing System (CUPS).
Set ``CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE`` to ``TRUE`` if you need a version which
features this function (i.e. at least ``1.1.19``)
diff --git a/Modules/FindCxxTest.cmake b/Modules/FindCxxTest.cmake
index 4eec5fc..321f004 100644
--- a/Modules/FindCxxTest.cmake
+++ b/Modules/FindCxxTest.cmake
@@ -5,7 +5,7 @@
FindCxxTest
-----------
-Find CxxTest
+Find CxxTest unit testing framework.
Find the CxxTest suite and declare a helper macro for creating unit
tests and integrating them with CTest. For more details on CxxTest
diff --git a/Modules/FindCygwin.cmake b/Modules/FindCygwin.cmake
index 8811623..5bbc802 100644
--- a/Modules/FindCygwin.cmake
+++ b/Modules/FindCygwin.cmake
@@ -5,7 +5,8 @@
FindCygwin
----------
-this module looks for Cygwin
+Find Cygwin, a POSIX-compatible environment that runs natively
+on Microsoft Windows
#]=======================================================================]
if (WIN32)
diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake
index 111e0ff..d48de08 100644
--- a/Modules/FindDCMTK.cmake
+++ b/Modules/FindDCMTK.cmake
@@ -5,7 +5,7 @@
FindDCMTK
---------
-Find DCMTK libraries and applications
+Find DICOM ToolKit (DCMTK) libraries and applications
The module defines the following variables::
diff --git a/Modules/FindEXPAT.cmake b/Modules/FindEXPAT.cmake
index 58e0841..15b419a 100644
--- a/Modules/FindEXPAT.cmake
+++ b/Modules/FindEXPAT.cmake
@@ -6,6 +6,7 @@ FindEXPAT
---------
Find the native Expat headers and library.
+Expat is a stream-oriented XML parser library written in C.
Imported Targets
^^^^^^^^^^^^^^^^
diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake
index 68eb9c8..09d57d2 100644
--- a/Modules/FindFLEX.cmake
+++ b/Modules/FindFLEX.cmake
@@ -5,7 +5,8 @@
FindFLEX
--------
-Find flex executable and provides a macro to generate custom build rules
+Find Fast Lexical Analyzer (Flex) executable and provides a macro
+to generate custom build rules
@@ -22,7 +23,7 @@ The module defines the following variables:
The minimum required version of flex can be specified using the
-standard syntax, e.g. find_package(FLEX 2.5.13)
+standard syntax, e.g. :command:`find_package(FLEX 2.5.13)`
diff --git a/Modules/FindFLTK.cmake b/Modules/FindFLTK.cmake
index 89122c0..e273642 100644
--- a/Modules/FindFLTK.cmake
+++ b/Modules/FindFLTK.cmake
@@ -5,14 +5,14 @@
FindFLTK
--------
-Find the FLTK library
+Find the Fast Light Toolkit (FLTK) library
Input Variables
^^^^^^^^^^^^^^^
By default this module will search for all of the FLTK components and
-add them to the FLTK_LIBRARIES variable. You can limit the components
-which get placed in FLTK_LIBRARIES by defining one or more of the
+add them to the ``FLTK_LIBRARIES`` variable. You can limit the components
+which get placed in ``FLTK_LIBRARIES`` by defining one or more of the
following three options:
``FLTK_SKIP_OPENGL``
diff --git a/Modules/FindFLTK2.cmake b/Modules/FindFLTK2.cmake
index 161d15c..a43f7a4 100644
--- a/Modules/FindFLTK2.cmake
+++ b/Modules/FindFLTK2.cmake
@@ -5,7 +5,7 @@
FindFLTK2
---------
-Find the native FLTK2 includes and library
+Find the native FLTK 2.0 includes and library
The following settings are defined
@@ -243,4 +243,3 @@ else()
endif()
endif()
endif()
-
diff --git a/Modules/FindGDAL.cmake b/Modules/FindGDAL.cmake
index 8522f9b..fde84d4 100644
--- a/Modules/FindGDAL.cmake
+++ b/Modules/FindGDAL.cmake
@@ -5,7 +5,7 @@
FindGDAL
--------
-Find GDAL.
+Find Geospatial Data Abstraction Library (GDAL).
IMPORTED Targets
^^^^^^^^^^^^^^^^
diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake
index 9687b57..d5a143e 100644
--- a/Modules/FindGIF.cmake
+++ b/Modules/FindGIF.cmake
@@ -5,7 +5,7 @@
FindGIF
-------
-This finds the GIF library (giflib)
+This finds the Graphics Interchange Format (GIF) library (``giflib``)
Imported targets
^^^^^^^^^^^^^^^^
@@ -13,7 +13,7 @@ Imported targets
This module defines the following :prop_tgt:`IMPORTED` target:
``GIF::GIF``
- The giflib library, if found.
+ The ``giflib`` library, if found.
Result variables
^^^^^^^^^^^^^^^^
diff --git a/Modules/FindGLU.cmake b/Modules/FindGLU.cmake
index dbec6d1..9892805 100644
--- a/Modules/FindGLU.cmake
+++ b/Modules/FindGLU.cmake
@@ -15,4 +15,3 @@ if (OPENGL_GLU_FOUND)
set (GLU_LIBRARY ${OPENGL_LIBRARIES})
set (GLU_INCLUDE_PATH ${OPENGL_INCLUDE_DIR})
endif ()
-
diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake
index d42db53..a22bf5b 100644
--- a/Modules/FindGLUT.cmake
+++ b/Modules/FindGLUT.cmake
@@ -5,7 +5,7 @@
FindGLUT
--------
-try to find glut library and include files.
+Find OpenGL Utility Toolkit (GLUT) library and include files.
IMPORTED Targets
^^^^^^^^^^^^^^^^
diff --git a/Modules/FindGSL.cmake b/Modules/FindGSL.cmake
index db05121..da1b3c4 100644
--- a/Modules/FindGSL.cmake
+++ b/Modules/FindGSL.cmake
@@ -5,7 +5,7 @@
FindGSL
--------
-Find the native GSL includes and libraries.
+Find the native GNU Scientific Library (GSL) includes and libraries.
The GNU Scientific Library (GSL) is a numerical library for C and C++
programmers. It is free software under the GNU General Public
diff --git a/Modules/FindGTK.cmake b/Modules/FindGTK.cmake
index 8cc6c97..552b19a 100644
--- a/Modules/FindGTK.cmake
+++ b/Modules/FindGTK.cmake
@@ -5,7 +5,7 @@
FindGTK
-------
-try to find GTK (and glib) and GTKGLArea
+Find GTK, glib and GTKGLArea
::
@@ -151,6 +151,3 @@ if(UNIX)
)
endif()
-
-
-
diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake
index 3bd61a9..02e96c6 100644
--- a/Modules/FindGTK2.cmake
+++ b/Modules/FindGTK2.cmake
@@ -5,10 +5,8 @@
FindGTK2
--------
-FindGTK2.cmake
-
-This module can find the GTK2 widget libraries and several of its
-other optional components like gtkmm, glade, and glademm.
+Find the GTK2 widget libraries and several of its
+other optional components like ``gtkmm``, ``glade``, and ``glademm``.
NOTE: If you intend to use version checking, CMake 2.6.2 or later is
diff --git a/Modules/FindGnuTLS.cmake b/Modules/FindGnuTLS.cmake
index 9c07444..4b4019c 100644
--- a/Modules/FindGnuTLS.cmake
+++ b/Modules/FindGnuTLS.cmake
@@ -5,7 +5,7 @@
FindGnuTLS
----------
-Try to find the GNU Transport Layer Security library (gnutls)
+Find the GNU Transport Layer Security library (gnutls)
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 70bfc96..08863c8 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -5,43 +5,44 @@
FindHDF5
--------
-Find HDF5, a library for reading and writing self describing array data.
+Find Hierarchical Data Format (HDF5), a library for reading and writing
+self describing array data.
-This module invokes the HDF5 wrapper compiler that should be installed
-alongside HDF5. Depending upon the HDF5 Configuration, the wrapper
-compiler is called either h5cc or h5pcc. If this succeeds, the module
-will then call the compiler with the -show argument to see what flags
-are used when compiling an HDF5 client application.
+This module invokes the ``HDF5`` wrapper compiler that should be installed
+alongside ``HDF5``. Depending upon the ``HDF5`` Configuration, the wrapper
+compiler is called either ``h5cc`` or ``h5pcc``. If this succeeds, the module
+will then call the compiler with the show argument to see what flags
+are used when compiling an ``HDF5`` client application.
-The module will optionally accept the COMPONENTS argument. If no
-COMPONENTS are specified, then the find module will default to finding
-only the HDF5 C library. If one or more COMPONENTS are specified, the
+The module will optionally accept the ``COMPONENTS`` argument. If no
+``COMPONENTS`` are specified, then the find module will default to finding
+only the ``HDF5`` C library. If one or more ``COMPONENTS`` are specified, the
module will attempt to find the language bindings for the specified
-components. The only valid components are C, CXX, Fortran, HL, and
-Fortran_HL. If the COMPONENTS argument is not given, the module will
+components. The only valid components are ``C``, ``CXX``, ``Fortran``, ``HL``,
+and ``Fortran_HL``. If the ``COMPONENTS`` argument is not given, the module will
attempt to find only the C bindings.
This module will read the variable
-HDF5_USE_STATIC_LIBRARIES to determine whether or not to prefer a
-static link to a dynamic link for HDF5 and all of it's dependencies.
-To use this feature, make sure that the HDF5_USE_STATIC_LIBRARIES
+``HDF5_USE_STATIC_LIBRARIES`` to determine whether or not to prefer a
+static link to a dynamic link for ``HDF5`` and all of it's dependencies.
+To use this feature, make sure that the ``HDF5_USE_STATIC_LIBRARIES``
variable is set before the call to find_package.
-To provide the module with a hint about where to find your HDF5
-installation, you can set the environment variable HDF5_ROOT. The
-Find module will then look in this path when searching for HDF5
+To provide the module with a hint about where to find your ``HDF5``
+installation, you can set the environment variable ``HDF5_ROOT``. The
+Find module will then look in this path when searching for ``HDF5``
executables, paths, and libraries.
-Both the serial and parallel HDF5 wrappers are considered and the first
+Both the serial and parallel ``HDF5`` wrappers are considered and the first
directory to contain either one will be used. In the event that both appear
in the same directory the serial version is preferentially selected. This
-behavior can be reversed by setting the variable HDF5_PREFER_PARALLEL to
-true.
+behavior can be reversed by setting the variable ``HDF5_PREFER_PARALLEL`` to
+``True``.
In addition to finding the includes and libraries required to compile
-an HDF5 client application, this module also makes an effort to find
-tools that come with the HDF5 distribution that may be useful for
+an ``HDF5`` client application, this module also makes an effort to find
+tools that come with the ``HDF5`` distribution that may be useful for
regression testing.
Result Variables
diff --git a/Modules/FindHSPELL.cmake b/Modules/FindHSPELL.cmake
index ec077a5..9724d2c 100644
--- a/Modules/FindHSPELL.cmake
+++ b/Modules/FindHSPELL.cmake
@@ -5,7 +5,7 @@
FindHSPELL
----------
-Try to find Hspell
+Try to find Hebrew spell-checker (Hspell) and morphology engine.
Once done this will define
diff --git a/Modules/FindIcotool.cmake b/Modules/FindIcotool.cmake
index 32fc4ae..d19c145 100644
--- a/Modules/FindIcotool.cmake
+++ b/Modules/FindIcotool.cmake
@@ -7,8 +7,8 @@ FindIcotool
Find icotool
-This module looks for icotool. This module defines the following
-values:
+This module looks for icotool. Convert and create Win32 icon and cursor files.
+This module defines the following values:
::
diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake
index 2ddd11c..8bf5123 100644
--- a/Modules/FindImageMagick.cmake
+++ b/Modules/FindImageMagick.cmake
@@ -5,11 +5,11 @@
FindImageMagick
---------------
-Find the ImageMagick binary suite.
+Find ImageMagick binary suite.
This module will search for a set of ImageMagick tools specified as
-components in the FIND_PACKAGE call. Typical components include, but
-are not limited to (future versions of ImageMagick might have
+components in the :command:`find_package` call. Typical components include,
+but are not limited to (future versions of ImageMagick might have
additional components not listed here):
::
@@ -28,7 +28,7 @@ additional components not listed here):
-If no component is specified in the FIND_PACKAGE call, then it only
+If no component is specified in the :command:`find_package` call, then it only
searches for the ImageMagick executable directory. This code defines
the following variables:
@@ -43,7 +43,7 @@ the following variables:
-ImageMagick_VERSION_STRING will not work for old versions like 5.2.3.
+``ImageMagick_VERSION_STRING`` will not work for old versions like 5.2.3.
There are also components for the following ImageMagick APIs:
@@ -80,8 +80,8 @@ Example Usages:
-Note that the standard FIND_PACKAGE features are supported (i.e.,
-QUIET, REQUIRED, etc.).
+Note that the standard :command:`find_package` features are supported (i.e.,
+``QUIET``, ``REQUIRED``, etc.).
#]=======================================================================]
find_package(PkgConfig QUIET)
diff --git a/Modules/FindJPEG.cmake b/Modules/FindJPEG.cmake
index f50f79e..0bb6989 100644
--- a/Modules/FindJPEG.cmake
+++ b/Modules/FindJPEG.cmake
@@ -5,7 +5,7 @@
FindJPEG
--------
-Find the JPEG library (libjpeg)
+Find the Joint Photographic Experts Group (JPEG) library (``libjpeg``)
Imported targets
^^^^^^^^^^^^^^^^
diff --git a/Modules/FindKDE3.cmake b/Modules/FindKDE3.cmake
index c7ad6e1..f916359 100644
--- a/Modules/FindKDE3.cmake
+++ b/Modules/FindKDE3.cmake
@@ -35,7 +35,7 @@ The following user adjustable options are provided:
``KDE3_BUILD_TESTS``
enable this to build KDE testcases
-It also adds the following macros (from KDE3Macros.cmake) SRCS_VAR is
+It also adds the following macros (from ``KDE3Macros.cmake``) ``SRCS_VAR`` is
always the variable which contains the list of source files for your
application or library.
@@ -358,4 +358,3 @@ endif ()
#add the found Qt and KDE include directories to the current include path
set(KDE3_INCLUDE_DIRS ${QT_INCLUDE_DIR} ${KDE3_INCLUDE_DIR})
-
diff --git a/Modules/FindKDE4.cmake b/Modules/FindKDE4.cmake
index c04804b..2a1838f 100644
--- a/Modules/FindKDE4.cmake
+++ b/Modules/FindKDE4.cmake
@@ -19,7 +19,7 @@ the given order:
-Please look in FindKDE4Internal.cmake and KDE4Macros.cmake for more
+Please look in ``FindKDE4Internal.cmake`` and ``KDE4Macros.cmake`` for more
information. They are installed with the KDE 4 libraries in
$KDEDIRS/share/apps/cmake/modules/.
diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake
index d6646ea..6582eea 100644
--- a/Modules/FindLAPACK.cmake
+++ b/Modules/FindLAPACK.cmake
@@ -5,13 +5,13 @@
FindLAPACK
----------
-Find LAPACK library
+Find Linear Algebra PACKage (LAPACK) library
This module finds an installed fortran library that implements the
LAPACK linear-algebra interface (see http://www.netlib.org/lapack/).
The approach follows that taken for the autoconf macro file,
-acx_lapack.m4 (distributed at
+``acx_lapack.m4`` (distributed at
http://ac-archive.sourceforge.net/ac-archive/acx_lapack.html).
Input Variables
diff --git a/Modules/FindLATEX.cmake b/Modules/FindLATEX.cmake
index 01f4793..b365d63 100644
--- a/Modules/FindLATEX.cmake
+++ b/Modules/FindLATEX.cmake
@@ -5,9 +5,9 @@
FindLATEX
---------
-Find Latex
+Find LaTeX
-This module finds an installed Latex and determines the location
+This module finds an installed LaTeX and determines the location
of the compiler. Additionally the module looks for Latex-related
software like BibTeX.
diff --git a/Modules/FindLTTngUST.cmake b/Modules/FindLTTngUST.cmake
index a074187..9cd17eb 100644
--- a/Modules/FindLTTngUST.cmake
+++ b/Modules/FindLTTngUST.cmake
@@ -5,7 +5,8 @@
FindLTTngUST
------------
-This module finds the `LTTng-UST <http://lttng.org/>`__ library.
+Find
+`Linux Trace Toolkit Next Generation (LTTng-UST) <http://lttng.org/>`__ library.
Imported target
^^^^^^^^^^^^^^^
diff --git a/Modules/FindLibArchive.cmake b/Modules/FindLibArchive.cmake
index 34fc2e2..ef27b7d 100644
--- a/Modules/FindLibArchive.cmake
+++ b/Modules/FindLibArchive.cmake
@@ -5,7 +5,8 @@
FindLibArchive
--------------
-Find libarchive library and headers
+Find libarchive library and headers.
+Libarchive is multi-format archive and compression library.
The module defines the following variables:
diff --git a/Modules/FindLibXslt.cmake b/Modules/FindLibXslt.cmake
index 4cca64f..01a9d8b 100644
--- a/Modules/FindLibXslt.cmake
+++ b/Modules/FindLibXslt.cmake
@@ -5,7 +5,8 @@
FindLibXslt
-----------
-Try to find the LibXslt library
+Find the XSL Transformations, Extensible Stylesheet Language
+Transformations (XSLT) library (LibXslt)
Once done this will define
diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake
index eb3b5fb..d229e18 100644
--- a/Modules/FindLua.cmake
+++ b/Modules/FindLua.cmake
@@ -7,7 +7,9 @@ FindLua
-Locate Lua library This module defines
+Locate Lua library.
+
+This module defines::
::
diff --git a/Modules/FindLua50.cmake b/Modules/FindLua50.cmake
index 52a54e7..0575caa 100644
--- a/Modules/FindLua50.cmake
+++ b/Modules/FindLua50.cmake
@@ -7,7 +7,8 @@ FindLua50
-Locate Lua library This module defines
+Locate Lua library.
+This module defines::
::
@@ -87,4 +88,3 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua50 DEFAULT_MSG LUA_LIBRARIES LUA_INCLUDE_DIR)
mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES)
-
diff --git a/Modules/FindLua51.cmake b/Modules/FindLua51.cmake
index 1c9029b..283a3eb 100644
--- a/Modules/FindLua51.cmake
+++ b/Modules/FindLua51.cmake
@@ -7,7 +7,8 @@ FindLua51
-Locate Lua library This module defines
+Locate Lua library.
+This module defines::
::
@@ -81,4 +82,3 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua51
VERSION_VAR LUA_VERSION_STRING)
mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY)
-
diff --git a/Modules/FindMFC.cmake b/Modules/FindMFC.cmake
index 9738ac5..e366619 100644
--- a/Modules/FindMFC.cmake
+++ b/Modules/FindMFC.cmake
@@ -5,7 +5,7 @@
FindMFC
-------
-Find MFC on Windows
+Find Microsoft Foundation Class Library (MFC) on Windows
Find the native MFC - i.e. decide if an application can link to the
MFC libraries.
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index 8c45a8c..5288640 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -770,18 +770,20 @@ function (_MPI_interrogate_compiler LANG)
endforeach()
# Add the link directories given explicitly that we haven't used back as linker directories.
- foreach(_MPI_LINK_DIRECTORY IN LISTS MPI_LINK_DIRECTORIES_LEFTOVER)
- file(TO_NATIVE_PATH "${_MPI_LINK_DIRECTORY}" _MPI_LINK_DIRECTORY_ACTUAL)
- string(FIND "${_MPI_LINK_DIRECTORY_ACTUAL}" " " _MPI_LINK_DIRECTORY_CONTAINS_SPACE)
- if(NOT _MPI_LINK_DIRECTORY_CONTAINS_SPACE EQUAL -1)
- set(_MPI_LINK_DIRECTORY_ACTUAL "\"${_MPI_LINK_DIRECTORY_ACTUAL}\"")
- endif()
- if(MPI_LINK_FLAGS_WORK)
- string(APPEND MPI_LINK_FLAGS_WORK " ${CMAKE_LIBRARY_PATH_FLAG}${_MPI_LINK_DIRECTORY_ACTUAL}")
- else()
- set(MPI_LINK_FLAGS_WORK "${CMAKE_LIBRARY_PATH_FLAG}${_MPI_LINK_DIRECTORY_ACTUAL}")
- endif()
- endforeach()
+ if(NOT WIN32)
+ foreach(_MPI_LINK_DIRECTORY IN LISTS MPI_LINK_DIRECTORIES_LEFTOVER)
+ file(TO_NATIVE_PATH "${_MPI_LINK_DIRECTORY}" _MPI_LINK_DIRECTORY_ACTUAL)
+ string(FIND "${_MPI_LINK_DIRECTORY_ACTUAL}" " " _MPI_LINK_DIRECTORY_CONTAINS_SPACE)
+ if(NOT _MPI_LINK_DIRECTORY_CONTAINS_SPACE EQUAL -1)
+ set(_MPI_LINK_DIRECTORY_ACTUAL "\"${_MPI_LINK_DIRECTORY_ACTUAL}\"")
+ endif()
+ if(MPI_LINK_FLAGS_WORK)
+ string(APPEND MPI_LINK_FLAGS_WORK " ${CMAKE_LIBRARY_PATH_FLAG}${_MPI_LINK_DIRECTORY_ACTUAL}")
+ else()
+ set(MPI_LINK_FLAGS_WORK "${CMAKE_LIBRARY_PATH_FLAG}${_MPI_LINK_DIRECTORY_ACTUAL}")
+ endif()
+ endforeach()
+ endif()
# Deal with the libraries given with full path next
unset(MPI_DIRECT_LIB_NAMES_WORK)
diff --git a/Modules/FindOpenAL.cmake b/Modules/FindOpenAL.cmake
index 18f3ff6..27dcaf5 100644
--- a/Modules/FindOpenAL.cmake
+++ b/Modules/FindOpenAL.cmake
@@ -6,15 +6,15 @@ FindOpenAL
----------
+Finds Open Audio Library (OpenAL).
+This module defines ``OPENAL_LIBRARY OPENAL_FOUND``, if
+false, do not try to link to OpenAL ``OPENAL_INCLUDE_DIR``, where to find
+the headers.
-Locate OpenAL This module defines OPENAL_LIBRARY OPENAL_FOUND, if
-false, do not try to link to OpenAL OPENAL_INCLUDE_DIR, where to find
-the headers
+``$OPENALDIR`` is an environment variable that would correspond to the
+``./configure --prefix=$OPENALDIR`` used in building OpenAL.
-$OPENALDIR is an environment variable that would correspond to the
-./configure --prefix=$OPENALDIR used in building OpenAL.
-
-Created by Eric Wing. This was influenced by the FindSDL.cmake
+Created by Eric Wing. This was influenced by the ``FindSDL.cmake``
module.
#]=======================================================================]
diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake
index 79c0382..9891724 100644
--- a/Modules/FindOpenCL.cmake
+++ b/Modules/FindOpenCL.cmake
@@ -5,7 +5,7 @@
FindOpenCL
----------
-Try to find OpenCL
+Finds Open Computing Language (OpenCL)
IMPORTED Targets
^^^^^^^^^^^^^^^^
diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake
index 00db033..23bb001d 100644
--- a/Modules/FindOpenGL.cmake
+++ b/Modules/FindOpenGL.cmake
@@ -5,7 +5,7 @@
FindOpenGL
----------
-FindModule for OpenGL and GLU.
+FindModule for OpenGL and OpenGL Utility Library (GLU).
Optional COMPONENTS
^^^^^^^^^^^^^^^^^^^
@@ -23,9 +23,9 @@ This module defines the :prop_tgt:`IMPORTED` targets:
``OpenGL::OpenGL``
Defined to libOpenGL if the system is GLVND-based.
``OpenGL::GLU``
- Defined if the system has GLU.
+ Defined if the system has OpenGL Utility Library (GLU).
``OpenGL::GLX``
- Defined if the system has GLX.
+ Defined if the system has OpenGL Extension to the X Window System (GLX).
``OpenGL::EGL``
Defined if the system has EGL.
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
index 5a34b9e..b909db8 100644
--- a/Modules/FindOpenMP.cmake
+++ b/Modules/FindOpenMP.cmake
@@ -5,7 +5,7 @@
FindOpenMP
----------
-Finds OpenMP support
+Finds Open Multi-Processing (OpenMP) support.
This module can be used to detect OpenMP support in a compiler. If
the compiler supports OpenMP, the flags required to compile with
diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake
index 6f7d3c8..27909bc 100644
--- a/Modules/FindOpenSceneGraph.cmake
+++ b/Modules/FindOpenSceneGraph.cmake
@@ -5,11 +5,11 @@
FindOpenSceneGraph
------------------
-Find OpenSceneGraph
+Find OpenSceneGraph (3D graphics application programming interface)
This module searches for the OpenSceneGraph core "osg" library as well
-as OpenThreads, and whatever additional COMPONENTS (nodekits) that you
-specify.
+as :module:`FindOpenThreads`, and whatever additional ``COMPONENTS``
+(nodekits) that you specify.
::
@@ -17,10 +17,11 @@ specify.
-NOTE: To use this module effectively you must either require CMake >=
-2.6.3 with cmake_minimum_required(VERSION 2.6.3) or download and place
-FindOpenThreads.cmake, Findosg_functions.cmake, Findosg.cmake, and
-Find<etc>.cmake files into your CMAKE_MODULE_PATH.
+NOTE: To use this module effectively you must either require ``CMake >=
+2.6.3`` with :command:`cmake_minimum_required(VERSION 2.6.3)` or download
+and place :module:`FindOpenThreads`, :module:`Findosg` functions,
+:module:`Findosg` and ``Find<etc>.cmake`` files into your
+:variable:`CMAKE_MODULE_PATH`.
==================================
@@ -40,11 +41,12 @@ This module accepts the following variables (note mixed case)
The following environment variables are also respected for finding the
-OSG and it's various components. CMAKE_PREFIX_PATH can also be used
-for this (see find_library() CMake documentation).
+OSG and it's various components. :variable:`CMAKE_PREFIX_PATH` can also be
+used for this (see :command:`find_library` CMake documentation).
``<MODULE>_DIR``
- (where MODULE is of the form "OSGVOLUME" and there is a FindosgVolume.cmake file)
+ (where ``MODULE`` is of the form "OSGVOLUME" and there is
+ a :module:`FindosgVolume`.cmake` file)
``OSG_DIR``
..
``OSGDIR``
@@ -53,7 +55,7 @@ for this (see find_library() CMake documentation).
..
-[CMake 2.8.10]: The CMake variable OSG_DIR can now be used as well to
+[CMake 2.8.10]: The CMake variable ``OSG_DIR`` can now be used as well to
influence detection, instead of needing to specify an environment
variable.
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index 0868989..8bd5eb3 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -321,9 +321,9 @@ unset (_${_PYTHON_PREFIX}_CACHED_VARS)
# first step, search for the interpreter
if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
+ list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS ${_PYTHON_PREFIX}_EXECUTABLE)
if (${_PYTHON_PREFIX}_FIND_REQUIRED_Interpreter)
list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_EXECUTABLE)
- list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS ${_PYTHON_PREFIX}_EXECUTABLE)
endif()
set (_${_PYTHON_PREFIX}_HINTS "${${_PYTHON_PREFIX}_ROOT_DIR}" ENV ${_PYTHON_PREFIX}_ROOT_DIR)
@@ -589,9 +589,9 @@ endif()
# second step, search for compiler (IronPython)
if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
+ list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS ${_PYTHON_PREFIX}_COMPILER)
if (${_PYTHON_PREFIX}_FIND_REQUIRED_Compiler)
list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_COMPILER)
- list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS ${_PYTHON_PREFIX}_COMPILER)
endif()
# IronPython specific artifacts
@@ -700,15 +700,15 @@ endif()
## Development environment is not compatible with IronPython interpreter
if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
AND NOT ${_PYTHON_PREFIX}_INTERPRETER_ID STREQUAL "IronPython")
+ list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS ${_PYTHON_PREFIX}_LIBRARY
+ ${_PYTHON_PREFIX}_LIBRARY_RELEASE
+ ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE
+ ${_PYTHON_PREFIX}_LIBRARY_DEBUG
+ ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG
+ ${_PYTHON_PREFIX}_INCLUDE_DIR)
if (${_PYTHON_PREFIX}_FIND_REQUIRED_Development)
list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_LIBRARY
${_PYTHON_PREFIX}_INCLUDE_DIR)
- list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS ${_PYTHON_PREFIX}_LIBRARY
- ${_PYTHON_PREFIX}_LIBRARY_RELEASE
- ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE
- ${_PYTHON_PREFIX}_LIBRARY_DEBUG
- ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG
- ${_PYTHON_PREFIX}_INCLUDE_DIR)
endif()
# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
@@ -1182,9 +1182,9 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
endif()
if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_Interpreter_FOUND)
+ list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS ${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR)
if (${_PYTHON_PREFIX}_FIND_REQUIRED_NumPy)
list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR)
- list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS ${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR)
endif()
execute_process(
COMMAND "${${_PYTHON_PREFIX}_EXECUTABLE}" -c
@@ -1213,6 +1213,10 @@ if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_Inte
set(${_PYTHON_PREFIX}_NumPy_VERSION "${_${_PYTHON_PREFIX}_NumPy_VERSION}")
endif()
endif()
+ # final step: set NumPy founded only if Development component is founded as well
+ if (NOT ${_PYTHON_PREFIX}_Development_FOUND)
+ set(${_PYTHON_PREFIX}_NumPy_FOUND FALSE)
+ endif()
endif()
# final validation
diff --git a/Modules/FindSWIG.cmake b/Modules/FindSWIG.cmake
index 49f303e..a5e3a37 100644
--- a/Modules/FindSWIG.cmake
+++ b/Modules/FindSWIG.cmake
@@ -5,13 +5,13 @@
FindSWIG
--------
-Find SWIG
+Find Simplified Wrapper and Interface Generator (SWIG)
This module finds an installed SWIG. It sets the following variables:
::
- SWIG_FOUND - set to true if SWIG is found
+ SWIG_FOUND - set to "True" if SWIG is found
SWIG_DIR - the directory where swig is installed
SWIG_EXECUTABLE - the path to the swig executable
SWIG_VERSION - the version number of the swig executable
diff --git a/Modules/FindVulkan.cmake b/Modules/FindVulkan.cmake
index b1201b4..ae8d72d 100644
--- a/Modules/FindVulkan.cmake
+++ b/Modules/FindVulkan.cmake
@@ -5,7 +5,8 @@
FindVulkan
----------
-Try to find Vulkan
+Find Vulkan, which isis a low-overhead, cross-platform 3D graphics
+and computing API.
IMPORTED Targets
^^^^^^^^^^^^^^^^
@@ -18,7 +19,7 @@ Result Variables
This module defines the following variables::
- Vulkan_FOUND - True if Vulkan was found
+ Vulkan_FOUND - "True" if Vulkan was found
Vulkan_INCLUDE_DIRS - include directories for Vulkan
Vulkan_LIBRARIES - link against this library to use Vulkan
diff --git a/Modules/Findosg.cmake b/Modules/Findosg.cmake
index bb28454..027f315 100644
--- a/Modules/Findosg.cmake
+++ b/Modules/Findosg.cmake
@@ -7,8 +7,6 @@ Findosg
-
-
NOTE: It is highly recommended that you use the new
FindOpenSceneGraph.cmake introduced in CMake 2.6.3 and not use this
Find module directly.
diff --git a/Modules/FindosgDB.cmake b/Modules/FindosgDB.cmake
index d0789ba..a28f650 100644
--- a/Modules/FindosgDB.cmake
+++ b/Modules/FindosgDB.cmake
@@ -7,30 +7,38 @@ FindosgDB
-This is part of the Findosg* suite used to find OpenSceneGraph
+This is part of the ``Findosg*`` suite used to find OpenSceneGraph
components. Each component is separate and you must opt in to each
module. You must also opt into OpenGL and OpenThreads (and Producer
if needed) as these modules won't do it for you. This is to allow you
control over your own system piece by piece in case you need to opt
out of certain components or change the Find behavior for a particular
-module (perhaps because the default FindOpenGL.cmake module doesn't
+module (perhaps because the default :module:`FindOpenGL` module doesn't
work with your system as an example). If you want to use a more
convenient module that includes everything, use the
-FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+:module:`FindOpenSceneGraph` instead of the ``Findosg*.cmake`` modules.
-Locate osgDB This module defines
+Locate osgDB This module defines:
-OSGDB_FOUND - Was osgDB found? OSGDB_INCLUDE_DIR - Where to find the
-headers OSGDB_LIBRARIES - The libraries to link against for the osgDB
-(use this)
+``OSGDB_FOUND``
+ Was osgDB found?
-OSGDB_LIBRARY - The osgDB library OSGDB_LIBRARY_DEBUG - The osgDB
-debug library
+``OSGDB_INCLUDE_DIR``
+ Where to find the headers
-$OSGDIR is an environment variable that would correspond to the
-./configure --prefix=$OSGDIR used in building osg.
+``OSGDB_LIBRARIES``
+ The libraries to link against for the osgDB
+
+``OSGDB_LIBRARY``
+ The osgDB library
+
+``OSGDB_LIBRARY_DEBUG``
+ The osgDB debug library
+
+``$OSGDIR`` is an environment variable that would correspond to::
+
+ ./configure --prefix=$OSGDIR used in building osg.
-Created by Eric Wing.
#]=======================================================================]
# Header files are presumed to be included like
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 49f237f..01c6cd7 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -264,6 +264,8 @@ set(SRCS
cmGeneratorExpression.h
cmGeneratorTarget.cxx
cmGeneratorTarget.h
+ cmGetPipes.cxx
+ cmGetPipes.h
cmGlobalCommonGenerator.cxx
cmGlobalCommonGenerator.h
cmGlobalGenerator.cxx
@@ -386,6 +388,7 @@ set(SRCS
cmUuid.cxx
cmUVHandlePtr.cxx
cmUVHandlePtr.h
+ cmUVStreambuf.h
cmUVSignalHackRAII.h
cmVariableWatch.cxx
cmVariableWatch.h
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index fa9ebda..dd166e0 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 14)
-set(CMake_VERSION_PATCH 20190424)
+set(CMake_VERSION_PATCH 20190501)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx
index bfe8d70..a2c30bb 100644
--- a/Source/CTest/cmProcess.cxx
+++ b/Source/CTest/cmProcess.cxx
@@ -5,61 +5,19 @@
#include "cmCTest.h"
#include "cmCTestRunTest.h"
#include "cmCTestTestHandler.h"
+#include "cmGetPipes.h"
#include "cmsys/Process.h"
-#include <fcntl.h>
#include <iostream>
#include <signal.h>
#include <string>
#if defined(_WIN32)
# include "cm_kwiml.h"
-#else
-# include <unistd.h>
#endif
#include <utility>
#define CM_PROCESS_BUF_SIZE 65536
-#if defined(_WIN32) && !defined(__CYGWIN__)
-# include <io.h>
-
-static int cmProcessGetPipes(int* fds)
-{
- SECURITY_ATTRIBUTES attr;
- HANDLE readh, writeh;
- attr.nLength = sizeof(attr);
- attr.lpSecurityDescriptor = nullptr;
- attr.bInheritHandle = FALSE;
- if (!CreatePipe(&readh, &writeh, &attr, 0))
- return uv_translate_sys_error(GetLastError());
- fds[0] = _open_osfhandle((intptr_t)readh, 0);
- fds[1] = _open_osfhandle((intptr_t)writeh, 0);
- if (fds[0] == -1 || fds[1] == -1) {
- CloseHandle(readh);
- CloseHandle(writeh);
- return uv_translate_sys_error(GetLastError());
- }
- return 0;
-}
-#else
-# include <errno.h>
-
-static int cmProcessGetPipes(int* fds)
-{
- if (pipe(fds) == -1) {
- return uv_translate_sys_error(errno);
- }
-
- if (fcntl(fds[0], F_SETFD, FD_CLOEXEC) == -1 ||
- fcntl(fds[1], F_SETFD, FD_CLOEXEC) == -1) {
- close(fds[0]);
- close(fds[1]);
- return uv_translate_sys_error(errno);
- }
- return 0;
-}
-#endif
-
cmProcess::cmProcess(cmCTestRunTest& runner)
: Runner(runner)
, Conv(cmProcessOutput::UTF8, CM_PROCESS_BUF_SIZE)
@@ -120,7 +78,7 @@ bool cmProcess::StartProcess(uv_loop_t& loop, std::vector<size_t>* affinity)
pipe_reader.init(loop, 0, this);
int fds[2] = { -1, -1 };
- status = cmProcessGetPipes(fds);
+ status = cmGetPipes(fds);
if (status != 0) {
cmCTestLog(this->Runner.GetCTest(), ERROR_MESSAGE,
"Error initializing pipe: " << uv_strerror(status)
diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx
index ff6340f..0d9859e 100644
--- a/Source/cmExecuteProcessCommand.cxx
+++ b/Source/cmExecuteProcessCommand.cxx
@@ -6,11 +6,13 @@
#include "cmsys/Process.h"
#include <algorithm>
#include <ctype.h> /* isspace */
+#include <iostream>
#include <stdio.h>
#include "cmAlgorithms.h"
#include "cmArgumentParser.h"
#include "cmMakefile.h"
+#include "cmMessageType.h"
#include "cmProcessOutput.h"
#include "cmSystemTools.h"
@@ -47,6 +49,7 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args,
std::string OutputFile;
std::string ErrorFile;
std::string Timeout;
+ std::string CommandEcho;
bool OutputQuiet = false;
bool ErrorQuiet = false;
bool OutputStripTrailingWhitespace = false;
@@ -57,6 +60,7 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args,
static auto const parser =
cmArgumentParser<Arguments>{}
.Bind("COMMAND"_s, &Arguments::Commands)
+ .Bind("COMMAND_ECHO"_s, &Arguments::CommandEcho)
.Bind("OUTPUT_VARIABLE"_s, &Arguments::OutputVariable)
.Bind("ERROR_VARIABLE"_s, &Arguments::ErrorVariable)
.Bind("RESULT_VARIABLE"_s, &Arguments::ResultVariable)
@@ -117,9 +121,10 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args,
return false;
}
}
-
// Create a process instance.
- cmsysProcess* cp = cmsysProcess_New();
+ std::unique_ptr<cmsysProcess, void (*)(cmsysProcess*)> cp_ptr(
+ cmsysProcess_New(), cmsysProcess_Delete);
+ cmsysProcess* cp = cp_ptr.get();
// Set the command sequence.
for (std::vector<std::string> const& cmd : arguments.Commands) {
@@ -169,6 +174,51 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args,
cmsysProcess_SetTimeout(cp, timeout);
}
+ bool echo_stdout = false;
+ bool echo_stderr = false;
+ bool echo_output_from_variable = true;
+ std::string echo_output =
+ this->Makefile->GetSafeDefinition("CMAKE_EXECUTE_PROCESS_COMMAND_ECHO");
+ if (!arguments.CommandEcho.empty()) {
+ echo_output_from_variable = false;
+ echo_output = arguments.CommandEcho;
+ }
+
+ if (!echo_output.empty()) {
+ if (echo_output == "STDERR") {
+ echo_stderr = true;
+ } else if (echo_output == "STDOUT") {
+ echo_stdout = true;
+ } else if (echo_output != "NONE") {
+ std::string error;
+ if (echo_output_from_variable) {
+ error = "CMAKE_EXECUTE_PROCESS_COMMAND_ECHO set to '";
+ } else {
+ error = " called with '";
+ }
+ error += echo_output;
+ error += "' expected STDERR|STDOUT|NONE";
+ if (!echo_output_from_variable) {
+ error += " for COMMAND_ECHO.";
+ }
+ this->Makefile->IssueMessage(MessageType::FATAL_ERROR, error);
+ return true;
+ }
+ }
+ if (echo_stdout || echo_stderr) {
+ std::string command;
+ for (auto& cmd : arguments.Commands) {
+ command += "'";
+ command += cmJoin(cmd, "' '");
+ command += "'";
+ command += "\n";
+ }
+ if (echo_stdout) {
+ std::cout << command;
+ } else if (echo_stderr) {
+ std::cerr << command;
+ }
+ }
// Start the process.
cmsysProcess_Execute(cp);
@@ -297,9 +347,6 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args,
}
}
- // Delete the process instance.
- cmsysProcess_Delete(cp);
-
return true;
}
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 8b3d9d6..8803830 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -1600,10 +1600,16 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
reportError(context, content->GetOriginalExpression(), e.str());
return std::string();
}
- if (gt->GetType() != cmStateEnums::OBJECT_LIBRARY) {
+ cmStateEnums::TargetType type = gt->GetType();
+ if (type != cmStateEnums::EXECUTABLE &&
+ type != cmStateEnums::STATIC_LIBRARY &&
+ type != cmStateEnums::SHARED_LIBRARY &&
+ type != cmStateEnums::MODULE_LIBRARY &&
+ type != cmStateEnums::OBJECT_LIBRARY) {
std::ostringstream e;
e << "Objects of target \"" << tgtName
- << "\" referenced but is not an OBJECT library.";
+ << "\" referenced but is not an allowed library types (EXECUTABLE, "
+ << "STATIC, SHARED, MODULE, OBJECT).";
reportError(context, content->GetOriginalExpression(), e.str());
return std::string();
}
diff --git a/Source/cmGetPipes.cxx b/Source/cmGetPipes.cxx
new file mode 100644
index 0000000..ad323f7
--- /dev/null
+++ b/Source/cmGetPipes.cxx
@@ -0,0 +1,48 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#include "cmGetPipes.h"
+
+#include "cm_uv.h"
+
+#include <fcntl.h>
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+# include <io.h>
+
+int cmGetPipes(int* fds)
+{
+ SECURITY_ATTRIBUTES attr;
+ HANDLE readh, writeh;
+ attr.nLength = sizeof(attr);
+ attr.lpSecurityDescriptor = nullptr;
+ attr.bInheritHandle = FALSE;
+ if (!CreatePipe(&readh, &writeh, &attr, 0))
+ return uv_translate_sys_error(GetLastError());
+ fds[0] = _open_osfhandle((intptr_t)readh, 0);
+ fds[1] = _open_osfhandle((intptr_t)writeh, 0);
+ if (fds[0] == -1 || fds[1] == -1) {
+ CloseHandle(readh);
+ CloseHandle(writeh);
+ return uv_translate_sys_error(GetLastError());
+ }
+ return 0;
+}
+#else
+# include <errno.h>
+# include <unistd.h>
+
+int cmGetPipes(int* fds)
+{
+ if (pipe(fds) == -1) {
+ return uv_translate_sys_error(errno);
+ }
+
+ if (fcntl(fds[0], F_SETFD, FD_CLOEXEC) == -1 ||
+ fcntl(fds[1], F_SETFD, FD_CLOEXEC) == -1) {
+ close(fds[0]);
+ close(fds[1]);
+ return uv_translate_sys_error(errno);
+ }
+ return 0;
+}
+#endif
diff --git a/Source/cmGetPipes.h b/Source/cmGetPipes.h
new file mode 100644
index 0000000..2a46b51
--- /dev/null
+++ b/Source/cmGetPipes.h
@@ -0,0 +1,8 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#ifndef cmGetPipes_h
+#define cmGetPipes_h
+
+int cmGetPipes(int* fds);
+
+#endif
diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx
index 2724030..5320ec5 100644
--- a/Source/cmMessageCommand.cxx
+++ b/Source/cmMessageCommand.cxx
@@ -8,6 +8,9 @@
#include "cmMessenger.h"
#include "cmRange.h"
#include "cmSystemTools.h"
+#include "cmake.h"
+
+#include <cassert>
class cmExecutionStatus;
@@ -19,49 +22,88 @@ bool cmMessageCommand::InitialPass(std::vector<std::string> const& args,
this->SetError("called with incorrect number of arguments");
return false;
}
- std::vector<std::string>::const_iterator i = args.begin();
+ auto i = args.cbegin();
- MessageType type = MessageType::MESSAGE;
- bool status = false;
- bool fatal = false;
+ auto type = MessageType::MESSAGE;
+ auto status = false;
+ auto fatal = false;
+ auto level = cmake::LogLevel::LOG_UNDEFINED;
if (*i == "SEND_ERROR") {
type = MessageType::FATAL_ERROR;
+ level = cmake::LogLevel::LOG_ERROR;
++i;
} else if (*i == "FATAL_ERROR") {
fatal = true;
type = MessageType::FATAL_ERROR;
+ level = cmake::LogLevel::LOG_ERROR;
++i;
} else if (*i == "WARNING") {
type = MessageType::WARNING;
+ level = cmake::LogLevel::LOG_WARNING;
++i;
} else if (*i == "AUTHOR_WARNING") {
if (this->Makefile->IsSet("CMAKE_SUPPRESS_DEVELOPER_ERRORS") &&
!this->Makefile->IsOn("CMAKE_SUPPRESS_DEVELOPER_ERRORS")) {
fatal = true;
type = MessageType::AUTHOR_ERROR;
+ level = cmake::LogLevel::LOG_ERROR;
} else if (!this->Makefile->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS")) {
type = MessageType::AUTHOR_WARNING;
+ level = cmake::LogLevel::LOG_WARNING;
} else {
return true;
}
++i;
} else if (*i == "STATUS") {
status = true;
+ level = cmake::LogLevel::LOG_STATUS;
+ ++i;
+ } else if (*i == "VERBOSE") {
+ status = true;
+ level = cmake::LogLevel::LOG_VERBOSE;
+ ++i;
+ } else if (*i == "DEBUG") {
+ status = true;
+ level = cmake::LogLevel::LOG_DEBUG;
+ ++i;
+ } else if (*i == "TRACE") {
+ status = true;
+ level = cmake::LogLevel::LOG_TRACE;
++i;
} else if (*i == "DEPRECATION") {
if (this->Makefile->IsOn("CMAKE_ERROR_DEPRECATED")) {
fatal = true;
type = MessageType::DEPRECATION_ERROR;
+ level = cmake::LogLevel::LOG_ERROR;
} else if ((!this->Makefile->IsSet("CMAKE_WARN_DEPRECATED") ||
this->Makefile->IsOn("CMAKE_WARN_DEPRECATED"))) {
type = MessageType::DEPRECATION_WARNING;
+ level = cmake::LogLevel::LOG_WARNING;
} else {
return true;
}
++i;
+ } else if (*i == "NOTICE") {
+ // `NOTICE` message type is going to be output to stderr
+ level = cmake::LogLevel::LOG_NOTICE;
+ ++i;
+ } else {
+ // Messages w/o any type are `NOTICE`s
+ level = cmake::LogLevel::LOG_NOTICE;
+ }
+ assert("Message log level expected to be set" &&
+ level != cmake::LogLevel::LOG_UNDEFINED);
+
+ auto desiredLevel = this->Makefile->GetCMakeInstance()->GetLogLevel();
+ assert("Expected a valid log level here" &&
+ desiredLevel != cmake::LogLevel::LOG_UNDEFINED);
+
+ if (desiredLevel < level) {
+ // Suppress the message
+ return true;
}
- std::string message = cmJoin(cmMakeRange(i, args.end()), std::string());
+ auto message = cmJoin(cmMakeRange(i, args.cend()), "");
if (type != MessageType::MESSAGE) {
// we've overridden the message type, above, so display it directly
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index 75c5d8a..005c27d 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -1186,6 +1186,7 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
num = std::min<unsigned long>(num, ParallelMax);
Base_.NumThreads = static_cast<unsigned int>(num);
}
+ WorkerPool_.SetThreadCount(Base_.NumThreads);
}
// - Files and directories
@@ -1482,15 +1483,12 @@ bool cmQtAutoMocUic::Process()
if (!CreateDirectories()) {
return false;
}
-
- if (!WorkerPool_.Process(Base().NumThreads, this)) {
+ if (!WorkerPool_.Process(this)) {
return false;
}
-
if (JobError_) {
return false;
}
-
return SettingsFileWrite();
}
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index 203ee93..dad8821 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -8,6 +8,7 @@
#include "cmGlobalGenerator.h"
#include "cmJsonObjectDictionary.h"
#include "cmJsonObjects.h"
+#include "cmMessageType.h"
#include "cmServer.h"
#include "cmServerDictionary.h"
#include "cmState.h"
@@ -600,6 +601,10 @@ cmServerResponse cmServerProtocol1::ProcessConfigure(
}
int ret = cm->Configure();
+ cm->IssueMessage(
+ MessageType::DEPRECATION_WARNING,
+ "The 'cmake-server(7)' is deprecated. "
+ "Please port clients to use the 'cmake-file-api(7)' instead.");
if (ret < 0) {
return request.ReportError("Configuration failed.");
}
diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx
index 2bc4c39..5cdacaa 100644
--- a/Source/cmSourceGroupCommand.cxx
+++ b/Source/cmSourceGroupCommand.cxx
@@ -80,7 +80,10 @@ std::vector<std::string> prepareFilesPathsForTree(
prepared.reserve(filesPaths.size());
for (auto const& filePath : filesPaths) {
- prepared.push_back(prepareFilePathForTree(filePath, currentSourceDir));
+ // If provided file path is actually not a file, silently ignore it.
+ if (cmSystemTools::FileExists(filePath, /*isFile=*/true)) {
+ prepared.push_back(prepareFilePathForTree(filePath, currentSourceDir));
+ }
}
return prepared;
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 212608d..bc853b7 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -168,7 +168,6 @@ bool cmSystemTools::s_RunCommandHideConsole = false;
bool cmSystemTools::s_DisableRunCommandOutput = false;
bool cmSystemTools::s_ErrorOccured = false;
bool cmSystemTools::s_FatalErrorOccured = false;
-bool cmSystemTools::s_DisableMessages = false;
bool cmSystemTools::s_ForceUnixPaths = false;
// replace replace with with as many times as it shows up in source.
@@ -326,14 +325,11 @@ void cmSystemTools::Stdout(const std::string& s)
void cmSystemTools::Message(const std::string& m, const char* title)
{
- if (s_DisableMessages) {
- return;
- }
if (s_MessageCallback) {
s_MessageCallback(m, title);
- return;
+ } else {
+ std::cerr << m << std::endl;
}
- std::cerr << m << std::endl << std::flush;
}
void cmSystemTools::ReportLastSystemError(const char* msg)
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index a8b2d37..05bd351 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -266,8 +266,6 @@ public:
static size_t CalculateCommandLineLengthLimit();
- static void EnableMessages() { s_DisableMessages = false; }
- static void DisableMessages() { s_DisableMessages = true; }
static void DisableRunCommandOutput() { s_DisableRunCommandOutput = true; }
static void EnableRunCommandOutput() { s_DisableRunCommandOutput = false; }
static bool GetRunCommandOutput() { return s_DisableRunCommandOutput; }
@@ -540,7 +538,6 @@ private:
static bool s_RunCommandHideConsole;
static bool s_ErrorOccured;
static bool s_FatalErrorOccured;
- static bool s_DisableMessages;
static bool s_DisableRunCommandOutput;
};
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 5c7b95c..3883b52 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -456,8 +456,8 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
this->Target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
std::string configLib =
this->Target->GetDebugGeneratorExpressions(libRef, llt);
- if (cmGeneratorExpression::IsValidTargetName(libRef) ||
- cmGeneratorExpression::Find(libRef) != std::string::npos) {
+ if (cmGeneratorExpression::IsValidTargetName(lib) ||
+ cmGeneratorExpression::Find(lib) != std::string::npos) {
configLib = "$<LINK_ONLY:" + configLib + ">";
}
this->Target->AppendProperty("INTERFACE_LINK_LIBRARIES",
diff --git a/Source/cmUVHandlePtr.cxx b/Source/cmUVHandlePtr.cxx
index fd07d2d..27069ee 100644
--- a/Source/cmUVHandlePtr.cxx
+++ b/Source/cmUVHandlePtr.cxx
@@ -11,19 +11,59 @@
namespace cm {
-static void close_delete(uv_handle_t* h)
+struct uv_loop_deleter
{
- free(h);
+ void operator()(uv_loop_t* loop) const;
+};
+
+void uv_loop_deleter::operator()(uv_loop_t* loop) const
+{
+ uv_run(loop, UV_RUN_DEFAULT);
+ int result = uv_loop_close(loop);
+ (void)result;
+ assert(result >= 0);
+ free(loop);
+}
+
+int uv_loop_ptr::init(void* data)
+{
+ this->reset();
+
+ this->loop.reset(static_cast<uv_loop_t*>(calloc(1, sizeof(uv_loop_t))),
+ uv_loop_deleter());
+ this->loop->data = data;
+
+ return uv_loop_init(this->loop.get());
+}
+
+void uv_loop_ptr::reset()
+{
+ this->loop.reset();
+}
+
+uv_loop_ptr::operator uv_loop_t*()
+{
+ return this->loop.get();
+}
+
+uv_loop_t* uv_loop_ptr::operator->() const noexcept
+{
+ return this->loop.get();
+}
+
+uv_loop_t* uv_loop_ptr::get() const
+{
+ return this->loop.get();
}
template <typename T>
-static void default_delete(T* type_handle)
+static void handle_default_delete(T* type_handle)
{
auto handle = reinterpret_cast<uv_handle_t*>(type_handle);
if (handle) {
assert(!uv_is_closing(handle));
if (!uv_is_closing(handle)) {
- uv_close(handle, &close_delete);
+ uv_close(handle, [](uv_handle_t* h) { free(h); });
}
}
}
@@ -34,7 +74,7 @@ static void default_delete(T* type_handle)
template <typename T>
struct uv_handle_deleter
{
- void operator()(T* type_handle) const { default_delete(type_handle); }
+ void operator()(T* type_handle) const { handle_default_delete(type_handle); }
};
template <typename T>
@@ -107,7 +147,7 @@ struct uv_handle_deleter<uv_async_t>
void operator()(uv_async_t* handle)
{
std::lock_guard<std::mutex> lock(*handleMutex);
- default_delete(handle);
+ handle_default_delete(handle);
}
};
@@ -136,7 +176,7 @@ struct uv_handle_deleter<uv_signal_t>
{
if (handle) {
uv_signal_stop(handle);
- default_delete(handle);
+ handle_default_delete(handle);
}
}
};
diff --git a/Source/cmUVHandlePtr.h b/Source/cmUVHandlePtr.h
index 992c429..c09e4bf 100644
--- a/Source/cmUVHandlePtr.h
+++ b/Source/cmUVHandlePtr.h
@@ -30,7 +30,45 @@
namespace cm {
/***
- * RAII class to simplify and insure the safe usage of uv_*_t types. This
+ * RAII class to simplify and ensure the safe usage of uv_loop_t. This includes
+ * making sure resources are properly freed.
+ */
+class uv_loop_ptr
+{
+protected:
+ std::shared_ptr<uv_loop_t> loop;
+
+public:
+ uv_loop_ptr(uv_loop_ptr const&) = delete;
+ uv_loop_ptr& operator=(uv_loop_ptr const&) = delete;
+ uv_loop_ptr(uv_loop_ptr&&) noexcept;
+ uv_loop_ptr& operator=(uv_loop_ptr&&) noexcept;
+
+ // Dtor and ctor need to be inline defined like this for default ctors and
+ // dtors to work. Some compilers do not like '= default' here.
+ uv_loop_ptr() {} // NOLINT(modernize-use-equals-default)
+ uv_loop_ptr(std::nullptr_t) {}
+ ~uv_loop_ptr() { this->reset(); }
+
+ int init(void* data = nullptr);
+
+ /**
+ * Properly close the handle if needed and sets the inner handle to nullptr
+ */
+ void reset();
+
+ /**
+ * Allow less verbose calling of uv_loop_* functions
+ * @return reinterpreted handle
+ */
+ operator uv_loop_t*();
+
+ uv_loop_t* get() const;
+ uv_loop_t* operator->() const noexcept;
+};
+
+/***
+ * RAII class to simplify and ensure the safe usage of uv_*_t types. This
* includes making sure resources are properly freed and contains casting
* operators which allow for passing into relevant uv_* functions.
*
diff --git a/Source/cmUVStreambuf.h b/Source/cmUVStreambuf.h
new file mode 100644
index 0000000..29e4fde
--- /dev/null
+++ b/Source/cmUVStreambuf.h
@@ -0,0 +1,219 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#ifndef cmUVStreambuf_h
+#define cmUVStreambuf_h
+
+#include "cmUVHandlePtr.h"
+
+#include "cm_uv.h"
+
+#include <algorithm>
+#include <cstring>
+#include <streambuf>
+#include <vector>
+
+/*
+ * This file is based on example code from:
+ *
+ * http://www.voidcn.com/article/p-vjnlygmc-gy.html
+ *
+ * The example code was distributed under the following license:
+ *
+ * Copyright 2007 Edd Dawson.
+ * Distributed under the Boost Software License, Version 1.0.
+ *
+ * Boost Software License - Version 1.0 - August 17th, 2003
+ *
+ * Permission is hereby granted, free of charge, to any person or organization
+ * obtaining a copy of the software and accompanying documentation covered by
+ * this license (the "Software") to use, reproduce, display, distribute,
+ * execute, and transmit the Software, and to prepare derivative works of the
+ * Software, and to permit third-parties to whom the Software is furnished to
+ * do so, all subject to the following:
+ *
+ * The copyright notices in the Software and this entire statement, including
+ * the above license grant, this restriction and the following disclaimer,
+ * must be included in all copies of the Software, in whole or in part, and
+ * all derivative works of the Software, unless such copies or derivative
+ * works are solely in the form of machine-executable object code generated by
+ * a source language processor.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+ * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+ * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+template <typename CharT, typename Traits = std::char_traits<CharT>>
+class cmBasicUVStreambuf : public std::basic_streambuf<CharT, Traits>
+{
+public:
+ cmBasicUVStreambuf(std::size_t bufSize = 256, std::size_t putBack = 8);
+ ~cmBasicUVStreambuf() override;
+
+ bool is_open() const;
+
+ cmBasicUVStreambuf* open(uv_stream_t* stream);
+
+ cmBasicUVStreambuf* close();
+
+protected:
+ typename cmBasicUVStreambuf::int_type underflow() override;
+ std::streamsize showmanyc() override;
+
+ // FIXME: Add write support
+
+private:
+ uv_stream_t* Stream = nullptr;
+ void* OldStreamData;
+ const std::size_t PutBack;
+ std::vector<CharT> InputBuffer;
+ bool EndOfFile;
+
+ void StreamReadStartStop();
+
+ void StreamRead(ssize_t nread);
+ void HandleAlloc(uv_buf_t* buf);
+};
+
+template <typename CharT, typename Traits>
+cmBasicUVStreambuf<CharT, Traits>::cmBasicUVStreambuf(std::size_t bufSize,
+ std::size_t putBack)
+ : PutBack(std::max<std::size_t>(putBack, 1))
+ , InputBuffer(std::max<std::size_t>(this->PutBack, bufSize) + this->PutBack)
+{
+ this->close();
+}
+
+template <typename CharT, typename Traits>
+cmBasicUVStreambuf<CharT, Traits>::~cmBasicUVStreambuf()
+{
+ this->close();
+}
+
+template <typename CharT, typename Traits>
+bool cmBasicUVStreambuf<CharT, Traits>::is_open() const
+{
+ return this->Stream != nullptr;
+}
+
+template <typename CharT, typename Traits>
+cmBasicUVStreambuf<CharT, Traits>* cmBasicUVStreambuf<CharT, Traits>::open(
+ uv_stream_t* stream)
+{
+ this->close();
+ this->Stream = stream;
+ this->EndOfFile = false;
+ if (this->Stream) {
+ this->OldStreamData = this->Stream->data;
+ this->Stream->data = this;
+ }
+ this->StreamReadStartStop();
+ return this;
+}
+
+template <typename CharT, typename Traits>
+cmBasicUVStreambuf<CharT, Traits>* cmBasicUVStreambuf<CharT, Traits>::close()
+{
+ if (this->Stream) {
+ uv_read_stop(this->Stream);
+ this->Stream->data = this->OldStreamData;
+ }
+ this->Stream = nullptr;
+ CharT* readEnd = this->InputBuffer.data() + this->InputBuffer.size();
+ this->setg(readEnd, readEnd, readEnd);
+ return this;
+}
+
+template <typename CharT, typename Traits>
+typename cmBasicUVStreambuf<CharT, Traits>::int_type
+cmBasicUVStreambuf<CharT, Traits>::underflow()
+{
+ if (!this->is_open()) {
+ return Traits::eof();
+ }
+
+ if (this->gptr() < this->egptr()) {
+ return Traits::to_int_type(*this->gptr());
+ }
+
+ this->StreamReadStartStop();
+ while (this->in_avail() == 0) {
+ uv_run(this->Stream->loop, UV_RUN_ONCE);
+ }
+ if (this->in_avail() == -1) {
+ return Traits::eof();
+ }
+ return Traits::to_int_type(*this->gptr());
+}
+
+template <typename CharT, typename Traits>
+std::streamsize cmBasicUVStreambuf<CharT, Traits>::showmanyc()
+{
+ if (!this->is_open() || this->EndOfFile) {
+ return -1;
+ }
+ return 0;
+}
+
+template <typename CharT, typename Traits>
+void cmBasicUVStreambuf<CharT, Traits>::StreamReadStartStop()
+{
+ if (this->Stream) {
+ uv_read_stop(this->Stream);
+ if (this->gptr() >= this->egptr()) {
+ uv_read_start(
+ this->Stream,
+ [](uv_handle_t* handle, size_t /* unused */, uv_buf_t* buf) {
+ auto streambuf =
+ static_cast<cmBasicUVStreambuf<CharT, Traits>*>(handle->data);
+ streambuf->HandleAlloc(buf);
+ },
+ [](uv_stream_t* stream2, ssize_t nread, const uv_buf_t* /* unused */) {
+ auto streambuf =
+ static_cast<cmBasicUVStreambuf<CharT, Traits>*>(stream2->data);
+ streambuf->StreamRead(nread);
+ });
+ }
+ }
+}
+
+template <typename CharT, typename Traits>
+void cmBasicUVStreambuf<CharT, Traits>::HandleAlloc(uv_buf_t* buf)
+{
+ auto size = this->egptr() - this->gptr();
+ std::memmove(this->InputBuffer.data(), this->gptr(),
+ this->egptr() - this->gptr());
+ this->setg(this->InputBuffer.data(), this->InputBuffer.data(),
+ this->InputBuffer.data() + size);
+ buf->base = this->egptr();
+#ifdef _WIN32
+# define BUF_LEN_TYPE ULONG
+#else
+# define BUF_LEN_TYPE size_t
+#endif
+ buf->len = BUF_LEN_TYPE(
+ (this->InputBuffer.data() + this->InputBuffer.size() - this->egptr()) *
+ sizeof(CharT));
+#undef BUF_LEN_TYPE
+}
+
+template <typename CharT, typename Traits>
+void cmBasicUVStreambuf<CharT, Traits>::StreamRead(ssize_t nread)
+{
+ if (nread > 0) {
+ this->setg(this->eback(), this->gptr(),
+ this->egptr() + nread / sizeof(CharT));
+ uv_read_stop(this->Stream);
+ } else if (nread < 0 || nread == UV_EOF) {
+ this->EndOfFile = true;
+ uv_read_stop(this->Stream);
+ }
+}
+
+using cmUVStreambuf = cmBasicUVStreambuf<char>;
+
+#endif
diff --git a/Source/cmWorkerPool.cxx b/Source/cmWorkerPool.cxx
index 464182c..cbf070e 100644
--- a/Source/cmWorkerPool.cxx
+++ b/Source/cmWorkerPool.cxx
@@ -371,137 +371,62 @@ void cmUVReadOnlyProcess::UVTryFinish()
}
/**
- * @brief Private worker pool internals
+ * @brief Worker pool worker thread
*/
-class cmWorkerPoolInternal
+class cmWorkerPoolWorker
{
public:
- // -- Types
-
- /**
- * @brief Worker thread
- */
- class WorkerT
- {
- public:
- WorkerT(unsigned int index);
- ~WorkerT();
-
- WorkerT(WorkerT const&) = delete;
- WorkerT& operator=(WorkerT const&) = delete;
-
- /**
- * Start the thread
- */
- void Start(cmWorkerPoolInternal* internal);
-
- /**
- * @brief Run an external process
- */
- bool RunProcess(cmWorkerPool::ProcessResultT& result,
- std::vector<std::string> const& command,
- std::string const& workingDirectory);
-
- // -- Accessors
- unsigned int Index() const { return Index_; }
- cmWorkerPool::JobHandleT& JobHandle() { return JobHandle_; }
-
- private:
- // -- Libuv callbacks
- static void UVProcessStart(uv_async_t* handle);
- void UVProcessFinished();
-
- private:
- //! @brief Job handle
- cmWorkerPool::JobHandleT JobHandle_;
- //! @brief Worker index
- unsigned int Index_;
- // -- Process management
- struct
- {
- std::mutex Mutex;
- cm::uv_async_ptr Request;
- std::condition_variable Condition;
- std::unique_ptr<cmUVReadOnlyProcess> ROP;
- } Proc_;
- // -- System thread
- std::thread Thread_;
- };
-
-public:
- // -- Constructors
- cmWorkerPoolInternal(cmWorkerPool* pool);
- ~cmWorkerPoolInternal();
-
- /**
- * @brief Runs the libuv loop
- */
- bool Process();
+ cmWorkerPoolWorker(uv_loop_t& uvLoop);
+ ~cmWorkerPoolWorker();
- /**
- * @brief Clear queue and abort threads
- */
- void Abort();
+ cmWorkerPoolWorker(cmWorkerPoolWorker const&) = delete;
+ cmWorkerPoolWorker& operator=(cmWorkerPoolWorker const&) = delete;
/**
- * @brief Push a job to the queue and notify a worker
+ * Set the internal thread
*/
- bool PushJob(cmWorkerPool::JobHandleT&& jobHandle);
+ void SetThread(std::thread&& aThread) { Thread_ = std::move(aThread); }
/**
- * @brief Worker thread main loop method
+ * Run an external process
*/
- void Work(WorkerT* worker);
-
- // -- Request slots
- static void UVSlotBegin(uv_async_t* handle);
- static void UVSlotEnd(uv_async_t* handle);
-
-public:
- // -- UV loop
-#ifdef CMAKE_UV_SIGNAL_HACK
- std::unique_ptr<cmUVSignalHackRAII> UVHackRAII;
-#endif
- std::unique_ptr<uv_loop_t> UVLoop;
- cm::uv_async_ptr UVRequestBegin;
- cm::uv_async_ptr UVRequestEnd;
+ bool RunProcess(cmWorkerPool::ProcessResultT& result,
+ std::vector<std::string> const& command,
+ std::string const& workingDirectory);
- // -- Thread pool and job queue
- std::mutex Mutex;
- bool Aborting = false;
- bool FenceProcessing = false;
- unsigned int WorkersRunning = 0;
- unsigned int WorkersIdle = 0;
- unsigned int JobsProcessing = 0;
- std::deque<cmWorkerPool::JobHandleT> Queue;
- std::condition_variable Condition;
- std::vector<std::unique_ptr<WorkerT>> Workers;
+private:
+ // -- Libuv callbacks
+ static void UVProcessStart(uv_async_t* handle);
+ void UVProcessFinished();
- // -- References
- cmWorkerPool* Pool = nullptr;
+private:
+ // -- Process management
+ struct
+ {
+ std::mutex Mutex;
+ cm::uv_async_ptr Request;
+ std::condition_variable Condition;
+ std::unique_ptr<cmUVReadOnlyProcess> ROP;
+ } Proc_;
+ // -- System thread
+ std::thread Thread_;
};
-cmWorkerPoolInternal::WorkerT::WorkerT(unsigned int index)
- : Index_(index)
+cmWorkerPoolWorker::cmWorkerPoolWorker(uv_loop_t& uvLoop)
{
+ Proc_.Request.init(uvLoop, &cmWorkerPoolWorker::UVProcessStart, this);
}
-cmWorkerPoolInternal::WorkerT::~WorkerT()
+cmWorkerPoolWorker::~cmWorkerPoolWorker()
{
if (Thread_.joinable()) {
Thread_.join();
}
}
-void cmWorkerPoolInternal::WorkerT::Start(cmWorkerPoolInternal* internal)
-{
- Proc_.Request.init(*(internal->UVLoop), &WorkerT::UVProcessStart, this);
- Thread_ = std::thread(&cmWorkerPoolInternal::Work, internal, this);
-}
-
-bool cmWorkerPoolInternal::WorkerT::RunProcess(
- cmWorkerPool::ProcessResultT& result,
- std::vector<std::string> const& command, std::string const& workingDirectory)
+bool cmWorkerPoolWorker::RunProcess(cmWorkerPool::ProcessResultT& result,
+ std::vector<std::string> const& command,
+ std::string const& workingDirectory)
{
if (command.empty()) {
return false;
@@ -524,9 +449,9 @@ bool cmWorkerPoolInternal::WorkerT::RunProcess(
return !result.error();
}
-void cmWorkerPoolInternal::WorkerT::UVProcessStart(uv_async_t* handle)
+void cmWorkerPoolWorker::UVProcessStart(uv_async_t* handle)
{
- auto* wrk = reinterpret_cast<WorkerT*>(handle->data);
+ auto* wrk = reinterpret_cast<cmWorkerPoolWorker*>(handle->data);
bool startFailed = false;
{
auto& Proc = wrk->Proc_;
@@ -542,7 +467,7 @@ void cmWorkerPoolInternal::WorkerT::UVProcessStart(uv_async_t* handle)
}
}
-void cmWorkerPoolInternal::WorkerT::UVProcessFinished()
+void cmWorkerPoolWorker::UVProcessFinished()
{
{
std::lock_guard<std::mutex> lock(Proc_.Mutex);
@@ -554,6 +479,65 @@ void cmWorkerPoolInternal::WorkerT::UVProcessFinished()
Proc_.Condition.notify_one();
}
+/**
+ * @brief Private worker pool internals
+ */
+class cmWorkerPoolInternal
+{
+public:
+ // -- Constructors
+ cmWorkerPoolInternal(cmWorkerPool* pool);
+ ~cmWorkerPoolInternal();
+
+ /**
+ * Runs the libuv loop.
+ */
+ bool Process();
+
+ /**
+ * Clear queue and abort threads.
+ */
+ void Abort();
+
+ /**
+ * Push a job to the queue and notify a worker.
+ */
+ bool PushJob(cmWorkerPool::JobHandleT&& jobHandle);
+
+ /**
+ * Worker thread main loop method.
+ */
+ void Work(unsigned int workerIndex);
+
+ // -- Request slots
+ static void UVSlotBegin(uv_async_t* handle);
+ static void UVSlotEnd(uv_async_t* handle);
+
+public:
+ // -- UV loop
+#ifdef CMAKE_UV_SIGNAL_HACK
+ std::unique_ptr<cmUVSignalHackRAII> UVHackRAII;
+#endif
+ std::unique_ptr<uv_loop_t> UVLoop;
+ cm::uv_async_ptr UVRequestBegin;
+ cm::uv_async_ptr UVRequestEnd;
+
+ // -- Thread pool and job queue
+ std::mutex Mutex;
+ bool Processing = false;
+ bool Aborting = false;
+ bool FenceProcessing = false;
+ unsigned int WorkersRunning = 0;
+ unsigned int WorkersIdle = 0;
+ unsigned int JobsProcessing = 0;
+ std::deque<cmWorkerPool::JobHandleT> Queue;
+ std::condition_variable Condition;
+ std::vector<std::unique_ptr<cmWorkerPoolWorker>> Workers;
+
+ // -- References
+ cmWorkerPool* Pool = nullptr;
+};
+
void cmWorkerPool::ProcessResultT::reset()
{
ExitStatus = 0;
@@ -591,7 +575,8 @@ cmWorkerPoolInternal::~cmWorkerPoolInternal()
bool cmWorkerPoolInternal::Process()
{
- // Reset state
+ // Reset state flags
+ Processing = true;
Aborting = false;
// Initialize libuv asynchronous request
UVRequestBegin.init(*UVLoop, &cmWorkerPoolInternal::UVSlotBegin, this);
@@ -599,23 +584,27 @@ bool cmWorkerPoolInternal::Process()
// Send begin request
UVRequestBegin.send();
// Run libuv loop
- return (uv_run(UVLoop.get(), UV_RUN_DEFAULT) == 0);
+ bool success = (uv_run(UVLoop.get(), UV_RUN_DEFAULT) == 0);
+ // Update state flags
+ Processing = false;
+ Aborting = false;
+ return success;
}
void cmWorkerPoolInternal::Abort()
{
- bool firstCall = false;
+ bool notifyThreads = false;
// Clear all jobs and set abort flag
{
std::lock_guard<std::mutex> guard(Mutex);
- if (!Aborting) {
+ if (Processing && !Aborting) {
// Register abort and clear queue
Aborting = true;
Queue.clear();
- firstCall = true;
+ notifyThreads = true;
}
}
- if (firstCall) {
+ if (notifyThreads) {
// Wake threads
Condition.notify_all();
}
@@ -627,15 +616,13 @@ inline bool cmWorkerPoolInternal::PushJob(cmWorkerPool::JobHandleT&& jobHandle)
if (Aborting) {
return false;
}
-
// Append the job to the queue
Queue.emplace_back(std::move(jobHandle));
-
// Notify an idle worker if there's one
if (WorkersIdle != 0) {
Condition.notify_one();
}
-
+ // Return success
return true;
}
@@ -648,11 +635,13 @@ void cmWorkerPoolInternal::UVSlotBegin(uv_async_t* handle)
// Create workers
gint.Workers.reserve(num);
for (unsigned int ii = 0; ii != num; ++ii) {
- gint.Workers.emplace_back(cm::make_unique<WorkerT>(ii));
+ gint.Workers.emplace_back(
+ cm::make_unique<cmWorkerPoolWorker>(*gint.UVLoop));
}
- // Start workers
- for (auto& wrk : gint.Workers) {
- wrk->Start(&gint);
+ // Start worker threads
+ for (unsigned int ii = 0; ii != num; ++ii) {
+ gint.Workers[ii]->SetThread(
+ std::thread(&cmWorkerPoolInternal::Work, &gint, ii));
}
}
// Destroy begin request
@@ -668,8 +657,9 @@ void cmWorkerPoolInternal::UVSlotEnd(uv_async_t* handle)
gint.UVRequestEnd.reset();
}
-void cmWorkerPoolInternal::Work(WorkerT* worker)
+void cmWorkerPoolInternal::Work(unsigned int workerIndex)
{
+ cmWorkerPool::JobHandleT jobHandle;
std::unique_lock<std::mutex> uLock(Mutex);
// Increment running workers count
++WorkersRunning;
@@ -698,15 +688,15 @@ void cmWorkerPoolInternal::Work(WorkerT* worker)
}
// Pop next job from queue
- worker->JobHandle() = std::move(Queue.front());
+ jobHandle = std::move(Queue.front());
Queue.pop_front();
// Unlocked scope for job processing
++JobsProcessing;
{
uLock.unlock();
- worker->JobHandle()->Work(Pool, worker->Index()); // Process job
- worker->JobHandle().reset(); // Destroy job
+ jobHandle->Work(Pool, workerIndex); // Process job
+ jobHandle.reset(); // Destroy job
uLock.lock();
}
--JobsProcessing;
@@ -743,19 +733,22 @@ cmWorkerPool::cmWorkerPool()
cmWorkerPool::~cmWorkerPool() = default;
-bool cmWorkerPool::Process(unsigned int threadCount, void* userData)
+void cmWorkerPool::SetThreadCount(unsigned int threadCount)
+{
+ if (!Int_->Processing) {
+ ThreadCount_ = (threadCount > 0) ? threadCount : 1u;
+ }
+}
+
+bool cmWorkerPool::Process(void* userData)
{
// Setup user data
UserData_ = userData;
- ThreadCount_ = (threadCount > 0) ? threadCount : 1u;
-
// Run libuv loop
bool success = Int_->Process();
-
// Clear user data
UserData_ = nullptr;
- ThreadCount_ = 0;
-
+ // Return
return success;
}
diff --git a/Source/cmWorkerPool.h b/Source/cmWorkerPool.h
index 71c7d84..f08bb4f 100644
--- a/Source/cmWorkerPool.h
+++ b/Source/cmWorkerPool.h
@@ -50,12 +50,12 @@ public:
JobT& operator=(JobT const&) = delete;
/**
- * @brief Virtual destructor.
+ * Virtual destructor.
*/
virtual ~JobT();
/**
- * @brief Fence job flag
+ * Fence job flag
*
* Fence jobs require that:
* - all jobs before in the queue have been processed
@@ -66,7 +66,7 @@ public:
protected:
/**
- * @brief Protected default constructor
+ * Protected default constructor
*/
JobT(bool fence = false)
: Fence_(fence)
@@ -125,12 +125,12 @@ public:
};
/**
- * @brief Job handle type
+ * Job handle type
*/
typedef std::unique_ptr<JobT> JobHandleT;
/**
- * @brief Fence job base class
+ * Fence job base class
*/
class JobFenceT : public JobT
{
@@ -144,8 +144,9 @@ public:
};
/**
- * @brief Fence job that aborts the worker pool.
- * This class is useful as the last job in the job queue.
+ * Fence job that aborts the worker pool.
+ *
+ * Useful as the last job in the job queue.
*/
class JobEndT : JobFenceT
{
@@ -160,23 +161,29 @@ public:
~cmWorkerPool();
/**
- * @brief Blocking function that starts threads to process all Jobs in
- * the queue.
+ * Number of worker threads.
+ */
+ unsigned int ThreadCount() const { return ThreadCount_; }
+
+ /**
+ * Set the number of worker threads.
*
- * This method blocks until a job calls the Abort() method.
- * @arg threadCount Number of threads to process jobs.
- * @arg userData Common user data pointer available in all Jobs.
+ * Calling this method during Process() has no effect.
*/
- bool Process(unsigned int threadCount, void* userData = nullptr);
+ void SetThreadCount(unsigned int threadCount);
/**
- * Number of worker threads passed to Process().
- * Only valid during Process().
+ * Blocking function that starts threads to process all Jobs in the queue.
+ *
+ * This method blocks until a job calls the Abort() method.
+ * @arg threadCount Number of threads to process jobs.
+ * @arg userData Common user data pointer available in all Jobs.
*/
- unsigned int ThreadCount() const { return ThreadCount_; }
+ bool Process(void* userData = nullptr);
/**
* User data reference passed to Process().
+ *
* Only valid during Process().
*/
void* UserData() const { return UserData_; }
@@ -184,14 +191,14 @@ public:
// -- Job processing interface
/**
- * @brief Clears the job queue and aborts all worker threads.
+ * Clears the job queue and aborts all worker threads.
*
* This method is thread safe and can be called from inside a job.
*/
void Abort();
/**
- * @brief Push job to the queue.
+ * Push job to the queue.
*
* This method is thread safe and can be called from inside a job or before
* Process().
@@ -199,7 +206,7 @@ public:
bool PushJob(JobHandleT&& jobHandle);
/**
- * @brief Push job to the queue
+ * Push job to the queue
*
* This method is thread safe and can be called from inside a job or before
* Process().
@@ -212,7 +219,7 @@ public:
private:
void* UserData_ = nullptr;
- unsigned int ThreadCount_ = 0;
+ unsigned int ThreadCount_ = 1;
std::unique_ptr<cmWorkerPoolInternal> Int_;
};
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index fc24ac0..121d12d 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -718,6 +718,14 @@ void cmake::SetArgs(const std::vector<std::string>& args)
} else if (arg.find("--debug-output", 0) == 0) {
std::cout << "Running with debug output on.\n";
this->SetDebugOutputOn(true);
+ } else if (arg.find("--loglevel=", 0) == 0) {
+ const auto logLevel =
+ StringToLogLevel(arg.substr(sizeof("--loglevel=") - 1));
+ if (logLevel == LogLevel::LOG_UNDEFINED) {
+ cmSystemTools::Error("Invalid level specified for --loglevel");
+ return;
+ }
+ this->SetLogLevel(logLevel);
} else if (arg.find("--trace-expand", 0) == 0) {
std::cout << "Running with expanded trace output on.\n";
this->SetTrace(true);
@@ -828,6 +836,25 @@ void cmake::SetArgs(const std::vector<std::string>& args)
}
}
+cmake::LogLevel cmake::StringToLogLevel(const std::string& levelStr)
+{
+ using LevelsPair = std::pair<std::string, LogLevel>;
+ static const std::vector<LevelsPair> levels = {
+ { "error", LogLevel::LOG_ERROR }, { "warning", LogLevel::LOG_WARNING },
+ { "notice", LogLevel::LOG_NOTICE }, { "status", LogLevel::LOG_STATUS },
+ { "verbose", LogLevel::LOG_VERBOSE }, { "debug", LogLevel::LOG_DEBUG },
+ { "trace", LogLevel::LOG_TRACE }
+ };
+
+ const auto levelStrLowCase = cmSystemTools::LowerCase(levelStr);
+
+ const auto it = std::find_if(levels.cbegin(), levels.cend(),
+ [&levelStrLowCase](const LevelsPair& p) {
+ return p.first == levelStrLowCase;
+ });
+ return (it != levels.cend()) ? it->second : LogLevel::LOG_UNDEFINED;
+}
+
void cmake::SetDirectoriesFromFile(const char* arg)
{
// Check if the argument refers to a CMakeCache.txt or
diff --git a/Source/cmake.h b/Source/cmake.h
index 8b4b396..4a345cf 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -96,6 +96,19 @@ public:
FIND_PACKAGE_MODE
};
+ /** \brief Define log level constants. */
+ enum LogLevel
+ {
+ LOG_UNDEFINED,
+ LOG_ERROR,
+ LOG_WARNING,
+ LOG_NOTICE,
+ LOG_STATUS,
+ LOG_VERBOSE,
+ LOG_DEBUG,
+ LOG_TRACE
+ };
+
struct GeneratorInfo
{
std::string name;
@@ -331,6 +344,11 @@ public:
*/
cmFileTimeCache* GetFileTimeCache() { return this->FileTimeCache; }
+ // Get the selected log level for `message()` commands during the cmake run.
+ LogLevel GetLogLevel() const { return this->MessageLogLevel; }
+ void SetLogLevel(LogLevel level) { this->MessageLogLevel = level; }
+ static LogLevel StringToLogLevel(const std::string& levelStr);
+
// Do we want debug output during the cmake run.
bool GetDebugOutput() { return this->DebugOutput; }
void SetDebugOutputOn(bool b) { this->DebugOutput = b; }
@@ -524,6 +542,8 @@ private:
std::vector<std::string> TraceOnlyThisSources;
+ LogLevel MessageLogLevel = LogLevel::LOG_STATUS;
+
void UpdateConversionPathTable();
// Print a list of valid generators to stderr.
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index d70c9d9..5631d10 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -95,6 +95,8 @@ static const char* cmDocumentationOptions[][2] = {
"Generate graphviz of dependencies, see "
"CMakeGraphVizOptions.cmake for more." },
{ "--system-information [file]", "Dump information about this system." },
+ { "--loglevel=<error|warn|notice|status|verbose|debug|trace>",
+ "Set the verbosity of messages from CMake files." },
{ "--debug-trycompile",
"Do not delete the try_compile build tree. Only "
"useful on one try_compile at a time." },
diff --git a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
index 85ce1f7..5c704ac 100644
--- a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
@@ -134,11 +134,15 @@ assert_property(newsignature1 LINK_LIBRARIES "depC;depB;subdirlib")
#----------------------------------------------------------------------------
# Test cross-directory linking.
cmake_policy(PUSH)
+cmake_policy(SET CMP0022 NEW)
cmake_policy(SET CMP0079 NEW)
add_executable(TopDir TopDir.c)
add_subdirectory(SubDirA)
add_subdirectory(SubDirB)
target_link_libraries(SubDirB TopDirImported)
+add_subdirectory(SubDirC)
+target_link_libraries(SubDirC PRIVATE SubDirC2)
+target_link_libraries(TopDir SubDirC)
add_library(TopDirImported IMPORTED INTERFACE)
target_compile_definitions(TopDirImported INTERFACE DEF_TopDirImported)
cmake_policy(POP)
diff --git a/Tests/CMakeCommands/target_link_libraries/SubDirC/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/SubDirC/CMakeLists.txt
new file mode 100644
index 0000000..54bcc51
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/SubDirC/CMakeLists.txt
@@ -0,0 +1,9 @@
+add_library(SubDirC STATIC SubDirC.c)
+
+add_library(SubDirC1 INTERFACE)
+target_compile_definitions(SubDirC1 INTERFACE DEF_SubDirC1)
+
+add_library(SubDirC2 INTERFACE)
+target_compile_definitions(SubDirC2 INTERFACE DEF_SubDirC2)
+
+target_link_libraries(SubDirC PRIVATE SubDirC1)
diff --git a/Tests/CMakeCommands/target_link_libraries/SubDirC/SubDirC.c b/Tests/CMakeCommands/target_link_libraries/SubDirC/SubDirC.c
new file mode 100644
index 0000000..c5536dc
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/SubDirC/SubDirC.c
@@ -0,0 +1,11 @@
+#ifndef DEF_SubDirC1
+# error "DEF_SubDirC1 not defined"
+#endif
+#ifndef DEF_SubDirC2
+# error "DEF_SubDirC2 not defined"
+#endif
+
+int SubDirC(void)
+{
+ return 0;
+}
diff --git a/Tests/CMakeCommands/target_link_libraries/TopDir.c b/Tests/CMakeCommands/target_link_libraries/TopDir.c
index 4706bb9..d8066e5 100644
--- a/Tests/CMakeCommands/target_link_libraries/TopDir.c
+++ b/Tests/CMakeCommands/target_link_libraries/TopDir.c
@@ -7,6 +7,12 @@
#ifdef DEF_TopDirImported
# error "DEF_TopDirImported is defined but should not be!"
#endif
+#ifdef DEF_SubDirC1
+# error "DEF_SubDirC1 defined but should not be"
+#endif
+#ifdef DEF_SubDirC2
+# error "DEF_SubDirC2 defined but should not be"
+#endif
int main(void)
{
diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt
index 031ab01..e04bba2 100644
--- a/Tests/CMakeLib/CMakeLists.txt
+++ b/Tests/CMakeLib/CMakeLists.txt
@@ -16,9 +16,11 @@ set(CMakeLib_TESTS
testXMLSafe.cxx
testFindPackageCommand.cxx
testUVRAII.cxx
+ testUVStreambuf.cxx
)
set(testRST_ARGS ${CMAKE_CURRENT_SOURCE_DIR})
+set(testUVStreambuf_ARGS $<TARGET_FILE:cmake>)
if(WIN32)
list(APPEND CMakeLib_TESTS
@@ -43,7 +45,7 @@ target_link_libraries(testEncoding cmsys)
foreach(testfile ${CMakeLib_TESTS})
get_filename_component(test "${testfile}" NAME_WE)
- add_test(CMakeLib.${test} CMakeLibTests ${test} ${${test}_ARGS})
+ add_test(NAME CMakeLib.${test} COMMAND CMakeLibTests ${test} ${${test}_ARGS})
endforeach()
if(TEST_CompileCommandOutput)
diff --git a/Tests/CMakeLib/testUVRAII.cxx b/Tests/CMakeLib/testUVRAII.cxx
index 1c1da76..2aeaf2c 100644
--- a/Tests/CMakeLib/testUVRAII.cxx
+++ b/Tests/CMakeLib/testUVRAII.cxx
@@ -171,11 +171,59 @@ static bool testAllMoves()
return true;
};
+static bool testLoopReset()
+{
+ bool closed = false;
+ cm::uv_loop_ptr loop;
+ loop.init();
+
+ uv_timer_t timer;
+ uv_timer_init(loop, &timer);
+ timer.data = &closed;
+ uv_close(reinterpret_cast<uv_handle_t*>(&timer), [](uv_handle_t* handle) {
+ auto closedPtr = static_cast<bool*>(handle->data);
+ *closedPtr = true;
+ });
+
+ loop.reset();
+ if (!closed) {
+ std::cerr << "uv_loop_ptr did not finish" << std::endl;
+ return false;
+ }
+
+ return true;
+};
+
+static bool testLoopDestructor()
+{
+ bool closed = false;
+
+ uv_timer_t timer;
+ {
+ cm::uv_loop_ptr loop;
+ loop.init();
+
+ uv_timer_init(loop, &timer);
+ timer.data = &closed;
+ uv_close(reinterpret_cast<uv_handle_t*>(&timer), [](uv_handle_t* handle) {
+ auto closedPtr = static_cast<bool*>(handle->data);
+ *closedPtr = true;
+ });
+ }
+
+ if (!closed) {
+ std::cerr << "uv_loop_ptr did not finish" << std::endl;
+ return false;
+ }
+
+ return true;
+};
+
int testUVRAII(int, char** const)
{
if ((testAsyncShutdown() &&
testAsyncDtor() & testAsyncMove() & testCrossAssignment() &
- testAllMoves()) == 0) {
+ testAllMoves() & testLoopReset() & testLoopDestructor()) == 0) {
return -1;
}
return 0;
diff --git a/Tests/CMakeLib/testUVStreambuf.cxx b/Tests/CMakeLib/testUVStreambuf.cxx
new file mode 100644
index 0000000..39655f3
--- /dev/null
+++ b/Tests/CMakeLib/testUVStreambuf.cxx
@@ -0,0 +1,457 @@
+#include "cmUVStreambuf.h"
+
+#include "cmGetPipes.h"
+#include "cmUVHandlePtr.h"
+
+#include "cm_uv.h"
+
+#include <iostream>
+#include <string>
+#include <vector>
+
+#include <cstring>
+
+#include <stdint.h>
+
+#define TEST_STR_LINE_1 "This string must be exactly 128 characters long so"
+#define TEST_STR_LINE_2 "that we can test CMake's std::streambuf integration"
+#define TEST_STR_LINE_3 "with libuv's uv_stream_t."
+#define TEST_STR TEST_STR_LINE_1 "\n" TEST_STR_LINE_2 "\n" TEST_STR_LINE_3
+
+bool writeDataToStreamPipe(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe,
+ char* outputData, unsigned int outputDataLength,
+ const char* /* unused */)
+{
+ int err;
+
+ // Create the pipe
+ int pipeHandles[2];
+ if (cmGetPipes(pipeHandles) < 0) {
+ std::cout << "Could not open pipe" << std::endl;
+ return false;
+ }
+
+ cm::uv_pipe_ptr outputPipe;
+ inputPipe.init(loop, 0);
+ outputPipe.init(loop, 0);
+ uv_pipe_open(inputPipe, pipeHandles[0]);
+ uv_pipe_open(outputPipe, pipeHandles[1]);
+
+ // Write data for reading
+ uv_write_t writeReq;
+ struct WriteCallbackData
+ {
+ bool Finished = false;
+ int Status;
+ } writeData;
+ writeReq.data = &writeData;
+ uv_buf_t outputBuf;
+ outputBuf.base = outputData;
+ outputBuf.len = outputDataLength;
+ if ((err = uv_write(&writeReq, outputPipe, &outputBuf, 1,
+ [](uv_write_t* req, int status) {
+ auto data = static_cast<WriteCallbackData*>(req->data);
+ data->Finished = true;
+ data->Status = status;
+ })) < 0) {
+ std::cout << "Could not write to pipe: " << uv_strerror(err) << std::endl;
+ return false;
+ }
+ while (!writeData.Finished) {
+ uv_run(&loop, UV_RUN_ONCE);
+ }
+ if (writeData.Status < 0) {
+ std::cout << "Status is " << uv_strerror(writeData.Status)
+ << ", should be 0" << std::endl;
+ return false;
+ }
+
+ return true;
+}
+
+bool writeDataToStreamProcess(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe,
+ char* outputData, unsigned int /* unused */,
+ const char* cmakeCommand)
+{
+ int err;
+
+ inputPipe.init(loop, 0);
+ std::vector<std::string> arguments = { cmakeCommand, "-E", "echo_append",
+ outputData };
+ std::vector<const char*> processArgs;
+ for (auto const& arg : arguments) {
+ processArgs.push_back(arg.c_str());
+ }
+ processArgs.push_back(nullptr);
+ std::vector<uv_stdio_container_t> stdio(3);
+ stdio[0].flags = UV_IGNORE;
+ stdio[0].data.stream = nullptr;
+ stdio[1].flags =
+ static_cast<uv_stdio_flags>(UV_CREATE_PIPE | UV_WRITABLE_PIPE);
+ stdio[1].data.stream = inputPipe;
+ stdio[2].flags = UV_IGNORE;
+ stdio[2].data.stream = nullptr;
+
+ struct ProcessExitData
+ {
+ bool Finished = false;
+ int64_t ExitStatus;
+ int TermSignal;
+ } exitData;
+ cm::uv_process_ptr process;
+ auto options = uv_process_options_t();
+ options.file = cmakeCommand;
+ options.args = const_cast<char**>(processArgs.data());
+ options.flags = UV_PROCESS_WINDOWS_HIDE;
+ options.stdio = stdio.data();
+ options.stdio_count = static_cast<int>(stdio.size());
+ options.exit_cb = [](uv_process_t* handle, int64_t exitStatus,
+ int termSignal) {
+ auto data = static_cast<ProcessExitData*>(handle->data);
+ data->Finished = true;
+ data->ExitStatus = exitStatus;
+ data->TermSignal = termSignal;
+ };
+ if ((err = process.spawn(loop, options, &exitData)) < 0) {
+ std::cout << "Could not spawn process: " << uv_strerror(err) << std::endl;
+ return false;
+ }
+ while (!exitData.Finished) {
+ uv_run(&loop, UV_RUN_ONCE);
+ }
+ if (exitData.ExitStatus != 0) {
+ std::cout << "Process exit status is " << exitData.ExitStatus
+ << ", should be 0" << std::endl;
+ return false;
+ }
+ if (exitData.TermSignal != 0) {
+ std::cout << "Process term signal is " << exitData.TermSignal
+ << ", should be 0" << std::endl;
+ return false;
+ }
+
+ return true;
+}
+
+bool testUVStreambufRead(
+ bool (*cb)(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe, char* outputData,
+ unsigned int outputDataLength, const char* cmakeCommand),
+ const char* cmakeCommand)
+{
+ char outputData[] = TEST_STR;
+ bool success = false;
+ cm::uv_loop_ptr loop;
+ loop.init();
+ cm::uv_pipe_ptr inputPipe;
+ std::vector<char> inputData(128);
+ std::streamsize readLen;
+ std::string line;
+ cm::uv_timer_ptr timer;
+
+ // Create the streambuf
+ cmUVStreambuf inputBuf(64);
+ std::istream inputStream(&inputBuf);
+ if (inputBuf.is_open()) {
+ std::cout << "is_open() is true, should be false" << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.in_avail()) != -1) {
+ std::cout << "in_avail() returned " << readLen << ", should be -1"
+ << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.sgetn(inputData.data(), 128)) != 0) {
+ std::cout << "sgetn() returned " << readLen << ", should be 0"
+ << std::endl;
+ goto end;
+ }
+
+ // Perform first read test - read all the data
+ if (!cb(*loop, inputPipe, outputData, 128, cmakeCommand)) {
+ goto end;
+ }
+ inputBuf.open(inputPipe);
+ if (!inputBuf.is_open()) {
+ std::cout << "is_open() is false, should be true" << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.in_avail()) != 0) {
+ std::cout << "in_avail() returned " << readLen << ", should be 0"
+ << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.sgetn(inputData.data(), 128)) != 128) {
+ std::cout << "sgetn() returned " << readLen << ", should be 128"
+ << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.in_avail()) != 0) {
+ std::cout << "in_avail() returned " << readLen << ", should be 0"
+ << std::endl;
+ goto end;
+ }
+ if (std::memcmp(inputData.data(), outputData, 128)) {
+ std::cout << "Read data does not match write data" << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.sgetn(inputData.data(), 128)) != 0) {
+ std::cout << "sgetn() returned " << readLen << ", should be 0"
+ << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.in_avail()) != -1) {
+ std::cout << "in_avail() returned " << readLen << ", should be -1"
+ << std::endl;
+ goto end;
+ }
+ inputData.assign(128, char{});
+ inputBuf.close();
+ if (inputBuf.is_open()) {
+ std::cout << "is_open() is true, should be false" << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.sgetn(inputData.data(), 128)) != 0) {
+ std::cout << "sgetn() returned " << readLen << ", should be 0"
+ << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.in_avail()) != -1) {
+ std::cout << "in_avail() returned " << readLen << ", should be -1"
+ << std::endl;
+ goto end;
+ }
+
+ // Perform second read test - read some data and then close
+ if (!cb(*loop, inputPipe, outputData, 128, cmakeCommand)) {
+ goto end;
+ }
+ inputBuf.open(inputPipe);
+ if (!inputBuf.is_open()) {
+ std::cout << "is_open() is false, should be true" << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.in_avail()) != 0) {
+ std::cout << "in_avail() returned " << readLen << ", should be 0"
+ << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.sgetn(inputData.data(), 64)) != 64) {
+ std::cout << "sgetn() returned " << readLen << ", should be 64"
+ << std::endl;
+ goto end;
+ }
+ if (std::memcmp(inputData.data(), outputData, 64)) {
+ std::cout << "Read data does not match write data" << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.in_avail()) != 8) {
+ std::cout << "in_avail() returned " << readLen << ", should be 8"
+ << std::endl;
+ goto end;
+ }
+ inputData.assign(128, char{});
+ inputBuf.close();
+ if (inputBuf.is_open()) {
+ std::cout << "is_open() is true, should be false" << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.in_avail()) != -1) {
+ std::cout << "in_avail() returned " << readLen << ", should be -1"
+ << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.sgetn(inputData.data(), 128)) != 0) {
+ std::cout << "sgetn() returned " << readLen << ", should be 0"
+ << std::endl;
+ goto end;
+ }
+
+ // Perform third read test - read line by line
+ if (!cb(*loop, inputPipe, outputData, 128, cmakeCommand)) {
+ goto end;
+ }
+ inputBuf.open(inputPipe);
+ if (!inputBuf.is_open()) {
+ std::cout << "is_open() is false, should be true" << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.in_avail()) != 0) {
+ std::cout << "in_avail() returned " << readLen << ", should be 0"
+ << std::endl;
+ goto end;
+ }
+
+ if (!std::getline(inputStream, line)) {
+ std::cout << "getline returned false, should be true" << std::endl;
+ goto end;
+ }
+ if (line != TEST_STR_LINE_1) {
+ std::cout << "Line 1 is \"" << line
+ << "\", should be \"" TEST_STR_LINE_1 "\"" << std::endl;
+ goto end;
+ }
+
+ if (!std::getline(inputStream, line)) {
+ std::cout << "getline returned false, should be true" << std::endl;
+ goto end;
+ }
+ if (line != TEST_STR_LINE_2) {
+ std::cout << "Line 2 is \"" << line
+ << "\", should be \"" TEST_STR_LINE_2 "\"" << std::endl;
+ goto end;
+ }
+
+ if (!std::getline(inputStream, line)) {
+ std::cout << "getline returned false, should be true" << std::endl;
+ goto end;
+ }
+ if (line != TEST_STR_LINE_3) {
+ std::cout << "Line 3 is \"" << line
+ << "\", should be \"" TEST_STR_LINE_3 "\"" << std::endl;
+ goto end;
+ }
+
+ if (std::getline(inputStream, line)) {
+ std::cout << "getline returned true, should be false" << std::endl;
+ goto end;
+ }
+
+ inputBuf.close();
+ if (inputBuf.is_open()) {
+ std::cout << "is_open() is true, should be false" << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.in_avail()) != -1) {
+ std::cout << "in_avail() returned " << readLen << ", should be -1"
+ << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.sgetn(inputData.data(), 128)) != 0) {
+ std::cout << "sgetn() returned " << readLen << ", should be 0"
+ << std::endl;
+ goto end;
+ }
+
+ // Perform fourth read test - run the event loop outside of underflow()
+ if (!cb(*loop, inputPipe, outputData, 128, cmakeCommand)) {
+ goto end;
+ }
+ inputBuf.open(inputPipe);
+ if (!inputBuf.is_open()) {
+ std::cout << "is_open() is false, should be true" << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.in_avail()) != 0) {
+ std::cout << "in_avail() returned " << readLen << ", should be 0"
+ << std::endl;
+ goto end;
+ }
+ uv_run(loop, UV_RUN_DEFAULT);
+ if ((readLen = inputBuf.in_avail()) != 72) {
+ std::cout << "in_avail() returned " << readLen << ", should be 72"
+ << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.sgetn(inputData.data(), 128)) != 128) {
+ std::cout << "sgetn() returned " << readLen << ", should be 128"
+ << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.in_avail()) != 0) {
+ std::cout << "in_avail() returned " << readLen << ", should be 0"
+ << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.sgetn(inputData.data(), 128)) != 0) {
+ std::cout << "sgetn() returned " << readLen << ", should be 128"
+ << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.in_avail()) != -1) {
+ std::cout << "in_avail() returned " << readLen << ", should be -1"
+ << std::endl;
+ goto end;
+ }
+
+ inputBuf.close();
+ if (inputBuf.is_open()) {
+ std::cout << "is_open() is true, should be false" << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.in_avail()) != -1) {
+ std::cout << "in_avail() returned " << readLen << ", should be -1"
+ << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.sgetn(inputData.data(), 128)) != 0) {
+ std::cout << "sgetn() returned " << readLen << ", should be 0"
+ << std::endl;
+ goto end;
+ }
+
+ // Perform fifth read test - close the streambuf in the middle of a read
+ timer.init(*loop, &inputBuf);
+ if (!cb(*loop, inputPipe, outputData, 128, cmakeCommand)) {
+ goto end;
+ }
+ inputBuf.open(inputPipe);
+ if (!inputBuf.is_open()) {
+ std::cout << "is_open() is false, should be true" << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.in_avail()) != 0) {
+ std::cout << "in_avail() returned " << readLen << ", should be 0"
+ << std::endl;
+ goto end;
+ }
+ uv_timer_start(timer,
+ [](uv_timer_t* handle) {
+ auto buf = static_cast<cmUVStreambuf*>(handle->data);
+ buf->close();
+ },
+ 0, 0);
+ if ((readLen = inputBuf.sgetn(inputData.data(), 128)) != 0) {
+ std::cout << "sgetn() returned " << readLen << ", should be 0"
+ << std::endl;
+ goto end;
+ }
+ if (inputBuf.is_open()) {
+ std::cout << "is_open() is true, should be false" << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.in_avail()) != -1) {
+ std::cout << "in_avail() returned " << readLen << ", should be -1"
+ << std::endl;
+ goto end;
+ }
+ if ((readLen = inputBuf.sgetn(inputData.data(), 128)) != 0) {
+ std::cout << "sgetn() returned " << readLen << ", should be 0"
+ << std::endl;
+ goto end;
+ }
+
+ success = true;
+
+end:
+ return success;
+}
+
+int testUVStreambuf(int argc, char** const argv)
+{
+ if (argc < 2) {
+ std::cout << "Invalid arguments.\n";
+ return -1;
+ }
+
+ if (!testUVStreambufRead(writeDataToStreamPipe, argv[1])) {
+ std::cout << "While executing testUVStreambufRead() with pipe.\n";
+ return -1;
+ }
+
+ if (!testUVStreambufRead(writeDataToStreamProcess, argv[1])) {
+ std::cout << "While executing testUVStreambufRead() with process.\n";
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index df0c78d..5ba0dc0 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -374,4 +374,49 @@ if(NOT CMAKE_GENERATOR STREQUAL Xcode OR NOT CMAKE_OSX_ARCHITECTURES MATCHES "[;
-P "${CMAKE_CURRENT_SOURCE_DIR}/check_object_files.cmake"
DEPENDS objlib
)
+
+
+ add_library(sharedlib SHARED objlib1.c objlib2.c)
+ file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/sharedlib_files_$<CONFIGURATION>"
+ CONTENT "$<JOIN:$<TARGET_OBJECTS:sharedlib>,\n>\n"
+ )
+
+ add_custom_target(check_sharedlib_objs ALL
+ COMMAND ${CMAKE_COMMAND}
+ "-DOBJLIB_LISTFILE=${CMAKE_CURRENT_BINARY_DIR}/sharedlib_files_$<CONFIGURATION>"
+ -DEXPECTED_NUM_OBJECTFILES=2
+ -P "${CMAKE_CURRENT_SOURCE_DIR}/check_object_files.cmake"
+ DEPENDS sharedlib
+ )
+
+
+ add_library(staticlib STATIC objlib1.c objlib2.c)
+ file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/staticlib_files_$<CONFIGURATION>"
+ CONTENT "$<JOIN:$<TARGET_OBJECTS:staticlib>,\n>\n"
+ )
+
+ add_custom_target(check_staticlib_objs ALL
+ COMMAND ${CMAKE_COMMAND}
+ "-DOBJLIB_LISTFILE=${CMAKE_CURRENT_BINARY_DIR}/staticlib_files_$<CONFIGURATION>"
+ -DEXPECTED_NUM_OBJECTFILES=2
+ -P "${CMAKE_CURRENT_SOURCE_DIR}/check_object_files.cmake"
+ DEPENDS staticlib
+ )
+
+
+ add_executable(execobjs objlib1.c objlib2.c echo.c)
+ file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/execobjs_files_$<CONFIGURATION>"
+ CONTENT "$<JOIN:$<TARGET_OBJECTS:execobjs>,\n>\n"
+ )
+
+ add_custom_target(check_exec_objs ALL
+ COMMAND ${CMAKE_COMMAND}
+ "-DOBJLIB_LISTFILE=${CMAKE_CURRENT_BINARY_DIR}/execobjs_files_$<CONFIGURATION>"
+ -DEXPECTED_NUM_OBJECTFILES=3
+ -P "${CMAKE_CURRENT_SOURCE_DIR}/check_object_files.cmake"
+ DEPENDS execobjs
+ )
endif()
diff --git a/Tests/MSVCRuntimeLibrary/CMakeLists.txt b/Tests/MSVCRuntimeLibrary/CMakeLists.txt
index b7a6e86..6994d8d 100644
--- a/Tests/MSVCRuntimeLibrary/CMakeLists.txt
+++ b/Tests/MSVCRuntimeLibrary/CMakeLists.txt
@@ -42,7 +42,22 @@ endfunction()
function(verify lang src)
add_library(default-${lang} ${src})
target_compile_definitions(default-${lang} PRIVATE VERIFY_MT VERIFY_DLL "$<$<CONFIG:Debug>:VERIFY_DEBUG>")
+
verify_combinations(MultiThreaded ${lang} ${src})
+
+ # Test known MSVC default behavior when no flag is given.
+ if(CMAKE_${lang}_COMPILER_ID STREQUAL "MSVC")
+ set(CMAKE_MSVC_RUNTIME_LIBRARY "")
+ add_library(empty-${lang} ${src})
+ if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 14)
+ # VS 2005 and above default to multi-threaded.
+ target_compile_definitions(empty-${lang} PRIVATE VERIFY_MT)
+ endif()
+ if(CMAKE_GENERATOR MATCHES "Visual Studio ([^9]|9[0-9])")
+ # VS 2010 and above have a different default runtime library for projects than 'cl'.
+ target_compile_definitions(empty-${lang} PRIVATE VERIFY_DLL)
+ endif()
+ endif()
endfunction()
verify(C verify.c)
diff --git a/Tests/ObjectLibrary/CMakeLists.txt b/Tests/ObjectLibrary/CMakeLists.txt
index 4bffd12..7897ab9 100644
--- a/Tests/ObjectLibrary/CMakeLists.txt
+++ b/Tests/ObjectLibrary/CMakeLists.txt
@@ -62,4 +62,14 @@ add_custom_target(UseABinternalDep COMMAND ${CMAKE_COMMAND} -E touch UseABintern
add_custom_command(TARGET UseABinternal POST_BUILD COMMAND ${CMAKE_COMMAND} -P UseABinternalDep.cmake)
add_dependencies(UseABinternal UseABinternalDep)
+# Test a static library with sources from a different static library
+add_library(UseCstaticObjs STATIC $<TARGET_OBJECTS:Cstatic> $<TARGET_OBJECTS:A> $<TARGET_OBJECTS:Bexport>)
+
+# Test a shared library with sources from a different shared library
+add_library(UseCsharedObjs SHARED $<TARGET_OBJECTS:Cshared> $<TARGET_OBJECTS:A> $<TARGET_OBJECTS:Bexport>)
+
+# Test a shared executable with sources from a different shared library
+add_executable(UseABstaticObjs $<TARGET_OBJECTS:UseABstatic>)
+target_link_libraries(UseABstaticObjs ABstatic)
+
add_subdirectory(ExportLanguages)
diff --git a/Tests/RunCMake/File_Generate/OutputNameMatchesObjects-stderr.txt b/Tests/RunCMake/File_Generate/OutputNameMatchesObjects-stderr.txt
index b08ef5a..4c2e35f 100644
--- a/Tests/RunCMake/File_Generate/OutputNameMatchesObjects-stderr.txt
+++ b/Tests/RunCMake/File_Generate/OutputNameMatchesObjects-stderr.txt
@@ -3,6 +3,7 @@ CMake Error at OutputNameMatchesObjects.cmake:[0-9]+ \(file\):
\$<TARGET_OBJECTS:foo>
- Objects of target "foo" referenced but is not an OBJECT library.
+ Objects of target "foo" referenced but is not an allowed library types
+ \(EXECUTABLE, STATIC, SHARED, MODULE, OBJECT\).
Call Stack \(most recent call first\):
CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/File_Generate/OutputNameMatchesObjects.cmake b/Tests/RunCMake/File_Generate/OutputNameMatchesObjects.cmake
index daa7c49..84825fe 100644
--- a/Tests/RunCMake/File_Generate/OutputNameMatchesObjects.cmake
+++ b/Tests/RunCMake/File_Generate/OutputNameMatchesObjects.cmake
@@ -1,11 +1,8 @@
enable_language(CXX)
file(GENERATE
- OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/$<BOOL:$<TARGET_OBJECTS:foo>>somefile.cpp"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/$<LOWER_CASE:$<CONFIG>/somefile.cpp"
CONTENT "static const char content[] = \"$<TARGET_OBJECTS:foo>\";\n"
)
-add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/input.txt"
- COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/input.txt" "${CMAKE_CURRENT_BINARY_DIR}")
-
-add_executable(foo empty.cpp "${CMAKE_CURRENT_BINARY_DIR}/1somefile.cpp" "${CMAKE_CURRENT_BINARY_DIR}/input.txt")
+add_library(foo INTERFACE )
diff --git a/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt b/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt
index 838b3d8..4dbd861 100644
--- a/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt
+++ b/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt
@@ -3,6 +3,7 @@ CMake Error at BadSourceExpression3.cmake:2 \(add_library\):
\$<TARGET_OBJECTS:NotObjLib>
- Objects of target "NotObjLib" referenced but is not an OBJECT library.
+ Objects of target "NotObjLib" referenced but is not an allowed library
+ types \(EXECUTABLE, STATIC, SHARED, MODULE, OBJECT\).
Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/ObjectLibrary/BadSourceExpression3.cmake b/Tests/RunCMake/ObjectLibrary/BadSourceExpression3.cmake
index c3d9a62..4e07ea6 100644
--- a/Tests/RunCMake/ObjectLibrary/BadSourceExpression3.cmake
+++ b/Tests/RunCMake/ObjectLibrary/BadSourceExpression3.cmake
@@ -1,2 +1,2 @@
-add_library(NotObjLib STATIC a.c)
+add_library(NotObjLib INTERFACE)
add_library(A STATIC a.c $<TARGET_OBJECTS:NotObjLib>)
diff --git a/Tests/RunCMake/ObjectLibrary/CheckTargetObjects.cmake b/Tests/RunCMake/ObjectLibrary/CheckTargetObjects.cmake
new file mode 100644
index 0000000..0c85c72
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/CheckTargetObjects.cmake
@@ -0,0 +1,32 @@
+add_library(StaticLib STATIC a.c)
+
+add_custom_command(TARGET StaticLib POST_BUILD
+ VERBATIM
+ COMMAND ${CMAKE_COMMAND}
+ "-DTARGET_OBJECTS=$<TARGET_OBJECTS:StaticLib>"
+ -DEXPECTED_NUM_OBJECTFILES=2
+ -P "${CMAKE_CURRENT_SOURCE_DIR}/check_object_files.cmake"
+ )
+
+add_library(SharedLib SHARED a.c b.c)
+target_compile_definitions(SharedLib PRIVATE REQUIRED)
+
+add_custom_command(TARGET SharedLib POST_BUILD
+ VERBATIM
+ COMMAND ${CMAKE_COMMAND}
+ "-DTARGET_OBJECTS:STRING=$<TARGET_OBJECTS:SharedLib>"
+ -DEXPECTED_NUM_OBJECTFILES=2
+ -P "${CMAKE_CURRENT_SOURCE_DIR}/check_object_files.cmake"
+ )
+
+add_executable(ExecObjs a.c b.c exe.c)
+target_compile_definitions(ExecObjs PRIVATE REQUIRED)
+
+add_custom_target(check_exec_objs ALL
+ VERBATIM
+ COMMAND ${CMAKE_COMMAND}
+ "-DTARGET_OBJECTS=$<TARGET_OBJECTS:ExecObjs>"
+ -DEXPECTED_NUM_OBJECTFILES=3
+ -P "${CMAKE_CURRENT_SOURCE_DIR}/check_object_files.cmake"
+ DEPENDS ExecObjs
+ )
diff --git a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
index 6ca33b8..5ec4018 100644
--- a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
@@ -37,6 +37,10 @@ function (run_object_lib_build2 name)
run_cmake_command(${name}-build ${CMAKE_COMMAND} --build .)
endfunction ()
+if(NOT (RunCMake_GENERATOR STREQUAL "Xcode" AND "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]"))
+ run_object_lib_build(CheckTargetObjects)
+endif()
+
run_object_lib_build(LinkObjLHSShared)
run_object_lib_build(LinkObjLHSStatic)
run_object_lib_build(LinkObjRHSShared)
@@ -54,6 +58,7 @@ run_cmake(PostBuild)
run_cmake(PreBuild)
run_cmake(PreLink)
+
function(run_Dependencies)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Dependencies-build)
set(RunCMake_TEST_NO_CLEAN 1)
diff --git a/Tests/RunCMake/ObjectLibrary/check_object_files.cmake b/Tests/RunCMake/ObjectLibrary/check_object_files.cmake
new file mode 100644
index 0000000..3c34229
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/check_object_files.cmake
@@ -0,0 +1,17 @@
+
+if (NOT TARGET_OBJECTS)
+ message(SEND_ERROR "Object not passed as -DTARGET_OBJECTS")
+endif()
+
+foreach(objlib_file IN LISTS objects)
+ message(STATUS "objlib_file: =${objlib_file}=")
+
+ set(file_exists False)
+ if (EXISTS "${objlib_file}")
+ set(file_exists True)
+ endif()
+
+ if (NOT file_exists)
+ message(SEND_ERROR "File \"${objlib_file}\" does not exist!${tried}")
+ endif()
+endforeach()
diff --git a/Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt b/Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt
index a66794c..77c4afd 100644
--- a/Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt
+++ b/Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt
@@ -1,8 +1,9 @@
-CMake Error at NotObjlibTarget.cmake:3 \(file\):
+CMake Error at NotObjlibTarget.cmake:[0-9]+ \(file\):
Error evaluating generator expression:
- \$<TARGET_OBJECTS:StaticLib>
+ \$<TARGET_OBJECTS:IFaceLib>
- Objects of target "StaticLib" referenced but is not an OBJECT library.
+ Objects of target "IFaceLib" referenced but is not an allowed library types
+ \(EXECUTABLE, STATIC, SHARED, MODULE, OBJECT\).
Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake b/Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake
index 3bb3e37..9fec369 100644
--- a/Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake
+++ b/Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake
@@ -1,3 +1,3 @@
-add_library(StaticLib empty.cpp)
+add_library(IFaceLib INTERFACE )
-file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_output CONTENT $<TARGET_OBJECTS:StaticLib>)
+file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_output CONTENT $<TARGET_OBJECTS:IFaceLib>)
diff --git a/Tests/RunCMake/VS10Project/RuntimeLibrary-check.cmake b/Tests/RunCMake/VS10Project/RuntimeLibrary-check.cmake
index 6b43d47..689b35f 100644
--- a/Tests/RunCMake/VS10Project/RuntimeLibrary-check.cmake
+++ b/Tests/RunCMake/VS10Project/RuntimeLibrary-check.cmake
@@ -20,7 +20,7 @@ macro(RuntimeLibrary_check tgt rtl_expect)
endif()
endforeach()
- if(NOT HAVE_Runtimelibrary)
+ if(NOT HAVE_Runtimelibrary AND NOT "${rtl_expect}" STREQUAL "")
set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a RuntimeLibrary field.")
return()
endif()
@@ -28,6 +28,8 @@ endmacro()
RuntimeLibrary_check(default-C MultiThreadedDebugDLL)
RuntimeLibrary_check(default-CXX MultiThreadedDebugDLL)
+RuntimeLibrary_check(empty-C "")
+RuntimeLibrary_check(empty-CXX "")
RuntimeLibrary_check(MTd-C MultiThreadedDebug)
RuntimeLibrary_check(MTd-CXX MultiThreadedDebug)
RuntimeLibrary_check(MT-C MultiThreaded)
diff --git a/Tests/RunCMake/VS10Project/RuntimeLibrary.cmake b/Tests/RunCMake/VS10Project/RuntimeLibrary.cmake
index 6c77a25..d7787c8 100644
--- a/Tests/RunCMake/VS10Project/RuntimeLibrary.cmake
+++ b/Tests/RunCMake/VS10Project/RuntimeLibrary.cmake
@@ -6,6 +6,10 @@ enable_language(CXX)
add_library(default-C empty.c)
add_library(default-CXX empty.cxx)
+set(CMAKE_MSVC_RUNTIME_LIBRARY "")
+add_library(empty-C empty.c)
+add_library(empty-CXX empty.cxx)
+
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDebug")
add_library(MTd-C empty.c)
add_library(MTd-CXX empty.cxx)
diff --git a/Tests/RunCMake/execute_process/EchoCommand-result.txt b/Tests/RunCMake/execute_process/EchoCommand-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/execute_process/EchoCommand-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/execute_process/EchoCommand-stderr.txt b/Tests/RunCMake/execute_process/EchoCommand-stderr.txt
new file mode 100644
index 0000000..f10ece8
--- /dev/null
+++ b/Tests/RunCMake/execute_process/EchoCommand-stderr.txt
@@ -0,0 +1,5 @@
+.*cmake.*-E' 'echo' '-- 2 COMMAND_ECHO STDERR'
+.*cmake.*-E' 'echo' '-- 4 COMMAND_ECHO STDERR'
+.*cmake.*-E' 'echo' '-- 8 COMMAND_ECHO STDOUT COMMAND_ECHO STDERR'
+CMake Error at .*EchoCommand.cmake:.* \(execute_process\):
+ CMAKE_EXECUTE_PROCESS_COMMAND_ECHO set to 'BAD' expected STDERR|STDOUT|NONE$
diff --git a/Tests/RunCMake/execute_process/EchoCommand-stdout.txt b/Tests/RunCMake/execute_process/EchoCommand-stdout.txt
new file mode 100644
index 0000000..0954b3b
--- /dev/null
+++ b/Tests/RunCMake/execute_process/EchoCommand-stdout.txt
@@ -0,0 +1,12 @@
+.*cmake.*-E' 'echo' '-- 1 COMMAND_ECHO STDOUT'
+-- 1 COMMAND_ECHO STDOUT
+-- 2 COMMAND_ECHO STDERR
+.*cmake.* '-E' 'echo' '-- 3 COMMAND_ECHO STDOUT'
+-- 3 COMMAND_ECHO STDOUT
+-- 4 COMMAND_ECHO STDERR
+.*cmake.* '-E' 'echo' '-- 5 COMMAND_ECHO STDOUT'
+-- 5 COMMAND_ECHO STDOUT
+-- 6 COMMAND_ECHO NONE
+.*cmake.* '-E' 'echo' '-- 7 COMMAND_ECHO STDERR COMMAND_ECHO STDOUT'
+-- 7 COMMAND_ECHO STDERR COMMAND_ECHO STDOUT
+-- 8 COMMAND_ECHO STDOUT COMMAND_ECHO STDERR$
diff --git a/Tests/RunCMake/execute_process/EchoCommand.cmake b/Tests/RunCMake/execute_process/EchoCommand.cmake
new file mode 100644
index 0000000..9c7d13d
--- /dev/null
+++ b/Tests/RunCMake/execute_process/EchoCommand.cmake
@@ -0,0 +1,41 @@
+if(CHECK_ERROR_OUTPUT_LOCATION)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E echo
+ "-- 1 COMMAND_ECHO " COMMAND_ECHO )
+endif()
+# test COMMAND_ECHO STDOUT
+execute_process(COMMAND ${CMAKE_COMMAND} -E echo
+ "-- 1 COMMAND_ECHO STDOUT" COMMAND_ECHO STDOUT )
+# test COMMAND_ECHO STDERR
+execute_process(COMMAND ${CMAKE_COMMAND} -E echo
+ "-- 2 COMMAND_ECHO STDERR" COMMAND_ECHO STDERR )
+# test CMAKE_EXECUTE_PROCESS_COMMAND_ECHO STDOUT
+set(CMAKE_EXECUTE_PROCESS_COMMAND_ECHO STDOUT)
+execute_process(COMMAND ${CMAKE_COMMAND} -E echo
+ "-- 3 COMMAND_ECHO STDOUT" )
+# test CMAKE_EXECUTE_PROCESS_COMMAND_ECHO STDERR
+set(CMAKE_EXECUTE_PROCESS_COMMAND_ECHO STDERR)
+execute_process(COMMAND ${CMAKE_COMMAND} -E echo
+ "-- 4 COMMAND_ECHO STDERR" )
+# make sure local will override global settings
+execute_process(COMMAND ${CMAKE_COMMAND} -E echo
+ "-- 5 COMMAND_ECHO STDOUT" COMMAND_ECHO STDOUT )
+execute_process(COMMAND ${CMAKE_COMMAND} -E echo
+ "-- 6 COMMAND_ECHO NONE" COMMAND_ECHO NONE)
+# test both and make sure override works
+execute_process(COMMAND ${CMAKE_COMMAND} -E echo
+ "-- 7 COMMAND_ECHO STDERR COMMAND_ECHO STDOUT" COMMAND_ECHO STDERR
+ COMMAND_ECHO STDOUT)
+execute_process(COMMAND ${CMAKE_COMMAND} -E echo
+ "-- 8 COMMAND_ECHO STDOUT COMMAND_ECHO STDERR" COMMAND_ECHO STDOUT
+ COMMAND_ECHO STDERR)
+
+# check for bad arguments to global and local
+if(CHECK_GLOBAL)
+ # make sure a non STDERR or STDOUT value is an error
+ set(CMAKE_EXECUTE_PROCESS_COMMAND_ECHO BAD)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E echo
+ "-- 9 - 1 CMAKE_EXECUTE_PROCESS_COMMAND_ECHO BAD" )
+else()
+ execute_process(COMMAND ${CMAKE_COMMAND} -E echo
+ "-- 9 - 2 COMMAND_ECHO BAD" COMMAND_ECHO BAD)
+endif()
diff --git a/Tests/RunCMake/execute_process/EchoCommand2-result.txt b/Tests/RunCMake/execute_process/EchoCommand2-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/execute_process/EchoCommand2-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/execute_process/EchoCommand2-stderr.txt b/Tests/RunCMake/execute_process/EchoCommand2-stderr.txt
new file mode 100644
index 0000000..4ae01c4
--- /dev/null
+++ b/Tests/RunCMake/execute_process/EchoCommand2-stderr.txt
@@ -0,0 +1,5 @@
+.*cmake.*-E' 'echo' '-- 2 COMMAND_ECHO STDERR'
+.*cmake.*-E' 'echo' '-- 4 COMMAND_ECHO STDERR'
+.*cmake.*-E' 'echo' '-- 8 COMMAND_ECHO STDOUT COMMAND_ECHO STDERR'
+CMake Error at .*EchoCommand.cmake:.* \(execute_process\):
+ called with 'BAD' expected STDERR|STDOUT|NONE for COMMAND_ECHO.$
diff --git a/Tests/RunCMake/execute_process/EchoCommand2-stdout.txt b/Tests/RunCMake/execute_process/EchoCommand2-stdout.txt
new file mode 100644
index 0000000..0954b3b
--- /dev/null
+++ b/Tests/RunCMake/execute_process/EchoCommand2-stdout.txt
@@ -0,0 +1,12 @@
+.*cmake.*-E' 'echo' '-- 1 COMMAND_ECHO STDOUT'
+-- 1 COMMAND_ECHO STDOUT
+-- 2 COMMAND_ECHO STDERR
+.*cmake.* '-E' 'echo' '-- 3 COMMAND_ECHO STDOUT'
+-- 3 COMMAND_ECHO STDOUT
+-- 4 COMMAND_ECHO STDERR
+.*cmake.* '-E' 'echo' '-- 5 COMMAND_ECHO STDOUT'
+-- 5 COMMAND_ECHO STDOUT
+-- 6 COMMAND_ECHO NONE
+.*cmake.* '-E' 'echo' '-- 7 COMMAND_ECHO STDERR COMMAND_ECHO STDOUT'
+-- 7 COMMAND_ECHO STDERR COMMAND_ECHO STDOUT
+-- 8 COMMAND_ECHO STDOUT COMMAND_ECHO STDERR$
diff --git a/Tests/RunCMake/execute_process/EchoCommand3-result.txt b/Tests/RunCMake/execute_process/EchoCommand3-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/execute_process/EchoCommand3-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/execute_process/EchoCommand3-stderr.txt b/Tests/RunCMake/execute_process/EchoCommand3-stderr.txt
new file mode 100644
index 0000000..e27f1e6
--- /dev/null
+++ b/Tests/RunCMake/execute_process/EchoCommand3-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at .*EchoCommand.cmake:.*\(execute_process\):
+ execute_process called with no value for COMMAND_ECHO.
diff --git a/Tests/RunCMake/execute_process/RunCMakeTest.cmake b/Tests/RunCMake/execute_process/RunCMakeTest.cmake
index cb40b40..b203aab 100644
--- a/Tests/RunCMake/execute_process/RunCMakeTest.cmake
+++ b/Tests/RunCMake/execute_process/RunCMakeTest.cmake
@@ -16,3 +16,11 @@ endif()
if(EXIT_CODE_EXE)
run_cmake_command(ExitValues ${CMAKE_COMMAND} -DEXIT_CODE_EXE=${EXIT_CODE_EXE} -P ${RunCMake_SOURCE_DIR}/ExitValues.cmake)
endif()
+
+run_cmake_command(EchoCommand ${CMAKE_COMMAND} -DCHECK_GLOBAL=TRUE
+ -P ${RunCMake_SOURCE_DIR}/EchoCommand.cmake)
+run_cmake_command(EchoCommand2 ${CMAKE_COMMAND} -P
+ ${RunCMake_SOURCE_DIR}/EchoCommand.cmake)
+run_cmake_command(EchoCommand3 ${CMAKE_COMMAND}
+ -DCHECK_ERROR_OUTPUT_LOCATION=TRUE -P
+ ${RunCMake_SOURCE_DIR}/EchoCommand.cmake)
diff --git a/Tests/RunCMake/message/RunCMakeTest.cmake b/Tests/RunCMake/message/RunCMakeTest.cmake
index 24dad03..cecfc7f 100644
--- a/Tests/RunCMake/message/RunCMakeTest.cmake
+++ b/Tests/RunCMake/message/RunCMakeTest.cmake
@@ -10,3 +10,45 @@ run_cmake(warnmessage)
# separately
run_cmake(errormessage_deprecated)
run_cmake(errormessage_dev)
+
+run_cmake_command(
+ message-loglevel-invalid
+ ${CMAKE_COMMAND} --loglevel=blah -P ${RunCMake_SOURCE_DIR}/message-all-loglevels.cmake
+ )
+
+# Checking various combinations of `message(...)` and log levels `WARNING` to `TRACE`
+# - no CLI option -> `WARNING` to `STATUS` output
+run_cmake_command(
+ message-loglevel-default
+ ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/message-all-loglevels.cmake
+ )
+# - Only `WARNING` output
+run_cmake_command(
+ message-loglevel-warning
+ ${CMAKE_COMMAND} --loglevel=warning -P ${RunCMake_SOURCE_DIR}/message-all-loglevels.cmake
+ )
+# - Only `WARNING` and `NOTICE` output
+run_cmake_command(
+ message-loglevel-notice
+ ${CMAKE_COMMAND} --loglevel=notice -P ${RunCMake_SOURCE_DIR}/message-all-loglevels.cmake
+ )
+# - `WARNING` to `STATUS` output
+run_cmake_command(
+ message-loglevel-status
+ ${CMAKE_COMMAND} --loglevel=status -P ${RunCMake_SOURCE_DIR}/message-all-loglevels.cmake
+ )
+# - `WARNING` to `VERBOSE` output
+run_cmake_command(
+ message-loglevel-verbose
+ ${CMAKE_COMMAND} --loglevel=verbose -P ${RunCMake_SOURCE_DIR}/message-all-loglevels.cmake
+ )
+# - `WARNING` to `DEBUG` output
+run_cmake_command(
+ message-loglevel-debug
+ ${CMAKE_COMMAND} --loglevel=debug -P ${RunCMake_SOURCE_DIR}/message-all-loglevels.cmake
+ )
+# - `WARNING` to `TRACE` output
+run_cmake_command(
+ message-loglevel-trace
+ ${CMAKE_COMMAND} --loglevel=trace -P ${RunCMake_SOURCE_DIR}/message-all-loglevels.cmake
+ )
diff --git a/Tests/RunCMake/message/message-all-loglevels.cmake b/Tests/RunCMake/message/message-all-loglevels.cmake
new file mode 100644
index 0000000..f8d8841
--- /dev/null
+++ b/Tests/RunCMake/message/message-all-loglevels.cmake
@@ -0,0 +1,10 @@
+# Produce a message for everything except FATAL_ERROR and SEND_ERROR
+message(DEPRECATION "Deprecation warning")
+message(AUTHOR_WARNING "Author warning message")
+message(WARNING "Warning message")
+message("Default NOTICE message")
+message(NOTICE "NOTICE message")
+message(STATUS "STATUS message")
+message(VERBOSE "VERBOSE message")
+message(DEBUG "DEBUG message")
+message(TRACE "TRACE message")
diff --git a/Tests/RunCMake/message/message-loglevel-debug-stderr.txt b/Tests/RunCMake/message/message-loglevel-debug-stderr.txt
new file mode 100644
index 0000000..efec736
--- /dev/null
+++ b/Tests/RunCMake/message/message-loglevel-debug-stderr.txt
@@ -0,0 +1,12 @@
+^CMake Deprecation Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:2 \(message\):
+ Deprecation warning
++
+CMake Warning \(dev\) at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:3 \(message\):
+ Author warning message
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+CMake Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:4 \(message\):
+ Warning message
++
+Default NOTICE message
+NOTICE message$
diff --git a/Tests/RunCMake/message/message-loglevel-debug-stdout.txt b/Tests/RunCMake/message/message-loglevel-debug-stdout.txt
new file mode 100644
index 0000000..1452137
--- /dev/null
+++ b/Tests/RunCMake/message/message-loglevel-debug-stdout.txt
@@ -0,0 +1,3 @@
+-- STATUS message
+-- VERBOSE message
+-- DEBUG message
diff --git a/Tests/RunCMake/message/message-loglevel-default-stderr.txt b/Tests/RunCMake/message/message-loglevel-default-stderr.txt
new file mode 100644
index 0000000..efec736
--- /dev/null
+++ b/Tests/RunCMake/message/message-loglevel-default-stderr.txt
@@ -0,0 +1,12 @@
+^CMake Deprecation Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:2 \(message\):
+ Deprecation warning
++
+CMake Warning \(dev\) at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:3 \(message\):
+ Author warning message
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+CMake Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:4 \(message\):
+ Warning message
++
+Default NOTICE message
+NOTICE message$
diff --git a/Tests/RunCMake/message/message-loglevel-default-stdout.txt b/Tests/RunCMake/message/message-loglevel-default-stdout.txt
new file mode 100644
index 0000000..809f4cc
--- /dev/null
+++ b/Tests/RunCMake/message/message-loglevel-default-stdout.txt
@@ -0,0 +1 @@
+-- STATUS message
diff --git a/Tests/RunCMake/message/message-loglevel-invalid-result.txt b/Tests/RunCMake/message/message-loglevel-invalid-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/message/message-loglevel-invalid-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/message/message-loglevel-invalid-stderr.txt b/Tests/RunCMake/message/message-loglevel-invalid-stderr.txt
new file mode 100644
index 0000000..f54d0f8
--- /dev/null
+++ b/Tests/RunCMake/message/message-loglevel-invalid-stderr.txt
@@ -0,0 +1 @@
+CMake Error: Invalid level specified for --loglevel
diff --git a/Tests/RunCMake/message/message-loglevel-notice-stderr.txt b/Tests/RunCMake/message/message-loglevel-notice-stderr.txt
new file mode 100644
index 0000000..efec736
--- /dev/null
+++ b/Tests/RunCMake/message/message-loglevel-notice-stderr.txt
@@ -0,0 +1,12 @@
+^CMake Deprecation Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:2 \(message\):
+ Deprecation warning
++
+CMake Warning \(dev\) at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:3 \(message\):
+ Author warning message
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+CMake Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:4 \(message\):
+ Warning message
++
+Default NOTICE message
+NOTICE message$
diff --git a/Tests/RunCMake/message/message-loglevel-status-stderr.txt b/Tests/RunCMake/message/message-loglevel-status-stderr.txt
new file mode 100644
index 0000000..efec736
--- /dev/null
+++ b/Tests/RunCMake/message/message-loglevel-status-stderr.txt
@@ -0,0 +1,12 @@
+^CMake Deprecation Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:2 \(message\):
+ Deprecation warning
++
+CMake Warning \(dev\) at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:3 \(message\):
+ Author warning message
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+CMake Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:4 \(message\):
+ Warning message
++
+Default NOTICE message
+NOTICE message$
diff --git a/Tests/RunCMake/message/message-loglevel-status-stdout.txt b/Tests/RunCMake/message/message-loglevel-status-stdout.txt
new file mode 100644
index 0000000..809f4cc
--- /dev/null
+++ b/Tests/RunCMake/message/message-loglevel-status-stdout.txt
@@ -0,0 +1 @@
+-- STATUS message
diff --git a/Tests/RunCMake/message/message-loglevel-trace-stderr.txt b/Tests/RunCMake/message/message-loglevel-trace-stderr.txt
new file mode 100644
index 0000000..efec736
--- /dev/null
+++ b/Tests/RunCMake/message/message-loglevel-trace-stderr.txt
@@ -0,0 +1,12 @@
+^CMake Deprecation Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:2 \(message\):
+ Deprecation warning
++
+CMake Warning \(dev\) at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:3 \(message\):
+ Author warning message
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+CMake Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:4 \(message\):
+ Warning message
++
+Default NOTICE message
+NOTICE message$
diff --git a/Tests/RunCMake/message/message-loglevel-trace-stdout.txt b/Tests/RunCMake/message/message-loglevel-trace-stdout.txt
new file mode 100644
index 0000000..1cfce6f
--- /dev/null
+++ b/Tests/RunCMake/message/message-loglevel-trace-stdout.txt
@@ -0,0 +1,4 @@
+-- STATUS message
+-- VERBOSE message
+-- DEBUG message
+-- TRACE message
diff --git a/Tests/RunCMake/message/message-loglevel-verbose-stderr.txt b/Tests/RunCMake/message/message-loglevel-verbose-stderr.txt
new file mode 100644
index 0000000..efec736
--- /dev/null
+++ b/Tests/RunCMake/message/message-loglevel-verbose-stderr.txt
@@ -0,0 +1,12 @@
+^CMake Deprecation Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:2 \(message\):
+ Deprecation warning
++
+CMake Warning \(dev\) at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:3 \(message\):
+ Author warning message
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+CMake Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:4 \(message\):
+ Warning message
++
+Default NOTICE message
+NOTICE message$
diff --git a/Tests/RunCMake/message/message-loglevel-verbose-stdout.txt b/Tests/RunCMake/message/message-loglevel-verbose-stdout.txt
new file mode 100644
index 0000000..c15d43f
--- /dev/null
+++ b/Tests/RunCMake/message/message-loglevel-verbose-stdout.txt
@@ -0,0 +1,2 @@
+-- STATUS message
+-- VERBOSE message
diff --git a/Tests/RunCMake/message/message-loglevel-warning-stderr.txt b/Tests/RunCMake/message/message-loglevel-warning-stderr.txt
new file mode 100644
index 0000000..c721b06
--- /dev/null
+++ b/Tests/RunCMake/message/message-loglevel-warning-stderr.txt
@@ -0,0 +1,9 @@
+^CMake Deprecation Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:2 \(message\):
+ Deprecation warning
++
+CMake Warning \(dev\) at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:3 \(message\):
+ Author warning message
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+CMake Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:4 \(message\):
+ Warning message$
diff --git a/Tests/SourceGroups/CMakeLists.txt b/Tests/SourceGroups/CMakeLists.txt
index 813774d..a5740bb 100644
--- a/Tests/SourceGroups/CMakeLists.txt
+++ b/Tests/SourceGroups/CMakeLists.txt
@@ -42,8 +42,16 @@ set(tree_files_with_prefix ${root}/tree_prefix_foo.c
set(tree_files_with_empty_prefix ${root}/tree_empty_prefix_foo.c
tree_empty_prefix_bar.c)
+set(tree_files_which_are_actually_directories ${root}
+ ${root}/
+ ${root}/sub1
+ ${root}/sub1/)
+
source_group(TREE ${root} FILES ${tree_files_without_prefix})
+# Should not crash and not add any files - just silently ignore the directories
+source_group(TREE ${root} FILES ${tree_files_which_are_actually_directories})
+
source_group(FILES ${tree_files_with_prefix} PREFIX tree_root/subgroup TREE ${root})
source_group(PREFIX "" FILES ${tree_files_with_empty_prefix} TREE ${root})