diff --git a/Help/release/3.27.rst b/Help/release/3.27.rst index 2ba0c7dd9..8a67ebc2e 100644 --- a/Help/release/3.27.rst +++ b/Help/release/3.27.rst @@ -285,8 +285,8 @@ Changes made since CMake 3.27.0 include the following. to select the Windows 8.1 SDK. In CMake 3.27.[0-1] the ``version=`` field was limited to selecting Windows 10 SDKs. -3.27.3, 3.27.4, 3.27.5, 3.27.6, 3.27.7 --------------------------------------- +3.27.3, 3.27.4, 3.27.5, 3.27.6, 3.27.7, 3.27.8 +---------------------------------------------- * These versions made no changes to documented features or interfaces. Some implementation updates were made to support ecosystem changes diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index cd912c36a..1d0f34bb6 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -434,6 +434,8 @@ endfunction() macro(_OPENMP_SET_VERSION_BY_SPEC_DATE LANG) set(OpenMP_SPEC_DATE_MAP + "202111=5.2" + "202011=5.1" # Preview versions "201611=5.0" # OpenMP 5.0 preview 1 # Combined versions, 2.5 onwards diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 0cd49ab4b..0ba35b6b7 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -730,7 +730,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa if(gp_tool MATCHES "ldd$") set(gp_cmd_args "") - set(gp_regex "^[\t ]*[^\t ]+ =>[\t ]+(/[^\t\(]+)( \(.+\))?${eol_char}$") + set(gp_regex "^[\t ]*[^\t ]+ =>[\t ]+([^\t\(]+)( \(.+\))?${eol_char}$") set(gp_regex_error "not found${eol_char}$") set(gp_regex_fallback "^[\t ]*([^\t ]+) => ([^\t ]+).*${eol_char}$") set(gp_regex_cmp_count 1) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index f34505fcd..8af86f55d 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 7) +set(CMake_VERSION_PATCH 8) #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 [==[9532e1cf5b CMake 3.27.7]==]) + set(git_info [==[9cfff766eb CMake 3.27.8]==]) # 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/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index c78113766..a5536d00e 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -170,15 +170,8 @@ std::vector cmCommonTargetGenerator::GetLinkedTargetDirectories( cmGlobalCommonGenerator* const gg = this->GlobalCommonGenerator; if (cmComputeLinkInformation* cli = this->GeneratorTarget->GetLinkInformation(config)) { - 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) { + auto addLinkedTarget = [this, &lang, &config, &dirs, &emitted, + gg](cmGeneratorTarget const* linkee) { if (linkee && !linkee->IsImported() // Skip targets that build after this one in a static lib cycle. @@ -200,6 +193,15 @@ std::vector cmCommonTargetGenerator::GetLinkedTargetDirectories( } dirs.push_back(std::move(di)); } + }; + for (auto const& item : cli->GetItems()) { + addLinkedTarget(item.Target); + } + for (cmGeneratorTarget const* target : cli->GetObjectLibrariesLinked()) { + addLinkedTarget(target); + } + for (cmGeneratorTarget const* target : cli->GetExternalObjectTargets()) { + addLinkedTarget(target); } } return dirs; diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index f51a1c895..f80c5fbd5 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -499,6 +499,8 @@ std::pair cmComputeLinkDepends::AddLinkEntry( void cmComputeLinkDepends::AddLinkObject(cmLinkItem const& item) { + assert(!item.Target); // The item is an object file, not its target. + // Allocate a spot for the item entry. auto lei = this->AllocateLinkEntry(item); diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 7d3675ed5..9046f928a 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -15,6 +15,7 @@ #include "cmComputeLinkDepends.h" #include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" +#include "cmLinkItem.h" #include "cmList.h" #include "cmListFileCache.h" #include "cmLocalGenerator.h" @@ -23,6 +24,7 @@ #include "cmOrderDirectories.h" #include "cmPlaceholderExpander.h" #include "cmPolicies.h" +#include "cmSourceFile.h" #include "cmState.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" @@ -531,6 +533,12 @@ cmComputeLinkInformation::GetObjectLibrariesLinked() const return this->ObjectLibrariesLinked; } +const std::vector& +cmComputeLinkInformation::GetExternalObjectTargets() const +{ + return this->ExternalObjectTargets; +} + bool cmComputeLinkInformation::Compute() { // Skip targets that do not link or have link-like information consumers may @@ -678,6 +686,9 @@ bool cmComputeLinkInformation::Compute() this->Target->GetBacktrace()); } + // Record targets referenced by $ sources. + this->AddExternalObjectTargets(); + return true; } @@ -1052,6 +1063,26 @@ cmComputeLinkInformation::GetGroupFeature(std::string const& feature) .first->second; } +void cmComputeLinkInformation::AddExternalObjectTargets() +{ + std::vector externalObjects; + this->Target->GetExternalObjects(externalObjects, this->Config); + std::set emitted; + for (auto const* externalObject : externalObjects) { + std::string const& objLib = externalObject->GetObjectLibrary(); + if (objLib.empty()) { + continue; + } + if (emitted.insert(objLib).second) { + cmLinkItem const& objItem = + this->Target->ResolveLinkItem(BT(objLib)); + if (objItem.Target) { + this->ExternalObjectTargets.emplace_back(objItem.Target); + } + } + } +} + void cmComputeLinkInformation::AddImplicitLinkInfo() { // The link closure lists all languages whose implicit info is needed. @@ -1220,7 +1251,7 @@ void cmComputeLinkInformation::AddItem(LinkEntry const& entry) this->AddFullItem(entry); this->AddLibraryRuntimeInfo(item.Value); } - } else { + } else if (entry.Kind != cmComputeLinkDepends::LinkEntry::Object) { // This is a library or option specified by the user. this->AddUserItem(entry, true); } diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index 8393a29f7..1052b9687 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -98,6 +98,8 @@ public: std::set const& GetSharedLibrariesLinked() const; std::vector const& GetObjectLibrariesLinked() const; + std::vector const& GetExternalObjectTargets() + const; std::vector const& GetRuntimeDLLs() const { return this->RuntimeDLLs; @@ -135,6 +137,7 @@ private: std::vector RuntimeSearchPath; std::set SharedLibrariesLinked; std::vector ObjectLibrariesLinked; + std::vector ExternalObjectTargets; std::vector RuntimeDLLs; // Context information. @@ -219,6 +222,8 @@ private: bool FinishLinkerSearchDirectories(); void PrintLinkPolicyDiagnosis(std::ostream&); + void AddExternalObjectTargets(); + // Implicit link libraries and directories for linker language. void LoadImplicitLinkInfo(); void AddImplicitLinkInfo(); diff --git a/Tests/FortranModules/CMakeLists.txt b/Tests/FortranModules/CMakeLists.txt index 00f3e570c..16ea0d4da 100644 --- a/Tests/FortranModules/CMakeLists.txt +++ b/Tests/FortranModules/CMakeLists.txt @@ -134,3 +134,6 @@ if( # Intel Fortran VS Integration breaks on custom targets with Fortran sources add_subdirectory(Issue25252-iface-target) endif() add_subdirectory(Issue25252-iface-sources) + +add_subdirectory(Issue25365-target-objects) +add_subdirectory(Issue25365-target-objects-iface) diff --git a/Tests/FortranModules/Issue25365-target-objects-iface/CMakeLists.txt b/Tests/FortranModules/Issue25365-target-objects-iface/CMakeLists.txt new file mode 100644 index 000000000..819ac0566 --- /dev/null +++ b/Tests/FortranModules/Issue25365-target-objects-iface/CMakeLists.txt @@ -0,0 +1,11 @@ +enable_language(C) + +add_library(fortran_target_objects_sources_iface STATIC "${CMAKE_CURRENT_SOURCE_DIR}/iface.f90") + +add_library(fortran_target_objects_sources_iface_bridge INTERFACE) +target_sources(fortran_target_objects_sources_iface_bridge + INTERFACE + "$") + +add_library(lib25365-target-objects-iface lib.f90) +target_link_libraries(lib25365-target-objects-iface PRIVATE fortran_target_objects_sources_iface_bridge) diff --git a/Tests/FortranModules/Issue25365-target-objects-iface/iface.f90 b/Tests/FortranModules/Issue25365-target-objects-iface/iface.f90 new file mode 100644 index 000000000..6b5ddd59f --- /dev/null +++ b/Tests/FortranModules/Issue25365-target-objects-iface/iface.f90 @@ -0,0 +1,11 @@ +module m1 + +implicit none + +contains + +pure real function pi() +pi = 4*atan(1.) +end function + +end module m1 diff --git a/Tests/FortranModules/Issue25365-target-objects-iface/lib.f90 b/Tests/FortranModules/Issue25365-target-objects-iface/lib.f90 new file mode 100644 index 000000000..f97190970 --- /dev/null +++ b/Tests/FortranModules/Issue25365-target-objects-iface/lib.f90 @@ -0,0 +1,13 @@ +module lib + +use m1, only : pi + +implicit none + +contains + +pure real function func() +func = pi() +end function + +end module diff --git a/Tests/FortranModules/Issue25365-target-objects/CMakeLists.txt b/Tests/FortranModules/Issue25365-target-objects/CMakeLists.txt new file mode 100644 index 000000000..64e36cbf1 --- /dev/null +++ b/Tests/FortranModules/Issue25365-target-objects/CMakeLists.txt @@ -0,0 +1,5 @@ +enable_language(C) + +add_library(fortran_target_objects_sources STATIC "${CMAKE_CURRENT_SOURCE_DIR}/iface.f90") + +add_library(lib25365-target-objects lib.f90 "$") diff --git a/Tests/FortranModules/Issue25365-target-objects/iface.f90 b/Tests/FortranModules/Issue25365-target-objects/iface.f90 new file mode 100644 index 000000000..6b5ddd59f --- /dev/null +++ b/Tests/FortranModules/Issue25365-target-objects/iface.f90 @@ -0,0 +1,11 @@ +module m1 + +implicit none + +contains + +pure real function pi() +pi = 4*atan(1.) +end function + +end module m1 diff --git a/Tests/FortranModules/Issue25365-target-objects/lib.f90 b/Tests/FortranModules/Issue25365-target-objects/lib.f90 new file mode 100644 index 000000000..f97190970 --- /dev/null +++ b/Tests/FortranModules/Issue25365-target-objects/lib.f90 @@ -0,0 +1,13 @@ +module lib + +use m1, only : pi + +implicit none + +contains + +pure real function func() +func = pi() +end function + +end module diff --git a/Tests/ObjectLibrary/CMakeLists.txt b/Tests/ObjectLibrary/CMakeLists.txt index 05a35bb26..2bc23274a 100644 --- a/Tests/ObjectLibrary/CMakeLists.txt +++ b/Tests/ObjectLibrary/CMakeLists.txt @@ -68,7 +68,7 @@ add_library(UseCstaticObjs STATIC $ $ # Test a shared library with sources from a different shared library add_library(UseCsharedObjs SHARED $ $ $) -# Test a shared executable with sources from a different shared library +# Test a shared executable with sources from a different executable add_executable(UseABstaticObjs $) target_link_libraries(UseABstaticObjs ABstatic) @@ -77,3 +77,5 @@ add_subdirectory(ExportLanguages) add_subdirectory(LinkObjects) add_subdirectory(Transitive) + +add_subdirectory(TransitiveLinkDeps) diff --git a/Tests/ObjectLibrary/TransitiveLinkDeps/CMakeLists.txt b/Tests/ObjectLibrary/TransitiveLinkDeps/CMakeLists.txt new file mode 100644 index 000000000..3f561fabf --- /dev/null +++ b/Tests/ObjectLibrary/TransitiveLinkDeps/CMakeLists.txt @@ -0,0 +1,15 @@ +add_library(implgather INTERFACE) + +add_library(dep STATIC dep.c) + +add_library(deps INTERFACE) +target_link_libraries(deps INTERFACE dep) + +add_library(impl_obj OBJECT impl_obj.c) +target_link_libraries(impl_obj PUBLIC deps) + +target_sources(implgather INTERFACE "$") +target_link_libraries(implgather INTERFACE impl_obj) + +add_executable(useimpl main.c) +target_link_libraries(useimpl PRIVATE implgather) diff --git a/Tests/ObjectLibrary/TransitiveLinkDeps/dep.c b/Tests/ObjectLibrary/TransitiveLinkDeps/dep.c new file mode 100644 index 000000000..7cc62c37d --- /dev/null +++ b/Tests/ObjectLibrary/TransitiveLinkDeps/dep.c @@ -0,0 +1,4 @@ +int from_dep(void) +{ + return 0; +} diff --git a/Tests/ObjectLibrary/TransitiveLinkDeps/impl_obj.c b/Tests/ObjectLibrary/TransitiveLinkDeps/impl_obj.c new file mode 100644 index 000000000..f5760b7e2 --- /dev/null +++ b/Tests/ObjectLibrary/TransitiveLinkDeps/impl_obj.c @@ -0,0 +1,6 @@ +int from_dep(void); + +int impl_obj(void) +{ + return from_dep(); +} diff --git a/Tests/ObjectLibrary/TransitiveLinkDeps/main.c b/Tests/ObjectLibrary/TransitiveLinkDeps/main.c new file mode 100644 index 000000000..5661f57c8 --- /dev/null +++ b/Tests/ObjectLibrary/TransitiveLinkDeps/main.c @@ -0,0 +1,6 @@ +int impl_obj(void); + +int main(int argc, char* argv[]) +{ + return impl_obj(); +} diff --git a/Utilities/cmcurl/lib/socks.c b/Utilities/cmcurl/lib/socks.c index 53d798a64..b74071ad7 100644 --- a/Utilities/cmcurl/lib/socks.c +++ b/Utilities/cmcurl/lib/socks.c @@ -588,9 +588,9 @@ static CURLproxycode do_SOCKS5(struct Curl_cfilter *cf, /* RFC1928 chapter 5 specifies max 255 chars for domain name in packet */ if(!socks5_resolve_local && hostname_len > 255) { - infof(data, "SOCKS5: server resolving disabled for hostnames of " - "length > 255 [actual len=%zu]", hostname_len); - socks5_resolve_local = TRUE; + failf(data, "SOCKS5: the destination hostname is too long to be " + "resolved remotely by the proxy."); + return CURLPX_LONG_HOSTNAME; } if(auth & ~(CURLAUTH_BASIC | CURLAUTH_GSSAPI)) @@ -904,7 +904,7 @@ CONNECT_RESOLVE_REMOTE: } else { socksreq[len++] = 3; - socksreq[len++] = (char) hostname_len; /* one byte address length */ + socksreq[len++] = (unsigned char) hostname_len; /* one byte length */ memcpy(&socksreq[len], sx->hostname, hostname_len); /* w/o NULL */ len += hostname_len; }