diff options
author | Brad King <brad.king@kitware.com> | 2023-09-26 15:04:03 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-09-26 15:10:16 (GMT) |
commit | 9ba1883ea662320e5abfe15960194560cf04390e (patch) | |
tree | a2568598ecb4be440af9f698f57a5411207621ac | |
parent | 84a1e529eefb942ddf8e0befb941e5ca024e1540 (diff) | |
download | CMake-9ba1883ea662320e5abfe15960194560cf04390e.zip CMake-9ba1883ea662320e5abfe15960194560cf04390e.tar.gz CMake-9ba1883ea662320e5abfe15960194560cf04390e.tar.bz2 |
Tests: Fix RunCMake.XcFramework in symlinked paths with Xcode 15
The `xcodebuild -create-xcframework` tool in Xcode 15.0 fails to
compute relative paths if the input paths have symlinks.
-rw-r--r-- | Tests/RunCMake/XcFramework/RunCMakeTest.cmake | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Tests/RunCMake/XcFramework/RunCMakeTest.cmake b/Tests/RunCMake/XcFramework/RunCMakeTest.cmake index 4df936e..9a13892 100644 --- a/Tests/RunCMake/XcFramework/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcFramework/RunCMakeTest.cmake @@ -29,12 +29,21 @@ endfunction() function(create_xcframework name type platforms) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/create-xcframework-${name}-build) + if(CMake_TEST_XCODE_VERSION VERSION_GREATER_EQUAL 15) + # 'xcodebuild -create-xcframework' fails on symlinked paths. + file(REAL_PATH "${RunCMake_SOURCE_DIR}" src_dir) + file(REAL_PATH "${RunCMake_BINARY_DIR}" bld_dir) + else() + set(src_dir "${RunCMake_SOURCE_DIR}") + set(bld_dir "${RunCMake_BINARY_DIR}") + endif() set(args) foreach(platform IN LISTS platforms) + set(lib_dir "${bld_dir}/create-${type}-${platform}-build/install/lib") if(type STREQUAL "framework") - list(APPEND args -framework ${RunCMake_BINARY_DIR}/create-${type}-${platform}-build/install/lib/mylib.framework) + list(APPEND args -framework ${lib_dir}/mylib.framework) else() - list(APPEND args -library ${RunCMake_BINARY_DIR}/create-${type}-${platform}-build/install/lib/libmylib.a -headers ${RunCMake_SOURCE_DIR}/mylib/include) + list(APPEND args -library ${lib_dir}/libmylib.a -headers ${src_dir}/mylib/include) endif() endforeach() run_cmake_command(create-xcframework-${name} xcodebuild -create-xcframework ${args} -output ${RunCMake_TEST_BINARY_DIR}/mylib.xcframework) |