From 4f9a71974e0d6e34c81fd8f55fce4118157e5559 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 10 Mar 2021 09:37:00 -0500 Subject: Xcode: Restore support for spaces in framework names In commit ce2dee9e5b (Xcode: Don't add framework as -framework argument in linker info list, 2020-09-28, v3.19.0-rc1~47^2) we split up the path to a framework into the directory and framework name parts, but only retained the quoting on the directory part. Restore quoting of the framework name. Fixes: #21910 --- Source/cmGlobalXCodeGenerator.cxx | 2 +- Tests/Framework/CMakeLists.txt | 10 ++++++++++ Tests/Framework/space.c | 7 +++++++ Tests/Framework/use_space.c | 8 ++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 Tests/Framework/space.c create mode 100644 Tests/Framework/use_space.c diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 51a7915..5b44851 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3647,7 +3647,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) // implicit search path, so we need it libPaths.Add("-F " + this->XCodeEscapePath(fwDir)); } - libPaths.Add("-framework " + fwName); + libPaths.Add("-framework " + this->XCodeEscapePath(fwName)); } else { libPaths.Add(this->XCodeEscapePath(cleanPath)); } diff --git a/Tests/Framework/CMakeLists.txt b/Tests/Framework/CMakeLists.txt index f741ec2..aabf6b4 100644 --- a/Tests/Framework/CMakeLists.txt +++ b/Tests/Framework/CMakeLists.txt @@ -83,6 +83,16 @@ if(NOT XCODE OR NOT XCODE_VERSION VERSION_LESS 5) target_link_libraries(barStatic fooStatic) endif() +if(XCODE) + add_library(space SHARED space.c) + set_target_properties(space PROPERTIES + FRAMEWORK TRUE + OUTPUT_NAME "space space" + ) + add_executable(use_space use_space.c) + target_link_libraries(use_space PRIVATE space) +endif() + include(CPack) if(APPLE) diff --git a/Tests/Framework/space.c b/Tests/Framework/space.c new file mode 100644 index 0000000..bf5b0c3 --- /dev/null +++ b/Tests/Framework/space.c @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int space(void) +{ + return 0; +} diff --git a/Tests/Framework/use_space.c b/Tests/Framework/use_space.c new file mode 100644 index 0000000..bb4893d --- /dev/null +++ b/Tests/Framework/use_space.c @@ -0,0 +1,8 @@ +#ifdef _WIN32 +__declspec(dllimport) +#endif + int space(void); +int main(void) +{ + return space(); +} -- cgit v0.12 From 00ecddd9ebcbfc0cc4c2bd4e49ae56db59b465ea Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 10 Mar 2021 10:04:05 -0500 Subject: Tests: Enable Framework test case with spaces everywhere possible --- Tests/CMakeLists.txt | 1 + Tests/Framework/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 3a05317..0430afb 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -804,6 +804,7 @@ if(BUILD_TESTING) ${build_generator_args} --build-project Framework --build-options + -DMAKE_SUPPORTS_SPACES=${MAKE_SUPPORTS_SPACES} "-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/Framework/Install" --test-command bar) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Framework") diff --git a/Tests/Framework/CMakeLists.txt b/Tests/Framework/CMakeLists.txt index aabf6b4..6e82f86 100644 --- a/Tests/Framework/CMakeLists.txt +++ b/Tests/Framework/CMakeLists.txt @@ -83,7 +83,7 @@ if(NOT XCODE OR NOT XCODE_VERSION VERSION_LESS 5) target_link_libraries(barStatic fooStatic) endif() -if(XCODE) +if(MAKE_SUPPORTS_SPACES AND NOT CMAKE_GENERATOR STREQUAL "Watcom WMake") add_library(space SHARED space.c) set_target_properties(space PROPERTIES FRAMEWORK TRUE -- cgit v0.12