* |SYSTEM_ENVIRONMENT_PATH_WINDOWS_XXX|
6. Search cmake variables defined in the Platform files
- for the current system. The searching of ``CMAKE_INSTALL_PREFIX`` can be
+ for the current system. The searching of ``CMAKE_INSTALL_PREFIX`` and
+ ``CMAKE_STAGING_PREFIX`` can be
skipped if ``NO_CMAKE_INSTALL_PREFIX`` is passed or by setting the
:variable:`CMAKE_FIND_USE_INSTALL_PREFIX` to ``FALSE``. All these locations
can be skipped if ``NO_CMAKE_SYSTEM_PATH`` is passed or by setting the
Specify which registry views must be queried. This option is only meaningful
-on ``Windows`` platform and will be ignored on other ones. When not
-specified, |FIND_XXX_REGISTRY_VIEW_DEFAULT| view is used when :policy:`CMP0134`
-policy is ``NEW``. Refer to :policy:`CMP0134` policy for default view when
-policy is ``OLD`` or undefined.
+on ``Windows`` platforms and will be ignored on other ones. When not
+specified, the |FIND_XXX_REGISTRY_VIEW_DEFAULT| view is used when the
+:policy:`CMP0134` policy is ``NEW``. Refer to :policy:`CMP0134` for the
+default view when the policy is ``OLD``.
``64``
- Query the 64bit registry. On ``32bit Windows``, returns always the string
+ Query the 64-bit registry. On 32-bit Windows, it always returns the string
``/REGISTRY-NOTFOUND``.
``32``
- Query the 32bit registry.
+ Query the 32-bit registry.
``64_32``
Query both views (``64`` and ``32``) and generate a path for each.
Query both views (``32`` and ``64``) and generate a path for each.
``HOST``
- Query the registry matching the architecture of the host: ``64`` on ``64bit
- Windows`` and ``32`` on ``32bit Windows``.
+ Query the registry matching the architecture of the host: ``64`` on 64-bit
+ Windows and ``32`` on 32-bit Windows.
``TARGET``
- Query the registry matching the architecture specified by
- :variable:`CMAKE_SIZEOF_VOID_P` variable. If not defined, fallback to
+ Query the registry matching the architecture specified by the
+ :variable:`CMAKE_SIZEOF_VOID_P` variable. If not defined, fall back to
``HOST`` view.
``BOTH``
- Query both views (``32`` and ``64``). The order depends of the following
- rules: If :variable:`CMAKE_SIZEOF_VOID_P` variable is defined. Use the
- following view depending of the content of this variable:
+ Query both views (``32`` and ``64``). The order depends on the following
+ rules: If the :variable:`CMAKE_SIZEOF_VOID_P` variable is defined, use the
+ following view depending on the content of this variable:
* ``8``: ``64_32``
* ``4``: ``32_64``
- If :variable:`CMAKE_SIZEOF_VOID_P` variable is not defined, rely on
+ If the :variable:`CMAKE_SIZEOF_VOID_P` variable is not defined, rely on the
architecture of the host:
- * ``64bit``: ``64_32``
- * ``32bit``: ``32``
+ * 64-bit: ``64_32``
+ * 32-bit: ``32``
See also the :variable:`CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE`,
:variable:`CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE` and
-:variable:`CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION` variables.
+:variable:`CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION` variables, along with their
+corresponding :manual:`ctest(1)` command line options
+``--test-output-size-passed``, ``--test-output-size-failed``, and
+``--test-output-truncation``.
.. _`Additional Test Measurements`:
"/dir/to/valid_img.gif</CTestMeasurementFile>" << std::endl;
std::cout <<
- "<CTestMeasurementFile type=\"image/png\" name=\"AlgoResult\"> <<
+ "<CTestMeasurementFile type=\"image/png\" name=\"AlgoResult\">" <<
"/dir/to/img.png</CTestMeasurementFile>"
<< std::endl;
available components.
.. versionadded:: 3.24
- The ``REGISTRY_VIEW`` keyword enables to specify which registry views must be
- queried. This keyword is only meaningful on ``Windows`` platform and will be
- ignored on all other ones. Formally, it is up to the target package how to
+ The ``REGISTRY_VIEW`` keyword specifies which registry views should be
+ queried. This keyword is only meaningful on ``Windows`` platforms and will
+ be ignored on all others. Formally, it is up to the target package how to
interpret the registry view information given to it.
.. versionadded:: 3.24
package registry.
7. Search cmake variables defined in the Platform files for the
- current system. The searching of :variable:`CMAKE_INSTALL_PREFIX` can be
+ current system. The searching of :variable:`CMAKE_INSTALL_PREFIX` and
+ :variable:`CMAKE_STAGING_PREFIX` can be
skipped if ``NO_CMAKE_INSTALL_PREFIX`` is passed or by setting the
:variable:`CMAKE_FIND_USE_INSTALL_PREFIX` to ``FALSE``. All these locations
can be skipped if ``NO_CMAKE_SYSTEM_PATH`` is passed or by setting the
CMake upstream. It includes links to contribution instructions, which
in turn link to developer guides for CMake itself.
+Accessing Windows Registry
+==========================
+
+CMake offers some facilities to access the registry on ``Windows`` platforms.
+
+Query Windows Registry
+----------------------
+
+.. versionadded:: 3.24
+
+The :command:`cmake_host_system_information` command offers the possibility to
+query the registry on the local computer. See
+:ref:`cmake_host_system(QUERY_WINDOWS_REGISTRY) <Query Windows registry>` for
+more information.
+
+.. _`Find Using Windows Registry`:
+
+Find Using Windows Registry
+---------------------------
+
+.. versionchanged:: 3.24
+
+Options ``HINTS`` and ``PATHS`` of :command:`find_file`,
+:command:`find_library`, :command:`find_path`, :command:`find_program`, and
+:command:`find_package` commands offer the possibility, on ``Windows``
+platform, to query the registry.
+
+The formal syntax, as specified using
+`BNF <https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form>`_ notation with
+the regular extensions, for registry query is the following:
+
+.. raw:: latex
+
+ \begin{small}
+
+.. productionlist::
+ registry_query: '[' `sep_definition`? `root_key`
+ : ((`key_separator` `sub_key`)? (`value_separator` `value_name`_)?)? ']'
+ sep_definition: '{' `value_separator` '}'
+ root_key: 'HKLM' | 'HKEY_LOCAL_MACHINE' | 'HKCU' | 'HKEY_CURRENT_USER' |
+ : 'HKCR' | 'HKEY_CLASSES_ROOT' | 'HKCC' | 'HKEY_CURRENT_CONFIG' |
+ : 'HKU' | 'HKEY_USERS'
+ sub_key: `element` (`key_separator` `element`)*
+ key_separator: '/' | '\\'
+ value_separator: `element` | ';'
+ value_name: `element` | '(default)'
+ element: `character`\+
+ character: <any character except `key_separator` and `value_separator`>
+
+.. raw:: latex
+
+ \end{small}
+
+The :token:`sep_definition` optional item offers the possibility to specify
+the string used to separate the :token:`sub_key` from the :token:`value_name`
+item. If not specified, the character ``;`` is used. Multiple
+:token:`registry_query` items can be specified as part of a path.
+
+.. code-block:: cmake
+
+ # example using default separator
+ find_file(... PATHS "/root/[HKLM/Stuff;InstallDir]/lib[HKLM\\\\Stuff;Architecture]")
+
+ # example using different specified separators
+ find_library(... HINTS "/root/[{|}HKCU/Stuff|InstallDir]/lib[{@@}HKCU\\\\Stuff@@Architecture]")
+
+If the :token:`value_name` item is not specified or has the special name
+``(default)``, the content of the default value, if any, will be returned. The
+supported types for the :token:`value_name` are:
+
+* ``REG_SZ``.
+* ``REG_EXPAND_SZ``. The returned data is expanded.
+* ``REG_DWORD``.
+* ``REG_QWORD``.
+
+When the registry query failed, typically because the key does not exist or
+the data type is not supported, the string ``/REGISTRY-NOTFOUND`` is substituted
+to the ``[]`` query expression.
+
.. _`Find Modules`:
Find Modules
Make sure you comment them as deprecated, so that no-one starts using
them.
-.. _`Find Using Windows Registry`:
-
-Find Using Windows Registry
----------------------------
-
-.. versionchanged:: 3.24
-
-Options ``HINTS`` and ``PATHS`` of :command:`find_file`,
-:command:`find_library`, :command:`find_path`, :command:`find_program`, and
-:command:`find_package` commands offer the possibility, on ``Windows``
-platform, to query the registry.
-
-The formal syntax, as specified using
-`BNF <https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form>`_ notation with
-the regular extensions, for registry query is the following:
-
-.. raw:: latex
-
- \begin{small}
-
-.. productionlist::
- registry_query: '[' `sep_definition`? `root_key`
- : ((`key_separator` `sub_key`)? (`value_separator` `value_name`_)?)? ']'
- sep_definition: '{' `value_separator` '}'
- root_key: 'HKLM' | 'HKEY_LOCAL_MACHINE' | 'HKCU' | 'HKEY_CURRENT_USER' |
- : 'HKCR' | 'HKEY_CLASSES_ROOT' | 'HKCC' | 'HKEY_CURRENT_CONFIG' |
- : 'HKU' | 'HKEY_USERS'
- sub_key: `element` (`key_separator` `element`)*
- key_separator: '/' | '\\'
- value_separator: `element` | ';'
- value_name: `element` | '(default)'
- element: `character`\+
- character: <any character except `key_separator` and `value_separator`>
-
-.. raw:: latex
-
- \end{small}
-
-The :token:`sep_definition` optional item offers the possibility to specify
-the string used to separate the :token:`sub_key` from the :token:`value_name`
-item. If not specified, the character ``;`` is used. Multiple
-:token:`registry_query` items can be specified as part of a path.
-
-.. code-block:: cmake
-
- # example using default separator
- find_file(... PATHS "/root/[HKLM/Stuff;InstallDir]/lib[HKLM\\\\Stuff;Architecture]")
-
- # example using different specified separators
- find_library(... HINTS "/root/[{|}HKCU/Stuff|InstallDir]/lib[{@@}HKCU\\\\Stuff@@Architecture]")
-
-If the :token:`value_name` item is not specified or has the special name
-``(default)``, the content of the default value, if any, will be returned. The
-supported types for the :token:`value_name` are:
-
-* ``REG_SZ``.
-* ``REG_EXPAND_SZ``. The returned data is expanded.
-* ``REG_DWORD``.
-* ``REG_QWORD``.
-
-When the registry query failed, typically because the key does not exist or
-the data type is not supported, the string ``/REGISTRY-NOTFOUND`` is substituted
-to the ``[]`` query expression.
-
A Sample Find Module
--------------------
A *variable reference* has the form ``${<variable>}`` and is
evaluated inside a `Quoted Argument`_ or an `Unquoted Argument`_.
-A variable reference is replaced by the value of the variable,
-or by the empty string if the variable is not set.
+A variable reference is replaced by the value of the specified
+variable or cache entry, or if neither is set, by the empty string.
Variable references can nest and are evaluated from the
inside out, e.g. ``${outer_${inner_variable}_variable}``.
An *environment variable reference* has the form ``$ENV{<variable>}``.
See the `Environment Variables`_ section for more information.
-A *cache variable reference* has the form ``$CACHE{<variable>}``.
+A *cache variable reference* has the form ``$CACHE{<variable>}``,
+and is replaced by the value of the specified cache entry without
+checking for a normal variable of the same name. If the cache
+entry does not exist, it is replaced by the empty string.
See :variable:`CACHE` for more information.
The :command:`if` command has a special condition syntax that
allows for variable references in the short form ``<variable>``
-instead of ``${<variable>}``.
-However, environment and cache variables always need to be
-referenced as ``$ENV{<variable>}`` or ``$CACHE{<variable>}``.
+instead of ``${<variable>}``. However, environment variables
+always need to be referenced as ``$ENV{<variable>}``.
Comments
--------
CMP0137: try_compile() passes platform variables in project mode. </policy/CMP0137>
CMP0136: Watcom runtime library flags are selected by an abstraction. </policy/CMP0136>
CMP0135: ExternalProject ignores timestamps in archives by default for the URL download method. </policy/CMP0135>
- CMP0134: Fallback to \"HOST\" Windows registry view when \"TARGET\" view is not usable. </policy/CMP0134>
+ CMP0134: Fallback to "HOST" Windows registry view when "TARGET" view is not usable. </policy/CMP0134>
CMP0133: The CPack module disables SLA by default in the CPack DragNDrop Generator. </policy/CMP0133>
CMP0132: Do not set compiler environment variables on first run. </policy/CMP0132>
CMP0131: LINK_LIBRARIES supports the LINK_ONLY generator expression. </policy/CMP0131>
This policy was introduced in CMake version 3.24. Use the
:command:`cmake_policy` command to set this policy to ``OLD`` or ``NEW``
explicitly. Unlike many policies, CMake version |release| does *not* warn
-by default when this policy is not set and simply uses ``OLD`` behavior.
-See documentation of the
-:variable:`CMAKE_POLICY_WARNING_CMP0133 <CMAKE_POLICY_WARNING_CMP<NNNN>>`
-variable to control the warning.
+when this policy is not set and simply uses ``OLD`` behavior.
.. include:: DEPRECATED.txt
Changes made since CMake 3.24.0 include the following.
-3.24.1
-------
+3.24.1, 3.24.2
+--------------
-* This version made no changes to documented features or interfaces.
+* These versions made no changes to documented features or interfaces.
Some implementation updates were made to support ecosystem changes
and/or fix regressions.
.. versionadded:: 3.24
Controls the default behavior of the following commands for whether or not to
-search the install location:
+search the locations in the :variable:`CMAKE_INSTALL_PREFIX` and
+:variable:`CMAKE_STAGING_PREFIX` variables.
* :command:`find_program`
* :command:`find_library`
function(_cmake_record_install_prefix )
set(_CMAKE_SYSTEM_PREFIX_PATH_INSTALL_PREFIX_VALUE "${CMAKE_INSTALL_PREFIX}" PARENT_SCOPE)
- set(count 0)
+ set(_CMAKE_SYSTEM_PREFIX_PATH_STAGING_PREFIX_VALUE "${CMAKE_STAGING_PREFIX}" PARENT_SCOPE)
+ set(icount 0)
+ set(scount 0)
foreach(value IN LISTS CMAKE_SYSTEM_PREFIX_PATH)
if(value STREQUAL CMAKE_INSTALL_PREFIX)
- math(EXPR count "${count}+1")
+ math(EXPR icount "${icount}+1")
+ endif()
+ if(value STREQUAL CMAKE_STAGING_PREFIX)
+ math(EXPR scount "${scount}+1")
endif()
endforeach()
- set(_CMAKE_SYSTEM_PREFIX_PATH_INSTALL_PREFIX_COUNT "${count}" PARENT_SCOPE)
+ set(_CMAKE_SYSTEM_PREFIX_PATH_INSTALL_PREFIX_COUNT "${icount}" PARENT_SCOPE)
+ set(_CMAKE_SYSTEM_PREFIX_PATH_STAGING_PREFIX_COUNT "${scount}" PARENT_SCOPE)
endfunction()
# include Generic system information
If ``GIT_SHALLOW`` is enabled then ``GIT_TAG`` works only with
branch names and tags. A commit hash is not allowed.
+ Note that if not provided, ``GIT_TAG`` defaults to ``master``, not the
+ default Git branch name.
+
``GIT_REMOTE_NAME <name>``
The optional name of the remote. If this option is not specified, it
defaults to ``origin``.
``<lowercaseName>-extra.cmake`` or ``<name>Extra.cmake`` file with the
``OPTIONAL`` flag (so the files can be missing and won't generate a
warning). Similarly, if no config version file exists, a very simple
- one will be written which sets ``PACKAGE_VERSION_COMPATIBLE`` to true.
+ one will be written which sets ``PACKAGE_VERSION_COMPATIBLE`` and
+ ``PACKAGE_VERSION_EXACT`` to true. This ensures all future calls to
+ :command:`find_package()` for the dependency will use the redirected
+ config file, regardless of any version requirements.
CMake cannot automatically determine an arbitrary dependency's version,
- so it cannot set ``PACKAGE_VERSION`` or ``PACKAGE_VERSION_EXACT``.
+ so it cannot set ``PACKAGE_VERSION``.
When a dependency is pulled in via :command:`add_subdirectory` in the
next step, it may choose to overwrite the generated config version file
in :variable:`CMAKE_FIND_PACKAGE_REDIRECTS_DIR` with one that also sets
- ``PACKAGE_VERSION``, and if appropriate, ``PACKAGE_VERSION_EXACT``.
+ ``PACKAGE_VERSION``.
The dependency may also write a ``<lowercaseName>-extra.cmake`` or
``<name>Extra.cmake`` file to perform custom processing or define any
variables that their normal (installed) package config file would
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG 703bd9caab50b139428cea1aaff9974ebee5742e # release-1.10.0
- FIND_PACKAGE_ARGS NAMES gtest
+ FIND_PACKAGE_ARGS NAMES GTest
)
FetchContent_Declare(
Catch2
For ``Catch2``, no additional arguments to :command:`find_package` are needed,
so no additional arguments are provided after the ``FIND_PACKAGE_ARGS``
-keyword. For ``googletest``, its package is more commonly called ``gtest``,
+keyword. For ``googletest``, its package is more commonly called ``GTest``,
so arguments are added to support it being found by that name.
If the user wanted to disable :command:`FetchContent_MakeAvailable` from
CMake provides a FindGTest module which defines some variables that older
projects may use instead of linking to the imported targets. To support
-those cases, we can provide an extras file. In keeping with the
+those cases, we can provide an extra file. In keeping with the
"first to define, wins" philosophy of ``FetchContent``, we only write out
that file if something else hasn't already done so.
FetchContent_MakeAvailable(googletest)
- if(NOT EXISTS ${CMAKE_FIND_PACKAGE_REDIRECTS_DIR}/googletest-extras.cmake AND
- NOT EXISTS ${CMAKE_FIND_PACKAGE_REDIRECTS_DIR}/googletestExtras.cmake)
- file(WRITE ${CMAKE_FIND_PACKAGE_REDIRECTS_DIR}/googletest-extras.cmake
+ if(NOT EXISTS ${CMAKE_FIND_PACKAGE_REDIRECTS_DIR}/googletest-extra.cmake AND
+ NOT EXISTS ${CMAKE_FIND_PACKAGE_REDIRECTS_DIR}/googletestExtra.cmake)
+ file(WRITE ${CMAKE_FIND_PACKAGE_REDIRECTS_DIR}/googletest-extra.cmake
[=[
if("${GTEST_LIBRARIES}" STREQUAL "" AND TARGET GTest::gtest)
set(GTEST_LIBRARIES GTest::gtest)
set(__cmake_fcProvider_${__cmake_contentNameLower} YES)
cmake_language(EVAL CODE "${__cmake_providerCommand}(${__cmake_providerArgs})")
- unset(__cmake_fcProvider_${__cmake_contentNameLower})
list(POP_BACK __cmake_fcCurrentVarsStack
__cmake_contentNameLower
__cmake_contentName
)
+ unset(__cmake_fcProvider_${__cmake_contentNameLower})
unset(__cmake_providerArgs)
unset(__cmake_addfpargs)
unset(__cmake_fpargs)
# Automatically generated by CMake's FetchContent module.
# Do not edit this file, it will be regenerated every time CMake runs.
-# Version not available, assuming it is compatible
+# Version not available, assuming it is compatible. We must also say it is an
+# exact match to ensure find_package() calls with the EXACT keyword still get
+# redirected.
set(PACKAGE_VERSION_COMPATIBLE TRUE)
+set(PACKAGE_VERSION_EXACT TRUE)
set(_Boost_TIMER_DEPENDENCIES chrono)
set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono atomic)
set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
- if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.80.0 AND NOT Boost_NO_WARN_NEW_VERSIONS)
+ if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.81.0 AND NOT Boost_NO_WARN_NEW_VERSIONS)
message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets")
endif()
endif()
# _Boost_COMPONENT_HEADERS. See the instructions at the top of
# _Boost_COMPONENT_DEPENDENCIES.
set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
- "1.79.0" "1.79"
+ "1.80.0" "1.80" "1.79.0" "1.79"
"1.78.0" "1.78" "1.77.0" "1.77" "1.76.0" "1.76" "1.75.0" "1.75" "1.74.0" "1.74"
"1.73.0" "1.73" "1.72.0" "1.72" "1.71.0" "1.71" "1.70.0" "1.70" "1.69.0" "1.69"
"1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65"
endif()
_CUDAToolkit_find_and_add_import_lib(culibos) # it's a static library
- foreach (cuda_lib cublasLt cublas cufft curand cusparse nppc nvjpeg)
+ foreach (cuda_lib cublasLt cufft curand cusparse nppc nvjpeg)
_CUDAToolkit_find_and_add_import_lib(${cuda_lib})
_CUDAToolkit_find_and_add_import_lib(${cuda_lib}_static DEPS culibos)
endforeach()
if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 11.0.0)
# cublas depends on cublasLt
# https://docs.nvidia.com/cuda/archive/11.0/cublas/index.html#static-library
- _CUDAToolkit_find_and_add_import_lib(cublas DEPS cublasLt)
- _CUDAToolkit_find_and_add_import_lib(cublas_static DEPS cublasLt_static)
+ _CUDAToolkit_find_and_add_import_lib(cublas DEPS cublasLt culibos)
+ _CUDAToolkit_find_and_add_import_lib(cublas_static DEPS cublasLt_static culibos)
+ else()
+ _CUDAToolkit_find_and_add_import_lib(cublas DEPS culibos)
+ _CUDAToolkit_find_and_add_import_lib(cublas_static DEPS culibos)
endif()
# cuFFTW depends on cuFFT
endif()
# cuSOLVER depends on cuBLAS, and cuSPARSE
- _CUDAToolkit_find_and_add_import_lib(cusolver DEPS cublas cusparse)
- _CUDAToolkit_find_and_add_import_lib(cusolver_static DEPS cublas_static cusparse_static culibos)
-
-
- if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 10.1.2)
- # cusolver depends on liblapack_static.a starting with CUDA 10.1 update 2,
- # https://docs.nvidia.com/cuda/archive/11.5.0/cusolver/index.html#static-link-lapack
- _CUDAToolkit_find_and_add_import_lib(cusolver_lapack_static ALT lapack_static) # implementation detail static lib
- _CUDAToolkit_find_and_add_import_lib(cusolver_static DEPS cusolver_lapack_static)
- endif()
-
+ set(cusolver_deps cublas cusparse)
+ set(cusolver_static_deps cublas_static cusparse_static culibos)
if(CUDAToolkit_VERSION VERSION_GREATER 11.2.1)
# cusolver depends on libcusolver_metis and cublasLt
# https://docs.nvidia.com/cuda/archive/11.2.2/cusolver/index.html#link-dependency
- _CUDAToolkit_find_and_add_import_lib(cusolver DEPS cublasLt)
-
+ list(APPEND cusolver_deps cublasLt)
_CUDAToolkit_find_and_add_import_lib(cusolver_metis_static ALT metis_static) # implementation detail static lib
- _CUDAToolkit_find_and_add_import_lib(cusolver_static DEPS cusolver_metis_static cublasLt_static)
+ list(APPEND cusolver_static_deps cusolver_metis_static cublasLt_static)
+ endif()
+ if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 10.1.2)
+ # cusolver depends on liblapack_static.a starting with CUDA 10.1 update 2,
+ # https://docs.nvidia.com/cuda/archive/11.5.0/cusolver/index.html#static-link-lapack
+ _CUDAToolkit_find_and_add_import_lib(cusolver_lapack_static ALT lapack_static) # implementation detail static lib
+ list(APPEND cusolver_static_deps cusolver_lapack_static)
endif()
+ _CUDAToolkit_find_and_add_import_lib(cusolver DEPS ${cusolver_deps})
+ _CUDAToolkit_find_and_add_import_lib(cusolver_static DEPS ${cusolver_static_deps})
+ unset(cusolver_deps)
+ unset(cusolver_static_deps)
# nvGRAPH depends on cuRAND, and cuSOLVER.
_CUDAToolkit_find_and_add_import_lib(nvgraph DEPS curand cusolver)
find_path(CUDAToolkit_CUPTI_INCLUDE_DIR cupti.h PATHS
"${CUDAToolkit_ROOT_DIR}/extras/CUPTI/include"
"${CUDAToolkit_INCLUDE_DIR}/../extras/CUPTI/include"
- "${CUDATookit_INCLUDE_DIR}"
+ "${CUDAToolkit_INCLUDE_DIR}"
NO_DEFAULT_PATH)
if(CUDAToolkit_CUPTI_INCLUDE_DIR)
if(UNIX)
list(APPEND PostgreSQL_LIBRARY_ADDITIONAL_SEARCH_SUFFIXES
"postgresql${suffix}"
+ "postgresql@${suffix}"
"pgsql-${suffix}/lib")
list(APPEND PostgreSQL_INCLUDE_ADDITIONAL_SEARCH_SUFFIXES
"postgresql${suffix}"
+ "postgresql@${suffix}"
"postgresql/${suffix}"
"pgsql-${suffix}/include")
list(APPEND PostgreSQL_TYPE_ADDITIONAL_SEARCH_SUFFIXES
"postgresql${suffix}/server"
+ "postgresql@${suffix}/server"
"postgresql/${suffix}/server"
"pgsql-${suffix}/include/server")
endif()
# Allow ZLIB_LIBRARY to be set manually, as the location of the zlib library
if(NOT ZLIB_LIBRARY)
- set(_zlib_ORIG_CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES})
- set(_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ if(DEFINED CMAKE_FIND_LIBRARY_PREFIXES)
+ set(_zlib_ORIG_CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
+ else()
+ set(_zlib_ORIG_CMAKE_FIND_LIBRARY_PREFIXES)
+ endif()
+ if(DEFINED CMAKE_FIND_LIBRARY_SUFFIXES)
+ set(_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES}")
+ else()
+ set(_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
+ endif()
# Prefix/suffix of the win32/Makefile.gcc build
if(WIN32)
list(APPEND CMAKE_FIND_LIBRARY_PREFIXES "" "lib")
endforeach()
# Restore the original find library ordering
- set(CMAKE_FIND_LIBRARY_SUFFIXES ${_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
- set(CMAKE_FIND_LIBRARY_PREFIXES ${_zlib_ORIG_CMAKE_FIND_LIBRARY_PREFIXES})
+ if(DEFINED _zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES "${_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}")
+ else()
+ set(CMAKE_FIND_LIBRARY_SUFFIXES)
+ endif()
+ if(DEFINED _zlib_ORIG_CMAKE_FIND_LIBRARY_PREFIXES)
+ set(CMAKE_FIND_LIBRARY_PREFIXES "${_zlib_ORIG_CMAKE_FIND_LIBRARY_PREFIXES}")
+ else()
+ set(CMAKE_FIND_LIBRARY_PREFIXES)
+ endif()
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
select_library_configurations(ZLIB)
MYMODULE_mp_MYSUB # Intel on Windows
mymodule_mysub_ # PGI
mymodule_MP_mysub # NAG
+ _QMmy_modulePmy_sub # LLVMFlang
+ _QMmymodulePmysub # LLVMFlang
${FortranCInterface_MODULE_SYMBOLS}
)
list(REMOVE_DUPLICATES module_symbols)
set(_case_MY_SUB "UPPER")
set(_global_regex "^(_*)(mysub|MYSUB)([_$]*)$")
set(_global__regex "^(_*)(my_sub|MY_SUB)([_$]*)$")
-set(_module_regex "^(_*)(mymodule|MYMODULE)([A-Za-z_$]*)(mysub|MYSUB)([_$]*)$")
-set(_module__regex "^(_*)(my_module|MY_MODULE)([A-Za-z_$]*)(my_sub|MY_SUB)([_$]*)$")
+set(_module_regex "^(_*)([A-Za-z$]*)(mymodule|MYMODULE)([A-Za-z_$]*)(mysub|MYSUB)([_$]*)$")
+set(_module__regex "^(_*)([A-Za-z$]*)(my_module|MY_MODULE)([A-Za-z_$]*)(my_sub|MY_SUB)([_$]*)$")
# Parse the symbol names.
foreach(symbol ${FortranCInterface_SYMBOLS})
# Look for module symbols.
string(REGEX REPLACE "${_module_${form}regex}"
- "\\1;\\2;\\3;\\4;\\5" pieces "${symbol}")
+ "\\1\\2;\\3;\\4;\\5;\\6" pieces "${symbol}")
list(LENGTH pieces len)
if(len EQUAL 5)
set(FortranCInterface_MODULE_${form}SYMBOL "${symbol}")
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 24)
-set(CMake_VERSION_PATCH 1)
+set(CMake_VERSION_PATCH 2)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
if(NOT CMake_VERSION_NO_GIT)
# If this source was exported by 'git archive', use its commit info.
- set(git_info [==[c3793b4157 CMake 3.24.1]==])
+ set(git_info [==[31f835410e CMake 3.24.2]==])
# Otherwise, try to identify the current development source version.
if(NOT git_info MATCHES "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]?[0-9a-f]?)[0-9a-f]* "
cmValue dval = mf->GetDefinition("CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION");
if (dval) {
- this->SetTestOutputTruncation(dval);
+ if (!this->SetTestOutputTruncation(dval)) {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Invalid value for CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION: "
+ << dval << std::endl);
+ }
}
}
paths.AddSuffixes(this->SearchPathSuffixes);
}
+namespace {
+struct entry_to_remove
+{
+ entry_to_remove(std::string const& name, cmMakefile* makefile)
+ : value()
+ {
+ if (cmValue to_skip = makefile->GetDefinition(
+ cmStrCat("_CMAKE_SYSTEM_PREFIX_PATH_", name, "_PREFIX_COUNT"))) {
+ cmStrToLong(to_skip, &count);
+ }
+ if (cmValue prefix_value = makefile->GetDefinition(
+ cmStrCat("_CMAKE_SYSTEM_PREFIX_PATH_", name, "_PREFIX_VALUE"))) {
+ value = *prefix_value;
+ }
+ }
+ bool valid() const { return count > 0 && !value.empty(); }
+
+ void remove_self(std::vector<std::string>& entries) const
+ {
+ if (this->valid()) {
+ long to_skip = this->count;
+ long index_to_remove = 0;
+ for (const auto& path : entries) {
+ if (path == this->value && --to_skip == 0) {
+ break;
+ }
+ ++index_to_remove;
+ }
+ entries.erase(entries.begin() + index_to_remove);
+ }
+ }
+
+ long count = -1;
+ std::string value;
+};
+}
+
void cmFindBase::FillCMakeSystemVariablePath()
{
cmSearchPath& paths = this->LabeledPaths[PathLabel::CMakeSystem];
// computed by `CMakeSystemSpecificInformation.cmake` while constructing
// `CMAKE_SYSTEM_PREFIX_PATH`. This ensures that if projects / toolchains
// have removed `CMAKE_INSTALL_PREFIX` from the list, we don't remove
- // some other entry by mistake
- long install_prefix_count = -1;
- std::string install_path_to_remove;
- if (cmValue to_skip = this->Makefile->GetDefinition(
- "_CMAKE_SYSTEM_PREFIX_PATH_INSTALL_PREFIX_COUNT")) {
- cmStrToLong(to_skip, &install_prefix_count);
- }
- if (cmValue install_value = this->Makefile->GetDefinition(
- "_CMAKE_SYSTEM_PREFIX_PATH_INSTALL_PREFIX_VALUE")) {
- install_path_to_remove = *install_value;
- }
+ // some other entry by mistake ( likewise for `CMAKE_STAGING_PREFIX` )
+ entry_to_remove install_entry("INSTALL", this->Makefile);
+ entry_to_remove staging_entry("STAGING", this->Makefile);
if (remove_install_prefix && install_prefix_in_list &&
- install_prefix_count > 0 && !install_path_to_remove.empty()) {
+ (install_entry.valid() || staging_entry.valid())) {
cmValue prefix_paths =
this->Makefile->GetDefinition("CMAKE_SYSTEM_PREFIX_PATH");
- // remove entry from CMAKE_SYSTEM_PREFIX_PATH
+ // remove entries from CMAKE_SYSTEM_PREFIX_PATH
std::vector<std::string> expanded = cmExpandedList(*prefix_paths);
- long index_to_remove = 0;
- for (const auto& path : expanded) {
- if (path == install_path_to_remove && --install_prefix_count == 0) {
- break;
- }
- ++index_to_remove;
- }
- expanded.erase(expanded.begin() + index_to_remove);
+ install_entry.remove_self(expanded);
+ staging_entry.remove_self(expanded);
+
paths.AddPrefixPaths(expanded,
this->Makefile->GetCurrentSourceDirectory().c_str());
} else if (add_install_prefix && !install_prefix_in_list) {
-
paths.AddCMakePrefixPath("CMAKE_INSTALL_PREFIX");
+ paths.AddCMakePrefixPath("CMAKE_STAGING_PREFIX");
paths.AddCMakePrefixPath("CMAKE_SYSTEM_PREFIX_PATH");
} else {
// Otherwise the current setup of `CMAKE_SYSTEM_PREFIX_PATH` is correct
}
bool found = false;
for (auto const& sg : headTarget->Makefile->GetSourceGroups()) {
- if (sg.MatchesFiles(path)) {
+ if (sg.MatchChildrenFiles(path)) {
found = true;
break;
}
verifyTarget->SetProperty("UNITY_BUILD", "OFF");
cm::optional<std::map<std::string, cmValue>>
perConfigCompileDefinitions;
- verifyTarget->FinalizeTargetCompileInfo(
+ verifyTarget->FinalizeTargetConfiguration(
this->Makefile->GetCompileDefinitionsEntries(),
perConfigCompileDefinitions);
if (!this->CheckALLOW_DUPLICATE_CUSTOM_TARGETS()) {
return false;
}
- this->FinalizeTargetCompileInfo();
+ this->FinalizeTargetConfiguration();
this->CreateGenerationObjects();
cm::make_unique<cmMSVC60LinkLineComputer>(outputConverter, stateDir));
}
-void cmGlobalGenerator::FinalizeTargetCompileInfo()
+void cmGlobalGenerator::FinalizeTargetConfiguration()
{
std::vector<std::string> const langs =
this->CMakeInstance->GetState()->GetEnabledLanguages();
for (auto& target : mf->GetTargets()) {
cmTarget* t = &target.second;
- t->FinalizeTargetCompileInfo(noConfigCompileDefinitions,
- perConfigCompileDefinitions);
+ t->FinalizeTargetConfiguration(noConfigCompileDefinitions,
+ perConfigCompileDefinitions);
}
// The standard include directories for each language
void WriteSummary();
void WriteSummary(cmGeneratorTarget* target);
- void FinalizeTargetCompileInfo();
+ void FinalizeTargetConfiguration();
virtual void ForceLinkerLanguages();
}
}
} else {
+ linkDir = cmSystemTools::GetParentDirectory(linkDir);
if (std::find(linkSearchPaths.begin(), linkSearchPaths.end(), linkDir) ==
linkSearchPaths.end()) {
linkSearchPaths.push_back(linkDir);
mf.AppendProperty("LINK_LIBRARIES", *i);
}
- mf.CheckProperty("LINK_LIBRARIES");
-
return true;
}
return this->StateSnapshot.GetDirectory().GetPropertyKeys();
}
-void cmMakefile::CheckProperty(const std::string& prop) const
-{
- // Certain properties need checking.
- if (prop == "LINK_LIBRARIES") {
- if (cmValue value = this->GetProperty(prop)) {
- // Look for <LINK_LIBRARY:> internal pattern
- static cmsys::RegularExpression linkPattern(
- "(^|;)(</?LINK_(LIBRARY|GROUP):[^;>]*>)(;|$)");
- if (!linkPattern.find(value)) {
- return;
- }
-
- // Report an error.
- this->IssueMessage(
- MessageType::FATAL_ERROR,
- cmStrCat("Property ", prop, " contains the invalid item \"",
- linkPattern.match(2), "\". The ", prop,
- " property may contain the generator-expression \"$<LINK_",
- linkPattern.match(3),
- ":...>\" which may be used to specify how the libraries are "
- "linked."));
- }
- }
-}
-
cmTarget* cmMakefile::FindLocalNonAliasTarget(const std::string& name) const
{
auto i = this->Targets.find(name);
cmValue GetProperty(const std::string& prop, bool chain) const;
bool GetPropertyAsBool(const std::string& prop) const;
std::vector<std::string> GetPropertyKeys() const;
- void CheckProperty(const std::string& prop) const;
//! Initialize a makefile from its parent
void InitializeFromParent(cmMakefile* parent);
if (this->MocEval().CompFiles.empty()) {
// Placeholder content
- cmCryptoHash hash(cmCryptoHash::AlgoSHA256);
- const std::string hashedPath = hash.HashString(compAbs);
- const std::string functionName =
- "cmake_automoc_silence_linker_warning" + hashedPath;
-
content += "// No files found that require moc or the moc files are "
"included\n"
- "void " +
- functionName + "() {}\n";
+ "enum some_compilers { need_more_than_nothing };\n";
} else {
// Valid content
const bool mc = this->BaseConst().MultiConfig;
return nullptr;
}
+const cmSourceGroup* cmSourceGroup::MatchChildrenFiles(
+ const std::string& name) const
+{
+ if (this->MatchesFiles(name)) {
+ return this;
+ }
+ for (const cmSourceGroup& group : this->Internal->GroupChildren) {
+ const cmSourceGroup* result = group.MatchChildrenFiles(name);
+ if (result) {
+ return result;
+ }
+ }
+ return nullptr;
+}
+
cmSourceGroup* cmSourceGroup::MatchChildrenRegex(const std::string& name)
{
for (cmSourceGroup& group : this->Internal->GroupChildren) {
cmSourceGroup* MatchChildrenFiles(const std::string& name);
/**
+ * Check if the given name matches this group's explicit file list
+ * in children.
+ */
+ const cmSourceGroup* MatchChildrenFiles(const std::string& name) const;
+
+ /**
* Check if the given name matches this group's regex in children.
*/
cmSourceGroup* MatchChildrenRegex(const std::string& name);
}
}
-void cmTarget::FinalizeTargetCompileInfo(
+namespace {
+bool CheckLinkLibraryPattern(cm::string_view property,
+ const std::vector<BT<std::string>>& value,
+ cmake* context)
+{
+ // Look for <LINK_LIBRARY:> and </LINK_LIBRARY:> internal tags
+ static cmsys::RegularExpression linkPattern(
+ "(^|;)(</?LINK_(LIBRARY|GROUP):[^;>]*>)(;|$)");
+
+ bool isValid = true;
+
+ for (const auto& item : value) {
+ if (!linkPattern.find(item.Value)) {
+ continue;
+ }
+
+ isValid = false;
+
+ // Report an error.
+ context->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat(
+ "Property ", property, " contains the invalid item \"",
+ linkPattern.match(2), "\". The ", property,
+ " property may contain the generator-expression \"$<LINK_",
+ linkPattern.match(3),
+ ":...>\" which may be used to specify how the libraries are linked."),
+ item.Backtrace);
+ }
+
+ return isValid;
+}
+}
+
+void cmTarget::FinalizeTargetConfiguration(
const cmBTStringRange& noConfigCompileDefinitions,
cm::optional<std::map<std::string, cmValue>>& perConfigCompileDefinitions)
{
return;
}
+ if (!CheckLinkLibraryPattern("LINK_LIBRARIES"_s,
+ this->impl->LinkImplementationPropertyEntries,
+ this->GetMakefile()->GetCMakeInstance()) ||
+ !CheckLinkLibraryPattern("INTERFACE_LINK_LIBRARIES"_s,
+ this->impl->LinkInterfacePropertyEntries,
+ this->GetMakefile()->GetCMakeInstance()) ||
+ !CheckLinkLibraryPattern("INTERFACE_LINK_LIBRARIES_DIRECT"_s,
+ this->impl->LinkInterfaceDirectPropertyEntries,
+ this->GetMakefile()->GetCMakeInstance())) {
+ return;
+ }
+
this->AppendBuildInterfaceIncludes();
if (this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
}
namespace {
-void CheckLinkLibraryPattern(const std::string& property,
- const std::string& value, cmMakefile* context)
-{
- // Look for <LINK_LIBRARY:> and </LINK_LIBRARY:> internal tags
- static cmsys::RegularExpression linkPattern(
- "(^|;)(</?LINK_(LIBRARY|GROUP):[^;>]*>)(;|$)");
- if (!linkPattern.find(value)) {
- return;
- }
-
- // Report an error.
- context->IssueMessage(
- MessageType::FATAL_ERROR,
- cmStrCat(
- "Property ", property, " contains the invalid item \"",
- linkPattern.match(2), "\". The ", property,
- " property may contain the generator-expression \"$<LINK_",
- linkPattern.match(3),
- ":...>\" which may be used to specify how the libraries are linked."));
-}
-
void CheckLINK_INTERFACE_LIBRARIES(const std::string& prop,
const std::string& value,
cmMakefile* context, bool imported)
}
context->IssueMessage(MessageType::FATAL_ERROR, e.str());
}
-
- CheckLinkLibraryPattern(base, value, context);
-}
-
-void CheckLINK_LIBRARIES(const std::string& value, cmMakefile* context)
-{
- CheckLinkLibraryPattern("LINK_LIBRARIES", value, context);
}
void CheckINTERFACE_LINK_LIBRARIES(const std::string& value,
context->IssueMessage(MessageType::FATAL_ERROR, e.str());
}
-
- CheckLinkLibraryPattern("INTERFACE_LINK_LIBRARIES", value, context);
}
void CheckIMPORTED_GLOBAL(const cmTarget* target, cmMakefile* context)
if (cmValue value = this->GetProperty(prop)) {
CheckLINK_INTERFACE_LIBRARIES(prop, *value, context, true);
}
- } else if (prop == "LINK_LIBRARIES") {
- if (cmValue value = this->GetProperty(prop)) {
- CheckLINK_LIBRARIES(*value, context);
- }
} else if (prop == "INTERFACE_LINK_LIBRARIES") {
if (cmValue value = this->GetProperty(prop)) {
CheckINTERFACE_LINK_LIBRARIES(*value, context);
void InsertPrecompileHeader(BT<std::string> const& entry);
void AppendBuildInterfaceIncludes();
- void FinalizeTargetCompileInfo(
+ void FinalizeTargetConfiguration(
const cmBTStringRange& noConfigCompileDefinitions,
cm::optional<std::map<std::string, cmValue>>& perConfigCompileDefinitions);
target->SetProperty("LINK_INTERFACE_LIBRARIES", "");
}
- target->CheckProperty("LINK_LIBRARIES", &mf);
- target->CheckProperty("INTERFACE_LINK_LIBRARIES", &mf);
-
return true;
}
file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" "
add_test(Truncation_${mode} \"${CMAKE_COMMAND}\" -E echo 123456789)
")
- run_cmake_command(TestOutputTruncation
+ run_cmake_command(TestOutputTruncation_${mode}
${CMAKE_CTEST_COMMAND} -M Experimental -T Test
--no-compress-output
--test-output-size-passed 5
run_TestOutputTruncation("head" "\\.\\.\\.6789")
run_TestOutputTruncation("middle" "12\\.\\.\\..*\\.\\.\\.89")
run_TestOutputTruncation("tail" "12345\\.\\.\\.")
+run_TestOutputTruncation("bad" "")
# Test --stop-on-failure
function(run_stop_on_failure)
--- /dev/null
+^CMake Error: Invalid value for '--test-output-truncation': bad$
--- /dev/null
+include(${RunCMake_SOURCE_DIR}/TestOutputTruncation-check.cmake)
--- /dev/null
+include(${RunCMake_SOURCE_DIR}/TestOutputTruncation-check.cmake)
--- /dev/null
+^Cannot find file: .*/Tests/RunCMake/CTestCommandLine/TestOutputTruncation.*/DartConfiguration.tcl
--- /dev/null
+include(${RunCMake_SOURCE_DIR}/TestOutputTruncation-check.cmake)
--- /dev/null
+^Cannot find file: .*/Tests/RunCMake/CTestCommandLine/TestOutputTruncation.*/DartConfiguration.tcl
# This is expected to be re-routed to a FetchContent_MakeAvailable() call
find_package(AddedProject REQUIRED)
+
+# Verify that find_package() version constraints are fully ignored by the
+# default-generated config version file
+find_package(AddedProject 1.2.3 EXACT REQUIRED)
-CMake Error at forbidden-arguments.cmake:[0-9]+ \(link_libraries\):
- Property LINK_LIBRARIES contains the invalid item "<LINK_GROUP:feat>". The
- LINK_LIBRARIES property may contain the generator-expression
+CMake Error at forbidden-arguments.cmake:[0-9]+ \(add_library\):
+ Property LINK_LIBRARIES contains the invalid item "</LINK_GROUP:feat>".
+ The LINK_LIBRARIES property may contain the generator-expression
"\$<LINK_GROUP:...>" which may be used to specify how the libraries are
linked.
Call Stack \(most recent call first\):
-CMake Error at forbidden-arguments.cmake:[0-9]+ \(link_libraries\):
- Property LINK_LIBRARIES contains the invalid item "<LINK_LIBRARY:feat>".
+CMake Error at forbidden-arguments.cmake:[0-9]+ \(add_library\):
+ Property LINK_LIBRARIES contains the invalid item "</LINK_LIBRARY:feat>".
The LINK_LIBRARIES property may contain the generator-expression
"\$<LINK_LIBRARY:...>" which may be used to specify how the libraries are
linked.
include(RunCMake)
+# Do not let ccache modify paths checked by the test cases.
+unset(ENV{CCACHE_BASEDIR})
+
function(run_symlink_test_case)
file(REMOVE_RECURSE
"${RunCMake_TEST_BINARY_DIR}/CMakeCache.txt"
run_cmake(RuntimeLibrary)
run_cmake(SourceGroupCMakeLists)
run_cmake(SourceGroupTreeCMakeLists)
+run_cmake(SourceGroupFileSet)
run_cmake(VsConfigurationType)
run_cmake(VsTargetsFileReferences)
run_cmake(VsCustomProps)
--- /dev/null
+cmake_policy(SET CMP0011 NEW)
+
+set(vcFiltersFile "${RunCMake_TEST_BINARY_DIR}/SourceGroupFileSet.vcxproj.filters")
+if(NOT EXISTS "${vcFiltersFile}")
+ set(RunCMake_TEST_FAILED "Filters file ${vcFiltersFile} does not exist.")
+ return()
+endif()
+
+file(STRINGS "${vcFiltersFile}" lines)
+
+include(${RunCMake_TEST_SOURCE_DIR}/SourceGroupHelpers.cmake)
+
+find_source_group("${lines}" "Header Files\\SourceGroupFileSet")
--- /dev/null
+add_library(SourceGroupFileSet INTERFACE)
+target_sources(SourceGroupFileSet PUBLIC FILE_SET HEADERS FILES iface.h)
+source_group("Header Files/SourceGroupFileSet" FILES iface.h)
function(find_source_group LINES NAME)
set(foundFileFilter 0)
set(foundFilter 0)
+ string(REPLACE "\\" "\\\\" regexName "${NAME}")
foreach(line IN LISTS LINES)
- if(line MATCHES "<Filter>${NAME}</Filter>")
+ if(line MATCHES "<Filter>${regexName}</Filter>")
if(foundFileFilter)
set(RunCMake_TEST_FAILED "Multiple files listed with filter for ${NAME}." PARENT_SCOPE)
set(FILTER_FOUND 0 PARENT_SCOPE)
endif()
set(foundFileFilter 1)
endif()
- if(line MATCHES "<Filter.*Include=\"${NAME}\"")
+ if(line MATCHES "<Filter.*Include=\"${regexName}\"")
if(foundFilter)
set(RunCMake_TEST_FAILED "Multiple copies of ${NAME} filter listed." PARENT_SCOPE)
set(FILTER_FOUND 0 PARENT_SCOPE)
"SourcesPrefix\\PrefixedNested"
)
-foreach(GROUP_NAME IN LISTS ${SOURCE_GROUPS_TO_FIND})
+foreach(GROUP_NAME IN LISTS SOURCE_GROUPS_TO_FIND)
find_source_group("${lines}" ${GROUP_NAME})
- if(NOT ${FILTER_FOUND})
+ if(NOT FILTER_FOUND)
return()
endif()
endforeach()
--- /dev/null
+cmake_minimum_required(VERSION 3.23)
+
+project(BundleLinkBundle CXX)
+
+add_subdirectory(lib_bundle)
+
+add_executable(MainBundle MACOSX_BUNDLE main_bundle.cpp)
+
+target_link_libraries(MainBundle PRIVATE LibBundle)
+
+set_target_properties(MainBundle PROPERTIES
+ MACOSX_BUNDLE "YES"
+ XCODE_LINK_BUILD_PHASE_MODE BUILT_ONLY
+)
XcodeXCConfig()
+function(BundleLinkBundle)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/BundleLinkBundle-build)
+ run_cmake(BundleLinkBundle)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(BundleLinkBundle-build ${CMAKE_COMMAND} --build .)
+endfunction()
+
+BundleLinkBundle()
+
+
# Isolate device tests from host architecture selection.
unset(ENV{CMAKE_OSX_ARCHITECTURES})
--- /dev/null
+
+add_library(LibBundle lib_bundle.cpp)
+
+set_target_properties(LibBundle PROPERTIES
+ MACOSX_BUNDLE YES)
--- /dev/null
+#include <iostream>
+
+void foo()
+{
+ std::cout << "foobar" << std::endl;
+}
--- /dev/null
+
+extern void foo();
+
+int main()
+{
+
+ foo();
+ return 0;
+}
function(run_TestOutputTruncation mode expected)
set(CASE_CTEST_TEST_ARGS EXCLUDE RunCMakeVersion)
set(TRUNCATED_OUTPUT ${expected}) # used in TestOutputTruncation-check.cmake
- set(CASE_TEST_PREFIX_CODE [[
-set( CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION${mode})
- ]])
- set(CASE_CMAKELISTS_SUFFIX_CODE [[
-add_test(NAME Truncation_${mode} COMMAND ${CMAKE_COMMAND} -E echo 123456789)
- ]])
+ string(CONCAT CASE_TEST_PREFIX_CODE "
+set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 5)
+set(CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION ${mode})" )
+ set(CASE_CMAKELISTS_SUFFIX_CODE "
+add_test(NAME Truncation_${mode} COMMAND \${CMAKE_COMMAND} -E echo 123456789)")
- run_ctest(TestOutputTruncation)
+ run_ctest(TestOutputTruncation_${mode})
endfunction()
-run_TestOutputTruncation("head" "...6789")
-run_TestOutputTruncation("middle" "12....*...89")
-run_TestOutputTruncation("tail" "12345...")
+run_TestOutputTruncation("head" "\\.\\.\\.6789")
+run_TestOutputTruncation("middle" "12\\.\\.\\..*\\.\\.\\.89")
+run_TestOutputTruncation("tail" "12345\\.\\.\\.")
+run_TestOutputTruncation("bad" "")
run_ctest_test(TestRepeatBad1 REPEAT UNKNOWN:3)
run_ctest_test(TestRepeatBad2 REPEAT UNTIL_FAIL:-1)
--- /dev/null
+file(GLOB test_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Test.xml")
+if(test_xml_file)
+ set(RunCMake_TEST_FAILED "Test.xml should not exist:\n ${test_xml_file}")
+endif()
--- /dev/null
+^Invalid value for CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION: bad$
--- /dev/null
+include(${RunCMake_SOURCE_DIR}/TestOutputTruncation-check.cmake)
--- /dev/null
+include(${RunCMake_SOURCE_DIR}/TestOutputTruncation-check.cmake)
--- /dev/null
+include(${RunCMake_SOURCE_DIR}/TestOutputTruncation-check.cmake)
--- /dev/null
+ find_library called with the following settings:.*
+ VAR: CREATED_LIBRARY
+ NAMES: \"created\"
+ Documentation.*
+ Framework.*
+ AppBundle.*
+ CMAKE_FIND_USE_CMAKE_PATH: 1
+ CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
+ CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1
+ CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+ CMAKE_FIND_USE_INSTALL_PREFIX: 0
+
+ find_library considered the following locations:.*
+ The item was not found.*
+ find_library called with the following settings:.*
+ VAR: CREATED_LIBRARY
+ NAMES: \"created\"
+ Documentation.*
+ Framework.*
+ AppBundle.*
+ CMAKE_FIND_USE_CMAKE_PATH: 1
+ CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
+ CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1
+ CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+ CMAKE_FIND_USE_INSTALL_PREFIX: 1
+
+ find_library considered the following locations:.*
+ The item was found at.*
+ .*IgnoreStagingAndInstallPrefix-build/lib.*
+ find_library called with the following settings:.*
+ VAR: CREATED_LIBRARY
+ NAMES: \"created\"
+ Documentation.*
+ Framework.*
+ AppBundle.*
+ CMAKE_FIND_USE_CMAKE_PATH: 1
+ CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
+ CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1
+ CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+ CMAKE_FIND_USE_INSTALL_PREFIX: 0
+
+ find_library considered the following locations:.*
+ The item was not found.*
--- /dev/null
+-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND'
+-- CREATED_LIBRARY='[^']*/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix-build/lib/libcreated.a'
+-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND'
--- /dev/null
+include(IgnoreInstallPrefix.cmake)
--- /dev/null
+ find_library called with the following settings:.*
+ VAR: CREATED_LIBRARY
+ NAMES: \"created\"
+ Documentation.*
+ Framework.*
+ AppBundle.*
+ CMAKE_FIND_USE_CMAKE_PATH: 1
+ CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
+ CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1
+ CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+ CMAKE_FIND_USE_INSTALL_PREFIX: 0
+
+ find_library considered the following locations:.*
+ The item was not found.*
+ find_library called with the following settings:.*
+ VAR: CREATED_LIBRARY
+ NAMES: \"created\"
+ Documentation.*
+ Framework.*
+ AppBundle.*
+ CMAKE_FIND_USE_CMAKE_PATH: 1
+ CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
+ CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1
+ CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+ CMAKE_FIND_USE_INSTALL_PREFIX: 1
+
+ find_library considered the following locations:.*
+ The item was found at.*
+ .*IgnoreStagingPrefix-build/lib.*
+ find_library called with the following settings:.*
+ VAR: CREATED_LIBRARY
+ NAMES: \"created\"
+ Documentation.*
+ Framework.*
+ AppBundle.*
+ CMAKE_FIND_USE_CMAKE_PATH: 1
+ CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
+ CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1
+ CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+ CMAKE_FIND_USE_INSTALL_PREFIX: 0
+
+ find_library considered the following locations:.*
+ The item was not found.*
--- /dev/null
+-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND'
+-- CREATED_LIBRARY='[^']*/Tests/RunCMake/find_library/IgnoreStagingPrefix-build/lib/libcreated.a'
+-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND'
--- /dev/null
+include(IgnoreInstallPrefix.cmake)
run_cmake(FromPrefixPath)
run_cmake(FromPATHEnv)
run_cmake_with_options(IgnoreInstallPrefix "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/IgnoreInstallPrefix-build/")
+run_cmake_with_options(IgnoreStagingPrefix "-DCMAKE_STAGING_PREFIX=${RunCMake_BINARY_DIR}/IgnoreStagingPrefix-build/")
+run_cmake_with_options(IgnoreStagingAndInstallPrefix "-DCMAKE_STAGING_PREFIX=${RunCMake_BINARY_DIR}/IgnoreStagingAndInstallPrefix-build/" "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/IgnoreStagingAndInstallPrefix-build/")
if(UNIX AND NOT CYGWIN)
run_cmake(LibArchLink)
run_cmake(LibSymLink)