diff options
author | JinWang An <jinwang.an@samsung.com> | 2022-12-27 17:20:01 +0900 |
---|---|---|
committer | JinWang An <jinwang.an@samsung.com> | 2022-12-27 17:20:01 +0900 |
commit | 39ffe0bb75b9a5a84ade197d469a816e80e2f4d5 (patch) | |
tree | 7f9b3d0b4b088b7b2f9f4246141aaa85cbbd9a2a | |
parent | 62fb436c87cb6ac30a448a2933b9febff4cf1661 (diff) | |
download | cmake-39ffe0bb75b9a5a84ade197d469a816e80e2f4d5.tar.gz cmake-39ffe0bb75b9a5a84ade197d469a816e80e2f4d5.tar.bz2 cmake-39ffe0bb75b9a5a84ade197d469a816e80e2f4d5.zip |
Imported Upstream version 3.21.5upstream/3.21.5
-rw-r--r-- | Help/command/add_library.rst | 5 | ||||
-rw-r--r-- | Help/command/try_compile.rst | 8 | ||||
-rw-r--r-- | Help/command/try_run.rst | 5 | ||||
-rw-r--r-- | Help/manual/cmake-generator-expressions.7.rst | 11 | ||||
-rw-r--r-- | Help/release/3.21.rst | 7 | ||||
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 8 | ||||
-rw-r--r-- | Modules/CMakeFindBinUtils.cmake | 2 | ||||
-rw-r--r-- | Modules/CMakeFortranCompiler.cmake.in | 1 | ||||
-rw-r--r-- | Modules/FindThreads.cmake | 19 | ||||
-rw-r--r-- | Modules/Platform/Windows-GNU.cmake | 2 | ||||
-rw-r--r-- | Modules/UseSWIG.cmake | 2 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 4 | ||||
-rw-r--r-- | Source/cmDependsFortran.cxx | 2 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 17 | ||||
-rw-r--r-- | Source/cmScanDepFormat.cxx | 2 | ||||
-rw-r--r-- | Source/cmakemain.cxx | 4 | ||||
-rw-r--r-- | Templates/MSBuild/FlagTables/v143_Link.json | 7 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/VsControlFlowGuardLinkSetting-check.cmake | 40 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/VsControlFlowGuardLinkSetting.cmake | 7 | ||||
-rw-r--r-- | Tests/UseSWIG/CMakeLists.txt | 1 |
21 files changed, 109 insertions, 46 deletions
diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst index dfc650091..1235155de 100644 --- a/Help/command/add_library.rst +++ b/Help/command/add_library.rst @@ -166,6 +166,8 @@ itself and is not included as a target in the generated buildsystem. call are ``PRIVATE`` to the interface library and do not appear in its :prop_tgt:`INTERFACE_SOURCES` target property. +.. _`add_library imported libraries`: + Imported Libraries ^^^^^^^^^^^^^^^^^^ @@ -205,7 +207,8 @@ The ``<type>`` must be one of: :prop_tgt:`IMPORTED_IMPLIB_<CONFIG>`) specifies the location of the DLL import library file (``.lib`` or ``.dll.a``) on disk, and the ``IMPORTED_LOCATION`` is the location of the ``.dll`` runtime - library (and is optional). + library (and is optional, but needed by the :genex:`TARGET_RUNTIME_DLLS` + generator expression). Additional usage requirements may be specified in ``INTERFACE_*`` properties. diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst index 06da910dd..08f8d5b62 100644 --- a/Help/command/try_compile.rst +++ b/Help/command/try_compile.rst @@ -19,10 +19,6 @@ Try Compiling Whole Projects Try building a project. The success or failure of the ``try_compile``, i.e. ``TRUE`` or ``FALSE`` respectively, is returned in ``<resultVar>``. -.. versionadded:: 3.14 - The name of the ``<resultVar>`` is defined by the user. Previously, it had - a fixed name ``RESULT_VAR``. - In this form, ``<srcdir>`` should contain a complete CMake project with a ``CMakeLists.txt`` file and all sources. The ``<bindir>`` and ``<srcdir>`` will not be deleted after this command is run. Specify ``<targetName>`` to @@ -51,10 +47,6 @@ Try building an executable or static library from one or more source files variable). The success or failure of the ``try_compile``, i.e. ``TRUE`` or ``FALSE`` respectively, is returned in ``<resultVar>``. -.. versionadded:: 3.14 - The name of the ``<resultVar>`` is defined by the user. Previously, it had - a fixed name ``RESULT_VAR``. - In this form, one or more source files must be provided. If :variable:`CMAKE_TRY_COMPILE_TARGET_TYPE` is unset or is set to ``EXECUTABLE``, the sources must include a definition for ``main`` and CMake will create a diff --git a/Help/command/try_run.rst b/Help/command/try_run.rst index 404de985d..fc41cdd7b 100644 --- a/Help/command/try_run.rst +++ b/Help/command/try_run.rst @@ -30,11 +30,6 @@ executable was built, but failed to run, then ``<runResultVar>`` will be set to ``FAILED_TO_RUN``. See the :command:`try_compile` command for information on how the test project is constructed to build the source file. -.. versionadded:: 3.14 - The names of the result variables ``<runResultVar>`` and - ``<compileResultVar>`` are defined by the user. Previously, they had - fixed names ``RUN_RESULT_VAR`` and ``COMPILE_RESULT_VAR``. - The options are: ``CMAKE_FLAGS <flags>...`` diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 5d508cb0d..d3cbd491c 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -1068,7 +1068,7 @@ which is just the string ``tgt``. .. code-block:: cmake - find_package(foo REQUIRED) + find_package(foo CONFIG REQUIRED) # package generated by install(EXPORT) add_executable(exe main.c) target_link_libraries(exe PRIVATE foo::foo foo::bar) @@ -1077,6 +1077,15 @@ which is just the string ``tgt``. COMMAND_EXPAND_LISTS ) + .. note:: + + :ref:`Imported Targets` are supported only if they know the location + of their ``.dll`` files. An imported ``SHARED`` or ``MODULE`` library + must have :prop_tgt:`IMPORTED_LOCATION` set to its ``.dll`` file. See + the :ref:`add_library imported libraries <add_library imported libraries>` + section for details. Many :ref:`Find Modules` produce imported targets + with the ``UNKNOWN`` type and therefore will be ignored. + .. genex:: $<INSTALL_PREFIX> Content of the install prefix when the target is exported via diff --git a/Help/release/3.21.rst b/Help/release/3.21.rst index e1c6172b2..ae954b282 100644 --- a/Help/release/3.21.rst +++ b/Help/release/3.21.rst @@ -334,3 +334,10 @@ Changes made since CMake 3.21.0 include the following. * The :generator:`Visual Studio 17 2022` generator is now based on the "Visual Studio 2022" release candidates. Previously it was based on preview versions. + +3.21.5 +------ + +This version made no changes to documented features or interfaces. +Some implementation updates were made to support ecosystem changes +and/or fix regressions. diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 30b4aec90..e564517c0 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -319,15 +319,13 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} set(id_cl "$(CLToolExe)") elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*") set(id_cl clang.exe) - # Executable names have been chosen according documentation - # URL: (https://software.intel.com/content/www/us/en/develop/documentation/get-started-with-dpcpp-compiler/top.html#top_GUID-A9B4C91D-97AC-450D-9742-9D895BC8AEE1) elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "Intel") if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "DPC\\+\\+ Compiler") set(id_cl dpcpp.exe) - elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "C\\+\\+ Compiler 2021") - set(id_cl icx.exe) - elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "C\\+\\+ Compiler") + elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "C\\+\\+ Compiler ([8-9]\\.|1[0-9]\\.|XE)") set(id_cl icl.exe) + elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "C\\+\\+ Compiler") + set(id_cl icx.exe) endif() else() set(id_cl cl.exe) diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index 8e9237a87..f3c2345d4 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -85,7 +85,7 @@ if(("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_SIMULATE_ID}" STREQUAL "xMSVC" AND list(PREPEND _CMAKE_MT_NAMES "llvm-mt") list(PREPEND _CMAKE_LINKER_NAMES "lld-link") list(APPEND _CMAKE_TOOL_VARS NM) - elseif("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" MATCHES "^xIntel") + elseif("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL "xIntel") list(PREPEND _CMAKE_AR_NAMES "xilib") list(PREPEND _CMAKE_LINKER_NAMES "xilink") endif() diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index 06ee5286d..d474f9644 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -5,6 +5,7 @@ set(CMAKE_Fortran_COMPILER_VERSION "@CMAKE_Fortran_COMPILER_VERSION@") set(CMAKE_Fortran_COMPILER_WRAPPER "@CMAKE_Fortran_COMPILER_WRAPPER@") set(CMAKE_Fortran_PLATFORM_ID "@CMAKE_Fortran_PLATFORM_ID@") set(CMAKE_Fortran_SIMULATE_ID "@CMAKE_Fortran_SIMULATE_ID@") +set(CMAKE_Fortran_COMPILER_FRONTEND_VARIANT "@CMAKE_Fortran_COMPILER_FRONTEND_VARIANT@") set(CMAKE_Fortran_SIMULATE_VERSION "@CMAKE_Fortran_SIMULATE_VERSION@") @_SET_CMAKE_Fortran_XL_CPP@ @_SET_CMAKE_Fortran_COMPILER_ARCHITECTURE_ID@ diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index c6a3451f7..ffd3352f9 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -164,18 +164,21 @@ if(CMAKE_HAVE_PTHREAD_H) elseif(CMAKE_CXX_COMPILER_LOADED) CHECK_CXX_SOURCE_COMPILES("${PTHREAD_C_CXX_TEST_SOURCE}" CMAKE_HAVE_LIBC_PTHREAD) endif() - if(CMAKE_HAVE_LIBC_PTHREAD) + + # Check for -pthread first if enabled. This is the recommended + # way, but not backwards compatible as one must also pass -pthread + # as compiler flag then. + if(THREADS_PREFER_PTHREAD_FLAG) + _check_pthreads_flag() + endif() + + if(Threads_FOUND) + # do nothing, we are done + elseif(CMAKE_HAVE_LIBC_PTHREAD) set(CMAKE_THREAD_LIBS_INIT "") set(CMAKE_HAVE_THREADS_LIBRARY 1) set(Threads_FOUND TRUE) else() - # Check for -pthread first if enabled. This is the recommended - # way, but not backwards compatible as one must also pass -pthread - # as compiler flag then. - if (THREADS_PREFER_PTHREAD_FLAG) - _check_pthreads_flag() - endif () - if(CMAKE_SYSTEM MATCHES "GHS-MULTI") _check_threads_lib(posix pthread_create CMAKE_HAVE_PTHREADS_CREATE) endif() diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index d0003803b..a04882f56 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -148,7 +148,7 @@ macro(__windows_compiler_gnu_abi lang) # Query the VS Installer tool for locations of VS 2017 and above. set(_vs_installer_paths "") - foreach(vs RANGE 16 15 -1) # change the first number to the largest supported version + foreach(vs RANGE 17 15 -1) # change the first number to the largest supported version cmake_host_system_information(RESULT _vs_dir QUERY VS_${vs}_DIR) if(_vs_dir) list(APPEND _vs_installer_paths "${_vs_dir}/VC/Auxiliary/Build") diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index 5c8f152bb..b48c33ce3 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -676,7 +676,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 3ca26b7e3..5dbcc825d 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 21) -set(CMake_VERSION_PATCH 4) +set(CMake_VERSION_PATCH 5) #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 [==[f65cebf51a CMake 3.21.4]==]) + set(git_info [==[6fe5df13c2 CMake 3.21.5]==]) # 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/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index bca26b9ca..a64dc27a9 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -648,7 +648,7 @@ bool cmDependsFortran::ModulesDiffer(const std::string& modFile, return true; } } - } else if (compilerId == "Intel") { + } else if (compilerId == "Intel" || compilerId == "IntelLLVM") { const char seq[2] = { '\n', '\0' }; const int seqlen = 2; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index a3e5553d7..945827701 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -16,6 +16,8 @@ #include <cmext/algorithm> #include <cmext/string_view> +#include "cm_codecvt.hxx" + #include "cmComputeLinkInformation.h" #include "cmCustomCommand.h" #include "cmCustomCommandGenerator.h" @@ -2046,11 +2048,22 @@ std::string cmMakefileTargetGenerator::CreateResponseFile( const char* name, std::string const& options, std::vector<std::string>& makefile_depends) { + // FIXME: Find a better way to determine the response file encoding, + // perhaps using tool-specific platform information variables. + // For now, use the makefile encoding as a heuristic. + codecvt::Encoding responseEncoding = + this->GlobalGenerator->GetMakefileEncoding(); + // Non-MSVC tooling may not understand a BOM. + if (responseEncoding == codecvt::UTF8_WITH_BOM && + !this->Makefile->IsOn("MSVC")) { + responseEncoding = codecvt::UTF8; + } + // Create the response file. std::string responseFileNameFull = cmStrCat(this->TargetBuildDirectoryFull, '/', name); - cmGeneratedFileStream responseStream( - responseFileNameFull, false, this->GlobalGenerator->GetMakefileEncoding()); + cmGeneratedFileStream responseStream(responseFileNameFull, false, + responseEncoding); responseStream.SetCopyIfDifferent(true); responseStream << options << "\n"; diff --git a/Source/cmScanDepFormat.cxx b/Source/cmScanDepFormat.cxx index 6fcbce5f1..82a374a83 100644 --- a/Source/cmScanDepFormat.cxx +++ b/Source/cmScanDepFormat.cxx @@ -97,7 +97,7 @@ bool cmScanDepFormat_P1689_Parse(std::string const& arg_pp, } Json::Value const& version = ppi["version"]; - if (version.asUInt() != 0) { + if (version.asUInt() > 1) { cmSystemTools::Error(cmStrCat("-E cmake_ninja_dyndep failed to parse ", arg_pp, ": version ", version.asString())); return false; diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 64d93df7f..95ad32048 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -161,11 +161,11 @@ void cmakemainMessageCallback(const std::string& m, // cannot use it to print messages. Another implementation will // be needed to print colored messages on Windows. static_cast<void>(md); - std::cerr << m << cmakemainGetStack(cm) << "\n"; + std::cerr << m << cmakemainGetStack(cm) << '\n' << std::flush; #else cmsysTerminal_cfprintf(md.desiredColor, stderr, "%s", m.c_str()); fflush(stderr); // stderr is buffered in some cases. - std::cerr << cmakemainGetStack(cm) << "\n"; + std::cerr << cmakemainGetStack(cm) << '\n' << std::flush; #endif } diff --git a/Templates/MSBuild/FlagTables/v143_Link.json b/Templates/MSBuild/FlagTables/v143_Link.json index 71d58f885..4422f55bd 100644 --- a/Templates/MSBuild/FlagTables/v143_Link.json +++ b/Templates/MSBuild/FlagTables/v143_Link.json @@ -978,13 +978,6 @@ "flags": [] }, { - "name": "LinkControlFlowGuard", - "switch": "guard:cf", - "comment": "Control Flow Guard", - "value": "true", - "flags": [] - }, - { "name": "LinkGuardEHContMetadata", "switch": "guard:ehcont", "comment": "Enable EH Continuation Metadata", diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index d5ed136ac..e11a24a96 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -41,6 +41,7 @@ run_cmake(VsDeployEnabled) run_cmake(VsSettings) run_cmake(VsSourceSettingsTool) run_cmake(VsPlatformToolset) +run_cmake(VsControlFlowGuardLinkSetting) run_cmake(VsWinRTByDefault) diff --git a/Tests/RunCMake/VS10Project/VsControlFlowGuardLinkSetting-check.cmake b/Tests/RunCMake/VS10Project/VsControlFlowGuardLinkSetting-check.cmake new file mode 100644 index 000000000..c13858bd9 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsControlFlowGuardLinkSetting-check.cmake @@ -0,0 +1,40 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/ControlFlowGuardProject.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ControlFlowGuardProject.vcxproj does not exist.") + return() +endif() + +set(Is_in_link_section 0) +set(HAS_ControlFlowGuardSetting 0) + +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "^ *<LinkControlFlowGuard>([^<>]+)</LinkControlFlowGuard>") + set(RunCMake_TEST_FAILED "Project file ControlFlowGuardProject.vcxproj contains the invalid <LinkControlFlowGuard> link property.") + return() + break() + endif() + if(line MATCHES "^ *<Link>") + # The start of the link section of the vcxproj file + set(Is_in_link_section 1) + continue() + endif() + if(line MATCHES "^ *</Link>") + # The end of the link section of the vcxproj file + set(Is_in_link_section 0) + continue() + endif() + if(Is_in_link_section) + if(line MATCHES "^ *<AdditionalOptions>([^<>]+)</AdditionalOptions>") + if("${CMAKE_MATCH_1}" MATCHES ".*/guard:cf.*") + set(HAS_ControlFlowGuardSetting 1) + break() + endif() + endif() + endif() +endforeach() + +if(NOT HAS_ControlFlowGuardSetting) + set(RunCMake_TEST_FAILED "Project file ControlFlowGuardProject.vcxproj does not have '/guard:cf' specified in the <AdditionalOptions> property.") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsControlFlowGuardLinkSetting.cmake b/Tests/RunCMake/VS10Project/VsControlFlowGuardLinkSetting.cmake new file mode 100644 index 000000000..31e69acd3 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsControlFlowGuardLinkSetting.cmake @@ -0,0 +1,7 @@ +enable_language(CXX) + +# Add the Control Flow Guard compiler and linker option +add_compile_options("/guard:cf") +string(APPEND CMAKE_SHARED_LINKER_FLAGS " /guard:cf") + +add_library(ControlFlowGuardProject SHARED foo.cpp) diff --git a/Tests/UseSWIG/CMakeLists.txt b/Tests/UseSWIG/CMakeLists.txt index f1b2f3214..6c0d5e483 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 |