mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-04 05:10:10 -05:00
macOS: GNU toolchain: ensure framework, marked as SYSTEM, can be linked
Fixes: #25263
This commit is contained in:
@@ -192,24 +192,16 @@ std::string cmLinkLineComputer::ComputeRPath(cmComputeLinkInformation& cli)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string cmLinkLineComputer::ComputeFrameworkPath(
|
std::string cmLinkLineComputer::ComputeFrameworkPath(
|
||||||
cmComputeLinkInformation& cli, cmValue fwSearchFlag, cmValue sysFwSearchFlag)
|
cmComputeLinkInformation& cli, cmValue fwSearchFlag)
|
||||||
{
|
{
|
||||||
if (!fwSearchFlag && !sysFwSearchFlag) {
|
if (!fwSearchFlag) {
|
||||||
return std::string{};
|
return std::string{};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string frameworkPath;
|
std::string frameworkPath;
|
||||||
auto const& fwDirs = cli.GetFrameworkPaths();
|
for (auto const& fd : cli.GetFrameworkPaths()) {
|
||||||
for (auto const& fd : fwDirs) {
|
frameworkPath +=
|
||||||
if (sysFwSearchFlag &&
|
cmStrCat(fwSearchFlag, this->ConvertToOutputFormat(fd), ' ');
|
||||||
cli.GetTarget()->IsSystemIncludeDirectory(fd, cli.GetConfig(),
|
|
||||||
cli.GetLinkLanguage())) {
|
|
||||||
frameworkPath += sysFwSearchFlag;
|
|
||||||
} else {
|
|
||||||
frameworkPath += fwSearchFlag;
|
|
||||||
}
|
|
||||||
frameworkPath += this->ConvertToOutputFormat(fd);
|
|
||||||
frameworkPath += " ";
|
|
||||||
}
|
}
|
||||||
return frameworkPath;
|
return frameworkPath;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,8 +44,7 @@ public:
|
|||||||
std::vector<BT<std::string>>& linkPath);
|
std::vector<BT<std::string>>& linkPath);
|
||||||
|
|
||||||
std::string ComputeFrameworkPath(cmComputeLinkInformation& cli,
|
std::string ComputeFrameworkPath(cmComputeLinkInformation& cli,
|
||||||
cmValue fwSearchFlag,
|
cmValue fwSearchFlag);
|
||||||
cmValue sysFwSearchFlag);
|
|
||||||
|
|
||||||
std::string ComputeLinkLibraries(cmComputeLinkInformation& cli,
|
std::string ComputeLinkLibraries(cmComputeLinkInformation& cli,
|
||||||
std::string const& stdLibString);
|
std::string const& stdLibString);
|
||||||
|
|||||||
@@ -1850,11 +1850,8 @@ void cmLocalGenerator::OutputLinkLibraries(
|
|||||||
// Append the framework search path flags.
|
// Append the framework search path flags.
|
||||||
cmValue fwSearchFlag = this->Makefile->GetDefinition(
|
cmValue fwSearchFlag = this->Makefile->GetDefinition(
|
||||||
cmStrCat("CMAKE_", linkLanguage, "_FRAMEWORK_SEARCH_FLAG"));
|
cmStrCat("CMAKE_", linkLanguage, "_FRAMEWORK_SEARCH_FLAG"));
|
||||||
cmValue sysFwSearchFlag = this->Makefile->GetDefinition(
|
|
||||||
cmStrCat("CMAKE_", linkLanguage, "_SYSTEM_FRAMEWORK_SEARCH_FLAG"));
|
|
||||||
|
|
||||||
frameworkPath =
|
frameworkPath = linkLineComputer->ComputeFrameworkPath(cli, fwSearchFlag);
|
||||||
linkLineComputer->ComputeFrameworkPath(cli, fwSearchFlag, sysFwSearchFlag);
|
|
||||||
linkLineComputer->ComputeLinkPath(cli, libPathFlag, libPathTerminator,
|
linkLineComputer->ComputeLinkPath(cli, libPathFlag, libPathTerminator,
|
||||||
linkPath);
|
linkPath);
|
||||||
linkLineComputer->ComputeLinkLibraries(cli, stdLibString, linkLibraries);
|
linkLineComputer->ComputeLinkLibraries(cli, stdLibString, linkLibraries);
|
||||||
|
|||||||
@@ -707,10 +707,11 @@ if(XCODE_VERSION)
|
|||||||
set_property(TEST RunCMake.XcodeProject PROPERTY TIMEOUT ${CMake_TEST_XcodeProject_TIMEOUT})
|
set_property(TEST RunCMake.XcodeProject PROPERTY TIMEOUT ${CMake_TEST_XcodeProject_TIMEOUT})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_C_COMPILER_ID STREQUAL "AppleClang"
|
if((CMAKE_C_COMPILER_ID STREQUAL "AppleClang"
|
||||||
AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0)
|
AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0)
|
||||||
add_RunCMake_test(Framework)
|
OR (APPLE AND CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0))
|
||||||
if(NOT DEFINED CMake_TEST_XcFramework)
|
add_RunCMake_test(Framework -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID})
|
||||||
|
if(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND NOT DEFINED CMake_TEST_XcFramework)
|
||||||
set(CMake_TEST_XcFramework ON)
|
set(CMake_TEST_XcFramework ON)
|
||||||
endif()
|
endif()
|
||||||
if(CMake_TEST_XcFramework AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 11.0)
|
if(CMake_TEST_XcFramework AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 11.0)
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
"lto": null,
|
"lto": null,
|
||||||
"commandFragments": [
|
"commandFragments": [
|
||||||
{
|
{
|
||||||
"fragment": "-iframework .+/framework(/(Debug|Release|RelWithDebInfo|MinSizeRel))?\"? -iframework /usr/Frameworks$",
|
"fragment": "-F.+/framework(/(Debug|Release|RelWithDebInfo|MinSizeRel))?\"? -F/usr/Frameworks$",
|
||||||
"role": "frameworkPath",
|
"role": "frameworkPath",
|
||||||
"backtrace": null
|
"backtrace": null
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ set_target_properties(Example::Example PROPERTIES
|
|||||||
)
|
)
|
||||||
|
|
||||||
add_library(testcase FrameworkSystemIncludeTest.c)
|
add_library(testcase FrameworkSystemIncludeTest.c)
|
||||||
target_compile_options(testcase PRIVATE "-Werror=#pragma-messages")
|
target_compile_options(testcase PRIVATE "$<IF:$<C_COMPILER_ID:GNU>,-Werror,-Werror=#pragma-messages>")
|
||||||
target_link_libraries(testcase PRIVATE Example::Example)
|
target_link_libraries(testcase PRIVATE Example::Example)
|
||||||
|
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ set_target_properties(Example::Example2 PROPERTIES
|
|||||||
)
|
)
|
||||||
|
|
||||||
add_library(testcase2 FrameworkSystemIncludeTest.c)
|
add_library(testcase2 FrameworkSystemIncludeTest.c)
|
||||||
target_compile_options(testcase2 PRIVATE "-Werror=#pragma-messages")
|
target_compile_options(testcase2 PRIVATE "$<IF:$<C_COMPILER_ID:GNU>,-Werror,-Werror=#pragma-messages>")
|
||||||
target_link_libraries(testcase2 PRIVATE Example::Example2)
|
target_link_libraries(testcase2 PRIVATE Example::Example2)
|
||||||
|
|
||||||
|
|
||||||
@@ -32,5 +32,5 @@ set_target_properties(Example::Example3 PROPERTIES
|
|||||||
)
|
)
|
||||||
|
|
||||||
add_library(testcase3 FrameworkSystemIncludeTest.c)
|
add_library(testcase3 FrameworkSystemIncludeTest.c)
|
||||||
target_compile_options(testcase3 PRIVATE "-Werror=#pragma-messages")
|
target_compile_options(testcase3 PRIVATE "$<IF:$<C_COMPILER_ID:GNU>,-Werror,-Werror=#pragma-messages>")
|
||||||
target_link_libraries(testcase3 PRIVATE Example::Example3)
|
target_link_libraries(testcase3 PRIVATE Example::Example3)
|
||||||
|
|||||||
@@ -15,8 +15,10 @@ function(framework_layout_test Name Toolchain Type)
|
|||||||
run_cmake_command(${Name} ${CMAKE_COMMAND} --build .)
|
run_cmake_command(${Name} ${CMAKE_COMMAND} --build .)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
framework_layout_test(iOSFrameworkLayout-build ios SHARED)
|
if (NOT CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||||
framework_layout_test(iOSFrameworkLayout-build ios STATIC)
|
framework_layout_test(iOSFrameworkLayout-build ios SHARED)
|
||||||
|
framework_layout_test(iOSFrameworkLayout-build ios STATIC)
|
||||||
|
endif()
|
||||||
framework_layout_test(OSXFrameworkLayout-build osx SHARED)
|
framework_layout_test(OSXFrameworkLayout-build osx SHARED)
|
||||||
framework_layout_test(OSXFrameworkLayout-build osx STATIC)
|
framework_layout_test(OSXFrameworkLayout-build osx STATIC)
|
||||||
|
|
||||||
@@ -36,13 +38,17 @@ function(framework_type_test Toolchain Type UseProperty)
|
|||||||
run_cmake_command(FrameworkType${Type}-build ${CMAKE_COMMAND} --build .)
|
run_cmake_command(FrameworkType${Type}-build ${CMAKE_COMMAND} --build .)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
framework_type_test(ios SHARED NO)
|
if (NOT CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||||
framework_type_test(ios STATIC NO)
|
framework_type_test(ios SHARED NO)
|
||||||
|
framework_type_test(ios STATIC NO)
|
||||||
|
endif()
|
||||||
framework_type_test(osx SHARED NO)
|
framework_type_test(osx SHARED NO)
|
||||||
framework_type_test(osx STATIC NO)
|
framework_type_test(osx STATIC NO)
|
||||||
|
|
||||||
framework_type_test(ios SHARED YES)
|
if (NOT CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||||
framework_type_test(ios STATIC YES)
|
framework_type_test(ios SHARED YES)
|
||||||
|
framework_type_test(ios STATIC YES)
|
||||||
|
endif()
|
||||||
framework_type_test(osx SHARED YES)
|
framework_type_test(osx SHARED YES)
|
||||||
framework_type_test(osx STATIC YES)
|
framework_type_test(osx STATIC YES)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user