diff options
author | JinWang An <jinwang.an@samsung.com> | 2022-12-27 17:20:06 +0900 |
---|---|---|
committer | JinWang An <jinwang.an@samsung.com> | 2022-12-27 17:20:06 +0900 |
commit | 309c331b5acb2d1303e09642820f6d95632f95a6 (patch) | |
tree | 68368615685495b6b34223ddd3a49bc5808bb9e4 | |
parent | ee94ded5e1f6585451d7376f711dc12cb3d92a01 (diff) | |
download | cmake-309c331b5acb2d1303e09642820f6d95632f95a6.tar.gz cmake-309c331b5acb2d1303e09642820f6d95632f95a6.tar.bz2 cmake-309c331b5acb2d1303e09642820f6d95632f95a6.zip |
Imported Upstream version 3.22.1upstream/3.22.1
57 files changed, 579 insertions, 77 deletions
diff --git a/Help/command/if.rst b/Help/command/if.rst index 6ff8852a3..5dba13ef3 100644 --- a/Help/command/if.rst +++ b/Help/command/if.rst @@ -56,12 +56,23 @@ Basic Expressions ``NO``, ``FALSE``, ``N``, ``IGNORE``, ``NOTFOUND``, the empty string, or ends in the suffix ``-NOTFOUND``. Named boolean constants are case-insensitive. If the argument is not one of these specific - constants, it is treated as a variable or string and the following - signature is used. + constants, it is treated as a variable or string (see `Variable Expansion`_ + further below) and one of the following two forms applies. -``if(<variable|string>)`` +``if(<variable>)`` True if given a variable that is defined to a value that is not a false - constant. False otherwise. (Note macro arguments are not variables.) + constant. False otherwise, including if the variable is undefined. + Note that macro arguments are not variables. + Environment variables also cannot be tested this way, e.g. + ``if(ENV{some_var})`` will always evaluate to false. + +``if(<string>)`` + A quoted string always evaluates to false unless: + + * The string's value is one of the true constants, or + * Policy :policy:`CMP0054` is not set to ``NEW`` and the string's value + happens to be a variable name that is affected by :policy:`CMP0054`'s + behavior. Logic Operators """"""""""""""" diff --git a/Help/dev/maint.rst b/Help/dev/maint.rst index 664b7a409..54d627dd5 100644 --- a/Help/dev/maint.rst +++ b/Help/dev/maint.rst @@ -245,12 +245,12 @@ Commit with a message such as:: Release versions do not have the development topic section of the CMake Release Notes index page. -Update ``.gitlab-ci.yml`` to drop the ``upload:`` jobs from the +Update ``.gitlab-ci.yml`` to drop the upload jobs from the packaging pipeline by renaming them to start in ``.``: .. code-block:: shell - sed -i 's/^upload:/.upload:/' .gitlab-ci.yml + sed -i 's/^u:/.u:/' .gitlab-ci.yml Commit with a message such as:: @@ -298,7 +298,7 @@ the version date from ``origin/master``: git checkout origin/master -- \ Source/CMakeVersion.cmake Help/release/dev/0-sample-topic.rst sed -i $'/^Releases/ i\\\n.. include:: dev.txt\\\n' Help/release/index.rst - sed -i 's/^\.upload:/upload:/' .gitlab-ci.yml + sed -i 's/^\.u:/u:/' .gitlab-ci.yml Update ``Source/CMakeVersion.cmake`` to set the version to ``$major.$minor.$date``: diff --git a/Help/dev/review.rst b/Help/dev/review.rst index 198e100a9..34796a1a3 100644 --- a/Help/dev/review.rst +++ b/Help/dev/review.rst @@ -324,6 +324,19 @@ Heavier jobs require a manual trigger to run: * ``failed``: Restart jobs which have completed, but without success. * ``completed``: Restart all completed jobs. + +In order to keep job names shorter and keep as much information visible on the +GitLab web interface as possible, jobs have a short prefix which indicates +what its main purpose is: + + * ``b:`` jobs build CMake for the purposes of running the + test suite. + * ``l:`` jobs perform "linting" on the CMake source tree such as static + analysis. + * ``p:`` jobs perform preparatory tasks for use in other jobs. + * ``t:`` jobs perform testing of CMake. + * ``u:`` jobs upload other job results to permanent locations. + If the merge request topic branch is updated by a push, a new manual trigger using one of the above methods is needed to start CI again. diff --git a/Help/envvar/CMAKE_INSTALL_MODE.rst b/Help/envvar/CMAKE_INSTALL_MODE.rst index 37db0d714..4549ea149 100644 --- a/Help/envvar/CMAKE_INSTALL_MODE.rst +++ b/Help/envvar/CMAKE_INSTALL_MODE.rst @@ -13,25 +13,104 @@ source directory into a destination directory. This environment variable however allows the user to override this behavior, causing CMake to create symbolic links instead. -.. note:: - A symbolic link consists of a reference file path rather than contents of its own, - hence there are two ways to express the relation, either by a relative or an absolute path. +Usage Scenarios +^^^^^^^^^^^^^^^ + +Installing symbolic links rather than copying files can help in the following +ways: + +* Conserving storage space because files do not have to be duplicated on disk. +* Changes to the source of the symbolic link are seen at the install + destination without having to re-run the install step. +* Editing through the link at the install destination will modify the source + of the link. This may be useful when dealing with CMake project hierarchies, + i.e. using :module:`ExternalProject` and consistent source navigation and + refactoring is desired across projects. + +Allowed Values +^^^^^^^^^^^^^^ The following values are allowed for ``CMAKE_INSTALL_MODE``: -* empty, unset or ``COPY``: default behavior, duplicate the file at its destination -* ``ABS_SYMLINK``: create an *absolute* symbolic link to the source file at the destination *or fail* -* ``ABS_SYMLINK_OR_COPY``: like ``ABS_SYMLINK`` but silently copy on error -* ``REL_SYMLINK``: create an *relative* symbolic link to the source file at the destination *or fail* -* ``REL_SYMLINK_OR_COPY``: like ``REL_SYMLINK`` but silently copy on error -* ``SYMLINK``: try as if through ``REL_SYMLINK`` and fall back to ``ABS_SYMLINK`` if the referenced - file cannot be expressed using a relative path. Fail on error. -* ``SYMLINK_OR_COPY``: like ``SYMLINK`` but silently copy on error +``COPY``, empty or unset + Duplicate the file at its destination. This is the default behavior. + +``ABS_SYMLINK`` + Create an *absolute* symbolic link to the source file at the destination. + Halt with an error if the link cannot be created. + +``ABS_SYMLINK_OR_COPY`` + Like ``ABS_SYMLINK`` but fall back to silently copying if the symlink + couldn't be created. + +``REL_SYMLINK`` + Create a *relative* symbolic link to the source file at the destination. + Halt with an error if the link cannot be created. + +``REL_SYMLINK_OR_COPY`` + Like ``REL_SYMLINK`` but fall back to silently copying if the symlink + couldn't be created. + +``SYMLINK`` + Try as if through ``REL_SYMLINK`` and fall back to ``ABS_SYMLINK`` if the + referenced file cannot be expressed using a relative path. + Halt with an error if the link cannot be created. + +``SYMLINK_OR_COPY`` + Like ``SYMLINK`` but fall back to silently copying if the symlink couldn't + be created. + +.. note:: + A symbolic link consists of a reference file path rather than contents of its + own, hence there are two ways to express the relation, either by a *relative* + or an *absolute* path. + +When To Set The Environment Variable +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +For the environment variable to take effect, it must be set during the correct +build phase(s). + +* If the project calls :command:`file(INSTALL)` directly, the environment + variable must be set during the configuration phase. +* In order to apply to :command:`install()`, the environment variable must be + set during installation. This could be during a build if using the + ``install`` or ``package`` build targets, or separate from the build when + invoking an install or running :manual:`cpack <cpack(1)>` from the command + line. +* When using :module:`ExternalProject`, it might be required during the build + phase, since the external project's own configure, build and install steps + will execute during the main project's build phase. + +Given the above, it is recommended to set the environment variable consistently +across all phases (configure, build and install). + +Caveats +^^^^^^^ + +Use this environment variable with caution. The following highlights some +points to be considered: + +* ``CMAKE_INSTALL_MODE`` only affects files, not directories. + +* Symbolic links are not available on all platforms. + +* The way this environment variable interacts with the install step of + :module:`ExternalProject` is more complex. For further details, see that + module's documentation. -Installing symbolic links rather than copying files can help conserve storage space because files do -not have to be duplicated on disk. However, modifications applied to the source immediately affects -the symbolic link and vice versa. *Use with caution*. +* A symbolic link ties the destination to the source in a persistent way. + Writing to either of the two affects both file system objects. + This is in contrast to normal install behavior which only copies files as + they were at the time the install was performed, with no enduring + relationship between the source and destination of the install. -.. note:: ``CMAKE_INSTALL_MODE`` only affects files, *not* directories. +* Combining ``CMAKE_INSTALL_MODE`` with :prop_tgt:`IOS_INSTALL_COMBINED` is + not supported. -.. note:: Symbolic links are not available on all platforms. +* Changing ``CMAKE_INSTALL_MODE`` from what it was on a previous run can lead + to unexpected results. Moving from a non-symlinking mode to a symlinking + mode will discard any previous file at the destination, but the reverse is + not true. Once a symlink exists at the destination, even if you switch to a + non-symlink mode, the symlink will continue to exist at the destination and + will not be replaced by an actual file. diff --git a/Help/policy/CMP0077.rst b/Help/policy/CMP0077.rst index d8744a945..482125a79 100644 --- a/Help/policy/CMP0077.rst +++ b/Help/policy/CMP0077.rst @@ -53,6 +53,8 @@ between the two policies. This policy was introduced in CMake version 3.13. CMake version |release| warns when the policy is not set and uses ``OLD`` behavior. Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` -explicitly. +explicitly within a project. Use the :variable:`CMAKE_POLICY_DEFAULT_CMP0077 +<CMAKE_POLICY_DEFAULT_CMP\<NNNN\>>` variable to set the policy for +a third-party project in a subdirectory without modifying it. .. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0126.rst b/Help/policy/CMP0126.rst index ba027b351..1b6995762 100644 --- a/Help/policy/CMP0126.rst +++ b/Help/policy/CMP0126.rst @@ -22,7 +22,10 @@ will *not* set the cache variable if a non-cache variable of the same name already exists and :policy:`CMP0077` is set to ``NEW``. Policy ``CMP0126`` was introduced in CMake version 3.21. Use the -:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. +:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly +within a project. Use the :variable:`CMAKE_POLICY_DEFAULT_CMP0126 +<CMAKE_POLICY_DEFAULT_CMP\<NNNN\>>` variable to set the policy for +a third-party project in a subdirectory without modifying it. Unlike many policies, CMake version |release| does *not* warn when the policy is not set and simply uses ``OLD`` behavior. See documentation of the :variable:`CMAKE_POLICY_WARNING_CMP0126 <CMAKE_POLICY_WARNING_CMP<NNNN>>` diff --git a/Help/prop_test/ENVIRONMENT_MODIFICATION.rst b/Help/prop_test/ENVIRONMENT_MODIFICATION.rst index 0b3cd83a4..1e1732934 100644 --- a/Help/prop_test/ENVIRONMENT_MODIFICATION.rst +++ b/Help/prop_test/ENVIRONMENT_MODIFICATION.rst @@ -21,9 +21,11 @@ order specified in the property's value. The ``OP`` may be one of: - ``string_append``: Appends ``VALUE`` to the current value of ``MYVAR``. - ``string_prepend``: Prepends ``VALUE`` to the current value of ``MYVAR``. - ``path_list_append``: Appends ``VALUE`` to the current value of ``MYVAR`` - using the platform-specific list separator. + using the host platform's path list separator (``;`` on Windows and ``:`` + elsewhere). - ``path_list_prepend``: Prepends ``VALUE`` to the current value of - ``MYVAR`` using the platform-specific list separator. + ``MYVAR`` using the host platform's path list separator (``;`` on Windows + and ``:`` elsewhere). - ``cmake_list_append``: Appends ``VALUE`` to the current value of ``MYVAR`` using ``;`` as the separator. - ``cmake_list_prepend``: Prepends ``VALUE`` to the current value of diff --git a/Help/variable/CMAKE_POLICY_DEFAULT_CMPNNNN.rst b/Help/variable/CMAKE_POLICY_DEFAULT_CMPNNNN.rst index 43582be94..d643fb8df 100644 --- a/Help/variable/CMAKE_POLICY_DEFAULT_CMPNNNN.rst +++ b/Help/variable/CMAKE_POLICY_DEFAULT_CMPNNNN.rst @@ -9,9 +9,16 @@ the given version unset. Set ``CMAKE_POLICY_DEFAULT_CMP<NNNN>`` to ``OLD`` or ``NEW`` to specify the default for policy ``CMP<NNNN>``, where ``<NNNN>`` is the policy number. -This variable should not be set by a project in CMake code; use -:command:`cmake_policy(SET)` instead. Users running CMake may set this -variable in the cache (e.g. ``-DCMAKE_POLICY_DEFAULT_CMP<NNNN>=<OLD|NEW>``) -to set a policy not otherwise set by the project. Set to ``OLD`` to quiet a -policy warning while using old behavior or to ``NEW`` to try building the -project with new behavior. +This variable should not be set by a project in CMake code as a way to +set its own policies; use :command:`cmake_policy(SET)` instead. This +variable is meant to externally set policies for which a project has +not itself been updated: + +* Users running CMake may set this variable in the cache + (e.g. ``-DCMAKE_POLICY_DEFAULT_CMP<NNNN>=<OLD|NEW>``). Set it to ``OLD`` + to quiet a policy warning while using old behavior or to ``NEW`` to + try building the project with new behavior. + +* Projects may set this variable before a call to :command:`add_subdirectory` + that adds a third-party project in order to set its policies without + modifying third-party code. diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index 43ede3e8a..30ad9824e 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -60,7 +60,7 @@ const char* info_language_standard_default = "INFO" ":" "standard_default[" C_VERSION "]"; const char* info_language_extensions_default = "INFO" ":" "extensions_default[" -// !defined(_MSC_VER) to exclude Clang's MSVC compatibility mode. +/* !defined(_MSC_VER) to exclude Clang's MSVC compatibility mode. */ #if (defined(__clang__) || defined(__GNUC__) || \ defined(__TI_COMPILER_VERSION__)) && \ !defined(__STRICT_ANSI__) && !defined(_MSC_VER) diff --git a/Modules/CMakeCUDACompilerId.cu.in b/Modules/CMakeCUDACompilerId.cu.in index bc685a7eb..becb9b4cb 100644 --- a/Modules/CMakeCUDACompilerId.cu.in +++ b/Modules/CMakeCUDACompilerId.cu.in @@ -33,7 +33,7 @@ const char* info_language_standard_default = "INFO" ":" "standard_default[" "]"; const char* info_language_extensions_default = "INFO" ":" "extensions_default[" -// !defined(_MSC_VER) to exclude Clang's MSVC compatibility mode. +/* !defined(_MSC_VER) to exclude Clang's MSVC compatibility mode. */ #if (defined(__clang__) || defined(__GNUC__)) && !defined(__STRICT_ANSI__) && \ !defined(_MSC_VER) "ON" diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index cdf9c1828..e7a548742 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -66,7 +66,7 @@ const char* info_language_standard_default = "INFO" ":" "standard_default[" "]"; const char* info_language_extensions_default = "INFO" ":" "extensions_default[" -// !defined(_MSC_VER) to exclude Clang's MSVC compatibility mode. +/* !defined(_MSC_VER) to exclude Clang's MSVC compatibility mode. */ #if (defined(__clang__) || defined(__GNUC__) || \ defined(__TI_COMPILER_VERSION__)) && \ !defined(__STRICT_ANSI__) && !defined(_MSC_VER) diff --git a/Modules/CMakeParseLibraryArchitecture.cmake b/Modules/CMakeParseLibraryArchitecture.cmake index 6fb9c6bfc..f7a4b29c3 100644 --- a/Modules/CMakeParseLibraryArchitecture.cmake +++ b/Modules/CMakeParseLibraryArchitecture.cmake @@ -23,7 +23,7 @@ function(cmake_parse_library_architecture lang implicit_dirs implicit_objs outpu foreach(obj IN LISTS implicit_objs) get_filename_component(dir "${obj}" DIRECTORY) - if("${dir}" MATCHES "(/usr)+/lib/${CMAKE_LIBRARY_ARCHITECTURE_REGEX}$") + if("${dir}" MATCHES "(/usr)?/lib/${CMAKE_LIBRARY_ARCHITECTURE_REGEX}$") get_filename_component(arch "${dir}" NAME) set(library_arch "${arch}") break() diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index e49faae18..4004ea443 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -637,6 +637,22 @@ External Project Definition supported). Passing an empty string as the ``<cmd>`` makes the install step do nothing. + .. note:: + If the :envvar:`CMAKE_INSTALL_MODE` environment variable is set when the + main project is built, it will only have an effect if the following + conditions are met: + + * The main project's configure step assumed the external project uses + CMake as its build system. + * The external project's install command actually runs. Note that due + to the way ``ExternalProject`` may use timestamps internally, if + nothing the install step depends on needs to be re-executed, the + install command might also not need to run. + + Note also that ``ExternalProject`` does not check whether the + :envvar:`CMAKE_INSTALL_MODE` environment variable changes from one run + to another. + **Test Step Options:** The test step is only defined if at least one of the following ``TEST_...`` options are provided. diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index ef43a3ae9..547bc520d 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -57,7 +57,7 @@ set(PKG_CONFIG_NAMES "pkg-config") if(CMAKE_HOST_WIN32) list(PREPEND PKG_CONFIG_NAMES "pkg-config.bat") endif() -list(PREPEND PKG_CONFIG_NAMES "pkgconf") +list(APPEND PKG_CONFIG_NAMES "pkgconf") find_program(PKG_CONFIG_EXECUTABLE NAMES ${PKG_CONFIG_NAMES} diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake index a4b7a0385..375cb7027 100644 --- a/Modules/FindPython.cmake +++ b/Modules/FindPython.cmake @@ -229,6 +229,11 @@ Hints * If set to TRUE, search **only** for static libraries. * If set to FALSE, search **only** for shared libraries. + .. note:: + + This hint will be ignored on ``Windows`` because static libraries are not + available on this platform. + ``Python_FIND_ABI`` .. versionadded:: 3.16 diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake index bb965b9d3..0888fad7e 100644 --- a/Modules/FindPython2.cmake +++ b/Modules/FindPython2.cmake @@ -215,6 +215,11 @@ Hints * If set to TRUE, search **only** for static libraries. * If set to FALSE, search **only** for shared libraries. + .. note:: + + This hint will be ignored on ``Windows`` because static libraries are not + available on this platform. + ``Python2_FIND_STRATEGY`` .. versionadded:: 3.15 diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake index f826fcfe2..145c95e11 100644 --- a/Modules/FindPython3.cmake +++ b/Modules/FindPython3.cmake @@ -231,6 +231,11 @@ Hints * If set to TRUE, search **only** for static libraries. * If set to FALSE, search **only** for shared libraries. + .. note:: + + This hint will be ignored on ``Windows`` because static libraries are not + available on this platform. + ``Python3_FIND_ABI`` .. versionadded:: 3.16 diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake index 6ca424ad5..01bd63716 100644 --- a/Modules/GNUInstallDirs.cmake +++ b/Modules/GNUInstallDirs.cmake @@ -253,7 +253,9 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR OR (_libdir_set elseif(DEFINED ENV{CONDA_PREFIX}) set(conda_prefix "$ENV{CONDA_PREFIX}") cmake_path(ABSOLUTE_PATH conda_prefix NORMALIZE) - if("${CMAKE_INSTALL_PREFIX}" STREQUAL conda_prefix) + if("${CMAKE_INSTALL_PREFIX}" STREQUAL conda_prefix AND + NOT ("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$" OR + "${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/local/?$")) set(__system_type_for_install "conda") endif() endif() diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index 9808861cd..35b1704ff 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -686,7 +686,7 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) ${swig_custom_products} ${swig_cleanup_command} # Let's create the ${outdir} at execution time, in case dir contains $(OutDir) - COMMAND "${CMAKE_COMMAND}" -E make_directory ${outdir} ${outfiledir} + COMMAND "${CMAKE_COMMAND}" -E make_directory "${workingdir}" "${outdir}" "${outfiledir}" ${swig_timestamp_command} COMMAND "${CMAKE_COMMAND}" -E env "SWIG_LIB=${SWIG_DIR}" "${SWIG_EXECUTABLE}" "-${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}" diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 512f47eda..c8d203bf3 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 22) -set(CMake_VERSION_PATCH 0) +set(CMake_VERSION_PATCH 1) #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 [==[ff8c3acc0f CMake 3.22.0]==]) + set(git_info [==[aa6a33fe54 CMake 3.22.1]==]) # 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/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 9914902ef..97ad7ab55 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -498,7 +498,8 @@ bool cmGlobalGenerator::CheckLanguages( void cmGlobalGenerator::EnableLanguage( std::vector<std::string> const& languages, cmMakefile* mf, bool optional) { - if (!this->IsMultiConfig()) { + if (!this->IsMultiConfig() && + !this->GetCMakeInstance()->GetIsInTryCompile()) { std::string envBuildType; if (!mf->GetDefinition("CMAKE_BUILD_TYPE") && cmSystemTools::GetEnv("CMAKE_BUILD_TYPE", envBuildType)) { diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 5d3e11a64..96dda5393 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -567,7 +567,7 @@ public: } else { this->Stream << this->LG->EscapeForXML("\n"); } - std::string script = this->LG->ConstructScript(ccg, unmanaged); + std::string script = this->LG->ConstructScript(ccg); this->Stream << this->LG->EscapeForXML(script); } @@ -1780,7 +1780,7 @@ void cmLocalVisualStudio7Generator::WriteCustomRule( } std::string comment = this->ConstructComment(ccg); - std::string script = this->ConstructScript(ccg, unmanaged); + std::string script = this->ConstructScript(ccg); if (this->FortranProject) { cmSystemTools::ReplaceString(script, "$(Configuration)", config); } diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 4ed1dd92b..03213ef1c 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -124,8 +124,7 @@ const char* cmLocalVisualStudioGenerator::GetReportErrorLabel() const } std::string cmLocalVisualStudioGenerator::ConstructScript( - cmCustomCommandGenerator const& ccg, IsManaged isManaged, - const std::string& newline_text) + cmCustomCommandGenerator const& ccg, const std::string& newline_text) { bool useLocal = this->CustomCommandUseLocal(); std::string workingDirectory = ccg.GetWorkingDirectory(); @@ -238,14 +237,6 @@ std::string cmLocalVisualStudioGenerator::ConstructScript( script += newline; script += "if %errorlevel% neq 0 goto "; script += this->GetReportErrorLabel(); - if (isManaged == managed) { - // These aren't generated by default for C# projects. - script += newline; - script += this->GetReportErrorLabel(); - script += newline; - script += "exit /b 0"; - script += newline; - } } return script; diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index 0e7f63ff5..91fb6b061 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -31,13 +31,7 @@ public: virtual ~cmLocalVisualStudioGenerator(); /** Construct a script from the given list of command lines. */ - enum IsManaged - { - unmanaged, - managed - }; std::string ConstructScript(cmCustomCommandGenerator const& ccg, - IsManaged isManaged, const std::string& newline = "\n"); /** Label to which to jump in a batch file after a failed step in a diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 83984f7a3..88f3cc7b1 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3167,7 +3167,8 @@ void cmMakefile::InitCMAKE_CONFIGURATION_TYPES(std::string const& genDefault) return; } std::string initConfigs; - if (!cmSystemTools::GetEnv("CMAKE_CONFIGURATION_TYPES", initConfigs)) { + if (this->GetCMakeInstance()->GetIsInTryCompile() || + !cmSystemTools::GetEnv("CMAKE_CONFIGURATION_TYPES", initConfigs)) { initConfigs = genDefault; } this->AddCacheDefinition( diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 8edadd31e..f5f3727e5 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -888,7 +888,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( bool lang_has_preprocessor = ((lang == "C") || (lang == "CXX") || (lang == "OBJC") || (lang == "OBJCXX") || (lang == "Fortran") || (lang == "CUDA") || - lang == "ISPC" || lang == "ASM"); + lang == "ISPC" || lang == "HIP" || lang == "ASM"); bool const lang_has_assembly = lang_has_preprocessor; bool const lang_can_export_cmds = lang_has_preprocessor; diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 75a5a8d87..1934393bb 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2869,6 +2869,14 @@ bool cmSystemTools::ChangeRPath(std::string const& file, file, oldRPath, newRPath, removeEnvironmentRPath, emsg, changed)) { return result.value(); } + // The file format is not recognized. Assume it has no RPATH. + if (newRPath.empty()) { + // The caller wanted no RPATH anyway. + return true; + } + if (emsg) { + *emsg = "The file format is not recognized."; + } return false; } @@ -2883,6 +2891,14 @@ bool cmSystemTools::SetRPath(std::string const& file, SetRPathXCOFF(file, newRPath, emsg, changed)) { return result.value(); } + // The file format is not recognized. Assume it has no RPATH. + if (newRPath.empty()) { + // The caller wanted no RPATH anyway. + return true; + } + if (emsg) { + *emsg = "The file format is not recognized."; + } return false; } @@ -3212,7 +3228,8 @@ bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg, if (cm::optional<bool> result = RemoveRPathXCOFF(file, emsg, removed)) { return result.value(); } - return false; + // The file format is not recognized. Assume it has no RPATH. + return true; } bool cmSystemTools::CheckRPath(std::string const& file, @@ -3252,9 +3269,9 @@ bool cmSystemTools::CheckRPath(std::string const& file, return false; } #endif - (void)file; - (void)newRPath; - return false; + // The file format is not recognized. Assume it has no RPATH. + // Therefore we succeed if the new rpath is empty anyway. + return newRPath.empty(); } bool cmSystemTools::RepeatedRemoveDirectory(const std::string& dir) diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx index c8f5a4b22..382657766 100644 --- a/Source/cmTimestamp.cxx +++ b/Source/cmTimestamp.cxx @@ -197,7 +197,7 @@ std::string cmTimestamp::AddTimestampComponent(char flag, #ifdef __MINGW32__ /* See a bug in MinGW: https://sourceforge.net/p/mingw-w64/bugs/793/. A work * around is to try to use strftime() from ucrtbase.dll. */ - using T = size_t(WINAPI*)(char*, size_t, const char*, const struct tm*); + using T = size_t(__cdecl*)(char*, size_t, const char*, const struct tm*); auto loadUcrtStrftime = []() -> T { auto handle = LoadLibraryExA("ucrtbase.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index d2c49ae36..a871e4ce5 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1488,10 +1488,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule( cmCustomCommandGenerator ccg(command, c, lg, true); std::string comment = lg->ConstructComment(ccg); comment = cmVS10EscapeComment(comment); - cmLocalVisualStudioGenerator::IsManaged isManaged = (this->Managed) - ? cmLocalVisualStudioGenerator::managed - : cmLocalVisualStudioGenerator::unmanaged; - std::string script = lg->ConstructScript(ccg, isManaged); + std::string script = lg->ConstructScript(ccg); bool symbolic = false; // input files for custom command std::stringstream additional_inputs; @@ -4241,10 +4238,7 @@ void cmVisualStudio10TargetGenerator::WriteEvent( comment += lg->ConstructComment(ccg); script += pre; pre = "\n"; - cmLocalVisualStudioGenerator::IsManaged isManaged = (this->Managed) - ? cmLocalVisualStudioGenerator::managed - : cmLocalVisualStudioGenerator::unmanaged; - script += lg->ConstructScript(ccg, isManaged); + script += lg->ConstructScript(ccg); stdPipesUTF8 = stdPipesUTF8 || cc.GetStdPipesUTF8(); } diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index ecb54c7ae..8b38080fd 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2234,8 +2234,9 @@ if(BUILD_TESTING) endif() if(NOT "${CMAKE_GENERATOR}" MATCHES "Visual Studio 9 " - AND NOT CMAKE_GENERATOR_TOOLSET) + AND NOT CMAKE_GENERATOR_TOOLSET STREQUAL "v90") ADD_TEST_MACRO(VSWindowsFormsResx VSWindowsFormsResx) + ADD_TEST_MACRO(VSManagedCustomCommand) endif() add_test(VSExternalInclude ${CMAKE_CTEST_COMMAND} diff --git a/Tests/RunCMake/ParseImplicitData/linux-custom_clang-C-Clang-13.0.0.input b/Tests/RunCMake/ParseImplicitData/linux-custom_clang-C-Clang-13.0.0.input new file mode 100644 index 000000000..a80592c10 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitData/linux-custom_clang-C-Clang-13.0.0.input @@ -0,0 +1,56 @@ +CMAKE_LANG=C +CMAKE_LINKER=/opt/llvm-13/bin/ld.lld +CMAKE_C_COMPILER_ABI=ELF +CMAKE_C_COMPILER_AR=/opt/llvm-13/bin/llvm-ar +CMAKE_C_COMPILER_ARCHITECTURE_ID= +CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_C_COMPILER_ID=Clang +CMAKE_C_COMPILER_LAUNCHER= +CMAKE_C_COMPILER_LOADED=1 +CMAKE_C_COMPILER_RANLIB=/opt/llvm-13/bin/llvm-ranlib +CMAKE_C_COMPILER_TARGET= +CMAKE_C_COMPILER_VERSION=13.0.0 +CMAKE_C_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/cmake/Tests/RunCMake/ParseImplicitData/build/CMakeFiles/CMakeTmp + +Run Build Command(s):/usr/bin/make -f Makefile cmTC_91833/fast && /usr/bin/make -f CMakeFiles/cmTC_91833.dir/build.make CMakeFiles/cmTC_91833.dir/build +make[1]: Entering directory '/tmp/cmake/Tests/RunCMake/ParseImplicitData/build/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_91833.dir/CMakeCCompilerABI.c.o +/opt/llvm-13/bin/clang -v -MD -MT CMakeFiles/cmTC_91833.dir/CMakeCCompilerABI.c.o -MF CMakeFiles/cmTC_91833.dir/CMakeCCompilerABI.c.o.d -o CMakeFiles/cmTC_91833.dir/CMakeCCompilerABI.c.o -c /opt/cmake-3.21.3/share/cmake-3.21/Modules/CMakeCCompilerABI.c +clang version 13.0.0 +Target: x86_64-pc-linux-gnu +Thread model: posix +InstalledDir: /opt/llvm-13/bin +Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9 +Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9 +Candidate multilib: .@m64 +Candidate multilib: 32@m32 +Candidate multilib: x32@mx32 +Selected multilib: .@m64 + (in-process) + "/opt/llvm-13/bin/clang-13" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -main-file-name CMakeCCompilerABI.c -mrelocation-model static -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -v -fcoverage-compilation-dir=/tmp/cmake/Tests/RunCMake/ParseImplicitData/build/CMakeFiles/CMakeTmp -resource-dir /opt/llvm-13/lib/clang/13.0.0 -dependency-file CMakeFiles/cmTC_91833.dir/CMakeCCompilerABI.c.o.d -MT CMakeFiles/cmTC_91833.dir/CMakeCCompilerABI.c.o -sys-header-deps -internal-isystem /opt/llvm-13/lib/clang/13.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/tmp/cmake/Tests/RunCMake/ParseImplicitData/build/CMakeFiles/CMakeTmp -ferror-limit 19 -fgnuc-version=4.2.1 -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o CMakeFiles/cmTC_91833.dir/CMakeCCompilerABI.c.o -x c /opt/cmake-3.21.3/share/cmake-3.21/Modules/CMakeCCompilerABI.c +clang -cc1 version 13.0.0 based upon LLVM 13.0.0 default target x86_64-pc-linux-gnu +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include" +ignoring nonexistent directory "/include" +#include "..." search starts here: +#include <...> search starts here: + /opt/llvm-13/lib/clang/13.0.0/include + /usr/local/include + /usr/include/x86_64-linux-gnu + /usr/include +End of search list. +Linking C executable cmTC_91833 +/opt/cmake-3.21.3/bin/cmake -E cmake_link_script CMakeFiles/cmTC_91833.dir/link.txt --verbose=1 +/opt/llvm-13/bin/clang -v -rdynamic CMakeFiles/cmTC_91833.dir/CMakeCCompilerABI.c.o -o cmTC_91833 +clang version 13.0.0 +Target: x86_64-pc-linux-gnu +Thread model: posix +InstalledDir: /opt/llvm-13/bin +Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9 +Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9 +Candidate multilib: .@m64 +Candidate multilib: 32@m32 +Candidate multilib: x32@mx32 +Selected multilib: .@m64 + "/opt/llvm-13/bin/ld.lld" -export-dynamic -z relro --hash-style=gnu --build-id --eh-frame-hdr -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTC_91833 /lib/x86_64-linux-gnu/crt1.o /lib/x86_64-linux-gnu/crti.o /opt/llvm-13/lib/clang/13.0.0/lib/x86_64-pc-linux-gnu/clang_rt.crtbegin.o -L/opt/llvm-13/bin/../lib/x86_64-pc-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/opt/llvm-13/bin/../lib -L/lib -L/usr/lib CMakeFiles/cmTC_91833.dir/CMakeCCompilerABI.c.o /opt/llvm-13/lib/clang/13.0.0/lib/x86_64-pc-linux-gnu/libclang_rt.builtins.a --as-needed -l:libunwind.so --no-as-needed -lc /opt/llvm-13/lib/clang/13.0.0/lib/x86_64-pc-linux-gnu/libclang_rt.builtins.a --as-needed -l:libunwind.so --no-as-needed /opt/llvm-13/lib/clang/13.0.0/lib/x86_64-pc-linux-gnu/clang_rt.crtend.o /lib/x86_64-linux-gnu/crtn.o +make[1]: Leaving directory '/tmp/cmake/Tests/RunCMake/ParseImplicitData/build/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitData/linux-custom_clang-CXX-Clang-13.0.0.input b/Tests/RunCMake/ParseImplicitData/linux-custom_clang-CXX-Clang-13.0.0.input new file mode 100644 index 000000000..e65639006 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitData/linux-custom_clang-CXX-Clang-13.0.0.input @@ -0,0 +1,58 @@ +CMAKE_LANG=CXX +CMAKE_LINKER=/opt/llvm-13/bin/ld.lld +CMAKE_CXX_COMPILER_ABI=ELF +CMAKE_CXX_COMPILER_AR=/opt/llvm-13/bin/llvm-ar +CMAKE_CXX_COMPILER_ARCHITECTURE_ID= +CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_CXX_COMPILER_ID=Clang +CMAKE_CXX_COMPILER_LAUNCHER= +CMAKE_CXX_COMPILER_LOADED=1 +CMAKE_CXX_COMPILER_RANLIB=/opt/llvm-13/bin/llvm-ranlib +CMAKE_CXX_COMPILER_TARGET= +CMAKE_CXX_COMPILER_VERSION=13.0.0 +CMAKE_CXX_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/cmake/Tests/RunCMake/ParseImplicitData/build/CMakeFiles/CMakeTmp + +Run Build Command(s):/usr/bin/make -f Makefile cmTC_5372b/fast && /usr/bin/make -f CMakeFiles/cmTC_5372b.dir/build.make CMakeFiles/cmTC_5372b.dir/build +make[1]: Entering directory '/tmp/cmake/Tests/RunCMake/ParseImplicitData/build/CMakeFiles/CMakeTmp' +Building CXX object CMakeFiles/cmTC_5372b.dir/CMakeCXXCompilerABI.cpp.o +/opt/llvm-13/bin/clang++ -v -MD -MT CMakeFiles/cmTC_5372b.dir/CMakeCXXCompilerABI.cpp.o -MF CMakeFiles/cmTC_5372b.dir/CMakeCXXCompilerABI.cpp.o.d -o CMakeFiles/cmTC_5372b.dir/CMakeCXXCompilerABI.cpp.o -c /opt/cmake-3.21.3/share/cmake-3.21/Modules/CMakeCXXCompilerABI.cpp +clang version 13.0.0 +Target: x86_64-pc-linux-gnu +Thread model: posix +InstalledDir: /opt/llvm-13/bin +Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9 +Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9 +Candidate multilib: .@m64 +Candidate multilib: 32@m32 +Candidate multilib: x32@mx32 +Selected multilib: .@m64 + (in-process) + "/opt/llvm-13/bin/clang-13" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -main-file-name CMakeCXXCompilerABI.cpp -mrelocation-model static -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -v -fcoverage-compilation-dir=/tmp/cmake/Tests/RunCMake/ParseImplicitData/build/CMakeFiles/CMakeTmp -resource-dir /opt/llvm-13/lib/clang/13.0.0 -dependency-file CMakeFiles/cmTC_5372b.dir/CMakeCXXCompilerABI.cpp.o.d -MT CMakeFiles/cmTC_5372b.dir/CMakeCXXCompilerABI.cpp.o -sys-header-deps -internal-isystem /opt/llvm-13/bin/../include/x86_64-pc-linux-gnu/c++/v1 -internal-isystem /opt/llvm-13/bin/../include/c++/v1 -internal-isystem /opt/llvm-13/lib/clang/13.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir=/tmp/cmake/Tests/RunCMake/ParseImplicitData/build/CMakeFiles/CMakeTmp -ferror-limit 19 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o CMakeFiles/cmTC_5372b.dir/CMakeCXXCompilerABI.cpp.o -x c++ /opt/cmake-3.21.3/share/cmake-3.21/Modules/CMakeCXXCompilerABI.cpp +clang -cc1 version 13.0.0 based upon LLVM 13.0.0 default target x86_64-pc-linux-gnu +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include" +ignoring nonexistent directory "/include" +#include "..." search starts here: +#include <...> search starts here: + /opt/llvm-13/bin/../include/x86_64-pc-linux-gnu/c++/v1 + /opt/llvm-13/bin/../include/c++/v1 + /opt/llvm-13/lib/clang/13.0.0/include + /usr/local/include + /usr/include/x86_64-linux-gnu + /usr/include +End of search list. +Linking CXX executable cmTC_5372b +/opt/cmake-3.21.3/bin/cmake -E cmake_link_script CMakeFiles/cmTC_5372b.dir/link.txt --verbose=1 +/opt/llvm-13/bin/clang++ -v -rdynamic CMakeFiles/cmTC_5372b.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_5372b +clang version 13.0.0 +Target: x86_64-pc-linux-gnu +Thread model: posix +InstalledDir: /opt/llvm-13/bin +Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9 +Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9 +Candidate multilib: .@m64 +Candidate multilib: 32@m32 +Candidate multilib: x32@mx32 +Selected multilib: .@m64 + "/opt/llvm-13/bin/ld.lld" -export-dynamic -z relro --hash-style=gnu --build-id --eh-frame-hdr -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTC_5372b /lib/x86_64-linux-gnu/crt1.o /lib/x86_64-linux-gnu/crti.o /opt/llvm-13/lib/clang/13.0.0/lib/x86_64-pc-linux-gnu/clang_rt.crtbegin.o -L/opt/llvm-13/bin/../lib/x86_64-pc-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/opt/llvm-13/bin/../lib -L/lib -L/usr/lib CMakeFiles/cmTC_5372b.dir/CMakeCXXCompilerABI.cpp.o -lc++ -lm /opt/llvm-13/lib/clang/13.0.0/lib/x86_64-pc-linux-gnu/libclang_rt.builtins.a -l:libunwind.so -lc /opt/llvm-13/lib/clang/13.0.0/lib/x86_64-pc-linux-gnu/libclang_rt.builtins.a -l:libunwind.so /opt/llvm-13/lib/clang/13.0.0/lib/x86_64-pc-linux-gnu/clang_rt.crtend.o /lib/x86_64-linux-gnu/crtn.o +make[1]: Leaving directory '/tmp/cmake/Tests/RunCMake/ParseImplicitData/build/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake b/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake index e501f122e..75c26a7a1 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake @@ -38,6 +38,7 @@ set(targets linux-C-XL-16.1.0.0 linux-CXX-XL-16.1.0.0 linux-CUDA-NVIDIA-10.1.168-CLANG linux-CUDA-NVIDIA-10.1.168-XLClang-v-empty linux-CUDA-NVIDIA-9.2.148-GCC + linux-custom_clang-C-Clang-13.0.0 linux-custom_clang-CXX-Clang-13.0.0 mingw.org-C-GNU-4.9.3 mingw.org-CXX-GNU-4.9.3 netbsd-C-GNU-4.8.5 netbsd-CXX-GNU-4.8.5 netbsd_nostdinc-C-GNU-4.8.5 netbsd_nostdinc-CXX-GNU-4.8.5 diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/results/linux-custom_clang-C-Clang-13.0.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/results/linux-custom_clang-C-Clang-13.0.0.output new file mode 100644 index 000000000..2435c62fb --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/results/linux-custom_clang-C-Clang-13.0.0.output @@ -0,0 +1 @@ +/opt/llvm-13/lib/clang/13.0.0/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/results/linux-custom_clang-CXX-Clang-13.0.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/results/linux-custom_clang-CXX-Clang-13.0.0.output new file mode 100644 index 000000000..de5a3689c --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/results/linux-custom_clang-CXX-Clang-13.0.0.output @@ -0,0 +1 @@ +/opt/llvm-13/include/x86_64-pc-linux-gnu/c\+\+/v1;/opt/llvm-13/include/c\+\+/v1;/opt/llvm-13/lib/clang/13.0.0/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include diff --git a/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake b/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake index dcdc7f1b9..51c88325f 100644 --- a/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake +++ b/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake @@ -38,6 +38,7 @@ set(targets linux-C-XL-16.1.0.0 linux-CXX-XL-16.1.0.0 linux-CUDA-NVIDIA-10.1.168-CLANG linux-CUDA-NVIDIA-10.1.168-XLClang-v linux-CUDA-NVIDIA-9.2.148-GCC + linux-custom_clang-C-Clang-13.0.0 linux-custom_clang-CXX-Clang-13.0.0 mingw.org-C-GNU-4.9.3 mingw.org-CXX-GNU-4.9.3 netbsd-C-GNU-4.8.5 netbsd-CXX-GNU-4.8.5 netbsd_nostdinc-C-GNU-4.8.5 netbsd_nostdinc-CXX-GNU-4.8.5 diff --git a/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-custom_clang-C-Clang-13.0.0.output b/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-custom_clang-C-Clang-13.0.0.output new file mode 100644 index 000000000..108712d56 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-custom_clang-C-Clang-13.0.0.output @@ -0,0 +1,3 @@ +libs=-l:libunwind.so;c;-l:libunwind.so +dirs=/opt/llvm-13/lib/x86_64-pc-linux-gnu;/usr/lib/gcc/x86_64-linux-gnu/9;/usr/lib64;/lib/x86_64-linux-gnu;/lib64;/usr/lib/x86_64-linux-gnu;/opt/llvm-13/lib;/lib;/usr/lib +library_arch=x86_64-linux-gnu diff --git a/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-custom_clang-CXX-Clang-13.0.0.output b/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-custom_clang-CXX-Clang-13.0.0.output new file mode 100644 index 000000000..e4a8a70eb --- /dev/null +++ b/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-custom_clang-CXX-Clang-13.0.0.output @@ -0,0 +1,3 @@ +libs=c\+\+;m;-l:libunwind.so;c;-l:libunwind.so +dirs=/opt/llvm-13/lib/x86_64-pc-linux-gnu;/usr/lib/gcc/x86_64-linux-gnu/9;/usr/lib64;/lib/x86_64-linux-gnu;/lib64;/usr/lib/x86_64-linux-gnu;/opt/llvm-13/lib;/lib;/usr/lib +library_arch=x86_64-linux-gnu diff --git a/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake b/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake index 1ca2e757a..525df09c3 100644 --- a/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake +++ b/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake @@ -5,3 +5,14 @@ run_cmake_command(ELF ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/ELF.cmake) if(CMAKE_SYSTEM_NAME STREQUAL "AIX") run_cmake_command(XCOFF ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/XCOFF.cmake) endif() + +run_cmake_command(TextCheck ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TextCheck.cmake) +run_cmake_command(TextCheckEmpty ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TextCheckEmpty.cmake) + +run_cmake_command(TextChange ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TextChange.cmake) +run_cmake_command(TextChangeEmpty ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TextChangeEmpty.cmake) + +run_cmake_command(TextSet ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TextSet.cmake) +run_cmake_command(TextSetEmpty ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TextSetEmpty.cmake) + +run_cmake_command(TextRemove ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TextRemove.cmake) diff --git a/Tests/RunCMake/file-RPATH/TextChange-result.txt b/Tests/RunCMake/file-RPATH/TextChange-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/file-RPATH/TextChange-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-RPATH/TextChange-stderr.txt b/Tests/RunCMake/file-RPATH/TextChange-stderr.txt new file mode 100644 index 000000000..48a1bf599 --- /dev/null +++ b/Tests/RunCMake/file-RPATH/TextChange-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at [^ +]*/Tests/RunCMake/file-RPATH/TextChange.cmake:[0-9]+ \(file\): + file RPATH_CHANGE could not write new RPATH: + + /new/rpath + + to the file: + + [^ +]*/Tests/RunCMake/file-RPATH/TextChange-build/not_a_binary.txt + + The file format is not recognized\.$ diff --git a/Tests/RunCMake/file-RPATH/TextChange.cmake b/Tests/RunCMake/file-RPATH/TextChange.cmake new file mode 100644 index 000000000..5c599eca2 --- /dev/null +++ b/Tests/RunCMake/file-RPATH/TextChange.cmake @@ -0,0 +1,3 @@ +set(f "${CMAKE_CURRENT_BINARY_DIR}/not_a_binary.txt") +file(WRITE "${f}" "Not a binary.\n") +file(RPATH_CHANGE FILE "${f}" OLD_RPATH "/old/rpath" NEW_RPATH "/new/rpath") diff --git a/Tests/RunCMake/file-RPATH/TextChangeEmpty.cmake b/Tests/RunCMake/file-RPATH/TextChangeEmpty.cmake new file mode 100644 index 000000000..8f855d947 --- /dev/null +++ b/Tests/RunCMake/file-RPATH/TextChangeEmpty.cmake @@ -0,0 +1,3 @@ +set(f "${CMAKE_CURRENT_BINARY_DIR}/not_a_binary.txt") +file(WRITE "${f}" "Not a binary.\n") +file(RPATH_CHANGE FILE "${f}" OLD_RPATH "/old/rpath" NEW_RPATH "") diff --git a/Tests/RunCMake/file-RPATH/TextCheck.cmake b/Tests/RunCMake/file-RPATH/TextCheck.cmake new file mode 100644 index 000000000..1f21ba73c --- /dev/null +++ b/Tests/RunCMake/file-RPATH/TextCheck.cmake @@ -0,0 +1,6 @@ +set(f "${CMAKE_CURRENT_BINARY_DIR}/not_a_binary.txt") +file(WRITE "${f}" "Not a binary.\n") +file(RPATH_CHECK FILE "${f}" RPATH "/some/rpath") +if(EXISTS "${f}") + message(FATAL_ERROR "RPATH_CHECK did not remove\n ${f}\nfor non-empty RPATH") +endif() diff --git a/Tests/RunCMake/file-RPATH/TextCheckEmpty.cmake b/Tests/RunCMake/file-RPATH/TextCheckEmpty.cmake new file mode 100644 index 000000000..806c73dae --- /dev/null +++ b/Tests/RunCMake/file-RPATH/TextCheckEmpty.cmake @@ -0,0 +1,6 @@ +set(f "${CMAKE_CURRENT_BINARY_DIR}/not_a_binary.txt") +file(WRITE "${f}" "Not a binary.\n") +file(RPATH_CHECK FILE "${f}" RPATH "") +if(NOT EXISTS "${f}") + message(FATAL_ERROR "RPATH_CHECK removed\n ${f}\nfor empty RPATH") +endif() diff --git a/Tests/RunCMake/file-RPATH/TextRemove.cmake b/Tests/RunCMake/file-RPATH/TextRemove.cmake new file mode 100644 index 000000000..aecaf6f43 --- /dev/null +++ b/Tests/RunCMake/file-RPATH/TextRemove.cmake @@ -0,0 +1,3 @@ +set(f "${CMAKE_CURRENT_BINARY_DIR}/not_a_binary.txt") +file(WRITE "${f}" "Not a binary.\n") +file(RPATH_REMOVE FILE "${f}") diff --git a/Tests/RunCMake/file-RPATH/TextSet-result.txt b/Tests/RunCMake/file-RPATH/TextSet-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/file-RPATH/TextSet-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file-RPATH/TextSet-stderr.txt b/Tests/RunCMake/file-RPATH/TextSet-stderr.txt new file mode 100644 index 000000000..811c9a5bf --- /dev/null +++ b/Tests/RunCMake/file-RPATH/TextSet-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at [^ +]*/Tests/RunCMake/file-RPATH/TextSet.cmake:[0-9]+ \(file\): + file RPATH_SET could not write new RPATH: + + /new/rpath + + to the file: + + [^ +]*/Tests/RunCMake/file-RPATH/TextSet-build/not_a_binary.txt + + The file format is not recognized\.$ diff --git a/Tests/RunCMake/file-RPATH/TextSet.cmake b/Tests/RunCMake/file-RPATH/TextSet.cmake new file mode 100644 index 000000000..f4b09d248 --- /dev/null +++ b/Tests/RunCMake/file-RPATH/TextSet.cmake @@ -0,0 +1,3 @@ +set(f "${CMAKE_CURRENT_BINARY_DIR}/not_a_binary.txt") +file(WRITE "${f}" "Not a binary.\n") +file(RPATH_SET FILE "${f}" NEW_RPATH "/new/rpath") diff --git a/Tests/RunCMake/file-RPATH/TextSetEmpty.cmake b/Tests/RunCMake/file-RPATH/TextSetEmpty.cmake new file mode 100644 index 000000000..d9517e08c --- /dev/null +++ b/Tests/RunCMake/file-RPATH/TextSetEmpty.cmake @@ -0,0 +1,3 @@ +set(f "${CMAKE_CURRENT_BINARY_DIR}/not_a_binary.txt") +file(WRITE "${f}" "Not a binary.\n") +file(RPATH_SET FILE "${f}" NEW_RPATH "") diff --git a/Tests/RunCMake/try_compile/EnvConfig.c b/Tests/RunCMake/try_compile/EnvConfig.c new file mode 100644 index 000000000..5b1d40052 --- /dev/null +++ b/Tests/RunCMake/try_compile/EnvConfig.c @@ -0,0 +1,7 @@ +#ifdef TC_CONFIG_BAD +# error "Built in 'Bad' config" +#endif +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/try_compile/EnvConfig.cmake b/Tests/RunCMake/try_compile/EnvConfig.cmake new file mode 100644 index 000000000..4040c593d --- /dev/null +++ b/Tests/RunCMake/try_compile/EnvConfig.cmake @@ -0,0 +1,18 @@ +enable_language(C) + +set(ENV{CMAKE_BUILD_TYPE} "Bad") +set(ENV{CMAKE_CONFIGURATION_TYPES} "Bad;Debug") + +add_library(tc_defs INTERFACE IMPORTED) +target_compile_definitions(tc_defs INTERFACE "TC_CONFIG_$<UPPER_CASE:$<CONFIG>>") + +try_compile(ENV_CONFIG_RESULT "${CMAKE_BINARY_DIR}" + SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/EnvConfig.c" + COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/EnvConfig.bin" + OUTPUT_VARIABLE tc_output + LINK_LIBRARIES tc_defs + ) +if(NOT ENV_CONFIG_RESULT) + string(REPLACE "\n" "\n " tc_output " ${tc_output}") + message(FATAL_ERROR "try_compile failed:\n${tc_output}") +endif() diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake index fffb03819..b19fd0ee9 100644 --- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake @@ -16,6 +16,8 @@ run_cmake(BadSources2) run_cmake(NonSourceCopyFile) run_cmake(NonSourceCompileDefinitions) +run_cmake(EnvConfig) + set(RunCMake_TEST_OPTIONS --debug-trycompile) run_cmake(PlatformVariables) run_cmake(WarnDeprecated) diff --git a/Tests/UseSWIG/CMakeLists.txt b/Tests/UseSWIG/CMakeLists.txt index c3f9e033a..c76e8a015 100644 --- a/Tests/UseSWIG/CMakeLists.txt +++ b/Tests/UseSWIG/CMakeLists.txt @@ -76,6 +76,7 @@ if(SWIG_FOUND AND NOT SWIG_VERSION VERSION_LESS "4.0.2" ${build_generator_args} --build-project TestBasicPython --build-options ${build_options} -DSWIG_USE_SWIG_DEPENDENCIES=ON + "-DSWIG_OUTFILE_DIR=${CMake_BINARY_DIR}/Tests/UseSWIG/BasicPython.Depfile" --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) add_test(NAME UseSWIG.Depfile.BasicPerl COMMAND diff --git a/Tests/VSManagedCustomCommand/CMakeLists.txt b/Tests/VSManagedCustomCommand/CMakeLists.txt new file mode 100644 index 000000000..222887511 --- /dev/null +++ b/Tests/VSManagedCustomCommand/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.20) +project(VSManagedCustomCommand CXX) + +add_custom_command(OUTPUT middle.txt + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/example.txt ${CMAKE_CURRENT_BINARY_DIR}/middle.txt + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/example.txt + ) + +add_custom_command(OUTPUT example.cxx + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/middle.txt ${CMAKE_CURRENT_BINARY_DIR}/example.cxx + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/middle.txt + ) + +add_library(example SHARED example.cxx) +set_property(TARGET example PROPERTY COMMON_LANGUAGE_RUNTIME "") diff --git a/Tests/VSManagedCustomCommand/example.txt b/Tests/VSManagedCustomCommand/example.txt new file mode 100644 index 000000000..05f95f1af --- /dev/null +++ b/Tests/VSManagedCustomCommand/example.txt @@ -0,0 +1,4 @@ +__declspec(dllexport) int example() +{ + return 0; +} diff --git a/Utilities/Release/macos/sign-notarize.bash b/Utilities/Release/macos/sign-notarize.bash new file mode 100755 index 000000000..377ecedde --- /dev/null +++ b/Utilities/Release/macos/sign-notarize.bash @@ -0,0 +1,118 @@ +#!/usr/bin/env bash +set -e +readonly usage='usage: sign-notarize.bash -i <id> -d <dev-acct> -k <key-item> [-p <provider>] [--] <package>.dmg + +Sign and notarize the "CMake.app" bundle inside the given "<package>.dmg" disk image. +Also produce a "<package>.tar.gz" tarball containing the same "CMake.app". + +Options: + + -i <id> Signing Identity + -d <dev-acct> Developer account name + -k <key-item> Keychain item containing account credentials + -p <provider> Provider short name +' + +cleanup() { + if test -d "$tmpdir"; then + rm -rf "$tmpdir" + fi + if test -d "$vol_path"; then + hdiutil detach "$vol_path" + fi +} + +trap "cleanup" EXIT + +die() { + echo "$@" 1>&2; exit 1 +} + +id='' +dev_acct='' +key_item='' +provider='' +while test "$#" != 0; do + case "$1" in + -i) shift; id="$1" ;; + -d) shift; dev_acct="$1" ;; + -k) shift; key_item="$1" ;; + -p) shift; provider="$1" ;; + --) shift ; break ;; + -*) die "$usage" ;; + *) break ;; + esac + shift +done +case "$1" in +*.dmg) readonly dmg="$1"; shift ;; +*) die "$usage" ;; +esac +test "$#" = 0 || die "$usage" + +# Verify arguments. +if test -z "$id" -o -z "$dev_acct" -o -z "$key_item"; then + die "$usage" +fi +if test -n "$provider"; then + provider="--provider $provider" +fi + +# Verify environment. +if ! xcnotary="$(type -p xcnotary)"; then + die "'xcnotary' not found in PATH" +fi +readonly xcnotary + +readonly tmpdir="$(mktemp -d)" + +# Prepare entitlements. +readonly entitlements_xml="$tmpdir/entitlements.xml" +echo '<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>com.apple.security.cs.allow-dyld-environment-variables</key> + <true/> +</dict> +</plist>' > "$entitlements_xml" + +# Extract SLA +readonly sla_xml="$tmpdir/sla.xml" +hdiutil udifderez -xml "$dmg" > "$sla_xml" +plutil -remove 'blkx' "$sla_xml" +plutil -remove 'plst' "$sla_xml" + +# Convert from read-only original image to read-write. +readonly udrw_dmg="$tmpdir/udrw.dmg" +hdiutil convert "$dmg" -format UDRW -o "${udrw_dmg}" + +# Mount the temporary udrw image. +readonly vol_name="$(basename "${dmg%.dmg}")" +readonly vol_path="/Volumes/$vol_name" +hdiutil attach "${udrw_dmg}" + +codesign --verify --timestamp --options=runtime --verbose --deep \ + -s "$id" \ + --entitlements "$entitlements_xml" \ + "$vol_path/CMake.app/Contents/bin/cmake" \ + "$vol_path/CMake.app/Contents/bin/ccmake" \ + "$vol_path/CMake.app/Contents/bin/ctest" \ + "$vol_path/CMake.app/Contents/bin/cpack" \ + "$vol_path/CMake.app/Contents/share/cmake"*"/Modules/Internal/CPack/CPack.OSXScriptLauncher.in" \ + "$vol_path/CMake.app" + +xcnotary notarize "$vol_path/CMake.app" -d "$dev_acct" -k "$key_item" $provider + +# Create a tarball of the volume next to the original disk image. +readonly tar_gz="${dmg/%.dmg/.tar.gz}" +tar cvzf "$tar_gz" -C /Volumes "$vol_name/CMake.app" + +# Unmount the modified udrw image. +hdiutil detach "$vol_path" + +# Convert back to read-only, compressed image. +hdiutil convert "${udrw_dmg}" -format UDZO -imagekey zlib-level=9 -ov -o "$dmg" + +# Re-insert SLA. +hdiutil udifrez -xml "${sla_xml}" 'FIXME_WHY_IS_THIS_ARGUMENT_NEEDED' "$dmg" |