diff options
46 files changed, 513 insertions, 98 deletions
diff --git a/.gitlab/ci/ninja.ps1 b/.gitlab/ci/ninja.ps1 index 91f8b02..4cc6bcb 100755 --- a/.gitlab/ci/ninja.ps1 +++ b/.gitlab/ci/ninja.ps1 @@ -1,7 +1,7 @@ $erroractionpreference = "stop" -$version = "1.10.0" -$sha256sum = "919FD158C16BF135E8A850BB4046EC1CE28A7439EE08B977CD0B7F6B3463D178" +$version = "1.10.2" +$sha256sum = "BBDE850D247D2737C5764C927D1071CBB1F1957DCABDA4A130FA8547C12C695F" $filename = "ninja-win" $tarball = "$filename.zip" diff --git a/.gitlab/ci/ninja.sh b/.gitlab/ci/ninja.sh index 93c1ee9..9011bbc 100755 --- a/.gitlab/ci/ninja.sh +++ b/.gitlab/ci/ninja.sh @@ -2,17 +2,17 @@ set -e -readonly version="1.10.0" +readonly version="1.10.2" case "$( uname -s )" in Linux) shatool="sha256sum" - sha256sum="6566836ddf3d72ca06685b34814e0c6fa0f0943542d651d0dab3150f10307c82" + sha256sum="763464859c7ef2ea3a0a10f4df40d2025d3bb9438fcb1228404640410c0ec22d" platform="linux" ;; Darwin) shatool="shasum -a 256" - sha256sum="2ee405c0e205d55666c60cc9c0d8d04c8ede06d3ef2e2c2aabe08fd81c17d22e" + sha256sum="6fa359f491fac7e5185273c6421a000eea6a2f0febf0ac03ac900bd4d80ed2a5" platform="mac" ;; *) diff --git a/Help/command/target_compile_definitions.rst b/Help/command/target_compile_definitions.rst index 09e2ded..3fb113a 100644 --- a/Help/command/target_compile_definitions.rst +++ b/Help/command/target_compile_definitions.rst @@ -39,3 +39,12 @@ For example, the following are all equivalent: target_compile_definitions(foo PUBLIC -DFOO) # -D removed target_compile_definitions(foo PUBLIC "" FOO) # "" ignored target_compile_definitions(foo PUBLIC -D FOO) # -D becomes "", then ignored + +Definitions may optionally have values: + +.. code-block:: cmake + + target_compile_definitions(foo PUBLIC FOO=1) + +Note that many compilers treat ``-DFOO`` as equivalent to ``-DFOO=1``, but +other tools may not recognize this in all circumstances (e.g. IntelliSense). diff --git a/Help/envvar/CUDAARCHS.rst b/Help/envvar/CUDAARCHS.rst new file mode 100644 index 0000000..82369cd --- /dev/null +++ b/Help/envvar/CUDAARCHS.rst @@ -0,0 +1,13 @@ +CUDAARCHS +--------- + +.. versionadded:: 3.20 + +.. include:: ENV_VAR.txt + +Value used to initialize :variable:`CMAKE_CUDA_ARCHITECTURES` on the first +configuration if it's not already defined. Subsequent runs will use the value +stored in the cache. + +This is a semicolon-separated list of architectures as described in +:prop_tgt:`CUDA_ARCHITECTURES`. diff --git a/Help/manual/cmake-env-variables.7.rst b/Help/manual/cmake-env-variables.7.rst index 13e0d39..26e0c48 100644 --- a/Help/manual/cmake-env-variables.7.rst +++ b/Help/manual/cmake-env-variables.7.rst @@ -56,6 +56,7 @@ Environment Variables for Languages /envvar/CC /envvar/CFLAGS /envvar/CSFLAGS + /envvar/CUDAARCHS /envvar/CUDACXX /envvar/CUDAFLAGS /envvar/CUDAHOSTCXX diff --git a/Help/release/dev/cuda-archs-env.rst b/Help/release/dev/cuda-archs-env.rst new file mode 100644 index 0000000..a2afcbe --- /dev/null +++ b/Help/release/dev/cuda-archs-env.rst @@ -0,0 +1,6 @@ +cuda-archs-env +-------------- + +* The :envvar:`CUDAARCHS` environment variable was added for initializing + :variable:`CMAKE_CUDA_ARCHITECTURES`. Useful in cases where the compiler + default is unsuitable for the machine's GPU. diff --git a/Help/variable/CMAKE_CUDA_ARCHITECTURES.rst b/Help/variable/CMAKE_CUDA_ARCHITECTURES.rst index 985040d..7f7e679 100644 --- a/Help/variable/CMAKE_CUDA_ARCHITECTURES.rst +++ b/Help/variable/CMAKE_CUDA_ARCHITECTURES.rst @@ -5,7 +5,8 @@ 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>`: +Initialized by the :envvar:`CUDAARCHS` environment variable if set. +Otherwise as follows depending on :variable:`CMAKE_CUDA_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>`: - For ``Clang``: the oldest architecture that works. diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index 2f6bdb4..8ba6abc 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -26,7 +26,7 @@ char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; char const* qnxnto = "INFO" ":" "qnxnto[]"; #endif -#if defined(__CRAYXE) || defined(__CRAYXC) +#if defined(_CRAYC) || defined(__cray__) char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; #endif @@ -77,7 +77,7 @@ int main(int argc, char* argv[]) #ifdef SIMULATE_VERSION_MAJOR require += info_simulate_version[argc]; #endif -#if defined(__CRAYXE) || defined(__CRAYXC) +#if defined(_CRAYC) || defined(__cray__) require += info_cray[argc]; #endif require += info_language_dialect_default[argc]; diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index a743ce7..672fff8 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -20,7 +20,7 @@ char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; char const* qnxnto = "INFO" ":" "qnxnto[]"; #endif -#if defined(__CRAYXE) || defined(__CRAYXC) +#if defined(_CRAYC) || defined(__cray__) char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; #endif @@ -76,7 +76,7 @@ int main(int argc, char* argv[]) #ifdef SIMULATE_VERSION_MAJOR require += info_simulate_version[argc]; #endif -#if defined(__CRAYXE) || defined(__CRAYXC) +#if defined(_CRAYC) || defined(__cray__) require += info_cray[argc]; #endif require += info_language_dialect_default[argc]; diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake index 972adef..578729c 100644 --- a/Modules/CMakeDetermineCUDACompiler.cmake +++ b/Modules/CMakeDetermineCUDACompiler.cmake @@ -47,6 +47,10 @@ if(NOT $ENV{CUDAHOSTCXX} STREQUAL "") endif() endif() +if(NOT "$ENV{CUDAARCHS}" STREQUAL "") + set(CMAKE_CUDA_ARCHITECTURES "$ENV{CUDAARCHS}" CACHE STRING "CUDA architectures") +endif() + # Build a small source file to identify the compiler. if(NOT CMAKE_CUDA_COMPILER_ID_RUN) set(CMAKE_CUDA_COMPILER_ID_RUN 1) diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 30f8d4c..7e8828b 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -108,7 +108,7 @@ #else PRINT *, 'INFO:compiler[]' #endif -#if defined(__CRAYXE) || defined(__CRAYXC) +#if defined(_CRAYFTN) PRINT *, 'INFO:compiler_wrapper[CrayPrgEnv]' #endif diff --git a/Modules/Compiler/TI-C.cmake b/Modules/Compiler/TI-C.cmake index 3c97afb..bd88989 100644 --- a/Modules/Compiler/TI-C.cmake +++ b/Modules/Compiler/TI-C.cmake @@ -26,7 +26,7 @@ else() endif() -if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_C99_VERSION_${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}}") +if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_C99_VERSION_${CMAKE_C_COMPILER_ARCHITECTURE_ID}}") set(CMAKE_C90_STANDARD_COMPILE_OPTION "--c89" "--strict_ansi") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "--c89" "--relaxed_ansi") @@ -34,8 +34,8 @@ if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_C99_VERSION_$ set(CMAKE_C99_STANDARD_COMPILE_OPTION "--c99" "--strict_ansi") set(CMAKE_C99_EXTENSION_COMPILE_OPTION "--c99" "--relaxed_ansi") - if(DEFINED __COMPILER_TI_C11_VERSION_${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} AND - CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_C11_VERSION_${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}}") + if(DEFINED __COMPILER_TI_C11_VERSION_${CMAKE_C_COMPILER_ARCHITECTURE_ID} AND + CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_C11_VERSION_${CMAKE_C_COMPILER_ARCHITECTURE_ID}}") set(CMAKE_C11_STANDARD_COMPILE_OPTION "--c11" "--strict_ansi") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "--c11" "--relaxed_ansi") diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index 0a92c71..0c1e93b 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -1026,7 +1026,7 @@ if (HDF5_FOUND) # Error if we still don't have the location. message(SEND_ERROR "HDF5 was found, but a different variable was set which contains " - "its location.") + "the location of the `hdf5::${hdf5_target_name}` library.") endif () add_library("hdf5::${hdf5_target_name}" UNKNOWN IMPORTED) string(REPLACE "-D" "" _hdf5_definitions "${HDF5_${hdf5_lang}_DEFINITIONS}") @@ -1057,12 +1057,14 @@ if (HDF5_FOUND) continue () endif () + set(hdf5_alt_target_name "") if (hdf5_lang STREQUAL "C") set(hdf5_target_name "hdf5_hl") elseif (hdf5_lang STREQUAL "CXX") set(hdf5_target_name "hdf5_hl_cpp") elseif (hdf5_lang STREQUAL "Fortran") set(hdf5_target_name "hdf5_hl_fortran") + set(hdf5_alt_target_name "hdf5hl_fortran") else () continue () endif () @@ -1081,11 +1083,13 @@ if (HDF5_FOUND) set(_hdf5_location "${HDF5_${hdf5_lang}_HL_LIBRARY}") elseif (DEFINED "HDF5_${hdf5_lang}_LIBRARY_${hdf5_target_name}") set(_hdf5_location "${HDF5_${hdf5_lang}_LIBRARY_${hdf5_target_name}}") + elseif (hdf5_alt_target_name AND DEFINED "HDF5_${hdf5_lang}_LIBRARY_${hdf5_alt_target_name}") + set(_hdf5_location "${HDF5_${hdf5_lang}_LIBRARY_${hdf5_alt_target_name}}") else () # Error if we still don't have the location. message(SEND_ERROR "HDF5 was found, but a different variable was set which contains " - "its location.") + "the location of the `hdf5::${hdf5_target_name}` library.") endif () add_library("hdf5::${hdf5_target_name}" UNKNOWN IMPORTED) string(REPLACE "-D" "" _hdf5_definitions "${HDF5_${hdf5_lang}_HL_DEFINITIONS}") diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake index e842e6b..b8b32c0 100644 --- a/Modules/FindPython.cmake +++ b/Modules/FindPython.cmake @@ -10,25 +10,32 @@ FindPython Find Python interpreter, compiler and development environment (include directories and libraries). -When a version is requested, it can be specified as a simple value or as a -range. For a detailed description of version range usage and capabilities, -refer to the :command:`find_package` command. +.. versionadded:: 3.19 + When a version is requested, it can be specified as a simple value or as a + range. For a detailed description of version range usage and capabilities, + refer to the :command:`find_package` command. 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). This component includes two sub-components which can be specified - independently: + libraries). - * ``Development.Module``: search for artifacts for Python module - developments. - * ``Development.Embed``: search for artifacts for Python embedding - developments. + .. versionadded:: 3.18 + 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. +.. versionadded:: 3.14 + Added ``NumPy`` component. + If no ``COMPONENTS`` are specified, ``Interpreter`` is assumed. If component ``Development`` is specified, it implies sub-components @@ -56,20 +63,30 @@ To manage concurrent versions 3 and 2 of Python, use :module:`FindPython3` and Imported Targets ^^^^^^^^^^^^^^^^ -This module defines the following :ref:`Imported Targets <Imported Targets>` -(when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``): +This module defines the following :ref:`Imported Targets <Imported Targets>`: + +.. versionchanged:: 3.14 + :ref:`Imported Targets <Imported Targets>` are only created when + :prop_gbl:`CMAKE_ROLE` is ``PROJECT``. ``Python::Interpreter`` Python interpreter. Target defined if component ``Interpreter`` is found. ``Python::Compiler`` Python compiler. Target defined if component ``Compiler`` is found. + ``Python::Module`` + .. versionadded:: 3.15 + 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.Embed`` is found. + ``Python::NumPy`` + .. versionadded:: 3.14 + NumPy Python library. Target defined if component ``NumPy`` is found. Result Variables @@ -116,7 +133,10 @@ This module will set the following variables in your project Information returned by ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)`` or else ``sysconfig.get_path('platlib')``. + ``Python_SOABI`` + .. versionadded:: 3.17 + Extension suffix for modules. Information returned by @@ -125,6 +145,7 @@ This module will set the following variables in your project ``python-config --extension-suffix``. If package ``distutils.sysconfig`` is not available, ``sysconfig.get_config_var('SOABI')`` or ``sysconfig.get_config_var('EXT_SUFFIX')`` are used. + ``Python_Compiler_FOUND`` System has the Python compiler. ``Python_COMPILER`` @@ -132,19 +153,35 @@ This module will set the following variables in your project ``Python_COMPILER_ID`` A short string unique to the compiler. Possible values include: * IronPython + ``Python_DOTNET_LAUNCHER`` + .. versionadded:: 3.18 + The ``.Net`` interpreter. Only used by ``IronPython`` implementation. + ``Python_Development_FOUND`` System has the Python development artifacts. + ``Python_Development.Module_FOUND`` + .. versionadded:: 3.18 + System has the Python development artifacts for Python module. + ``Python_Development.Embed_FOUND`` + .. versionadded:: 3.18 + System has the Python development artifacts for Python embedding. + ``Python_INCLUDE_DIRS`` + The Python include directories. + ``Python_LINK_OPTIONS`` + .. versionadded:: 3.19 + The Python link options. Some configurations require specific link options for a correct build and execution. + ``Python_LIBRARIES`` The Python libraries. ``Python_LIBRARY_DIRS`` @@ -159,13 +196,25 @@ This module will set the following variables in your project Python minor version. ``Python_VERSION_PATCH`` Python patch version. + ``Python_PyPy_VERSION`` + .. versionadded:: 3.18 + Python PyPy version. + ``Python_NumPy_FOUND`` + .. versionadded:: 3.14 + System has the NumPy. + ``Python_NumPy_INCLUDE_DIRS`` + .. versionadded:: 3.14 + The NumPy include directories. + ``Python_NumPy_VERSION`` + .. versionadded:: 3.14 + The NumPy version. Hints @@ -181,6 +230,8 @@ Hints * If set to FALSE, search **only** for shared libraries. ``Python_FIND_ABI`` + .. versionadded:: 3.16 + This variable defines which ABIs, as defined in `PEP 3149 <https://www.python.org/dev/peps/pep-3149/>`_, should be searched. @@ -226,6 +277,8 @@ Hints each flag is ``OFF`` or ``ANY``. ``Python_FIND_STRATEGY`` + .. versionadded:: 3.15 + This variable defines how lookup will be done. The ``Python_FIND_STRATEGY`` variable can be set to one of the following: @@ -238,6 +291,8 @@ Hints This is the default if policy :policy:`CMP0094` is set to ``NEW``. ``Python_FIND_REGISTRY`` + .. versionadded:: 3.13 + On Windows the ``Python_FIND_REGISTRY`` variable determine the order of preference between registry and environment variables. the ``Python_FIND_REGISTRY`` variable can be set to one of the following: @@ -248,6 +303,8 @@ Hints * ``NEVER``: Never try to use registry. ``Python_FIND_FRAMEWORK`` + .. versionadded:: 3.15 + On macOS the ``Python_FIND_FRAMEWORK`` variable determine the order of preference between Apple-style and unix-style package components. This variable can take same values as :variable:`CMAKE_FIND_FRAMEWORK` @@ -261,6 +318,8 @@ Hints variable will be used, if any. ``Python_FIND_VIRTUALENV`` + .. versionadded:: 3.15 + This variable defines the handling of virtual environments managed by ``virtualenv`` or ``conda``. It is meaningful only when a virtual environment is active (i.e. the ``activate`` script has been evaluated). In this case, it @@ -279,6 +338,9 @@ Hints ``NEVER`` to select preferably the interpreter from the virtual environment. + .. versionadded:: 3.17 + Added support for ``conda`` environments. + .. note:: If the component ``Development`` is requested, it is **strongly** @@ -286,6 +348,8 @@ Hints result. ``Python_FIND_IMPLEMENTATIONS`` + .. versionadded:: 3.18 + This variable defines, in an ordered list, the different implementations which will be searched. The ``Python_FIND_IMPLEMENTATIONS`` variable can hold the following values: @@ -319,7 +383,6 @@ Hints through the ``PATH`` variable. ``Python_FIND_UNVERSIONED_NAMES`` - .. versionadded:: 3.20 This variable defines how the generic names will be searched. Currently, it @@ -337,6 +400,8 @@ Hints Artifacts Specification ^^^^^^^^^^^^^^^^^^^^^^^ +.. versionadded:: 3.16 + To solve special cases, it is possible to specify directly the artifacts by setting the following variables: @@ -347,6 +412,8 @@ setting the following variables: The path to the compiler. ``Python_DOTNET_LAUNCHER`` + .. versionadded:: 3.18 + The ``.Net`` interpreter. Only used by ``IronPython`` implementation. ``Python_LIBRARY`` @@ -383,6 +450,8 @@ specification. So, to enable also interactive specification, module behavior can be controlled with the following variable: ``Python_ARTIFACTS_INTERACTIVE`` + .. versionadded:: 3.18 + Selects the behavior of the module. This is a boolean variable: * If set to ``TRUE``: Create CMake cache entries for the above artifact @@ -405,8 +474,9 @@ Python module naming rules:: If the library type is not specified, ``MODULE`` is assumed. -For ``MODULE`` library type, if option ``WITH_SOABI`` is specified, the -module suffix will include the ``Python_SOABI`` value, if any. +.. versionadded:: 3.17 + For ``MODULE`` library type, if option ``WITH_SOABI`` is specified, the + module suffix will include the ``Python_SOABI`` value, if any. #]=======================================================================] diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake index 5277e33..6b722ff 100644 --- a/Modules/FindPython2.cmake +++ b/Modules/FindPython2.cmake @@ -10,25 +10,32 @@ FindPython2 Find Python 2 interpreter, compiler and development environment (include directories and libraries). -When a version is requested, it can be specified as a simple value or as a -range. For a detailed description of version range usage and capabilities, -refer to the :command:`find_package` command. +.. versionadded:: 3.19 + When a version is requested, it can be specified as a simple value or as a + range. For a detailed description of version range usage and capabilities, + refer to the :command:`find_package` command. 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). This component includes two sub-components which can be specified - independently: + libraries). - * ``Development.Module``: search for artifacts for Python 2 module - developments. - * ``Development.Embed``: search for artifacts for Python 2 embedding - developments. + .. versionadded:: 3.18 + 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. +.. versionadded:: 3.14 + Added ``NumPy`` component. + If no ``COMPONENTS`` are specified, ``Interpreter`` is assumed. If component ``Development`` is specified, it implies sub-components @@ -57,20 +64,29 @@ for you. Imported Targets ^^^^^^^^^^^^^^^^ -This module defines the following :ref:`Imported Targets <Imported Targets>` -(when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``): +This module defines the following :ref:`Imported Targets <Imported Targets>`: + +.. versionchanged:: 3.14 + :ref:`Imported Targets <Imported Targets>` are only created when + :prop_gbl:`CMAKE_ROLE` is ``PROJECT``. ``Python2::Interpreter`` Python 2 interpreter. Target defined if component ``Interpreter`` is found. ``Python2::Compiler`` Python 2 compiler. Target defined if component ``Compiler`` is found. ``Python2::Module`` + .. versionadded:: 3.15 + Python 2 library for Python module. Target defined if component ``Development.Module`` is found. + ``Python2::Python`` Python 2 library for Python embedding. Target defined if component ``Development.Embed`` is found. + ``Python2::NumPy`` + .. versionadded:: 3.14 + NumPy library for Python 2. Target defined if component ``NumPy`` is found. Result Variables @@ -124,19 +140,34 @@ This module will set the following variables in your project ``Python2_COMPILER_ID`` A short string unique to the compiler. Possible values include: * IronPython + ``Python2_DOTNET_LAUNCHER`` + .. versionadded:: 3.18 + The ``.Net`` interpreter. Only used by ``IronPython`` implementation. + ``Python2_Development_FOUND`` System has the Python 2 development artifacts. + ``Python2_Development.Module_FOUND`` + .. versionadded:: 3.18 + System has the Python 2 development artifacts for Python module. + ``Python2_Development.Embed_FOUND`` + .. versionadded:: 3.18 + System has the Python 2 development artifacts for Python embedding. + ``Python2_INCLUDE_DIRS`` The Python 2 include directories. + ``Python2_LINK_OPTIONS`` + .. versionadded:: 3.19 + The Python 2 link options. Some configurations require specific link options for a correct build and execution. + ``Python2_LIBRARIES`` The Python 2 libraries. ``Python2_LIBRARY_DIRS`` @@ -151,13 +182,25 @@ This module will set the following variables in your project Python 2 minor version. ``Python2_VERSION_PATCH`` Python 2 patch version. + ``Python2_PyPy_VERSION`` + .. versionadded:: 3.18 + Python 2 PyPy version. + ``Python2_NumPy_FOUND`` + .. versionadded:: 3.14 + System has the NumPy. + ``Python2_NumPy_INCLUDE_DIRS`` + .. versionadded:: 3.14 + The NumPy include directories. + ``Python2_NumPy_VERSION`` + .. versionadded:: 3.14 + The NumPy version. Hints @@ -173,6 +216,8 @@ Hints * If set to FALSE, search **only** for shared libraries. ``Python2_FIND_STRATEGY`` + .. versionadded:: 3.15 + This variable defines how lookup will be done. The ``Python2_FIND_STRATEGY`` variable can be set to one of the following: @@ -185,6 +230,8 @@ Hints This is the default if policy :policy:`CMP0094` is set to ``NEW``. ``Python2_FIND_REGISTRY`` + .. versionadded:: 3.13 + On Windows the ``Python2_FIND_REGISTRY`` variable determine the order of preference between registry and environment variables. the ``Python2_FIND_REGISTRY`` variable can be set to one of the following: @@ -195,6 +242,8 @@ Hints * ``NEVER``: Never try to use registry. ``Python2_FIND_FRAMEWORK`` + .. versionadded:: 3.15 + On macOS the ``Python2_FIND_FRAMEWORK`` variable determine the order of preference between Apple-style and unix-style package components. This variable can take same values as :variable:`CMAKE_FIND_FRAMEWORK` @@ -208,6 +257,8 @@ Hints variable will be used, if any. ``Python2_FIND_VIRTUALENV`` + .. versionadded:: 3.15 + This variable defines the handling of virtual environments managed by ``virtualenv`` or ``conda``. It is meaningful only when a virtual environment is active (i.e. the ``activate`` script has been evaluated). In this case, it @@ -226,6 +277,9 @@ Hints ``NEVER`` to select preferably the interpreter from the virtual environment. + .. versionadded:: 3.17 + Added support for ``conda`` environments. + .. note:: If the component ``Development`` is requested, it is **strongly** @@ -233,6 +287,8 @@ Hints result. ``Python2_FIND_IMPLEMENTATIONS`` + .. versionadded:: 3.18 + This variable defines, in an ordered list, the different implementations which will be searched. The ``Python2_FIND_IMPLEMENTATIONS`` variable can hold the following values: @@ -266,7 +322,6 @@ Hints through the ``PATH`` variable. ``Python2_FIND_UNVERSIONED_NAMES`` - .. versionadded:: 3.20 This variable defines how the generic names will be searched. Currently, it @@ -284,6 +339,8 @@ Hints Artifacts Specification ^^^^^^^^^^^^^^^^^^^^^^^ +.. versionadded:: 3.16 + To solve special cases, it is possible to specify directly the artifacts by setting the following variables: @@ -294,6 +351,8 @@ setting the following variables: The path to the compiler. ``Python2_DOTNET_LAUNCHER`` + .. versionadded:: 3.18 + The ``.Net`` interpreter. Only used by ``IronPython`` implementation. ``Python2_LIBRARY`` @@ -330,6 +389,8 @@ specification. So, to enable also interactive specification, module behavior can be controlled with the following variable: ``Python2_ARTIFACTS_INTERACTIVE`` + .. versionadded:: 3.18 + Selects the behavior of the module. This is a boolean variable: * If set to ``TRUE``: Create CMake cache entries for the above artifact diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake index 2bd4d76..9e2133d 100644 --- a/Modules/FindPython3.cmake +++ b/Modules/FindPython3.cmake @@ -10,25 +10,32 @@ FindPython3 Find Python 3 interpreter, compiler and development environment (include directories and libraries). -When a version is requested, it can be specified as a simple value or as a -range. For a detailed description of version range usage and capabilities, -refer to the :command:`find_package` command. +.. versionadded:: 3.19 + When a version is requested, it can be specified as a simple value or as a + range. For a detailed description of version range usage and capabilities, + refer to the :command:`find_package` command. 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). This component includes two sub-components which can be specified - independently: + libraries). - * ``Development.Module``: search for artifacts for Python 3 module - developments. - * ``Development.Embed``: search for artifacts for Python 3 embedding - developments. + .. versionadded:: 3.18 + 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. +.. versionadded:: 3.14 + Added ``NumPy`` component. + If no ``COMPONENTS`` are specified, ``Interpreter`` is assumed. If component ``Development`` is specified, it implies sub-components @@ -57,20 +64,30 @@ for you. Imported Targets ^^^^^^^^^^^^^^^^ -This module defines the following :ref:`Imported Targets <Imported Targets>` -(when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``): +This module defines the following :ref:`Imported Targets <Imported Targets>`: + +.. versionchanged:: 3.14 + :ref:`Imported Targets <Imported Targets>` are only created when + :prop_gbl:`CMAKE_ROLE` is ``PROJECT``. ``Python3::Interpreter`` Python 3 interpreter. Target defined if component ``Interpreter`` is found. ``Python3::Compiler`` Python 3 compiler. Target defined if component ``Compiler`` is found. + ``Python3::Module`` + .. versionadded:: 3.15 + Python 3 library for Python module. Target defined if component ``Development.Module`` is found. + ``Python3::Python`` Python 3 library for Python embedding. Target defined if component ``Development.Embed`` is found. + ``Python3::NumPy`` + .. versionadded:: 3.14 + NumPy library for Python 3. Target defined if component ``NumPy`` is found. Result Variables @@ -117,7 +134,10 @@ This module will set the following variables in your project Information returned by ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)`` or else ``sysconfig.get_path('platlib')``. + ``Python3_SOABI`` + .. versionadded:: 3.17 + Extension suffix for modules. Information returned by @@ -126,6 +146,7 @@ This module will set the following variables in your project ``python3-config --extension-suffix``. If package ``distutils.sysconfig`` is not available, ``sysconfig.get_config_var('SOABI')`` or ``sysconfig.get_config_var('EXT_SUFFIX')`` are used. + ``Python3_Compiler_FOUND`` System has the Python 3 compiler. ``Python3_COMPILER`` @@ -133,19 +154,36 @@ This module will set the following variables in your project ``Python3_COMPILER_ID`` A short string unique to the compiler. Possible values include: * IronPython + ``Python3_DOTNET_LAUNCHER`` + .. versionadded:: 3.18 + The ``.Net`` interpreter. Only used by ``IronPython`` implementation. + ``Python3_Development_FOUND`` + System has the Python 3 development artifacts. + ``Python3_Development.Module_FOUND`` + .. versionadded:: 3.18 + System has the Python 3 development artifacts for Python module. + ``Python3_Development.Embed_FOUND`` + .. versionadded:: 3.18 + System has the Python 3 development artifacts for Python embedding. + ``Python3_INCLUDE_DIRS`` + The Python 3 include directories. + ``Python3_LINK_OPTIONS`` + .. versionadded:: 3.19 + The Python 3 link options. Some configurations require specific link options for a correct build and execution. + ``Python3_LIBRARIES`` The Python 3 libraries. ``Python3_LIBRARY_DIRS`` @@ -160,13 +198,25 @@ This module will set the following variables in your project Python 3 minor version. ``Python3_VERSION_PATCH`` Python 3 patch version. + ``Python3_PyPy_VERSION`` + .. versionadded:: 3.18 + Python 3 PyPy version. + ``Python3_NumPy_FOUND`` + .. versionadded:: 3.14 + System has the NumPy. + ``Python3_NumPy_INCLUDE_DIRS`` + .. versionadded:: 3.14 + The NumPy include directories. + ``Python3_NumPy_VERSION`` + .. versionadded:: 3.14 + The NumPy version. Hints @@ -182,6 +232,8 @@ Hints * If set to FALSE, search **only** for shared libraries. ``Python3_FIND_ABI`` + .. versionadded:: 3.16 + This variable defines which ABIs, as defined in `PEP 3149 <https://www.python.org/dev/peps/pep-3149/>`_, should be searched. @@ -223,6 +275,8 @@ Hints each flag is ``OFF`` or ``ANY``. ``Python3_FIND_STRATEGY`` + .. versionadded:: 3.15 + This variable defines how lookup will be done. The ``Python3_FIND_STRATEGY`` variable can be set to one of the following: @@ -235,6 +289,8 @@ Hints This is the default if policy :policy:`CMP0094` is set to ``NEW``. ``Python3_FIND_REGISTRY`` + .. versionadded:: 3.13 + On Windows the ``Python3_FIND_REGISTRY`` variable determine the order of preference between registry and environment variables. The ``Python3_FIND_REGISTRY`` variable can be set to one of the following: @@ -245,6 +301,8 @@ Hints * ``NEVER``: Never try to use registry. ``Python3_FIND_FRAMEWORK`` + .. versionadded:: 3.15 + On macOS the ``Python3_FIND_FRAMEWORK`` variable determine the order of preference between Apple-style and unix-style package components. This variable can take same values as :variable:`CMAKE_FIND_FRAMEWORK` @@ -258,6 +316,8 @@ Hints variable will be used, if any. ``Python3_FIND_VIRTUALENV`` + .. versionadded:: 3.15 + This variable defines the handling of virtual environments managed by ``virtualenv`` or ``conda``. It is meaningful only when a virtual environment is active (i.e. the ``activate`` script has been evaluated). In this case, it @@ -276,6 +336,9 @@ Hints ``NEVER`` to select preferably the interpreter from the virtual environment. + .. versionadded:: 3.17 + Added support for ``conda`` environments. + .. note:: If the component ``Development`` is requested, it is **strongly** @@ -283,6 +346,8 @@ Hints result. ``Python3_FIND_IMPLEMENTATIONS`` + .. versionadded:: 3.18 + This variable defines, in an ordered list, the different implementations which will be searched. The ``Python3_FIND_IMPLEMENTATIONS`` variable can hold the following values: @@ -316,7 +381,6 @@ Hints through the ``PATH`` variable. ``Python3_FIND_UNVERSIONED_NAMES`` - .. versionadded:: 3.20 This variable defines how the generic names will be searched. Currently, it @@ -334,6 +398,8 @@ Hints Artifacts Specification ^^^^^^^^^^^^^^^^^^^^^^^ +.. versionadded:: 3.16 + To solve special cases, it is possible to specify directly the artifacts by setting the following variables: @@ -344,6 +410,8 @@ setting the following variables: The path to the compiler. ``Python3_DOTNET_LAUNCHER`` + .. versionadded:: 3.18 + The ``.Net`` interpreter. Only used by ``IronPython`` implementation. ``Python3_LIBRARY`` @@ -380,6 +448,8 @@ specification. So, to enable also interactive specification, module behavior can be controlled with the following variable: ``Python3_ARTIFACTS_INTERACTIVE`` + .. versionadded:: 3.18 + Selects the behavior of the module. This is a boolean variable: * If set to ``TRUE``: Create CMake cache entries for the above artifact @@ -402,8 +472,9 @@ of Python module naming rules:: If the library type is not specified, ``MODULE`` is assumed. -For ``MODULE`` library type, if option ``WITH_SOABI`` is specified, the -module suffix will include the ``Python3_SOABI`` value, if any. +.. versionadded:: 3.17 + For ``MODULE`` library type, if option ``WITH_SOABI`` is specified, the + module suffix will include the ``Python3_SOABI`` value, if any. #]=======================================================================] diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake index d10ea8f..2c6ee19 100644 --- a/Modules/Platform/Windows-Clang.cmake +++ b/Modules/Platform/Windows-Clang.cmake @@ -35,6 +35,9 @@ macro(__windows_compiler_clang_gnu lang) set(CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS 1) set (CMAKE_LINK_DEF_FILE_FLAG "-Xlinker /DEF:") + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Xlinker" " ") + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP) + if("${CMAKE_${lang}_SIMULATE_VERSION}" MATCHES "^([0-9]+)\\.([0-9]+)") math(EXPR MSVC_VERSION "${CMAKE_MATCH_1}*100 + ${CMAKE_MATCH_2}") endif() diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 63dde11..464e138 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 19) -set(CMake_VERSION_PATCH 20201201) +set(CMake_VERSION_PATCH 20201202) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index 1cc267e..4151fde 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -54,22 +54,21 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() // cmProp ctestBuildConfiguration = this->Makefile->GetDefinition("CTEST_BUILD_CONFIGURATION"); - const std::string* cmakeBuildConfiguration = !this->Configuration.empty() - ? &this->Configuration - : (cmNonempty(ctestBuildConfiguration) ? ctestBuildConfiguration - : &this->CTest->GetConfigType()); - - const std::string* cmakeBuildAdditionalFlags = !this->Flags.empty() - ? &this->Flags - : this->Makefile->GetDefinition("CTEST_BUILD_FLAGS"); - const std::string* cmakeBuildTarget = !this->Target.empty() - ? &this->Target - : this->Makefile->GetDefinition("CTEST_BUILD_TARGET"); + std::string cmakeBuildConfiguration = cmNonempty(this->Configuration) + ? this->Configuration + : cmNonempty(ctestBuildConfiguration) ? *ctestBuildConfiguration + : this->CTest->GetConfigType(); + + const std::string& cmakeBuildAdditionalFlags = cmNonempty(this->Flags) + ? this->Flags + : this->Makefile->GetSafeDefinition("CTEST_BUILD_FLAGS"); + const std::string& cmakeBuildTarget = cmNonempty(this->Target) + ? this->Target + : this->Makefile->GetSafeDefinition("CTEST_BUILD_TARGET"); if (cmNonempty(cmakeGeneratorName)) { - if (!cmakeBuildConfiguration) { - static const std::string sRelease = "Release"; - cmakeBuildConfiguration = &sRelease; + if (cmakeBuildConfiguration.empty()) { + cmakeBuildConfiguration = "Release"; } if (this->GlobalGenerator) { if (this->GlobalGenerator->GetName() != *cmakeGeneratorName) { @@ -88,24 +87,18 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() return nullptr; } } - if (cmakeBuildConfiguration->empty()) { - const std::string* config = nullptr; + if (cmakeBuildConfiguration.empty()) { #ifdef CMAKE_INTDIR - static const std::string sIntDir = CMAKE_INTDIR; - config = &sIntDir; + cmakeBuildConfiguration = CMAKE_INTDIR; +#else + cmakeBuildConfiguration = "Debug"; #endif - if (!config) { - static const std::string sDebug = "Debug"; - config = &sDebug; - } - cmakeBuildConfiguration = config; } std::string dir = this->CTest->GetCTestConfiguration("BuildDirectory"); std::string buildCommand = this->GlobalGenerator->GenerateCMakeBuildCommand( - cmakeBuildTarget ? *cmakeBuildTarget : "", *cmakeBuildConfiguration, - cmakeBuildAdditionalFlags ? *cmakeBuildAdditionalFlags : "", + cmakeBuildTarget, cmakeBuildConfiguration, cmakeBuildAdditionalFlags, this->Makefile->IgnoreErrorsCMP0061()); cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "SetMakeCommand:" << buildCommand << "\n", diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 8cf5ae9..8479458 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1017,6 +1017,17 @@ int cmCTest::ProcessSteps() } if (res != 0) { cmCTestLog(this, ERROR_MESSAGE, "Errors while running CTest" << std::endl); + if (!this->Impl->OutputTestOutputOnTestFailure) { + const std::string lastTestLog = + this->GetBinaryDir() + "/Testing/Temporary/LastTest.log"; + cmCTestLog(this, ERROR_MESSAGE, + "Output from these tests are in: " << lastTestLog + << std::endl); + cmCTestLog(this, ERROR_MESSAGE, + "Use \"--rerun-failed --output-on-failure\" to re-run the " + "failed cases verbosely." + << std::endl); + } } return res; } diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index dd700c5..1a31ae4 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -288,6 +288,9 @@ void cmExportBuildFileGenerator::GetTargets( if (this->ExportSet) { for (std::unique_ptr<cmTargetExport> const& te : this->ExportSet->GetTargetExports()) { + if (te->NamelinkOnly) { + continue; + } targets.push_back(te->TargetName); } return; diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 987ec9e..0b9b183 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -42,6 +42,9 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) std::string sep; for (std::unique_ptr<cmTargetExport> const& te : this->IEGen->GetExportSet()->GetTargetExports()) { + if (te->NamelinkOnly) { + continue; + } expectedTargets += sep + this->Namespace + te->Target->GetExportName(); sep = " "; if (this->ExportedTargets.insert(te->Target).second) { diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 7ef69f4..4147ba8 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -540,10 +540,11 @@ void cmGlobalNinjaGenerator::Generate() this->CloseBuildFileStreams(); #ifdef _WIN32 - // The ninja tools will not be able to update metadata on Windows + // Older ninja tools will not be able to update metadata on Windows // when we are re-generating inside an existing 'ninja' invocation // because the outer tool has the files open for write. - if (!this->GetCMakeInstance()->GetRegenerateDuringBuild()) + if (this->NinjaSupportsMetadataOnRegeneration || + !this->GetCMakeInstance()->GetRegenerateDuringBuild()) #endif { this->CleanMetaData(); @@ -692,6 +693,9 @@ void cmGlobalNinjaGenerator::CheckNinjaFeatures() this->NinjaSupportsMultipleOutputs = !cmSystemTools::VersionCompare( cmSystemTools::OP_LESS, this->NinjaVersion.c_str(), RequiredNinjaVersionForMultipleOutputs().c_str()); + this->NinjaSupportsMetadataOnRegeneration = !cmSystemTools::VersionCompare( + cmSystemTools::OP_LESS, this->NinjaVersion.c_str(), + RequiredNinjaVersionForMetadataOnRegeneration().c_str()); } bool cmGlobalNinjaGenerator::CheckLanguages( diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 40d3cfc..8df0372 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -377,6 +377,10 @@ public: { return "1.10"; } + static std::string RequiredNinjaVersionForMetadataOnRegeneration() + { + return "1.10.2"; + } bool SupportsConsolePool() const; bool SupportsImplicitOuts() const; bool SupportsManifestRestat() const; @@ -542,6 +546,7 @@ private: bool NinjaSupportsUnconditionalRecompactTool = false; bool NinjaSupportsCleanDeadTool = false; bool NinjaSupportsMultipleOutputs = false; + bool NinjaSupportsMetadataOnRegeneration = false; private: void InitOutputPathPrefix(); diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index b99e6a3..ff08ee4 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -461,6 +461,13 @@ bool HandleTargetsMode(std::vector<std::string> const& args, std::unique_ptr<cmInstallFilesGenerator> publicHeaderGenerator; std::unique_ptr<cmInstallFilesGenerator> resourceGenerator; + // Avoid selecting default destinations for PUBLIC_HEADER and + // PRIVATE_HEADER if any artifacts are specified. + bool artifactsSpecified = false; + + // Track whether this is a namelink-only rule. + bool namelinkOnly = false; + auto addTargetExport = [&]() { // Add this install rule to an export if one was specified. if (!exports.empty()) { @@ -475,20 +482,13 @@ bool HandleTargetsMode(std::vector<std::string> const& args, te->ObjectsGenerator = objectGenerator.get(); te->InterfaceIncludeDirectories = cmJoin(includesArgs.GetIncludeDirs(), ";"); - + te->NamelinkOnly = namelinkOnly; helper.Makefile->GetGlobalGenerator() ->GetExportSets()[exports] .AddTargetExport(std::move(te)); } }; - // Avoid selecting default destinations for PUBLIC_HEADER and - // PRIVATE_HEADER if any artifacts are specified. - bool artifactsSpecified = false; - - // Track whether this is a namelink-only rule. - bool namelinkOnly = false; - switch (target.GetType()) { case cmStateEnums::SHARED_LIBRARY: { // Shared libraries are handled differently on DLL and non-DLL @@ -497,6 +497,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args, if (target.IsDLLPlatform()) { // When in namelink only mode skip all libraries on Windows. if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) { + namelinkOnly = true; addTargetExport(); continue; } @@ -529,6 +530,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args, if (target.IsFrameworkOnApple()) { // When in namelink only mode skip frameworks. if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) { + namelinkOnly = true; addTargetExport(); continue; } @@ -574,6 +576,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args, if (target.IsFrameworkOnApple()) { // When in namelink only mode skip frameworks. if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) { + namelinkOnly = true; addTargetExport(); continue; } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 8a3f285..f582701 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2503,8 +2503,10 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target) } if (!useMultiArchPch.empty()) { - target->Target->SetProperty( - cmStrCat(lang, "_COMPILE_OPTIONS_USE_PCH"), useMultiArchPch); + + target->Target->AppendProperty( + cmStrCat(lang, "_COMPILE_OPTIONS_USE_PCH"), + cmStrCat("$<$<CONFIG:", config, ">:", useMultiArchPch, ">")); } } diff --git a/Source/cmTargetExport.h b/Source/cmTargetExport.h index cb4d8da..1e38d84 100644 --- a/Source/cmTargetExport.h +++ b/Source/cmTargetExport.h @@ -31,4 +31,6 @@ public: cmInstallFilesGenerator* HeaderGenerator; std::string InterfaceIncludeDirectories; ///@} + + bool NamelinkOnly = false; }; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5524d4e..cfd724b 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -846,6 +846,8 @@ void cmake::SetArgs(const std::vector<std::string>& args) bool haveToolset = false; bool havePlatform = false; bool haveBArg = false; + bool scriptMode = false; + std::string possibleUnknownArg; #if !defined(CMAKE_BOOTSTRAP) std::string profilingFormat; std::string profilingOutput; @@ -898,7 +900,11 @@ void cmake::SetArgs(const std::vector<std::string>& args) CommandArgument{ "-B", "No build directory specified for -B", CommandArgument::Values::One, BuildArgLambda }, CommandArgument{ "-P", "-P must be followed by a file name.", - CommandArgument::Values::One, IgnoreAndTrueLambda }, + CommandArgument::Values::One, + [&](std::string const&, cmake*) -> bool { + scriptMode = true; + return true; + } }, CommandArgument{ "-D", "-D must be followed with VAR=VALUE.", CommandArgument::Values::One, IgnoreAndTrueLambda }, CommandArgument{ "-C", "-C must be followed by a file name.", @@ -1145,14 +1151,28 @@ void cmake::SetArgs(const std::vector<std::string>& args) break; } } + + // We have an issue where arguments to a "-P" script mode + // can be provided before the "-P" argument. This means + // that we need to lazily check this argument after checking + // all args. + // Additionally it can't be the source/binary tree location if (!parsedCorrectly) { cmSystemTools::Error("Run 'cmake --help' for all supported options."); exit(1); + } else if (!matched && cmHasLiteralPrefix(arg, "-")) { + possibleUnknownArg = arg; } else if (!matched) { this->SetDirectoriesFromFile(arg); } } + if (!possibleUnknownArg.empty() && !scriptMode) { + cmSystemTools::Error(cmStrCat("Unknown argument ", possibleUnknownArg)); + cmSystemTools::Error("Run 'cmake --help' for all supported options."); + exit(1); + } + // Empty instance, platform and toolset if only a generator is specified if (this->GlobalGenerator) { this->GeneratorInstance = ""; diff --git a/Tests/CudaOnly/CompileFlags/CMakeLists.txt b/Tests/CudaOnly/CompileFlags/CMakeLists.txt index 5e8a8e4..38765ec 100644 --- a/Tests/CudaOnly/CompileFlags/CMakeLists.txt +++ b/Tests/CudaOnly/CompileFlags/CMakeLists.txt @@ -8,6 +8,7 @@ if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") target_compile_options(CudaOnlyCompileFlags PRIVATE -gencode arch=compute_50,code=compute_50 ) + set_property(TARGET CudaOnlyCompileFlags PROPERTY CUDA_ARCHITECTURES) else() set_property(TARGET CudaOnlyCompileFlags PROPERTY CUDA_ARCHITECTURES 50-real) endif() diff --git a/Tests/CudaOnly/ExportPTX/CMakeLists.txt b/Tests/CudaOnly/ExportPTX/CMakeLists.txt index ee5f54d..e7e7bc4 100644 --- a/Tests/CudaOnly/ExportPTX/CMakeLists.txt +++ b/Tests/CudaOnly/ExportPTX/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.19) project (ExportPTX CUDA) #Goal for this example: @@ -6,6 +6,10 @@ project (ExportPTX CUDA) # How to reference PTX files for custom commands # How to install PTX files +# PTX can be compiled only for a single virtual architecture at a time +list(SUBLIST CMAKE_CUDA_ARCHITECTURES 0 1 CMAKE_CUDA_ARCHITECTURES) +string(APPEND CMAKE_CUDA_ARCHITECTURES "-virtual") + add_library(CudaPTX OBJECT kernelA.cu kernelB.cu) set_property(TARGET CudaPTX PROPERTY CUDA_PTX_COMPILATION ON) diff --git a/Tests/RunCMake/CMP0104/CMP0104-OLD.cmake b/Tests/RunCMake/CMP0104/CMP0104-OLD.cmake index 415eecc..6988447 100644 --- a/Tests/RunCMake/CMP0104/CMP0104-OLD.cmake +++ b/Tests/RunCMake/CMP0104/CMP0104-OLD.cmake @@ -1,3 +1,5 @@ +set(ENV{CUDAARCHS}) + cmake_policy(SET CMP0104 OLD) include(CMP0104-Common.cmake) diff --git a/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt b/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt index 97e2a10..b27da43 100644 --- a/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt +++ b/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt @@ -1,4 +1,6 @@ ^CMake Error at CTestTestfile.cmake:[0-9]+ \(subdirs\): subdirs called with incorrect number of arguments + -Errors while running CTest$ +Errors while running CTest +Output from these tests are in: .*/Testing/Temporary/LastTest.log +Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt index 7593783..a993ac6 100644 --- a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt @@ -1 +1,3 @@ -^Errors while running CTest$ +^Errors while running CTest +Output from these tests are in: .*/Testing/Temporary/LastTest.log +Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.$ diff --git a/Tests/RunCMake/CommandLine/InvalidArg1-result.txt b/Tests/RunCMake/CommandLine/InvalidArg1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/InvalidArg1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/InvalidArg1-stderr.txt b/Tests/RunCMake/CommandLine/InvalidArg1-stderr.txt new file mode 100644 index 0000000..6b825bb --- /dev/null +++ b/Tests/RunCMake/CommandLine/InvalidArg1-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Unknown argument -invalid +CMake Error: Run 'cmake --help' for all supported options.$ diff --git a/Tests/RunCMake/CommandLine/InvalidArg2-result.txt b/Tests/RunCMake/CommandLine/InvalidArg2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/InvalidArg2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/InvalidArg2-stderr.txt b/Tests/RunCMake/CommandLine/InvalidArg2-stderr.txt new file mode 100644 index 0000000..eb1488c --- /dev/null +++ b/Tests/RunCMake/CommandLine/InvalidArg2-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Unknown argument --invalid +CMake Error: Run 'cmake --help' for all supported options.$ diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index bb40c52..51754fc 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.1) include(RunCMake) run_cmake_command(NoArgs ${CMAKE_COMMAND}) +run_cmake_command(InvalidArg1 ${CMAKE_COMMAND} -invalid) +run_cmake_command(InvalidArg2 ${CMAKE_COMMAND} --invalid) run_cmake_command(Wizard ${CMAKE_COMMAND} -i) run_cmake_command(C-no-arg ${CMAKE_COMMAND} -B DummyBuildDir -C) run_cmake_command(C-no-file ${CMAKE_COMMAND} -B DummyBuildDir -C nosuchcachefile.txt) diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 62163ac..abba741 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -51,6 +51,35 @@ run_cmake(PerConfigPerSourceOptions) run_cmake(PerConfigPerSourceDefinitions) run_cmake(PerConfigPerSourceIncludeDirs) +if(XCODE_VERSION VERSION_GREATER_EQUAL 12) + + function(XcodeObjectLibsInTwoProjectsiOS) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeObjectLibsInTwoProjects-build-ios) + set(RunCMake_TEST_OPTIONS "-DCMAKE_SYSTEM_NAME=iOS") + + run_cmake(XcodeObjectLibsInTwoProjects) + + set(RunCMake_TEST_NO_CLEAN 1) + + run_cmake_command(XcodeObjectLibsInTwoProjects-build-ios ${CMAKE_COMMAND} --build . --target shared_lib -- -sdk iphonesimulator) + endfunction() + + XcodeObjectLibsInTwoProjectsiOS() + + function(XcodeObjectLibsInTwoProjectsMacOS) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeObjectLibsInTwoProjects-build-macos) + + run_cmake(XcodeObjectLibsInTwoProjects) + + set(RunCMake_TEST_NO_CLEAN 1) + + run_cmake_command(XcodeObjectLibsInTwoProjects-build-macos ${CMAKE_COMMAND} --build . --target shared_lib) + endfunction() + + XcodeObjectLibsInTwoProjectsMacOS() + +endif() + function(XcodeSchemaGeneration) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeSchemaGeneration-build) set(RunCMake_TEST_NO_CLEAN 1) diff --git a/Tests/RunCMake/XcodeProject/XcodeObjectLibsInTwoProjects.cmake b/Tests/RunCMake/XcodeProject/XcodeObjectLibsInTwoProjects.cmake new file mode 100644 index 0000000..3ca24af --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeObjectLibsInTwoProjects.cmake @@ -0,0 +1,5 @@ +cmake_minimum_required (VERSION 3.19) + +project (test_xcode_fail NONE) + +add_subdirectory(subproject_two_object_libs) diff --git a/Tests/RunCMake/XcodeProject/subproject_two_object_libs/CMakeLists.txt b/Tests/RunCMake/XcodeProject/subproject_two_object_libs/CMakeLists.txt new file mode 100644 index 0000000..e55836d --- /dev/null +++ b/Tests/RunCMake/XcodeProject/subproject_two_object_libs/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required (VERSION 3.16) + +enable_language(CXX) + +project (subproject_two_object_libs) + +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED NO) +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + +if(IOS) + set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) + + set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64") +endif() + +# Hierarchy of libraries looks like: +# +# OBJECT-1 ---> STATIC--\ +# |---> SHARED +# OBJECT-2 -------------/ + +add_library(object_lib_dependency1 OBJECT dummy.cpp) + +add_library(static_lib_dependency STATIC dummy.cpp $<TARGET_OBJECTS:object_lib_dependency1>) + +add_library(object_lib_dependency2 OBJECT dummy.cpp) +target_link_libraries(object_lib_dependency2 PRIVATE static_lib_dependency) + +add_library(shared_lib SHARED dummy.cpp) +target_link_libraries(shared_lib PRIVATE static_lib_dependency) +target_sources(shared_lib PRIVATE $<TARGET_OBJECTS:object_lib_dependency2>) diff --git a/Tests/RunCMake/XcodeProject/subproject_two_object_libs/dummy.cpp b/Tests/RunCMake/XcodeProject/subproject_two_object_libs/dummy.cpp new file mode 100644 index 0000000..8082abc --- /dev/null +++ b/Tests/RunCMake/XcodeProject/subproject_two_object_libs/dummy.cpp @@ -0,0 +1,5 @@ +namespace { +void foo() +{ +} +} diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake index 95c8d5c..0e6020f 100644 --- a/Tests/RunCMake/export/RunCMakeTest.cmake +++ b/Tests/RunCMake/export/RunCMakeTest.cmake @@ -17,3 +17,4 @@ run_cmake(DependOnNotExport) run_cmake(DependOnDoubleExport) run_cmake(UnknownExport) run_cmake(NamelinkOnlyExport) +run_cmake(SeparateNamelinkExport) diff --git a/Tests/RunCMake/export/SeparateNamelinkExport.cmake b/Tests/RunCMake/export/SeparateNamelinkExport.cmake new file mode 100644 index 0000000..b006aea --- /dev/null +++ b/Tests/RunCMake/export/SeparateNamelinkExport.cmake @@ -0,0 +1,16 @@ +enable_language(CXX) +add_library(foo SHARED empty.cpp) +install(TARGETS foo EXPORT fooExport + RUNTIME DESTINATION bin + LIBRARY + DESTINATION lib + COMPONENT runtime + NAMELINK_SKIP +) +install(TARGETS foo EXPORT fooExport + LIBRARY + DESTINATION lib + COMPONENT development + NAMELINK_ONLY +) +export(EXPORT fooExport FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake") diff --git a/Tests/RunCMake/install/EXPORT-SeparateNamelink.cmake b/Tests/RunCMake/install/EXPORT-SeparateNamelink.cmake new file mode 100644 index 0000000..5c6fa10 --- /dev/null +++ b/Tests/RunCMake/install/EXPORT-SeparateNamelink.cmake @@ -0,0 +1,19 @@ +enable_language(C) +add_library(foo SHARED empty.c) +install(TARGETS foo EXPORT fooExport + RUNTIME DESTINATION bin + LIBRARY + DESTINATION lib + COMPONENT runtime + NAMELINK_SKIP +) +install(TARGETS foo EXPORT fooExport + LIBRARY + DESTINATION lib + COMPONENT development + NAMELINK_ONLY +) +install(EXPORT fooExport + DESTINATION "lib/cmake/" + FILE "foo.cmake" +) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index 5aab88c..d64d88b 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -78,6 +78,7 @@ run_cmake(TARGETS-DESTINATION-bad) run_cmake(EXPORT-OldIFace) run_cmake(EXPORT-UnknownExport) run_cmake(EXPORT-NamelinkOnly) +run_cmake(EXPORT-SeparateNamelink) run_cmake(CMP0062-OLD) run_cmake(CMP0062-NEW) run_cmake(CMP0062-WARN) |