Xcode: Fix erroneous MACOSX_BUNDLE link

Refactoring in commit a2cfa2da4f (GenEx/LINK_LIBRARY: Add features for
framework support on Apple, 2022-02-10, v3.24.0-rc1~661^2) accidentally
removed a `GetParentDirectory` call.  Restore it.

Fixes: #23891
This commit is contained in:
Marc Chevrier
2022-08-31 11:50:07 +02:00
committed by Brad King
parent 9b4efcb92f
commit f5a441a616
6 changed files with 45 additions and 0 deletions

View File

@@ -3622,6 +3622,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
}
}
} else {
linkDir = cmSystemTools::GetParentDirectory(linkDir);
if (std::find(linkSearchPaths.begin(), linkSearchPaths.end(), linkDir) ==
linkSearchPaths.end()) {
linkSearchPaths.push_back(linkDir);

View File

@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.23)
project(BundleLinkBundle CXX)
add_subdirectory(lib_bundle)
add_executable(MainBundle MACOSX_BUNDLE main_bundle.cpp)
target_link_libraries(MainBundle PRIVATE LibBundle)
set_target_properties(MainBundle PROPERTIES
MACOSX_BUNDLE "YES"
XCODE_LINK_BUILD_PHASE_MODE BUILT_ONLY
)

View File

@@ -151,6 +151,16 @@ endfunction()
XcodeXCConfig()
function(BundleLinkBundle)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/BundleLinkBundle-build)
run_cmake(BundleLinkBundle)
set(RunCMake_TEST_NO_CLEAN 1)
run_cmake_command(BundleLinkBundle-build ${CMAKE_COMMAND} --build .)
endfunction()
BundleLinkBundle()
# Isolate device tests from host architecture selection.
unset(ENV{CMAKE_OSX_ARCHITECTURES})

View File

@@ -0,0 +1,5 @@
add_library(LibBundle lib_bundle.cpp)
set_target_properties(LibBundle PROPERTIES
MACOSX_BUNDLE YES)

View File

@@ -0,0 +1,6 @@
#include <iostream>
void foo()
{
std::cout << "foobar" << std::endl;
}

View File

@@ -0,0 +1,9 @@
extern void foo();
int main()
{
foo();
return 0;
}