diff options
344 files changed, 3708 insertions, 1488 deletions
diff --git a/Help/command/DEVICE_LINK_OPTIONS.txt b/Help/command/DEVICE_LINK_OPTIONS.txt new file mode 100644 index 0000000..012e9b1 --- /dev/null +++ b/Help/command/DEVICE_LINK_OPTIONS.txt @@ -0,0 +1,10 @@ + +When a device link step is involved, which is controlled by +:prop_tgt:`CUDA_SEPARABLE_COMPILATION` and +:prop_tgt:`CUDA_RESOLVE_DEVICE_SYMBOLS` properties, the raw options will be +delivered to the host and device link steps (wrapped in ``-Xcompiler`` or +equivalent for device link). Options wrapped with ``$<DEVICE_LINK:...>`` +:manual:`generator expression <cmake-generator-expressions(7)>` will be used +only for the device link step. Options wrapped with ``$<HOST_LINK:...>`` +:manual:`generator expression <cmake-generator-expressions(7)>` will be used +only for the host link step. diff --git a/Help/command/add_link_options.rst b/Help/command/add_link_options.rst index a83005b..faa4afb 100644 --- a/Help/command/add_link_options.rst +++ b/Help/command/add_link_options.rst @@ -26,6 +26,8 @@ the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. See the :manual:`cmake-buildsystem(7)` manual for more on defining buildsystem properties. +.. include:: DEVICE_LINK_OPTIONS.txt + .. include:: OPTIONS_SHELL.txt .. include:: LINK_OPTIONS_LINKER.txt diff --git a/Help/command/ctest_test.rst b/Help/command/ctest_test.rst index 5c67b2c..3589296 100644 --- a/Help/command/ctest_test.rst +++ b/Help/command/ctest_test.rst @@ -20,6 +20,7 @@ Perform the :ref:`CTest Test Step` as a :ref:`Dashboard Client`. [RESOURCE_SPEC_FILE <file>] [TEST_LOAD <threshold>] [SCHEDULE_RANDOM <ON|OFF>] + [STOP_ON_FAILURE] [STOP_TIME <time-of-day>] [RETURN_VALUE <result-var>] [CAPTURE_CMAKE_ERROR <result-var>] @@ -119,6 +120,9 @@ The options are: Launch tests in a random order. This may be useful for detecting implicit test dependencies. +``STOP_ON_FAILURE`` + Stop the execution of the tests once one has failed. + ``STOP_TIME <time-of-day>`` Specify a time of day at which the tests should all stop running. diff --git a/Help/command/separate_arguments.rst b/Help/command/separate_arguments.rst index fbca859..ab3d5c1 100644 --- a/Help/command/separate_arguments.rst +++ b/Help/command/separate_arguments.rst @@ -19,7 +19,7 @@ They are specified by the ``<mode>`` argument which must be one of the following keywords: ``UNIX_COMMAND`` - Arguments are separated by by unquoted whitespace. + Arguments are separated by unquoted whitespace. Both single-quote and double-quote pairs are respected. A backslash escapes the next literal character (``\"`` is ``"``); there are no special escapes (``\n`` is just ``n``). diff --git a/Help/command/set_property.rst b/Help/command/set_property.rst index ec08c8f..1728c98 100644 --- a/Help/command/set_property.rst +++ b/Help/command/set_property.rst @@ -66,7 +66,8 @@ the property to set. Remaining arguments are used to compose the property value in the form of a semicolon-separated list. If the ``APPEND`` option is given the list is appended to any existing -property value. If the ``APPEND_STRING`` option is given the string is +property value (except that empty values are ignored and not appended). +If the ``APPEND_STRING`` option is given the string is appended to any existing property value as string, i.e. it results in a longer string and not a list of strings. When using ``APPEND`` or ``APPEND_STRING`` with a property defined to support ``INHERITED`` diff --git a/Help/command/target_link_options.rst b/Help/command/target_link_options.rst index b5abbc4..89038e3 100644 --- a/Help/command/target_link_options.rst +++ b/Help/command/target_link_options.rst @@ -43,6 +43,8 @@ with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. See the :manual:`cmake-buildsystem(7)` manual for more on defining buildsystem properties. +.. include:: DEVICE_LINK_OPTIONS.txt + .. include:: OPTIONS_SHELL.txt .. include:: LINK_OPTIONS_LINKER.txt diff --git a/Help/dev/source.rst b/Help/dev/source.rst index 5371353..65a6adf 100644 --- a/Help/dev/source.rst +++ b/Help/dev/source.rst @@ -108,6 +108,9 @@ These are: * ``cm::append``: Append elements to a sequential container. + * ``cm::contains``: + Checks if element or key is contained in container. + * ``<cmext/iterator>``: * ``cm::is_terator``: @@ -117,12 +120,12 @@ These are: Checks if a type is an input iterator type. * ``cm::is_range``: - Checks if a type is a range type: must have methods ``begin()`` and - ``end()`` returning an iterator. + Checks if a type is a range type: functions ``std::begin()`` and + ``std::end()`` apply. * ``cm::is_input_range``: - Checks if a type is an input range type: must have methods ``begin()`` and - ``end()`` returning an input iterator. + Checks if a type is an input range type: functions ``std::begin()`` and + ``std::end()`` apply and return an input iterator. * ``<cmext/memory>``: diff --git a/Help/generator/Ninja.rst b/Help/generator/Ninja.rst index 275055d..08ee81b 100644 --- a/Help/generator/Ninja.rst +++ b/Help/generator/Ninja.rst @@ -33,11 +33,7 @@ Fortran Support ^^^^^^^^^^^^^^^ The ``Ninja`` generator conditionally supports Fortran when the ``ninja`` -tool has the required features. As of this version of CMake the needed -features have not been integrated into upstream Ninja. Kitware maintains -a branch of Ninja with the required features on `github.com/Kitware/ninja`_. - -.. _`github.com/Kitware/ninja`: https://github.com/Kitware/ninja/tree/features-for-fortran#readme +tool is at least version 1.10 (which has the required features). See Also ^^^^^^^^ diff --git a/Help/guide/tutorial/Step5/MathFunctions/MakeTable.cxx b/Help/guide/tutorial/Step5/MathFunctions/MakeTable.cxx deleted file mode 100644 index ee58556..0000000 --- a/Help/guide/tutorial/Step5/MathFunctions/MakeTable.cxx +++ /dev/null @@ -1,25 +0,0 @@ -// A simple program that builds a sqrt table -#include <cmath> -#include <fstream> -#include <iostream> - -int main(int argc, char* argv[]) -{ - // make sure we have enough arguments - if (argc < 2) { - return 1; - } - - std::ofstream fout(argv[1], std::ios_base::out); - const bool fileOpen = fout.is_open(); - if (fileOpen) { - fout << "double sqrtTable[] = {" << std::endl; - for (int i = 0; i < 10; ++i) { - fout << sqrt(static_cast<double>(i)) << "," << std::endl; - } - // close the table with a zero - fout << "0};" << std::endl; - fout.close(); - } - return fileOpen ? 0 : 1; // return 0 if wrote the file -} diff --git a/Help/guide/tutorial/Step6/MathFunctions/MakeTable.cxx b/Help/guide/tutorial/Step6/MathFunctions/MakeTable.cxx deleted file mode 100644 index ee58556..0000000 --- a/Help/guide/tutorial/Step6/MathFunctions/MakeTable.cxx +++ /dev/null @@ -1,25 +0,0 @@ -// A simple program that builds a sqrt table -#include <cmath> -#include <fstream> -#include <iostream> - -int main(int argc, char* argv[]) -{ - // make sure we have enough arguments - if (argc < 2) { - return 1; - } - - std::ofstream fout(argv[1], std::ios_base::out); - const bool fileOpen = fout.is_open(); - if (fileOpen) { - fout << "double sqrtTable[] = {" << std::endl; - for (int i = 0; i < 10; ++i) { - fout << sqrt(static_cast<double>(i)) << "," << std::endl; - } - // close the table with a zero - fout << "0};" << std::endl; - fout.close(); - } - return fileOpen ? 0 : 1; // return 0 if wrote the file -} diff --git a/Help/guide/tutorial/index.rst b/Help/guide/tutorial/index.rst index 4fbcd4c..6e26de9 100644 --- a/Help/guide/tutorial/index.rst +++ b/Help/guide/tutorial/index.rst @@ -380,8 +380,12 @@ tutorial assume that they are not common. If the platform has ``log`` and ``exp`` then we will use them to compute the square root in the ``mysqrt`` function. We first test for the availability of these functions using the :module:`CheckSymbolExists` module in the top-level -``CMakeLists.txt``. We're going to use the new defines in -``TutorialConfig.h.in``, so be sure to set them before that file is configured. +``CMakeLists.txt``. On some platforms, we will need to link to the m library. +If ``log`` and ``exp`` are not initially found, require the m library and try +again. + +We're going to use the new defines in ``TutorialConfig.h.in``, so be sure to +set them before that file is configured. .. literalinclude:: Step6/MathFunctions/CMakeLists.txt :language: cmake diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 72de4ac..9e411a4 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -362,6 +362,18 @@ Variable Queries evaluation will give ``C`` as link language, so the second pass will correctly add target ``libother`` as link dependency. +``$<DEVICE_LINK:list>`` + Returns the list if it is the device link step, an empty list otherwise. + The device link step is controlled by :prop_tgt:`CUDA_SEPARABLE_COMPILATION` + and :prop_tgt:`CUDA_RESOLVE_DEVICE_SYMBOLS` properties. This expression can + only be used to specify link options. + +``$<HOST_LINK:list>`` + Returns the list if it is the normal link step, an empty list otherwise. + This expression is mainly useful when a device link step is also involved + (see ``$<DEVICE_LINK:list>`` generator expression). This expression can only + be used to specify link options. + String-Valued Generator Expressions =================================== diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 08d59e7..3f3b70d 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -57,6 +57,9 @@ Policies Introduced by CMake 3.18 .. toctree:: :maxdepth: 1 + CMP0106: The Documentation module is removed. </policy/CMP0106> + CMP0105: Device link step uses the link options. </policy/CMP0105> + CMP0104: CMAKE_CUDA_ARCHITECTURES now detected for NVCC, empty CUDA_ARCHITECTURES not allowed. </policy/CMP0104> CMP0103: Multiple export() with same FILE without APPEND is not allowed. </policy/CMP0103> Policies Introduced by CMake 3.17 diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index cbb2298..4966f86 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -172,6 +172,7 @@ Properties on Targets /prop_tgt/CONFIG_OUTPUT_NAME /prop_tgt/CONFIG_POSTFIX /prop_tgt/CROSSCOMPILING_EMULATOR + /prop_tgt/CUDA_ARCHITECTURES /prop_tgt/CUDA_PTX_COMPILATION /prop_tgt/CUDA_SEPARABLE_COMPILATION /prop_tgt/CUDA_RESOLVE_DEVICE_SYMBOLS diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 1642772..7d802e1 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -488,6 +488,7 @@ Variables for Languages /variable/CMAKE_COMPILER_IS_GNUCC /variable/CMAKE_COMPILER_IS_GNUCXX /variable/CMAKE_COMPILER_IS_GNUG77 + /variable/CMAKE_CUDA_ARCHITECTURES /variable/CMAKE_CUDA_COMPILE_FEATURES /variable/CMAKE_CUDA_HOST_COMPILER /variable/CMAKE_CUDA_EXTENSIONS diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 9a43499..e3e965c 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -554,6 +554,9 @@ Available commands are: ``serverMode`` ``true`` if cmake supports server-mode and ``false`` otherwise. +``cat <files>...`` + Concatenate files and print on the standard output. + ``chdir <dir> <cmd> [<arg>...]`` Change the current working directory and run a command. diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index f2033b7..5f953b3 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -72,6 +72,9 @@ Options This option can also be enabled by setting the :envvar:`CTEST_OUTPUT_ON_FAILURE` environment variable +``--stop-on-failure`` + Stop running the tests when the first failure happens. + ``-F`` Enable failover. diff --git a/Help/policy/CMP0104.rst b/Help/policy/CMP0104.rst new file mode 100644 index 0000000..ca2c571 --- /dev/null +++ b/Help/policy/CMP0104.rst @@ -0,0 +1,31 @@ +CMP0104 +------- + +Initialize :variable:`CMAKE_CUDA_ARCHITECTURES` when +:variable:`CMAKE_CUDA_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>` is ``NVIDIA``. +Raise an error if :prop_tgt:`CUDA_ARCHITECTURES` is empty. + +:variable:`CMAKE_CUDA_ARCHITECTURES` introduced in CMake 3.18 is used to +initialize :prop_tgt:`CUDA_ARCHITECTURES`, which passes correct code generation +flags to the CUDA compiler. + +Previous to this users had to manually specify the code generation flags. This +policy is for backwards compatibility with manually specifying code generation +flags. + +The ``OLD`` behavior for this policy is to not initialize +:variable:`CMAKE_CUDA_ARCHITECTURES` when +:variable:`CMAKE_CUDA_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>` is ``NVIDIA``. +Empty :prop_tgt:`CUDA_ARCHITECTURES` is allowed. + +The ``NEW`` behavior of this policy is to initialize +:variable:`CMAKE_CUDA_ARCHITECTURES` when +:variable:`CMAKE_CUDA_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>` is ``NVIDIA`` +and raise an error if :prop_tgt:`CUDA_ARCHITECTURES` is empty during generation. + +This policy was introduced in CMake version 3.18. CMake version +|release| warns when the policy is not set and uses ``OLD`` behavior. +Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` +explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0105.rst b/Help/policy/CMP0105.rst new file mode 100644 index 0000000..19a1edb --- /dev/null +++ b/Help/policy/CMP0105.rst @@ -0,0 +1,19 @@ +CMP0105 +------- + +:prop_tgt:`LINK_OPTIONS` and :prop_tgt:`INTERFACE_LINK_OPTIONS` target +properties are now used for the device link step. + +In CMake 3.17 and below, link options are not used by the device link step. + +The ``OLD`` behavior for this policy is to ignore the link options. + +The ``NEW`` behavior of this policy is to use the link options during the +device link step. + +This policy was introduced in CMake version 3.17. Use the +:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. +Unlike many policies, CMake version |release| does *not* warn +when this policy is not set and simply uses ``OLD`` behavior. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0106.rst b/Help/policy/CMP0106.rst new file mode 100644 index 0000000..e34d15a --- /dev/null +++ b/Help/policy/CMP0106.rst @@ -0,0 +1,19 @@ +CMP0106 +------- + +The :module:`Documentation` module is removed. + +The :module:`Documentation` was added as a support mechanism for the VTK +project and was tuned for that project. Instead of CMake providing this module +with (now old) VTK patterns for cache variables and required packages, the +module is now deprecated by CMake itself. + +The ``OLD`` behavior of this policy is for :module:`Documentation` to add +cache variables and find VTK documentation dependent packages. The ``NEW`` +behavior is to act as an empty module. + +This policy was introduced in CMake version 3.18. CMake version |release| +warns when the policy is not set and uses ``OLD`` behavior. Use the +:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/prop_dir/LINK_OPTIONS.rst b/Help/prop_dir/LINK_OPTIONS.rst index 54ac6dd..f229ba6 100644 --- a/Help/prop_dir/LINK_OPTIONS.rst +++ b/Help/prop_dir/LINK_OPTIONS.rst @@ -2,7 +2,7 @@ LINK_OPTIONS ------------ List of options to use for the link step of shared library, module -and executable targets. +and executable targets as well as the device link step. This property holds a :ref:`semicolon-separated list <CMake Language Lists>` of options given so far to the :command:`add_link_options` command. diff --git a/Help/prop_tgt/CUDA_ARCHITECTURES.rst b/Help/prop_tgt/CUDA_ARCHITECTURES.rst new file mode 100644 index 0000000..328f40b --- /dev/null +++ b/Help/prop_tgt/CUDA_ARCHITECTURES.rst @@ -0,0 +1,30 @@ +CUDA_ARCHITECTURES +------------------ + +List of architectures to generate device code for. + +An architecture can be suffixed by either ``-real`` or ``-virtual`` to specify +the kind of architecture to generate code for. +If no suffix is given then code is generated for both real and virtual +architectures. + +This property is initialized by the value of the :variable:`CMAKE_CUDA_ARCHITECTURES` +variable if it is set when a target is created. + +The ``CUDA_ARCHITECTURES`` target property must be set to a non-empty value on targets +that compile CUDA sources, or it is an error. See policy :policy:`CMP0104`. + +Examples +^^^^^^^^ + +.. code-block:: cmake + + set_property(TARGET tgt PROPERTY CUDA_ARCHITECTURES 35 50 72) + +Generates code for real and virtual architectures ``30``, ``50`` and ``72``. + +.. code-block:: cmake + + set_property(TARGET tgt PROPERTY CUDA_ARCHITECTURES 70-real 72-virtual) + +Generates code for real architecture ``70`` and virtual architecture ``72``. diff --git a/Help/prop_tgt/LINK_OPTIONS.rst b/Help/prop_tgt/LINK_OPTIONS.rst index 2a05ea7..ff3ee87 100644 --- a/Help/prop_tgt/LINK_OPTIONS.rst +++ b/Help/prop_tgt/LINK_OPTIONS.rst @@ -2,12 +2,16 @@ LINK_OPTIONS ------------ List of options to use for the link step of shared library, module -and executable targets. Targets that are static libraries need to use -the :prop_tgt:`STATIC_LIBRARY_OPTIONS` target property. +and executable targets as well as the device link step. Targets that are static +libraries need to use the :prop_tgt:`STATIC_LIBRARY_OPTIONS` target property. +These options are used for both normal linking and device linking +(see policy :policy:`CMP0105`). To control link options for normal and device +link steps, ``$<HOST_LINK>`` and ``$<DEVICE_LINK>`` +:manual:`generator expressions <cmake-generator-expressions(7)>` can be used. -This property holds a :ref:`semicolon-separated list <CMake Language Lists>` of options -specified so far for its target. Use the :command:`target_link_options` +This property holds a :ref:`semicolon-separated list <CMake Language Lists>` of +options specified so far for its target. Use the :command:`target_link_options` command to append more options. This property is initialized by the :prop_dir:`LINK_OPTIONS` directory diff --git a/Help/release/dev/FindPython-dev-subcomponents.rst b/Help/release/dev/FindPython-dev-subcomponents.rst new file mode 100644 index 0000000..fe76ee8 --- /dev/null +++ b/Help/release/dev/FindPython-dev-subcomponents.rst @@ -0,0 +1,6 @@ +FindPython-dev-subcomponents +---------------------------- + +* The :module:`FindPython3`, :module:`FindPython2` and :module:`FindPython` + modules gained sub-components ``Development.Module`` and + ``Development.Embed`` for ``Development`` component. diff --git a/Help/release/dev/command-line-cat.rst b/Help/release/dev/command-line-cat.rst new file mode 100644 index 0000000..acde835 --- /dev/null +++ b/Help/release/dev/command-line-cat.rst @@ -0,0 +1,5 @@ +Command-Line +------------ +* :manual:`cmake(1)` gained a ``cat`` command line + option that can be used to concatenate files and print them + on standard output. diff --git a/Help/release/dev/ctest_stop_on_failure.rst b/Help/release/dev/ctest_stop_on_failure.rst new file mode 100644 index 0000000..f10c37c --- /dev/null +++ b/Help/release/dev/ctest_stop_on_failure.rst @@ -0,0 +1,8 @@ +ctest_stop_on_failure +--------------------- + +* :manual:`ctest(1)` gained a ``--stop-on-failure`` option, + which can be used to stop running the tests once one has failed. + +* The :command:`ctest_test` command gained a ``STOP_ON_FAILURE`` option + which can be used to stop running the tests once one has failed. diff --git a/Help/release/dev/cuda-architectures-empty.rst b/Help/release/dev/cuda-architectures-empty.rst new file mode 100644 index 0000000..b0fc327 --- /dev/null +++ b/Help/release/dev/cuda-architectures-empty.rst @@ -0,0 +1,7 @@ +cuda-architectures-empty +------------------------ + +* :variable:`CMAKE_CUDA_ARCHITECTURES` is now initialized when + :variable:`CMAKE_CUDA_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>` is ``NVIDIA``. + Empty :prop_tgt:`CUDA_ARCHITECTURES` raises an error. See policy + :policy:`CMP0104`. diff --git a/Help/release/dev/cuda-architectures.rst b/Help/release/dev/cuda-architectures.rst new file mode 100644 index 0000000..dc6c55b --- /dev/null +++ b/Help/release/dev/cuda-architectures.rst @@ -0,0 +1,6 @@ +cuda-architectures +------------------ + +* Added :prop_tgt:`CUDA_ARCHITECTURES` target property for specifying CUDA + output architectures. Users are encouraged to use this instead of specifying + options manually, as this approach is compiler-agnostic. diff --git a/Help/release/dev/deprecate-documentation-module.rst b/Help/release/dev/deprecate-documentation-module.rst new file mode 100644 index 0000000..5c3157b --- /dev/null +++ b/Help/release/dev/deprecate-documentation-module.rst @@ -0,0 +1,6 @@ +deprecate-documentation-module +------------------------------ + +* The :module:`Documentation` module has been deprecated via + :policy:`CMP0106`. This module was essentially VTK code that CMake should + not be shipping anymore. diff --git a/Help/release/dev/device-link-options.rst b/Help/release/dev/device-link-options.rst new file mode 100644 index 0000000..f58026b --- /dev/null +++ b/Help/release/dev/device-link-options.rst @@ -0,0 +1,5 @@ +device-link-options +------------------- + +* the :prop_tgt:`LINK_OPTIONS` and :prop_tgt:`INTERFACE_LINK_OPTIONS` target + properties are now used for the device link step. See policy :policy:`CMP0105`. diff --git a/Help/release/dev/genex-DEVICE_LINK-HOST_LINK.rst b/Help/release/dev/genex-DEVICE_LINK-HOST_LINK.rst new file mode 100644 index 0000000..ef275e7 --- /dev/null +++ b/Help/release/dev/genex-DEVICE_LINK-HOST_LINK.rst @@ -0,0 +1,6 @@ +genex-DEVICE_LINK-HOST_LINK +--------------------------- + +* To manage device and host link steps, the ``$<DEVICE_LINK:...>`` and + ``$<HOST_LINK:...>`` + :manual:`generator expressions <cmake-generator-expressions(7)>` were added. diff --git a/Help/release/dev/ninja-compiler-PATH-windows.rst b/Help/release/dev/ninja-compiler-PATH-windows.rst new file mode 100644 index 0000000..cb33493 --- /dev/null +++ b/Help/release/dev/ninja-compiler-PATH-windows.rst @@ -0,0 +1,7 @@ +ninja-compiler-PATH-windows +--------------------------- + +* On Windows, the :generator:`Ninja` and :generator:`Ninja Multi-Config` + generators, when a compiler is not explicitly specified, now select + the first compiler (of any name) found in directories listed by the + ``PATH`` environment variable. diff --git a/Help/variable/CMAKE_CUDA_ARCHITECTURES.rst b/Help/variable/CMAKE_CUDA_ARCHITECTURES.rst new file mode 100644 index 0000000..149bffa --- /dev/null +++ b/Help/variable/CMAKE_CUDA_ARCHITECTURES.rst @@ -0,0 +1,17 @@ +CMAKE_CUDA_ARCHITECTURES +------------------------ + +Default value for :prop_tgt:`CUDA_ARCHITECTURES` property of targets. + +This is initialized as follows depending on :variable:`CMAKE_CUDA_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>`: + +- For ``Clang``: the oldest architecture that works. + +- For ``NVIDIA``: the default architecture chosen by the compiler. + See policy :policy:`CMP0104`. + +Users are encouraged to override this, as the default varies across compilers +and compiler versions. + +This variable is used to initialize the :prop_tgt:`CUDA_ARCHITECTURES` property +on all targets. See the target property for additional information. diff --git a/Modules/CMakeASM_NASMInformation.cmake b/Modules/CMakeASM_NASMInformation.cmake index cb793e7..97cb488 100644 --- a/Modules/CMakeASM_NASMInformation.cmake +++ b/Modules/CMakeASM_NASMInformation.cmake @@ -8,19 +8,25 @@ set(CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS nasm asm) if(NOT CMAKE_ASM_NASM_OBJECT_FORMAT) if(WIN32) - if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) + if(DEFINED CMAKE_C_SIZEOF_DATA_PTR AND CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) + set(CMAKE_ASM_NASM_OBJECT_FORMAT win64) + elseif(DEFINED CMAKE_CXX_SIZEOF_DATA_PTR AND CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8) set(CMAKE_ASM_NASM_OBJECT_FORMAT win64) else() set(CMAKE_ASM_NASM_OBJECT_FORMAT win32) endif() elseif(APPLE) - if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) + if(DEFINED CMAKE_C_SIZEOF_DATA_PTR AND CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) + set(CMAKE_ASM_NASM_OBJECT_FORMAT macho64) + elseif(DEFINED CMAKE_CXX_SIZEOF_DATA_PTR AND CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8) set(CMAKE_ASM_NASM_OBJECT_FORMAT macho64) else() set(CMAKE_ASM_NASM_OBJECT_FORMAT macho) endif() else() - if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) + if(DEFINED CMAKE_C_SIZEOF_DATA_PTR AND CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) + set(CMAKE_ASM_NASM_OBJECT_FORMAT elf64) + elseif(DEFINED CMAKE_CXX_SIZEOF_DATA_PTR AND CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8) set(CMAKE_ASM_NASM_OBJECT_FORMAT elf64) else() set(CMAKE_ASM_NASM_OBJECT_FORMAT elf) diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake index ab562c6..e8b60b6 100644 --- a/Modules/CMakeCUDAInformation.cmake +++ b/Modules/CMakeCUDAInformation.cmake @@ -192,14 +192,13 @@ unset(__IMPLICT_DLINK_DIRS) #These are used when linking relocatable (dc) cuda code if(NOT CMAKE_CUDA_DEVICE_LINK_LIBRARY) set(CMAKE_CUDA_DEVICE_LINK_LIBRARY - "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICT_DLINK_FLAGS}") + "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICT_DLINK_FLAGS}") endif() if(NOT CMAKE_CUDA_DEVICE_LINK_EXECUTABLE) set(CMAKE_CUDA_DEVICE_LINK_EXECUTABLE - "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICT_DLINK_FLAGS}") + "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICT_DLINK_FLAGS}") endif() -unset(_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS) unset(__IMPLICT_DLINK_FLAGS) set(CMAKE_CUDA_INFORMATION_LOADED 1) diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake index 55ca800..ead4125 100644 --- a/Modules/CMakeDetermineCUDACompiler.cmake +++ b/Modules/CMakeDetermineCUDACompiler.cmake @@ -226,6 +226,17 @@ if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Failed to detect CUDA nvcc include information:\n${_nvcc_log}\n\n") endif() + + # Parse default CUDA architecture. + cmake_policy(GET CMP0104 _CUDA_CMP0104) + if(NOT CMAKE_CUDA_ARCHITECTURES AND _CUDA_CMP0104 STREQUAL "NEW") + string(REGEX MATCH "arch[ =]compute_([0-9]+)" dont_care "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}") + set(CMAKE_CUDA_ARCHITECTURES "${CMAKE_MATCH_1}" CACHE STRING "CUDA architectures") + + if(NOT CMAKE_CUDA_ARCHITECTURES) + message(FATAL_ERROR "Failed to find default CUDA architecture.") + endif() + endif() endif() # configure all variables set in this file diff --git a/Modules/CMakeDetermineCompiler.cmake b/Modules/CMakeDetermineCompiler.cmake index 7afae8a..da93b5c 100644 --- a/Modules/CMakeDetermineCompiler.cmake +++ b/Modules/CMakeDetermineCompiler.cmake @@ -53,6 +53,20 @@ macro(_cmake_find_compiler lang) NO_DEFAULT_PATH DOC "${lang} compiler") endif() + if(CMAKE_HOST_WIN32 AND CMAKE_GENERATOR MATCHES "Ninja") + # On Windows command-line builds, the Makefile generators each imply + # a preferred compiler tool. The Ninja generator does not imply a + # compiler tool, so use the compiler that occurs first in PATH. + find_program(CMAKE_${lang}_COMPILER + NAMES ${CMAKE_${lang}_COMPILER_LIST} + NAMES_PER_DIR + DOC "${lang} compiler" + NO_PACKAGE_ROOT_PATH + NO_CMAKE_PATH + NO_CMAKE_ENVIRONMENT_PATH + NO_CMAKE_SYSTEM_PATH + ) + endif() find_program(CMAKE_${lang}_COMPILER NAMES ${CMAKE_${lang}_COMPILER_LIST} DOC "${lang} compiler") if(CMAKE_${lang}_COMPILER_INIT AND NOT CMAKE_${lang}_COMPILER) set_property(CACHE CMAKE_${lang}_COMPILER PROPERTY VALUE "${CMAKE_${lang}_COMPILER_INIT}") diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake index e24738d..4b09e6f 100644 --- a/Modules/Compiler/NVIDIA-CUDA.cmake +++ b/Modules/Compiler/NVIDIA-CUDA.cmake @@ -46,6 +46,19 @@ endif() set(CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS -shared) set(CMAKE_INCLUDE_SYSTEM_FLAG_CUDA -isystem=) +if (CMAKE_CUDA_SIMULATE_ID STREQUAL "GNU") + set(CMAKE_CUDA_LINKER_WRAPPER_FLAG "-Wl,") + set(CMAKE_CUDA_LINKER_WRAPPER_FLAG_SEP ",") +elseif(CMAKE_CUDA_SIMULATE_ID STREQUAL "Clang") + set(CMAKE_CUDA_LINKER_WRAPPER_FLAG "-Xlinker" " ") + set(CMAKE_CUDA_LINKER_WRAPPER_FLAG_SEP) +endif() + +set(CMAKE_CUDA_DEVICE_COMPILER_WRAPPER_FLAG "-Xcompiler=") +set(CMAKE_CUDA_DEVICE_COMPILER_WRAPPER_FLAG_SEP ",") +set(CMAKE_CUDA_DEVICE_LINKER_WRAPPER_FLAG "-Xlinker=") +set(CMAKE_CUDA_DEVICE_LINKER_WRAPPER_FLAG_SEP ",") + set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "STATIC") set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "cudadevrt;cudart_static") set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_SHARED "cudadevrt;cudart") diff --git a/Modules/Compiler/NVIDIA-DetermineCompiler.cmake b/Modules/Compiler/NVIDIA-DetermineCompiler.cmake index bf9111a..4f6ddc2 100644 --- a/Modules/Compiler/NVIDIA-DetermineCompiler.cmake +++ b/Modules/Compiler/NVIDIA-DetermineCompiler.cmake @@ -11,9 +11,19 @@ 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) +# elif defined(__clang__) +# define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(__clang_major__) +# define @PREFIX@SIMULATE_VERSION_MINOR @MACRO_DEC@(__clang_minor__) +# elif defined(__GNUC__) +# define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(__GNUC__) +# define @PREFIX@SIMULATE_VERSION_MINOR @MACRO_DEC@(__GNUC_MINOR__) # endif") set(_compiler_id_simulate " # if defined(_MSC_VER) # define @PREFIX@SIMULATE_ID \"MSVC\" +# elif defined(__clang__) +# define @PREFIX@SIMULATE_ID \"Clang\" +# elif defined(__GNUC__) +# define @PREFIX@SIMULATE_ID \"GNU\" # endif") diff --git a/Modules/Compiler/TI-CXX.cmake b/Modules/Compiler/TI-CXX.cmake index 4c6af06..7836543 100644 --- a/Modules/Compiler/TI-CXX.cmake +++ b/Modules/Compiler/TI-CXX.cmake @@ -8,5 +8,8 @@ set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> --compile_only --skip set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> --preproc_only --cpp_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<PREPROCESSED_SOURCE>") set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> --compile_only --cpp_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<OBJECT>") -set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> -r <TARGET> <OBJECTS>") -set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> --run_linker --output_file=<TARGET> --map_file=<TARGET>.map <CMAKE_CXX_LINK_FLAGS> <LINK_LIBRARIES> <LINK_FLAGS> <OBJECTS>") +set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qr <TARGET> <OBJECTS>") +set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> qa <TARGET> <OBJECTS>") +set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> --run_linker --output_file=<TARGET> --map_file=<TARGET_NAME>.map <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES>") +set(CMAKE_CXX_RESPONSE_FILE_FLAG "--cmd_file=") +set(CMAKE_CXX_RESPONSE_FILE_LINK_FLAG " ") diff --git a/Modules/Documentation.cmake b/Modules/Documentation.cmake index aaf24f6..c297231 100644 --- a/Modules/Documentation.cmake +++ b/Modules/Documentation.cmake @@ -9,6 +9,30 @@ This module provides support for the VTK documentation framework. It relies on several tools (Doxygen, Perl, etc). #]=======================================================================] +cmake_policy(GET CMP0106 _Documentation_policy) + +if (_Documentation_policy STREQUAL "NEW") + message(FATAL_ERROR + "Documentation.cmake is VTK-specific code and should not be used in " + "non-VTK projects. This logic in this module is best shipped with the " + "project using it rather than with CMake. This is now an error according " + "to policy CMP0106.") +else () + +if (_Documentation_policy STREQUAL "") + # Ignore the warning if the project is detected as VTK itself. + if (NOT CMAKE_PROJECT_NAME STREQUAL "VTK" AND + NOT PROJECT_NAME STREQUAL "VTK") + cmake_policy(GET_WARNING CMP0106 _Documentation_policy_warning) + message(AUTHOR_WARNING + "${_Documentation_policy_warning}\n" + "Documentation.cmake is VTK-specific code and should not be used in " + "non-VTK projects. This logic in this module is best shipped with the " + "project using it rather than with CMake.") + endif () + unset(_Documentation_policy_warning) +endif () + # # Build the documentation ? # @@ -44,3 +68,7 @@ if (BUILD_DOCUMENTATION) # endif () + +endif () + +unset(_Documentation_policy) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index c1ca2b5..75f68c8 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -2282,7 +2282,7 @@ function(ExternalProject_Add_StepDependencies name step) get_property(steps TARGET ${name} PROPERTY _EP_STEPS) list(FIND steps ${step} is_step) - if(NOT is_step) + if(is_step LESS 0) message(FATAL_ERROR "External project \"${name}\" does not have a step \"${step}\".") endif() diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index fb8cdeb..1b27463 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -854,318 +854,334 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) endif() set(_Boost_IMPORTED_TARGETS TRUE) - if(Boost_VERSION_STRING AND Boost_VERSION_STRING VERSION_LESS 1.33.0) - message(WARNING "Imported targets and dependency information not available for Boost version ${Boost_VERSION_STRING} (all versions older than 1.33)") - set(_Boost_IMPORTED_TARGETS FALSE) - elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.33.0 AND Boost_VERSION_STRING VERSION_LESS 1.35.0) - set(_Boost_IOSTREAMS_DEPENDENCIES regex thread) - set(_Boost_REGEX_DEPENDENCIES thread) - set(_Boost_WAVE_DEPENDENCIES filesystem thread) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.35.0 AND Boost_VERSION_STRING VERSION_LESS 1.36.0) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_WAVE_DEPENDENCIES filesystem system thread) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.36.0 AND Boost_VERSION_STRING VERSION_LESS 1.38.0) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_WAVE_DEPENDENCIES filesystem system thread) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.38.0 AND Boost_VERSION_STRING VERSION_LESS 1.43.0) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_THREAD_DEPENDENCIES date_time) - set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.43.0 AND Boost_VERSION_STRING VERSION_LESS 1.44.0) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_THREAD_DEPENDENCIES date_time) - set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.44.0 AND Boost_VERSION_STRING VERSION_LESS 1.45.0) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random serialization) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_THREAD_DEPENDENCIES date_time) - set(_Boost_WAVE_DEPENDENCIES serialization filesystem system thread date_time) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.45.0 AND Boost_VERSION_STRING VERSION_LESS 1.47.0) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_THREAD_DEPENDENCIES date_time) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.47.0 AND Boost_VERSION_STRING VERSION_LESS 1.48.0) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_THREAD_DEPENDENCIES date_time) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.48.0 AND Boost_VERSION_STRING VERSION_LESS 1.50.0) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_THREAD_DEPENDENCIES date_time) - set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.50.0 AND Boost_VERSION_STRING VERSION_LESS 1.53.0) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_THREAD_DEPENDENCIES chrono system date_time) - set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.53.0 AND Boost_VERSION_STRING VERSION_LESS 1.54.0) - set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.54.0 AND Boost_VERSION_STRING VERSION_LESS 1.55.0) - set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.55.0 AND Boost_VERSION_STRING VERSION_LESS 1.56.0) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_COROUTINE_DEPENDENCIES context system) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.56.0 AND Boost_VERSION_STRING VERSION_LESS 1.59.0) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_COROUTINE_DEPENDENCIES context system) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_RANDOM_DEPENDENCIES system) - set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.59.0 AND Boost_VERSION_STRING VERSION_LESS 1.60.0) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_COROUTINE_DEPENDENCIES context system) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_RANDOM_DEPENDENCIES system) - set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.60.0 AND Boost_VERSION_STRING VERSION_LESS 1.61.0) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_COROUTINE_DEPENDENCIES context system) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_RANDOM_DEPENDENCIES system) - set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.61.0 AND Boost_VERSION_STRING VERSION_LESS 1.62.0) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) - set(_Boost_COROUTINE_DEPENDENCIES context system) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_RANDOM_DEPENDENCIES system) - set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.62.0 AND Boost_VERSION_STRING VERSION_LESS 1.63.0) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) - set(_Boost_COROUTINE_DEPENDENCIES context system) - set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_RANDOM_DEPENDENCIES system) - set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.63.0 AND Boost_VERSION_STRING VERSION_LESS 1.65.0) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) - set(_Boost_COROUTINE_DEPENDENCIES context system) - set(_Boost_COROUTINE2_DEPENDENCIES context fiber thread chrono system date_time) - set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_RANDOM_DEPENDENCIES system) - set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.65.0 AND Boost_VERSION_STRING VERSION_LESS 1.67.0) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) - set(_Boost_COROUTINE_DEPENDENCIES context system) - set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) - set(_Boost_RANDOM_DEPENDENCIES system) - set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.67.0 AND Boost_VERSION_STRING VERSION_LESS 1.68.0) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) - set(_Boost_COROUTINE_DEPENDENCIES context system) - set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) - set(_Boost_RANDOM_DEPENDENCIES system) - set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.68.0 AND Boost_VERSION_STRING VERSION_LESS 1.69.0) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) - set(_Boost_CONTRACT_DEPENDENCIES thread chrono system date_time) - set(_Boost_COROUTINE_DEPENDENCIES context system) - set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) - set(_Boost_RANDOM_DEPENDENCIES system) - set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.69.0 AND Boost_VERSION_STRING VERSION_LESS 1.70.0) - set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time) - set(_Boost_COROUTINE_DEPENDENCIES context) - set(_Boost_FIBER_DEPENDENCIES context) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) - set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic) - set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.70.0 AND Boost_VERSION_STRING VERSION_LESS 1.72.0) - set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time) - set(_Boost_COROUTINE_DEPENDENCIES context) - set(_Boost_FIBER_DEPENDENCIES context) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) - set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic) - set(_Boost_TIMER_DEPENDENCIES chrono) - set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.72.0) - set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time) - set(_Boost_COROUTINE_DEPENDENCIES context) - set(_Boost_FIBER_DEPENDENCIES context) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l chrono atomic) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) - set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic) - set(_Boost_TIMER_DEPENDENCIES chrono) - set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - if(NOT Boost_VERSION_STRING VERSION_LESS 1.73.0) - message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets") + if(Boost_VERSION_STRING) + if(Boost_VERSION_STRING VERSION_LESS 1.33.0) + message(WARNING "Imported targets and dependency information not available for Boost version ${Boost_VERSION_STRING} (all versions older than 1.33)") + set(_Boost_IMPORTED_TARGETS FALSE) + elseif(Boost_VERSION_STRING VERSION_LESS 1.35.0) + set(_Boost_IOSTREAMS_DEPENDENCIES regex thread) + set(_Boost_REGEX_DEPENDENCIES thread) + set(_Boost_WAVE_DEPENDENCIES filesystem thread) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(Boost_VERSION_STRING VERSION_LESS 1.36.0) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_WAVE_DEPENDENCIES filesystem system thread) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(Boost_VERSION_STRING VERSION_LESS 1.38.0) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_WAVE_DEPENDENCIES filesystem system thread) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(Boost_VERSION_STRING VERSION_LESS 1.43.0) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(Boost_VERSION_STRING VERSION_LESS 1.44.0) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(Boost_VERSION_STRING VERSION_LESS 1.45.0) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random serialization) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_WAVE_DEPENDENCIES serialization filesystem system thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(Boost_VERSION_STRING VERSION_LESS 1.47.0) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(Boost_VERSION_STRING VERSION_LESS 1.48.0) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(Boost_VERSION_STRING VERSION_LESS 1.50.0) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(Boost_VERSION_STRING VERSION_LESS 1.53.0) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(Boost_VERSION_STRING VERSION_LESS 1.54.0) + set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(Boost_VERSION_STRING VERSION_LESS 1.55.0) + set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(Boost_VERSION_STRING VERSION_LESS 1.56.0) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(Boost_VERSION_STRING VERSION_LESS 1.59.0) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(Boost_VERSION_STRING VERSION_LESS 1.60.0) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(Boost_VERSION_STRING VERSION_LESS 1.61.0) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(Boost_VERSION_STRING VERSION_LESS 1.62.0) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(Boost_VERSION_STRING VERSION_LESS 1.63.0) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(Boost_VERSION_STRING VERSION_LESS 1.65.0) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_COROUTINE2_DEPENDENCIES context fiber thread chrono system date_time) + set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(Boost_VERSION_STRING VERSION_LESS 1.67.0) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(Boost_VERSION_STRING VERSION_LESS 1.68.0) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(Boost_VERSION_STRING VERSION_LESS 1.69.0) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) + set(_Boost_CONTRACT_DEPENDENCIES thread chrono system date_time) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(Boost_VERSION_STRING VERSION_LESS 1.70.0) + set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time) + set(_Boost_COROUTINE_DEPENDENCIES context) + set(_Boost_FIBER_DEPENDENCIES context) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) + set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(Boost_VERSION_STRING VERSION_LESS 1.72.0) + set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time) + set(_Boost_COROUTINE_DEPENDENCIES context) + set(_Boost_FIBER_DEPENDENCIES context) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) + set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono) + set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(Boost_VERSION_STRING VERSION_LESS 1.73.0) + set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time) + set(_Boost_COROUTINE_DEPENDENCIES context) + set(_Boost_FIBER_DEPENDENCIES context) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l chrono atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) + set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono) + set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + else() + set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time) + set(_Boost_COROUTINE_DEPENDENCIES context) + set(_Boost_FIBER_DEPENDENCIES context) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) + set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono) + set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + if(NOT Boost_VERSION_STRING VERSION_LESS 1.73.0) + message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets") + endif() endif() endif() @@ -1228,6 +1244,7 @@ function(_Boost_COMPONENT_HEADERS component _hdrs) set(_Boost_MPI_HEADERS "boost/mpi.hpp") set(_Boost_MPI_PYTHON_HEADERS "boost/mpi/python/config.hpp") set(_Boost_NUMPY_HEADERS "boost/python/numpy.hpp") + set(_Boost_NOWIDE_HEADERS "boost/nowide/cstdlib.hpp") set(_Boost_PRG_EXEC_MONITOR_HEADERS "boost/test/prg_exec_monitor.hpp") set(_Boost_PROGRAM_OPTIONS_HEADERS "boost/program_options.hpp") set(_Boost_PYTHON_HEADERS "boost/python.hpp") diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index cdbb927..e9b6bd2 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -867,11 +867,11 @@ function(_MPI_guess_settings LANG) # We first attempt to locate the msmpi.lib. Should be find it, we'll assume that the MPI present is indeed # Microsoft MPI. if("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) - set(MPI_MSMPI_LIB_PATH "$ENV{MSMPI_LIB64}") - set(MPI_MSMPI_INC_PATH_EXTRA "$ENV{MSMPI_INC}/x64") + file(TO_CMAKE_PATH "$ENV{MSMPI_LIB64}" MPI_MSMPI_LIB_PATH) + file(TO_CMAKE_PATH "$ENV{MSMPI_INC}/x64" MPI_MSMPI_INC_PATH_EXTRA) else() - set(MPI_MSMPI_LIB_PATH "$ENV{MSMPI_LIB32}") - set(MPI_MSMPI_INC_PATH_EXTRA "$ENV{MSMPI_INC}/x86") + file(TO_CMAKE_PATH "$ENV{MSMPI_LIB32}" MPI_MSMPI_LIB_PATH) + file(TO_CMAKE_PATH "$ENV{MSMPI_INC}/x86" MPI_MSMPI_INC_PATH_EXTRA) endif() find_library(MPI_msmpi_LIBRARY diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index b7e6442..835811c 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -212,7 +212,13 @@ function(_pkg_find_libs _prefix _no_cmake_path _no_cmake_environment_path) endif() unset(_search_paths) + unset(_next_is_framework) foreach (flag IN LISTS ${_prefix}_LDFLAGS) + if (_next_is_framework) + list(APPEND _libs "-framework ${flag}") + unset(_next_is_framework) + continue() + endif () if (flag MATCHES "^-L(.*)") list(APPEND _search_paths ${CMAKE_MATCH_1}) continue() @@ -220,6 +226,9 @@ function(_pkg_find_libs _prefix _no_cmake_path _no_cmake_environment_path) if (flag MATCHES "^-l(.*)") set(_pkg_search "${CMAKE_MATCH_1}") else() + if (flag STREQUAL "-framework") + set(_next_is_framework TRUE) + endif () continue() endif() @@ -379,6 +388,30 @@ macro(_pkg_restore_path_internal) unset(_pkgconfig_path_old) endmacro() +# pkg-config returns frameworks in --libs-only-other +# they need to be in ${_prefix}_LIBRARIES so "-framework a -framework b" does +# not incorrectly be combined to "-framework a b" +function(_pkgconfig_extract_frameworks _prefix) + set(ldflags "${${_prefix}_LDFLAGS_OTHER}") + list(FIND ldflags "-framework" FR_POS) + list(LENGTH ldflags LD_LENGTH) + + # reduce length by 1 as we need "-framework" and the next entry + math(EXPR LD_LENGTH "${LD_LENGTH} - 1") + while (FR_POS GREATER -1 AND LD_LENGTH GREATER FR_POS) + list(REMOVE_AT ldflags ${FR_POS}) + list(GET ldflags ${FR_POS} HEAD) + list(REMOVE_AT ldflags ${FR_POS}) + math(EXPR LD_LENGTH "${LD_LENGTH} - 2") + + list(APPEND LIBS "-framework ${HEAD}") + + list(FIND ldflags "-framework" FR_POS) + endwhile () + set(${_prefix}_LIBRARIES ${${_prefix}_LIBRARIES} ${LIBS} PARENT_SCOPE) + set(${_prefix}_LDFLAGS_OTHER "${ldflags}" PARENT_SCOPE) +endfunction() + ### macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cmake_environment_path _imp_target _imp_target_global _prefix) _pkgconfig_unset(${_prefix}_FOUND) @@ -517,6 +550,10 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS "" --libs ) _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS_OTHER "" --libs-only-other ) + if (APPLE AND "-framework" IN_LIST ${_prefix}_LDFLAGS_OTHER) + _pkgconfig_extract_frameworks("${_prefix}") + endif() + _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" INCLUDE_DIRS "(^| )-I" --cflags-only-I ) _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags ) _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other ) diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake index 95426ba..95c4a0f 100644 --- a/Modules/FindPython.cmake +++ b/Modules/FindPython.cmake @@ -13,13 +13,24 @@ The following components are supported: * ``Interpreter``: search for Python interpreter. * ``Compiler``: search for Python compiler. Only offered by IronPython. * ``Development``: search for development artifacts (include directories and - libraries). + libraries). This component includes two sub-components which can be specified + independently: + + * ``Development.Module``: search for artifacts for Python module + developments. + * ``Development.Embed``: search for artifacts for Python embedding + developments. + * ``NumPy``: search for NumPy include directories. If no ``COMPONENTS`` are specified, ``Interpreter`` is assumed. +If component ``Development`` is specified, it implies sub-components +``Development.Module`` and ``Development.Embed``. + To ensure consistent versions between components ``Interpreter``, ``Compiler``, -``Development`` and ``NumPy``, specify all components at the same time:: +``Development`` (or one of its sub-components) and ``NumPy``, specify all +components at the same time:: find_package (Python COMPONENTS Interpreter Development) @@ -30,10 +41,11 @@ To manage concurrent versions 3 and 2 of Python, use :module:`FindPython3` and .. note:: - If components ``Interpreter`` and ``Development`` are both specified, this - module search only for interpreter with same platform architecture as the one - defined by ``CMake`` configuration. This contraint does not apply if only - ``Interpreter`` component is specified. + If components ``Interpreter`` and ``Development`` (or one of its + sub-components) are both specified, this module search only for interpreter + with same platform architecture as the one defined by ``CMake`` + configuration. This contraint does not apply if only ``Interpreter`` + component is specified. Imported Targets ^^^^^^^^^^^^^^^^ @@ -45,12 +57,12 @@ This module defines the following :ref:`Imported Targets <Imported Targets>` Python interpreter. Target defined if component ``Interpreter`` is found. ``Python::Compiler`` Python compiler. Target defined if component ``Compiler`` is found. +``Python::Module`` + Python library for Python module. Target defined if component + ``Development.Module`` is found. ``Python::Python`` Python library for Python embedding. Target defined if component - ``Development`` is found. -``Python::Module`` - Python library for Python module. Target defined if component ``Development`` - is found. + ``Development.Embed`` is found. ``Python::NumPy`` NumPy Python library. Target defined if component ``NumPy`` is found. @@ -115,6 +127,10 @@ This module will set the following variables in your project * IronPython ``Python_Development_FOUND`` System has the Python development artifacts. +``Python_Development.Module_FOUND`` + System has the Python development artifacts for Python module. +``Python_Development.Embed_FOUND`` + System has the Python development artifacts for Python embedding. ``Python_INCLUDE_DIRS`` The Python include directories. ``Python_LIBRARIES`` diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake index a990f0d..670a550 100644 --- a/Modules/FindPython/Support.cmake +++ b/Modules/FindPython/Support.cmake @@ -22,9 +22,9 @@ endif() if (NOT DEFINED _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR) message (FATAL_ERROR "FindPython: INTERNAL ERROR") endif() -if (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR EQUAL 3) +if (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR EQUAL "3") set(_${_PYTHON_PREFIX}_VERSIONS 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0) -elseif (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR EQUAL 2) +elseif (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR EQUAL "2") set(_${_PYTHON_PREFIX}_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0) else() message (FATAL_ERROR "FindPython: INTERNAL ERROR") @@ -484,7 +484,7 @@ function (_PYTHON_VALIDATE_INTERPRETER) cmake_parse_arguments (PARSE_ARGV 0 _PVI "EXACT;CHECK_EXISTS" "" "") if (_PVI_UNPARSED_ARGUMENTS) - set (expected_version ${_PVI_UNPARSED_ARGUMENTS}) + set (expected_version "${_PVI_UNPARSED_ARGUMENTS}") else() unset (expected_version) endif() @@ -572,7 +572,8 @@ function (_PYTHON_VALIDATE_INTERPRETER) endif() endif() - if (CMAKE_SIZEOF_VOID_P AND "Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS + if (CMAKE_SIZEOF_VOID_P AND ("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS + OR "Development.Embed" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) AND NOT CMAKE_CROSSCOMPILING) # In this case, interpreter must have same architecture as environment execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c @@ -595,18 +596,18 @@ function (_PYTHON_VALIDATE_INTERPRETER) endfunction() -function (_PYTHON_VALIDATE_COMPILER expected_version) +function (_PYTHON_VALIDATE_COMPILER) if (NOT _${_PYTHON_PREFIX}_COMPILER) return() endif() - cmake_parse_arguments (_PVC "EXACT;CHECK_EXISTS" "" "" ${ARGN}) + cmake_parse_arguments (PARSE_ARGV 0 _PVC "EXACT;CHECK_EXISTS" "" "") if (_PVC_UNPARSED_ARGUMENTS) set (major_version FALSE) - set (expected_version ${_PVC_UNPARSED_ARGUMENTS}) + set (expected_version "${_PVC_UNPARSED_ARGUMENTS}") else() set (major_version TRUE) - set (expected_version ${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}) + set (expected_version "${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}") set (_PVC_EXACT TRUE) endif() @@ -635,15 +636,15 @@ function (_PYTHON_VALIDATE_COMPILER expected_version) RESULT_VARIABLE result OUTPUT_VARIABLE version ERROR_QUIET) - file (REMOVE_RECURSE "${_${_PYTHON_PREFIX}_VERSION_DIR}") - - if (result OR (_PVC_EXACT AND NOT version VERSION_EQUAL expected_version) OR (version VERSION_LESS expected_version)) - # Compiler not usable or has wrong version - if (result) - set (_${_PYTHON_PREFIX}_Compiler_REASON_FAILURE "Cannot use the compiler \"${_${_PYTHON_PREFIX}_COMPILER}\"") - else() - set (_${_PYTHON_PREFIX}_Compiler_REASON_FAILURE "Wrong version for the compiler \"${_${_PYTHON_PREFIX}_COMPILER}\"") - endif() + file (REMOVE_RECURSE "${working_dir}") + if (result) + # compiler is not usable + set (_${_PYTHON_PREFIX}_Compiler_REASON_FAILURE "Cannot use the compiler \"${_${_PYTHON_PREFIX}_COMPILER}\"") + set_property (CACHE _${_PYTHON_PREFIX}_COMPILER PROPERTY VALUE "${_PYTHON_PREFIX}_COMPILER-NOTFOUND") + elseif ((_PVC_EXACT AND NOT version VERSION_EQUAL expected_version) + OR NOT version VERSION_GREATER_EQUAL expected_version) + # Compiler has wrong version + set (_${_PYTHON_PREFIX}_Compiler_REASON_FAILURE "Wrong version for the compiler \"${_${_PYTHON_PREFIX}_COMPILER}\"") set_property (CACHE _${_PYTHON_PREFIX}_COMPILER PROPERTY VALUE "${_PYTHON_PREFIX}_COMPILER-NOTFOUND") endif() endfunction() @@ -651,6 +652,7 @@ endfunction() function (_PYTHON_VALIDATE_LIBRARY) if (NOT _${_PYTHON_PREFIX}_LIBRARY_RELEASE) + unset (_${_PYTHON_PREFIX}_LIBRARY_DEBUG) return() endif() @@ -775,13 +777,30 @@ function (_PYTHON_SET_LIBRARY_DIRS _PYTHON_SLD_RESULT) list (APPEND _PYTHON_DIRS "${_PYTHON_DIR}") endif() endforeach() - if (_PYTHON_DIRS) - list (REMOVE_DUPLICATES _PYTHON_DIRS) - endif() + list (REMOVE_DUPLICATES _PYTHON_DIRS) set (${_PYTHON_SLD_RESULT} ${_PYTHON_DIRS} PARENT_SCOPE) endfunction() +function (_PYTHON_SET_DEVELOPMENT_MODULE_FOUND module) + if ("Development.${module}" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) + string(TOUPPER "${module}" id) + set (module_found TRUE) + + if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_${id}_ARTIFACTS + AND NOT _${_PYTHON_PREFIX}_LIBRARY_RELEASE) + set (module_found FALSE) + endif() + if ("INCLUDE_DIR" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_${id}_ARTIFACTS + AND NOT _${_PYTHON_PREFIX}_INCLUDE_DIR) + set (module_found FALSE) + endif() + + set (${_PYTHON_PREFIX}_Development.${module}_FOUND ${module_found} PARENT_SCOPE) + endif() +endfunction() + + # If major version is specified, it must be the same as internal major version if (DEFINED ${_PYTHON_PREFIX}_FIND_VERSION_MAJOR AND NOT ${_PYTHON_PREFIX}_FIND_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR) @@ -795,19 +814,42 @@ if (NOT ${_PYTHON_PREFIX}_FIND_COMPONENTS) set (${_PYTHON_PREFIX}_FIND_REQUIRED_Interpreter TRUE) endif() if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) - list (APPEND ${_PYTHON_PREFIX}_FIND_COMPONENTS "Interpreter" "Development") - list (REMOVE_DUPLICATES ${_PYTHON_PREFIX}_FIND_COMPONENTS) + list (APPEND ${_PYTHON_PREFIX}_FIND_COMPONENTS "Interpreter" "Development.Module") endif() -foreach (_${_PYTHON_PREFIX}_COMPONENT IN ITEMS Interpreter Compiler Development NumPy) +if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) + list (APPEND ${_PYTHON_PREFIX}_FIND_COMPONENTS "Development.Module" "Development.Embed") +endif() +list (REMOVE_DUPLICATES ${_PYTHON_PREFIX}_FIND_COMPONENTS) +foreach (_${_PYTHON_PREFIX}_COMPONENT IN ITEMS Interpreter Compiler Development Development.Module Development.Embed NumPy) set (${_PYTHON_PREFIX}_${_${_PYTHON_PREFIX}_COMPONENT}_FOUND FALSE) endforeach() +if (${_PYTHON_PREFIX}_FIND_REQUIRED_Development) + set (${_PYTHON_PREFIX}_FIND_REQUIRED_Development.Module TRUE) + set (${_PYTHON_PREFIX}_FIND_REQUIRED_Development.Embed TRUE) +endif() + +unset (_${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS) +unset (_${_PYTHON_PREFIX}_FIND_DEVELOPMENT_MODULE_ARTIFACTS) +unset (_${_PYTHON_PREFIX}_FIND_DEVELOPMENT_EMBED_ARTIFACTS) +if ("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) + if (CMAKE_SYSTEM_NAME MATCHES "^(Windows.*|CYGWIN|MSYS)$") + list (APPEND _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_MODULE_ARTIFACTS "LIBRARY") + endif() + list (APPEND _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_MODULE_ARTIFACTS "INCLUDE_DIR") +endif() +if ("Development.Embed" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) + list (APPEND _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_EMBED_ARTIFACTS "LIBRARY" "INCLUDE_DIR") +endif() +set (_${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS ${_${_PYTHON_PREFIX}_FIND_DEVELOPMENT_MODULE_ARTIFACTS} ${_${_PYTHON_PREFIX}_FIND_DEVELOPMENT_EMBED_ARTIFACTS}) +list (REMOVE_DUPLICATES _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS) + unset (_${_PYTHON_PREFIX}_FIND_VERSIONS) # Set versions to search ## default: search any version set (_${_PYTHON_PREFIX}_FIND_VERSIONS ${_${_PYTHON_PREFIX}_VERSIONS}) -if (${_PYTHON_PREFIX}_FIND_VERSION_COUNT GREATER 1) +if (${_PYTHON_PREFIX}_FIND_VERSION_COUNT GREATER "1") if (${_PYTHON_PREFIX}_FIND_VERSION_EXACT) set (_${_PYTHON_PREFIX}_FIND_VERSIONS ${${_PYTHON_PREFIX}_FIND_VERSION_MAJOR}.${${_PYTHON_PREFIX}_FIND_VERSION_MINOR}) else() @@ -962,6 +1004,63 @@ if (CMAKE_HOST_WIN32) string (APPEND _${_PYTHON_PREFIX}_SIGNATURE ":${_${_PYTHON_PREFIX}_FIND_REGISTRY}") endif() +function (_PYTHON_CHECK_DEVELOPMENT_SIGNATURE module) + if ("Development.${module}" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) + string (TOUPPER "${module}" id) + set (signature "${_${_PYTHON_PREFIX}_SIGNATURE}:") + if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_${id}_ARTIFACTS) + list (APPEND signature "${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}:") + endif() + if ("INCLUDE_DIR" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_${id}_ARTIFACTS) + list (APPEND signature "${_${_PYTHON_PREFIX}_INCLUDE_DIR}:") + endif() + string (MD5 signature "${signature}") + if (signature STREQUAL _${_PYTHON_PREFIX}_DEVELOPMENT_${id}_SIGNATURE) + if (${_PYTHON_PREFIX}_FIND_VERSION_EXACT) + set (exact EXACT) + endif() + if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_${id}_ARTIFACTS) + _python_validate_library (${${_PYTHON_PREFIX}_FIND_VERSION} ${exact} CHECK_EXISTS) + endif() + if ("INCLUDE_DIR" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_${id}_ARTIFACTS) + _python_validate_include_dir (${${_PYTHON_PREFIX}_FIND_VERSION} ${exact} CHECK_EXISTS) + endif() + else() + if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_${id}_ARTIFACTS) + unset (_${_PYTHON_PREFIX}_LIBRARY_RELEASE CACHE) + unset (_${_PYTHON_PREFIX}_LIBRARY_DEBUG CACHE) + endif() + if ("INCLUDE_DIR" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_${id}_ARTIFACTS) + unset (_${_PYTHON_PREFIX}_INCLUDE_DIR CACHE) + endif() + endif() + if (("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_${id}_ARTIFACTS + AND NOT _${_PYTHON_PREFIX}_LIBRARY_RELEASE) + OR ("INCLUDE_DIR" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_${id}_ARTIFACTS + AND NOT _${_PYTHON_PREFIX}_INCLUDE_DIR)) + unset (_${_PYTHON_PREFIX}_CONFIG CACHE) + unset (_${_PYTHON_PREFIX}_DEVELOPMENT_${id}_SIGNATURE CACHE) + endif() + endif() +endfunction() + +function (_PYTHON_COMPUTE_DEVELOPMENT_SIGNATURE module) + string (TOUPPER "${module}" id) + if (${_PYTHON_PREFIX}_Development.${module}_FOUND) + set (signature "${_${_PYTHON_PREFIX}_SIGNATURE}:") + if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_${id}_ARTIFACTS) + list (APPEND signature "${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}:") + endif() + if ("INCLUDE_DIR" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_${id}_ARTIFACTS) + list (APPEND signature "${_${_PYTHON_PREFIX}_INCLUDE_DIR}:") + endif() + string (MD5 signature "${signature}") + set (_${_PYTHON_PREFIX}_DEVELOPMENT_${id}_SIGNATURE "${signature}" CACHE INTERNAL "") + else() + unset (_${_PYTHON_PREFIX}_DEVELOPMENT_${id}_SIGNATURE CACHE) + endif() +endfunction() + unset (_${_PYTHON_PREFIX}_REQUIRED_VARS) unset (_${_PYTHON_PREFIX}_CACHED_VARS) @@ -973,7 +1072,8 @@ unset (_${_PYTHON_PREFIX}_NumPy_REASON_FAILURE) # first step, search for the interpreter if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) - list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS _${_PYTHON_PREFIX}_EXECUTABLE) + list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS _${_PYTHON_PREFIX}_EXECUTABLE + _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES) if (${_PYTHON_PREFIX}_FIND_REQUIRED_Interpreter) list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_EXECUTABLE) endif() @@ -1633,46 +1733,38 @@ endif() # third step, search for the development artifacts ## Development environment is not compatible with IronPython interpreter -if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS +if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS + OR "Development.Embed" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) AND NOT ${_PYTHON_PREFIX}_INTERPRETER_ID STREQUAL "IronPython") + if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS) list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS _${_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}_LIBRARIES - ${_PYTHON_PREFIX}_INCLUDE_DIRS) + _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG) endif() - - if (DEFINED _${_PYTHON_PREFIX}_LIBRARY_RELEASE OR DEFINED _${_PYTHON_PREFIX}_INCLUDE_DIR) - # compute development signature and check validity of definition - string (MD5 __${_PYTHON_PREFIX}_DEVELOPMENT_SIGNATURE "${_${_PYTHON_PREFIX}_SIGNATURE}:${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}:${_${_PYTHON_PREFIX}_INCLUDE_DIR}") - if (WIN32 AND NOT DEFINED _${_PYTHON_PREFIX}_LIBRARY_DEBUG) - set (_${_PYTHON_PREFIX}_LIBRARY_DEBUG "${_PYTHON_PREFIX}_LIBRARY_DEBUG-NOTFOUND" CACHE INTERNAL "") - endif() - if (NOT DEFINED _${_PYTHON_PREFIX}_INCLUDE_DIR) - set (_${_PYTHON_PREFIX}_INCLUDE_DIR "${_PYTHON_PREFIX}_INCLUDE_DIR-NOTFOUND" CACHE INTERNAL "") + if ("INCLUDE_DIR" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS) + list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS _${_PYTHON_PREFIX}_INCLUDE_DIR) + endif() + if (${_PYTHON_PREFIX}_FIND_REQUIRED_Development.Module) + if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_MODULE_ARTIFACTS) + list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_LIBRARIES) endif() - if (__${_PYTHON_PREFIX}_DEVELOPMENT_SIGNATURE STREQUAL _${_PYTHON_PREFIX}_DEVELOPMENT_SIGNATURE) - # check version validity - if (${_PYTHON_PREFIX}_FIND_VERSION_EXACT) - _python_validate_library (${${_PYTHON_PREFIX}_FIND_VERSION} EXACT CHECK_EXISTS) - _python_validate_include_dir (${${_PYTHON_PREFIX}_FIND_VERSION} EXACT CHECK_EXISTS) - else() - _python_validate_library (${${_PYTHON_PREFIX}_FIND_VERSION} CHECK_EXISTS) - _python_validate_include_dir (${${_PYTHON_PREFIX}_FIND_VERSION} CHECK_EXISTS) - endif() - else() - unset (_${_PYTHON_PREFIX}_LIBRARY_RELEASE CACHE) - unset (_${_PYTHON_PREFIX}_LIBRARY_DEBUG CACHE) - unset (_${_PYTHON_PREFIX}_INCLUDE_DIR CACHE) + if ("INCLUDE_DIR" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_MODULE_ARTIFACTS) + list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_INCLUDE_DIRS) endif() endif() - if (NOT _${_PYTHON_PREFIX}_LIBRARY_RELEASE OR NOT _${_PYTHON_PREFIX}_INCLUDE_DIR) - unset (_${_PYTHON_PREFIX}_CONFIG CACHE) - unset (_${_PYTHON_PREFIX}_DEVELOPMENT_SIGNATURE CACHE) + if (${_PYTHON_PREFIX}_FIND_REQUIRED_Development.Embed) + if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_EMBED_ARTIFACTS) + list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_LIBRARIES) + endif() + if ("INCLUDE_DIR" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_EMBED_ARTIFACTS) + list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_INCLUDE_DIRS) + endif() endif() + list (REMOVE_DUPLICATES _${_PYTHON_PREFIX}_REQUIRED_VARS) + + _python_check_development_signature (Module) + _python_check_development_signature (Embed) if (DEFINED ${_PYTHON_PREFIX}_LIBRARY AND IS_ABSOLUTE "${${_PYTHON_PREFIX}_LIBRARY}") @@ -1895,6 +1987,7 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS endif() endif() + if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS) if (NOT _${_PYTHON_PREFIX}_LIBRARY_RELEASE) if ((${_PYTHON_PREFIX}_Interpreter_FOUND AND NOT CMAKE_CROSSCOMPILING) OR _${_PYTHON_PREFIX}_CONFIG) # retrieve root install directory @@ -2139,9 +2232,16 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS HINTS "${_${_PYTHON_PREFIX}_PATH}" "${_${_PYTHON_PREFIX}_PATH2}" ${_${_PYTHON_PREFIX}_HINTS} PATH_SUFFIXES bin) endif() + endif() + if ("INCLUDE_DIR" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS) + while (NOT _${_PYTHON_PREFIX}_INCLUDE_DIR) + if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS + AND NOT _${_PYTHON_PREFIX}_LIBRARY_RELEASE) # Don't search for include dir if no library was founded - if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE AND NOT _${_PYTHON_PREFIX}_INCLUDE_DIR) + break() + endif() + if ((${_PYTHON_PREFIX}_Interpreter_FOUND AND NOT CMAKE_CROSSCOMPILING) OR _${_PYTHON_PREFIX}_CONFIG) _python_get_config_var (_${_PYTHON_PREFIX}_INCLUDE_DIRS INCLUDES) @@ -2160,10 +2260,11 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS endif() unset (_${_PYTHON_PREFIX}_INCLUDE_HINTS) + if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE) # Use the library's install prefix as a hint - if (${_${_PYTHON_PREFIX}_LIBRARY_RELEASE} MATCHES "^(.+/Frameworks/Python.framework/Versions/[0-9.]+)") + if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "^(.+/Frameworks/Python.framework/Versions/[0-9.]+)") list (APPEND _${_PYTHON_PREFIX}_INCLUDE_HINTS "${CMAKE_MATCH_1}") - elseif (${_${_PYTHON_PREFIX}_LIBRARY_RELEASE} MATCHES "^(.+)/lib(64|32)?/python[0-9.]+/config") + elseif (_${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "^(.+)/lib(64|32)?/python[0-9.]+/config") list (APPEND _${_PYTHON_PREFIX}_INCLUDE_HINTS "${CMAKE_MATCH_1}") elseif (DEFINED CMAKE_LIBRARY_ARCHITECTURE AND ${_${_PYTHON_PREFIX}_LIBRARY_RELEASE} MATCHES "^(.+)/lib/${CMAKE_LIBRARY_ARCHITECTURE}") list (APPEND _${_PYTHON_PREFIX}_INCLUDE_HINTS "${CMAKE_MATCH_1}") @@ -2173,6 +2274,7 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS get_filename_component (_${_PYTHON_PREFIX}_PREFIX "${_${_PYTHON_PREFIX}_PREFIX}" DIRECTORY) list (APPEND _${_PYTHON_PREFIX}_INCLUDE_HINTS "${_${_PYTHON_PREFIX}_PREFIX}") endif() + endif() _python_get_frameworks (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS ${_${_PYTHON_PREFIX}_VERSION}) _python_get_registries (_${_PYTHON_PREFIX}_REGISTRY_PATHS ${_${_PYTHON_PREFIX}_VERSION}) @@ -2228,7 +2330,9 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS # search header file in standard locations find_path (_${_PYTHON_PREFIX}_INCLUDE_DIR NAMES Python.h) - endif() + + break() + endwhile() set (${_PYTHON_PREFIX}_INCLUDE_DIRS "${_${_PYTHON_PREFIX}_INCLUDE_DIR}") @@ -2241,10 +2345,18 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS # retrieve version from header file _python_get_version (INCLUDE PREFIX _${_PYTHON_PREFIX}_INC_) + if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE) # update versioning if (_${_PYTHON_PREFIX}_INC_VERSION VERSION_EQUAL _${_PYTHON_PREFIX}_VERSION) set (_${_PYTHON_PREFIX}_VERSION_PATCH ${_${_PYTHON_PREFIX}_INC_VERSION_PATCH}) endif() + else() + set (_${_PYTHON_PREFIX}_VERSION ${_${_PYTHON_PREFIX}_INC_VERSION}) + set (_${_PYTHON_PREFIX}_VERSION_MAJOR ${_${_PYTHON_PREFIX}_INC_VERSION_MAJOR}) + set (_${_PYTHON_PREFIX}_VERSION_MINOR ${_${_PYTHON_PREFIX}_INC_VERSION_MINOR}) + set (_${_PYTHON_PREFIX}_VERSION_PATCH ${_${_PYTHON_PREFIX}_INC_VERSION_PATCH}) + endif() + endif() endif() if (NOT ${_PYTHON_PREFIX}_Interpreter_FOUND AND NOT ${_PYTHON_PREFIX}_Compiler_FOUND) @@ -2256,6 +2368,7 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS endif() # define public variables + if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS) set (${_PYTHON_PREFIX}_LIBRARY_DEBUG "${_${_PYTHON_PREFIX}_LIBRARY_DEBUG}") _python_select_library_configurations (${_PYTHON_PREFIX}) @@ -2280,37 +2393,42 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS _python_set_library_dirs (${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DIRS _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG) endif() + endif() - if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE AND _${_PYTHON_PREFIX}_INCLUDE_DIR) + if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE OR _${_PYTHON_PREFIX}_INCLUDE_DIR) if (${_PYTHON_PREFIX}_Interpreter_FOUND OR ${_PYTHON_PREFIX}_Compiler_FOUND) # development environment must be compatible with interpreter/compiler if ("${_${_PYTHON_PREFIX}_VERSION_MAJOR}.${_${_PYTHON_PREFIX}_VERSION_MINOR}" VERSION_EQUAL "${${_PYTHON_PREFIX}_VERSION_MAJOR}.${${_PYTHON_PREFIX}_VERSION_MINOR}" AND "${_${_PYTHON_PREFIX}_INC_VERSION_MAJOR}.${_${_PYTHON_PREFIX}_INC_VERSION_MINOR}" VERSION_EQUAL "${_${_PYTHON_PREFIX}_VERSION_MAJOR}.${_${_PYTHON_PREFIX}_VERSION_MINOR}") - set (${_PYTHON_PREFIX}_Development_FOUND TRUE) + _python_set_development_module_found (Module) + _python_set_development_module_found (Embed) endif() elseif (${_PYTHON_PREFIX}_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR AND "${_${_PYTHON_PREFIX}_INC_VERSION_MAJOR}.${_${_PYTHON_PREFIX}_INC_VERSION_MINOR}" VERSION_EQUAL "${_${_PYTHON_PREFIX}_VERSION_MAJOR}.${_${_PYTHON_PREFIX}_VERSION_MINOR}") - set (${_PYTHON_PREFIX}_Development_FOUND TRUE) + _python_set_development_module_found (Module) + _python_set_development_module_found (Embed) endif() if (DEFINED _${_PYTHON_PREFIX}_FIND_ABI AND (NOT _${_PYTHON_PREFIX}_ABI IN_LIST _${_PYTHON_PREFIX}_ABIFLAGS OR NOT _${_PYTHON_PREFIX}_INC_ABI IN_LIST _${_PYTHON_PREFIX}_ABIFLAGS)) - set (${_PYTHON_PREFIX}_Development_FOUND FALSE) + set (${_PYTHON_PREFIX}_Development.Module_FOUND FALSE) + set (${_PYTHON_PREFIX}_Development.Embed_FOUND FALSE) endif() endif() + if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS + AND ${_PYTHON_PREFIX}_Development.Module_FOUND + AND ${_PYTHON_PREFIX}_Development.Embed_FOUND) + set (${_PYTHON_PREFIX}_Development_FOUND TRUE) + endif() + if (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR VERSION_GREATER_EQUAL "3" AND NOT DEFINED ${_PYTHON_PREFIX}_SOABI) _python_get_config_var (${_PYTHON_PREFIX}_SOABI SOABI) endif() - if (${_PYTHON_PREFIX}_Development_FOUND) - # compute and save development signature - string (MD5 __${_PYTHON_PREFIX}_DEVELOPMENT_SIGNATURE "${_${_PYTHON_PREFIX}_SIGNATURE}:${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}:${_${_PYTHON_PREFIX}_INCLUDE_DIR}") - set (_${_PYTHON_PREFIX}_DEVELOPMENT_SIGNATURE "${__${_PYTHON_PREFIX}_DEVELOPMENT_SIGNATURE}" CACHE INTERNAL "") - else() - unset (_${_PYTHON_PREFIX}_DEVELOPMENT_SIGNATURE CACHE) - endif() + _python_compute_development_signature (Module) + _python_compute_development_signature (Embed) # Restore the original find library ordering if (DEFINED _${_PYTHON_PREFIX}_CMAKE_FIND_LIBRARY_SUFFIXES) @@ -2318,9 +2436,13 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS endif() if (${_PYTHON_PREFIX}_ARTIFACTS_INTERACTIVE) + if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS) set (${_PYTHON_PREFIX}_LIBRARY "${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}" CACHE FILEPATH "${_PYTHON_PREFIX} Library") + endif() + if ("INCLUDE_DIR" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS) set (${_PYTHON_PREFIX}_INCLUDE_DIR "${_${_PYTHON_PREFIX}_INCLUDE_DIR}" CACHE FILEPATH "${_PYTHON_PREFIX} Include Directory") endif() + endif() _python_mark_as_internal (_${_PYTHON_PREFIX}_LIBRARY_RELEASE _${_PYTHON_PREFIX}_LIBRARY_DEBUG @@ -2328,7 +2450,8 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG _${_PYTHON_PREFIX}_INCLUDE_DIR _${_PYTHON_PREFIX}_CONFIG - _${_PYTHON_PREFIX}_DEVELOPMENT_SIGNATURE) + _${_PYTHON_PREFIX}_DEVELOPMENT_MODULE_SIGNATURE + _${_PYTHON_PREFIX}_DEVELOPMENT_EMBED_SIGNATURE) endif() if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_Interpreter_FOUND) @@ -2342,7 +2465,7 @@ if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_Inte set (_${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR "${${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR}" CACHE INTERNAL "") elseif (DEFINED _${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR) # compute numpy signature. Depends on interpreter and development signatures - string (MD5 __${_PYTHON_PREFIX}_NUMPY_SIGNATURE "${_${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE}:${_${_PYTHON_PREFIX}_DEVELOPMENT_SIGNATURE}:${_${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR}") + string (MD5 __${_PYTHON_PREFIX}_NUMPY_SIGNATURE "${_${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE}:${_${_PYTHON_PREFIX}_DEVELOPMENT_MODULE_SIGNATURE}:${_${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR}") if (NOT __${_PYTHON_PREFIX}_NUMPY_SIGNATURE STREQUAL _${_PYTHON_PREFIX}_NUMPY_SIGNATURE OR NOT EXISTS "${_${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR}") unset (_${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR CACHE) @@ -2386,15 +2509,15 @@ if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_Inte unset (${_PYTHON_PREFIX}_NumPy_VERSION) endif() - # final step: set NumPy founded only if Development component is founded as well - set(${_PYTHON_PREFIX}_NumPy_FOUND ${${_PYTHON_PREFIX}_Development_FOUND}) + # final step: set NumPy founded only if Development.Module component is founded as well + set(${_PYTHON_PREFIX}_NumPy_FOUND ${${_PYTHON_PREFIX}_Development.Module_FOUND}) else() set (${_PYTHON_PREFIX}_NumPy_FOUND FALSE) endif() if (${_PYTHON_PREFIX}_NumPy_FOUND) # compute and save numpy signature - string (MD5 __${_PYTHON_PREFIX}_NUMPY_SIGNATURE "${_${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE}:${_${_PYTHON_PREFIX}_DEVELOPMENT_SIGNATURE}:${${_PYTHON_PREFIX}_NumPyINCLUDE_DIR}") + string (MD5 __${_PYTHON_PREFIX}_NUMPY_SIGNATURE "${_${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE}:${_${_PYTHON_PREFIX}_DEVELOPMENT_MODULE_SIGNATURE}:${${_PYTHON_PREFIX}_NumPyINCLUDE_DIR}") set (_${_PYTHON_PREFIX}_NUMPY_SIGNATURE "${__${_PYTHON_PREFIX}_NUMPY_SIGNATURE}" CACHE INTERNAL "") else() unset (_${_PYTHON_PREFIX}_NUMPY_SIGNATURE CACHE) @@ -2446,8 +2569,10 @@ if(_${_PYTHON_PREFIX}_CMAKE_ROLE STREQUAL "PROJECT") PROPERTY IMPORTED_LOCATION "${${_PYTHON_PREFIX}_COMPILER}") endif() - if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS - AND ${_PYTHON_PREFIX}_Development_FOUND) + if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS + AND ${_PYTHON_PREFIX}_Development.Module_FOUND) + OR ("Development.Embed" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS + AND ${_PYTHON_PREFIX}_Development.Embed_FOUND)) macro (__PYTHON_IMPORT_LIBRARY __name) if (${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "${CMAKE_SHARED_LIBRARY_SUFFIX}$" @@ -2508,31 +2633,35 @@ if(_${_PYTHON_PREFIX}_CMAKE_ROLE STREQUAL "PROJECT") endif() endmacro() + if (${_PYTHON_PREFIX}_Development.Embed_FOUND) __python_import_library (${_PYTHON_PREFIX}::Python) + endif() - if (CMAKE_SYSTEM_NAME MATCHES "^(Windows.*|CYGWIN|MSYS)$") - # On Windows/CYGWIN/MSYS, Python::Module is the same as Python::Python - # but ALIAS cannot be used because the imported library is not GLOBAL. - __python_import_library (${_PYTHON_PREFIX}::Module) - else() - if (NOT TARGET ${_PYTHON_PREFIX}::Module ) - add_library (${_PYTHON_PREFIX}::Module INTERFACE IMPORTED) - endif() - set_property (TARGET ${_PYTHON_PREFIX}::Module - PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${${_PYTHON_PREFIX}_INCLUDE_DIRS}") - - # When available, enforce shared library generation with undefined symbols - if (APPLE) - set_property (TARGET ${_PYTHON_PREFIX}::Module - PROPERTY INTERFACE_LINK_OPTIONS "LINKER:-undefined,dynamic_lookup") - endif() - if (CMAKE_SYSTEM_NAME STREQUAL "SunOS") - set_property (TARGET ${_PYTHON_PREFIX}::Module - PROPERTY INTERFACE_LINK_OPTIONS "LINKER:-z,nodefs") - endif() - if (CMAKE_SYSTEM_NAME STREQUAL "AIX") + if (${_PYTHON_PREFIX}_Development.Module_FOUND) + if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_MODULE_ARTIFACTS) + # On Windows/CYGWIN/MSYS, Python::Module is the same as Python::Python + # but ALIAS cannot be used because the imported library is not GLOBAL. + __python_import_library (${_PYTHON_PREFIX}::Module) + else() + if (NOT TARGET ${_PYTHON_PREFIX}::Module) + add_library (${_PYTHON_PREFIX}::Module INTERFACE IMPORTED) + endif() set_property (TARGET ${_PYTHON_PREFIX}::Module - PROPERTY INTERFACE_LINK_OPTIONS "LINKER:-b,erok") + PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${${_PYTHON_PREFIX}_INCLUDE_DIRS}") + + # When available, enforce shared library generation with undefined symbols + if (APPLE) + set_property (TARGET ${_PYTHON_PREFIX}::Module + PROPERTY INTERFACE_LINK_OPTIONS "LINKER:-undefined,dynamic_lookup") + endif() + if (CMAKE_SYSTEM_NAME STREQUAL "SunOS") + set_property (TARGET ${_PYTHON_PREFIX}::Module + PROPERTY INTERFACE_LINK_OPTIONS "LINKER:-z,nodefs") + endif() + if (CMAKE_SYSTEM_NAME STREQUAL "AIX") + set_property (TARGET ${_PYTHON_PREFIX}::Module + PROPERTY INTERFACE_LINK_OPTIONS "LINKER:-b,erok") + endif() endif() endif() @@ -2556,6 +2685,16 @@ if(_${_PYTHON_PREFIX}_CMAKE_ROLE STREQUAL "PROJECT") else() set (type MODULE) endif() + + if (type STREQUAL "MODULE" AND NOT TARGET ${prefix}::Module) + message (SEND_ERROR "${prefix}_ADD_LIBRARY: dependent target '${prefix}::Module' is not defined.\n Did you miss to request COMPONENT 'Development.Module'?") + return() + endif() + if (NOT type STREQUAL "MODULE" AND NOT TARGET ${prefix}::Python) + message (SEND_ERROR "${prefix}_ADD_LIBRARY: dependent target '${prefix}::Python' is not defined.\n Did you miss to request COMPONENT 'Development.Embed'?") + return() + endif() + add_library (${name} ${type} ${PYTHON_ADD_LIBRARY_UNPARSED_ARGUMENTS}) get_property (type TARGET ${name} PROPERTY TYPE) diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake index 3d9ceb4..ef3280f 100644 --- a/Modules/FindPython2.cmake +++ b/Modules/FindPython2.cmake @@ -13,13 +13,24 @@ The following components are supported: * ``Interpreter``: search for Python 2 interpreter * ``Compiler``: search for Python 2 compiler. Only offered by IronPython. * ``Development``: search for development artifacts (include directories and - libraries) + libraries). This component includes two sub-components which can be specified + independently: + + * ``Development.Module``: search for artifacts for Python 2 module + developments. + * ``Development.Embed``: search for artifacts for Python 2 embedding + developments. + * ``NumPy``: search for NumPy include directories. If no ``COMPONENTS`` are specified, ``Interpreter`` is assumed. +If component ``Development`` is specified, it implies sub-components +``Development.Module`` and ``Development.Embed``. + To ensure consistent versions between components ``Interpreter``, ``Compiler``, -``Development`` and ``NumPy``, specify all components at the same time:: +``Development`` (or one of its sub-components) and ``NumPy``, specify all +components at the same time:: find_package (Python2 COMPONENTS Interpreter Development) @@ -31,10 +42,11 @@ for you. .. note:: - If components ``Interpreter`` and ``Development`` are both specified, this - module search only for interpreter with same platform architecture as the one - defined by ``CMake`` configuration. This contraint does not apply if only - ``Interpreter`` component is specified. + If components ``Interpreter`` and ``Development`` (or one of its + sub-components) are both specified, this module search only for interpreter + with same platform architecture as the one defined by ``CMake`` + configuration. This contraint does not apply if only ``Interpreter`` + component is specified. Imported Targets ^^^^^^^^^^^^^^^^ @@ -46,12 +58,12 @@ This module defines the following :ref:`Imported Targets <Imported Targets>` Python 2 interpreter. Target defined if component ``Interpreter`` is found. ``Python2::Compiler`` Python 2 compiler. Target defined if component ``Compiler`` is found. -``Python2::Python`` - Python 2 library for Python embedding. Target defined if component - ``Development`` is found. ``Python2::Module`` Python 2 library for Python module. Target defined if component - ``Development`` is found. + ``Development.Module`` is found. +``Python2::Python`` + Python 2 library for Python embedding. Target defined if component + ``Development.Embed`` is found. ``Python2::NumPy`` NumPy library for Python 2. Target defined if component ``NumPy`` is found. @@ -107,6 +119,10 @@ This module will set the following variables in your project * IronPython ``Python2_Development_FOUND`` System has the Python 2 development artifacts. +``Python2_Development.Module_FOUND`` + System has the Python 2 development artifacts for Python module. +``Python2_Development.Embed_FOUND`` + System has the Python 2 development artifacts for Python embedding. ``Python2_INCLUDE_DIRS`` The Python 2 include directories. ``Python2_LIBRARIES`` diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake index 122316b..1373407 100644 --- a/Modules/FindPython3.cmake +++ b/Modules/FindPython3.cmake @@ -13,13 +13,24 @@ The following components are supported: * ``Interpreter``: search for Python 3 interpreter * ``Compiler``: search for Python 3 compiler. Only offered by IronPython. * ``Development``: search for development artifacts (include directories and - libraries) + libraries). This component includes two sub-components which can be specified + independently: + + * ``Development.Module``: search for artifacts for Python 3 module + developments. + * ``Development.Embed``: search for artifacts for Python 3 embedding + developments. + * ``NumPy``: search for NumPy include directories. If no ``COMPONENTS`` are specified, ``Interpreter`` is assumed. +If component ``Development`` is specified, it implies sub-components +``Development.Module`` and ``Development.Embed``. + To ensure consistent versions between components ``Interpreter``, ``Compiler``, -``Development`` and ``NumPy``, specify all components at the same time:: +``Development`` (or one of its sub-components) and ``NumPy``, specify all +components at the same time:: find_package (Python3 COMPONENTS Interpreter Development) @@ -31,10 +42,11 @@ for you. .. note:: - If components ``Interpreter`` and ``Development`` are both specified, this - module search only for interpreter with same platform architecture as the one - defined by ``CMake`` configuration. This contraint does not apply if only - ``Interpreter`` component is specified. + If components ``Interpreter`` and ``Development`` (or one of its + sub-components) are both specified, this module search only for interpreter + with same platform architecture as the one defined by ``CMake`` + configuration. This contraint does not apply if only ``Interpreter`` + component is specified. Imported Targets ^^^^^^^^^^^^^^^^ @@ -46,12 +58,12 @@ This module defines the following :ref:`Imported Targets <Imported Targets>` Python 3 interpreter. Target defined if component ``Interpreter`` is found. ``Python3::Compiler`` Python 3 compiler. Target defined if component ``Compiler`` is found. -``Python3::Python`` - Python 3 library for Python embedding. Target defined if component - ``Development`` is found. ``Python3::Module`` Python 3 library for Python module. Target defined if component - ``Development`` is found. + ``Development.Module`` is found. +``Python3::Python`` + Python 3 library for Python embedding. Target defined if component + ``Development.Embed`` is found. ``Python3::NumPy`` NumPy library for Python 3. Target defined if component ``NumPy`` is found. @@ -116,6 +128,10 @@ This module will set the following variables in your project * IronPython ``Python3_Development_FOUND`` System has the Python 3 development artifacts. +``Python3_Development.Module_FOUND`` + System has the Python 3 development artifacts for Python module. +``Python3_Development.Embed_FOUND`` + System has the Python 3 development artifacts for Python embedding. ``Python3_INCLUDE_DIRS`` The Python 3 include directories. ``Python3_LIBRARIES`` diff --git a/Modules/FindSquish.cmake b/Modules/FindSquish.cmake index 7d49505..eec8876 100644 --- a/Modules/FindSquish.cmake +++ b/Modules/FindSquish.cmake @@ -137,7 +137,8 @@ if(NOT SQUISH_INSTALL_DIR) string(REPLACE "//" "/" SQUISH_INSTALL_DIR_SEARCH "${SQUISH_INSTALL_DIR_SEARCH}") # Look for an installation - find_path(SQUISH_INSTALL_DIR bin/squishrunner + find_path(SQUISH_INSTALL_DIR + NAMES bin/squishrunner bin/squishrunner.exe HINTS # Look for an environment variable SQUISH_INSTALL_DIR. ENV SQUISH_INSTALL_DIR @@ -259,10 +260,6 @@ function(SQUISH_V4_ADD_TEST testName) message(FATAL_ERROR "Required argument TEST not given for SQUISH_ADD_TEST()") endif() - get_target_property(testAUTLocation ${_SQUISH_AUT} LOCATION) - get_filename_component(testAUTDir ${testAUTLocation} PATH) - get_filename_component(testAUTName ${testAUTLocation} NAME) - get_filename_component(absTestSuite "${_SQUISH_SUITE}" ABSOLUTE) if(NOT EXISTS "${absTestSuite}") message(FATAL_ERROR "Could not find squish test suite ${_SQUISH_SUITE} (checked ${absTestSuite})") @@ -277,11 +274,11 @@ function(SQUISH_V4_ADD_TEST testName) set(_SQUISH_SETTINGSGROUP "CTest_$ENV{LOGNAME}") endif() - add_test(${testName} - ${CMAKE_COMMAND} -V -VV + add_test(NAME ${testName} + COMMAND ${CMAKE_COMMAND} -V -VV "-Dsquish_version:STRING=4" - "-Dsquish_aut:STRING=${testAUTName}" - "-Dsquish_aut_dir:STRING=${testAUTDir}" + "-Dsquish_aut:STRING=$<TARGET_FILE_NAME:${_SQUISH_AUT}>" + "-Dsquish_aut_dir:STRING=$<TARGET_FILE_DIR:${_SQUISH_AUT}>" "-Dsquish_server_executable:STRING=${SQUISH_SERVER_EXECUTABLE}" "-Dsquish_client_executable:STRING=${SQUISH_CLIENT_EXECUTABLE}" "-Dsquish_libqtdir:STRING=${QT_LIBRARY_DIR}" diff --git a/Modules/Platform/Darwin-Initialize.cmake b/Modules/Platform/Darwin-Initialize.cmake index 80e668e..80e9a40 100644 --- a/Modules/Platform/Darwin-Initialize.cmake +++ b/Modules/Platform/Darwin-Initialize.cmake @@ -133,6 +133,80 @@ function(_apple_resolve_sdk_path sdk_name ret) ) set(${ret} "${_stdout}" PARENT_SCOPE) endfunction() + +function(_apple_resolve_supported_archs_for_sdk_from_system_lib sdk_path ret ret_failed) + # Detect the supported SDK architectures by inspecting the main libSystem library. + set(common_lib_prefix "${sdk_path}/usr/lib/libSystem") + set(system_lib_dylib_path "${common_lib_prefix}.dylib") + set(system_lib_tbd_path "${common_lib_prefix}.tbd") + + # Newer SDKs ship text based dylib stub files which contain the architectures supported by the + # library in text form. + if(EXISTS "${system_lib_tbd_path}") + file(STRINGS "${system_lib_tbd_path}" tbd_lines REGEX "^archs: +\\[.+\\]") + if(NOT tbd_lines) + set(${ret_failed} TRUE PARENT_SCOPE) + return() + endif() + + # The tbd architectures line looks like the following: + # archs: [ armv7, armv7s, arm64, arm64e ] + list(GET tbd_lines 0 first_arch_line) + string(REGEX REPLACE + "archs: +\\[ (.+) \\]" "\\1" arches_comma_separated "${first_arch_line}") + string(STRIP "${arches_comma_separated}" arches_comma_separated) + string(REPLACE "," ";" arch_list "${arches_comma_separated}") + string(REPLACE " " "" arch_list "${arch_list}") + if(NOT arch_list) + set(${ret_failed} TRUE PARENT_SCOPE) + return() + endif() + set(${ret} "${arch_list}" PARENT_SCOPE) + elseif(EXISTS "${system_lib_dylib_path}") + # Old SDKs (Xcode < 7) ship dylib files, use lipo to inspect the supported architectures. + # Can't use -archs because the option is not available in older Xcode versions. + execute_process( + COMMAND lipo -info ${system_lib_dylib_path} + OUTPUT_VARIABLE lipo_output + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_VARIABLE _stderr + RESULT_VARIABLE _failed + ) + if(_failed OR NOT lipo_output OR NOT lipo_output MATCHES "(Non-fat file:|Architectures in the fat file:)") + set(${ret_failed} TRUE PARENT_SCOPE) + return() + endif() + + # The lipo output looks like the following: + # Non-fat file: <path> is architecture: i386 + # Architectures in the fat file: <path> are: i386 x86_64 + string(REGEX REPLACE + "^(.+)is architecture:(.+)" "\\2" arches_space_separated "${lipo_output}") + string(REGEX REPLACE + "^(.+)are:(.+)" "\\2" arches_space_separated "${arches_space_separated}") + + # Need to clean up the arches, with Xcode 4.6.3 the output of lipo -info contains some + # additional info, e.g. + # Architectures in the fat file: <path> are: armv7 (cputype (12) cpusubtype (11)) + string(REGEX REPLACE + "\\(.+\\)" "" arches_space_separated "${arches_space_separated}") + + # The output is space separated. + string(STRIP "${arches_space_separated}" arches_space_separated) + string(REPLACE " " ";" arch_list "${arches_space_separated}") + + if(NOT arch_list) + set(${ret_failed} TRUE PARENT_SCOPE) + return() + endif() + set(${ret} "${arch_list}" PARENT_SCOPE) + else() + # This shouldn't happen, but keep it for safety. + message(WARNING "No way to find architectures for given sdk_path '${sdk_path}'") + set(${ret_failed} TRUE PARENT_SCOPE) + endif() +endfunction() + # Handle multi-arch sysroots. Do this before CMAKE_OSX_SYSROOT is # transformed into a path, so that we know the sysroot name. function(_apple_resolve_multi_arch_sysroots) @@ -166,13 +240,8 @@ function(_apple_resolve_multi_arch_sysroots) continue() endif() - execute_process( - COMMAND plutil -extract SupportedTargets.${sdk}.Archs json ${_sdk_path}/SDKSettings.plist -o - - OUTPUT_VARIABLE _sdk_archs_json - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_VARIABLE _stderr - RESULT_VARIABLE _failed - ) + _apple_resolve_supported_archs_for_sdk_from_system_lib(${_sdk_path} _sdk_archs _failed) + if(_failed) # Failure to extract supported architectures for an SDK means that the installed SDK is old # and does not provide such information (SDKs that come with Xcode >= 10.x started providing @@ -181,10 +250,6 @@ function(_apple_resolve_multi_arch_sysroots) return() endif() - # Poor man's JSON decoding - string(REGEX REPLACE "[]\\[\"]" "" _sdk_archs ${_sdk_archs_json}) - string(REPLACE "," ";" _sdk_archs ${_sdk_archs}) - set(_sdk_archs_${sdk} ${_sdk_archs}) set(_sdk_path_${sdk} ${_sdk_path}) endforeach() diff --git a/Modules/Platform/Windows-NVIDIA-CUDA.cmake b/Modules/Platform/Windows-NVIDIA-CUDA.cmake index 2f50280..f425cf8 100644 --- a/Modules/Platform/Windows-NVIDIA-CUDA.cmake +++ b/Modules/Platform/Windows-NVIDIA-CUDA.cmake @@ -46,9 +46,9 @@ endforeach() unset(__IMPLICT_DLINK_DIRS) set(CMAKE_CUDA_DEVICE_LINK_LIBRARY - "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS${__IMPLICT_DLINK_FLAGS}") + "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS${__IMPLICT_DLINK_FLAGS}") set(CMAKE_CUDA_DEVICE_LINK_EXECUTABLE - "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <FLAGS> ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS${__IMPLICT_DLINK_FLAGS}") + "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS${__IMPLICT_DLINK_FLAGS}") unset(__IMPLICT_DLINK_FLAGS) string(REPLACE "/D" "-D" _PLATFORM_DEFINES_CUDA "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_CXX}") diff --git a/Modules/Squish4RunTestCase.bat b/Modules/Squish4RunTestCase.bat index ad1cc8c..5bd815a 100755 --- a/Modules/Squish4RunTestCase.bat +++ b/Modules/Squish4RunTestCase.bat @@ -12,7 +12,7 @@ echo "Adding AUT... %SQUISHSERVER% --config addAUT %AUT% %AUTDIR%" %SQUISHSERVER% --config addAUT "%AUT%" "%AUTDIR%" echo "Starting the squish server... %SQUISHSERVER%" -start /B %SQUISHSERVER% +start /B "Squish Server" %SQUISHSERVER% echo "Running the test case...%SQUISHRUNNER% --testsuite %TESTSUITE% --testcase %TESTCASE%" %SQUISHRUNNER% --testsuite "%TESTSUITE%" --testcase "%TESTCASE%" diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2ce3006..f376bd4 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 17) -set(CMake_VERSION_PATCH 20200415) +set(CMake_VERSION_PATCH 20200427) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index e481d13..72af10b 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -6,13 +6,13 @@ #include <cm/memory> #include <cm/string_view> +#include <cmext/algorithm> #include "cmsys/Directory.hxx" #include "cmsys/Encoding.hxx" #include "cmsys/FStream.hxx" #include "cmsys/SystemTools.hxx" -#include "cmAlgorithms.h" #include "cmCPackComponentGroup.h" #include "cmCPackLog.h" #include "cmCryptoHash.h" @@ -954,7 +954,7 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitions( shortcut.workingDirectoryId = directoryId; shortcuts.insert(cmWIXShortcuts::START_MENU, id, shortcut); - if (cmContains(desktopExecutables, executableName)) { + if (cm::contains(desktopExecutables, executableName)) { shortcuts.insert(cmWIXShortcuts::DESKTOP, id, shortcut); } } diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index c30a57a..8eca2ff 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -487,6 +487,7 @@ int cmCPackDebGenerator::PackageOnePack(std::string const& initialTopLevel, findExpr += "/*"; gl.RecurseOn(); gl.SetRecurseListDirs(true); + gl.SetRecurseThroughSymlinks(false); if (!gl.FindFiles(findExpr)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find any files in the installed directory" @@ -511,6 +512,7 @@ int cmCPackDebGenerator::PackageOnePack(std::string const& initialTopLevel, findExpr += "/*"; gl.RecurseOn(); gl.SetRecurseListDirs(true); + gl.SetRecurseThroughSymlinks(false); if (!gl.FindFiles(findExpr)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find any files in the installed directory" @@ -630,6 +632,7 @@ int cmCPackDebGenerator::PackageComponentsAllInOne( findExpr += "/*"; gl.RecurseOn(); gl.SetRecurseListDirs(true); + gl.SetRecurseThroughSymlinks(false); if (!gl.FindFiles(findExpr)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find any files in the installed directory" diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 43f0d3c..08fd2a2 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -354,6 +354,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( "- Install directory: " << top << std::endl); gl.RecurseOn(); gl.SetRecurseListDirs(true); + gl.SetRecurseThroughSymlinks(false); if (!gl.FindFiles(findExpr)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find any files in the installed directory" @@ -862,6 +863,7 @@ int cmCPackGenerator::InstallCMakeProject( findExpr += "/*"; glB.RecurseOn(); glB.SetRecurseListDirs(true); + glB.SetRecurseThroughSymlinks(false); glB.FindFiles(findExpr); filesBefore = glB.GetFiles(); std::sort(filesBefore.begin(), filesBefore.end()); diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 3067f96..058b090 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -9,10 +9,11 @@ #include <sstream> #include <utility> +#include <cmext/algorithm> + #include "cmsys/Directory.hxx" #include "cmsys/RegularExpression.hxx" -#include "cmAlgorithms.h" #include "cmCPackComponentGroup.h" #include "cmCPackGenerator.h" #include "cmCPackLog.h" @@ -529,7 +530,7 @@ int cmCPackNSISGenerator::InitializeInternal() << ".lnk\"" << std::endl; // see if CPACK_CREATE_DESKTOP_LINK_ExeName is on // if so add a desktop link - if (cmContains(cpackPackageDesktopLinksVector, execName)) { + if (cm::contains(cpackPackageDesktopLinksVector, execName)) { str << " StrCmp \"$INSTALL_DESKTOP\" \"1\" 0 +2\n"; str << " CreateShortCut \"$DESKTOP\\" << linkName << R"(.lnk" "$INSTDIR\)" << cpackNsisExecutablesDirectory << "\\" diff --git a/Source/CTest/cmCTestCoverageCommand.cxx b/Source/CTest/cmCTestCoverageCommand.cxx index d6e6be3..e335923 100644 --- a/Source/CTest/cmCTestCoverageCommand.cxx +++ b/Source/CTest/cmCTestCoverageCommand.cxx @@ -4,9 +4,10 @@ #include <set> +#include <cmext/algorithm> + #include "cm_static_string_view.hxx" -#include "cmAlgorithms.h" #include "cmCTest.h" #include "cmCTestCoverageHandler.h" @@ -22,7 +23,7 @@ void cmCTestCoverageCommand::CheckArguments( std::vector<std::string> const& keywords) { this->LabelsMentioned = - !this->Labels.empty() || cmContains(keywords, "LABELS"); + !this->Labels.empty() || cm::contains(keywords, "LABELS"); } cmCTestGenericHandler* cmCTestCoverageCommand::InitializeHandler() diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 7ad87f5..85b8ab1 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -10,11 +10,12 @@ #include <sstream> #include <utility> +#include <cmext/algorithm> + #include "cmsys/FStream.hxx" #include "cmsys/Glob.hxx" #include "cmsys/RegularExpression.hxx" -#include "cmAlgorithms.h" #include "cmCTest.h" #include "cmDuration.h" #include "cmSystemTools.h" @@ -297,9 +298,6 @@ void cmCTestMemCheckHandler::PopulateCustomVectors(cmMakefile* mf) this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_MEMCHECK_IGNORE", this->CustomTestsIgnore); - std::string cmake = cmSystemTools::GetCMakeCommand(); - this->CTest->SetCTestConfiguration("CMakeCommand", cmake.c_str(), - this->Quiet); } int cmCTestMemCheckHandler::GetDefectCount() @@ -490,31 +488,31 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() } if (this->CTest->GetCTestConfiguration("MemoryCheckType") == "AddressSanitizer") { - this->MemoryTester = this->CTest->GetCTestConfiguration("CMakeCommand"); + this->MemoryTester = cmSystemTools::GetCMakeCommand(); this->MemoryTesterStyle = cmCTestMemCheckHandler::ADDRESS_SANITIZER; this->LogWithPID = true; // even if we give the log file the pid is added } if (this->CTest->GetCTestConfiguration("MemoryCheckType") == "LeakSanitizer") { - this->MemoryTester = this->CTest->GetCTestConfiguration("CMakeCommand"); + this->MemoryTester = cmSystemTools::GetCMakeCommand(); this->MemoryTesterStyle = cmCTestMemCheckHandler::LEAK_SANITIZER; this->LogWithPID = true; // even if we give the log file the pid is added } if (this->CTest->GetCTestConfiguration("MemoryCheckType") == "ThreadSanitizer") { - this->MemoryTester = this->CTest->GetCTestConfiguration("CMakeCommand"); + this->MemoryTester = cmSystemTools::GetCMakeCommand(); this->MemoryTesterStyle = cmCTestMemCheckHandler::THREAD_SANITIZER; this->LogWithPID = true; // even if we give the log file the pid is added } if (this->CTest->GetCTestConfiguration("MemoryCheckType") == "MemorySanitizer") { - this->MemoryTester = this->CTest->GetCTestConfiguration("CMakeCommand"); + this->MemoryTester = cmSystemTools::GetCMakeCommand(); this->MemoryTesterStyle = cmCTestMemCheckHandler::MEMORY_SANITIZER; this->LogWithPID = true; // even if we give the log file the pid is added } if (this->CTest->GetCTestConfiguration("MemoryCheckType") == "UndefinedBehaviorSanitizer") { - this->MemoryTester = this->CTest->GetCTestConfiguration("CMakeCommand"); + this->MemoryTester = cmSystemTools::GetCMakeCommand(); this->MemoryTesterStyle = cmCTestMemCheckHandler::UB_SANITIZER; this->LogWithPID = true; // even if we give the log file the pid is added } @@ -594,11 +592,11 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() std::string tempDrMemoryDir = this->CTest->GetBinaryDir() + "/Testing/Temporary/DrMemory"; - if (!cmContains(this->MemoryTesterOptions, "-quiet")) { + if (!cm::contains(this->MemoryTesterOptions, "-quiet")) { this->MemoryTesterOptions.emplace_back("-quiet"); } - if (!cmContains(this->MemoryTesterOptions, "-batch")) { + if (!cm::contains(this->MemoryTesterOptions, "-batch")) { this->MemoryTesterOptions.emplace_back("-batch"); } diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 50c963d..5c37f97 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -29,7 +29,6 @@ #include "cm_uv.h" #include "cmAffinity.h" -#include "cmAlgorithms.h" #include "cmCTest.h" #include "cmCTestBinPacker.h" #include "cmCTestRunTest.h" @@ -138,7 +137,7 @@ void cmCTestMultiProcessHandler::RunTests() uv_run(&this->Loop, UV_RUN_DEFAULT); uv_loop_close(&this->Loop); - if (!this->StopTimePassed) { + if (!this->StopTimePassed && !this->CheckStopOnFailure()) { assert(this->Completed == this->Total); assert(this->Tests.empty()); } @@ -188,7 +187,7 @@ bool cmCTestMultiProcessHandler::StartTestProcess(int test) // Find any failed dependencies for this test. We assume the more common // scenario has no failed tests, so make it the outer loop. for (std::string const& f : *this->Failed) { - if (cmContains(this->Properties[test]->RequireSuccessDepends, f)) { + if (cm::contains(this->Properties[test]->RequireSuccessDepends, f)) { testRun->AddFailedDependency(f); } } @@ -368,6 +367,11 @@ void cmCTestMultiProcessHandler::CheckResourcesAvailable() } } +bool cmCTestMultiProcessHandler::CheckStopOnFailure() +{ + return this->CTest->GetStopOnFailure(); +} + bool cmCTestMultiProcessHandler::CheckStopTimePassed() { if (!this->StopTimePassed) { @@ -445,7 +449,7 @@ bool cmCTestMultiProcessHandler::StartTest(int test) { // Check for locked resources for (std::string const& i : this->Properties[test]->LockedResources) { - if (cmContains(this->LockedResources, i)) { + if (cm::contains(this->LockedResources, i)) { return false; } } @@ -484,6 +488,10 @@ void cmCTestMultiProcessHandler::StartNextTests() return; } + if (this->CheckStopOnFailure() && !this->Failed->empty()) { + return; + } + size_t numToStart = 0; if (this->RunningCount < this->ParallelLevel) { @@ -802,7 +810,7 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList() // In parallel test runs add previously failed tests to the front // of the cost list and queue other tests for further sorting for (auto const& t : this->Tests) { - if (cmContains(this->LastTestsFailed, this->Properties[t.first]->Name)) { + if (cm::contains(this->LastTestsFailed, this->Properties[t.first]->Name)) { // If the test failed last time, it should be run first. this->SortedTests.push_back(t.first); alreadySortedTests.insert(t.first); @@ -841,7 +849,7 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList() TestComparator(this)); for (auto const& j : sortedCopy) { - if (!cmContains(alreadySortedTests, j)) { + if (!cm::contains(alreadySortedTests, j)) { this->SortedTests.push_back(j); alreadySortedTests.insert(j); } @@ -873,7 +881,7 @@ void cmCTestMultiProcessHandler::CreateSerialTestCostList() TestSet alreadySortedTests; for (int test : presortedList) { - if (cmContains(alreadySortedTests, test)) { + if (cm::contains(alreadySortedTests, test)) { continue; } @@ -881,7 +889,7 @@ void cmCTestMultiProcessHandler::CreateSerialTestCostList() GetAllTestDependencies(test, dependencies); for (int testDependency : dependencies) { - if (!cmContains(alreadySortedTests, testDependency)) { + if (!cm::contains(alreadySortedTests, testDependency)) { alreadySortedTests.insert(testDependency); this->SortedTests.push_back(testDependency); } diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index c3686bc..6e999f9 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -138,6 +138,8 @@ protected: inline size_t GetProcessorsUsed(int index); std::string GetName(int index); + bool CheckStopOnFailure(); + bool CheckStopTimePassed(); void SetStopTimePassed(); diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index acb75b2..5b2f2e6 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -8,10 +8,10 @@ #include <cm/memory> #include <cm/vector> +#include <cmext/algorithm> #include "cm_static_string_view.hxx" -#include "cmAlgorithms.h" #include "cmCTest.h" #include "cmCTestSubmitHandler.h" #include "cmCommand.h" @@ -172,8 +172,10 @@ void cmCTestSubmitCommand::BindArguments() void cmCTestSubmitCommand::CheckArguments( std::vector<std::string> const& keywords) { - this->PartsMentioned = !this->Parts.empty() || cmContains(keywords, "PARTS"); - this->FilesMentioned = !this->Files.empty() || cmContains(keywords, "FILES"); + this->PartsMentioned = + !this->Parts.empty() || cm::contains(keywords, "PARTS"); + this->FilesMentioned = + !this->Files.empty() || cm::contains(keywords, "FILES"); cm::erase_if(this->Parts, [this](std::string const& arg) -> bool { cmCTest::Part p = this->CTest->GetPartFromName(arg.c_str()); diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx index c5f683d..6b317cb 100644 --- a/Source/CTest/cmCTestTestCommand.cxx +++ b/Source/CTest/cmCTestTestCommand.cxx @@ -34,6 +34,7 @@ void cmCTestTestCommand::BindArguments() this->Bind("STOP_TIME"_s, this->StopTime); this->Bind("TEST_LOAD"_s, this->TestLoad); this->Bind("RESOURCE_SPEC_FILE"_s, this->ResourceSpecFile); + this->Bind("STOP_ON_FAILURE"_s, this->StopOnFailure); } cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler() @@ -90,6 +91,9 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler() handler->SetOption("ExcludeFixtureCleanupRegularExpression", this->ExcludeFixtureCleanup.c_str()); } + if (this->StopOnFailure) { + handler->SetOption("StopOnFailure", "ON"); + } if (!this->ParallelLevel.empty()) { handler->SetOption("ParallelLevel", this->ParallelLevel.c_str()); } diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h index 2345afb..7925586 100644 --- a/Source/CTest/cmCTestTestCommand.h +++ b/Source/CTest/cmCTestTestCommand.h @@ -60,6 +60,7 @@ protected: std::string StopTime; std::string TestLoad; std::string ResourceSpecFile; + bool StopOnFailure = false; }; #endif diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index ca65946..2408d57 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -19,6 +19,7 @@ #include <cm/memory> #include <cm/string_view> +#include <cmext/algorithm> #include "cmsys/FStream.hxx" #include <cmsys/Base64.h> @@ -28,7 +29,6 @@ #include "cm_static_string_view.hxx" #include "cm_utf8.h" -#include "cmAlgorithms.h" #include "cmCTest.h" #include "cmCTestMultiProcessHandler.h" #include "cmCTestResourceGroupsLexerHelper.h" @@ -514,6 +514,10 @@ bool cmCTestTestHandler::ProcessOptions() this->CTest->SetParallelLevel(atoi(this->GetOption("ParallelLevel"))); } + if (this->GetOption("StopOnFailure")) { + this->CTest->SetStopOnFailure(true); + } + const char* val; val = this->GetOption("LabelRegularExpression"); if (val) { @@ -711,7 +715,7 @@ void cmCTestTestHandler::PrintLabelOrSubprojectSummary(bool doSubProject) cmCTestTestProperties& p = *result.Properties; for (std::string const& l : p.Labels) { // only use labels found in labels - if (cmContains(labels, l)) { + if (cm::contains(labels, l)) { labelTimes[l] += result.ExecutionTime.count() * result.Properties->Processors; ++labelCounts[l]; @@ -853,14 +857,15 @@ void cmCTestTestHandler::ComputeTestList() if (this->UseUnion) { // if it is not in the list and not in the regexp then skip - if ((!this->TestsToRun.empty() && !cmContains(this->TestsToRun, cnt)) && + if ((!this->TestsToRun.empty() && + !cm::contains(this->TestsToRun, cnt)) && !tp.IsInBasedOnREOptions) { continue; } } else { // is this test in the list of tests to run? If not then skip it if ((!this->TestsToRun.empty() && - !cmContains(this->TestsToRun, inREcnt)) || + !cm::contains(this->TestsToRun, inREcnt)) || !tp.IsInBasedOnREOptions) { continue; } @@ -889,7 +894,7 @@ void cmCTestTestHandler::ComputeTestListForRerunFailed() cnt++; // if this test is not in our list of tests to run, then skip it. - if (!this->TestsToRun.empty() && !cmContains(this->TestsToRun, cnt)) { + if (!this->TestsToRun.empty() && !cm::contains(this->TestsToRun, cnt)) { continue; } @@ -1008,7 +1013,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const for (auto sIt = setupRange.first; sIt != setupRange.second; ++sIt) { const std::string& setupTestName = sIt->second->Name; tests[i].RequireSuccessDepends.insert(setupTestName); - if (!cmContains(tests[i].Depends, setupTestName)) { + if (!cm::contains(tests[i].Depends, setupTestName)) { tests[i].Depends.push_back(setupTestName); } } @@ -1112,7 +1117,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const const std::vector<size_t>& indices = cIt->second; for (size_t index : indices) { const std::string& reqTestName = tests[index].Name; - if (!cmContains(p.Depends, reqTestName)) { + if (!cm::contains(p.Depends, reqTestName)) { p.Depends.push_back(reqTestName); } } @@ -1125,7 +1130,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const const std::vector<size_t>& indices = cIt->second; for (size_t index : indices) { const std::string& setupTestName = tests[index].Name; - if (!cmContains(p.Depends, setupTestName)) { + if (!cm::contains(p.Depends, setupTestName)) { p.Depends.push_back(setupTestName); } } diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index c0ac551..8b0aa5e 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -13,20 +13,12 @@ #include <utility> #include <vector> +#include <cmext/algorithm> + #include "cm_kwiml.h" #include "cmRange.h" -template <std::size_t N> -struct cmOverloadPriority : cmOverloadPriority<N - 1> -{ -}; - -template <> -struct cmOverloadPriority<0> -{ -}; - template <typename FwdIt> FwdIt cmRotate(FwdIt first, FwdIt middle, FwdIt last) { @@ -37,34 +29,6 @@ FwdIt cmRotate(FwdIt first, FwdIt middle, FwdIt last) return first; } -template <typename Range, typename Key> -auto cmContainsImpl(Range const& range, Key const& key, cmOverloadPriority<2>) - -> decltype(range.exists(key)) -{ - return range.exists(key); -} - -template <typename Range, typename Key> -auto cmContainsImpl(Range const& range, Key const& key, cmOverloadPriority<1>) - -> decltype(range.find(key) != range.end()) -{ - return range.find(key) != range.end(); -} - -template <typename Range, typename Key> -bool cmContainsImpl(Range const& range, Key const& key, cmOverloadPriority<0>) -{ - using std::begin; - using std::end; - return std::find(begin(range), end(range), key) != end(range); -} - -template <typename Range, typename Key> -bool cmContains(Range const& range, Key const& key) -{ - return cmContainsImpl(range, key, cmOverloadPriority<2>{}); -} - namespace ContainerAlgorithms { template <typename FwdIt> @@ -158,7 +122,7 @@ ForwardIterator cmRemoveDuplicates(ForwardIterator first, ForwardIterator last) ForwardIterator result = first; while (first != last) { - if (!cmContains(uniq, first)) { + if (!cm::contains(uniq, first)) { if (result != first) { *result = std::move(*first); } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 35a8952..c2b2a09 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -92,6 +92,7 @@ struct cmCTest::Private std::string ConfigType; std::string ScheduleType; std::chrono::system_clock::time_point StopTime; + bool StopOnFailure = false; bool TestProgressOutput = false; bool Verbose = false; bool ExtraVerbose = false; @@ -1932,6 +1933,10 @@ bool cmCTest::HandleCommandLineArguments(size_t& i, this->SetStopTime(args[i]); } + else if (this->CheckArgument(arg, "--stop-on-failure"_s)) { + this->Impl->StopOnFailure = true; + } + else if (this->CheckArgument(arg, "-C"_s, "--build-config") && i < args.size() - 1) { i++; @@ -2493,6 +2498,16 @@ void cmCTest::SetNotesFiles(const char* notes) this->Impl->NotesFiles = notes; } +bool cmCTest::GetStopOnFailure() const +{ + return this->Impl->StopOnFailure; +} + +void cmCTest::SetStopOnFailure(bool stop) +{ + this->Impl->StopOnFailure = stop; +} + std::chrono::system_clock::time_point cmCTest::GetStopTime() const { return this->Impl->StopTime; diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 984be13..a39b8fe 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -204,6 +204,9 @@ public: bool ShouldCompressTestOutput(); bool CompressString(std::string& str); + bool GetStopOnFailure() const; + void SetStopOnFailure(bool stop); + std::chrono::system_clock::time_point GetStopTime() const; void SetStopTime(std::string const& time); diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 31a8692..35bd681 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -19,12 +19,6 @@ #include "cmSystemTools.h" #include "cmVersion.h" -cmCacheManager::cmCacheManager() -{ - this->CacheMajorVersion = 0; - this->CacheMinorVersion = 0; -} - void cmCacheManager::CleanCMakeFiles(const std::string& path) { std::string glob = cmStrCat(path, "/CMakeFiles/*.cmake"); @@ -172,10 +166,10 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal, } const char* cmCacheManager::PersistentProperties[] = { "ADVANCED", "MODIFIED", - "STRINGS", nullptr }; + "STRINGS" }; -bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey, - CacheEntry& e) +bool cmCacheManager::ReadPropertyEntry(const std::string& entryKey, + const CacheEntry& e) { // All property entries are internal. if (e.Type != cmStateEnums::INTERNAL) { @@ -183,20 +177,18 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey, } const char* end = entryKey.c_str() + entryKey.size(); - for (const char** p = cmCacheManager::PersistentProperties; *p; ++p) { - std::string::size_type plen = strlen(*p) + 1; + for (const char* p : cmCacheManager::PersistentProperties) { + std::string::size_type plen = strlen(p) + 1; if (entryKey.size() > plen && *(end - plen) == '-' && - strcmp(end - plen + 1, *p) == 0) { + strcmp(end - plen + 1, p) == 0) { std::string key = entryKey.substr(0, entryKey.size() - plen); - cmCacheManager::CacheIterator it = this->GetCacheIterator(key); - if (it.IsAtEnd()) { + if (auto entry = this->GetCacheEntry(key)) { + // Store this property on its entry. + entry->SetProperty(p, e.Value.c_str()); + } else { // Create an entry and store the property. CacheEntry& ne = this->Cache[key]; - ne.Type = cmStateEnums::UNINITIALIZED; - ne.SetProperty(*p, e.Value.c_str()); - } else { - // Store this property on its entry. - it.SetProperty(*p, e.Value.c_str()); + ne.SetProperty(p, e.Value.c_str()); } return true; } @@ -204,16 +196,18 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey, return false; } -void cmCacheManager::WritePropertyEntries(std::ostream& os, CacheIterator i, - cmMessenger* messenger) +void cmCacheManager::WritePropertyEntries(std::ostream& os, + const std::string& entryKey, + const CacheEntry& e, + cmMessenger* messenger) const { - for (const char** p = cmCacheManager::PersistentProperties; *p; ++p) { - if (cmProp value = i.GetProperty(*p)) { + for (const char* p : cmCacheManager::PersistentProperties) { + if (cmProp value = e.GetProperty(p)) { std::string helpstring = - cmStrCat(*p, " property for variable: ", i.GetName()); + cmStrCat(p, " property for variable: ", entryKey); cmCacheManager::OutputHelpString(os, helpstring); - std::string key = cmStrCat(i.GetName(), '-', *p); + std::string key = cmStrCat(entryKey, '-', p); cmCacheManager::OutputKey(os, key); os << ":INTERNAL="; cmCacheManager::OutputValue(os, *value); @@ -322,25 +316,24 @@ bool cmCacheManager::SaveCache(const std::string& path, cmMessenger* messenger) "########################\n" "\n"; - for (cmCacheManager::CacheIterator i = this->NewIterator(); !i.IsAtEnd(); - i.Next()) { - if (!i.Initialized()) { + for (auto const& i : this->Cache) { + if (!i.second.Initialized) { continue; } - cmStateEnums::CacheEntryType t = i.GetType(); - this->WritePropertyEntries(fout, i, messenger); + cmStateEnums::CacheEntryType t = i.second.GetType(); + this->WritePropertyEntries(fout, i.first, i.second, messenger); if (t == cmStateEnums::INTERNAL) { // Format is key:type=value - if (cmProp help = i.GetProperty("HELPSTRING")) { + if (cmProp help = i.second.GetProperty("HELPSTRING")) { cmCacheManager::OutputHelpString(fout, *help); } - cmCacheManager::OutputKey(fout, i.GetName()); + cmCacheManager::OutputKey(fout, i.first); fout << ':' << cmState::CacheEntryTypeToString(t) << '='; - cmCacheManager::OutputValue(fout, i.GetValue()); + cmCacheManager::OutputValue(fout, i.second.GetValue()); fout << '\n'; - cmCacheManager::OutputNewlineTruncationWarning(fout, i.GetName(), - i.GetValue(), messenger); + cmCacheManager::OutputNewlineTruncationWarning( + fout, i.first, i.second.GetValue(), messenger); } } fout << '\n'; @@ -479,10 +472,7 @@ void cmCacheManager::OutputNewlineTruncationWarning(std::ostream& fout, void cmCacheManager::RemoveCacheEntry(const std::string& key) { - auto i = this->Cache.find(key); - if (i != this->Cache.end()) { - this->Cache.erase(i); - } + this->Cache.erase(key); } cmCacheManager::CacheEntry* cmCacheManager::GetCacheEntry( @@ -495,22 +485,22 @@ cmCacheManager::CacheEntry* cmCacheManager::GetCacheEntry( return nullptr; } -cmCacheManager::CacheIterator cmCacheManager::GetCacheIterator( - const std::string& key) -{ - return { *this, key.c_str() }; -} - -cmCacheManager::CacheIterator cmCacheManager::GetCacheIterator() +const cmCacheManager::CacheEntry* cmCacheManager::GetCacheEntry( + const std::string& key) const { - return { *this, nullptr }; + auto i = this->Cache.find(key); + if (i != this->Cache.end()) { + return &i->second; + } + return nullptr; } cmProp cmCacheManager::GetInitializedCacheValue(const std::string& key) const { - auto i = this->Cache.find(key); - if (i != this->Cache.end() && i->second.Initialized) { - return &i->second.Value; + if (auto entry = this->GetCacheEntry(key)) { + if (entry->Initialized) { + return &entry->GetValue(); + } } return nullptr; } @@ -535,12 +525,7 @@ void cmCacheManager::AddCacheEntry(const std::string& key, const char* value, cmStateEnums::CacheEntryType type) { CacheEntry& e = this->Cache[key]; - if (value) { - e.Value = value; - e.Initialized = true; - } else { - e.Value.clear(); - } + e.SetValue(value); e.Type = type; // make sure we only use unix style paths if (type == cmStateEnums::FILEPATH || type == cmStateEnums::PATH) { @@ -564,53 +549,16 @@ void cmCacheManager::AddCacheEntry(const std::string& key, const char* value, : "(This variable does not exist and should not be used)"); } -bool cmCacheManager::CacheIterator::IsAtEnd() const -{ - return this->Position == this->Container.Cache.end(); -} - -void cmCacheManager::CacheIterator::Begin() -{ - this->Position = this->Container.Cache.begin(); -} - -bool cmCacheManager::CacheIterator::Find(const std::string& key) +void cmCacheManager::CacheEntry::SetValue(const char* value) { - this->Position = this->Container.Cache.find(key); - return !this->IsAtEnd(); -} - -void cmCacheManager::CacheIterator::Next() -{ - if (!this->IsAtEnd()) { - ++this->Position; - } -} - -std::vector<std::string> cmCacheManager::CacheIterator::GetPropertyList() const -{ - return this->GetEntry().GetPropertyList(); -} - -void cmCacheManager::CacheIterator::SetValue(const char* value) -{ - if (this->IsAtEnd()) { - return; - } - CacheEntry* entry = &this->GetEntry(); if (value) { - entry->Value = value; - entry->Initialized = true; + this->Value = value; + this->Initialized = true; } else { - entry->Value.clear(); + this->Value.clear(); } } -bool cmCacheManager::CacheIterator::GetValueAsBool() const -{ - return cmIsOn(this->GetEntry().Value); -} - std::vector<std::string> cmCacheManager::CacheEntry::GetPropertyList() const { return this->Properties.GetKeys(); @@ -627,6 +575,15 @@ cmProp cmCacheManager::CacheEntry::GetProperty(const std::string& prop) const return this->Properties.GetPropertyValue(prop); } +bool cmCacheManager::CacheEntry::GetPropertyAsBool( + const std::string& prop) const +{ + if (cmProp value = this->GetProperty(prop)) { + return cmIsOn(*value); + } + return false; +} + void cmCacheManager::CacheEntry::SetProperty(const std::string& prop, const char* value) { @@ -639,6 +596,11 @@ void cmCacheManager::CacheEntry::SetProperty(const std::string& prop, } } +void cmCacheManager::CacheEntry::SetProperty(const std::string& p, bool v) +{ + this->SetProperty(p, v ? "ON" : "OFF"); +} + void cmCacheManager::CacheEntry::AppendProperty(const std::string& prop, const std::string& value, bool asString) @@ -657,49 +619,3 @@ void cmCacheManager::CacheEntry::AppendProperty(const std::string& prop, this->Properties.AppendProperty(prop, value, asString); } } - -cmProp cmCacheManager::CacheIterator::GetProperty( - const std::string& prop) const -{ - if (!this->IsAtEnd()) { - return this->GetEntry().GetProperty(prop); - } - return nullptr; -} - -void cmCacheManager::CacheIterator::SetProperty(const std::string& p, - const char* v) -{ - if (!this->IsAtEnd()) { - this->GetEntry().SetProperty(p, v); - } -} - -void cmCacheManager::CacheIterator::AppendProperty(const std::string& p, - const std::string& v, - bool asString) -{ - if (!this->IsAtEnd()) { - this->GetEntry().AppendProperty(p, v, asString); - } -} - -bool cmCacheManager::CacheIterator::GetPropertyAsBool( - const std::string& prop) const -{ - if (cmProp value = this->GetProperty(prop)) { - return cmIsOn(*value); - } - return false; -} - -void cmCacheManager::CacheIterator::SetProperty(const std::string& p, bool v) -{ - this->SetProperty(p, v ? "ON" : "OFF"); -} - -bool cmCacheManager::CacheIterator::PropertyExists( - const std::string& prop) const -{ - return this->GetProperty(prop) != nullptr; -} diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 3db76a9..3d946b4 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -25,77 +25,33 @@ class cmMessenger; */ class cmCacheManager { -public: - cmCacheManager(); - class CacheIterator; - friend class cmCacheManager::CacheIterator; - -private: - struct CacheEntry + class CacheEntry { - std::string Value; - cmStateEnums::CacheEntryType Type = cmStateEnums::UNINITIALIZED; - cmPropertyMap Properties; - std::vector<std::string> GetPropertyList() const; - cmProp GetProperty(const std::string&) const; - void SetProperty(const std::string& property, const char* value); - void AppendProperty(const std::string& property, const std::string& value, - bool asString = false); - bool Initialized = false; - }; + friend class cmCacheManager; -public: - class CacheIterator - { public: - void Begin(); - bool Find(const std::string&); - bool IsAtEnd() const; - void Next(); - std::string GetName() const { return this->Position->first; } + const std::string& GetValue() const { return this->Value; } + void SetValue(const char*); + + cmStateEnums::CacheEntryType GetType() const { return this->Type; } + void SetType(cmStateEnums::CacheEntryType ty) { this->Type = ty; } + std::vector<std::string> GetPropertyList() const; - cmProp GetProperty(const std::string&) const; - bool GetPropertyAsBool(const std::string&) const; - bool PropertyExists(const std::string&) const; + cmProp GetProperty(const std::string& property) const; + bool GetPropertyAsBool(const std::string& property) const; void SetProperty(const std::string& property, const char* value); + void SetProperty(const std::string& property, bool value); void AppendProperty(const std::string& property, const std::string& value, bool asString = false); - void SetProperty(const std::string& property, bool value); - const std::string& GetValue() const { return this->GetEntry().Value; } - bool GetValueAsBool() const; - void SetValue(const char*); - cmStateEnums::CacheEntryType GetType() const - { - return this->GetEntry().Type; - } - void SetType(cmStateEnums::CacheEntryType ty) - { - this->GetEntry().Type = ty; - } - bool Initialized() { return this->GetEntry().Initialized; } - cmCacheManager& Container; - std::map<std::string, CacheEntry>::iterator Position; - CacheIterator(cmCacheManager& cm) - : Container(cm) - { - this->Begin(); - } - CacheIterator(cmCacheManager& cm, const char* key) - : Container(cm) - { - if (key) { - this->Find(key); - } - } private: - CacheEntry const& GetEntry() const { return this->Position->second; } - CacheEntry& GetEntry() { return this->Position->second; } + std::string Value; + cmStateEnums::CacheEntryType Type = cmStateEnums::UNINITIALIZED; + cmPropertyMap Properties; + bool Initialized = false; }; - //! return an iterator to iterate through the cache map - cmCacheManager::CacheIterator NewIterator() { return { *this }; } - +public: //! Load a cache for given makefile. Loads from path/CMakeCache.txt. bool LoadCache(const std::string& path, bool internal, std::set<std::string>& excludes, @@ -110,67 +66,82 @@ public: //! Print the cache to a stream void PrintCache(std::ostream&) const; - //! Get the iterator for an entry with a given key. - cmCacheManager::CacheIterator GetCacheIterator(const std::string& key); - cmCacheManager::CacheIterator GetCacheIterator(); - - //! Remove an entry from the cache - void RemoveCacheEntry(const std::string& key); - - //! Get the number of entries in the cache - int GetSize() { return static_cast<int>(this->Cache.size()); } - //! Get a value from the cache given a key cmProp GetInitializedCacheValue(const std::string& key) const; - cmProp GetCacheEntryValue(const std::string& key) + cmProp GetCacheEntryValue(const std::string& key) const { - cmCacheManager::CacheIterator it = this->GetCacheIterator(key); - if (it.IsAtEnd()) { - return nullptr; + if (auto entry = this->GetCacheEntry(key)) { + return &entry->GetValue(); } - return &it.GetValue(); + return nullptr; } - cmProp GetCacheEntryProperty(std::string const& key, - std::string const& propName) + void SetCacheEntryValue(std::string const& key, std::string const& value) { - return this->GetCacheIterator(key).GetProperty(propName); + if (auto entry = this->GetCacheEntry(key)) { + entry->SetValue(value.c_str()); + } } - cmStateEnums::CacheEntryType GetCacheEntryType(std::string const& key) + cmStateEnums::CacheEntryType GetCacheEntryType(std::string const& key) const { - return this->GetCacheIterator(key).GetType(); + if (auto entry = this->GetCacheEntry(key)) { + return entry->GetType(); + } + return cmStateEnums::UNINITIALIZED; + } + + std::vector<std::string> GetCacheEntryPropertyList( + std::string const& key) const + { + if (auto entry = this->GetCacheEntry(key)) { + return entry->GetPropertyList(); + } + return {}; + } + + cmProp GetCacheEntryProperty(std::string const& key, + std::string const& propName) const + { + if (auto entry = this->GetCacheEntry(key)) { + return entry->GetProperty(propName); + } + return nullptr; } bool GetCacheEntryPropertyAsBool(std::string const& key, - std::string const& propName) + std::string const& propName) const { - return this->GetCacheIterator(key).GetPropertyAsBool(propName); + if (auto entry = this->GetCacheEntry(key)) { + return entry->GetPropertyAsBool(propName); + } + return false; } void SetCacheEntryProperty(std::string const& key, std::string const& propName, std::string const& value) { - this->GetCacheIterator(key).SetProperty(propName, value.c_str()); + if (auto entry = this->GetCacheEntry(key)) { + entry->SetProperty(propName, value.c_str()); + } } void SetCacheEntryBoolProperty(std::string const& key, std::string const& propName, bool value) { - this->GetCacheIterator(key).SetProperty(propName, value); - } - - void SetCacheEntryValue(std::string const& key, std::string const& value) - { - this->GetCacheIterator(key).SetValue(value.c_str()); + if (auto entry = this->GetCacheEntry(key)) { + entry->SetProperty(propName, value); + } } void RemoveCacheEntryProperty(std::string const& key, std::string const& propName) { - this->GetCacheIterator(key).SetProperty(propName, nullptr); + if (auto entry = this->GetCacheEntry(key)) { + entry->SetProperty(propName, nullptr); + } } void AppendCacheEntryProperty(std::string const& key, @@ -178,16 +149,17 @@ public: std::string const& value, bool asString = false) { - this->GetCacheIterator(key).AppendProperty(propName, value, asString); + if (auto entry = this->GetCacheEntry(key)) { + entry->AppendProperty(propName, value, asString); + } } - std::vector<std::string> GetCacheEntryKeys() + std::vector<std::string> GetCacheEntryKeys() const { std::vector<std::string> definitions; - definitions.reserve(this->GetSize()); - cmCacheManager::CacheIterator cit = this->GetCacheIterator(); - for (cit.Begin(); !cit.IsAtEnd(); cit.Next()) { - definitions.push_back(cit.GetName()); + definitions.reserve(this->Cache.size()); + for (auto const& i : this->Cache) { + definitions.push_back(i.first); } return definitions; } @@ -196,23 +168,22 @@ public: unsigned int GetCacheMajorVersion() const { return this->CacheMajorVersion; } unsigned int GetCacheMinorVersion() const { return this->CacheMinorVersion; } -protected: //! Add an entry into the cache void AddCacheEntry(const std::string& key, const char* value, const char* helpString, cmStateEnums::CacheEntryType type); + //! Remove an entry from the cache + void RemoveCacheEntry(const std::string& key); + +private: //! Get a cache entry object for a key CacheEntry* GetCacheEntry(const std::string& key); + const CacheEntry* GetCacheEntry(const std::string& key) const; + //! Clean out the CMakeFiles directory if no CMakeCache.txt void CleanCMakeFiles(const std::string& path); - // Cache version info - unsigned int CacheMajorVersion; - unsigned int CacheMinorVersion; - -private: - using CacheEntryMap = std::map<std::string, CacheEntry>; static void OutputHelpString(std::ostream& fout, const std::string& helpString); static void OutputWarningComment(std::ostream& fout, @@ -228,15 +199,15 @@ private: std::string const& value); static const char* PersistentProperties[]; - bool ReadPropertyEntry(std::string const& key, CacheEntry& e); - void WritePropertyEntries(std::ostream& os, CacheIterator i, - cmMessenger* messenger); - - CacheEntryMap Cache; - // Only cmake and cmState should be able to add cache values - // the commands should never use the cmCacheManager directly - friend class cmState; // allow access to add cache values - friend class cmake; // allow access to add cache values + bool ReadPropertyEntry(const std::string& key, const CacheEntry& e); + void WritePropertyEntries(std::ostream& os, const std::string& entryKey, + const CacheEntry& e, cmMessenger* messenger) const; + + std::map<std::string, CacheEntry> Cache; + + // Cache version info + unsigned int CacheMajorVersion = 0; + unsigned int CacheMinorVersion = 0; }; #endif diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index d8a6204..f0174d9 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -9,8 +9,8 @@ #include <utility> #include <cm/memory> +#include <cmext/algorithm> -#include "cmAlgorithms.h" #include "cmComputeLinkDepends.h" #include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" @@ -610,7 +610,7 @@ void cmComputeLinkInformation::AddRuntimeLinkLibrary(std::string const& lang) runtimeLibrary)) { std::vector<std::string> libsVec = cmExpandedList(runtimeLinkOptions); for (std::string const& i : libsVec) { - if (!cmContains(this->ImplicitLinkLibs, i)) { + if (!cm::contains(this->ImplicitLinkLibs, i)) { this->AddItem(i, nullptr); } } @@ -627,7 +627,7 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang) if (const char* libs = this->Makefile->GetDefinition(libVar)) { std::vector<std::string> libsVec = cmExpandedList(libs); for (std::string const& i : libsVec) { - if (!cmContains(this->ImplicitLinkLibs, i)) { + if (!cm::contains(this->ImplicitLinkLibs, i)) { this->AddItem(i, nullptr); } } @@ -1064,8 +1064,8 @@ void cmComputeLinkInformation::AddTargetItem(BT<std::string> const& item, // For compatibility with CMake 2.4 include the item's directory in // the linker search path. if (this->OldLinkDirMode && !target->IsFrameworkOnApple() && - !cmContains(this->OldLinkDirMask, - cmSystemTools::GetFilenamePath(item.Value))) { + !cm::contains(this->OldLinkDirMask, + cmSystemTools::GetFilenamePath(item.Value))) { this->OldLinkDirItems.push_back(item.Value); } @@ -1118,8 +1118,8 @@ void cmComputeLinkInformation::AddFullItem(BT<std::string> const& item) // For compatibility with CMake 2.4 include the item's directory in // the linker search path. if (this->OldLinkDirMode && - !cmContains(this->OldLinkDirMask, - cmSystemTools::GetFilenamePath(item.Value))) { + !cm::contains(this->OldLinkDirMask, + cmSystemTools::GetFilenamePath(item.Value))) { this->OldLinkDirItems.push_back(item.Value); } @@ -1138,7 +1138,7 @@ bool cmComputeLinkInformation::CheckImplicitDirItem(std::string const& item) // Check if this item is in an implicit link directory. std::string dir = cmSystemTools::GetFilenamePath(item); - if (!cmContains(this->ImplicitLinkDirs, dir)) { + if (!cm::contains(this->ImplicitLinkDirs, dir)) { // Only libraries in implicit link directories are converted to // pathless items. return false; diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index bf11022..7a3a3e8 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -13,7 +13,6 @@ #include "cmsys/RegularExpression.hxx" -#include "cmAlgorithms.h" #include "cmMakefile.h" #include "cmMessageType.h" #include "cmState.h" @@ -673,7 +672,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs, if (def2) { std::vector<std::string> list = cmExpandedList(def2, true); - result = cmContains(list, def); + result = cm::contains(list, def); } this->HandleBinaryOp(result, reducible, arg, newArgs, argP1, argP2); diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 9175dac..dc2df14 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -40,6 +40,8 @@ static std::string const kCMAKE_CXX_LINK_NO_PIE_SUPPORTED = "CMAKE_CXX_LINK_NO_PIE_SUPPORTED"; static std::string const kCMAKE_CXX_LINK_PIE_SUPPORTED = "CMAKE_CXX_LINK_PIE_SUPPORTED"; +static std::string const kCMAKE_CUDA_ARCHITECTURES = + "CMAKE_CUDA_ARCHITECTURES"; static std::string const kCMAKE_CUDA_COMPILER_TARGET = "CMAKE_CUDA_COMPILER_TARGET"; static std::string const kCMAKE_ENABLE_EXPORTS = "CMAKE_ENABLE_EXPORTS"; @@ -713,6 +715,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv, vars.insert(kCMAKE_C_COMPILER_TARGET); vars.insert(kCMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN); vars.insert(kCMAKE_CXX_COMPILER_TARGET); + vars.insert(kCMAKE_CUDA_ARCHITECTURES); vars.insert(kCMAKE_CUDA_COMPILER_TARGET); vars.insert(kCMAKE_ENABLE_EXPORTS); vars.insert(kCMAKE_LINK_SEARCH_END_STATIC); diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index d4e8da6..d8aa730 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -9,12 +9,12 @@ #include "cmFileTime.h" #include "cmFileTimeCache.h" #include "cmGeneratedFileStream.h" -#include "cmLocalGenerator.h" +#include "cmLocalUnixMakefileGenerator3.h" #include "cmMakefile.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -cmDepends::cmDepends(cmLocalGenerator* lg, std::string targetDir) +cmDepends::cmDepends(cmLocalUnixMakefileGenerator3* lg, std::string targetDir) : LocalGenerator(lg) , TargetDirectory(std::move(targetDir)) { diff --git a/Source/cmDepends.h b/Source/cmDepends.h index d938775..8cf528f 100644 --- a/Source/cmDepends.h +++ b/Source/cmDepends.h @@ -12,7 +12,7 @@ #include <vector> class cmFileTimeCache; -class cmLocalGenerator; +class cmLocalUnixMakefileGenerator3; /** \class cmDepends * \brief Dependency scanner superclass. @@ -29,7 +29,8 @@ public: public: /** Instances need to know the build directory name and the relative path from the build directory to the target file. */ - cmDepends(cmLocalGenerator* lg = nullptr, std::string targetDir = ""); + cmDepends(cmLocalUnixMakefileGenerator3* lg = nullptr, + std::string targetDir = ""); cmDepends(cmDepends const&) = delete; cmDepends& operator=(cmDepends const&) = delete; @@ -38,7 +39,10 @@ public: scanning dependencies. This is not a full local generator; it has been setup to do relative path conversions for the current directory. */ - void SetLocalGenerator(cmLocalGenerator* lg) { this->LocalGenerator = lg; } + void SetLocalGenerator(cmLocalUnixMakefileGenerator3* lg) + { + this->LocalGenerator = lg; + } /** Set the specific language to be scanned. */ void SetLanguage(const std::string& lang) { this->Language = lang; } @@ -92,7 +96,7 @@ protected: std::ostream& internalDepends); // The local generator. - cmLocalGenerator* LocalGenerator; + cmLocalUnixMakefileGenerator3* LocalGenerator; // Flag for verbose output. bool Verbose = false; diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 01bb6ed..4499a66 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -7,7 +7,7 @@ #include "cmsys/FStream.hxx" #include "cmFileTime.h" -#include "cmLocalGenerator.h" +#include "cmLocalUnixMakefileGenerator3.h" #include "cmMakefile.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" @@ -22,8 +22,9 @@ cmDependsC::cmDependsC() = default; -cmDependsC::cmDependsC(cmLocalGenerator* lg, const std::string& targetDir, - const std::string& lang, const DependencyMap* validDeps) +cmDependsC::cmDependsC(cmLocalUnixMakefileGenerator3* lg, + const std::string& targetDir, const std::string& lang, + const DependencyMap* validDeps) : cmDepends(lg, targetDir) , ValidDeps(validDeps) { @@ -211,12 +212,12 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources, // written by the original local generator for this directory // convert the dependencies to paths relative to the home output // directory. We must do the same here. - std::string obj_m = cmSystemTools::ConvertToOutputPath(obj_i); + std::string obj_m = this->LocalGenerator->ConvertToMakefilePath(obj_i); internalDepends << obj_i << '\n'; for (std::string const& dep : dependencies) { makeDepends << obj_m << ": " - << cmSystemTools::ConvertToOutputPath( + << this->LocalGenerator->ConvertToMakefilePath( this->LocalGenerator->MaybeConvertToRelativePath(binDir, dep)) << '\n'; diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h index 868c94a..e01faa4 100644 --- a/Source/cmDependsC.h +++ b/Source/cmDependsC.h @@ -16,7 +16,7 @@ #include "cmDepends.h" -class cmLocalGenerator; +class cmLocalUnixMakefileGenerator3; /** \class cmDependsC * \brief Dependency scanner for C and C++ object files. @@ -27,7 +27,7 @@ public: /** Checking instances need to know the build directory name and the relative path from the build directory to the target file. */ cmDependsC(); - cmDependsC(cmLocalGenerator* lg, const std::string& targetDir, + cmDependsC(cmLocalUnixMakefileGenerator3* lg, const std::string& targetDir, const std::string& lang, const DependencyMap* validDeps); /** Virtual destructor to cleanup subclasses properly. */ diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index c45cd1c..95dfc4e 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -12,7 +12,7 @@ #include "cmFortranParser.h" /* Interface to parser object. */ #include "cmGeneratedFileStream.h" -#include "cmLocalGenerator.h" +#include "cmLocalUnixMakefileGenerator3.h" #include "cmMakefile.h" #include "cmOutputConverter.h" #include "cmStateDirectory.h" @@ -70,7 +70,7 @@ public: cmDependsFortran::cmDependsFortran() = default; -cmDependsFortran::cmDependsFortran(cmLocalGenerator* lg) +cmDependsFortran::cmDependsFortran(cmLocalUnixMakefileGenerator3* lg) : cmDepends(lg) , Internal(new cmDependsFortranInternals) { diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h index e3e0d05..3e306dd 100644 --- a/Source/cmDependsFortran.h +++ b/Source/cmDependsFortran.h @@ -15,7 +15,7 @@ class cmDependsFortranInternals; class cmFortranSourceInfo; -class cmLocalGenerator; +class cmLocalUnixMakefileGenerator3; /** \class cmDependsFortran * \brief Dependency scanner for Fortran object files. @@ -31,7 +31,7 @@ public: path from the build directory to the target file, the source file from which to start scanning, the include file search path, and the target directory. */ - cmDependsFortran(cmLocalGenerator* lg); + cmDependsFortran(cmLocalUnixMakefileGenerator3* lg); /** Virtual destructor to cleanup subclasses properly. */ ~cmDependsFortran() override; diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx index a2b4d60..0ee1259 100644 --- a/Source/cmExportBuildAndroidMKGenerator.cxx +++ b/Source/cmExportBuildAndroidMKGenerator.cxx @@ -5,7 +5,8 @@ #include <sstream> #include <utility> -#include "cmAlgorithms.h" +#include <cmext/algorithm> + #include "cmGeneratorTarget.h" #include "cmLinkItem.h" #include "cmMakefile.h" @@ -165,7 +166,7 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties( // Tell the NDK build system if prebuilt static libraries use C++. if (target->GetType() == cmStateEnums::STATIC_LIBRARY) { cmLinkImplementation const* li = target->GetLinkImplementation(config); - if (cmContains(li->Languages, "CXX")) { + if (cm::contains(li->Languages, "CXX")) { os << "LOCAL_HAS_CPP := true\n"; } } diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index d22bd48..dd700c5 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -8,7 +8,8 @@ #include <sstream> #include <utility> -#include "cmAlgorithms.h" +#include <cmext/algorithm> + #include "cmExportSet.h" #include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" @@ -307,7 +308,7 @@ cmExportBuildFileGenerator::FindBuildExportInfo(cmGlobalGenerator* gg, const auto& exportSet = exp.second; std::vector<std::string> targets; exportSet->GetTargets(targets); - if (cmContains(targets, name)) { + if (cm::contains(targets, name)) { exportFiles.push_back(exp.first); ns = exportSet->GetNamespace(); } diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index f31759d..ad632ee 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -7,12 +7,12 @@ #include <utility> #include <cm/memory> +#include <cmext/algorithm> #include "cmsys/RegularExpression.hxx" #include "cm_static_string_view.hxx" -#include "cmAlgorithms.h" #include "cmArgumentParser.h" #include "cmExecutionStatus.h" #include "cmExportBuildAndroidMKGenerator.h" @@ -147,7 +147,7 @@ bool cmExportCommand(std::vector<std::string> const& args, } exportSet = &it->second; } else if (!arguments.Targets.empty() || - cmContains(keywordsMissingValue, "TARGETS")) { + cm::contains(keywordsMissingValue, "TARGETS")) { for (std::string const& currentTarget : arguments.Targets) { if (mf.IsAlias(currentTarget)) { std::ostringstream e; diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index af3c554..4ec128e 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2980,7 +2980,7 @@ bool HandleArchiveCreateCommand(std::vector<std::string> const& args, }; if (!parsedArgs.Format.empty() && - !cmContains(knownFormats, parsedArgs.Format)) { + !cm::contains(knownFormats, parsedArgs.Format)) { status.SetError( cmStrCat("archive format ", parsedArgs.Format, " not supported")); cmSystemTools::SetFatalErrorOccured(); @@ -2989,7 +2989,7 @@ bool HandleArchiveCreateCommand(std::vector<std::string> const& args, const char* zipFileFormats[] = { "7zip", "zip" }; if (!parsedArgs.Type.empty() && - cmContains(zipFileFormats, parsedArgs.Format)) { + cm::contains(zipFileFormats, parsedArgs.Format)) { status.SetError(cmStrCat("archive format ", parsedArgs.Format, " does not support TYPE arguments")); cmSystemTools::SetFatalErrorOccured(); diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index c860c75..b4ba1a1 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -48,12 +48,7 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker( void cmGeneratorExpressionDAGChecker::Initialize() { - const cmGeneratorExpressionDAGChecker* top = this; - const cmGeneratorExpressionDAGChecker* p = this->Parent; - while (p) { - top = p; - p = p->Parent; - } + const auto* top = this->Top(); this->CheckResult = this->CheckGraph(); #define TEST_TRANSITIVE_PROPERTY_METHOD(METHOD) top->METHOD() || @@ -144,60 +139,41 @@ cmGeneratorExpressionDAGChecker::CheckGraph() const return DAG; } -bool cmGeneratorExpressionDAGChecker::GetTransitivePropertiesOnly() +bool cmGeneratorExpressionDAGChecker::GetTransitivePropertiesOnly() const { - const cmGeneratorExpressionDAGChecker* top = this; - const cmGeneratorExpressionDAGChecker* parent = this->Parent; - while (parent) { - top = parent; - parent = parent->Parent; - } - - return top->TransitivePropertiesOnly; + return this->Top()->TransitivePropertiesOnly; } -bool cmGeneratorExpressionDAGChecker::EvaluatingGenexExpression() +bool cmGeneratorExpressionDAGChecker::EvaluatingGenexExpression() const { return cmHasLiteralPrefix(this->Property, "TARGET_GENEX_EVAL:") || cmHasLiteralPrefix(this->Property, "GENEX_EVAL:"); } -bool cmGeneratorExpressionDAGChecker::EvaluatingPICExpression() +bool cmGeneratorExpressionDAGChecker::EvaluatingPICExpression() const { - const cmGeneratorExpressionDAGChecker* top = this; - const cmGeneratorExpressionDAGChecker* parent = this->Parent; - while (parent) { - top = parent; - parent = parent->Parent; - } - - return top->Property == "INTERFACE_POSITION_INDEPENDENT_CODE"; + return this->Top()->Property == "INTERFACE_POSITION_INDEPENDENT_CODE"; } -bool cmGeneratorExpressionDAGChecker::EvaluatingLinkExpression() +bool cmGeneratorExpressionDAGChecker::EvaluatingLinkExpression() const { - const cmGeneratorExpressionDAGChecker* top = this; - const cmGeneratorExpressionDAGChecker* parent = this->Parent; - while (parent) { - top = parent; - parent = parent->Parent; - } - - cm::string_view property(top->Property); + cm::string_view property(this->Top()->Property); return property == "LINK_DIRECTORIES"_s || property == "LINK_OPTIONS"_s || property == "LINK_DEPENDS"_s; } +bool cmGeneratorExpressionDAGChecker::EvaluatingLinkOptionsExpression() const +{ + cm::string_view property(this->Top()->Property); + + return property == "LINK_OPTIONS"_s; +} + bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries( - cmGeneratorTarget const* tgt) + cmGeneratorTarget const* tgt) const { - const cmGeneratorExpressionDAGChecker* top = this; - const cmGeneratorExpressionDAGChecker* parent = this->Parent; - while (parent) { - top = parent; - parent = parent->Parent; - } + const auto* top = this->Top(); cm::string_view prop(top->Property); @@ -212,7 +188,8 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries( prop == "INTERFACE_LINK_LIBRARIES"_s; } -cmGeneratorTarget const* cmGeneratorExpressionDAGChecker::TopTarget() const +cmGeneratorExpressionDAGChecker const* cmGeneratorExpressionDAGChecker::Top() + const { const cmGeneratorExpressionDAGChecker* top = this; const cmGeneratorExpressionDAGChecker* parent = this->Parent; @@ -220,7 +197,12 @@ cmGeneratorTarget const* cmGeneratorExpressionDAGChecker::TopTarget() const top = parent; parent = parent->Parent; } - return top->Target; + return top; +} + +cmGeneratorTarget const* cmGeneratorExpressionDAGChecker::TopTarget() const +{ + return this->Top()->Target; } enum TransitiveProperty diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h index 2a06596..c2c5b6b 100644 --- a/Source/cmGeneratorExpressionDAGChecker.h +++ b/Source/cmGeneratorExpressionDAGChecker.h @@ -66,10 +66,12 @@ struct cmGeneratorExpressionDAGChecker void ReportError(cmGeneratorExpressionContext* context, const std::string& expr); - bool EvaluatingGenexExpression(); - bool EvaluatingPICExpression(); - bool EvaluatingLinkExpression(); - bool EvaluatingLinkLibraries(cmGeneratorTarget const* tgt = nullptr); + bool EvaluatingGenexExpression() const; + bool EvaluatingPICExpression() const; + bool EvaluatingLinkExpression() const; + bool EvaluatingLinkOptionsExpression() const; + + bool EvaluatingLinkLibraries(cmGeneratorTarget const* tgt = nullptr) const; #define DECLARE_TRANSITIVE_PROPERTY_METHOD(METHOD) bool METHOD() const; @@ -77,9 +79,10 @@ struct cmGeneratorExpressionDAGChecker #undef DECLARE_TRANSITIVE_PROPERTY_METHOD - bool GetTransitivePropertiesOnly(); + bool GetTransitivePropertiesOnly() const; void SetTransitivePropertiesOnly() { this->TransitivePropertiesOnly = true; } + cmGeneratorExpressionDAGChecker const* Top() const; cmGeneratorTarget const* TopTarget() const; private: diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index dfc354d..d48427e 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -15,6 +15,8 @@ #include <cm/iterator> #include <cm/string_view> +#include <cm/vector> +#include <cmext/algorithm> #include "cmsys/RegularExpression.hxx" #include "cmsys/String.h" @@ -313,7 +315,7 @@ static const struct InListNode : public cmGeneratorExpressionNode break; } - return cmContains(values, parameters.front()) ? "1" : "0"; + return cm::contains(values, parameters.front()) ? "1" : "0"; } } inListNode; @@ -921,8 +923,8 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode if (const char* mapValue = context->CurrentTarget->GetProperty(mapProp)) { cmExpandList(cmSystemTools::UpperCase(mapValue), mappedConfigs); - return cmContains(mappedConfigs, - cmSystemTools::UpperCase(parameters.front())) + return cm::contains(mappedConfigs, + cmSystemTools::UpperCase(parameters.front())) ? "1" : "0"; } @@ -1186,6 +1188,70 @@ static const struct LinkLanguageAndIdNode : public cmGeneratorExpressionNode } } linkLanguageAndIdNode; +static const struct HostLinkNode : public cmGeneratorExpressionNode +{ + HostLinkNode() {} // NOLINT(modernize-use-equals-default) + + int NumExpectedParameters() const override { return ZeroOrMoreParameters; } + + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* dagChecker) const override + { + if (!context->HeadTarget || !dagChecker || + !dagChecker->EvaluatingLinkOptionsExpression()) { + reportError(context, content->GetOriginalExpression(), + "$<HOST_LINK:...> may only be used with binary targets " + "to specify link options."); + return std::string(); + } + + return context->HeadTarget->IsDeviceLink() ? std::string() + : cmJoin(parameters, ";"); + } +} hostLinkNode; + +static const struct DeviceLinkNode : public cmGeneratorExpressionNode +{ + DeviceLinkNode() {} // NOLINT(modernize-use-equals-default) + + int NumExpectedParameters() const override { return ZeroOrMoreParameters; } + + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* dagChecker) const override + { + if (!context->HeadTarget || !dagChecker || + !dagChecker->EvaluatingLinkOptionsExpression()) { + reportError(context, content->GetOriginalExpression(), + "$<DEVICE_LINK:...> may only be used with binary targets " + "to specify link options."); + return std::string(); + } + + if (context->HeadTarget->IsDeviceLink()) { + std::vector<std::string> list; + cmExpandLists(parameters.begin(), parameters.end(), list); + const auto DL_BEGIN = "<DEVICE_LINK>"_s; + const auto DL_END = "</DEVICE_LINK>"_s; + cm::erase_if(list, [&](const std::string& item) { + return item == DL_BEGIN || item == DL_END; + }); + + list.insert(list.begin(), static_cast<std::string>(DL_BEGIN)); + list.push_back(static_cast<std::string>(DL_END)); + + return cmJoin(list, ";"); + } + + return std::string(); + } +} deviceLinkNode; + std::string getLinkedTargetsContent( cmGeneratorTarget const* target, std::string const& prop, cmGeneratorExpressionContext* context, @@ -1303,6 +1369,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode context, content->GetOriginalExpression(), "$<TARGET_PROPERTY:prop> may only be used with binary targets. " "It may not be used with add_custom_command or add_custom_target. " + " " "Specify the target to read a property from using the " "$<TARGET_PROPERTY:tgt,prop> signature instead."); return std::string(); @@ -1659,7 +1726,7 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode const char* standardDefault = context->LG->GetMakefile()->GetDefinition( "CMAKE_" + lit.first + "_STANDARD_DEFAULT"); for (std::string const& it : lit.second) { - if (!cmContains(langAvailable, it)) { + if (!cm::contains(langAvailable, it)) { return "0"; } if (standardDefault && !*standardDefault) { @@ -2463,6 +2530,8 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode( { "COMPILE_LANGUAGE", &languageNode }, { "LINK_LANG_AND_ID", &linkLanguageAndIdNode }, { "LINK_LANGUAGE", &linkLanguageNode }, + { "HOST_LINK", &hostLinkNode }, + { "DEVICE_LINK", &deviceLinkNode }, { "SHELL_PATH", &shellPathNode } }; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 55157b4..fd863a3 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -21,6 +21,8 @@ #include "cmsys/RegularExpression.hxx" +#include "cm_static_string_view.hxx" + #include "cmAlgorithms.h" #include "cmComputeLinkInformation.h" #include "cmCustomCommand.h" @@ -1309,7 +1311,8 @@ std::string AddSwiftInterfaceIncludeDirectories( target->GetLinkInterfaceLibraries(config, root, true)) { for (const cmLinkItem& library : interface->Libraries) { if (const cmGeneratorTarget* dependency = library.Target) { - if (cmContains(dependency->GetAllConfigCompileLanguages(), "Swift")) { + if (cm::contains(dependency->GetAllConfigCompileLanguages(), + "Swift")) { std::string value = dependency->GetSafeProperty("Swift_MODULE_DIRECTORY"); if (value.empty()) { @@ -1339,7 +1342,8 @@ void AddSwiftImplicitIncludeDirectories( for (const cmLinkImplItem& library : libraries->Libraries) { if (const cmGeneratorTarget* dependency = library.Target) { - if (cmContains(dependency->GetAllConfigCompileLanguages(), "Swift")) { + if (cm::contains(dependency->GetAllConfigCompileLanguages(), + "Swift")) { EvaluatedTargetPropertyEntry entry{ library, library.Backtrace }; if (const char* val = @@ -1522,7 +1526,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths( } bool debugSources = - !this->DebugSourcesDone && cmContains(debugProperties, "SOURCES"); + !this->DebugSourcesDone && cm::contains(debugProperties, "SOURCES"); if (this->LocalGenerator->GetGlobalGenerator()->GetConfigureDoneCMP0026()) { this->DebugSourcesDone = true; @@ -2806,7 +2810,7 @@ cmTargetTraceDependencies::cmTargetTraceDependencies(cmGeneratorTarget* target) for (cmSourceFile* sf : sources) { const std::set<cmGeneratorTarget const*> tgts = this->GlobalGenerator->GetFilenameTargetDepends(sf); - if (cmContains(tgts, this->GeneratorTarget)) { + if (cm::contains(tgts, this->GeneratorTarget)) { std::ostringstream e; e << "Evaluation output file\n \"" << sf->ResolveFullPath() << "\"\ndepends on the sources of a target it is used in. This " @@ -3085,6 +3089,95 @@ void cmGeneratorTarget::GetAppleArchs(const std::string& config, } } +void cmGeneratorTarget::AddCUDAArchitectureFlags(std::string& flags) const +{ + struct CudaArchitecture + { + std::string name; + bool real{ true }; + bool virtual_{ true }; + }; + std::vector<CudaArchitecture> architectures; + + { + std::vector<std::string> options; + cmExpandList(this->GetSafeProperty("CUDA_ARCHITECTURES"), options); + + if (options.empty()) { + switch (this->GetPolicyStatusCMP0104()) { + case cmPolicies::WARN: + if (!this->LocalGenerator->GetCMakeInstance()->GetIsInTryCompile()) { + this->Makefile->IssueMessage( + MessageType::AUTHOR_WARNING, + cmPolicies::GetPolicyWarning(cmPolicies::CMP0104) + + "\nCUDA_ARCHITECTURES is empty for target \"" + + this->GetName() + "\"."); + } + CM_FALLTHROUGH; + case cmPolicies::OLD: + break; + default: + this->Makefile->IssueMessage( + MessageType::FATAL_ERROR, + "CUDA_ARCHITECTURES is empty for target \"" + this->GetName() + + "\"."); + } + } + + for (std::string& option : options) { + CudaArchitecture architecture; + + // Architecture name is up to the first specifier. + std::size_t pos = option.find_first_of('-'); + architecture.name = option.substr(0, pos); + + if (pos != std::string::npos) { + cm::string_view specifier{ option.c_str() + pos + 1, + option.length() - pos - 1 }; + + if (specifier == "real") { + architecture.real = true; + architecture.virtual_ = false; + } else if (specifier == "virtual") { + architecture.real = false; + architecture.virtual_ = true; + } else { + this->Makefile->IssueMessage( + MessageType::FATAL_ERROR, + "Uknown CUDA architecture specifier \"" + std::string(specifier) + + "\"."); + } + } + + architectures.emplace_back(architecture); + } + } + + std::string const& compiler = + this->Makefile->GetSafeDefinition("CMAKE_CUDA_COMPILER_ID"); + + if (compiler == "NVIDIA") { + for (CudaArchitecture& architecture : architectures) { + flags += + " --generate-code=arch=compute_" + architecture.name + ",code=["; + + if (architecture.virtual_) { + flags += "compute_" + architecture.name; + + if (architecture.real) { + flags += ","; + } + } + + if (architecture.real) { + flags += "sm_" + architecture.name; + } + + flags += "]"; + } + } +} + //---------------------------------------------------------------------------- std::string cmGeneratorTarget::GetFeatureSpecificLinkRuleVariable( std::string const& var, std::string const& lang, @@ -3250,7 +3343,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories( } bool debugIncludes = !this->DebugIncludesDone && - cmContains(debugProperties, "INCLUDE_DIRECTORIES"); + cm::contains(debugProperties, "INCLUDE_DIRECTORIES"); if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { this->DebugIncludesDone = true; @@ -3301,22 +3394,38 @@ enum class OptionsParse }; namespace { +const auto DL_BEGIN = "<DEVICE_LINK>"_s; +const auto DL_END = "</DEVICE_LINK>"_s; + void processOptions(cmGeneratorTarget const* tgt, std::vector<EvaluatedTargetPropertyEntry> const& entries, std::vector<BT<std::string>>& options, std::unordered_set<std::string>& uniqueOptions, - bool debugOptions, const char* logName, OptionsParse parse) + bool debugOptions, const char* logName, OptionsParse parse, + bool processDeviceOptions = false) { + bool splitOption = !processDeviceOptions; for (EvaluatedTargetPropertyEntry const& entry : entries) { std::string usedOptions; for (std::string const& opt : entry.Values) { + if (processDeviceOptions && (opt == DL_BEGIN || opt == DL_END)) { + options.emplace_back(opt, entry.Backtrace); + splitOption = opt == DL_BEGIN; + continue; + } + if (uniqueOptions.insert(opt).second) { if (parse == OptionsParse::Shell && cmHasLiteralPrefix(opt, "SHELL:")) { - std::vector<std::string> tmp; - cmSystemTools::ParseUnixCommandLine(opt.c_str() + 6, tmp); - for (std::string& o : tmp) { - options.emplace_back(std::move(o), entry.Backtrace); + if (splitOption) { + std::vector<std::string> tmp; + cmSystemTools::ParseUnixCommandLine(opt.c_str() + 6, tmp); + for (std::string& o : tmp) { + options.emplace_back(std::move(o), entry.Backtrace); + } + } else { + options.emplace_back(std::string(opt.c_str() + 6), + entry.Backtrace); } } else { options.emplace_back(opt, entry.Backtrace); @@ -3335,6 +3444,63 @@ void processOptions(cmGeneratorTarget const* tgt, } } } + +std::vector<BT<std::string>> wrapOptions( + std::vector<std::string>& options, const cmListFileBacktrace& bt, + const std::vector<std::string>& wrapperFlag, const std::string& wrapperSep, + bool concatFlagAndArgs) +{ + std::vector<BT<std::string>> result; + + if (options.empty()) { + return result; + } + + if (wrapperFlag.empty() || cmHasLiteralPrefix(options.front(), "LINKER:")) { + // nothing specified or LINKER wrapper, insert elements as is + result.reserve(options.size()); + for (std::string& o : options) { + result.emplace_back(std::move(o), bt); + } + } else { + if (!wrapperSep.empty()) { + if (concatFlagAndArgs) { + // insert flag elements except last one + for (auto i = wrapperFlag.begin(); i != wrapperFlag.end() - 1; ++i) { + result.emplace_back(*i, bt); + } + // concatenate last flag element and all list values + // in one option + result.emplace_back(wrapperFlag.back() + cmJoin(options, wrapperSep), + bt); + } else { + for (std::string const& i : wrapperFlag) { + result.emplace_back(i, bt); + } + // concatenate all list values in one option + result.emplace_back(cmJoin(options, wrapperSep), bt); + } + } else { + // prefix each element of list with wrapper + if (concatFlagAndArgs) { + std::transform(options.begin(), options.end(), options.begin(), + [&wrapperFlag](std::string const& o) -> std::string { + return wrapperFlag.back() + o; + }); + } + for (std::string& o : options) { + for (auto i = wrapperFlag.begin(), + e = concatFlagAndArgs ? wrapperFlag.end() - 1 + : wrapperFlag.end(); + i != e; ++i) { + result.emplace_back(*i, bt); + } + result.emplace_back(std::move(o), bt); + } + } + } + return result; +} } void cmGeneratorTarget::GetCompileOptions(std::vector<std::string>& result, @@ -3365,7 +3531,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileOptions( } bool debugOptions = !this->DebugCompileOptionsDone && - cmContains(debugProperties, "COMPILE_OPTIONS"); + cm::contains(debugProperties, "COMPILE_OPTIONS"); if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { this->DebugCompileOptionsDone = true; @@ -3411,7 +3577,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileFeatures( } bool debugFeatures = !this->DebugCompileFeaturesDone && - cmContains(debugProperties, "COMPILE_FEATURES"); + cm::contains(debugProperties, "COMPILE_FEATURES"); if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { this->DebugCompileFeaturesDone = true; @@ -3459,7 +3625,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions( } bool debugDefines = !this->DebugCompileDefinitionsDone && - cmContains(debugProperties, "COMPILE_DEFINITIONS"); + cm::contains(debugProperties, "COMPILE_DEFINITIONS"); if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { this->DebugCompileDefinitionsDone = true; @@ -3867,6 +4033,12 @@ void cmGeneratorTarget::GetLinkOptions(std::vector<std::string>& result, const std::string& config, const std::string& language) const { + if (this->IsDeviceLink() && + this->GetPolicyStatusCMP0105() != cmPolicies::NEW) { + // link options are not propagated to the device link step + return; + } + std::vector<BT<std::string>> tmp = this->GetLinkOptions(config, language); result.reserve(tmp.size()); for (BT<std::string>& v : tmp) { @@ -3890,8 +4062,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions( cmExpandList(debugProp, debugProperties); } - bool debugOptions = - !this->DebugLinkOptionsDone && cmContains(debugProperties, "LINK_OPTIONS"); + bool debugOptions = !this->DebugLinkOptionsDone && + cm::contains(debugProperties, "LINK_OPTIONS"); if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { this->DebugLinkOptionsDone = true; @@ -3906,15 +4078,65 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions( this->GetPolicyStatusCMP0099() != cmPolicies::NEW); processOptions(this, entries, result, uniqueOptions, debugOptions, - "link options", OptionsParse::Shell); + "link options", OptionsParse::Shell, this->IsDeviceLink()); + + if (this->IsDeviceLink()) { + // wrap host link options + const std::string wrapper(this->Makefile->GetSafeDefinition( + "CMAKE_" + language + "_DEVICE_COMPILER_WRAPPER_FLAG")); + std::vector<std::string> wrapperFlag = cmExpandedList(wrapper); + const std::string wrapperSep(this->Makefile->GetSafeDefinition( + "CMAKE_" + language + "_DEVICE_COMPILER_WRAPPER_FLAG_SEP")); + bool concatFlagAndArgs = true; + if (!wrapperFlag.empty() && wrapperFlag.back() == " ") { + concatFlagAndArgs = false; + wrapperFlag.pop_back(); + } + + auto it = result.begin(); + while (it != result.end()) { + if (it->Value == DL_BEGIN) { + // device link options, no treatment + it = result.erase(it); + it = std::find_if(it, result.end(), [](const BT<std::string>& item) { + return item.Value == DL_END; + }); + if (it != result.end()) { + it = result.erase(it); + } + } else { + // host link options must be wrapped + std::vector<std::string> options; + cmSystemTools::ParseUnixCommandLine(it->Value.c_str(), options); + auto hostOptions = wrapOptions(options, it->Backtrace, wrapperFlag, + wrapperSep, concatFlagAndArgs); + it = result.erase(it); + // some compilers (like gcc 4.8 or Intel 19.0 or XLC 16) do not respect + // C++11 standard: 'std::vector::insert()' do not returns an iterator, + // so need to recompute the iterator after insertion. + if (it == result.end()) { + cm::append(result, hostOptions); + it = result.end(); + } else { + auto index = it - result.begin(); + result.insert(it, hostOptions.begin(), hostOptions.end()); + it = result.begin() + index + hostOptions.size(); + } + } + } + } // Last step: replace "LINKER:" prefixed elements by // actual linker wrapper const std::string wrapper(this->Makefile->GetSafeDefinition( - "CMAKE_" + language + "_LINKER_WRAPPER_FLAG")); + "CMAKE_" + language + + (this->IsDeviceLink() ? "_DEVICE_LINKER_WRAPPER_FLAG" + : "_LINKER_WRAPPER_FLAG"))); std::vector<std::string> wrapperFlag = cmExpandedList(wrapper); const std::string wrapperSep(this->Makefile->GetSafeDefinition( - "CMAKE_" + language + "_LINKER_WRAPPER_FLAG_SEP")); + "CMAKE_" + language + + (this->IsDeviceLink() ? "_DEVICE_LINKER_WRAPPER_FLAG_SEP" + : "_LINKER_WRAPPER_FLAG_SEP"))); bool concatFlagAndArgs = true; if (!wrapperFlag.empty() && wrapperFlag.back() == " ") { concatFlagAndArgs = false; @@ -3960,51 +4182,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions( return result; } - std::vector<BT<std::string>> options; - if (wrapperFlag.empty()) { - // nothing specified, insert elements as is - options.reserve(linkerOptions.size()); - for (std::string& o : linkerOptions) { - options.emplace_back(std::move(o), bt); - } - } else { - if (!wrapperSep.empty()) { - if (concatFlagAndArgs) { - // insert flag elements except last one - for (auto i = wrapperFlag.begin(); i != wrapperFlag.end() - 1; ++i) { - options.emplace_back(*i, bt); - } - // concatenate last flag element and all LINKER list values - // in one option - options.emplace_back( - wrapperFlag.back() + cmJoin(linkerOptions, wrapperSep), bt); - } else { - for (std::string const& i : wrapperFlag) { - options.emplace_back(i, bt); - } - // concatenate all LINKER list values in one option - options.emplace_back(cmJoin(linkerOptions, wrapperSep), bt); - } - } else { - // prefix each element of LINKER list with wrapper - if (concatFlagAndArgs) { - std::transform(linkerOptions.begin(), linkerOptions.end(), - linkerOptions.begin(), - [&wrapperFlag](std::string const& o) -> std::string { - return wrapperFlag.back() + o; - }); - } - for (std::string& o : linkerOptions) { - for (auto i = wrapperFlag.begin(), - e = concatFlagAndArgs ? wrapperFlag.end() - 1 - : wrapperFlag.end(); - i != e; ++i) { - options.emplace_back(*i, bt); - } - options.emplace_back(std::move(o), bt); - } - } - } + std::vector<BT<std::string>> options = wrapOptions( + linkerOptions, bt, wrapperFlag, wrapperSep, concatFlagAndArgs); result.insert(entry, options.begin(), options.end()); } return result; @@ -4147,7 +4326,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDirectories( } bool debugDirectories = !this->DebugLinkDirectoriesDone && - cmContains(debugProperties, "LINK_DIRECTORIES"); + cm::contains(debugProperties, "LINK_DIRECTORIES"); if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { this->DebugLinkDirectoriesDone = true; @@ -4560,9 +4739,9 @@ void cmGeneratorTarget::GetFullNameInternal( outBase += this->GetOutputName(config, artifact); // Append the per-configuration postfix. - // When using Xcode, the postfix should be part of the suffix rather than the - // base, because the suffix ends up being used in Xcode's EXECUTABLE_SUFFIX - // attribute. + // When using Xcode, the postfix should be part of the suffix rather than + // the base, because the suffix ends up being used in Xcode's + // EXECUTABLE_SUFFIX attribute. if (this->IsFrameworkOnApple() && GetGlobalGenerator()->GetName() == "Xcode") { targetSuffix = configPostfix.c_str(); @@ -5059,7 +5238,8 @@ void cmGeneratorTarget::CheckPropertyCompatibility( std::ostringstream e; e << "Property \"" << prop << "\" appears in both the " << propsString << " property in the dependencies of target \"" << this->GetName() - << "\". This is not allowed. A property may only require compatibility " + << "\". This is not allowed. A property may only require " + "compatibility " "in a boolean interpretation, a numeric minimum, a numeric maximum " "or a " "string interpretation, but not a mixture."; @@ -5308,7 +5488,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt, PropertyType propContent = getTypedProperty<PropertyType>(tgt, p); std::vector<std::string> headPropKeys = tgt->GetPropertyKeys(); - const bool explicitlySet = cmContains(headPropKeys, p); + const bool explicitlySet = cm::contains(headPropKeys, p); const bool impliedByUse = tgt->IsNullImpliedByLinkLibraries(p); assert((impliedByUse ^ explicitlySet) || (!impliedByUse && !explicitlySet)); @@ -5348,7 +5528,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt, std::vector<std::string> propKeys = theTarget->GetPropertyKeys(); - const bool ifaceIsSet = cmContains(propKeys, interfaceProperty); + const bool ifaceIsSet = cm::contains(propKeys, interfaceProperty); PropertyType ifacePropContent = getTypedProperty<PropertyType>( theTarget, interfaceProperty, genexInterpreter.get()); @@ -5441,6 +5621,13 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt, return propContent; } +bool cmGeneratorTarget::SetDeviceLink(bool deviceLink) +{ + bool previous = this->DeviceLink; + this->DeviceLink = deviceLink; + return previous; +} + bool cmGeneratorTarget::GetLinkInterfaceDependentBoolProperty( const std::string& p, const std::string& config) const { @@ -5639,8 +5826,8 @@ void cmGeneratorTarget::ReportPropertyOrigin( cmExpandList(debugProp, debugProperties); } - bool debugOrigin = - !this->DebugCompatiblePropertiesDone[p] && cmContains(debugProperties, p); + bool debugOrigin = !this->DebugCompatiblePropertiesDone[p] && + cm::contains(debugProperties, p); if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { this->DebugCompatiblePropertiesDone[p] = true; @@ -5702,8 +5889,9 @@ void cmGeneratorTarget::ExpandLinkItems( // Keep this logic in sync with ComputeLinkImplementationLibraries. cmGeneratorExpression ge; cmGeneratorExpressionDAGChecker dagChecker(this, prop, nullptr, nullptr); - // The $<LINK_ONLY> expression may be in a link interface to specify private - // link dependencies that are otherwise excluded from usage requirements. + // The $<LINK_ONLY> expression may be in a link interface to specify + // private link dependencies that are otherwise excluded from usage + // requirements. if (usage_requirements_only) { dagChecker.SetTransitivePropertiesOnly(); } @@ -5801,9 +5989,9 @@ void cmGeneratorTarget::ComputeLinkInterface( } } else { // TODO: Recognize shared library file names. Perhaps this - // should be moved to cmComputeLinkInformation, but that creates - // a chicken-and-egg problem since this list is needed for its - // construction. + // should be moved to cmComputeLinkInformation, but that + // creates a chicken-and-egg problem since this list is needed + // for its construction. } } } @@ -5864,7 +6052,6 @@ const cmLinkInterfaceLibraries* cmGeneratorTarget::GetLinkInterfaceLibraries( } // Lookup any existing link interface for this configuration. - std::string CONFIG = cmSystemTools::UpperCase(config); cmHeadToLinkInterfaceMap& hm = (usage_requirements_only ? this->GetHeadToLinkInterfaceUsageRequirementsMap(config) @@ -6286,7 +6473,6 @@ const cmLinkInterface* cmGeneratorTarget::GetImportLinkInterface( return nullptr; } - std::string CONFIG = cmSystemTools::UpperCase(config); cmHeadToLinkInterfaceMap& hm = (usage_requirements_only ? this->GetHeadToLinkInterfaceUsageRequirementsMap(config) @@ -6500,16 +6686,15 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config, cmHeadToLinkInterfaceMap& cmGeneratorTarget::GetHeadToLinkInterfaceMap( const std::string& config) const { - std::string CONFIG = cmSystemTools::UpperCase(config); - return this->LinkInterfaceMap[CONFIG]; + return this->LinkInterfaceMap[cmSystemTools::UpperCase(config)]; } cmHeadToLinkInterfaceMap& cmGeneratorTarget::GetHeadToLinkInterfaceUsageRequirementsMap( const std::string& config) const { - std::string CONFIG = cmSystemTools::UpperCase(config); - return this->LinkInterfaceUsageRequirementsOnlyMap[CONFIG]; + return this + ->LinkInterfaceUsageRequirementsOnlyMap[cmSystemTools::UpperCase(config)]; } const cmLinkImplementation* cmGeneratorTarget::GetLinkImplementation( @@ -6526,8 +6711,8 @@ const cmLinkImplementation* cmGeneratorTarget::GetLinkImplementation( return nullptr; } - std::string CONFIG = cmSystemTools::UpperCase(config); - cmOptionalLinkImplementation& impl = this->LinkImplMap[CONFIG][this]; + cmOptionalLinkImplementation& impl = + this->LinkImplMap[cmSystemTools::UpperCase(config)][this]; if (secondPass) { impl = cmOptionalLinkImplementation(); } @@ -6786,8 +6971,8 @@ cmGeneratorTarget::GetLinkImplementationLibrariesInternal( } // Populate the link implementation libraries for this configuration. - std::string CONFIG = cmSystemTools::UpperCase(config); - HeadToLinkImplementationMap& hm = this->LinkImplMap[CONFIG]; + HeadToLinkImplementationMap& hm = + this->LinkImplMap[cmSystemTools::UpperCase(config)]; // If the link implementation does not depend on the head target // then return the one we computed first. @@ -6806,7 +6991,7 @@ cmGeneratorTarget::GetLinkImplementationLibrariesInternal( bool cmGeneratorTarget::IsNullImpliedByLinkLibraries( const std::string& p) const { - return cmContains(this->LinkImplicitNullProperties, p); + return cm::contains(this->LinkImplicitNullProperties, p); } void cmGeneratorTarget::ComputeLinkImplementationLibraries( diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 9136928..dd46bb9 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -204,6 +204,24 @@ public: const char* GetLinkInterfaceDependentNumberMaxProperty( const std::string& p, const std::string& config) const; + class DeviceLinkSetter + { + public: + DeviceLinkSetter(cmGeneratorTarget& target) + : Target(target) + { + this->PreviousState = target.SetDeviceLink(true); + } + ~DeviceLinkSetter() { this->Target.SetDeviceLink(this->PreviousState); }; + + private: + cmGeneratorTarget& Target; + bool PreviousState; + }; + + bool SetDeviceLink(bool deviceLink); + bool IsDeviceLink() const { return this->DeviceLink; } + cmLinkInterface const* GetLinkInterface( const std::string& config, const cmGeneratorTarget* headTarget) const; void ComputeLinkInterface(const std::string& config, @@ -421,6 +439,8 @@ public: void GetAppleArchs(const std::string& config, std::vector<std::string>& archVec) const; + void AddCUDAArchitectureFlags(std::string& flags) const; + std::string GetFeatureSpecificLinkRuleVariable( std::string const& var, std::string const& lang, std::string const& config) const; @@ -827,6 +847,7 @@ private: mutable std::string LinkerLanguage; using LinkClosureMapType = std::map<std::string, LinkClosure>; mutable LinkClosureMapType LinkClosureMap; + bool DeviceLink = false; // Returns ARCHIVE, LIBRARY, or RUNTIME based on platform and type. const char* GetOutputTargetType(cmStateEnums::ArtifactType artifact) const; diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h index 9af0eac..3c97955 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.h +++ b/Source/cmGlobalBorlandMakefileGenerator.h @@ -46,6 +46,7 @@ public: bool AllowNotParallel() const override { return false; } bool AllowDeleteOnError() const override { return false; } + bool CanEscapeOctothorpe() const override { return true; } protected: std::vector<GeneratedMakeCommand> GenerateBuildCommand( diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 8505d43..a6ca75f 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -14,6 +14,7 @@ #include <utility> #include <cm/memory> +#include <cmext/algorithm> #include "cmsys/Directory.hxx" #include "cmsys/FStream.hxx" @@ -403,7 +404,7 @@ bool cmGlobalGenerator::IsExportedTargetsFile( if (it == this->BuildExportSets.end()) { return false; } - return !cmContains(this->BuildExportExportSets, filename); + return !cm::contains(this->BuildExportExportSets, filename); } // Find the make program for the generator, required for try compiles @@ -529,7 +530,7 @@ void cmGlobalGenerator::EnableLanguage( if (lang == "NONE") { this->SetLanguageEnabled("NONE", mf); } else { - if (!cmContains(this->LanguagesReady, lang)) { + if (!cm::contains(this->LanguagesReady, lang)) { std::ostringstream e; e << "The test project needs language " << lang << " which is not enabled."; @@ -1094,7 +1095,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l, { // use LanguageToLinkerPreference to detect whether this functions has // run before - if (cmContains(this->LanguageToLinkerPreference, l)) { + if (cm::contains(this->LanguageToLinkerPreference, l)) { return; } @@ -2227,7 +2228,7 @@ void cmGlobalGenerator::AddAlias(const std::string& name, bool cmGlobalGenerator::IsAlias(const std::string& name) const { - return cmContains(this->AliasTargets, name); + return cm::contains(this->AliasTargets, name); } void cmGlobalGenerator::IndexTarget(cmTarget* t) @@ -2792,7 +2793,7 @@ bool cmGlobalGenerator::IsReservedTarget(std::string const& name) "clean", "edit_cache", "rebuild_cache", "ZERO_CHECK" }; - return cmContains(reservedTargets, name); + return cm::contains(reservedTargets, name); } void cmGlobalGenerator::SetExternalMakefileProjectGenerator( diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 289a035..24559e6 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -10,8 +10,8 @@ #include <cm/memory> #include <cm/string> +#include <cmext/algorithm> -#include "cmAlgorithms.h" #include "cmDocumentationEntry.h" #include "cmGeneratedFileStream.h" #include "cmGeneratorTarget.h" @@ -585,14 +585,14 @@ cmGlobalGhsMultiGenerator::GenerateBuildCommand( /* if multiple top-projects are found in build directory * then prefer projectName top-project. */ - if (!cmContains(files, proj)) { + if (!cm::contains(files, proj)) { proj = files.at(0); } } makeCommand.Add("-top", proj); if (!targetNames.empty()) { - if (cmContains(targetNames, "clean")) { + if (cm::contains(targetNames, "clean")) { makeCommand.Add("-clean"); } else { for (const auto& tname : targetNames) { diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 5a31ab2..8ef19cc 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -18,7 +18,6 @@ #include "cm_jsoncpp_value.h" #include "cm_jsoncpp_writer.h" -#include "cmAlgorithms.h" #include "cmDocumentationEntry.h" #include "cmFortranParser.h" #include "cmGeneratedFileStream.h" @@ -436,8 +435,6 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator(cmake* cm) #ifdef _WIN32 cm->GetState()->SetWindowsShell(true); #endif - // // Ninja is not ported to non-Unix OS yet. - // this->ForceUnixPaths = true; this->FindMakeProgramFile = "CMakeNinjaFindMake.cmake"; } @@ -687,10 +684,10 @@ void cmGlobalNinjaGenerator::CheckNinjaFeatures() bool cmGlobalNinjaGenerator::CheckLanguages( std::vector<std::string> const& languages, cmMakefile* mf) const { - if (cmContains(languages, "Fortran")) { + if (cm::contains(languages, "Fortran")) { return this->CheckFortran(mf); } - if (cmContains(languages, "Swift")) { + if (cm::contains(languages, "Swift")) { const std::string architectures = mf->GetSafeDefinition("CMAKE_OSX_ARCHITECTURES"); if (architectures.find_first_of(';') != std::string::npos) { @@ -715,14 +712,7 @@ bool cmGlobalNinjaGenerator::CheckFortran(cmMakefile* mf) const e << "The Ninja generator does not support Fortran using Ninja version\n" " " << this->NinjaVersion << "\n" - "due to lack of required features. " - "Kitware has implemented the required features and they have been " - "merged to upstream ninja for inclusion in Ninja 1.10 and higher. " - "As of this version of CMake, Ninja 1.10 has not been released. " - "Meanwhile, Kitware maintains a branch of Ninja at:\n" - " https://github.com/Kitware/ninja/tree/features-for-fortran#readme\n" - "with the required features. " - "One may build ninja from that branch to get support for Fortran." + "due to lack of required features. Ninja 1.10 or higher is required." ; /* clang-format on */ mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); @@ -1064,10 +1054,9 @@ void cmGlobalNinjaGenerator::WriteAssumedSourceDependencies() } std::string cmGlobalNinjaGenerator::OrderDependsTargetForTarget( - cmGeneratorTarget const* target, const std::string& config) + cmGeneratorTarget const* target, const std::string& /*config*/) const { - return cmStrCat("cmake_object_order_depends_target_", target->GetName(), '_', - cmSystemTools::UpperCase(config)); + return cmStrCat("cmake_object_order_depends_target_", target->GetName()); } void cmGlobalNinjaGenerator::AppendTargetOutputs( @@ -2688,3 +2677,10 @@ bool cmGlobalNinjaMultiGenerator::ReadCacheEntriesForBuild( return true; } + +std::string cmGlobalNinjaMultiGenerator::OrderDependsTargetForTarget( + cmGeneratorTarget const* target, const std::string& config) const +{ + return cmStrCat("cmake_object_order_depends_target_", target->GetName(), '_', + cmSystemTools::UpperCase(config)); +} diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 5668dd1..b89fb8f 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -315,8 +315,8 @@ public: ASD.insert(deps.begin(), deps.end()); } - static std::string OrderDependsTargetForTarget( - cmGeneratorTarget const* target, const std::string& config); + virtual std::string OrderDependsTargetForTarget( + cmGeneratorTarget const* target, const std::string& config) const; void AppendTargetOutputs( cmGeneratorTarget const* target, cmNinjaDeps& outputs, @@ -644,6 +644,9 @@ public: bool SupportsCrossConfigs() const override { return true; } bool SupportsDefaultConfigs() const override { return true; } + std::string OrderDependsTargetForTarget( + cmGeneratorTarget const* target, const std::string& config) const override; + protected: bool OpenBuildFileStreams() override; void CloseBuildFileStreams() override; diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 582877f..5363ea5 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -117,6 +117,12 @@ void cmGlobalUnixMakefileGenerator3::ComputeTargetObjectDirectory( gt->ObjectDirectory = dir; } +bool cmGlobalUnixMakefileGenerator3::CanEscapeOctothorpe() const +{ + // Make tools that use UNIX-style '/' paths also support '\' escaping. + return this->ForceUnixPaths; +} + void cmGlobalUnixMakefileGenerator3::Configure() { // Initialize CMAKE_EDIT_COMMAND cache entry. @@ -480,6 +486,78 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRules2( } } +namespace { +std::string ConvertToMakefilePathForUnix(std::string const& path) +{ + std::string result; + result.reserve(path.size()); + for (char c : path) { + switch (c) { + case '=': + // We provide 'EQUALS = =' to encode '=' in a non-assignment case. + result.append("$(EQUALS)"); + break; + case '$': + result.append("$$"); + break; + case '\\': + case ' ': + case '#': + result.push_back('\\'); + CM_FALLTHROUGH; + default: + result.push_back(c); + break; + } + } + return result; +} + +#if defined(_WIN32) && !defined(__CYGWIN__) +std::string ConvertToMakefilePathForWindows(std::string const& path) +{ + bool const quote = path.find_first_of(" #") != std::string::npos; + std::string result; + result.reserve(path.size() + (quote ? 2 : 0)); + if (quote) { + result.push_back('"'); + } + for (char c : path) { + switch (c) { + case '=': + // We provide 'EQUALS = =' to encode '=' in a non-assignment case. + result.append("$(EQUALS)"); + break; + case '$': + result.append("$$"); + break; + case '/': + result.push_back('\\'); + break; + default: + result.push_back(c); + break; + } + } + if (quote) { + result.push_back('"'); + } + return result; +} +#endif +} + +std::string cmGlobalUnixMakefileGenerator3::ConvertToMakefilePath( + std::string const& path) const +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + if (!this->ForceUnixPaths) { + return ConvertToMakefilePathForWindows(path); + } +#endif + return ConvertToMakefilePathForUnix(path); +} + std::vector<cmGlobalGenerator::GeneratedMakeCommand> cmGlobalUnixMakefileGenerator3::GenerateBuildCommand( const std::string& makeProgram, const std::string& /*projectName*/, diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 19b2b85..1caa4b7 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -136,6 +136,12 @@ public: or dependencies. */ std::string GetEmptyRuleHackDepends() { return this->EmptyRuleHackDepends; } + /** + * Convert a file path to a Makefile target or dependency with + * escaping and quoting suitable for the generator's make tool. + */ + std::string ConvertToMakefilePath(std::string const& path) const; + // change the build command for speed std::vector<GeneratedMakeCommand> GenerateBuildCommand( const std::string& makeProgram, const std::string& projectName, @@ -157,6 +163,9 @@ public: /** Does the make tool tolerate .DELETE_ON_ERROR? */ virtual bool AllowDeleteOnError() const { return true; } + /** Does the make tool interpret '\#' as '#'? */ + virtual bool CanEscapeOctothorpe() const; + bool IsIPOSupported() const override { return true; } void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const override; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index c0068b4..1a753e2 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -15,7 +15,6 @@ #include "cmsys/RegularExpression.hxx" -#include "cmAlgorithms.h" #include "cmComputeLinkInformation.h" #include "cmCustomCommand.h" #include "cmCustomCommandGenerator.h" @@ -363,7 +362,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( std::string projectArg = cmStrCat(projectName, ".xcodeproj"); makeCommand.Add(projectArg); } - if (cmContains(targetNames, "clean")) { + if (cm::contains(targetNames, "clean")) { makeCommand.Add("clean"); makeCommand.Add("-target", "ALL_BUILD"); } else { @@ -911,7 +910,7 @@ void cmGlobalXCodeGenerator::AddXCodeProjBuildRule( "/CMakeLists.txt"); cmSourceFile* srcCMakeLists = target->Makefile->GetOrCreateSource( listfile, false, cmSourceFileLocationKind::Known); - if (!cmContains(sources, srcCMakeLists)) { + if (!cm::contains(sources, srcCMakeLists)) { sources.push_back(srcCMakeLists); } } @@ -1427,8 +1426,8 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt) bool cmGlobalXCodeGenerator::IsHeaderFile(cmSourceFile* sf) { - return cmContains(this->CMakeInstance->GetHeaderExtensions(), - sf->GetExtension()); + return cm::contains(this->CMakeInstance->GetHeaderExtensions(), + sf->GetExtension()); } cmXCodeObject* cmGlobalXCodeGenerator::CreateBuildPhase( diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index 14264f4..ae801bb 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -2,7 +2,9 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmIncludeCommand.h" +#include <map> #include <sstream> +#include <utility> #include "cmExecutionStatus.h" #include "cmGlobalGenerator.h" @@ -16,6 +18,11 @@ bool cmIncludeCommand(std::vector<std::string> const& args, cmExecutionStatus& status) { + static std::map<std::string, cmPolicies::PolicyID> DeprecatedModules; + if (DeprecatedModules.empty()) { + DeprecatedModules["Documentation"] = cmPolicies::CMP0106; + } + if (args.empty() || args.size() > 4) { status.SetError("called with wrong number of arguments. " "include() only takes one file."); @@ -65,9 +72,35 @@ bool cmIncludeCommand(std::vector<std::string> const& args, } if (!cmSystemTools::FileIsFullPath(fname)) { + bool system = false; // Not a path. Maybe module. std::string module = cmStrCat(fname, ".cmake"); - std::string mfile = status.GetMakefile().GetModulesFile(module); + std::string mfile = status.GetMakefile().GetModulesFile(module, system); + + if (system) { + auto ModulePolicy = DeprecatedModules.find(fname); + if (ModulePolicy != DeprecatedModules.end()) { + cmPolicies::PolicyStatus PolicyStatus = + status.GetMakefile().GetPolicyStatus(ModulePolicy->second); + switch (PolicyStatus) { + case cmPolicies::WARN: { + status.GetMakefile().IssueMessage( + MessageType::AUTHOR_WARNING, + cmStrCat(cmPolicies::GetPolicyWarning(ModulePolicy->second), + "\n")); + CM_FALLTHROUGH; + } + case cmPolicies::OLD: + break; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::NEW: + mfile = ""; + break; + } + } + } + if (!mfile.empty()) { fname = mfile; } diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h index ae87e45..f27648c 100644 --- a/Source/cmLinkItem.h +++ b/Source/cmLinkItem.h @@ -10,7 +10,8 @@ #include <string> #include <vector> -#include "cmAlgorithms.h" +#include <cmext/algorithm> + #include "cmListFileCache.h" #include "cmSystemTools.h" #include "cmTargetLinkLibraryType.h" @@ -127,7 +128,7 @@ inline cmTargetLinkLibraryType CMP0003_ComputeLinkType( // Check if any entry in the list matches this configuration. std::string configUpper = cmSystemTools::UpperCase(config); - if (cmContains(debugConfigs, configUpper)) { + if (cm::contains(debugConfigs, configUpper)) { return DEBUG_LibraryType; } // The current configuration is not a debug configuration. diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx index 65ed34c..b9a73b0 100644 --- a/Source/cmLinkLineDeviceComputer.cxx +++ b/Source/cmLinkLineDeviceComputer.cxx @@ -6,7 +6,8 @@ #include <set> #include <utility> -#include "cmAlgorithms.h" +#include <cmext/algorithm> + #include "cmComputeLinkInformation.h" #include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" @@ -188,7 +189,7 @@ bool requireDeviceLinking(cmGeneratorTarget& target, cmLocalGenerator& lg, cmGeneratorTarget::LinkClosure const* closure = target.GetLinkClosure(config); - if (cmContains(closure->Languages, "CUDA")) { + if (cm::contains(closure->Languages, "CUDA")) { if (const char* separableCompilation = target.GetProperty("CUDA_SEPARABLE_COMPILATION")) { if (cmIsOn(separableCompilation)) { diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 860b4da..1d82dfc 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -16,6 +16,7 @@ #include <vector> #include <cm/memory> +#include <cmext/algorithm> #include "cmsys/RegularExpression.hxx" @@ -66,7 +67,7 @@ bool GetList(std::vector<std::string>& list, const std::string& var, // expand the variable into a list cmExpandList(listString, list, true); // if no empty elements then just return - if (!cmContains(list, std::string())) { + if (!cm::contains(list, std::string())) { return true; } // if we have empty elements we need to check policy CMP0007 diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index a55e094..829f9cc 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -20,7 +20,6 @@ #include "cmsys/RegularExpression.hxx" -#include "cmAlgorithms.h" #include "cmComputeLinkInformation.h" #include "cmCustomCommand.h" #include "cmCustomCommandGenerator.h" @@ -35,7 +34,6 @@ #include "cmInstallScriptGenerator.h" #include "cmInstallTargetGenerator.h" #include "cmLinkLineComputer.h" -#include "cmLinkLineDeviceComputer.h" #include "cmMakefile.h" #include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" @@ -1255,7 +1253,7 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit( // directly. In this case adding -I/usr/include can hide SDK headers so we // must still exclude it. if ((lang == "C" || lang == "CXX" || lang == "CUDA") && - !cmContains(impDirVec, "/usr/include") && + !cm::contains(impDirVec, "/usr/include") && std::find_if(impDirVec.begin(), impDirVec.end(), [](std::string const& d) { return cmHasLiteralSuffix(d, "/usr/include"); @@ -1276,13 +1274,14 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit( &lang](std::string const& dir) { return ( // Do not exclude directories that are not in an excluded set. - ((!cmContains(implicitSet, this->GlobalGenerator->GetRealPath(dir))) && - (!cmContains(implicitExclude, dir))) + ((!cm::contains(implicitSet, this->GlobalGenerator->GetRealPath(dir))) && + (!cm::contains(implicitExclude, dir))) // Do not exclude entries of the CPATH environment variable even though // they are implicitly searched by the compiler. They are meant to be // user-specified directories that can be re-ordered or converted to // -isystem without breaking real compiler builtin headers. - || ((lang == "C" || lang == "CXX") && cmContains(this->EnvCPATH, dir))); + || + ((lang == "C" || lang == "CXX") && cm::contains(this->EnvCPATH, dir))); }; // Get the target-specific include directories. @@ -1329,7 +1328,7 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit( if (!stripImplicitDirs) { // Append implicit directories that were requested by the user only for (BT<std::string> const& udr : userDirs) { - if (cmContains(implicitSet, cmSystemTools::GetRealPath(udr.Value))) { + if (cm::contains(implicitSet, cmSystemTools::GetRealPath(udr.Value))) { emitBT(udr); } } @@ -1423,6 +1422,30 @@ std::vector<BT<std::string>> cmLocalGenerator::GetStaticLibraryFlags( return flags; } +void cmLocalGenerator::GetDeviceLinkFlags( + cmLinkLineComputer* linkLineComputer, const std::string& config, + std::string& linkLibs, std::string& linkFlags, std::string& frameworkPath, + std::string& linkPath, cmGeneratorTarget* target) +{ + cmGeneratorTarget::DeviceLinkSetter setter(*target); + + cmComputeLinkInformation* pcli = target->GetLinkInformation(config); + const std::string linkLanguage = + linkLineComputer->GetLinkerLanguage(target, config); + + if (pcli) { + // Compute the required cuda device link libraries when + // resolving cuda device symbols + this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs, frameworkPath, + linkPath); + } + + std::vector<std::string> linkOpts; + target->GetLinkOptions(linkOpts, config, linkLanguage); + // LINK_OPTIONS are escaped. + this->AppendCompileOptions(linkFlags, linkOpts); +} + void cmLocalGenerator::GetTargetFlags( cmLinkLineComputer* linkLineComputer, const std::string& config, std::string& linkLibs, std::string& flags, std::string& linkFlags, @@ -1455,12 +1478,6 @@ void cmLocalGenerator::GetTargetFlags( switch (target->GetType()) { case cmStateEnums::STATIC_LIBRARY: linkFlags = this->GetStaticLibraryFlags(config, linkLanguage, target); - if (pcli && dynamic_cast<cmLinkLineDeviceComputer*>(linkLineComputer)) { - // Compute the required cuda device link libraries when - // resolving cuda device symbols - this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs, - frameworkPath, linkPath); - } break; case cmStateEnums::MODULE_LIBRARY: libraryLinkVariable = "CMAKE_MODULE_LINKER_FLAGS"; @@ -1827,10 +1844,10 @@ std::string cmLocalGenerator::GetLinkLibsCMP0065( "CMAKE_POLICY_WARNING_CMP0065")) { std::ostringstream w; /* clang-format off */ - w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0065) << "\n" - "For compatibility with older versions of CMake, " - "additional flags may be added to export symbols on all " - "executables regardless of their ENABLE_EXPORTS property."; + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0065) << "\n" + "For compatibility with older versions of CMake, " + "additional flags may be added to export symbols on all " + "executables regardless of their ENABLE_EXPORTS property."; /* clang-format on */ this->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); } @@ -1863,6 +1880,26 @@ std::string cmLocalGenerator::GetLinkLibsCMP0065( return linkFlags; } +bool cmLocalGenerator::AllAppleArchSysrootsAreTheSame( + const std::vector<std::string>& archs, const char* sysroot) +{ + if (!sysroot) { + return false; + } + + for (std::string const& arch : archs) { + std::string const& archSysroot = this->AppleArchSysroots[arch]; + if (cmIsOff(archSysroot)) { + continue; + } + if (archSysroot != sysroot) { + return false; + } + } + + return true; +} + void cmLocalGenerator::AddArchitectureFlags(std::string& flags, cmGeneratorTarget const* target, const std::string& lang, @@ -1891,7 +1928,8 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, std::string("CMAKE_") + lang + "_SYSROOT_FLAG"; const char* sysrootFlag = this->Makefile->GetDefinition(sysrootFlagVar); if (sysrootFlag && *sysrootFlag) { - if (!this->AppleArchSysroots.empty()) { + if (!this->AppleArchSysroots.empty() && + !this->AllAppleArchSysrootsAreTheSame(archs, sysroot)) { for (std::string const& arch : archs) { std::string const& archSysroot = this->AppleArchSysroots[arch]; if (cmIsOff(archSysroot)) { @@ -1945,6 +1983,8 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags, this->AppendFlags(flags, "-swift-version " + std::string(v)); } } + } else if (lang == "CUDA") { + target->AddCUDAArchitectureFlags(flags); } // Add MSVC runtime library flags. This is activated by the presence @@ -2031,7 +2071,6 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName, if (name.empty()) { return false; } - if (cmSystemTools::GetFilenameLastExtension(name) == ".exe") { name = cmSystemTools::GetFilenameWithoutLastExtension(name); } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 5fb9337..1492304 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -421,6 +421,11 @@ public: /** Fill out these strings for the given target. Libraries to link, * flags, and linkflags. */ + void GetDeviceLinkFlags(cmLinkLineComputer* linkLineComputer, + const std::string& config, std::string& linkLibs, + std::string& linkFlags, std::string& frameworkPath, + std::string& linkPath, cmGeneratorTarget* target); + void GetTargetFlags(cmLinkLineComputer* linkLineComputer, const std::string& config, std::string& linkLibs, std::string& flags, std::string& linkFlags, @@ -533,6 +538,8 @@ private: int targetType); void ComputeObjectMaxPath(); + bool AllAppleArchSysrootsAreTheSame(const std::vector<std::string>& archs, + const char* sysroot); }; #if !defined(CMAKE_BOOTSTRAP) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 99428bc..aa8912e 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -48,37 +48,6 @@ # include "cmDependsJava.h" #endif -// Escape special characters in Makefile dependency lines -class cmMakeSafe -{ -public: - cmMakeSafe(const char* s) - : Data(s) - { - } - cmMakeSafe(std::string const& s) - : Data(s.c_str()) - { - } - -private: - const char* Data; - friend std::ostream& operator<<(std::ostream& os, cmMakeSafe const& self) - { - for (const char* c = self.Data; *c; ++c) { - switch (*c) { - case '=': - os << "$(EQUALS)"; - break; - default: - os << *c; - break; - } - } - return os; - } -}; - // Helper function used below. static std::string cmSplitExtension(std::string const& in, std::string& base) { @@ -498,6 +467,14 @@ const std::string& cmLocalUnixMakefileGenerator3::GetHomeRelativeOutputPath() return this->HomeRelativeOutputPath; } +std::string cmLocalUnixMakefileGenerator3::ConvertToMakefilePath( + std::string const& path) const +{ + cmGlobalUnixMakefileGenerator3* gg = + static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator); + return gg->ConvertToMakefilePath(path); +} + void cmLocalUnixMakefileGenerator3::WriteMakeRule( std::ostream& os, const char* comment, const std::string& target, const std::vector<std::string>& depends, @@ -528,7 +505,7 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule( } // Construct the left hand side of the rule. - std::string tgt = cmSystemTools::ConvertToOutputPath( + std::string tgt = this->ConvertToMakefilePath( this->MaybeConvertToRelativePath(this->GetBinaryDirectory(), target)); const char* space = ""; @@ -542,30 +519,30 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule( if (symbolic) { if (const char* sym = this->Makefile->GetDefinition("CMAKE_MAKE_SYMBOLIC_RULE")) { - os << cmMakeSafe(tgt) << space << ": " << sym << "\n"; + os << tgt << space << ": " << sym << "\n"; } } // Write the rule. if (depends.empty()) { // No dependencies. The commands will always run. - os << cmMakeSafe(tgt) << space << ":\n"; + os << tgt << space << ":\n"; } else { // Split dependencies into multiple rule lines. This allows for // very long dependency lists even on older make implementations. std::string binDir = this->GetBinaryDirectory(); for (std::string const& depend : depends) { - replace = depend; - replace = cmSystemTools::ConvertToOutputPath( - this->MaybeConvertToRelativePath(binDir, replace)); - os << cmMakeSafe(tgt) << space << ": " << cmMakeSafe(replace) << "\n"; + os << tgt << space << ": " + << this->ConvertToMakefilePath( + this->MaybeConvertToRelativePath(binDir, depend)) + << '\n'; } } // Write the list of commands. os << cmWrap("\t", commands, "", "\n") << "\n"; if (symbolic && !this->IsWatcomWMake()) { - os << ".PHONY : " << cmMakeSafe(tgt) << "\n"; + os << ".PHONY : " << tgt << "\n"; } os << "\n"; // Add the output to the local help if requested. diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 68eeb29..2b07952 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -46,6 +46,12 @@ public: // local generators StartOutputDirectory const std::string& GetHomeRelativeOutputPath(); + /** + * Convert a file path to a Makefile target or dependency with + * escaping and quoting suitable for the generator's make tool. + */ + std::string ConvertToMakefilePath(std::string const& path) const; + // Write out a make rule void WriteMakeRule(std::ostream& os, const char* comment, const std::string& target, diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 2dfdd1f..95c798b 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -3,6 +3,7 @@ #include "cmLocalVisualStudio7Generator.h" #include <cm/memory> +#include <cmext/algorithm> #include <windows.h> @@ -1522,7 +1523,7 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo( // If HEADER_FILE_ONLY is set, we must suppress this generation in // the project file fc.ExcludedFromBuild = sf.GetPropertyAsBool("HEADER_FILE_ONLY") || - !cmContains(acs.Configs, ci) || + !cm::contains(acs.Configs, ci) || (gt->GetPropertyAsBool("UNITY_BUILD") && sf.GetProperty("UNITY_SOURCE_FILE") && !sf.GetPropertyAsBool("SKIP_UNITY_BUILD_INCLUSION")); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 85e7df1..028b0f5 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -27,7 +27,6 @@ #include "cm_static_string_view.hxx" #include "cm_sys_stat.h" -#include "cmAlgorithms.h" #include "cmCommandArgumentParserHelper.h" #include "cmCustomCommand.h" #include "cmCustomCommandLines.h" @@ -1645,7 +1644,7 @@ void cmMakefile::Configure() allowedCommands.insert("message"); isProblem = false; for (cmListFileFunction const& func : listFile.Functions) { - if (!cmContains(allowedCommands, func.Name.Lower)) { + if (!cm::contains(allowedCommands, func.Name.Lower)) { isProblem = true; break; } @@ -4294,7 +4293,7 @@ cmTarget* cmMakefile::FindTargetToUse(const std::string& name, bool cmMakefile::IsAlias(const std::string& name) const { - if (cmContains(this->AliasTargets, name)) { + if (cm::contains(this->AliasTargets, name)) { return true; } return this->GetGlobalGenerator()->IsAlias(name); @@ -4664,7 +4663,7 @@ bool cmMakefile::AddRequiredTargetFeature(cmTarget* target, } std::vector<std::string> availableFeatures = cmExpandedList(features); - if (!cmContains(availableFeatures, feature)) { + if (!cm::contains(availableFeatures, feature)) { std::ostringstream e; e << "The compiler feature \"" << feature << "\" is not known to " << lang << " compiler\n\"" @@ -4961,27 +4960,27 @@ void cmMakefile::CheckNeededCxxLanguage(const std::string& feature, if (const char* propCxx98 = this->GetDefinition(cmStrCat("CMAKE_", lang, "98_COMPILE_FEATURES"))) { std::vector<std::string> props = cmExpandedList(propCxx98); - needCxx98 = cmContains(props, feature); + needCxx98 = cm::contains(props, feature); } if (const char* propCxx11 = this->GetDefinition(cmStrCat("CMAKE_", lang, "11_COMPILE_FEATURES"))) { std::vector<std::string> props = cmExpandedList(propCxx11); - needCxx11 = cmContains(props, feature); + needCxx11 = cm::contains(props, feature); } if (const char* propCxx14 = this->GetDefinition(cmStrCat("CMAKE_", lang, "14_COMPILE_FEATURES"))) { std::vector<std::string> props = cmExpandedList(propCxx14); - needCxx14 = cmContains(props, feature); + needCxx14 = cm::contains(props, feature); } if (const char* propCxx17 = this->GetDefinition(cmStrCat("CMAKE_", lang, "17_COMPILE_FEATURES"))) { std::vector<std::string> props = cmExpandedList(propCxx17); - needCxx17 = cmContains(props, feature); + needCxx17 = cm::contains(props, feature); } if (const char* propCxx20 = this->GetDefinition(cmStrCat("CMAKE_", lang, "20_COMPILE_FEATURES"))) { std::vector<std::string> props = cmExpandedList(propCxx20); - needCxx20 = cmContains(props, feature); + needCxx20 = cm::contains(props, feature); } } @@ -5120,27 +5119,27 @@ void cmMakefile::CheckNeededCudaLanguage(const std::string& feature, if (const char* propCuda03 = this->GetDefinition(cmStrCat("CMAKE_", lang, "03_COMPILE_FEATURES"))) { std::vector<std::string> props = cmExpandedList(propCuda03); - needCuda03 = cmContains(props, feature); + needCuda03 = cm::contains(props, feature); } if (const char* propCuda11 = this->GetDefinition(cmStrCat("CMAKE_", lang, "11_COMPILE_FEATURES"))) { std::vector<std::string> props = cmExpandedList(propCuda11); - needCuda11 = cmContains(props, feature); + needCuda11 = cm::contains(props, feature); } if (const char* propCuda14 = this->GetDefinition(cmStrCat("CMAKE_", lang, "14_COMPILE_FEATURES"))) { std::vector<std::string> props = cmExpandedList(propCuda14); - needCuda14 = cmContains(props, feature); + needCuda14 = cm::contains(props, feature); } if (const char* propCuda17 = this->GetDefinition(cmStrCat("CMAKE_", lang, "17_COMPILE_FEATURES"))) { std::vector<std::string> props = cmExpandedList(propCuda17); - needCuda17 = cmContains(props, feature); + needCuda17 = cm::contains(props, feature); } if (const char* propCuda20 = this->GetDefinition(cmStrCat("CMAKE_", lang, "20_COMPILE_FEATURES"))) { std::vector<std::string> props = cmExpandedList(propCuda20); - needCuda20 = cmContains(props, feature); + needCuda20 = cm::contains(props, feature); } } @@ -5214,17 +5213,17 @@ void cmMakefile::CheckNeededCLanguage(const std::string& feature, if (const char* propC90 = this->GetDefinition(cmStrCat("CMAKE_", lang, "90_COMPILE_FEATURES"))) { std::vector<std::string> props = cmExpandedList(propC90); - needC90 = cmContains(props, feature); + needC90 = cm::contains(props, feature); } if (const char* propC99 = this->GetDefinition(cmStrCat("CMAKE_", lang, "99_COMPILE_FEATURES"))) { std::vector<std::string> props = cmExpandedList(propC99); - needC99 = cmContains(props, feature); + needC99 = cm::contains(props, feature); } if (const char* propC11 = this->GetDefinition(cmStrCat("CMAKE_", lang, "11_COMPILE_FEATURES"))) { std::vector<std::string> props = cmExpandedList(propC11); - needC11 = cmContains(props, feature); + needC11 = cm::contains(props, feature); } } diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 4fe10ad..e15b016 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -122,31 +122,15 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule( } // Build a list of compiler flags and linker flags. - std::string flags; + std::string langFlags; std::string linkFlags; - // Add flags to create an executable. - // Add symbol export flags if necessary. - if (this->GeneratorTarget->IsExecutableWithExports()) { - std::string export_flag_var = - cmStrCat("CMAKE_EXE_EXPORTS_", linkLanguage, "_FLAG"); - this->LocalGenerator->AppendFlags( - linkFlags, this->Makefile->GetSafeDefinition(export_flag_var)); - } - - this->LocalGenerator->AppendFlags(linkFlags, - this->LocalGenerator->GetLinkLibsCMP0065( - linkLanguage, *this->GeneratorTarget)); - // Add language feature flags. this->LocalGenerator->AddLanguageFlagsForLinking( - flags, this->GeneratorTarget, linkLanguage, this->GetConfigName()); - - this->LocalGenerator->AddArchitectureFlags( - flags, this->GeneratorTarget, linkLanguage, this->GetConfigName()); + langFlags, this->GeneratorTarget, linkLanguage, this->GetConfigName()); - // Add target-specific linker flags. - this->GetTargetLinkFlags(linkFlags, linkLanguage); + // Add device-specific linker flags. + this->GetDeviceLinkFlags(linkFlags, linkLanguage); // Construct a list of files associated with this executable that // may need to be cleaned. @@ -226,7 +210,7 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule( vars.ObjectDir = objectDir.c_str(); vars.Target = target.c_str(); vars.LinkLibraries = linkLibs.c_str(); - vars.Flags = flags.c_str(); + vars.LanguageCompileFlags = langFlags.c_str(); vars.LinkFlags = linkFlags.c_str(); vars.TargetCompilePDB = targetOutPathCompilePDB.c_str(); diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 372b43b..2d360e6 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -249,9 +249,14 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules( std::vector<std::string> depends; this->AppendLinkDepends(depends, linkLanguage); + // Add language-specific flags. + std::string langFlags; + this->LocalGenerator->AddLanguageFlagsForLinking( + langFlags, this->GeneratorTarget, linkLanguage, this->GetConfigName()); + // Create set of linking flags. std::string linkFlags; - this->GetTargetLinkFlags(linkFlags, linkLanguage); + this->GetDeviceLinkFlags(linkFlags, linkLanguage); // Get the name of the device object to generate. std::string const targetOutputReal = @@ -344,16 +349,10 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules( vars.Target = target.c_str(); vars.LinkLibraries = linkLibs.c_str(); vars.ObjectsQuoted = buildObjs.c_str(); + vars.LanguageCompileFlags = langFlags.c_str(); vars.LinkFlags = linkFlags.c_str(); vars.TargetCompilePDB = targetOutPathCompilePDB.c_str(); - // Add language-specific flags. - std::string langFlags; - this->LocalGenerator->AddLanguageFlagsForLinking( - langFlags, this->GeneratorTarget, linkLanguage, this->GetConfigName()); - - vars.LanguageCompileFlags = langFlags.c_str(); - std::string launcher; const char* val = this->LocalGenerator->GetRuleLauncher( this->GeneratorTarget, "RULE_LAUNCH_LINK"); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 2d8f8d6..b21946c 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -87,6 +87,18 @@ std::string cmMakefileTargetGenerator::GetConfigName() return configNames.front(); } +void cmMakefileTargetGenerator::GetDeviceLinkFlags( + std::string& linkFlags, const std::string& linkLanguage) +{ + cmGeneratorTarget::DeviceLinkSetter setter(*this->GetGeneratorTarget()); + + std::vector<std::string> linkOpts; + this->GeneratorTarget->GetLinkOptions(linkOpts, this->GetConfigName(), + linkLanguage); + // LINK_OPTIONS are escaped. + this->LocalGenerator->AppendCompileOptions(linkFlags, linkOpts); +} + void cmMakefileTargetGenerator::GetTargetLinkFlags( std::string& flags, const std::string& linkLanguage) { @@ -341,12 +353,16 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags() << "\n"; } + bool const escapeOctothorpe = this->GlobalGenerator->CanEscapeOctothorpe(); + for (std::string const& language : languages) { std::string defines = this->GetDefines(language, this->GetConfigName()); std::string includes = this->GetIncludes(language, this->GetConfigName()); - // Escape comment characters so they do not terminate assignment. - cmSystemTools::ReplaceString(defines, "#", "\\#"); - cmSystemTools::ReplaceString(includes, "#", "\\#"); + if (escapeOctothorpe) { + // Escape comment characters so they do not terminate assignment. + cmSystemTools::ReplaceString(defines, "#", "\\#"); + cmSystemTools::ReplaceString(includes, "#", "\\#"); + } *this->FlagFileStream << language << "_DEFINES = " << defines << "\n\n"; *this->FlagFileStream << language << "_INCLUDES = " << includes << "\n\n"; @@ -357,7 +373,9 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags() for (const std::string& arch : architectures) { std::string flags = this->GetFlags(language, this->GetConfigName(), arch); - cmSystemTools::ReplaceString(flags, "#", "\\#"); + if (escapeOctothorpe) { + cmSystemTools::ReplaceString(flags, "#", "\\#"); + } *this->FlagFileStream << language << "_FLAGS" << arch << " = " << flags << "\n\n"; } diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index ec6b314..f38f862 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -60,6 +60,8 @@ public: std::string GetConfigName(); protected: + void GetDeviceLinkFlags(std::string& linkFlags, + const std::string& linkLanguage); void GetTargetLinkFlags(std::string& flags, const std::string& linkLanguage); // create the file and directory etc diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 9c4ff83..49e8af9 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -233,11 +233,7 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkRule( vars.LinkFlags = "$LINK_FLAGS"; vars.Manifests = "$MANIFESTS"; - std::string langFlags; - if (this->GetGeneratorTarget()->GetType() != cmStateEnums::EXECUTABLE) { - langFlags += "$LANGUAGE_COMPILE_FLAGS $ARCH_FLAGS"; - vars.LanguageCompileFlags = langFlags.c_str(); - } + vars.LanguageCompileFlags = "$LANGUAGE_COMPILE_FLAGS"; std::string launcher; const char* val = this->GetLocalGenerator()->GetRuleLauncher( @@ -590,8 +586,6 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement( return; } - // Now we can do device linking - // First and very important step is to make sure while inside this // step our link language is set to CUDA std::string cudaLinkLanguage = "CUDA"; @@ -677,9 +671,9 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement( linkLineComputer->SetUseWatcomQuote(useWatcomQuote); linkLineComputer->SetUseNinjaMulti(globalGen->IsMultiConfig()); - localGen.GetTargetFlags( - linkLineComputer.get(), config, vars["LINK_LIBRARIES"], vars["FLAGS"], - vars["LINK_FLAGS"], frameworkPath, linkPath, genTarget); + localGen.GetDeviceLinkFlags(linkLineComputer.get(), config, + vars["LINK_LIBRARIES"], vars["LINK_FLAGS"], + frameworkPath, linkPath, genTarget); this->addPoolNinjaVariable("JOB_POOL_LINK", genTarget, vars); @@ -689,22 +683,12 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement( vars["LINK_PATH"] = frameworkPath + linkPath; - // Compute architecture specific link flags. Yes, these go into a different - // variable for executables, probably due to a mistake made when duplicating - // code between the Makefile executable and library generators. - if (targetType == cmStateEnums::EXECUTABLE) { - std::string t = vars["FLAGS"]; - localGen.AddArchitectureFlags(t, genTarget, cudaLinkLanguage, config); - vars["FLAGS"] = t; - } else { - std::string t = vars["ARCH_FLAGS"]; - localGen.AddArchitectureFlags(t, genTarget, cudaLinkLanguage, config); - vars["ARCH_FLAGS"] = t; - t.clear(); - localGen.AddLanguageFlagsForLinking(t, genTarget, cudaLinkLanguage, - config); - vars["LANGUAGE_COMPILE_FLAGS"] = t; - } + // Compute language specific link flags. + std::string langFlags; + localGen.AddLanguageFlagsForLinking(langFlags, genTarget, cudaLinkLanguage, + config); + vars["LANGUAGE_COMPILE_FLAGS"] = langFlags; + auto const tgtNames = this->TargetNames(config); if (genTarget->HasSOName(config)) { vars["SONAME_FLAG"] = diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index a70b6a0..701c44f 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -147,7 +147,7 @@ bool cmNinjaTargetGenerator::NeedDyndep(std::string const& lang) const std::string cmNinjaTargetGenerator::OrderDependsTargetForTarget( const std::string& config) { - return cmGlobalNinjaGenerator::OrderDependsTargetForTarget( + return this->GetGlobalGenerator()->OrderDependsTargetForTarget( this->GeneratorTarget, config); } diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 1c6fad1..68bf3af 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -26,7 +26,7 @@ std::string cmOutputConverter::ConvertToOutputForExisting( // already exists, we can use a short-path to reference it without a // space. if (this->GetState()->UseWindowsShell() && - remote.find(' ') != std::string::npos && + remote.find_first_of(" #") != std::string::npos && cmSystemTools::FileExists(remote)) { std::string tmp; if (cmSystemTools::GetShortPath(remote, tmp)) { diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index d3daad8..4abfa1f 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -307,8 +307,16 @@ class cmMakefile; "mark_as_advanced() does nothing if a cache entry does not exist.", \ 3, 17, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0103, \ - "multiple export() with same FILE without APPEND is not allowed.", \ - 3, 18, 0, cmPolicies::WARN) + "Multiple export() with same FILE without APPEND is not allowed.", \ + 3, 18, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0104, \ + "CMAKE_CUDA_ARCHITECTURES now detected for NVCC, empty " \ + "CUDA_ARCHITECTURES not allowed.", \ + 3, 18, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0105, "Device link step uses the link options.", 3, 18, \ + 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0106, "The Documentation module is removed.", 3, 18, 0, \ + cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ @@ -338,7 +346,9 @@ class cmMakefile; F(CMP0081) \ F(CMP0083) \ F(CMP0095) \ - F(CMP0099) + F(CMP0099) \ + F(CMP0104) \ + F(CMP0105) /** \class cmPolicies * \brief Handles changes in CMake behavior and policies diff --git a/Source/cmQtAutoGen.cxx b/Source/cmQtAutoGen.cxx index d5891c4..57fcd2d 100644 --- a/Source/cmQtAutoGen.cxx +++ b/Source/cmQtAutoGen.cxx @@ -13,7 +13,6 @@ #include "cmsys/FStream.hxx" #include "cmsys/RegularExpression.hxx" -#include "cmAlgorithms.h" #include "cmDuration.h" #include "cmProcessOutput.h" #include "cmStringAlgorithms.h" @@ -55,7 +54,7 @@ void MergeOptions(std::vector<std::string>& baseOpts, } } // Test if this is a value option and change the existing value - if (!optName.empty() && cmContains(valueOpts, optName)) { + if (!optName.empty() && cm::contains(valueOpts, optName)) { const auto existItNext(existIt + 1); const auto fitNext(fit + 1); if ((existItNext != baseOpts.end()) && (fitNext != fitEnd)) { diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 87f4656..b0a7c30 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -16,13 +16,13 @@ #include <cm/algorithm> #include <cm/iterator> #include <cm/memory> +#include <cmext/algorithm> #include "cmsys/SystemInformation.hxx" #include "cm_jsoncpp_value.h" #include "cm_jsoncpp_writer.h" -#include "cmAlgorithms.h" #include "cmCustomCommand.h" #include "cmCustomCommandLines.h" #include "cmGeneratedFileStream.h" @@ -850,7 +850,7 @@ bool cmQtAutoGenInitializer::InitScanFiles() this->Makefile->GetSource(fullPath, locationKind); if (sf != nullptr) { // Check if we know about this header already - if (cmContains(this->AutogenTarget.Headers, sf)) { + if (cm::contains(this->AutogenTarget.Headers, sf)) { continue; } // We only accept not-GENERATED files that do exist. @@ -898,14 +898,14 @@ bool cmQtAutoGenInitializer::InitScanFiles() cmSystemTools::LowerCase(sf->GetExtension()); if (cm->IsHeaderExtension(extLower)) { - if (!cmContains(this->AutogenTarget.Headers, sf.get())) { + if (!cm::contains(this->AutogenTarget.Headers, sf.get())) { auto muf = makeMUFile(sf.get(), fullPath, false); if (muf->SkipMoc || muf->SkipUic) { addMUHeader(std::move(muf), extLower); } } } else if (cm->IsSourceExtension(extLower)) { - if (!cmContains(this->AutogenTarget.Sources, sf.get())) { + if (!cm::contains(this->AutogenTarget.Sources, sf.get())) { auto muf = makeMUFile(sf.get(), fullPath, false); if (muf->SkipMoc || muf->SkipUic) { addMUSource(std::move(muf)); diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index c5f3463..10e6317 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -10,10 +10,10 @@ #include <vector> #include <cm/memory> +#include <cmext/algorithm> #include "cm_uv.h" -#include "cmAlgorithms.h" #include "cmExternalMakefileProjectGenerator.h" #include "cmFileMonitor.h" #include "cmGlobalGenerator.h" @@ -433,7 +433,7 @@ cmServerResponse cmServerProtocol1::ProcessCache( keys = allKeys; } else { for (auto const& i : keys) { - if (!cmContains(allKeys, i)) { + if (!cm::contains(allKeys, i)) { return request.ReportError("Key \"" + i + "\" not found in cache."); } } diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx index 8350410..bb75a14 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/Source/cmSourceGroupCommand.cxx @@ -7,7 +7,8 @@ #include <set> #include <utility> -#include "cmAlgorithms.h" +#include <cmext/algorithm> + #include "cmExecutionStatus.h" #include "cmMakefile.h" #include "cmSourceGroup.h" @@ -136,7 +137,7 @@ ExpectedOptions getExpectedOptions() bool isExpectedOption(const std::string& argument, const ExpectedOptions& expectedOptions) { - return cmContains(expectedOptions, argument); + return cm::contains(expectedOptions, argument); } void parseArguments(const std::vector<std::string>& args, diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 2dfdcf7..2e748d3 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -139,28 +139,17 @@ bool cmState::DeleteCache(const std::string& path) std::vector<std::string> cmState::GetCacheEntryKeys() const { - std::vector<std::string> definitions; - definitions.reserve(this->CacheManager->GetSize()); - cmCacheManager::CacheIterator cit = this->CacheManager->GetCacheIterator(); - for (cit.Begin(); !cit.IsAtEnd(); cit.Next()) { - definitions.push_back(cit.GetName()); - } - return definitions; + return this->CacheManager->GetCacheEntryKeys(); } cmProp cmState::GetCacheEntryValue(std::string const& key) const { - cmCacheManager::CacheEntry* e = this->CacheManager->GetCacheEntry(key); - if (!e) { - return nullptr; - } - return &e->Value; + return this->CacheManager->GetCacheEntryValue(key); } std::string cmState::GetSafeCacheEntryValue(std::string const& key) const { - cmProp val = this->GetCacheEntryValue(key); - if (val) { + if (cmProp val = this->GetCacheEntryValue(key)) { return *val; } return std::string(); @@ -175,8 +164,7 @@ const std::string* cmState::GetInitializedCacheValue( cmStateEnums::CacheEntryType cmState::GetCacheEntryType( std::string const& key) const { - cmCacheManager::CacheIterator it = this->CacheManager->GetCacheIterator(key); - return it.GetType(); + return this->CacheManager->GetCacheEntryType(key); } void cmState::SetCacheEntryValue(std::string const& key, @@ -189,40 +177,32 @@ void cmState::SetCacheEntryProperty(std::string const& key, std::string const& propertyName, std::string const& value) { - cmCacheManager::CacheIterator it = this->CacheManager->GetCacheIterator(key); - it.SetProperty(propertyName, value.c_str()); + this->CacheManager->SetCacheEntryProperty(key, propertyName, value); } void cmState::SetCacheEntryBoolProperty(std::string const& key, std::string const& propertyName, bool value) { - cmCacheManager::CacheIterator it = this->CacheManager->GetCacheIterator(key); - it.SetProperty(propertyName, value); + this->CacheManager->SetCacheEntryBoolProperty(key, propertyName, value); } std::vector<std::string> cmState::GetCacheEntryPropertyList( const std::string& key) { - cmCacheManager::CacheIterator it = this->CacheManager->GetCacheIterator(key); - return it.GetPropertyList(); + return this->CacheManager->GetCacheEntryPropertyList(key); } cmProp cmState::GetCacheEntryProperty(std::string const& key, std::string const& propertyName) { - cmCacheManager::CacheIterator it = this->CacheManager->GetCacheIterator(key); - if (!it.PropertyExists(propertyName)) { - return nullptr; - } - return it.GetProperty(propertyName); + return this->CacheManager->GetCacheEntryProperty(key, propertyName); } bool cmState::GetCacheEntryPropertyAsBool(std::string const& key, std::string const& propertyName) { - return this->CacheManager->GetCacheIterator(key).GetPropertyAsBool( - propertyName); + return this->CacheManager->GetCacheEntryPropertyAsBool(key, propertyName); } void cmState::AddCacheEntry(const std::string& key, const char* value, @@ -274,14 +254,13 @@ void cmState::AppendCacheEntryProperty(const std::string& key, const std::string& property, const std::string& value, bool asString) { - this->CacheManager->GetCacheIterator(key).AppendProperty(property, value, - asString); + this->CacheManager->AppendCacheEntryProperty(key, property, value, asString); } void cmState::RemoveCacheEntryProperty(std::string const& key, std::string const& propertyName) { - this->CacheManager->GetCacheIterator(key).SetProperty(propertyName, nullptr); + this->CacheManager->RemoveCacheEntryProperty(key, propertyName); } cmStateSnapshot cmState::Reset() diff --git a/Source/cmStringAlgorithms.h b/Source/cmStringAlgorithms.h index 0e405de..a5ecca7 100644 --- a/Source/cmStringAlgorithms.h +++ b/Source/cmStringAlgorithms.h @@ -87,7 +87,7 @@ void cmExpandLists(InputIt first, InputIt last, std::vector<std::string>& argsOut) { for (; first != last; ++first) { - ExpandList(*first, argsOut); + cmExpandList(*first, argsOut); } } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 0c4311d..955a5cc 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -363,6 +363,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, initProp("CUDA_SEPARABLE_COMPILATION"); initProp("CUDA_RESOLVE_DEVICE_SYMBOLS"); initProp("CUDA_RUNTIME_LIBRARY"); + initProp("CUDA_ARCHITECTURES"); initProp("LINK_SEARCH_START_STATIC"); initProp("LINK_SEARCH_END_STATIC"); initProp("Swift_LANGUAGE_VERSION"); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 6cd8edd..930db41 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -8,10 +8,10 @@ #include <cm/memory> #include <cm/string_view> #include <cm/vector> +#include <cmext/algorithm> #include "windows.h" -#include "cmAlgorithms.h" #include "cmComputeLinkInformation.h" #include "cmCustomCommand.h" #include "cmCustomCommandGenerator.h" @@ -2718,7 +2718,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( std::string langForClCompile; if (this->ProjectType == csproj) { langForClCompile = "CSharp"; - } else if (cmContains(clLangs, linkLanguage)) { + } else if (cm::contains(clLangs, linkLanguage)) { langForClCompile = linkLanguage; } else { std::set<std::string> languages; @@ -3184,6 +3184,8 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions( this->LocalGenerator, Options::CudaCompiler, gg->GetCudaFlagTable()); Options& cudaLinkOptions = *pOptions; + cmGeneratorTarget::DeviceLinkSetter setter(*this->GeneratorTarget); + // Determine if we need to do a device link const bool doDeviceLinking = requireDeviceLinking( *this->GeneratorTarget, *this->LocalGenerator, configName); @@ -3191,12 +3193,20 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions( cudaLinkOptions.AddFlag("PerformDeviceLink", doDeviceLinking ? "true" : "false"); - // Suppress deprecation warnings for default GPU targets during device link. - if (cmSystemTools::VersionCompareGreaterEq( - this->GlobalGenerator->GetPlatformToolsetCudaString(), "8.0")) { - cudaLinkOptions.AppendFlagString("AdditionalOptions", - "-Wno-deprecated-gpu-targets"); - } + // Add extra flags for device linking + cudaLinkOptions.AppendFlagString( + "AdditionalOptions", + this->Makefile->GetSafeDefinition("_CMAKE_CUDA_EXTRA_FLAGS")); + cudaLinkOptions.AppendFlagString( + "AdditionalOptions", + this->Makefile->GetSafeDefinition("_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS")); + + std::vector<std::string> linkOpts; + std::string linkFlags; + this->GeneratorTarget->GetLinkOptions(linkOpts, configName, "CUDA"); + // LINK_OPTIONS are escaped. + this->LocalGenerator->AppendCompileOptions(linkFlags, linkOpts); + cudaLinkOptions.AppendFlagString("AdditionalOptions", linkFlags); // For static libraries that have device linking enabled compute // the libraries @@ -3651,7 +3661,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( std::vector<std::string> libVec; std::vector<std::string> vsTargetVec; this->AddLibraries(cli, libVec, vsTargetVec, config); - if (cmContains(linkClosure->Languages, "CUDA") && + if (cm::contains(linkClosure->Languages, "CUDA") && this->CudaOptions[config] != nullptr) { this->CudaOptions[config]->FixCudaRuntime(this->GeneratorTarget); } @@ -3925,7 +3935,7 @@ void cmVisualStudio10TargetGenerator::AddTargetsFileAndConfigPair( { for (TargetsFileAndConfigs& i : this->TargetsFileAndConfigsVec) { if (cmSystemTools::ComparePath(targetsFile, i.File)) { - if (!cmContains(i.Configs, config)) { + if (!cm::contains(i.Configs, config)) { i.Configs.push_back(config); } return; diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index d9be3d2..24ecaa2 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -12,7 +12,7 @@ #include <utility> #include <vector> -#include "cmAlgorithms.h" +#include <cmext/algorithm> class cmGeneratorTarget; @@ -82,10 +82,13 @@ public: void SetObject(cmXCodeObject* value) { this->Object = value; } cmXCodeObject* GetObject() { return this->Object; } void AddObject(cmXCodeObject* value) { this->List.push_back(value); } - bool HasObject(cmXCodeObject* o) const { return cmContains(this->List, o); } + bool HasObject(cmXCodeObject* o) const + { + return cm::contains(this->List, o); + } void AddUniqueObject(cmXCodeObject* value) { - if (!cmContains(this->List, value)) { + if (!cm::contains(this->List, value)) { this->List.push_back(value); } } diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx index b34c2f6..1b437e9 100644 --- a/Source/cmXCodeScheme.cxx +++ b/Source/cmXCodeScheme.cxx @@ -7,6 +7,8 @@ #include <sstream> #include <utility> +#include <cmext/algorithm> + #include "cmGeneratedFileStream.h" #include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" @@ -427,7 +429,7 @@ std::string cmXCodeScheme::FindConfiguration(const std::string& name) // Try to find the desired configuration by name, // and if it's not found return first from the list // - if (!cmContains(this->ConfigList, name) && !this->ConfigList.empty()) { + if (!cm::contains(this->ConfigList, name) && !this->ConfigList.empty()) { return this->ConfigList[0]; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index ea1d8ca..c619e1e 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -27,7 +27,6 @@ #include "cm_static_string_view.hxx" #include "cm_sys_stat.h" -#include "cmAlgorithms.h" #include "cmCommands.h" #include "cmDocumentation.h" #include "cmDocumentationEntry.h" @@ -2863,7 +2862,7 @@ void cmake::WatchUnusedCli(const std::string& var) { #ifndef CMAKE_BOOTSTRAP this->VariableWatch->AddWatch(var, cmWarnUnusedCliWarning, this); - if (!cmContains(this->UsedCliVariables, var)) { + if (!cm::contains(this->UsedCliVariables, var)) { this->UsedCliVariables[var] = false; } #endif diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 49d04a6..a8e07e4 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -8,7 +8,6 @@ #include "cm_uv.h" -#include "cmAlgorithms.h" #include "cmDuration.h" #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" @@ -90,6 +89,7 @@ void CMakeCommandUsage(const char* program) << "Available commands: \n" << " capabilities - Report capabilities built into cmake " "in JSON format\n" + << " cat <files>... - concat the files and print them to the standard output\n" << " chdir dir cmd [args...] - run command in a given directory\n" << " compare_files [--ignore-eol] file1 file2\n" << " - check if file1 is same as file2\n" @@ -180,6 +180,13 @@ static bool cmTarFilesFrom(std::string const& file, return true; } +static void cmCatFile(const std::string& fileToAppend) +{ + cmsys::ifstream source(fileToAppend.c_str(), + (std::ios::binary | std::ios::in)); + std::cout << source.rdbuf(); +} + static bool cmRemoveDirectory(const std::string& dir, bool recursive = true) { if (cmSystemTools::FileIsSymlink(dir)) { @@ -927,6 +934,33 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) return HashSumFile(args, cmCryptoHash::AlgoSHA512); } + // Command to concat files into one + if (args[1] == "cat" && args.size() >= 3) { + int return_value = 0; + for (auto const& arg : cmMakeRange(args).advance(2)) { + if (cmHasLiteralPrefix(arg, "-")) { + if (arg != "--") { + cmSystemTools::Error(arg + ": option not handled"); + return_value = 1; + } + } else if (!cmSystemTools::TestFileAccess(arg, + cmsys::TEST_FILE_READ) && + cmSystemTools::TestFileAccess(arg, cmsys::TEST_FILE_OK)) { + cmSystemTools::Error(arg + ": permission denied (ignoring)"); + return_value = 1; + } else if (cmSystemTools::FileIsDirectory(arg)) { + cmSystemTools::Error(arg + ": is a directory (ignoring)"); + return_value = 1; + } else if (!cmSystemTools::FileExists(arg)) { + cmSystemTools::Error(arg + ": no such file or directory (ignoring)"); + return_value = 1; + } else { + cmCatFile(arg); + } + } + return return_value; + } + // Command to change directory and run a program. if (args[1] == "chdir" && args.size() >= 4) { std::string const& directory = args[2]; @@ -1185,7 +1219,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) } } else if (cmHasLiteralPrefix(arg, "--format=")) { format = arg.substr(9); - if (!cmContains(knownFormats, format)) { + if (!cm::contains(knownFormats, format)) { cmSystemTools::Error("Unknown -E tar --format= argument: " + format); return 1; @@ -2083,12 +2117,18 @@ int cmVSLink::LinkIncremental() } // If we have not previously generated a manifest file, - // generate an empty one so the resource compiler succeeds. + // generate a manifest file so the resource compiler succeeds. if (!cmSystemTools::FileExists(this->ManifestFile)) { if (this->Verbose) { std::cout << "Create empty: " << this->ManifestFile << "\n"; } - cmsys::ofstream foutTmp(this->ManifestFile.c_str()); + if (this->UserManifests.empty()) { + // generate an empty manifest because there are no user provided + // manifest files. + cmsys::ofstream foutTmp(this->ManifestFile.c_str()); + } else { + this->RunMT("/out:" + this->ManifestFile, false); + } } // Compile the resource file. @@ -2156,7 +2196,10 @@ int cmVSLink::RunMT(std::string const& out, bool notify) mtCommand.push_back(this->MtPath.empty() ? "mt" : this->MtPath); mtCommand.emplace_back("/nologo"); mtCommand.emplace_back("/manifest"); - if (this->LinkGeneratesManifest) { + + // add the linker generated manifest if the file exists. + if (this->LinkGeneratesManifest && + cmSystemTools::FileExists(this->LinkerManifestFile)) { mtCommand.push_back(this->LinkerManifestFile); } cm::append(mtCommand, this->UserManifests); diff --git a/Source/ctest.cxx b/Source/ctest.cxx index fbdf75a..3b5bf8c 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -35,6 +35,7 @@ static const char* cmDocumentationOptions[][2] = { { "--output-on-failure", "Output anything outputted by the test program " "if the test should fail." }, + { "--stop-on-failure", "Stop running the tests after one has failed." }, { "--test-output-size-passed <size>", "Limit the output for passed tests " "to <size> bytes" }, diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index 5de2776..d8f7e57 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -1198,9 +1198,7 @@ if(KWSYS_STANDALONE OR CMake_SOURCE_DIR) add_executable(${KWSYS_NAMESPACE}TestProcess testProcess.c) set_property(TARGET ${KWSYS_NAMESPACE}TestProcess PROPERTY LABELS ${KWSYS_LABELS_EXE}) target_link_libraries(${KWSYS_NAMESPACE}TestProcess ${KWSYS_TARGET_C_LINK}) - if(NOT CYGWIN) - set(KWSYS_TEST_PROCESS_7 7) - endif() + #set(KWSYS_TEST_PROCESS_7 7) # uncomment to run timing-sensitive test locally foreach(n 1 2 3 4 5 6 ${KWSYS_TEST_PROCESS_7} 9 10) add_test(kwsys.testProcess-${n} ${EXEC_DIR}/${KWSYS_NAMESPACE}TestProcess ${n}) set_property(TEST kwsys.testProcess-${n} PROPERTY LABELS ${KWSYS_LABELS_TEST}) diff --git a/Source/kwsys/MD5.c b/Source/kwsys/MD5.c index 7ae2630..fb18a5b 100644 --- a/Source/kwsys/MD5.c +++ b/Source/kwsys/MD5.c @@ -417,14 +417,16 @@ static void md5_finish(md5_state_t* pms, md5_byte_t digest[16]) int i; /* Save the length before padding. */ - for (i = 0; i < 8; ++i) + for (i = 0; i < 8; ++i) { data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3)); + } /* Pad to 56 bytes mod 64. */ md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1); /* Append the length. */ md5_append(pms, data, 8); - for (i = 0; i < 16; ++i) + for (i = 0; i < 16; ++i) { digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3)); + } } #if defined(__clang__) && !defined(__INTEL_COMPILER) diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c index d3a09ed..cc45529 100644 --- a/Source/kwsys/ProcessUNIX.c +++ b/Source/kwsys/ProcessUNIX.c @@ -1147,8 +1147,8 @@ static int kwsysProcessWaitForPipe(kwsysProcess* cp, char** data, int* length, read until the operation is not interrupted. */ while (((n = read(cp->PipeReadEnds[i], cp->PipeBuffer, KWSYSPE_PIPE_BUFFER_SIZE)) < 0) && - (errno == EINTR)) - ; + (errno == EINTR)) { + } if (n > 0) { /* We have data on this pipe. */ if (i == KWSYSPE_PIPE_SIGNAL) { @@ -1221,8 +1221,8 @@ static int kwsysProcessWaitForPipe(kwsysProcess* cp, char** data, int* length, /* Run select to block until data are available. Repeat call until it is not interrupted. */ while (((numReady = select(max + 1, &cp->PipeSet, 0, 0, timeout)) < 0) && - (errno == EINTR)) - ; + (errno == EINTR)) { + } /* Check result of select. */ if (numReady == 0) { @@ -1879,7 +1879,8 @@ static void kwsysProcessDestroy(kwsysProcess* cp) int i; /* Temporarily disable signals that access ForkPIDs. We don't want them to read a reaped PID, and writes to ForkPIDs are not atomic. */ - sigset_t mask, old_mask; + sigset_t mask; + sigset_t old_mask; sigemptyset(&mask); sigaddset(&mask, SIGINT); sigaddset(&mask, SIGTERM); @@ -1892,8 +1893,8 @@ static void kwsysProcessDestroy(kwsysProcess* cp) int result; while (((result = waitpid(cp->ForkPIDs[i], &cp->CommandExitCodes[i], WNOHANG)) < 0) && - (errno == EINTR)) - ; + (errno == EINTR)) { + } if (result > 0) { /* This child has termianted. */ cp->ForkPIDs[i] = 0; @@ -2567,7 +2568,8 @@ static void kwsysProcessKill(pid_t process_id) /* Make sure the process started and provided a valid header. */ if (ps && fscanf(ps, "%*[^\n]\n") != EOF) { /* Look for processes whose parent is the process being killed. */ - int pid, ppid; + int pid; + int ppid; while (fscanf(ps, KWSYSPE_PS_FORMAT, &pid, &ppid) == 2) { if (ppid == process_id) { /* Recursively kill this child and its children. */ diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index 95b06e1..ba9fa67 100644 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -204,7 +204,8 @@ typedef struct rlimit ResourceLimitType; # define USE_ASM_INSTRUCTIONS 0 #endif -#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__clang__) +#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__clang__) && \ + !defined(_M_ARM64) # include <intrin.h> # define USE_CPUID_INTRINSICS 1 #else @@ -4322,9 +4323,15 @@ SystemInformationImplementation::GetCyclesDifference(DELAY_FUNC DelayFunction, #if defined(_MSC_VER) && (_MSC_VER >= 1400) unsigned __int64 stamp1, stamp2; +# ifdef _M_ARM64 + stamp1 = _ReadStatusReg(ARM64_PMCCNTR_EL0); + DelayFunction(uiParameter); + stamp2 = _ReadStatusReg(ARM64_PMCCNTR_EL0); +# else stamp1 = __rdtsc(); DelayFunction(uiParameter); stamp2 = __rdtsc(); +# endif return stamp2 - stamp1; #elif USE_ASM_INSTRUCTIONS diff --git a/Source/kwsys/testProcess.c b/Source/kwsys/testProcess.c index cde466a..5507dfb 100644 --- a/Source/kwsys/testProcess.c +++ b/Source/kwsys/testProcess.c @@ -710,7 +710,8 @@ int main(int argc, const char* argv[]) free(argv0); #endif return r; - } else if (argc > 2 && strcmp(argv[1], "0") == 0) { + } + if (argc > 2 && strcmp(argv[1], "0") == 0) { /* This is the special debugging test to run a given command line. */ const char** cmd = argv + 2; @@ -721,9 +722,8 @@ int main(int argc, const char* argv[]) int r = runChild(cmd, state, exception, value, 0, 1, 0, timeout, 0, 1, 0, 0, 0); return r; - } else { - /* Improper usage. */ - fprintf(stdout, "Usage: %s <test number>\n", argv[0]); - return 1; } + /* Improper usage. */ + fprintf(stdout, "Usage: %s <test number>\n", argv[0]); + return 1; } diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index af555b5..ed472a1 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -363,7 +363,10 @@ if(BUILD_TESTING) add_test_macro(VSResourceNinjaForceRSP VSResourceNinjaForceRSP) endif () endif() - ADD_TEST_MACRO(MSManifest MSManifest) + if(_isMultiConfig) + set(MSManifest_CTEST_OPTIONS -C $<CONFIGURATION>) + endif() + ADD_TEST_MACRO(MSManifest ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>) ADD_TEST_MACRO(Simple Simple) ADD_TEST_MACRO(PreOrder PreOrder) ADD_TEST_MACRO(MissingSourceFile MissingSourceFile) @@ -1471,7 +1474,8 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH add_subdirectory(GoogleTest) endif() - if(CMake_TEST_FindPython OR CMake_TEST_FindPython_NumPy OR CMake_TEST_FindPython_Conda) + if(CMake_TEST_FindPython OR CMake_TEST_FindPython_NumPy + OR CMake_TEST_FindPython_Conda OR CMake_TEST_FindPython_IronPython) add_subdirectory(FindPython) endif() @@ -3478,6 +3482,8 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH --build-two-config ${build_generator_args} --build-project IncludeDirectories + --build-options + -DMAKE_SUPPORTS_SPACES=${MAKE_SUPPORTS_SPACES} --test-command IncludeDirectories) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/IncludeDirectories") diff --git a/Tests/Contracts/VTK/Dashboard.cmake.in b/Tests/Contracts/VTK/Dashboard.cmake.in index c3d10f4..ae760bc 100644 --- a/Tests/Contracts/VTK/Dashboard.cmake.in +++ b/Tests/Contracts/VTK/Dashboard.cmake.in @@ -24,8 +24,8 @@ set(CTEST_BUILD_COMMAND "@CMAKE_MAKE_PROGRAM@ -j9 -i") ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" " - BUILD_EXAMPLES:BOOL=ON - BUILD_TESTING:BOOL=ON + VTK_BUILD_EXAMPLES:BOOL=ON + VTK_BUILD_TESTING:STRING=WANT VTK_WRAP_PYTHON:BOOL=ON ExternalData_OBJECT_STORES:FILEPATH=@base_dir@/ExternalData ") diff --git a/Tests/Cuda/CXXStandardSetTwice/CMakeLists.txt b/Tests/Cuda/CXXStandardSetTwice/CMakeLists.txt index 1941c49..f4ad83a 100644 --- a/Tests/Cuda/CXXStandardSetTwice/CMakeLists.txt +++ b/Tests/Cuda/CXXStandardSetTwice/CMakeLists.txt @@ -1,9 +1,8 @@ cmake_minimum_required(VERSION 3.7) project(CXXStandardSetTwice CXX CUDA) -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") - set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CUDA_ARCHITECTURES 30) add_executable(CXXStandardSetTwice main.cu) target_compile_features(CXXStandardSetTwice PUBLIC cxx_std_11) diff --git a/Tests/Cuda/Complex/CMakeLists.txt b/Tests/Cuda/Complex/CMakeLists.txt index 08d1e16..265bd85 100644 --- a/Tests/Cuda/Complex/CMakeLists.txt +++ b/Tests/Cuda/Complex/CMakeLists.txt @@ -15,7 +15,7 @@ project (Complex CXX CUDA) #and also building cpp targets that need cuda implicit libraries #verify that we can pass explicit cuda arch flags -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") +set(CMAKE_CUDA_ARCHITECTURES 30) set(CMAKE_CUDA_STANDARD 11) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CUDA_STANDARD_REQUIRED TRUE) diff --git a/Tests/Cuda/MixedStandardLevels1/CMakeLists.txt b/Tests/Cuda/MixedStandardLevels1/CMakeLists.txt index b03e51e..e40ffa6 100644 --- a/Tests/Cuda/MixedStandardLevels1/CMakeLists.txt +++ b/Tests/Cuda/MixedStandardLevels1/CMakeLists.txt @@ -1,10 +1,9 @@ cmake_minimum_required(VERSION 3.7) project(MixedStandardLevels1 CXX CUDA) -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") - set(CMAKE_CXX_STANDARD 14) set(CMAKE_CUDA_STANDARD 11) +set(CMAKE_CUDA_ARCHITECTURES 30) add_executable(MixedStandardLevels1 main.cu lib.cpp) diff --git a/Tests/Cuda/MixedStandardLevels2/CMakeLists.txt b/Tests/Cuda/MixedStandardLevels2/CMakeLists.txt index 12dd328..7af8081 100644 --- a/Tests/Cuda/MixedStandardLevels2/CMakeLists.txt +++ b/Tests/Cuda/MixedStandardLevels2/CMakeLists.txt @@ -1,9 +1,8 @@ cmake_minimum_required(VERSION 3.7) project(MixedStandardLevels2 CXX CUDA) -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") - set(CMAKE_CXX_STANDARD 17) #this can decay +set(CMAKE_CUDA_ARCHITECTURES 30) add_executable(MixedStandardLevels2 main.cu lib.cpp) target_compile_features(MixedStandardLevels2 PUBLIC cuda_std_11) diff --git a/Tests/Cuda/MixedStandardLevels3/CMakeLists.txt b/Tests/Cuda/MixedStandardLevels3/CMakeLists.txt index 2b611be..2c42003 100644 --- a/Tests/Cuda/MixedStandardLevels3/CMakeLists.txt +++ b/Tests/Cuda/MixedStandardLevels3/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.7) project(MixedStandardLevels3 CXX CUDA) -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") +set(CMAKE_CUDA_ARCHITECTURES 30) add_executable(MixedStandardLevels3 main.cu lib.cpp) target_compile_features(MixedStandardLevels3 PUBLIC cuda_std_03 cxx_std_14) diff --git a/Tests/Cuda/MixedStandardLevels4/CMakeLists.txt b/Tests/Cuda/MixedStandardLevels4/CMakeLists.txt index faf6869..230230d 100644 --- a/Tests/Cuda/MixedStandardLevels4/CMakeLists.txt +++ b/Tests/Cuda/MixedStandardLevels4/CMakeLists.txt @@ -1,9 +1,8 @@ cmake_minimum_required(VERSION 3.7) project(MixedStandardLevels4 CXX CUDA) -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") - set(CMAKE_CUDA_STANDARD 03) +set(CMAKE_CUDA_ARCHITECTURES 30) add_executable(MixedStandardLevels4 main.cu lib.cpp) target_compile_features(MixedStandardLevels4 PUBLIC cxx_std_14) diff --git a/Tests/Cuda/MixedStandardLevels5/CMakeLists.txt b/Tests/Cuda/MixedStandardLevels5/CMakeLists.txt index 7209f60..5f5ee06 100644 --- a/Tests/Cuda/MixedStandardLevels5/CMakeLists.txt +++ b/Tests/Cuda/MixedStandardLevels5/CMakeLists.txt @@ -1,9 +1,8 @@ cmake_minimum_required(VERSION 3.7) project(MixedStandardLevels5 CXX CUDA) -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") - set(CMAKE_CXX_STANDARD 98) +set(CMAKE_CUDA_ARCHITECTURES 30) add_executable(MixedStandardLevels5 main.cu lib.cpp) diff --git a/Tests/Cuda/ProperDeviceLibraries/CMakeLists.txt b/Tests/Cuda/ProperDeviceLibraries/CMakeLists.txt index cb47b09..fe28c3e 100644 --- a/Tests/Cuda/ProperDeviceLibraries/CMakeLists.txt +++ b/Tests/Cuda/ProperDeviceLibraries/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required(VERSION 3.13) project(ProperDeviceLibraries CXX CUDA) -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_35,code=compute_35 -gencode arch=compute_35,code=sm_35") set(CMAKE_CUDA_STANDARD 11) +set(CMAKE_CUDA_ARCHITECTURES 35) set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads) diff --git a/Tests/Cuda/WithC/CMakeLists.txt b/Tests/Cuda/WithC/CMakeLists.txt index 69aa3f9..049cbce 100644 --- a/Tests/Cuda/WithC/CMakeLists.txt +++ b/Tests/Cuda/WithC/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.7) project(WithC CUDA C) -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") +set(CMAKE_CUDA_ARCHITECTURES 30) add_executable(CudaWithC main.c cuda.cu) diff --git a/Tests/CudaOnly/Architecture/CMakeLists.txt b/Tests/CudaOnly/Architecture/CMakeLists.txt new file mode 100644 index 0000000..7270b56 --- /dev/null +++ b/Tests/CudaOnly/Architecture/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.17) +project(Architecture CUDA) + +set(CMAKE_CUDA_ARCHITECTURES 52) +add_executable(Architecture main.cu) diff --git a/Tests/CudaOnly/Architecture/main.cu b/Tests/CudaOnly/Architecture/main.cu new file mode 100644 index 0000000..8c817d5 --- /dev/null +++ b/Tests/CudaOnly/Architecture/main.cu @@ -0,0 +1,9 @@ +#ifdef __CUDA_ARCH__ +# if __CUDA_ARCH__ != 520 +# error "Passed architecture 52, but got something else." +# endif +#endif + +int main() +{ +} diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt index cc1ee1a..d74e810 100644 --- a/Tests/CudaOnly/CMakeLists.txt +++ b/Tests/CudaOnly/CMakeLists.txt @@ -1,5 +1,7 @@ +ADD_TEST_MACRO(CudaOnly.Architecture Architecture) ADD_TEST_MACRO(CudaOnly.CircularLinkLine CudaOnlyCircularLinkLine) +ADD_TEST_MACRO(CudaOnly.CompileFlags CudaOnlyCompileFlags) ADD_TEST_MACRO(CudaOnly.EnableStandard CudaOnlyEnableStandard) ADD_TEST_MACRO(CudaOnly.ExportPTX CudaOnlyExportPTX) ADD_TEST_MACRO(CudaOnly.GPUDebugFlag CudaOnlyGPUDebugFlag) diff --git a/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt b/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt index 5e6f7ab..e10a348 100644 --- a/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt +++ b/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt @@ -5,9 +5,9 @@ project (CircularLinkLine CUDA) # Verify that we de-duplicate the device link line # Verify that a de-duplicated link line still works with circular static libraries -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=[compute_30]") set(CMAKE_CXX_STANDARD 11) set(CMAKE_CUDA_STANDARD 11) +set(CMAKE_CUDA_ARCHITECTURES 30) add_library(CUDACircularDeviceLinking1 STATIC file1.cu) add_library(CUDACircularDeviceLinking2 STATIC file2.cu) diff --git a/Tests/CudaOnly/CompileFlags/CMakeLists.txt b/Tests/CudaOnly/CompileFlags/CMakeLists.txt new file mode 100644 index 0000000..cbce7d6 --- /dev/null +++ b/Tests/CudaOnly/CompileFlags/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.17) +cmake_policy(SET CMP0104 OLD) +project(CompileFlags CUDA) + +# Clear defaults. +set(CMAKE_CUDA_ARCHITECTURES) + +add_executable(CudaOnlyCompileFlags main.cu) + +# Try passing CUDA architecture flags explicitly. +if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") + target_compile_options(CudaOnlyCompileFlags PRIVATE + -gencode arch=compute_50,code=compute_50 + --compiler-options=-DHOST_DEFINE + ) +endif() diff --git a/Tests/CudaOnly/CompileFlags/main.cu b/Tests/CudaOnly/CompileFlags/main.cu new file mode 100644 index 0000000..573d230 --- /dev/null +++ b/Tests/CudaOnly/CompileFlags/main.cu @@ -0,0 +1,16 @@ +#ifdef __CUDA_ARCH__ +# if __CUDA_ARCH__ != 500 +# error "Passed architecture 50, but got something else." +# endif +#endif + +// Check HOST_DEFINE only for nvcc +#ifndef __CUDA__ +# ifndef HOST_DEFINE +# error "HOST_DEFINE not defined!" +# endif +#endif + +int main() +{ +} diff --git a/Tests/CudaOnly/DontResolveDeviceSymbols/CMakeLists.txt b/Tests/CudaOnly/DontResolveDeviceSymbols/CMakeLists.txt index 6e3697f..1265660 100644 --- a/Tests/CudaOnly/DontResolveDeviceSymbols/CMakeLists.txt +++ b/Tests/CudaOnly/DontResolveDeviceSymbols/CMakeLists.txt @@ -24,9 +24,9 @@ endif() # Don't resolve the device symbols in the static library # Don't resolve the device symbols in the executable library # Verify that we can't use those device symbols from anything -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=[compute_30] -gencode arch=compute_50,code=\\\"compute_50\\\"") set(CMAKE_CXX_STANDARD 11) set(CMAKE_CUDA_STANDARD 11) +set(CMAKE_CUDA_ARCHITECTURES 30 50) set(CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS OFF) add_library(CUDANoDeviceResolve SHARED file1.cu) diff --git a/Tests/CudaOnly/ResolveDeviceSymbols/CMakeLists.txt b/Tests/CudaOnly/ResolveDeviceSymbols/CMakeLists.txt index 57aa0b9..bd94ec8 100644 --- a/Tests/CudaOnly/ResolveDeviceSymbols/CMakeLists.txt +++ b/Tests/CudaOnly/ResolveDeviceSymbols/CMakeLists.txt @@ -21,7 +21,7 @@ endif() # confirming that the first static library is on the device link line # 3. Verify that we can't use those device symbols from anything that links # to the static library -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=[sm_30] -gencode arch=compute_50,code=\\\"compute_50\\\"") +set(CMAKE_CUDA_ARCHITECTURES 30 50) add_library(CUDAResolveDeviceDepsA STATIC file1.cu) add_library(CUDAResolveDeviceDepsB STATIC file2.cu) diff --git a/Tests/CudaOnly/RuntimeControls/CMakeLists.txt b/Tests/CudaOnly/RuntimeControls/CMakeLists.txt index 8b58fec..0da5739 100644 --- a/Tests/CudaOnly/RuntimeControls/CMakeLists.txt +++ b/Tests/CudaOnly/RuntimeControls/CMakeLists.txt @@ -15,9 +15,8 @@ else() endif() endif() -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=[compute_30]") - set(CMAKE_CUDA_STANDARD 11) +set(CMAKE_CUDA_ARCHITECTURES 30) set(CMAKE_CUDA_RUNTIME_LIBRARY static) if(NOT "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC") diff --git a/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt b/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt index c1bd64a..586be81 100644 --- a/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt +++ b/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt @@ -9,9 +9,7 @@ project (SeparateCompilation CUDA) #and executables. #We complicate the matter by also testing that multiple static libraries #all containing cuda separable compilation code links properly -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=\\\"compute_30,sm_30,sm_35\\\"") -string(APPEND CMAKE_CUDA_FLAGS " --generate-code=arch=compute_50,code=[compute_50,sm_50,sm_52]") - +set(CMAKE_CUDA_ARCHITECTURES 30 35 50 52) set(CMAKE_CUDA_SEPARABLE_COMPILATION ON) add_library(CUDASeparateLibA STATIC file1.cu file2.cu file3.cu) target_compile_features(CUDASeparateLibA PRIVATE cuda_std_11) diff --git a/Tests/CudaOnly/Standard98/CMakeLists.txt b/Tests/CudaOnly/Standard98/CMakeLists.txt index ef9a685..3ba0360 100644 --- a/Tests/CudaOnly/Standard98/CMakeLists.txt +++ b/Tests/CudaOnly/Standard98/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.7) project(CudaOnlyStandard98 CUDA) -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") +set(CMAKE_CUDA_ARCHITECTURES 30) # Support setting CUDA Standard to 98 which internally gets transformed to # CUDA03 diff --git a/Tests/CudaOnly/WithDefs/CMakeLists.txt b/Tests/CudaOnly/WithDefs/CMakeLists.txt index ba9bf04..add8131 100644 --- a/Tests/CudaOnly/WithDefs/CMakeLists.txt +++ b/Tests/CudaOnly/WithDefs/CMakeLists.txt @@ -3,17 +3,7 @@ cmake_minimum_required(VERSION 3.7) project (WithDefs CUDA) #verify that we can pass explicit cuda arch flags -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") -if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 9) - set(debug_compile_flags --generate-code arch=compute_32,code=sm_32) -else() - set(debug_compile_flags --generate-code arch=compute_20,code=sm_20) -endif() -if(CMAKE_CUDA_SIMULATE_ID STREQUAL "MSVC") - list(APPEND debug_compile_flags -Xcompiler=-WX) -else() - list(APPEND debug_compile_flags -Xcompiler=-Werror) -endif() +set(CMAKE_CUDA_ARCHITECTURES 30) set(release_compile_defs DEFREL) #Goal for this example: @@ -29,7 +19,6 @@ target_compile_options(CudaOnlyWithDefs -DFLAG_COMPILE_LANG_$<COMPILE_LANGUAGE> -DFLAG_LANG_IS_CUDA=$<COMPILE_LANGUAGE:CUDA> --compiler-options=-DHOST_DEFINE - $<$<CONFIG:DEBUG>:$<BUILD_INTERFACE:${debug_compile_flags}>> ) target_compile_definitions(CudaOnlyWithDefs diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt index d2326e4..c72b5e2 100644 --- a/Tests/FindPython/CMakeLists.txt +++ b/Tests/FindPython/CMakeLists.txt @@ -20,6 +20,17 @@ if(CMake_TEST_FindPython) --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) + add_test(NAME FindPython.Python2.Development.Module COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python2Module" + "${CMake_BINARY_DIR}/Tests/FindPython/Python2Module" + ${build_generator_args} + --build-project TestPython2Module + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.Python2Fail COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test @@ -54,6 +65,17 @@ if(CMake_TEST_FindPython) --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) + add_test(NAME FindPython.Python3.Development.Module COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python3Module" + "${CMake_BINARY_DIR}/Tests/FindPython/Python3Module" + ${build_generator_args} + --build-project TestPython3Module + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.Python3Fail COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test @@ -276,11 +298,10 @@ if(CMake_TEST_FindPython_NumPy) ${build_generator_args} --build-project TestNumPyOnly --build-options ${build_options} - --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) - endif() +endif() - if(CMake_TEST_FindPython_Conda) +if(CMake_TEST_FindPython_Conda) add_test(NAME FindPython.VirtualEnvConda COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test @@ -291,4 +312,68 @@ if(CMake_TEST_FindPython_NumPy) --build-options ${build_options} --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) - endif() +endif() + +if(CMake_TEST_FindPython_IronPython) + add_test(NAME FindPython.IronPython2.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/IronPython2" + "${CMake_BINARY_DIR}/Tests/FindPython/IronPython2.LOCATION" + ${build_generator_args} + --build-project TestIronPython2 + --build-options ${build_options} -DPython2_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.IronPython2.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/IronPython2" + "${CMake_BINARY_DIR}/Tests/FindPython/IronPython2.VERSION" + ${build_generator_args} + --build-project TestIronPython2 + --build-options ${build_options} -DPython2_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + + add_test(NAME FindPython.IronPython.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/IronPython" + "${CMake_BINARY_DIR}/Tests/FindPython/IronPython.LOCATION" + ${build_generator_args} + --build-project TestIronPython + --build-options ${build_options} -DPython_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.IronPython.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/IronPython" + "${CMake_BINARY_DIR}/Tests/FindPython/IronPython.VERSION" + ${build_generator_args} + --build-project TestIronPython + --build-options ${build_options} -DPython_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.IronPython.V2.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/IronPython" + "${CMake_BINARY_DIR}/Tests/FindPython/IronPython.V2.LOCATION" + ${build_generator_args} + --build-project TestIronPython + --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.IronPython.V2.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/IronPython" + "${CMake_BINARY_DIR}/Tests/FindPython/IronPython.V2.VERSION" + ${build_generator_args} + --build-project TestIronPython + --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) +endif() diff --git a/Tests/FindPython/IronPython/CMakeLists.txt b/Tests/FindPython/IronPython/CMakeLists.txt new file mode 100644 index 0000000..c96a3e0 --- /dev/null +++ b/Tests/FindPython/IronPython/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestIronPython C) + +find_package(Python ${Python_REQUESTED_VERSION} REQUIRED COMPONENTS Interpreter Compiler) +if (NOT Python_FOUND) + message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}") +endif() + +if (NOT Python_Compiler_FOUND) + message (FATAL_ERROR "Fail to found Python Compiler") +endif() +if (NOT Python_COMPILER_ID STREQUAL "IronPython") + message (FATAL_ERROR "Erroneous compiler ID (${Python_COMPILER_ID})") +endif() + +if(NOT TARGET Python::Interpreter) + message(SEND_ERROR "Python::Interpreter not found") +endif() +if(NOT TARGET Python::Compiler) + message(SEND_ERROR "Python::Interpreter not found") +endif() diff --git a/Tests/FindPython/IronPython2/CMakeLists.txt b/Tests/FindPython/IronPython2/CMakeLists.txt new file mode 100644 index 0000000..43ec309 --- /dev/null +++ b/Tests/FindPython/IronPython2/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestIronPython2 C) + +find_package(Python2 REQUIRED COMPONENTS Interpreter Compiler) +if (NOT Python2_FOUND) + message (FATAL_ERROR "Fail to found Python 2") +endif() + +if (NOT Python2_Compiler_FOUND) + message (FATAL_ERROR "Fail to found Python 2 Compiler") +endif() +if (NOT Python2_COMPILER_ID STREQUAL "IronPython") + message (FATAL_ERROR "Erroneous compiler ID (${Python2_COMPILER_ID})") +endif() + +if(NOT TARGET Python2::Interpreter) + message(SEND_ERROR "Python2::Interpreter not found") +endif() +if(NOT TARGET Python2::Compiler) + message(SEND_ERROR "Python2::Compiler not found") +endif() diff --git a/Tests/FindPython/Python/CMakeLists.txt b/Tests/FindPython/Python/CMakeLists.txt index 3ee38e3..e8828a2 100644 --- a/Tests/FindPython/Python/CMakeLists.txt +++ b/Tests/FindPython/Python/CMakeLists.txt @@ -8,6 +8,12 @@ find_package(Python ${Python_REQUESTED_VERSION} REQUIRED COMPONENTS Interpreter if (NOT Python_FOUND) message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}") endif() +if (NOT Python_Development.Module_FOUND) + message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}, COMPONENT 'Development.Module'") +endif() +if (NOT Python_Development.Embed_FOUND) + message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}, COMPOENENT 'Development.Embed'") +endif() if(NOT TARGET Python::Interpreter) message(SEND_ERROR "Python::Interpreter not found") diff --git a/Tests/FindPython/Python2/CMakeLists.txt b/Tests/FindPython/Python2/CMakeLists.txt index cf77ca2..609d80f 100644 --- a/Tests/FindPython/Python2/CMakeLists.txt +++ b/Tests/FindPython/Python2/CMakeLists.txt @@ -13,6 +13,15 @@ find_package(Python2 REQUIRED COMPONENTS Interpreter Development) if (NOT Python2_FOUND) message (FATAL_ERROR "Fail to found Python 2") endif() +if (NOT Python2_Development_FOUND) + message (FATAL_ERROR "Fail to found Python 2 'Development' component") +endif() +if (NOT Python2_Development.Module_FOUND) + message (FATAL_ERROR "Fail to found Python 2 'Development.Module' component") +endif() +if (NOT Python2_Development.Embed_FOUND) + message (FATAL_ERROR "Fail to found Python 2 'Development.Embed' component") +endif() if(NOT TARGET Python2::Interpreter) message(SEND_ERROR "Python2::Interpreter not found") diff --git a/Tests/FindPython/Python2Embedded/CMakeLists.txt b/Tests/FindPython/Python2Embedded/CMakeLists.txt index 0115dea..1cf6034 100644 --- a/Tests/FindPython/Python2Embedded/CMakeLists.txt +++ b/Tests/FindPython/Python2Embedded/CMakeLists.txt @@ -4,10 +4,23 @@ project(TestPython2Embedded C) include(CTest) -find_package(Python2 REQUIRED COMPONENTS Development) +find_package(Python2 REQUIRED COMPONENTS Development.Embed) if (NOT Python2_FOUND) message (FATAL_ERROR "Fail to found Python 2") endif() +if (Python2_Development_FOUND) + message (FATAL_ERROR "Python 2, COMPONENT 'Development' unexpectedly found") +endif() +if (Python2_Development.Module_FOUND) + message (FATAL_ERROR "Python 2, COMPONENT 'Development.Module' unexpectedly found") +endif() +if (NOT Python2_Development.Embed_FOUND) + message (FATAL_ERROR "Python 2, COMPONENT 'Development.Embed' not found") +endif() + +if(TARGET Python2::Module) + message(SEND_ERROR "Python2::Module unexpectedly found") +endif() if(NOT TARGET Python2::Python) message(SEND_ERROR "Python2::Python not found") diff --git a/Tests/FindPython/Python2Module/CMakeLists.txt b/Tests/FindPython/Python2Module/CMakeLists.txt new file mode 100644 index 0000000..0bc3390 --- /dev/null +++ b/Tests/FindPython/Python2Module/CMakeLists.txt @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestPython2Module C) + +include(CTest) + +find_package(Python2 REQUIRED COMPONENTS Interpreter Development.Module) +if (NOT Python2_FOUND) + message (FATAL_ERROR "Fail to found Python 2") +endif() +if (Python2_Development_FOUND) + message (FATAL_ERROR "Python 2, COMPONENT 'Development' unexpectedly found") +endif() +if (Python2_Development.Embed_FOUND) + message (FATAL_ERROR "Python 2, COMPONENT 'Development.Embed' unexpectedly found") +endif() +if (NOT Python2_Development.Module_FOUND) + message (FATAL_ERROR "Python 2, COMPONENT 'Development.Module' not found") +endif() + +if(NOT TARGET Python2::Interpreter) + message(SEND_ERROR "Python2::Interpreter not found") +endif() + +if(TARGET Python2::Python) + message(SEND_ERROR "Python2::Python unexpectedly found") +endif() +if(NOT TARGET Python2::Module) + message(SEND_ERROR "Python2::Module not found") +endif() + +Python2_add_library (spam2 MODULE ../spam.c) +target_compile_definitions (spam2 PRIVATE PYTHON2) + +add_test (NAME python2_spam2 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam2>" + "${Python2_EXECUTABLE}" -c "import spam2; spam2.system(\"cd\")") diff --git a/Tests/FindPython/Python3/CMakeLists.txt b/Tests/FindPython/Python3/CMakeLists.txt index 34ebd2c..d6e5fdb 100644 --- a/Tests/FindPython/Python3/CMakeLists.txt +++ b/Tests/FindPython/Python3/CMakeLists.txt @@ -13,6 +13,15 @@ find_package(Python3 REQUIRED COMPONENTS Interpreter Development) if (NOT Python3_FOUND) message (FATAL_ERROR "Fail to found Python 3") endif() +if (NOT Python3_Development_FOUND) + message (FATAL_ERROR "Fail to found Python 3 'Development' component") +endif() +if (NOT Python3_Development.Module_FOUND) + message (FATAL_ERROR "Fail to found Python 3 'Development.Module' component") +endif() +if (NOT Python3_Development.Embed_FOUND) + message (FATAL_ERROR "Fail to found Python 3 'Development.Embed' component") +endif() if(NOT TARGET Python3::Interpreter) message(SEND_ERROR "Python3::Interpreter not found") diff --git a/Tests/FindPython/Python3Embedded/CMakeLists.txt b/Tests/FindPython/Python3Embedded/CMakeLists.txt index 4eb7ebc..184c0b4 100644 --- a/Tests/FindPython/Python3Embedded/CMakeLists.txt +++ b/Tests/FindPython/Python3Embedded/CMakeLists.txt @@ -4,10 +4,23 @@ project(TestPython3Embedded C) include(CTest) -find_package(Python3 REQUIRED COMPONENTS Development) +find_package(Python3 REQUIRED COMPONENTS Development.Embed) if (NOT Python3_FOUND) message (FATAL_ERROR "Fail to found Python 3") endif() +if (Python3_Development_FOUND) + message (FATAL_ERROR "Python 3, COMPONENT 'Development' unexpectedly found") +endif() +if (Python3_Development.Module_FOUND) + message (FATAL_ERROR "Python 3, COMPONENT 'Development.Module' unexpectedly found") +endif() +if (NOT Python3_Development.Embed_FOUND) + message (FATAL_ERROR "Python 3, COMPONENT 'Development.Embed' not found") +endif() + +if(TARGET Python3::Module) + message(SEND_ERROR "Python3::Module unexpectedly found") +endif() if(NOT TARGET Python3::Python) message(SEND_ERROR "Python3::Python not found") diff --git a/Tests/FindPython/Python3Module/CMakeLists.txt b/Tests/FindPython/Python3Module/CMakeLists.txt new file mode 100644 index 0000000..676f4c8 --- /dev/null +++ b/Tests/FindPython/Python3Module/CMakeLists.txt @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestPython3Module C) + +include(CTest) + +find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module) +if (NOT Python3_FOUND) + message (FATAL_ERROR "Fail to found Python 3") +endif() +if (Python3_Development_FOUND) + message (FATAL_ERROR "Python 3, COMPONENT 'Development' unexpectedly found") +endif() +if (Python3_Development.Embed_FOUND) + message (FATAL_ERROR "Python 3, COMPONENT 'Development.Embed' unexpectedly found") +endif() +if (NOT Python3_Development.Module_FOUND) + message (FATAL_ERROR "Python 3, COMPONENT 'Development.Module' not found") +endif() + +if(NOT TARGET Python3::Interpreter) + message(SEND_ERROR "Python3::Interpreter not found") +endif() + +if(TARGET Python3::Python) + message(SEND_ERROR "Python3::Python unexpectedly found") +endif() +if(NOT TARGET Python3::Module) + message(SEND_ERROR "Python3::Module not found") +endif() + +Python3_add_library (spam3 MODULE ../spam.c) +target_compile_definitions (spam3 PRIVATE PYTHON3) + +add_test (NAME python3_spam3 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam3>" + "${Python3_EXECUTABLE}" -c "import spam3; spam3.system(\"cd\")") diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt index 838a236..eb08676 100644 --- a/Tests/IncludeDirectories/CMakeLists.txt +++ b/Tests/IncludeDirectories/CMakeLists.txt @@ -66,21 +66,36 @@ else() endif() # Test escaping of special characters in include directory paths. -# FIXME: Implement full support in Makefile generators -if(NOT CMAKE_GENERATOR MATCHES "Make") - set(special_chars "~@#$%^&=[]{}()!'") - if(NOT CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") - string(APPEND special_chars ",") - endif() - if(NOT WIN32 AND NOT CYGWIN) - string(APPEND special_chars "*?<>") - endif() - set(special_dir "${CMAKE_CURRENT_BINARY_DIR}/special-${special_chars}-include") - file(WRITE "${special_dir}/SpecialDir.h" "#define SPECIAL_DIR_H\n") +set(special_chars "~@%&{}()!'") +if(NOT CMAKE_GENERATOR STREQUAL "Watcom WMake") + # Watcom seems to have no way to encode these characters. + string(APPEND special_chars "#=[]") +endif() +if(NOT (MINGW AND CMAKE_GENERATOR MATCHES "(Unix|MSYS) Makefiles")) + # FIXME: Dependencies work but command-line generation does not handle '$'. + string(APPEND special_chars "$") +endif() +if(NOT CMAKE_GENERATOR MATCHES "(Borland|NMake) Makefiles") + # NMake and Borland seem to have no way to encode a single '^'. + string(APPEND special_chars "^") +endif() +if(NOT CMAKE_GENERATOR MATCHES "Visual Studio 9 2008|Watcom WMake") + # The vcproj format separates values with ','. + string(APPEND special_chars ",") +endif() +if(NOT WIN32 AND NOT CYGWIN) + string(APPEND special_chars "*?<>") +endif() +set(special_dir "${CMAKE_CURRENT_BINARY_DIR}/special-${special_chars}-include") +file(WRITE "${special_dir}/SpecialDir.h" "#define SPECIAL_DIR_H\n") +target_include_directories(IncludeDirectories PRIVATE "${special_dir}") +target_compile_definitions(IncludeDirectories PRIVATE INCLUDE_SPECIAL_DIR) + +if(MAKE_SUPPORTS_SPACES) set(special_space_dir "${CMAKE_CURRENT_BINARY_DIR}/special-space ${special_chars}-include") file(WRITE "${special_space_dir}/SpecialSpaceDir.h" "#define SPECIAL_SPACE_DIR_H\n") - target_include_directories(IncludeDirectories PRIVATE "${special_dir}" "${special_space_dir}") - target_compile_definitions(IncludeDirectories PRIVATE INCLUDE_SPECIAL_DIR) + target_include_directories(IncludeDirectories PRIVATE "${special_space_dir}") + target_compile_definitions(IncludeDirectories PRIVATE INCLUDE_SPECIAL_SPACE_DIR) endif() add_library(ordertest ordertest.cpp) diff --git a/Tests/IncludeDirectories/main.cpp b/Tests/IncludeDirectories/main.cpp index 7368ee9..6dc88e2 100644 --- a/Tests/IncludeDirectories/main.cpp +++ b/Tests/IncludeDirectories/main.cpp @@ -8,6 +8,9 @@ # ifndef SPECIAL_DIR_H # error "SPECIAL_DIR_H not defined" # endif +#endif + +#ifdef INCLUDE_SPECIAL_SPACE_DIR # include "SpecialSpaceDir.h" # ifndef SPECIAL_SPACE_DIR_H # error "SPECIAL_SPACE_DIR_H not defined" diff --git a/Tests/MSManifest/CMakeLists.txt b/Tests/MSManifest/CMakeLists.txt index 300cfa6..631c598 100644 --- a/Tests/MSManifest/CMakeLists.txt +++ b/Tests/MSManifest/CMakeLists.txt @@ -1,5 +1,8 @@ cmake_minimum_required(VERSION 3.3) project(MSManifest C) +include(CTest) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) add_subdirectory(Subdir) +add_subdirectory(Subdir2) diff --git a/Tests/MSManifest/Subdir/CMakeLists.txt b/Tests/MSManifest/Subdir/CMakeLists.txt index 11272bb..8664572 100644 --- a/Tests/MSManifest/Subdir/CMakeLists.txt +++ b/Tests/MSManifest/Subdir/CMakeLists.txt @@ -2,10 +2,9 @@ configure_file(test.manifest.in test.manifest) add_executable(MSManifest main.c ${CMAKE_CURRENT_BINARY_DIR}/test.manifest) if(MSVC AND NOT MSVC_VERSION LESS 1400) - add_custom_command(TARGET MSManifest POST_BUILD VERBATIM - COMMAND ${CMAKE_COMMAND} -Dexe=$<TARGET_FILE:MSManifest> - -P ${CMAKE_CURRENT_SOURCE_DIR}/check.cmake - ) + add_test(NAME MSManifest.Single COMMAND + ${CMAKE_COMMAND} -Dexe=$<TARGET_FILE:MSManifest> + -P ${CMAKE_CURRENT_SOURCE_DIR}/check.cmake) add_executable(MSManifestNone main.c) set_property(TARGET MSManifestNone PROPERTY LINK_FLAGS "/MANIFEST:NO") endif() diff --git a/Tests/MSManifest/Subdir2/CMakeLists.txt b/Tests/MSManifest/Subdir2/CMakeLists.txt new file mode 100644 index 0000000..19d8de7 --- /dev/null +++ b/Tests/MSManifest/Subdir2/CMakeLists.txt @@ -0,0 +1,13 @@ +configure_file(test_manifest1.in test_manifest1.manifest) +configure_file(test_manifest2.in test_manifest2.manifest) +configure_file(test_manifest3.in test_manifest3.manifest) +add_executable(MSMultipleManifest main.c + ${CMAKE_CURRENT_BINARY_DIR}/test_manifest1.manifest + ${CMAKE_CURRENT_BINARY_DIR}/test_manifest2.manifest + ${CMAKE_CURRENT_BINARY_DIR}/test_manifest3.manifest) + +if(MSVC AND NOT MSVC_VERSION LESS 1400) + add_test(NAME MSManifest.Multiple COMMAND + ${CMAKE_COMMAND} -Dexe=$<TARGET_FILE:MSMultipleManifest> + -P ${CMAKE_CURRENT_SOURCE_DIR}/check.cmake) +endif() diff --git a/Tests/MSManifest/Subdir2/check.cmake b/Tests/MSManifest/Subdir2/check.cmake new file mode 100644 index 0000000..4a1705b --- /dev/null +++ b/Tests/MSManifest/Subdir2/check.cmake @@ -0,0 +1,22 @@ +file(STRINGS "${exe}" manifest_content1 REGEX "name=\"Kitware.CMake.MSMultipleManifest\"") +if(manifest_content1) + message(STATUS "Expected manifest content found:\n ${manifest_content1}") +else() + message(FATAL_ERROR "Expected manifest content not found in\n ${exe}") +endif() + +# Verify Second Manifest Content is inside Executable. +file(STRINGS "${exe}" manifest_content2 REGEX "8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a") +if(manifest_content2) + message(STATUS "Expected manifest content found:\n ${manifest_content2}") +else() + message(FATAL_ERROR "Expected manifest content not found in\n ${exe}") +endif() + +# Verify Third Manifest Content is inside Executable. +file(STRINGS "${exe}" manifest_content3 REGEX "<dpiAware>true</dpiAware>") +if(manifest_content3) + message(STATUS "Expected manifest content found:\n ${manifest_content3}") +else() + message(FATAL_ERROR "Expected manifest content not found in\n ${exe}") +endif() diff --git a/Tests/MSManifest/Subdir2/main.c b/Tests/MSManifest/Subdir2/main.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/MSManifest/Subdir2/main.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/MSManifest/Subdir2/test_manifest1.in b/Tests/MSManifest/Subdir2/test_manifest1.in new file mode 100644 index 0000000..f36eead --- /dev/null +++ b/Tests/MSManifest/Subdir2/test_manifest1.in @@ -0,0 +1,5 @@ +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> + <assemblyIdentity type="win32" version="1.0.0.0" + name="Kitware.CMake.MSMultipleManifest"/> + <description>CMake Multiple Manifest Test Application</description> +</assembly> diff --git a/Tests/MSManifest/Subdir2/test_manifest2.in b/Tests/MSManifest/Subdir2/test_manifest2.in new file mode 100644 index 0000000..ec96f11 --- /dev/null +++ b/Tests/MSManifest/Subdir2/test_manifest2.in @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"> + <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> + <application> + <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"></supportedOS> + <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"></supportedOS> + <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS> + <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"></supportedOS> + <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS> + </application> + </compatibility> +</assembly> diff --git a/Tests/MSManifest/Subdir2/test_manifest3.in b/Tests/MSManifest/Subdir2/test_manifest3.in new file mode 100644 index 0000000..0770e11 --- /dev/null +++ b/Tests/MSManifest/Subdir2/test_manifest3.in @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" > + <asmv3:application> + <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"> + <dpiAware>true</dpiAware> + <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness> + </asmv3:windowsSettings> + </asmv3:application> +</assembly> diff --git a/Tests/RunCMake/CMP0104/CMP0104-Common.cmake b/Tests/RunCMake/CMP0104/CMP0104-Common.cmake new file mode 100644 index 0000000..b3568f1 --- /dev/null +++ b/Tests/RunCMake/CMP0104/CMP0104-Common.cmake @@ -0,0 +1,2 @@ +enable_language(CUDA) +add_library(cuda main.cu) diff --git a/Tests/RunCMake/CMP0104/CMP0104-NEW.cmake b/Tests/RunCMake/CMP0104/CMP0104-NEW.cmake new file mode 100644 index 0000000..732ab77 --- /dev/null +++ b/Tests/RunCMake/CMP0104/CMP0104-NEW.cmake @@ -0,0 +1,6 @@ +cmake_policy(SET CMP0104 NEW) +include(CMP0104-Common.cmake) + +if(NOT CMAKE_CUDA_ARCHITECTURES) + message(FATAL_ERROR "CMAKE_CUDA_ARCHITECTURES is empty with CMP0104 enabled.") +endif() diff --git a/Tests/RunCMake/CMP0104/CMP0104-OLD.cmake b/Tests/RunCMake/CMP0104/CMP0104-OLD.cmake new file mode 100644 index 0000000..415eecc --- /dev/null +++ b/Tests/RunCMake/CMP0104/CMP0104-OLD.cmake @@ -0,0 +1,12 @@ +cmake_policy(SET CMP0104 OLD) +include(CMP0104-Common.cmake) + +if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") + if(CMAKE_CUDA_ARCHITECTURES) + message(FATAL_ERROR "CMAKE_CUDA_ARCHITECTURES isn't empty for NVIDIA with CMP0104 OLD.") + endif() +else(NOT CMAKE_CUDA_COMPILER_ID STREQUAL "Unknown") + if(NOT CMAKE_CUDA_ARCHITECTURES) + message(FATAL_ERROR "CMAKE_CUDA_ARCHITECTURES isn't non-empty for non-NVIDIA with CMP0104 OLD.") + endif() +endif() diff --git a/Tests/RunCMake/CMP0104/CMP0104-WARN-stderr.txt b/Tests/RunCMake/CMP0104/CMP0104-WARN-stderr.txt new file mode 100644 index 0000000..2c9b7d7 --- /dev/null +++ b/Tests/RunCMake/CMP0104/CMP0104-WARN-stderr.txt @@ -0,0 +1,8 @@ +CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0104 is not set: CMAKE_CUDA_ARCHITECTURES now detected for NVCC, + empty CUDA_ARCHITECTURES not allowed. Run "cmake --help-policy CMP0104" + for policy details. Use the cmake_policy command to set the policy and + suppress this warning. + + CUDA_ARCHITECTURES is empty for target "cuda". +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0104/CMP0104-WARN.cmake b/Tests/RunCMake/CMP0104/CMP0104-WARN.cmake new file mode 100644 index 0000000..841d0a8 --- /dev/null +++ b/Tests/RunCMake/CMP0104/CMP0104-WARN.cmake @@ -0,0 +1 @@ +include(CMP0104-Common.cmake) diff --git a/Tests/RunCMake/CMP0104/CMakeLists.txt b/Tests/RunCMake/CMP0104/CMakeLists.txt new file mode 100644 index 0000000..2632ffa --- /dev/null +++ b/Tests/RunCMake/CMP0104/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.16) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0104/RunCMakeTest.cmake b/Tests/RunCMake/CMP0104/RunCMakeTest.cmake new file mode 100644 index 0000000..bc8e1b1 --- /dev/null +++ b/Tests/RunCMake/CMP0104/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0104-OLD) +run_cmake(CMP0104-NEW) +run_cmake(CMP0104-WARN) diff --git a/Tests/RunCMake/CMP0104/main.cu b/Tests/RunCMake/CMP0104/main.cu new file mode 100644 index 0000000..5047a34 --- /dev/null +++ b/Tests/RunCMake/CMP0104/main.cu @@ -0,0 +1,3 @@ +int main() +{ +} diff --git a/Tests/RunCMake/CMP0106/CMP0106-Common.cmake b/Tests/RunCMake/CMP0106/CMP0106-Common.cmake new file mode 100644 index 0000000..a1f7908 --- /dev/null +++ b/Tests/RunCMake/CMP0106/CMP0106-Common.cmake @@ -0,0 +1,10 @@ +include(Documentation OPTIONAL RESULT_VARIABLE found) +if (NOT should_find AND found) + message(FATAL_ERROR + "The Documentation module should not have been found, but it was.") +endif () +if (should_find AND NOT found) + message(FATAL_ERROR + "The Documentation module should have been found, but it was not.") +endif () +include(${CMAKE_ROOT}/Modules/Documentation.cmake) diff --git a/Tests/RunCMake/CMP0106/CMP0106-NEW-result.txt b/Tests/RunCMake/CMP0106/CMP0106-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0106/CMP0106-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0106/CMP0106-NEW-stderr.txt b/Tests/RunCMake/CMP0106/CMP0106-NEW-stderr.txt new file mode 100644 index 0000000..7ad774e --- /dev/null +++ b/Tests/RunCMake/CMP0106/CMP0106-NEW-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at .*/Modules/Documentation.cmake:15 \(message\): + Documentation.cmake is VTK-specific code and should not be used in non-VTK + projects. This logic in this module is best shipped with the project using + it rather than with CMake. This is now an error according to policy + CMP0106. +Call Stack \(most recent call first\): + CMP0106-Common.cmake:10 \(include\) + CMP0106-NEW.cmake:4 \(include\) + CMakeLists.txt:7 \(include\) diff --git a/Tests/RunCMake/CMP0106/CMP0106-NEW.cmake b/Tests/RunCMake/CMP0106/CMP0106-NEW.cmake new file mode 100644 index 0000000..e7d5bd1 --- /dev/null +++ b/Tests/RunCMake/CMP0106/CMP0106-NEW.cmake @@ -0,0 +1,4 @@ +cmake_policy(SET CMP0106 NEW) + +set(should_find OFF) +include(CMP0106-Common.cmake) diff --git a/Tests/RunCMake/CMP0106/CMP0106-OLD.cmake b/Tests/RunCMake/CMP0106/CMP0106-OLD.cmake new file mode 100644 index 0000000..730e846 --- /dev/null +++ b/Tests/RunCMake/CMP0106/CMP0106-OLD.cmake @@ -0,0 +1,9 @@ +cmake_policy(SET CMP0106 OLD) + +set(should_find ON) +include(CMP0106-Common.cmake) +if (NOT DEFINED BUILD_DOCUMENTATION) + message(FATAL_ERROR + "Cache variables seem to have not been made with a `OLD` policy " + "setting.") +endif () diff --git a/Tests/RunCMake/CMP0106/CMP0106-WARN-ParaView-stderr.txt b/Tests/RunCMake/CMP0106/CMP0106-WARN-ParaView-stderr.txt new file mode 100644 index 0000000..b61889b --- /dev/null +++ b/Tests/RunCMake/CMP0106/CMP0106-WARN-ParaView-stderr.txt @@ -0,0 +1,8 @@ +CMake Warning \(dev\) at CMP0106-Common.cmake:1 \(include\): + Policy CMP0106 is not set: The Documentation module is removed. Run "cmake + --help-policy CMP0106" for policy details. Use the cmake_policy command to + set the policy and suppress this warning. + +Call Stack \(most recent call first\): + subdir/CMakeLists.txt:2 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0106/CMP0106-WARN-ParaView.cmake b/Tests/RunCMake/CMP0106/CMP0106-WARN-ParaView.cmake new file mode 100644 index 0000000..309abcc --- /dev/null +++ b/Tests/RunCMake/CMP0106/CMP0106-WARN-ParaView.cmake @@ -0,0 +1,2 @@ +set(should_find ON) +add_subdirectory(subdir) diff --git a/Tests/RunCMake/CMP0106/CMP0106-WARN-VTK-stderr.txt b/Tests/RunCMake/CMP0106/CMP0106-WARN-VTK-stderr.txt new file mode 100644 index 0000000..f8a754e --- /dev/null +++ b/Tests/RunCMake/CMP0106/CMP0106-WARN-VTK-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) at CMP0106-Common.cmake:1 \(include\): + Policy CMP0106 is not set: The Documentation module is removed. Run "cmake + --help-policy CMP0106" for policy details. Use the cmake_policy command to + set the policy and suppress this warning. + +Call Stack \(most recent call first\): + CMP0106-WARN-VTK.cmake:2 \(include\) + CMakeLists.txt:7 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0106/CMP0106-WARN-VTK.cmake b/Tests/RunCMake/CMP0106/CMP0106-WARN-VTK.cmake new file mode 100644 index 0000000..99f6c39 --- /dev/null +++ b/Tests/RunCMake/CMP0106/CMP0106-WARN-VTK.cmake @@ -0,0 +1,2 @@ +set(should_find ON) +include(CMP0106-Common.cmake) diff --git a/Tests/RunCMake/CMP0106/CMP0106-WARN-stderr.txt b/Tests/RunCMake/CMP0106/CMP0106-WARN-stderr.txt new file mode 100644 index 0000000..d0d48d0 --- /dev/null +++ b/Tests/RunCMake/CMP0106/CMP0106-WARN-stderr.txt @@ -0,0 +1,37 @@ +CMake Warning \(dev\) at CMP0106-Common.cmake:1 \(include\): + Policy CMP0106 is not set: The Documentation module is removed. Run "cmake + --help-policy CMP0106" for policy details. Use the cmake_policy command to + set the policy and suppress this warning. + +Call Stack \(most recent call first\): + CMP0106-WARN.cmake:2 \(include\) + CMakeLists.txt:7 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at .*/Modules/Documentation.cmake:27 \(message\): + Policy CMP0106 is not set: The Documentation module is removed. Run "cmake + --help-policy CMP0106" for policy details. Use the cmake_policy command to + set the policy and suppress this warning. + + Documentation.cmake is VTK-specific code and should not be used in non-VTK + projects. This logic in this module is best shipped with the project using + it rather than with CMake. +Call Stack \(most recent call first\): + CMP0106-Common.cmake:1 \(include\) + CMP0106-WARN.cmake:2 \(include\) + CMakeLists.txt:7 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at .*/Modules/Documentation.cmake:27 \(message\): + Policy CMP0106 is not set: The Documentation module is removed. Run "cmake + --help-policy CMP0106" for policy details. Use the cmake_policy command to + set the policy and suppress this warning. + + Documentation.cmake is VTK-specific code and should not be used in non-VTK + projects. This logic in this module is best shipped with the project using + it rather than with CMake. +Call Stack \(most recent call first\): + CMP0106-Common.cmake:10 \(include\) + CMP0106-WARN.cmake:2 \(include\) + CMakeLists.txt:7 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0106/CMP0106-WARN.cmake b/Tests/RunCMake/CMP0106/CMP0106-WARN.cmake new file mode 100644 index 0000000..99f6c39 --- /dev/null +++ b/Tests/RunCMake/CMP0106/CMP0106-WARN.cmake @@ -0,0 +1,2 @@ +set(should_find ON) +include(CMP0106-Common.cmake) diff --git a/Tests/RunCMake/CMP0106/CMakeLists.txt b/Tests/RunCMake/CMP0106/CMakeLists.txt new file mode 100644 index 0000000..eafa642 --- /dev/null +++ b/Tests/RunCMake/CMP0106/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +if (RunCMake_TEST STREQUAL "CMP0106-WARN-VTK") + project(VTK NONE) +else () + project(${RunCMake_TEST} NONE) +endif () +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0106/RunCMakeTest.cmake b/Tests/RunCMake/CMP0106/RunCMakeTest.cmake new file mode 100644 index 0000000..acec054 --- /dev/null +++ b/Tests/RunCMake/CMP0106/RunCMakeTest.cmake @@ -0,0 +1,7 @@ +include(RunCMake) + +run_cmake(CMP0106-OLD) +run_cmake(CMP0106-NEW) +run_cmake(CMP0106-WARN) +run_cmake(CMP0106-WARN-VTK) +run_cmake(CMP0106-WARN-ParaView) diff --git a/Tests/RunCMake/CMP0106/subdir/CMakeLists.txt b/Tests/RunCMake/CMP0106/subdir/CMakeLists.txt new file mode 100644 index 0000000..ed1dd05 --- /dev/null +++ b/Tests/RunCMake/CMP0106/subdir/CMakeLists.txt @@ -0,0 +1,2 @@ +project(VTK NONE) +include(${CMAKE_CURRENT_SOURCE_DIR}/../CMP0106-Common.cmake) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 2a4af3e..cc88868 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -116,6 +116,10 @@ endif() add_RunCMake_test(CMP0069) add_RunCMake_test(CMP0081) add_RunCMake_test(CMP0102) +if(CMake_TEST_CUDA) + add_RunCMake_test(CMP0104) +endif() +add_RunCMake_test(CMP0106) # The test for Policy 65 requires the use of the # CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode @@ -468,7 +472,8 @@ add_RunCMake_test(ExportWithoutLanguage) add_RunCMake_test(target_link_directories) add_RunCMake_test(target_link_libraries) add_RunCMake_test(add_link_options -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}) -add_RunCMake_test(target_link_options -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}) +add_RunCMake_test(target_link_options -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID} + -DCMake_TEST_CUDA=${CMake_TEST_CUDA}) add_RunCMake_test(target_compile_definitions) add_RunCMake_test(target_compile_features) diff --git a/Tests/RunCMake/CTestCommandLine/MemCheckSan.cmake b/Tests/RunCMake/CTestCommandLine/MemCheckSan.cmake new file mode 100644 index 0000000..192c30c --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/MemCheckSan.cmake @@ -0,0 +1,7 @@ +set(MEMORYCHECK_COMMAND "") +include(CTest) +add_test( + NAME TestSan + COMMAND ${CMAKE_COMMAND} + -P ${CMAKE_CURRENT_LIST_DIR}/../ctest_memcheck/test${MEMORYCHECK_TYPE}.cmake + ) diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 9b9ae65..e05ad79 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -242,6 +242,20 @@ function(run_TestOutputSize) endfunction() run_TestOutputSize() +# Test --stop-on-failure +function(run_stop_on_failure) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/stop-on-failure) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " +add_test(test1 \"${CMAKE_COMMAND}\" -E false) +add_test(test2 \"${CMAKE_COMMAND}\" -E echo \"not running\") +") + run_cmake_command(stop-on-failure ${CMAKE_CTEST_COMMAND} --stop-on-failure) +endfunction() +run_stop_on_failure() + function(run_TestAffinity) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestAffinity) set(RunCMake_TEST_NO_CLEAN 1) @@ -345,3 +359,24 @@ run_NoTests() # Check the configuration type variable is passed run_ctest(check-configuration-type) + +function(run_MemCheckSan case opts) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/MemCheckSan${case}-build) + set(RunCMake_TEST_OPTIONS + "-DMEMORYCHECK_TYPE=${case}Sanitizer" + "-DMEMORYCHECK_SANITIZER_OPTIONS=${opts}" + ) + run_cmake(MemCheckSan) + unset(RunCMake_TEST_OPTIONS) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake-stdout-file "../ctest_memcheck/Dummy${case}Sanitizer-stdout.txt") + run_cmake_command(MemCheckSan${case}-ctest + ${CMAKE_CTEST_COMMAND} -C Debug -M Experimental -T MemCheck -V + ) +endfunction() +run_MemCheckSan(Address "simulate_sanitizer=1:report_bugs=1:history_size=5:exitcode=55") +run_MemCheckSan(Leak "simulate_sanitizer=1:report_bugs=1:history_size=5:exitcode=55") +run_MemCheckSan(Memory "simulate_sanitizer=1:report_bugs=1:history_size=5:exitcode=55") +run_MemCheckSan(Thread "report_bugs=1:history_size=5:exitcode=55") +run_MemCheckSan(UndefinedBehavior "simulate_sanitizer=1") diff --git a/Tests/RunCMake/CTestCommandLine/stop-on-failure-result.txt b/Tests/RunCMake/CTestCommandLine/stop-on-failure-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/stop-on-failure-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/CTestCommandLine/stop-on-failure-stderr.txt b/Tests/RunCMake/CTestCommandLine/stop-on-failure-stderr.txt new file mode 100644 index 0000000..ba4235d --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/stop-on-failure-stderr.txt @@ -0,0 +1 @@ +Errors while running CTest diff --git a/Tests/RunCMake/CTestCommandLine/stop-on-failure-stdout.txt b/Tests/RunCMake/CTestCommandLine/stop-on-failure-stdout.txt new file mode 100644 index 0000000..12c77d0 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/stop-on-failure-stdout.txt @@ -0,0 +1,10 @@ +^Test project .*/Tests/RunCMake/CTestCommandLine/stop-on-failure + Start 1: test1 +1/2 Test #1: test1 ............................\*\*\*Failed +[0-9.]+ sec ++ +0% tests passed, 1 tests failed out of 1 ++ +Total Test time \(real\) = +[0-9.]+ sec ++ +The following tests FAILED: +[ ]+1 - test1 \(Failed\)$ diff --git a/Tests/RunCMake/CommandLine/E_cat_directory-result.txt b/Tests/RunCMake/CommandLine/E_cat_directory-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_cat_directory-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_cat_directory-stderr.txt b/Tests/RunCMake/CommandLine/E_cat_directory-stderr.txt new file mode 100644 index 0000000..c4d0d48 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_cat_directory-stderr.txt @@ -0,0 +1 @@ +^CMake Error: .* is a directory diff --git a/Tests/RunCMake/CommandLine/E_cat_good_cat-stdout.txt b/Tests/RunCMake/CommandLine/E_cat_good_cat-stdout.txt new file mode 100644 index 0000000..aae90e6 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_cat_good_cat-stdout.txt @@ -0,0 +1,3 @@ +first file to append +second file to append +à éùç - 한êµì–´ diff --git a/Tests/RunCMake/CommandLine/E_cat_non_existing_file-result.txt b/Tests/RunCMake/CommandLine/E_cat_non_existing_file-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_cat_non_existing_file-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_cat_non_existing_file-stderr.txt b/Tests/RunCMake/CommandLine/E_cat_non_existing_file-stderr.txt new file mode 100644 index 0000000..0d8fc4b --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_cat_non_existing_file-stderr.txt @@ -0,0 +1 @@ +^CMake Error: .*: no such file or directory \(ignoring\) diff --git a/Tests/RunCMake/CommandLine/E_cat_non_readable_file-result.txt b/Tests/RunCMake/CommandLine/E_cat_non_readable_file-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_cat_non_readable_file-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_cat_non_readable_file-stderr.txt b/Tests/RunCMake/CommandLine/E_cat_non_readable_file-stderr.txt new file mode 100644 index 0000000..97ec822 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_cat_non_readable_file-stderr.txt @@ -0,0 +1 @@ +^CMake Error: .*: permission denied \(ignoring\) diff --git a/Tests/RunCMake/CommandLine/E_cat_option_not_handled-result.txt b/Tests/RunCMake/CommandLine/E_cat_option_not_handled-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_cat_option_not_handled-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_cat_option_not_handled-stderr.txt b/Tests/RunCMake/CommandLine/E_cat_option_not_handled-stderr.txt new file mode 100644 index 0000000..92f7acf --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_cat_option_not_handled-stderr.txt @@ -0,0 +1 @@ +^CMake Error: -f: option not handled diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 839aec0..0f806bc 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -459,6 +459,44 @@ if(NOT WIN32 AND NOT CYGWIN) endif() unset(out) +# cat tests +set(out ${RunCMake_BINARY_DIR}/cat_tests) +file(REMOVE_RECURSE "${out}") +file(MAKE_DIRECTORY ${out}) +run_cmake_command(E_cat_non_existing_file + ${CMAKE_COMMAND} -E cat ${out}/non-existing-file.txt) + +if(UNIX) + # test non readable file only if not root + execute_process( + COMMAND id -u $ENV{USER} + OUTPUT_VARIABLE uid + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(NOT "${uid}" STREQUAL "0") + # Create non readable file + set(inside_folder "${out}/in") + file(MAKE_DIRECTORY ${inside_folder}) + file(WRITE "${inside_folder}/non_readable_file.txt" "first file to append\n") + file(COPY "${inside_folder}/non_readable_file.txt" DESTINATION "${out}" FILE_PERMISSIONS OWNER_WRITE) + run_cmake_command(E_cat_non_readable_file + ${CMAKE_COMMAND} -E cat "${out}/non_readable_file.txt") + endif() +endif() + +run_cmake_command(E_cat_option_not_handled + ${CMAKE_COMMAND} -E cat -f) + +run_cmake_command(E_cat_directory + ${CMAKE_COMMAND} -E cat ${out}) + +file(WRITE "${out}/first_file.txt" "first file to append\n") +file(WRITE "${out}/second_file.txt" "second file to append\n") +file(WRITE "${out}/unicode_file.txt" "à éùç - 한êµì–´") # Korean in Korean +run_cmake_command(E_cat_good_cat + ${CMAKE_COMMAND} -E cat "${out}/first_file.txt" "${out}/second_file.txt" "${out}/unicode_file.txt") +unset(out) + run_cmake_command(E_env-no-command0 ${CMAKE_COMMAND} -E env) run_cmake_command(E_env-no-command1 ${CMAKE_COMMAND} -E env TEST_ENV=1) run_cmake_command(E_env-bad-arg1 ${CMAKE_COMMAND} -E env -bad-arg1) diff --git a/Tests/RunCMake/CompilerLauncher/CUDA-common.cmake b/Tests/RunCMake/CompilerLauncher/CUDA-common.cmake index 6f7fc86..ca25b2a 100644 --- a/Tests/RunCMake/CompilerLauncher/CUDA-common.cmake +++ b/Tests/RunCMake/CompilerLauncher/CUDA-common.cmake @@ -1,3 +1,4 @@ +cmake_policy(SET CMP0104 NEW) enable_language(CUDA) set(CMAKE_VERBOSE_MAKEFILE TRUE) add_executable(main main.cu) diff --git a/Tests/RunCMake/ExternalProject/Add_StepDependencies_iface_step-stderr.txt b/Tests/RunCMake/ExternalProject/Add_StepDependencies_iface_step-stderr.txt index 22e13bf..5fa75e8 100644 --- a/Tests/RunCMake/ExternalProject/Add_StepDependencies_iface_step-stderr.txt +++ b/Tests/RunCMake/ExternalProject/Add_StepDependencies_iface_step-stderr.txt @@ -1,5 +1,5 @@ ^CMake Error at .*/Modules/ExternalProject.cmake:[0-9]+ \(message\): - Target "MyProj-IFace" was not generated by ExternalProject_Add_StepTargets. + External project "MyProj" does not have a step "IFace". Call Stack \(most recent call first\): Add_StepDependencies_iface_step.cmake:[0-9]+ \(ExternalProject_Add_StepDependencies\) CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_CMAKE_APPBUNDLE_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_CMAKE_APPBUNDLE_PATH.cmake index 2687efe..bf8cd4e 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_CMAKE_APPBUNDLE_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_CMAKE_APPBUNDLE_PATH.cmake @@ -4,53 +4,13 @@ enable_language(C) # Prepare environment and variables set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE) set(CMAKE_APPBUNDLE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pc-foo") -if(WIN32) - set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}\\dummy-pkg-config.bat") - set(ENV{CMAKE_APPBUNDLE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}\\pc-bar;X:\\this\\directory\\should\\not\\exist\\in\\the\\filesystem") - set(ENV{PKG_CONFIG_PATH} "C:\\baz") -else() - set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}/dummy-pkg-config.sh") - set(ENV{CMAKE_APPBUNDLE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/pc-bar:/this/directory/should/not/exist/in/the/filesystem") - set(ENV{PKG_CONFIG_PATH} "/baz") -endif() - +set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}/dummy-pkg-config.sh") +set(ENV{CMAKE_APPBUNDLE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/pc-bar:/this/directory/should/not/exist/in/the/filesystem") +set(ENV{PKG_CONFIG_PATH} "/baz") find_package(PkgConfig) - -if(NOT DEFINED CMAKE_SYSTEM_NAME - OR (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$" - AND NOT CMAKE_CROSSCOMPILING)) - if(EXISTS "/etc/debian_version") # is this a debian system ? - if(CMAKE_LIBRARY_ARCHITECTURE MATCHES "^(i386-linux-gnu|x86_64-linux-gnu)$") - # Cannot create directories for all the existing architectures... - set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") - else() - set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") - endif() - else() - # not debian, check the FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS properties - get_property(uselibx32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIBX32_PATHS) - get_property(uselib32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS) - get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) - if(uselibx32 AND CMAKE_INTERNAL_PLATFORM_ABI STREQUAL "ELF X32") - set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/libx32/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/libx32/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") - elseif(uselib32 AND CMAKE_SIZEOF_VOID_P EQUAL 4) - set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib32/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib32/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") - elseif(uselib64 AND CMAKE_SIZEOF_VOID_P EQUAL 8) - set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") - else() - set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") - endif() - endif() -else() - if(WIN32) - set(expected_path "C:\\baz;${CMAKE_CURRENT_SOURCE_DIR}\\pc-foo\\lib\\pkgconfig;${CMAKE_CURRENT_SOURCE_DIR}\\pc-bar\\lib\\pkgconfig") - else() - set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") - endif() -endif() - +set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") pkg_check_modules(FOO "${expected_path}") diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_CMAKE_FRAMEWORK_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_CMAKE_FRAMEWORK_PATH.cmake index 74cda25..37c18fc 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_CMAKE_FRAMEWORK_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_CMAKE_FRAMEWORK_PATH.cmake @@ -4,53 +4,13 @@ enable_language(C) # Prepare environment and variables set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE) set(CMAKE_FRAMEWORK_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pc-foo") -if(WIN32) - set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}\\dummy-pkg-config.bat") - set(ENV{CMAKE_FRAMEWORK_PATH} "${CMAKE_CURRENT_SOURCE_DIR}\\pc-bar;X:\\this\\directory\\should\\not\\exist\\in\\the\\filesystem") - set(ENV{PKG_CONFIG_PATH} "C:\\baz") -else() - set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}/dummy-pkg-config.sh") - set(ENV{CMAKE_FRAMEWORK_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/pc-bar:/this/directory/should/not/exist/in/the/filesystem") - set(ENV{PKG_CONFIG_PATH} "/baz") -endif() - +set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}/dummy-pkg-config.sh") +set(ENV{CMAKE_FRAMEWORK_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/pc-bar:/this/directory/should/not/exist/in/the/filesystem") +set(ENV{PKG_CONFIG_PATH} "/baz") find_package(PkgConfig) - -if(NOT DEFINED CMAKE_SYSTEM_NAME - OR (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$" - AND NOT CMAKE_CROSSCOMPILING)) - if(EXISTS "/etc/debian_version") # is this a debian system ? - if(CMAKE_LIBRARY_ARCHITECTURE MATCHES "^(i386-linux-gnu|x86_64-linux-gnu)$") - # Cannot create directories for all the existing architectures... - set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") - else() - set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") - endif() - else() - # not debian, check the FIND_LIBRARY_USE_LIB64_PATHS and FIND_LIBRARY_USE_LIB64_PATHS properties - get_property(uselibx32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIBX32_PATHS) - get_property(uselib32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS) - get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) - if(uselibx32 AND CMAKE_INTERNAL_PLATFORM_ABI STREQUAL "ELF X32") - set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/libx32/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/libx32/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") - elseif(uselib32 AND CMAKE_SIZEOF_VOID_P EQUAL 4) - set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib32/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib32/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") - elseif(uselib64 AND CMAKE_SIZEOF_VOID_P EQUAL 8) - set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") - else() - set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") - endif() - endif() -else() - if(WIN32) - set(expected_path "C:\\baz;${CMAKE_CURRENT_SOURCE_DIR}\\pc-foo\\lib\\pkgconfig;${CMAKE_CURRENT_SOURCE_DIR}\\pc-bar\\lib\\pkgconfig") - else() - set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") - endif() -endif() - +set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") pkg_check_modules(FOO "${expected_path}") diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_extract_frameworks.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_extract_frameworks.cmake new file mode 100644 index 0000000..fde886d --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_extract_frameworks.cmake @@ -0,0 +1,13 @@ +find_package(PkgConfig) + +set(foobar_LDFLAGS_OTHER "-Wl,xy;-framework;bar;-Wl,other-framework;-framework;baz;-Wl,abc;-framework;gosh;-frameworkcrap;-frame;j;-framework;nix;-Wl,def") +set(foobar_LIBRARIES "-lz;-lm") + +_pkgconfig_extract_frameworks("foobar") + +if (NOT foobar_LDFLAGS_OTHER STREQUAL "-Wl,xy;-Wl,other-framework;-Wl,abc;-frameworkcrap;-frame;j;-Wl,def") + message(SEND_ERROR "foobar_LDFLAGS_OTHER did not match: ${foobar_LDFLAGS_OTHER}") +endif () +if (NOT foobar_LIBRARIES STREQUAL "-lz;-lm;-framework bar;-framework baz;-framework gosh;-framework nix") + message(SEND_ERROR "foobar_LIBRARIES did not match: ${foobar_LIBRARIES}") +endif () diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_extract_frameworks_target.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_extract_frameworks_target.cmake new file mode 100644 index 0000000..5501d9f --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_extract_frameworks_target.cmake @@ -0,0 +1,29 @@ +# Prepare environment to reuse bletch.pc +file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pc-bletch/lib/pkgconfig" PC_PATH) +if(UNIX) + string(REPLACE "\\ " " " PC_PATH "${PC_PATH}") +endif() +set(ENV{PKG_CONFIG_PATH} "${PC_PATH}") + +find_package(PkgConfig REQUIRED) +pkg_check_modules(Bletch IMPORTED_TARGET REQUIRED bletch-framework) + +if (Bletch_LDFLAGS_OTHER) + message(SEND_ERROR "Bletch_LDFLAGS_OTHER should be empty, but is '${Bletch_LDFLAGS_OTHER}'") +endif () + +if (NOT Bletch_LINK_LIBRARIES STREQUAL "-framework foo;-framework bar;bletch;-framework baz") + message(SEND_ERROR "Bletch_LINK_LIBRARIES has wrong value '${Bletch_LINK_LIBRARIES}'") +endif () + +foreach (prop IN ITEMS INTERFACE_INCLUDE_DIRECTORIES INTERFACE_LINK_OPTIONS INTERFACE_COMPILE_OPTIONS) + get_target_property(prop_value PkgConfig::Bletch ${prop}) + if (prop_value) + message(SEND_ERROR "target property ${prop} should not be set, but is '${prop_value}'") + endif () +endforeach () + +get_target_property(prop_value PkgConfig::Bletch INTERFACE_LINK_LIBRARIES) +if (NOT prop_value STREQUAL Bletch_LINK_LIBRARIES) + message(SEND_ERROR "target property INTERFACE_LINK_LIBRARIES has wrong value '${prop_value}'") +endif () diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake index 9df1d5b..dc77915 100644 --- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake @@ -6,8 +6,10 @@ run_cmake(FindPkgConfig_NO_PKGCONFIG_PATH) run_cmake(FindPkgConfig_PKGCONFIG_PATH) run_cmake(FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH) run_cmake(FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH) +run_cmake(FindPkgConfig_extract_frameworks) if(APPLE) + run_cmake(FindPkgConfig_extract_frameworks_target) run_cmake(FindPkgConfig_CMAKE_FRAMEWORK_PATH) run_cmake(FindPkgConfig_CMAKE_APPBUNDLE_PATH) endif() diff --git a/Tests/RunCMake/FindPkgConfig/pc-bletch/lib/pkgconfig/bletch-framework.pc b/Tests/RunCMake/FindPkgConfig/pc-bletch/lib/pkgconfig/bletch-framework.pc new file mode 100644 index 0000000..cc680ae --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/pc-bletch/lib/pkgconfig/bletch-framework.pc @@ -0,0 +1,9 @@ +prefix=/opt/bletch +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: Bletch +Description: Dummy packaget to test variable support +Version: 1.3 +Libs: -L${libdir} -framework foo -framework bar -lbletch -framework baz diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_command-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_command-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_command-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_command-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_command-stderr.txt new file mode 100644 index 0000000..eb15834 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_command-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at DEVICE_LINK-add_custom_command.cmake:[0-9]+ \(add_custom_command\): + Error evaluating generator expression: + + \$<DEVICE_LINK> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_command.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_command.cmake new file mode 100644 index 0000000..01b3784 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_command.cmake @@ -0,0 +1,4 @@ +add_custom_target(drive) +add_custom_command(TARGET drive PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E echo $<DEVICE_LINK> +) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_target-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_target-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_target-stderr.txt new file mode 100644 index 0000000..cdd3043 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_target-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at DEVICE_LINK-add_custom_target.cmake:[0-9]+ \(add_custom_target\): + Error evaluating generator expression: + + \$<DEVICE_LINK> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_target.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_target.cmake new file mode 100644 index 0000000..35728e9 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_target.cmake @@ -0,0 +1,3 @@ +add_custom_target(drive + COMMAND ${CMAKE_COMMAND} -E echo $<DEVICE_LINK> +) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_executable-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_executable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_executable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_executable-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_executable-stderr.txt new file mode 100644 index 0000000..56b595c --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_executable-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at DEVICE_LINK-add_executable.cmake:[0-9]+ \(add_executable\): + Error evaluating generator expression: + + \$<DEVICE_LINK:empty.c> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_executable.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_executable.cmake new file mode 100644 index 0000000..899f8f6 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_executable.cmake @@ -0,0 +1 @@ +add_executable(empty $<DEVICE_LINK:empty.c>) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_library-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_library-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_library-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_library-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_library-stderr.txt new file mode 100644 index 0000000..4477e00 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_library-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at DEVICE_LINK-add_library.cmake:[0-9]+ \(add_library\): + Error evaluating generator expression: + + \$<DEVICE_LINK:empty.c> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_library.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_library.cmake new file mode 100644 index 0000000..fc8547b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_library.cmake @@ -0,0 +1 @@ +add_library(empty $<DEVICE_LINK:empty.c>) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_test-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_test-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_test-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_test-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_test-stderr.txt new file mode 100644 index 0000000..99561fe --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_test-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at DEVICE_LINK-add_test.cmake:[0-9]+ \(add_test\): + Error evaluating generator expression: + + \$<DEVICE_LINK> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_test.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_test.cmake new file mode 100644 index 0000000..87d6ba1 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_test.cmake @@ -0,0 +1,5 @@ + +include(CTest) +enable_testing() + +add_test(NAME dummy COMMAND ${CMAKE_COMMAND} -E echo $<DEVICE_LINK>) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-install-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-install-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-install-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-install-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-install-stderr.txt new file mode 100644 index 0000000..afb3090 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-install-stderr.txt @@ -0,0 +1,7 @@ +CMake Error: + Error evaluating generator expression: + + \$<DEVICE_LINK:empty> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-install.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-install.cmake new file mode 100644 index 0000000..4b6dbef --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-install.cmake @@ -0,0 +1,5 @@ + +install(FILES + $<DEVICE_LINK:empty> + DESTINATION src +) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-link_depends-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-link_depends-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-link_depends-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-link_depends-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-link_depends-stderr.txt new file mode 100644 index 0000000..4fa0522 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-link_depends-stderr.txt @@ -0,0 +1,7 @@ +CMake Error: + Error evaluating generator expression: + + \$<DEVICE_LINK:lib> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-link_depends.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-link_depends.cmake new file mode 100644 index 0000000..8129514 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-link_depends.cmake @@ -0,0 +1,7 @@ + +enable_language(C) + +add_library(lib empty.c) + +add_executable(empty empty.c) +set_property(TARGET empty PROPERTY LINK_DEPENDS $<DEVICE_LINK:lib>) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_definitions-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_definitions-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_definitions-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_definitions-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_definitions-stderr.txt new file mode 100644 index 0000000..c0185e3 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_definitions-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at DEVICE_LINK-target_compile_definitions.cmake:[0-9]+ \(target_compile_definitions\): + Error evaluating generator expression: + + \$<DEVICE_LINK:DEF> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_definitions.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_definitions.cmake new file mode 100644 index 0000000..aaa8efc --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_definitions.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_compile_definitions(empty PRIVATE $<DEVICE_LINK:DEF>) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_options-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_options-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_options-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_options-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_options-stderr.txt new file mode 100644 index 0000000..34ca4f2 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_options-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at DEVICE_LINK-target_compile_options.cmake:[0-9]+ \(target_compile_options\): + Error evaluating generator expression: + + \$<DEVICE_LINK:-OPT> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_options.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_options.cmake new file mode 100644 index 0000000..a9cb7fd --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_options.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_compile_options(empty PRIVATE $<DEVICE_LINK:-OPT>) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_include_directories-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_include_directories-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_include_directories-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_include_directories-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_include_directories-stderr.txt new file mode 100644 index 0000000..4d1642d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_include_directories-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at DEVICE_LINK-target_include_directories.cmake:[0-9]+ \(target_include_directories\): + Error evaluating generator expression: + + \$<DEVICE_LINK:/DIR> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_include_directories.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_include_directories.cmake new file mode 100644 index 0000000..03cc413 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_include_directories.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_include_directories(empty PRIVATE $<DEVICE_LINK:/DIR>) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_directories-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_directories-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_directories-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_directories-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_directories-stderr.txt new file mode 100644 index 0000000..d924916 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_directories-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at DEVICE_LINK-target_link_directories.cmake:[0-9]+ \(target_link_directories\): + Error evaluating generator expression: + + \$<DEVICE_LINK:/DIR> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_directories.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_directories.cmake new file mode 100644 index 0000000..e50d27d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_directories.cmake @@ -0,0 +1,7 @@ + +enable_language(C) + +add_library(lib empty.c) + +add_executable(empty empty.c) +target_link_directories(empty PRIVATE $<DEVICE_LINK:/DIR>) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_libraries-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_libraries-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_libraries-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_libraries-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_libraries-stderr.txt new file mode 100644 index 0000000..1436fa8 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_libraries-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at DEVICE_LINK-target_link_libraries.cmake:[0-9]+ \(target_link_libraries\): + Error evaluating generator expression: + + \$<DEVICE_LINK:lib> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_libraries.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_libraries.cmake new file mode 100644 index 0000000..971f562 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_libraries.cmake @@ -0,0 +1,7 @@ + +enable_language(C) + +add_library(lib empty.c) + +add_executable(empty empty.c) +target_link_libraries(empty PRIVATE $<DEVICE_LINK:lib>) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_sources-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_sources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_sources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_sources-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_sources-stderr.txt new file mode 100644 index 0000000..c9b602d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_sources-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at DEVICE_LINK-target_sources.cmake:[0-9]+ \(target_sources\): + Error evaluating generator expression: + + \$<DEVICE_LINK:empty.c> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_sources.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_sources.cmake new file mode 100644 index 0000000..94bac9e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_sources.cmake @@ -0,0 +1,2 @@ +add_library(empty) +target_sources(empty PRIVATE $<DEVICE_LINK:empty.c>) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_command-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_command-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_command-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_command-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_command-stderr.txt new file mode 100644 index 0000000..5ad41b9 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_command-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at HOST_LINK-add_custom_command.cmake:[0-9]+ \(add_custom_command\): + Error evaluating generator expression: + + \$<HOST_LINK> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_command.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_command.cmake new file mode 100644 index 0000000..4d6e305 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_command.cmake @@ -0,0 +1,4 @@ +add_custom_target(drive) +add_custom_command(TARGET drive PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E echo $<HOST_LINK> +) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_target-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_target-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_target-stderr.txt new file mode 100644 index 0000000..c44202a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_target-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at HOST_LINK-add_custom_target.cmake:[0-9]+ \(add_custom_target\): + Error evaluating generator expression: + + \$<HOST_LINK> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_target.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_target.cmake new file mode 100644 index 0000000..eec072a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_target.cmake @@ -0,0 +1,3 @@ +add_custom_target(drive + COMMAND ${CMAKE_COMMAND} -E echo $<HOST_LINK> +) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_executable-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_executable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_executable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_executable-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_executable-stderr.txt new file mode 100644 index 0000000..b395515 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_executable-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at HOST_LINK-add_executable.cmake:[0-9]+ \(add_executable\): + Error evaluating generator expression: + + \$<HOST_LINK:empty.c> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_executable.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_executable.cmake new file mode 100644 index 0000000..c9f74a5 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_executable.cmake @@ -0,0 +1 @@ +add_executable(empty $<HOST_LINK:empty.c>) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_library-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_library-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_library-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_library-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_library-stderr.txt new file mode 100644 index 0000000..4bd27be --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_library-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at HOST_LINK-add_library.cmake:[0-9]+ \(add_library\): + Error evaluating generator expression: + + \$<HOST_LINK:empty.c> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_library.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_library.cmake new file mode 100644 index 0000000..44135af --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_library.cmake @@ -0,0 +1 @@ +add_library(empty $<HOST_LINK:empty.c>) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_test-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_test-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_test-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_test-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_test-stderr.txt new file mode 100644 index 0000000..012ad21 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_test-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at HOST_LINK-add_test.cmake:[0-9]+ \(add_test\): + Error evaluating generator expression: + + \$<HOST_LINK> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_test.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_test.cmake new file mode 100644 index 0000000..4b472af --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_test.cmake @@ -0,0 +1,5 @@ + +include(CTest) +enable_testing() + +add_test(NAME dummy COMMAND ${CMAKE_COMMAND} -E echo $<HOST_LINK>) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-install-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-install-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-install-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-install-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-install-stderr.txt new file mode 100644 index 0000000..c265ec4 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-install-stderr.txt @@ -0,0 +1,7 @@ +CMake Error: + Error evaluating generator expression: + + \$<HOST_LINK:empty> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-install.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-install.cmake new file mode 100644 index 0000000..b4dff68 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-install.cmake @@ -0,0 +1,5 @@ + +install(FILES + $<HOST_LINK:empty> + DESTINATION src +) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-link_depends-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-link_depends-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-link_depends-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-link_depends-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-link_depends-stderr.txt new file mode 100644 index 0000000..24b8b82 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-link_depends-stderr.txt @@ -0,0 +1,7 @@ +CMake Error: + Error evaluating generator expression: + + \$<HOST_LINK:lib> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-link_depends.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-link_depends.cmake new file mode 100644 index 0000000..0402f43 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-link_depends.cmake @@ -0,0 +1,7 @@ + +enable_language(C) + +add_library(lib empty.c) + +add_executable(empty empty.c) +set_property(TARGET empty PROPERTY LINK_DEPENDS $<HOST_LINK:lib>) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_definitions-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_definitions-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_definitions-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_definitions-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_definitions-stderr.txt new file mode 100644 index 0000000..6ab3c14 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_definitions-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at HOST_LINK-target_compile_definitions.cmake:[0-9]+ \(target_compile_definitions\): + Error evaluating generator expression: + + \$<HOST_LINK:DEF> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_definitions.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_definitions.cmake new file mode 100644 index 0000000..f6c130d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_definitions.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_compile_definitions(empty PRIVATE $<HOST_LINK:DEF>) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_options-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_options-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_options-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_options-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_options-stderr.txt new file mode 100644 index 0000000..0f5bbc3 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_options-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at HOST_LINK-target_compile_options.cmake:[0-9]+ \(target_compile_options\): + Error evaluating generator expression: + + \$<HOST_LINK:-OPT> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_options.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_options.cmake new file mode 100644 index 0000000..53afea1 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_options.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_compile_options(empty PRIVATE $<HOST_LINK:-OPT>) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_include_directories-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_include_directories-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_include_directories-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_include_directories-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_include_directories-stderr.txt new file mode 100644 index 0000000..9a2634a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_include_directories-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at HOST_LINK-target_include_directories.cmake:[0-9]+ \(target_include_directories\): + Error evaluating generator expression: + + \$<HOST_LINK:/DIR> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_include_directories.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_include_directories.cmake new file mode 100644 index 0000000..aff1009 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_include_directories.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_include_directories(empty PRIVATE $<HOST_LINK:/DIR>) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_directories-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_directories-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_directories-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_directories-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_directories-stderr.txt new file mode 100644 index 0000000..5225a52 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_directories-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at HOST_LINK-target_link_directories.cmake:[0-9]+ \(target_link_directories\): + Error evaluating generator expression: + + \$<HOST_LINK:/DIR> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_directories.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_directories.cmake new file mode 100644 index 0000000..97488ee --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_directories.cmake @@ -0,0 +1,7 @@ + +enable_language(C) + +add_library(lib empty.c) + +add_executable(empty empty.c) +target_link_directories(empty PRIVATE $<HOST_LINK:/DIR>) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_libraries-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_libraries-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_libraries-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_libraries-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_libraries-stderr.txt new file mode 100644 index 0000000..6c4441f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_libraries-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at HOST_LINK-target_link_libraries.cmake:[0-9]+ \(target_link_libraries\): + Error evaluating generator expression: + + \$<HOST_LINK:lib> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_libraries.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_libraries.cmake new file mode 100644 index 0000000..d74c92d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_libraries.cmake @@ -0,0 +1,7 @@ + +enable_language(C) + +add_library(lib empty.c) + +add_executable(empty empty.c) +target_link_libraries(empty PRIVATE $<HOST_LINK:lib>) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_sources-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_sources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_sources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_sources-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_sources-stderr.txt new file mode 100644 index 0000000..0e25568 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_sources-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at HOST_LINK-target_sources.cmake:[0-9]+ \(target_sources\): + Error evaluating generator expression: + + \$<HOST_LINK:empty.c> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_sources.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_sources.cmake new file mode 100644 index 0000000..ea7bf55 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_sources.cmake @@ -0,0 +1,2 @@ +add_library(empty) +target_sources(empty PRIVATE $<HOST_LINK:empty.c>) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 6550f84..24c3642 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -64,6 +64,36 @@ run_cmake(LINK_LANG_AND_ID-wrong-usage1) run_cmake(LINK_LANG_AND_ID-wrong-usage2) run_cmake(LINK_LANG_AND_ID-wrong-usage3) run_cmake(LINK_LANG_AND_ID-file_generate) +run_cmake(HOST_LINK-add_custom_target) +run_cmake(HOST_LINK-add_custom_command) +run_cmake(HOST_LINK-install) +run_cmake(HOST_LINK-add_executable) +run_cmake(HOST_LINK-add_library) +run_cmake(HOST_LINK-add_test) +run_cmake(HOST_LINK-target_sources) +run_cmake(HOST_LINK-target_compile_definitions) +run_cmake(HOST_LINK-target_compile_options) +run_cmake(HOST_LINK-target_include_directories) +run_cmake(HOST_LINK-target_link_libraries) +run_cmake(HOST_LINK-target_link_directories) +if(RunCMake_GENERATOR MATCHES "(Ninja|Makefile)") + run_cmake(HOST_LINK-link_depends) +endif() +run_cmake(DEVICE_LINK-add_custom_target) +run_cmake(DEVICE_LINK-add_custom_command) +run_cmake(DEVICE_LINK-install) +run_cmake(DEVICE_LINK-add_executable) +run_cmake(DEVICE_LINK-add_library) +run_cmake(DEVICE_LINK-add_test) +run_cmake(DEVICE_LINK-target_sources) +run_cmake(DEVICE_LINK-target_compile_definitions) +run_cmake(DEVICE_LINK-target_compile_options) +run_cmake(DEVICE_LINK-target_include_directories) +run_cmake(DEVICE_LINK-target_link_libraries) +run_cmake(DEVICE_LINK-target_link_directories) +if(RunCMake_GENERATOR MATCHES "(Ninja|Makefile)") + run_cmake(DEVICE_LINK-link_depends) +endif() run_cmake(TARGET_FILE-recursion) run_cmake(OUTPUT_NAME-recursion) run_cmake(TARGET_FILE_PREFIX) diff --git a/Tests/RunCMake/Ninja/ChangeBuildType.cmake b/Tests/RunCMake/Ninja/ChangeBuildType.cmake new file mode 100644 index 0000000..80405a8 --- /dev/null +++ b/Tests/RunCMake/Ninja/ChangeBuildType.cmake @@ -0,0 +1,12 @@ +enable_language(C) + +function(change_build_type_subdir) + set(CMAKE_BUILD_TYPE Release) + add_subdirectory(SubDirPrefix) +endfunction() + +change_build_type_subdir() + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +add_executable(hello hello_sub_greeting.c) +target_link_libraries(hello greeting) diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index a00d830..8f9c263 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -18,6 +18,12 @@ else() message(FATAL_ERROR "'ninja --version' reported:\n${ninja_out}") endif() +if(CMAKE_HOST_WIN32) + run_cmake(SelectCompilerWindows) +else() + run_cmake(SelectCompilerUNIX) +endif() + function(run_NinjaToolMissing) set(RunCMake_MAKE_PROGRAM ninja-tool-missing) run_cmake(NinjaToolMissing) @@ -307,3 +313,12 @@ function (run_PreventConfigureFileDupBuildRule) run_ninja("${RunCMake_TEST_BINARY_DIR}" -w dupbuild=err) endfunction() run_PreventConfigureFileDupBuildRule() + +function (run_ChangeBuildType) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ChangeBuildType-build) + set(RunCMake_TEST_OPTIONS "-DCMAKE_BUILD_TYPE:STRING=Debug") + run_cmake(ChangeBuildType) + unset(RunCMake_TEST_OPTIONS) + run_ninja("${RunCMake_TEST_BINARY_DIR}" -w dupbuild=err) +endfunction() +run_ChangeBuildType() diff --git a/Tests/RunCMake/Ninja/SelectCompiler/1/gcc b/Tests/RunCMake/Ninja/SelectCompiler/1/gcc new file mode 100755 index 0000000..151dfa6 --- /dev/null +++ b/Tests/RunCMake/Ninja/SelectCompiler/1/gcc @@ -0,0 +1,2 @@ +#!/bin/sh +false diff --git a/Tests/RunCMake/Ninja/SelectCompiler/2/cc b/Tests/RunCMake/Ninja/SelectCompiler/2/cc new file mode 100755 index 0000000..151dfa6 --- /dev/null +++ b/Tests/RunCMake/Ninja/SelectCompiler/2/cc @@ -0,0 +1,2 @@ +#!/bin/sh +false diff --git a/Tests/RunCMake/Ninja/SelectCompilerUNIX-result.txt b/Tests/RunCMake/Ninja/SelectCompilerUNIX-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Ninja/SelectCompilerUNIX-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Ninja/SelectCompilerUNIX-stderr.txt b/Tests/RunCMake/Ninja/SelectCompilerUNIX-stderr.txt new file mode 100644 index 0000000..a2baa48 --- /dev/null +++ b/Tests/RunCMake/Ninja/SelectCompilerUNIX-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at .*/Modules/CMakeTestCCompiler.cmake:[0-9]+ \(message\): + The C compiler + + "[^"]*/Tests/RunCMake/Ninja/SelectCompiler/2/cc" + + is not able to compile a simple test program. diff --git a/Tests/RunCMake/Ninja/SelectCompilerUNIX.cmake b/Tests/RunCMake/Ninja/SelectCompilerUNIX.cmake new file mode 100644 index 0000000..02c8439 --- /dev/null +++ b/Tests/RunCMake/Ninja/SelectCompilerUNIX.cmake @@ -0,0 +1,3 @@ +set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}/SelectCompiler/1:${CMAKE_CURRENT_SOURCE_DIR}/SelectCompiler/2:$ENV{PATH}") +unset(ENV{CC}) +enable_language(C) diff --git a/Tests/RunCMake/Ninja/SelectCompilerWindows-result.txt b/Tests/RunCMake/Ninja/SelectCompilerWindows-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Ninja/SelectCompilerWindows-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Ninja/SelectCompilerWindows-stderr.txt b/Tests/RunCMake/Ninja/SelectCompilerWindows-stderr.txt new file mode 100644 index 0000000..e4b506e --- /dev/null +++ b/Tests/RunCMake/Ninja/SelectCompilerWindows-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at .*/Modules/CMakeTestCCompiler.cmake:[0-9]+ \(message\): + The C compiler + + "[^"]*/Tests/RunCMake/Ninja/SelectCompiler/1/gcc" + + is not able to compile a simple test program. diff --git a/Tests/RunCMake/Ninja/SelectCompilerWindows.cmake b/Tests/RunCMake/Ninja/SelectCompilerWindows.cmake new file mode 100644 index 0000000..f5a7e2b --- /dev/null +++ b/Tests/RunCMake/Ninja/SelectCompilerWindows.cmake @@ -0,0 +1,3 @@ +set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}/SelectCompiler/1;${CMAKE_CURRENT_SOURCE_DIR}/SelectCompiler/2;$ENV{PATH}") +unset(ENV{CC}) +enable_language(C) diff --git a/Tests/RunCMake/NinjaMultiConfig/CudaSimple.cmake b/Tests/RunCMake/NinjaMultiConfig/CudaSimple.cmake index 2e9b1cb..00d8a1b 100644 --- a/Tests/RunCMake/NinjaMultiConfig/CudaSimple.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/CudaSimple.cmake @@ -1,3 +1,4 @@ +cmake_policy(SET CMP0104 NEW) enable_language(CUDA) file(TOUCH ${CMAKE_BINARY_DIR}/empty.cmake) diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt index 9a1e027..2d270c5 100644 --- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt +++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt @@ -29,6 +29,8 @@ \* CMP0083 \* CMP0095 \* CMP0099 + \* CMP0104 + \* CMP0105 Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ctest_memcheck/testAddressLeakSanitizer.cmake b/Tests/RunCMake/ctest_memcheck/testAddressLeakSanitizer.cmake index ca36a7c..58c94d7 100644 --- a/Tests/RunCMake/ctest_memcheck/testAddressLeakSanitizer.cmake +++ b/Tests/RunCMake/ctest_memcheck/testAddressLeakSanitizer.cmake @@ -2,7 +2,7 @@ # options message("ASAN_OPTIONS = [$ENV{ASAN_OPTIONS}]") -string(REGEX REPLACE ".*log_path=\'([^\']*)\'.*" "\\1" LOG_FILE "$ENV{ASAN_OPTIONS}") +string(REGEX REPLACE ".*log_path='([^']*)'.*" "\\1" LOG_FILE "$ENV{ASAN_OPTIONS}") message("LOG_FILE=[${LOG_FILE}]") # if we are not asked to simulate AddressSanitizer don't do it diff --git a/Tests/RunCMake/ctest_memcheck/testAddressSanitizer.cmake b/Tests/RunCMake/ctest_memcheck/testAddressSanitizer.cmake index 1219666..8f18cd0 100644 --- a/Tests/RunCMake/ctest_memcheck/testAddressSanitizer.cmake +++ b/Tests/RunCMake/ctest_memcheck/testAddressSanitizer.cmake @@ -2,7 +2,7 @@ # options message("ASAN_OPTIONS = [$ENV{ASAN_OPTIONS}]") -string(REGEX REPLACE ".*log_path=\'([^\']*)\'.*" "\\1" LOG_FILE "$ENV{ASAN_OPTIONS}") +string(REGEX REPLACE ".*log_path='([^']*)'.*" "\\1" LOG_FILE "$ENV{ASAN_OPTIONS}") message("LOG_FILE=[${LOG_FILE}]") # if we are not asked to simulate address sanitizer don't do it diff --git a/Tests/RunCMake/ctest_memcheck/testLeakSanitizer.cmake b/Tests/RunCMake/ctest_memcheck/testLeakSanitizer.cmake index 6d51f83..4990792 100644 --- a/Tests/RunCMake/ctest_memcheck/testLeakSanitizer.cmake +++ b/Tests/RunCMake/ctest_memcheck/testLeakSanitizer.cmake @@ -2,7 +2,7 @@ # options message("LSAN_OPTIONS = [$ENV{LSAN_OPTIONS}]") -string(REGEX REPLACE ".*log_path=\'([^\']*)\'.*" "\\1" LOG_FILE "$ENV{LSAN_OPTIONS}") +string(REGEX REPLACE ".*log_path='([^']*)'.*" "\\1" LOG_FILE "$ENV{LSAN_OPTIONS}") message("LOG_FILE=[${LOG_FILE}]") # if we are not asked to simulate LeakSanitizer don't do it diff --git a/Tests/RunCMake/ctest_memcheck/testMemorySanitizer.cmake b/Tests/RunCMake/ctest_memcheck/testMemorySanitizer.cmake index 3b3ac22..4a6adb1 100644 --- a/Tests/RunCMake/ctest_memcheck/testMemorySanitizer.cmake +++ b/Tests/RunCMake/ctest_memcheck/testMemorySanitizer.cmake @@ -2,7 +2,7 @@ # options message("MSAN_OPTIONS = [$ENV{MSAN_OPTIONS}]") -string(REGEX REPLACE ".*log_path=\'([^\']*)\'.*" "\\1" LOG_FILE "$ENV{MSAN_OPTIONS}") +string(REGEX REPLACE ".*log_path='([^']*)'.*" "\\1" LOG_FILE "$ENV{MSAN_OPTIONS}") message("LOG_FILE=[${LOG_FILE}]") # if we are not asked to simulate address sanitizer don't do it diff --git a/Tests/RunCMake/ctest_memcheck/testThreadSanitizer.cmake b/Tests/RunCMake/ctest_memcheck/testThreadSanitizer.cmake index e7a5c9f..96251c3 100644 --- a/Tests/RunCMake/ctest_memcheck/testThreadSanitizer.cmake +++ b/Tests/RunCMake/ctest_memcheck/testThreadSanitizer.cmake @@ -2,7 +2,7 @@ # options message("TSAN_OPTIONS = [$ENV{TSAN_OPTIONS}]") -string(REGEX REPLACE ".*log_path=\'([^\']*)\'.*" "\\1" LOG_FILE "$ENV{TSAN_OPTIONS}") +string(REGEX REPLACE ".*log_path='([^']*)'.*" "\\1" LOG_FILE "$ENV{TSAN_OPTIONS}") message("LOG_FILE=[${LOG_FILE}]") set(error_types diff --git a/Tests/RunCMake/ctest_memcheck/testUndefinedBehaviorSanitizer.cmake b/Tests/RunCMake/ctest_memcheck/testUndefinedBehaviorSanitizer.cmake index ba6122d..7160280 100644 --- a/Tests/RunCMake/ctest_memcheck/testUndefinedBehaviorSanitizer.cmake +++ b/Tests/RunCMake/ctest_memcheck/testUndefinedBehaviorSanitizer.cmake @@ -2,7 +2,7 @@ # UndefinedBehaviorSanitizer options message("UBSAN_OPTIONS = [$ENV{UBSAN_OPTIONS}]") -string(REGEX REPLACE ".*log_path=\'([^\']*)\'.*" "\\1" LOG_FILE "$ENV{UBSAN_OPTIONS}") +string(REGEX REPLACE ".*log_path='([^']*)'.*" "\\1" LOG_FILE "$ENV{UBSAN_OPTIONS}") message("LOG_FILE=[${LOG_FILE}]") # if we are not asked to simulate address sanitizer don't do it diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake index 84d1d66..34d4020 100644 --- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake @@ -95,3 +95,15 @@ endfunction() run_TestRepeat(UntilFail REPEAT UNTIL_FAIL:3) run_TestRepeat(UntilPass REPEAT UNTIL_PASS:3) run_TestRepeat(AfterTimeout REPEAT AFTER_TIMEOUT:3) + +# test --stop-on-failure +function(run_stop_on_failure) + set(CASE_CTEST_TEST_ARGS EXCLUDE RunCMakeVersion) + set(CASE_CMAKELISTS_SUFFIX_CODE [[ +add_test(NAME StoppingTest COMMAND ${CMAKE_COMMAND} -E false) +add_test(NAME NotRunTest COMMAND ${CMAKE_COMMAND} -E true) + ]]) + + run_ctest_test(stop-on-failure STOP_ON_FAILURE) +endfunction() +run_stop_on_failure() diff --git a/Tests/RunCMake/ctest_test/stop-on-failure-stdout.txt b/Tests/RunCMake/ctest_test/stop-on-failure-stdout.txt new file mode 100644 index 0000000..fa4bce0 --- /dev/null +++ b/Tests/RunCMake/ctest_test/stop-on-failure-stdout.txt @@ -0,0 +1,13 @@ +Test project [^ +]*/Tests/RunCMake/ctest_test/stop-on-failure-build + Start 1: RunCMakeVersion +1/3 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec + Start 2: StoppingTest +2/3 Test #2: StoppingTest .....................\*\*\*Failed +[0-9.]+ sec ++ +50% tests passed, 1 tests failed out of 2 ++ +Total Test time \(real\) = +[0-9.]+ sec ++ +The following tests FAILED: +[ ]+2 - StoppingTest \(Failed\)$ diff --git a/Tests/RunCMake/export/Repeat-CMP0103-WARN-stderr.txt b/Tests/RunCMake/export/Repeat-CMP0103-WARN-stderr.txt index 3104df4..28e849d 100644 --- a/Tests/RunCMake/export/Repeat-CMP0103-WARN-stderr.txt +++ b/Tests/RunCMake/export/Repeat-CMP0103-WARN-stderr.txt @@ -1,5 +1,5 @@ CMake Warning \(dev\) at Repeat.cmake:[0-9]+ \(export\): - Policy CMP0103 is not set: multiple export\(\) with same FILE without APPEND + Policy CMP0103 is not set: Multiple export\(\) with same FILE without APPEND is not allowed. Run "cmake --help-policy CMP0103" for policy details. Use the cmake_policy command to set the policy and suppress this warning. @@ -14,7 +14,7 @@ Call Stack \(most recent call first\): This warning is for project developers. Use -Wno-dev to suppress it. CMake Warning \(dev\) at Repeat/CMakeLists.txt:[0-9]+ \(export\): - Policy CMP0103 is not set: multiple export\(\) with same FILE without APPEND + Policy CMP0103 is not set: Multiple export\(\) with same FILE without APPEND is not allowed. Run "cmake --help-policy CMP0103" for policy details. Use the cmake_policy command to set the policy and suppress this warning. diff --git a/Tests/RunCMake/target_link_options/LinkOptionsDevice.cu b/Tests/RunCMake/target_link_options/LinkOptionsDevice.cu new file mode 100644 index 0000000..96504e1 --- /dev/null +++ b/Tests/RunCMake/target_link_options/LinkOptionsDevice.cu @@ -0,0 +1,14 @@ +#include <cuda.h> + +#ifdef _WIN32 +__declspec(dllexport) +#endif + int simplelib() +{ + return 0; +} + +int main(void) +{ + return simplelib(); +} diff --git a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake index 9fdcdee..b919f48 100644 --- a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake @@ -13,8 +13,9 @@ endmacro() if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") # Intel compiler does not reject bad flags or objects! set(RunCMake_TEST_OUTPUT_MERGE TRUE) + set(RunCMake_TEST_OPTIONS -DCMake_TEST_CUDA=${CMake_TEST_CUDA}) if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) - set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release) + list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release) endif() run_cmake(LINK_OPTIONS) @@ -44,6 +45,18 @@ if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") run_cmake_target(genex_LINK_LANG_AND_ID mod LinkOptions_mod --config Release) run_cmake_target(genex_LINK_LANG_AND_ID exe LinkOptions_exe --config Release) + run_cmake(genex_DEVICE_LINK) + + run_cmake_target(genex_DEVICE_LINK interface LinkOptions_shared_interface --config Release) + run_cmake_target(genex_DEVICE_LINK private LinkOptions_private --config Release) + if (CMake_TEST_CUDA) + run_cmake_target(genex_DEVICE_LINK CMP0105_UNSET LinkOptions_CMP0105_UNSET --config Release) + run_cmake_target(genex_DEVICE_LINK CMP0105_OLD LinkOptions_CMP0105_OLD --config Release) + run_cmake_target(genex_DEVICE_LINK CMP0105_NEW LinkOptions_CMP0105_NEW --config Release) + run_cmake_target(genex_DEVICE_LINK device LinkOptions_device --config Release) + run_cmake_target(genex_DEVICE_LINK no_device LinkOptions_no_device --config Release) + endif() + unset(RunCMake_TEST_OPTIONS) unset(RunCMake_TEST_OUTPUT_MERGE) endif() diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-CMP0105_NEW-check.cmake b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-CMP0105_NEW-check.cmake new file mode 100644 index 0000000..20c4fab --- /dev/null +++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-CMP0105_NEW-check.cmake @@ -0,0 +1,4 @@ + +if (NOT actual_stdout MATCHES "BADFLAG_DEVICE_LINK") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_DEVICE_LINK'.") +endif() diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-CMP0105_NEW-result.txt b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-CMP0105_NEW-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-CMP0105_NEW-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-device-check.cmake b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-device-check.cmake new file mode 100644 index 0000000..23c3b46 --- /dev/null +++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-device-check.cmake @@ -0,0 +1,3 @@ +set (DEVICE_LINK TRUE) + +include ("${CMAKE_CURRENT_LIST_DIR}/genex_DEVICE_LINK-validation.cmake") diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-device-result.txt b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-device-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-device-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-interface-check.cmake b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-interface-check.cmake new file mode 100644 index 0000000..8431e22 --- /dev/null +++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-interface-check.cmake @@ -0,0 +1,3 @@ +set (DEVICE_LINK FALSE) + +include ("${CMAKE_CURRENT_LIST_DIR}/genex_DEVICE_LINK-validation.cmake") diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-interface-result.txt b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-interface-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-interface-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-no_device-check.cmake b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-no_device-check.cmake new file mode 100644 index 0000000..8431e22 --- /dev/null +++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-no_device-check.cmake @@ -0,0 +1,3 @@ +set (DEVICE_LINK FALSE) + +include ("${CMAKE_CURRENT_LIST_DIR}/genex_DEVICE_LINK-validation.cmake") diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-no_device-result.txt b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-no_device-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-no_device-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-private-check.cmake b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-private-check.cmake new file mode 100644 index 0000000..8431e22 --- /dev/null +++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-private-check.cmake @@ -0,0 +1,3 @@ +set (DEVICE_LINK FALSE) + +include ("${CMAKE_CURRENT_LIST_DIR}/genex_DEVICE_LINK-validation.cmake") diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-private-result.txt b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-private-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-private-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-validation.cmake b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-validation.cmake new file mode 100644 index 0000000..28f5d01 --- /dev/null +++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-validation.cmake @@ -0,0 +1,22 @@ + +if (NOT DEFINED DEVICE_LINK) + set (DEVICE_LINK FALSE) +endif() + +if (DEVICE_LINK) + set (VALID_ID DEVICE_LINK) + set (INVALID_ID NORMAL_LINK) +else() + set (VALID_ID NORMAL_LINK) + set (INVALID_ID DEVICE_LINK) +endif() + +if (NOT actual_stdout MATCHES "BADFLAG_${VALID_ID}") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_${VALID_ID}'.") +endif() +if (actual_stdout MATCHES "BADFLAG_${INVALID_ID}") + if (RunCMake_TEST_FAILED) + string (APPEND RunCMake_TEST_FAILED "\n") + endif() + string (APPEND RunCMake_TEST_FAILED "Found unexpected 'BADFLAG_${INVALID_ID}'.") +endif() diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK.cmake b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK.cmake new file mode 100644 index 0000000..4d0c02f --- /dev/null +++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK.cmake @@ -0,0 +1,48 @@ + +enable_language(C) + +set (obj "${CMAKE_C_OUTPUT_EXTENSION}") +if(BORLAND) + set(pre -) +endif() + +add_library(LinkOptions_interface INTERFACE) +target_link_options (LinkOptions_interface INTERFACE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}> + $<HOST_LINK:${pre}BADFLAG_NORMAL_LINK${obj}>) + +add_library(LinkOptions_shared_interface SHARED LinkOptionsLib.c) +target_link_libraries (LinkOptions_shared_interface PRIVATE LinkOptions_interface) + + +add_library(LinkOptions_private SHARED LinkOptionsLib.c) +target_link_options (LinkOptions_private PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}> + $<HOST_LINK:${pre}BADFLAG_NORMAL_LINK${obj}>) + +if (CMake_TEST_CUDA) + enable_language(CUDA) + + add_executable(LinkOptions_CMP0105_UNSET LinkOptionsDevice.cu) + set_property(TARGET LinkOptions_CMP0105_UNSET PROPERTY CUDA_SEPARABLE_COMPILATION ON) + target_link_options(LinkOptions_CMP0105_UNSET PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>) + + cmake_policy(SET CMP0105 OLD) + + add_executable(LinkOptions_CMP0105_OLD LinkOptionsDevice.cu) + set_property(TARGET LinkOptions_CMP0105_OLD PROPERTY CUDA_SEPARABLE_COMPILATION ON) + target_link_options(LinkOptions_CMP0105_OLD PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>) + + cmake_policy(SET CMP0105 NEW) + + add_executable(LinkOptions_CMP0105_NEW LinkOptionsDevice.cu) + set_property(TARGET LinkOptions_CMP0105_NEW PROPERTY CUDA_SEPARABLE_COMPILATION ON) + target_link_options(LinkOptions_CMP0105_NEW PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>) + + add_executable(LinkOptions_device LinkOptionsDevice.cu) + set_property(TARGET LinkOptions_device PROPERTY CUDA_SEPARABLE_COMPILATION ON) + target_link_options(LinkOptions_device PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}> + $<HOST_LINK:${pre}BADFLAG_NORMAL_LINK${obj}>) + + add_executable(LinkOptions_no_device LinkOptionsDevice.cu) + target_link_options(LinkOptions_no_device PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}> + $<HOST_LINK:${pre}BADFLAG_NORMAL_LINK${obj}>) +endif() diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt index 9ec9b70..df921d8 100644 --- a/Tests/TryCompile/CMakeLists.txt +++ b/Tests/TryCompile/CMakeLists.txt @@ -187,7 +187,7 @@ try_compile(SHOULD_FAIL_DUE_TO_BAD_SOURCE if(SHOULD_FAIL_DUE_TO_BAD_SOURCE AND NOT CMAKE_GENERATOR MATCHES "Watcom WMake|NMake Makefiles") string(REPLACE "\n" "\n " output " ${output}") message(SEND_ERROR "try_compile with bad#source.c did not fail:\n${output}") -elseif(NOT output MATCHES [[(bad#source\.c|bad\\)]]) +elseif(NOT output MATCHES [[(bad#source\.c|bad\.c|bad')]]) string(REPLACE "\n" "\n " output " ${output}") message(SEND_ERROR "try_compile with bad#source.c failed without mentioning bad source:\n${output}") else() diff --git a/Utilities/GitSetup/setup-user b/Utilities/GitSetup/setup-user index 0b98879..4cbd184 100755 --- a/Utilities/GitSetup/setup-user +++ b/Utilities/GitSetup/setup-user @@ -20,7 +20,14 @@ # Project configuration instructions: NONE for (( ; ; )); do - ident="$(git var GIT_AUTHOR_IDENT 2>/dev/null | rev | cut -d' ' -f3- | rev)" + if type -p rev >/dev/null && type -p cut >/dev/null; then + ident="$(git var GIT_AUTHOR_IDENT 2>/dev/null | rev | cut -d' ' -f3- | rev)" + elif user_name=$(git config --get user.name) && + user_email=$(git config --get user.email); then + ident="$user_name <$user_email>" + else + ident="" + fi if test -n "$ident"; then echo 'Your commits will record as Author: diff --git a/Utilities/KWIML/CMakeLists.txt b/Utilities/KWIML/CMakeLists.txt index 15e65e5..1d15884 100644 --- a/Utilities/KWIML/CMakeLists.txt +++ b/Utilities/KWIML/CMakeLists.txt @@ -17,7 +17,6 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") endif() set(KWIML_INCLUDE_PREFIX kwiml) else() - cmake_minimum_required(VERSION 2.8.2 FATAL_ERROR) set(kwiml_standalone 0) if(KWIML_INSTALL_INCLUDE_DIR AND NOT DEFINED KWIML_INCLUDE_PREFIX) message(FATAL_ERROR "Host project must set KWIML_INCLUDE_PREFIX") diff --git a/Utilities/KWIML/include/kwiml/abi.h b/Utilities/KWIML/include/kwiml/abi.h index da525fd..1112cb0 100644 --- a/Utilities/KWIML/include/kwiml/abi.h +++ b/Utilities/KWIML/include/kwiml/abi.h @@ -136,6 +136,8 @@ suppression macro KWIML_ABI_NO_VERIFY was defined. # define KWIML_ABI_SIZEOF_DATA_PTR 8 # elif defined(__i386) || defined(__i386__) # define KWIML_ABI_SIZEOF_DATA_PTR 4 +# elif defined(_M_ARM64) +# define KWIML_ABI_SIZEOF_DATA_PTR 8 # endif #endif #if !defined(KWIML_ABI_SIZEOF_DATA_PTR) @@ -461,6 +463,10 @@ suppression macro KWIML_ABI_NO_VERIFY was defined. # define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG # endif +/* Aarch64 (Windows) */ +#elif defined(_M_ARM64) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE + /* Xtensa */ #elif defined(__XTENSA_EB__) # define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG diff --git a/Utilities/Scripts/BoostScanDeps.cmake b/Utilities/Scripts/BoostScanDeps.cmake index 28a94ce..5794d03 100644 --- a/Utilities/Scripts/BoostScanDeps.cmake +++ b/Utilities/Scripts/BoostScanDeps.cmake @@ -134,11 +134,17 @@ function(_Boost_FIND_COMPONENT_DEPENDENCIES component includedir _ret_libs) continue() endif() if(component STREQUAL "python" AND - boost_component_match STREQUAL "numpy") + _boost_component_match STREQUAL "numpy") # Optional python dependency; skip to avoid making it a # hard dependency (handle as special-case for numpy). continue() endif() + if(component STREQUAL "nowide" AND + _boost_component_match STREQUAL "filesystem") + # Optional filesystem dependency; skip to avoid making it a + # hard dependency. + continue() + endif() if (_boost_dep_found EQUAL -1 AND NOT "${_boost_component_match}" STREQUAL "${component}") list(APPEND _boost_DEPS "${_boost_component_match}") diff --git a/Utilities/std/cmext/algorithm b/Utilities/std/cmext/algorithm index 44e61f4..251c89a 100644 --- a/Utilities/std/cmext/algorithm +++ b/Utilities/std/cmext/algorithm @@ -13,12 +13,11 @@ #include <cm/type_traits> #include <cmext/iterator> +#include <cmext/type_traits> #if defined(__SUNPRO_CC) && defined(__sparc) # include <list> # include <vector> -#else -# include <cmext/type_traits> #endif namespace cm { @@ -158,6 +157,95 @@ void append(T& v, U const& r) # endif #endif +#if defined(__SUNPRO_CC) +template <typename Iterator, typename Key> +auto contains(Iterator first, Iterator last, Key const& key, + detail::overload_selector<1>) -> decltype(first->first == key) +#else +template <typename Iterator, typename Key, + cm::enable_if_t< + cm::is_input_iterator<Iterator>::value && + std::is_convertible<Key, + typename std::iterator_traits< + Iterator>::value_type::first_type>::value, + int> = 0> +bool contains(Iterator first, Iterator last, Key const& key) +#endif +{ + return std::find_if( + first, last, + [&key]( + typename std::iterator_traits<Iterator>::value_type const& item) { + return item.first == key; + }) != last; +} + +#if defined(__SUNPRO_CC) +template <typename Iterator, typename Key> +bool contains(Iterator first, Iterator last, Key const& key, + detail::overload_selector<0>) +#else +template < + typename Iterator, typename Key, + cm::enable_if_t< + cm::is_input_iterator<Iterator>::value && + std::is_convertible< + Key, typename std::iterator_traits<Iterator>::value_type>::value, + int> = 0> +bool contains(Iterator first, Iterator last, Key const& key) +#endif +{ + return std::find(first, last, key) != last; +} + +#if defined(__SUNPRO_CC) +template <typename Iterator, typename Key> +bool contains(Iterator first, Iterator last, Key const& key) +{ + return contains(first, last, key, detail::overload_selector<1>{}); +} +#endif + +#if defined(__SUNPRO_CC) +template <typename Range, typename Key> +auto contains(Range const& range, Key const& key, detail::overload_selector<1>) + -> decltype(range.find(key) != range.end()) +#else +template < + typename Range, typename Key, + cm::enable_if_t<cm::is_associative_container<Range>::value || + cm::is_unordered_associative_container<Range>::value, + int> = 0> +bool contains(Range const& range, Key const& key) +#endif +{ + return range.find(key) != range.end(); +} + +#if defined(__SUNPRO_CC) +template <typename Range, typename Key> +bool contains(Range const& range, Key const& key, detail::overload_selector<0>) +#else +template < + typename Range, typename Key, + cm::enable_if_t<cm::is_input_range<Range>::value && + !(cm::is_associative_container<Range>::value || + cm::is_unordered_associative_container<Range>::value), + int> = 0> +bool contains(Range const& range, Key const& key) +#endif +{ + return std::find(std::begin(range), std::end(range), key) != std::end(range); +} + +#if defined(__SUNPRO_CC) +template <typename Range, typename Key> +bool contains(Range const& range, Key const& key) +{ + return contains(range, key, detail::overload_selector<1>{}); +} +#endif + } // namespace cm #endif diff --git a/Utilities/std/cmext/iterator b/Utilities/std/cmext/iterator index ffe94b1..ce9462f 100644 --- a/Utilities/std/cmext/iterator +++ b/Utilities/std/cmext/iterator @@ -23,25 +23,27 @@ using is_input_iterator = std::is_base_of<std::input_iterator_tag, typename std::iterator_traits<I>::iterator_category>; -// checks if a type is a range type: must have a difference_type type +// checks if a type is a range type: std::begin() and std::end() are supported template <typename Range> using is_range = cm::bool_constant< - cm::is_iterator<decltype(std::declval<const Range>().begin())>::value && - cm::is_iterator<decltype(std::declval<const Range>().end())>::value>; + cm::is_iterator<decltype(std::begin(std::declval<const Range>()))>::value && + cm::is_iterator<decltype(std::end(std::declval<const Range>()))>::value>; -// checks if a type is an input range type: must have methods begin() and end() +// checks if a type is an input range type: std::begin() and std::end() are // returning an input iterator template <typename Range> using is_input_range = #if defined(_MSC_VER) && _MSC_VER < 1920 // MS C++ is not able to evaluate complex type introspection, // so use a simplified version - cm::is_input_iterator<typename Range::const_iterator>; + cm::bool_constant<std::is_class<Range>::value || + std::is_pointer<Range>::value || + std::is_array<Range>::value>; #else - cm::bool_constant< - cm::is_input_iterator<decltype( - std::declval<const Range>().begin())>::value && - cm::is_input_iterator<decltype(std::declval<const Range>().end())>::value>; + cm::bool_constant<cm::is_input_iterator<decltype( + std::begin(std::declval<const Range>()))>::value && + cm::is_input_iterator<decltype( + std::end(std::declval<const Range>()))>::value>; #endif } // namespace cm diff --git a/Utilities/std/cmext/type_traits b/Utilities/std/cmext/type_traits index 00984cb..f02b488 100644 --- a/Utilities/std/cmext/type_traits +++ b/Utilities/std/cmext/type_traits @@ -6,6 +6,8 @@ #ifndef cmext_type_traits #define cmext_type_traits +#include <memory> + #include <cm/type_traits> namespace cm { |