diff options
author | JinWang An <jinwang.an@samsung.com> | 2022-12-27 17:20:20 +0900 |
---|---|---|
committer | JinWang An <jinwang.an@samsung.com> | 2022-12-27 17:20:20 +0900 |
commit | d3369211b9dc44c4dc91f8e88d9369a91b1736a9 (patch) | |
tree | da2a758bb2629fbd6c2c120c8dcee2058ec72c6e | |
parent | c2873843eeadaa4dcbfd9658fb4d9b26d6f90dee (diff) | |
download | cmake-d3369211b9dc44c4dc91f8e88d9369a91b1736a9.tar.gz cmake-d3369211b9dc44c4dc91f8e88d9369a91b1736a9.tar.bz2 cmake-d3369211b9dc44c4dc91f8e88d9369a91b1736a9.zip |
Imported Upstream version 3.24.1upstream/3.24.1
-rw-r--r-- | Help/prop_tgt/COMPILE_WARNING_AS_ERROR.rst | 25 | ||||
-rw-r--r-- | Help/release/3.24.rst | 17 | ||||
-rw-r--r-- | Modules/Compiler/GNU.cmake | 9 | ||||
-rw-r--r-- | Modules/Compiler/TI.cmake | 1 | ||||
-rw-r--r-- | Modules/FindThreads.cmake | 6 | ||||
-rw-r--r-- | Modules/FindVulkan.cmake | 10 | ||||
-rw-r--r-- | Modules/Platform/Windows-GNU.cmake | 2 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 4 | ||||
-rw-r--r-- | Source/cmExportFileGenerator.cxx | 7 | ||||
-rw-r--r-- | Source/cmQtAutoMocUic.cxx | 18 | ||||
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/ExportImport/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/ExportImport/RunCMakeTest.cmake | 24 | ||||
-rw-r--r-- | Tests/RunCMake/ExportImport/SharedDep-export.cmake | 13 | ||||
-rw-r--r-- | Tests/RunCMake/ExportImport/SharedDep-import.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/ExportImport/bar-config.cmake.in | 2 | ||||
-rw-r--r-- | Tests/RunCMake/ExportImport/bar.c | 12 | ||||
-rw-r--r-- | Tests/RunCMake/ExportImport/foo-config.cmake.in | 1 | ||||
-rw-r--r-- | Tests/RunCMake/ExportImport/foo.c | 7 |
19 files changed, 149 insertions, 14 deletions
diff --git a/Help/prop_tgt/COMPILE_WARNING_AS_ERROR.rst b/Help/prop_tgt/COMPILE_WARNING_AS_ERROR.rst index 86a0f7f66..19323cb39 100644 --- a/Help/prop_tgt/COMPILE_WARNING_AS_ERROR.rst +++ b/Help/prop_tgt/COMPILE_WARNING_AS_ERROR.rst @@ -5,6 +5,31 @@ COMPILE_WARNING_AS_ERROR Specify whether to treat warnings on compile as errors. If enabled, adds a flag to treat warnings on compile as errors. +If the ``--compile-no-warning-as-error`` option is given on the +:manual:`cmake(1)` command line, this property is ignored. + +This property is not implemented for all compilers. It is silently ignored +if there is no implementation for the compiler being used. The currently +implemented :variable:`compiler IDs <CMAKE_<LANG>_COMPILER_ID>` are: + +* ``GNU`` +* ``Clang`` +* ``AppleClang`` +* ``Fujitsu`` +* ``FujitsuClang`` +* ``IBMClang`` +* ``Intel`` +* ``IntelLLVM`` +* ``LCC`` +* ``MSVC`` +* ``NVHPC`` +* ``NVIDIA`` (CUDA) +* ``QCC`` +* ``SunPro`` +* ``TI`` +* ``VisualAge`` +* ``XL`` +* ``XLClang`` This property is initialized by the value of the variable :variable:`CMAKE_COMPILE_WARNING_AS_ERROR` if it is set when a target is created. diff --git a/Help/release/3.24.rst b/Help/release/3.24.rst index 02252e0c5..ecf6f1cc5 100644 --- a/Help/release/3.24.rst +++ b/Help/release/3.24.rst @@ -317,6 +317,11 @@ Deprecated and Removed Features * The :module:`FindGLUT` module no longer provides the undocumented ``GLUT_LIBRARY`` and ``GLUT_INCLUDE_PATH`` result variables. +* The :module:`FindVulkan` module no longer silently ignores unknown + components requested by a ``find_package(Vulkan REQUIRED ...)`` call. + With the addition of support for components, requests for unknown + components now produce an error. + Other Changes ============= @@ -348,3 +353,15 @@ Other Changes * A precompiled Windows ``arm64`` binary is now provided on `cmake.org`_. .. _`cmake.org`: https://cmake.org/download/ + +Updates +======= + +Changes made since CMake 3.24.0 include the following. + +3.24.1 +------ + +* 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/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index db1eab557..48639cd67 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -79,8 +79,15 @@ macro(__compiler_gnu lang) # * https://gcc.gnu.org/onlinedocs/gcc-9.5.0/gcc/Optimize-Options.html#Optimize-Options (no) # * https://gcc.gnu.org/onlinedocs/gcc-10.1.0/gcc/Optimize-Options.html#Optimize-Options (yes) # Since GCC 12.1, the abundance of a parameter produces a warning if compiling multiple targets. - if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 10.1) + # FIXME: What version of GCC for Windows added support for -flto=auto? 10.3 does not have it. + if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 11.0) list(APPEND __lto_flags -flto=auto) + elseif(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 10.1) + if (CMAKE_HOST_WIN32) + list(APPEND __lto_flags -flto=1) + else() + list(APPEND __lto_flags -flto=auto) + endif() else() list(APPEND __lto_flags -flto) endif() diff --git a/Modules/Compiler/TI.cmake b/Modules/Compiler/TI.cmake index 0f9ded3ca..6cb115baf 100644 --- a/Modules/Compiler/TI.cmake +++ b/Modules/Compiler/TI.cmake @@ -15,6 +15,7 @@ set(__COMPILER_TI_SOURCE_FLAG_CXX "--cpp_file") set(__COMPILER_TI_SOURCE_FLAG_ASM "--asm_file") macro(__compiler_ti lang) + set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "--emit_warnings_as_errors") set(CMAKE_${lang}_RESPONSE_FILE_FLAG "--cmd_file=") # Using --cmd_file flag is not possible after the --run_linker flag. # By using a whitespace only the filename is used without flag. diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index a2304c2eb..a675fd675 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -122,7 +122,11 @@ endmacro() macro(_threads_check_flag_pthread) if(NOT Threads_FOUND) # If we did not find -lpthreads, -lpthread, or -lthread, look for -pthread - if(NOT DEFINED THREADS_HAVE_PTHREAD_ARG) + # except on compilers known to not have it. + if(MSVC) + # Compilers targeting the MSVC ABI do not have a -pthread flag. + set(THREADS_HAVE_PTHREAD_ARG FALSE) + elseif(NOT DEFINED THREADS_HAVE_PTHREAD_ARG) message(CHECK_START "Check if compiler accepts -pthread") if(CMAKE_C_COMPILER_LOADED) set(_threads_src ${CMAKE_CURRENT_LIST_DIR}/CheckForPthreads.c) diff --git a/Modules/FindVulkan.cmake b/Modules/FindVulkan.cmake index 2c702274c..7ca7d03bf 100644 --- a/Modules/FindVulkan.cmake +++ b/Modules/FindVulkan.cmake @@ -172,6 +172,16 @@ environment. cmake_policy(PUSH) cmake_policy(SET CMP0057 NEW) +# Provide compatibility with a common invalid component request that +# was silently ignored prior to CMake 3.24. +if("FATAL_ERROR" IN_LIST Vulkan_FIND_COMPONENTS) + message(AUTHOR_WARNING + "Ignoring unknown component 'FATAL_ERROR'.\n" + "The find_package() command documents no such argument." + ) + list(REMOVE_ITEM Vulkan_FIND_COMPONENTS "FATAL_ERROR") +endif() + # For backward compatibility as `FindVulkan` in previous CMake versions allow to retrieve `glslc` # and `glslangValidator` without requesting the corresponding component. if(NOT glslc IN_LIST Vulkan_FIND_COMPONENTS) diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index b46416907..bf96e637b 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -157,7 +157,7 @@ macro(__windows_compiler_gnu lang) endif() if(NOT CMAKE_RC_COMPILER_INIT AND NOT CMAKE_GENERATOR_RC) - set(CMAKE_RC_COMPILER_INIT ${_CMAKE_TOOLCHAIN_PREFIX}windres) + set(CMAKE_RC_COMPILER_INIT ${_CMAKE_TOOLCHAIN_PREFIX}windres windres) endif() enable_language(RC) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 737e53dd2..e467a3d8d 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 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 [==[4be24f031a CMake 3.24.0]==]) + set(git_info [==[c3793b4157 CMake 3.24.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/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 452eb998b..5a33349b1 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -843,9 +843,16 @@ void cmExportFileGenerator::SetImportDetailProperties( suffix, target, "IMPORTED_LINK_INTERFACE_LANGUAGES", iface->Languages, properties, ImportLinkPropertyTargetNames::No); + // Export IMPORTED_LINK_DEPENDENT_LIBRARIES to help consuming linkers + // find private dependencies of shared libraries. + std::size_t oldMissingTargetsSize = this->MissingTargets.size(); this->SetImportLinkProperty( suffix, target, "IMPORTED_LINK_DEPENDENT_LIBRARIES", iface->SharedDeps, properties, ImportLinkPropertyTargetNames::Yes); + // Avoid enforcing shared library private dependencies as public package + // dependencies by ignoring missing targets added for them. + this->MissingTargets.resize(oldMissingTargetsSize); + if (iface->Multiplicity > 0) { std::string prop = cmStrCat("IMPORTED_LINK_INTERFACE_MULTIPLICITY", suffix); diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index a7125b170..8c09b5699 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -2167,22 +2167,23 @@ void cmQtAutoMocUicT::JobCompileUicT::Process() void cmQtAutoMocUicT::JobMocsCompilationT::Process() { + std::string const& compAbs = this->MocConst().CompFileAbs; + // Compose mocs compilation file content std::string content = "// This file is autogenerated. Changes will be overwritten.\n"; 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" - "struct cmake_automoc_silence_linker_warning{\n" - " virtual ~cmake_automoc_silence_linker_warning();\n" - "};\n" - "\n" - "inline " - "cmake_automoc_silence_linker_warning::" - "~cmake_automoc_silence_linker_warning()\n" - "{}\n"; + "void " + + functionName + "() {}\n"; } else { // Valid content const bool mc = this->BaseConst().MultiConfig; @@ -2191,7 +2192,6 @@ void cmQtAutoMocUicT::JobMocsCompilationT::Process() content += cmWrap(wrapFront, this->MocEval().CompFiles, wrapBack, ""); } - std::string const& compAbs = this->MocConst().CompFileAbs; if (cmQtAutoGenerator::FileDiffers(compAbs, content)) { // Actually write mocs compilation file if (this->Log().Verbose()) { diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 69def6de1..09f248e55 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -301,6 +301,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") add_RunCMake_test(ExportCompileCommands) endif() add_RunCMake_test(ExcludeFromAll) +add_RunCMake_test(ExportImport) add_RunCMake_test(ExternalData) add_RunCMake_test(FeatureSummary) add_RunCMake_test(FPHSA) diff --git a/Tests/RunCMake/ExportImport/CMakeLists.txt b/Tests/RunCMake/ExportImport/CMakeLists.txt new file mode 100644 index 000000000..5ff8d3e0f --- /dev/null +++ b/Tests/RunCMake/ExportImport/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.23) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ExportImport/RunCMakeTest.cmake b/Tests/RunCMake/ExportImport/RunCMakeTest.cmake new file mode 100644 index 000000000..d07fca2a1 --- /dev/null +++ b/Tests/RunCMake/ExportImport/RunCMakeTest.cmake @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.23) +include(RunCMake) + +function(run_ExportImport_test case) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-export-build) + set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root) + if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) + endif() + run_cmake(${case}-export) + unset(RunCMake_TEST_OPTIONS) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(${case}-export-build ${CMAKE_COMMAND} --build . --config Debug) + run_cmake_command(${case}-export-install ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -P cmake_install.cmake) + unset(RunCMake_TEST_NO_CLEAN) + + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-import-build) + run_cmake_with_options(${case}-import + -Dfoo_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/foo + -Dbar_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/bar + ) +endfunction() + +run_ExportImport_test(SharedDep) diff --git a/Tests/RunCMake/ExportImport/SharedDep-export.cmake b/Tests/RunCMake/ExportImport/SharedDep-export.cmake new file mode 100644 index 000000000..2da3e47a6 --- /dev/null +++ b/Tests/RunCMake/ExportImport/SharedDep-export.cmake @@ -0,0 +1,13 @@ +enable_language(C) + +add_library(foo SHARED foo.c) +install(TARGETS foo EXPORT foo) +install(EXPORT foo DESTINATION lib/cmake/foo) +install(FILES foo-config.cmake.in RENAME foo-config.cmake DESTINATION lib/cmake/foo) + +add_library(bar SHARED bar.c) +target_link_libraries(bar PRIVATE foo) +# 'foo' only appears in IMPORTED_LINK_DEPENDENT_LIBRARIES, and so is not enforced on import. +install(TARGETS bar EXPORT bar) +install(EXPORT bar DESTINATION lib/cmake/bar) +install(FILES bar-config.cmake.in RENAME bar-config.cmake DESTINATION lib/cmake/bar) diff --git a/Tests/RunCMake/ExportImport/SharedDep-import.cmake b/Tests/RunCMake/ExportImport/SharedDep-import.cmake new file mode 100644 index 000000000..2e2c2f642 --- /dev/null +++ b/Tests/RunCMake/ExportImport/SharedDep-import.cmake @@ -0,0 +1 @@ +find_package(bar REQUIRED CONFIG NO_DEFAULT_PATH) diff --git a/Tests/RunCMake/ExportImport/bar-config.cmake.in b/Tests/RunCMake/ExportImport/bar-config.cmake.in new file mode 100644 index 000000000..9148046a6 --- /dev/null +++ b/Tests/RunCMake/ExportImport/bar-config.cmake.in @@ -0,0 +1,2 @@ +# find_dependency(foo) intentionally left out for this test case +include(${CMAKE_CURRENT_LIST_DIR}/bar.cmake) diff --git a/Tests/RunCMake/ExportImport/bar.c b/Tests/RunCMake/ExportImport/bar.c new file mode 100644 index 000000000..19adca9cd --- /dev/null +++ b/Tests/RunCMake/ExportImport/bar.c @@ -0,0 +1,12 @@ +#if defined(_WIN32) +__declspec(dllimport) +#endif + int foo(void); + +#ifdef _WIN32 +__declspec(dllexport) +#endif + int bar(void) +{ + return foo(); +} diff --git a/Tests/RunCMake/ExportImport/foo-config.cmake.in b/Tests/RunCMake/ExportImport/foo-config.cmake.in new file mode 100644 index 000000000..b0381387a --- /dev/null +++ b/Tests/RunCMake/ExportImport/foo-config.cmake.in @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/foo.cmake) diff --git a/Tests/RunCMake/ExportImport/foo.c b/Tests/RunCMake/ExportImport/foo.c new file mode 100644 index 000000000..879496537 --- /dev/null +++ b/Tests/RunCMake/ExportImport/foo.c @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int foo(void) +{ + return 0; +} |