From 354615eb8f3e53e88a5daac4795437424b6b1f84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20R=C3=B6hling?= Date: Wed, 26 Jul 2023 10:08:00 +0200 Subject: [PATCH] New upstream version 3.27.1 --- Help/release/3.26.rst | 4 ++-- Help/release/3.27.rst | 12 ++++++++++ Modules/FindCUDAToolkit.cmake | 2 +- Modules/FindOpenSSL.cmake | 2 +- Source/CMakeVersion.cmake | 4 ++-- Source/CTest/cmCTestRunTest.cxx | 8 ++++--- Source/CTest/cmCTestSubmitHandler.cxx | 21 ++++++++++-------- Source/cmCommonTargetGenerator.cxx | 12 +++++++--- Source/cmComputeLinkInformation.cxx | 14 ++++++++++-- Source/cmComputeLinkInformation.h | 3 +++ Source/cmTarget.cxx | 2 +- Tests/CMakeLists.txt | 2 +- Tests/FortranOnly/CMakeLists.txt | 10 ++++++++- Tests/FortranOnly/objmain.f90 | 5 +++++ Tests/FortranOnly/objmod.f90 | 7 ++++++ .../PropertyOverridesScript-stdout.txt | 6 +++++ .../RunCMake/CTestTimeout/RunCMakeTest.cmake | 7 ++++++ Tests/RunCMake/CXXModules/RunCMakeTest.cmake | 1 + .../examples/object-library-stderr.txt | 4 ++++ .../examples/object-library/CMakeLists.txt | 22 +++++++++++++++++++ .../examples/object-library/importable.cxx | 6 +++++ .../examples/object-library/main.cxx | 6 +++++ 22 files changed, 134 insertions(+), 26 deletions(-) create mode 100644 Tests/FortranOnly/objmain.f90 create mode 100644 Tests/FortranOnly/objmod.f90 create mode 100644 Tests/RunCMake/CTestTimeout/PropertyOverridesScript-stdout.txt create mode 100644 Tests/RunCMake/CXXModules/examples/object-library-stderr.txt create mode 100644 Tests/RunCMake/CXXModules/examples/object-library/CMakeLists.txt create mode 100644 Tests/RunCMake/CXXModules/examples/object-library/importable.cxx create mode 100644 Tests/RunCMake/CXXModules/examples/object-library/main.cxx diff --git a/Help/release/3.26.rst b/Help/release/3.26.rst index 1cf37ca99..c73c59abf 100644 --- a/Help/release/3.26.rst +++ b/Help/release/3.26.rst @@ -175,8 +175,8 @@ Updates Changes made since CMake 3.26.0 include the following. -3.26.1, 3.26.2, 3.26.3, 3.26.4 ------------------------------- +3.26.1, 3.26.2, 3.26.3, 3.26.4, 3.26.5 +-------------------------------------- * These versions made no changes to documented features or interfaces. Some implementation updates were made to support ecosystem changes diff --git a/Help/release/3.27.rst b/Help/release/3.27.rst index 52768d10e..e98a49a0f 100644 --- a/Help/release/3.27.rst +++ b/Help/release/3.27.rst @@ -256,3 +256,15 @@ Other Changes * :ref:`Visual Studio Generators`, for VS 15.8 (2017) and newer, now build custom commands in parallel. See policy :policy:`CMP0147`. + +Updates +======= + +Changes made since CMake 3.27.0 include the following. + +3.27.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/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake index 9cf7e2930..c2627e76a 100644 --- a/Modules/FindCUDAToolkit.cmake +++ b/Modules/FindCUDAToolkit.cmake @@ -1200,7 +1200,7 @@ if(CUDAToolkit_FOUND) endif() endif() - _CUDAToolkit_find_and_add_import_lib(nvrtc_builtins DEPS cuda_driver) + _CUDAToolkit_find_and_add_import_lib(nvrtc_builtins ALT nvrtc-builtins DEPS cuda_driver) _CUDAToolkit_find_and_add_import_lib(nvrtc DEPS nvrtc_builtins nvJitLink) if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 11.5.0) _CUDAToolkit_find_and_add_import_lib(nvrtc_builtins_static ALT nvrtc-builtins_static DEPS cuda_driver) diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index 426d00dce..10282a042 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -230,7 +230,7 @@ else() set(_OPENSSL_FIND_PATH_SUFFIX "include") endif() -if ((DEFINED OPENSSL_ROOT_DIR) OR (DEFINED ENV{OPENSSL_ROOT_DIR})) +if (OPENSSL_ROOT_DIR OR NOT "$ENV{OPENSSL_ROOT_DIR}" STREQUAL "") set(_OPENSSL_ROOT_HINTS HINTS ${OPENSSL_ROOT_DIR} ENV OPENSSL_ROOT_DIR) set(_OPENSSL_ROOT_PATHS NO_DEFAULT_PATH) elseif (MSVC) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 906c77d99..748432798 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 27) -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 [==[784596bd08 CMake 3.27.0]==]) + set(git_info [==[b5c54d9c8a CMake 3.27.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/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 9b62183dd..563439acd 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -758,11 +758,13 @@ bool cmCTestRunTest::ForkProcess() } // An explicit TIMEOUT=0 test property means "no timeout". - if (timeout && *timeout == std::chrono::duration::zero()) { - timeout = cm::nullopt; + if (timeout) { + if (*timeout == std::chrono::duration::zero()) { + timeout = cm::nullopt; + } } else { // Check --timeout. - if (!timeout && this->CTest->GetGlobalTimeout() > cmDuration::zero()) { + if (this->CTest->GetGlobalTimeout() > cmDuration::zero()) { timeout = this->CTest->GetGlobalTimeout(); } diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index a095e5dc6..7d4b0a847 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -143,7 +143,6 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP( const std::string& remoteprefix, const std::string& url) { CURL* curl; - CURLcode res; FILE* ftpfile; char error_buffer[1024]; // Set Content-Type to satisfy fussy modsecurity rules. @@ -211,8 +210,6 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP( if (this->CTest->ShouldUseHTTP10()) { curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); } - // enable HTTP ERROR parsing - curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1); /* enable uploading */ curl_easy_setopt(curl, CURLOPT_UPLOAD, 1); @@ -286,7 +283,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP( upload_as += "&MD5="; if (cmIsOn(this->GetOption("InternalTest"))) { - upload_as += "bad_md5sum"; + upload_as += "ffffffffffffffffffffffffffffffff"; } else { upload_as += cmSystemTools::ComputeFileHash(local_file, cmCryptoHash::AlgoMD5); @@ -338,7 +335,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP( ::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, &chunkDebug); // Now run off and do what you've been told! - res = ::curl_easy_perform(curl); + ::curl_easy_perform(curl); if (!chunk.empty()) { cmCTestOptionalLog(this->CTest, DEBUG, @@ -359,7 +356,11 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP( // If curl failed for any reason, or checksum fails, wait and retry // - if (res != CURLE_OK || this->HasErrors) { + long response_code; + curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code); + bool successful_submission = response_code == 200; + + if (!successful_submission || this->HasErrors) { std::string retryDelay = *this->GetOption("RetryDelay"); std::string retryCount = *this->GetOption("RetryCount"); @@ -397,7 +398,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP( chunkDebug.clear(); this->HasErrors = false; - res = ::curl_easy_perform(curl); + ::curl_easy_perform(curl); if (!chunk.empty()) { cmCTestOptionalLog(this->CTest, DEBUG, @@ -408,14 +409,16 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP( this->ParseResponse(chunk); } - if (res == CURLE_OK && !this->HasErrors) { + curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code); + if (response_code == 200 && !this->HasErrors) { + successful_submission = true; break; } } } fclose(ftpfile); - if (res) { + if (!successful_submission) { cmCTestLog(this->CTest, ERROR_MESSAGE, " Error when uploading file: " << local_file << std::endl); diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index e635dd931..1924235dd 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -170,9 +170,15 @@ std::vector cmCommonTargetGenerator::GetLinkedTargetDirectories( cmGlobalCommonGenerator* const gg = this->GlobalCommonGenerator; if (cmComputeLinkInformation* cli = this->GeneratorTarget->GetLinkInformation(config)) { - cmComputeLinkInformation::ItemVector const& items = cli->GetItems(); - for (auto const& item : items) { - cmGeneratorTarget const* linkee = item.Target; + std::vector targets; + for (auto const& item : cli->GetItems()) { + targets.push_back(item.Target); + } + for (auto const* target : cli->GetObjectLibrariesLinked()) { + targets.push_back(target); + } + + for (auto const* linkee : targets) { if (linkee && !linkee->IsImported() // Skip targets that build after this one in a static lib cycle. diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index b80b3cb6f..ebbb88f6a 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -525,6 +525,12 @@ cmComputeLinkInformation::GetSharedLibrariesLinked() const return this->SharedLibrariesLinked; } +const std::vector& +cmComputeLinkInformation::GetObjectLibrariesLinked() const +{ + return this->ObjectLibrariesLinked; +} + bool cmComputeLinkInformation::Compute() { // Skip targets that do not link. @@ -1147,8 +1153,12 @@ void cmComputeLinkInformation::AddItem(LinkEntry const& entry) this->AddItem(BT(libName, item.Backtrace)); } } else if (tgt->GetType() == cmStateEnums::OBJECT_LIBRARY) { - // Ignore object library! - // Its object-files should already have been extracted for linking. + if (!tgt->HaveCxx20ModuleSources() && !tgt->HaveFortranSources(config)) { + // Ignore object library! + // Its object-files should already have been extracted for linking. + } else { + this->ObjectLibrariesLinked.push_back(entry.Target); + } } else { // Decide whether to use an import library. cmStateEnums::ArtifactType artifact = tgt->HasImportLibrary(config) diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index a4ada1fab..8393a29f7 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -96,6 +96,8 @@ public: std::string GetRPathString(bool for_install) const; std::string GetChrpathString() const; std::set const& GetSharedLibrariesLinked() const; + std::vector const& GetObjectLibrariesLinked() + const; std::vector const& GetRuntimeDLLs() const { return this->RuntimeDLLs; @@ -132,6 +134,7 @@ private: std::vector FrameworkPaths; std::vector RuntimeSearchPath; std::set SharedLibrariesLinked; + std::vector ObjectLibrariesLinked; std::vector RuntimeDLLs; // Context information. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 81497f59a..b53adf84d 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -420,7 +420,7 @@ TargetProperty const StaticTargetProperties[] = { { "Fortran_FORMAT"_s, IC::CanCompileSources }, { "Fortran_MODULE_DIRECTORY"_s, IC::CanCompileSources }, { "Fortran_COMPILER_LAUNCHER"_s, IC::CanCompileSources }, - { "Fortran_PREPRPOCESS"_s, IC::CanCompileSources }, + { "Fortran_PREPROCESS"_s, IC::CanCompileSources }, { "Fortran_VISIBILITY_PRESET"_s, IC::CanCompileSources }, // ---- HIP COMMON_LANGUAGE_PROPERTIES(HIP), diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 53bb1e654..19dea8f57 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -3290,7 +3290,7 @@ if(BUILD_TESTING) "${CMake_BINARY_DIR}/Tests/CTestTestChecksum/testOutput.log" ) set_tests_properties(CTestTestChecksum PROPERTIES PASS_REGULAR_EXPRESSION - "Submission failed: Checksum failed for file") + "md5 mismatch") # these tests take a long time, make sure they have it # if timeouts have not already been set diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt index ed2a440d4..dfc28dd81 100644 --- a/Tests/FortranOnly/CMakeLists.txt +++ b/Tests/FortranOnly/CMakeLists.txt @@ -169,8 +169,11 @@ endif() # extensions like '.F' and '.fpp'. if(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF AND NOT CMAKE_Fortran_COMPILER_ID MATCHES "(Flang|NAG|PGI|NVHPC|SunPro|XL)") + + set(CMAKE_Fortran_PREPROCESS OFF) add_library(no_preprocess_target STATIC no_preprocess_target_upper.F) target_compile_options(no_preprocess_target PRIVATE -DINTEGER=nonsense) + unset(CMAKE_Fortran_PREPROCESS) add_library(no_preprocess_source STATIC no_preprocess_source_upper.F) target_compile_options(no_preprocess_source PRIVATE -DINTEGER=nonsense) @@ -181,6 +184,11 @@ if(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF AND target_sources(no_preprocess_source PRIVATE no_preprocess_source_fpp.fpp) endif() - set_property(TARGET no_preprocess_target PROPERTY Fortran_PREPROCESS OFF) set_property(SOURCE no_preprocess_source_upper.F no_preprocess_source_fpp.fpp PROPERTY Fortran_PREPROCESS OFF) endif() + +# Issue 25112 +set(CMAKE_Fortran_MODULE_DIRECTORY "${PROJECT_BINARY_DIR}/include") +add_library(objmod OBJECT objmod.f90) +add_executable(objmain objmain.f90) +target_link_libraries(objmain PRIVATE objmod) diff --git a/Tests/FortranOnly/objmain.f90 b/Tests/FortranOnly/objmain.f90 new file mode 100644 index 000000000..d41d45464 --- /dev/null +++ b/Tests/FortranOnly/objmain.f90 @@ -0,0 +1,5 @@ +program main + use objmod, only : hello + implicit none + call hello() +end program diff --git a/Tests/FortranOnly/objmod.f90 b/Tests/FortranOnly/objmod.f90 new file mode 100644 index 000000000..6b79cc792 --- /dev/null +++ b/Tests/FortranOnly/objmod.f90 @@ -0,0 +1,7 @@ +module objmod + implicit none +contains + subroutine hello() + print '(a)', "hello world" + end subroutine hello +end module objmod diff --git a/Tests/RunCMake/CTestTimeout/PropertyOverridesScript-stdout.txt b/Tests/RunCMake/CTestTimeout/PropertyOverridesScript-stdout.txt new file mode 100644 index 000000000..6e4648575 --- /dev/null +++ b/Tests/RunCMake/CTestTimeout/PropertyOverridesScript-stdout.txt @@ -0,0 +1,6 @@ +Test project [^ +]*/Tests/RunCMake/CTestTimeout/PropertyOverridesScript-build + Start 1: TestTimeout +1/1 Test #1: TestTimeout ...................... Passed +[1-9][0-9.]* sec ++ +100% tests passed, 0 tests failed out of 1 diff --git a/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake b/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake index 6caeef10a..2f9eda121 100644 --- a/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake @@ -87,3 +87,10 @@ block() set(CASE_TEST_PREFIX_CODE "set(CTEST_TEST_TIMEOUT 2)") run_ctest_timeout(ZeroOverridesVar) endblock() + +block() + set(TIMEOUT 4) + set(CASE_TEST_PREFIX_CODE "set(CTEST_TEST_TIMEOUT 2)") + set(CASE_CMAKELISTS_SUFFIX_CODE "set_property(TEST TestTimeout PROPERTY TIMEOUT 10)\n") + run_ctest_timeout(PropertyOverridesScript) +endblock() diff --git a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake index 1009ce482..d324ec940 100644 --- a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake +++ b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake @@ -142,6 +142,7 @@ string(REPLACE "," ";" CMake_TEST_MODULE_COMPILATION "${CMake_TEST_MODULE_COMPIL if ("named" IN_LIST CMake_TEST_MODULE_COMPILATION) run_cxx_module_test(simple) run_cxx_module_test(library library-static -DBUILD_SHARED_LIBS=OFF) + run_cxx_module_test(object-library) run_cxx_module_test(generated) run_cxx_module_test(deep-chain) run_cxx_module_test(duplicate) diff --git a/Tests/RunCMake/CXXModules/examples/object-library-stderr.txt b/Tests/RunCMake/CXXModules/examples/object-library-stderr.txt new file mode 100644 index 000000000..4709399f0 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/object-library-stderr.txt @@ -0,0 +1,4 @@ +CMake Warning \(dev\) at CMakeLists.txt:[0-9]* \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/object-library/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/object-library/CMakeLists.txt new file mode 100644 index 000000000..238e30a19 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/object-library/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_objlib CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +add_library(objlib OBJECT) +target_sources(objlib + PUBLIC + FILE_SET CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + importable.cxx) +target_compile_features(objlib PUBLIC cxx_std_20) + +add_executable(objmain) +target_sources(objmain + PRIVATE + main.cxx) +target_link_libraries(objmain PRIVATE objlib) + +add_test(NAME objmain COMMAND objmain) diff --git a/Tests/RunCMake/CXXModules/examples/object-library/importable.cxx b/Tests/RunCMake/CXXModules/examples/object-library/importable.cxx new file mode 100644 index 000000000..607680a07 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/object-library/importable.cxx @@ -0,0 +1,6 @@ +export module importable; + +export int from_import() +{ + return 0; +} diff --git a/Tests/RunCMake/CXXModules/examples/object-library/main.cxx b/Tests/RunCMake/CXXModules/examples/object-library/main.cxx new file mode 100644 index 000000000..feb38d22e --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/object-library/main.cxx @@ -0,0 +1,6 @@ +import importable; + +int main(int argc, char* argv[]) +{ + return from_import(); +}