From 0fcbd26aaf0d3b76521778eb1a2f839850b53ee2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20R=C3=B6hling?= Date: Tue, 13 Sep 2022 21:35:23 +0200 Subject: [PATCH] New upstream version 3.24.2 --- Help/command/FIND_XXX.txt | 3 +- Help/command/FIND_XXX_REGISTRY_VIEW.txt | 32 ++-- Help/command/ctest_test.rst | 7 +- Help/command/find_package.rst | 9 +- Help/manual/cmake-developer.7.rst | 143 ++++++++++-------- Help/manual/cmake-language.7.rst | 14 +- Help/manual/cmake-policies.7.rst | 2 +- Help/policy/CMP0134.rst | 5 +- Help/release/3.24.rst | 6 +- .../CMAKE_FIND_USE_INSTALL_PREFIX.rst | 3 +- Modules/CMakeSystemSpecificInformation.cmake | 12 +- Modules/ExternalProject.cmake | 3 + Modules/FetchContent.cmake | 23 +-- .../package-config-version.cmake.in | 5 +- Modules/FindBoost.cmake | 4 +- Modules/FindCUDAToolkit.cmake | 39 ++--- Modules/FindPostgreSQL.cmake | 3 + Modules/FindZLIB.cmake | 24 ++- Modules/FortranCInterface/CMakeLists.txt | 2 + Modules/FortranCInterface/Detect.cmake | 6 +- Source/CMakeVersion.cmake | 4 +- Source/CTest/cmCTestTestHandler.cxx | 6 +- Source/cmFindBase.cxx | 68 ++++++--- Source/cmGeneratorTarget.cxx | 4 +- Source/cmGlobalGenerator.cxx | 8 +- Source/cmGlobalGenerator.h | 2 +- Source/cmGlobalXCodeGenerator.cxx | 1 + Source/cmLinkLibrariesCommand.cxx | 2 - Source/cmMakefile.cxx | 25 --- Source/cmMakefile.h | 1 - Source/cmQtAutoMocUic.cxx | 8 +- Source/cmSourceGroup.cxx | 15 ++ Source/cmSourceGroup.h | 6 + Source/cmTarget.cxx | 82 +++++----- Source/cmTarget.h | 2 +- Source/cmTargetLinkLibrariesCommand.cxx | 3 - .../CTestCommandLine/RunCMakeTest.cmake | 3 +- .../TestOutputTruncation_bad-result.txt | 1 + .../TestOutputTruncation_bad-stderr.txt | 1 + .../TestOutputTruncation_head-check.cmake | 1 + ...t => TestOutputTruncation_head-stderr.txt} | 0 .../TestOutputTruncation_middle-check.cmake | 1 + .../TestOutputTruncation_middle-stderr.txt | 1 + .../TestOutputTruncation_tail-check.cmake | 1 + .../TestOutputTruncation_tail-stderr.txt | 1 + .../PreferFetchContent.cmake | 4 + .../forbidden-arguments-stderr.txt | 6 +- .../forbidden-arguments-stderr.txt | 4 +- .../RunCMake/SymlinkTrees/RunCMakeTest.cmake | 3 + Tests/RunCMake/VS10Project/RunCMakeTest.cmake | 1 + .../SourceGroupFileSet-check.cmake | 13 ++ .../VS10Project/SourceGroupFileSet.cmake | 3 + .../VS10Project/SourceGroupHelpers.cmake | 5 +- .../SourceGroupTreeCMakeLists-check.cmake | 4 +- .../XcodeProject/BundleLinkBundle.cmake | 14 ++ .../RunCMake/XcodeProject/RunCMakeTest.cmake | 10 ++ .../XcodeProject/lib_bundle/CMakeLIsts.txt | 5 + .../XcodeProject/lib_bundle/lib_bundle.cpp | 6 + Tests/RunCMake/XcodeProject/main_bundle.cpp | 9 ++ Tests/RunCMake/ctest_test/RunCMakeTest.cmake | 20 +-- .../TestOutputTruncation_bad-check.cmake | 4 + .../TestOutputTruncation_bad-result.txt | 1 + .../TestOutputTruncation_bad-stderr.txt | 1 + .../TestOutputTruncation_head-check.cmake | 1 + .../TestOutputTruncation_middle-check.cmake | 1 + .../TestOutputTruncation_tail-check.cmake | 1 + .../IgnoreStagingAndInstallPrefix-stderr.txt | 43 ++++++ .../IgnoreStagingAndInstallPrefix-stdout.txt | 3 + .../IgnoreStagingAndInstallPrefix.cmake | 1 + .../IgnoreStagingPrefix-stderr.txt | 43 ++++++ .../IgnoreStagingPrefix-stdout.txt | 3 + .../find_library/IgnoreStagingPrefix.cmake | 1 + .../RunCMake/find_library/RunCMakeTest.cmake | 2 + 73 files changed, 535 insertions(+), 269 deletions(-) create mode 100644 Tests/RunCMake/CTestCommandLine/TestOutputTruncation_bad-result.txt create mode 100644 Tests/RunCMake/CTestCommandLine/TestOutputTruncation_bad-stderr.txt create mode 100644 Tests/RunCMake/CTestCommandLine/TestOutputTruncation_head-check.cmake rename Tests/RunCMake/CTestCommandLine/{TestOutputTruncation-stderr.txt => TestOutputTruncation_head-stderr.txt} (100%) create mode 100644 Tests/RunCMake/CTestCommandLine/TestOutputTruncation_middle-check.cmake create mode 100644 Tests/RunCMake/CTestCommandLine/TestOutputTruncation_middle-stderr.txt create mode 100644 Tests/RunCMake/CTestCommandLine/TestOutputTruncation_tail-check.cmake create mode 100644 Tests/RunCMake/CTestCommandLine/TestOutputTruncation_tail-stderr.txt create mode 100644 Tests/RunCMake/VS10Project/SourceGroupFileSet-check.cmake create mode 100644 Tests/RunCMake/VS10Project/SourceGroupFileSet.cmake create mode 100644 Tests/RunCMake/XcodeProject/BundleLinkBundle.cmake create mode 100644 Tests/RunCMake/XcodeProject/lib_bundle/CMakeLIsts.txt create mode 100644 Tests/RunCMake/XcodeProject/lib_bundle/lib_bundle.cpp create mode 100644 Tests/RunCMake/XcodeProject/main_bundle.cpp create mode 100644 Tests/RunCMake/ctest_test/TestOutputTruncation_bad-check.cmake create mode 100644 Tests/RunCMake/ctest_test/TestOutputTruncation_bad-result.txt create mode 100644 Tests/RunCMake/ctest_test/TestOutputTruncation_bad-stderr.txt create mode 100644 Tests/RunCMake/ctest_test/TestOutputTruncation_head-check.cmake create mode 100644 Tests/RunCMake/ctest_test/TestOutputTruncation_middle-check.cmake create mode 100644 Tests/RunCMake/ctest_test/TestOutputTruncation_tail-check.cmake create mode 100644 Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix-stderr.txt create mode 100644 Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix-stdout.txt create mode 100644 Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix.cmake create mode 100644 Tests/RunCMake/find_library/IgnoreStagingPrefix-stderr.txt create mode 100644 Tests/RunCMake/find_library/IgnoreStagingPrefix-stdout.txt create mode 100644 Tests/RunCMake/find_library/IgnoreStagingPrefix.cmake diff --git a/Help/command/FIND_XXX.txt b/Help/command/FIND_XXX.txt index 83860b792..cd3c78baf 100644 --- a/Help/command/FIND_XXX.txt +++ b/Help/command/FIND_XXX.txt @@ -166,7 +166,8 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows: * |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 diff --git a/Help/command/FIND_XXX_REGISTRY_VIEW.txt b/Help/command/FIND_XXX_REGISTRY_VIEW.txt index 39b156f61..6cab1d13a 100644 --- a/Help/command/FIND_XXX_REGISTRY_VIEW.txt +++ b/Help/command/FIND_XXX_REGISTRY_VIEW.txt @@ -1,15 +1,15 @@ 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. @@ -18,24 +18,24 @@ policy is ``OLD`` or undefined. 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`` diff --git a/Help/command/ctest_test.rst b/Help/command/ctest_test.rst index 11ebdbd3d..65f82d703 100644 --- a/Help/command/ctest_test.rst +++ b/Help/command/ctest_test.rst @@ -174,7 +174,10 @@ The options are: 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`: @@ -236,7 +239,7 @@ The following example demonstrates how to upload test images to CDash. "/dir/to/valid_img.gif" << std::endl; std::cout << - " << + "" << "/dir/to/img.png" << std::endl; diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst index ee52c4189..c96d84e18 100644 --- a/Help/command/find_package.rst +++ b/Help/command/find_package.rst @@ -142,9 +142,9 @@ should find all components, no components or some well-defined subset of the 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 @@ -412,7 +412,8 @@ enabled. 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 diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst index 2c6cd9628..0f3c30a1c 100644 --- a/Help/manual/cmake-developer.7.rst +++ b/Help/manual/cmake-developer.7.rst @@ -18,6 +18,85 @@ See https://cmake.org/get-involved/ to get involved in development of 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) ` 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 `_ 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: + +.. 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 @@ -242,70 +321,6 @@ backwards compatibility for any old names that were actually in use. 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 `_ 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: - -.. 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 -------------------- diff --git a/Help/manual/cmake-language.7.rst b/Help/manual/cmake-language.7.rst index 02cfa7e5f..16917ffd6 100644 --- a/Help/manual/cmake-language.7.rst +++ b/Help/manual/cmake-language.7.rst @@ -391,8 +391,8 @@ Variable References A *variable reference* has the form ``${}`` 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}``. @@ -408,14 +408,16 @@ and how their values are set. An *environment variable reference* has the form ``$ENV{}``. See the `Environment Variables`_ section for more information. -A *cache variable reference* has the form ``$CACHE{}``. +A *cache variable reference* has the form ``$CACHE{}``, +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 ```` -instead of ``${}``. -However, environment and cache variables always need to be -referenced as ``$ENV{}`` or ``$CACHE{}``. +instead of ``${}``. However, environment variables +always need to be referenced as ``$ENV{}``. Comments -------- diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 43eb20037..f6ab0c7fb 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -63,7 +63,7 @@ Policies Introduced by CMake 3.24 CMP0137: try_compile() passes platform variables in project mode. CMP0136: Watcom runtime library flags are selected by an abstraction. CMP0135: ExternalProject ignores timestamps in archives by default for the URL download method. - CMP0134: Fallback to \"HOST\" Windows registry view when \"TARGET\" view is not usable. + CMP0134: Fallback to "HOST" Windows registry view when "TARGET" view is not usable. CMP0133: The CPack module disables SLA by default in the CPack DragNDrop Generator. CMP0132: Do not set compiler environment variables on first run. CMP0131: LINK_LIBRARIES supports the LINK_ONLY generator expression. diff --git a/Help/policy/CMP0134.rst b/Help/policy/CMP0134.rst index 2b562bc1a..a94012c8c 100644 --- a/Help/policy/CMP0134.rst +++ b/Help/policy/CMP0134.rst @@ -31,9 +31,6 @@ The ``NEW`` behavior for this policy is to use registry views ``TARGET`` and 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 >` -variable to control the warning. +when this policy is not set and simply uses ``OLD`` behavior. .. include:: DEPRECATED.txt diff --git a/Help/release/3.24.rst b/Help/release/3.24.rst index ecf6f1cc5..3857c5d26 100644 --- a/Help/release/3.24.rst +++ b/Help/release/3.24.rst @@ -359,9 +359,9 @@ Updates 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. diff --git a/Help/variable/CMAKE_FIND_USE_INSTALL_PREFIX.rst b/Help/variable/CMAKE_FIND_USE_INSTALL_PREFIX.rst index 8494e9549..d577a8acd 100644 --- a/Help/variable/CMAKE_FIND_USE_INSTALL_PREFIX.rst +++ b/Help/variable/CMAKE_FIND_USE_INSTALL_PREFIX.rst @@ -4,7 +4,8 @@ CMAKE_FIND_USE_INSTALL_PREFIX .. 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` diff --git a/Modules/CMakeSystemSpecificInformation.cmake b/Modules/CMakeSystemSpecificInformation.cmake index 59f552ab4..e0459321c 100644 --- a/Modules/CMakeSystemSpecificInformation.cmake +++ b/Modules/CMakeSystemSpecificInformation.cmake @@ -19,13 +19,19 @@ set(WIN32 ) 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 diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index c7948cddf..995265803 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -301,6 +301,9 @@ External Project Definition 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 `` The optional name of the remote. If this option is not specified, it defaults to ``origin``. diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake index d016fb5ae..995e69a93 100644 --- a/Modules/FetchContent.cmake +++ b/Modules/FetchContent.cmake @@ -303,13 +303,16 @@ Commands ``-extra.cmake`` or ``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 ``-extra.cmake`` or ``Extra.cmake`` file to perform custom processing or define any variables that their normal (installed) package config file would @@ -772,7 +775,7 @@ to the declared details and leaving 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 @@ -786,7 +789,7 @@ to the declared details and leaving 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 @@ -822,7 +825,7 @@ details: 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. @@ -830,9 +833,9 @@ 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) @@ -1893,13 +1896,13 @@ macro(FetchContent_MakeAvailable) 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) diff --git a/Modules/FetchContent/package-config-version.cmake.in b/Modules/FetchContent/package-config-version.cmake.in index 7f190944c..9fcade71c 100644 --- a/Modules/FetchContent/package-config-version.cmake.in +++ b/Modules/FetchContent/package-config-version.cmake.in @@ -1,5 +1,8 @@ # 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) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 0f407c8c6..0cea239ac 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -1380,7 +1380,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) 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() @@ -1653,7 +1653,7 @@ else() # _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" diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake index 538e13241..5f83ccc3d 100644 --- a/Modules/FindCUDAToolkit.cmake +++ b/Modules/FindCUDAToolkit.cmake @@ -927,7 +927,7 @@ if(CUDAToolkit_FOUND) 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() @@ -935,8 +935,11 @@ if(CUDAToolkit_FOUND) 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 @@ -947,25 +950,25 @@ if(CUDAToolkit_FOUND) 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) @@ -980,7 +983,7 @@ if(CUDAToolkit_FOUND) 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) diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake index 2233aa05f..c92fbdcd2 100644 --- a/Modules/FindPostgreSQL.cmake +++ b/Modules/FindPostgreSQL.cmake @@ -121,13 +121,16 @@ foreach(suffix ${PostgreSQL_KNOWN_VERSIONS}) 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() diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake index f50116fc4..be5c775b2 100644 --- a/Modules/FindZLIB.cmake +++ b/Modules/FindZLIB.cmake @@ -92,8 +92,16 @@ endforeach() # 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") @@ -114,8 +122,16 @@ if(NOT ZLIB_LIBRARY) 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) diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt index fb35ff0a6..4bd7006ef 100644 --- a/Modules/FortranCInterface/CMakeLists.txt +++ b/Modules/FortranCInterface/CMakeLists.txt @@ -43,6 +43,8 @@ set(module_symbols 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) diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake index 72e554490..567fc3727 100644 --- a/Modules/FortranCInterface/Detect.cmake +++ b/Modules/FortranCInterface/Detect.cmake @@ -95,8 +95,8 @@ set(_case_MYSUB "UPPER") 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}) @@ -115,7 +115,7 @@ 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}") diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e467a3d8d..665feebc4 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 24) -set(CMake_VERSION_PATCH 1) +set(CMake_VERSION_PATCH 2) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) @@ -21,7 +21,7 @@ endif() 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]* " diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index d1fad6290..daaf5fdca 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -363,7 +363,11 @@ void cmCTestTestHandler::PopulateCustomVectors(cmMakefile* mf) 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); + } } } diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 4dfbef98d..1da995a4b 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -278,6 +278,43 @@ void cmFindBase::FillSystemEnvironmentPath() 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& 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]; @@ -298,38 +335,25 @@ void cmFindBase::FillCMakeSystemVariablePath() // 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 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 diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 0c351adac..6235a2ae9 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1702,7 +1702,7 @@ void addFileSetEntry(cmGeneratorTarget const* headTarget, } bool found = false; for (auto const& sg : headTarget->Makefile->GetSourceGroups()) { - if (sg.MatchesFiles(path)) { + if (sg.MatchChildrenFiles(path)) { found = true; break; } @@ -8622,7 +8622,7 @@ bool cmGeneratorTarget::AddHeaderSetVerification() verifyTarget->SetProperty("UNITY_BUILD", "OFF"); cm::optional> perConfigCompileDefinitions; - verifyTarget->FinalizeTargetCompileInfo( + verifyTarget->FinalizeTargetConfiguration( this->Makefile->GetCompileDefinitionsEntries(), perConfigCompileDefinitions); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 4feae6d80..254220b24 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1501,7 +1501,7 @@ bool cmGlobalGenerator::Compute() if (!this->CheckALLOW_DUPLICATE_CUSTOM_TARGETS()) { return false; } - this->FinalizeTargetCompileInfo(); + this->FinalizeTargetConfiguration(); this->CreateGenerationObjects(); @@ -1825,7 +1825,7 @@ cmGlobalGenerator::CreateMSVC60LinkLineComputer( cm::make_unique(outputConverter, stateDir)); } -void cmGlobalGenerator::FinalizeTargetCompileInfo() +void cmGlobalGenerator::FinalizeTargetConfiguration() { std::vector const langs = this->CMakeInstance->GetState()->GetEnabledLanguages(); @@ -1838,8 +1838,8 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo() for (auto& target : mf->GetTargets()) { cmTarget* t = &target.second; - t->FinalizeTargetCompileInfo(noConfigCompileDefinitions, - perConfigCompileDefinitions); + t->FinalizeTargetConfiguration(noConfigCompileDefinitions, + perConfigCompileDefinitions); } // The standard include directories for each language diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index dcef070c6..6e3072bf5 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -694,7 +694,7 @@ private: void WriteSummary(); void WriteSummary(cmGeneratorTarget* target); - void FinalizeTargetCompileInfo(); + void FinalizeTargetConfiguration(); virtual void ForceLinkerLanguages(); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index d5783efc7..b9bbb67c4 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3622,6 +3622,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) } } } else { + linkDir = cmSystemTools::GetParentDirectory(linkDir); if (std::find(linkSearchPaths.begin(), linkSearchPaths.end(), linkDir) == linkSearchPaths.end()) { linkSearchPaths.push_back(linkDir); diff --git a/Source/cmLinkLibrariesCommand.cxx b/Source/cmLinkLibrariesCommand.cxx index ed89e916c..2b8f83622 100644 --- a/Source/cmLinkLibrariesCommand.cxx +++ b/Source/cmLinkLibrariesCommand.cxx @@ -35,7 +35,5 @@ bool cmLinkLibrariesCommand(std::vector const& args, mf.AppendProperty("LINK_LIBRARIES", *i); } - mf.CheckProperty("LINK_LIBRARIES"); - return true; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 628eb1d18..469eac3e5 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3987,31 +3987,6 @@ std::vector cmMakefile::GetPropertyKeys() const 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 internal pattern - static cmsys::RegularExpression linkPattern( - "(^|;)(]*>)(;|$)"); - 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 \"$\" 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); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index e7b9716df..27838b29e 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -794,7 +794,6 @@ public: cmValue GetProperty(const std::string& prop, bool chain) const; bool GetPropertyAsBool(const std::string& prop) const; std::vector GetPropertyKeys() const; - void CheckProperty(const std::string& prop) const; //! Initialize a makefile from its parent void InitializeFromParent(cmMakefile* parent); diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index 8c09b5699..4753e61f1 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -2175,15 +2175,9 @@ void cmQtAutoMocUicT::JobMocsCompilationT::Process() 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; diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx index 155068cbe..6019de122 100644 --- a/Source/cmSourceGroup.cxx +++ b/Source/cmSourceGroup.cxx @@ -124,6 +124,21 @@ cmSourceGroup* cmSourceGroup::MatchChildrenFiles(const std::string& name) 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) { diff --git a/Source/cmSourceGroup.h b/Source/cmSourceGroup.h index 295240d77..9ce71c7b1 100644 --- a/Source/cmSourceGroup.h +++ b/Source/cmSourceGroup.h @@ -79,6 +79,12 @@ public: */ 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. */ diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 62ec344e6..cbe5d7d8d 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1881,7 +1881,41 @@ void cmTarget::AppendBuildInterfaceIncludes() } } -void cmTarget::FinalizeTargetCompileInfo( +namespace { +bool CheckLinkLibraryPattern(cm::string_view property, + const std::vector>& value, + cmake* context) +{ + // Look for and internal tags + static cmsys::RegularExpression linkPattern( + "(^|;)(]*>)(;|$)"); + + 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 \"$\" which may be used to specify how the libraries are linked."), + item.Backtrace); + } + + return isValid; +} +} + +void cmTarget::FinalizeTargetConfiguration( const cmBTStringRange& noConfigCompileDefinitions, cm::optional>& perConfigCompileDefinitions) { @@ -1889,6 +1923,18 @@ void cmTarget::FinalizeTargetCompileInfo( 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) { @@ -1969,27 +2015,6 @@ void cmTarget::InsertPrecompileHeader(BT const& entry) } namespace { -void CheckLinkLibraryPattern(const std::string& property, - const std::string& value, cmMakefile* context) -{ - // Look for and internal tags - static cmsys::RegularExpression linkPattern( - "(^|;)(]*>)(;|$)"); - 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 \"$\" 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) @@ -2024,13 +2049,6 @@ void CheckLINK_INTERFACE_LIBRARIES(const std::string& prop, } 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, @@ -2051,8 +2069,6 @@ 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) @@ -2085,10 +2101,6 @@ void cmTarget::CheckProperty(const std::string& prop, 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); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 37701f07c..467c4dabd 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -236,7 +236,7 @@ public: void InsertPrecompileHeader(BT const& entry); void AppendBuildInterfaceIncludes(); - void FinalizeTargetCompileInfo( + void FinalizeTargetConfiguration( const cmBTStringRange& noConfigCompileDefinitions, cm::optional>& perConfigCompileDefinitions); diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index ba901d0f8..af870dada 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -379,9 +379,6 @@ bool cmTargetLinkLibrariesCommand(std::vector const& args, target->SetProperty("LINK_INTERFACE_LIBRARIES", ""); } - target->CheckProperty("LINK_LIBRARIES", &mf); - target->CheckProperty("INTERFACE_LINK_LIBRARIES", &mf); - return true; } diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 8ac174759..df3e82af7 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -284,7 +284,7 @@ function(run_TestOutputTruncation mode expected) 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 @@ -294,6 +294,7 @@ endfunction() 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) diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_bad-result.txt b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_bad-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_bad-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_bad-stderr.txt b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_bad-stderr.txt new file mode 100644 index 000000000..6afc02bfe --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_bad-stderr.txt @@ -0,0 +1 @@ +^CMake Error: Invalid value for '--test-output-truncation': bad$ diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_head-check.cmake b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_head-check.cmake new file mode 100644 index 000000000..6065c30f6 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_head-check.cmake @@ -0,0 +1 @@ +include(${RunCMake_SOURCE_DIR}/TestOutputTruncation-check.cmake) diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation-stderr.txt b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_head-stderr.txt similarity index 100% rename from Tests/RunCMake/CTestCommandLine/TestOutputTruncation-stderr.txt rename to Tests/RunCMake/CTestCommandLine/TestOutputTruncation_head-stderr.txt diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_middle-check.cmake b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_middle-check.cmake new file mode 100644 index 000000000..6065c30f6 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_middle-check.cmake @@ -0,0 +1 @@ +include(${RunCMake_SOURCE_DIR}/TestOutputTruncation-check.cmake) diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_middle-stderr.txt b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_middle-stderr.txt new file mode 100644 index 000000000..30b46ce49 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_middle-stderr.txt @@ -0,0 +1 @@ +^Cannot find file: .*/Tests/RunCMake/CTestCommandLine/TestOutputTruncation.*/DartConfiguration.tcl diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_tail-check.cmake b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_tail-check.cmake new file mode 100644 index 000000000..6065c30f6 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_tail-check.cmake @@ -0,0 +1 @@ +include(${RunCMake_SOURCE_DIR}/TestOutputTruncation-check.cmake) diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_tail-stderr.txt b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_tail-stderr.txt new file mode 100644 index 000000000..30b46ce49 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestOutputTruncation_tail-stderr.txt @@ -0,0 +1 @@ +^Cannot find file: .*/Tests/RunCMake/CTestCommandLine/TestOutputTruncation.*/DartConfiguration.tcl diff --git a/Tests/RunCMake/FetchContent_find_package/PreferFetchContent.cmake b/Tests/RunCMake/FetchContent_find_package/PreferFetchContent.cmake index c1030fbf4..4943f9e20 100644 --- a/Tests/RunCMake/FetchContent_find_package/PreferFetchContent.cmake +++ b/Tests/RunCMake/FetchContent_find_package/PreferFetchContent.cmake @@ -18,3 +18,7 @@ message(STATUS "Lowercase extra file was read") # 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) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/forbidden-arguments-stderr.txt b/Tests/RunCMake/GenEx-LINK_GROUP/forbidden-arguments-stderr.txt index bae65050f..b29303b26 100644 --- a/Tests/RunCMake/GenEx-LINK_GROUP/forbidden-arguments-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_GROUP/forbidden-arguments-stderr.txt @@ -1,6 +1,6 @@ -CMake Error at forbidden-arguments.cmake:[0-9]+ \(link_libraries\): - Property LINK_LIBRARIES contains the invalid item "". 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 "". + The LINK_LIBRARIES property may contain the generator-expression "\$" which may be used to specify how the libraries are linked. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/forbidden-arguments-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/forbidden-arguments-stderr.txt index 5245dd8a3..fc8e383fd 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/forbidden-arguments-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/forbidden-arguments-stderr.txt @@ -1,5 +1,5 @@ -CMake Error at forbidden-arguments.cmake:[0-9]+ \(link_libraries\): - Property LINK_LIBRARIES contains the invalid item "". +CMake Error at forbidden-arguments.cmake:[0-9]+ \(add_library\): + Property LINK_LIBRARIES contains the invalid item "". The LINK_LIBRARIES property may contain the generator-expression "\$" which may be used to specify how the libraries are linked. diff --git a/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake b/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake index e5bfac484..58a111a97 100644 --- a/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake +++ b/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake @@ -1,5 +1,8 @@ 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" diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index ee8821ad3..e540b9fc4 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -16,6 +16,7 @@ run_cmake(NoImpLib) run_cmake(RuntimeLibrary) run_cmake(SourceGroupCMakeLists) run_cmake(SourceGroupTreeCMakeLists) +run_cmake(SourceGroupFileSet) run_cmake(VsConfigurationType) run_cmake(VsTargetsFileReferences) run_cmake(VsCustomProps) diff --git a/Tests/RunCMake/VS10Project/SourceGroupFileSet-check.cmake b/Tests/RunCMake/VS10Project/SourceGroupFileSet-check.cmake new file mode 100644 index 000000000..fb2eecc86 --- /dev/null +++ b/Tests/RunCMake/VS10Project/SourceGroupFileSet-check.cmake @@ -0,0 +1,13 @@ +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") diff --git a/Tests/RunCMake/VS10Project/SourceGroupFileSet.cmake b/Tests/RunCMake/VS10Project/SourceGroupFileSet.cmake new file mode 100644 index 000000000..954168762 --- /dev/null +++ b/Tests/RunCMake/VS10Project/SourceGroupFileSet.cmake @@ -0,0 +1,3 @@ +add_library(SourceGroupFileSet INTERFACE) +target_sources(SourceGroupFileSet PUBLIC FILE_SET HEADERS FILES iface.h) +source_group("Header Files/SourceGroupFileSet" FILES iface.h) diff --git a/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake b/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake index c82a66e8c..3a5d2e768 100644 --- a/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake +++ b/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake @@ -1,8 +1,9 @@ function(find_source_group LINES NAME) set(foundFileFilter 0) set(foundFilter 0) + string(REPLACE "\\" "\\\\" regexName "${NAME}") foreach(line IN LISTS LINES) - if(line MATCHES "${NAME}") + if(line MATCHES "${regexName}") if(foundFileFilter) set(RunCMake_TEST_FAILED "Multiple files listed with filter for ${NAME}." PARENT_SCOPE) set(FILTER_FOUND 0 PARENT_SCOPE) @@ -10,7 +11,7 @@ function(find_source_group LINES NAME) endif() set(foundFileFilter 1) endif() - if(line MATCHES " + +void foo() +{ + std::cout << "foobar" << std::endl; +} diff --git a/Tests/RunCMake/XcodeProject/main_bundle.cpp b/Tests/RunCMake/XcodeProject/main_bundle.cpp new file mode 100644 index 000000000..11834ac56 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/main_bundle.cpp @@ -0,0 +1,9 @@ + +extern void foo(); + +int main() +{ + + foo(); + return 0; +} diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake index b41c2711d..74ae99cc6 100644 --- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake @@ -84,18 +84,18 @@ run_TestOutputSize() 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) diff --git a/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-check.cmake b/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-check.cmake new file mode 100644 index 000000000..4315074f3 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-check.cmake @@ -0,0 +1,4 @@ +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() diff --git a/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-result.txt b/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-result.txt new file mode 100644 index 000000000..d197c913c --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-stderr.txt b/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-stderr.txt new file mode 100644 index 000000000..ef4d11b83 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestOutputTruncation_bad-stderr.txt @@ -0,0 +1 @@ +^Invalid value for CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION: bad$ diff --git a/Tests/RunCMake/ctest_test/TestOutputTruncation_head-check.cmake b/Tests/RunCMake/ctest_test/TestOutputTruncation_head-check.cmake new file mode 100644 index 000000000..6065c30f6 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestOutputTruncation_head-check.cmake @@ -0,0 +1 @@ +include(${RunCMake_SOURCE_DIR}/TestOutputTruncation-check.cmake) diff --git a/Tests/RunCMake/ctest_test/TestOutputTruncation_middle-check.cmake b/Tests/RunCMake/ctest_test/TestOutputTruncation_middle-check.cmake new file mode 100644 index 000000000..6065c30f6 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestOutputTruncation_middle-check.cmake @@ -0,0 +1 @@ +include(${RunCMake_SOURCE_DIR}/TestOutputTruncation-check.cmake) diff --git a/Tests/RunCMake/ctest_test/TestOutputTruncation_tail-check.cmake b/Tests/RunCMake/ctest_test/TestOutputTruncation_tail-check.cmake new file mode 100644 index 000000000..6065c30f6 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestOutputTruncation_tail-check.cmake @@ -0,0 +1 @@ +include(${RunCMake_SOURCE_DIR}/TestOutputTruncation-check.cmake) diff --git a/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix-stderr.txt b/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix-stderr.txt new file mode 100644 index 000000000..48d2fadbf --- /dev/null +++ b/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix-stderr.txt @@ -0,0 +1,43 @@ + 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.* diff --git a/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix-stdout.txt b/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix-stdout.txt new file mode 100644 index 000000000..ea6614ebe --- /dev/null +++ b/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix-stdout.txt @@ -0,0 +1,3 @@ +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' +-- CREATED_LIBRARY='[^']*/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix-build/lib/libcreated.a' +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' diff --git a/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix.cmake b/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix.cmake new file mode 100644 index 000000000..9b5700a3e --- /dev/null +++ b/Tests/RunCMake/find_library/IgnoreStagingAndInstallPrefix.cmake @@ -0,0 +1 @@ +include(IgnoreInstallPrefix.cmake) diff --git a/Tests/RunCMake/find_library/IgnoreStagingPrefix-stderr.txt b/Tests/RunCMake/find_library/IgnoreStagingPrefix-stderr.txt new file mode 100644 index 000000000..784c5fd06 --- /dev/null +++ b/Tests/RunCMake/find_library/IgnoreStagingPrefix-stderr.txt @@ -0,0 +1,43 @@ + 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.* diff --git a/Tests/RunCMake/find_library/IgnoreStagingPrefix-stdout.txt b/Tests/RunCMake/find_library/IgnoreStagingPrefix-stdout.txt new file mode 100644 index 000000000..fd414fbb1 --- /dev/null +++ b/Tests/RunCMake/find_library/IgnoreStagingPrefix-stdout.txt @@ -0,0 +1,3 @@ +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' +-- CREATED_LIBRARY='[^']*/Tests/RunCMake/find_library/IgnoreStagingPrefix-build/lib/libcreated.a' +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' diff --git a/Tests/RunCMake/find_library/IgnoreStagingPrefix.cmake b/Tests/RunCMake/find_library/IgnoreStagingPrefix.cmake new file mode 100644 index 000000000..9b5700a3e --- /dev/null +++ b/Tests/RunCMake/find_library/IgnoreStagingPrefix.cmake @@ -0,0 +1 @@ +include(IgnoreInstallPrefix.cmake) diff --git a/Tests/RunCMake/find_library/RunCMakeTest.cmake b/Tests/RunCMake/find_library/RunCMakeTest.cmake index de0ee14f0..a912077cf 100644 --- a/Tests/RunCMake/find_library/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_library/RunCMakeTest.cmake @@ -4,6 +4,8 @@ run_cmake(Created) 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)