diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2023-05-17 17:50:32 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2023-07-26 21:00:01 (GMT) |
commit | 7050ac56a11768c90f55654aa3f63d02bb549243 (patch) | |
tree | a436ee5be767bfd776dc93d747abd122a94f3a34 /Tests/RunCMake/XcFramework | |
parent | 93ed53790cb1e2d5f25f26156ee5c6590b0d3150 (diff) | |
download | CMake-7050ac56a11768c90f55654aa3f63d02bb549243.zip CMake-7050ac56a11768c90f55654aa3f63d02bb549243.tar.gz CMake-7050ac56a11768c90f55654aa3f63d02bb549243.tar.bz2 |
macOS: Add support for linking against .xcframework folders
Issue: #21752
Diffstat (limited to 'Tests/RunCMake/XcFramework')
74 files changed, 258 insertions, 0 deletions
diff --git a/Tests/RunCMake/XcFramework/CMakeLists.txt b/Tests/RunCMake/XcFramework/CMakeLists.txt new file mode 100644 index 0000000..54a4d62 --- /dev/null +++ b/Tests/RunCMake/XcFramework/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.26) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/XcFramework/RunCMakeTest.cmake b/Tests/RunCMake/XcFramework/RunCMakeTest.cmake new file mode 100644 index 0000000..dcfaad4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/RunCMakeTest.cmake @@ -0,0 +1,83 @@ +include(RunCMake) + +function(create_library type platform system_name archs) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/create-${type}-${platform}-build) + run_cmake_with_options(create-${type}-${platform} -DCMAKE_SYSTEM_NAME=${system_name} -DCMAKE_OSX_ARCHITECTURES=${archs} -DCMAKE_INSTALL_PREFIX=${RunCMake_TEST_BINARY_DIR}/install) + + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(create-${type}-${platform}-build ${CMAKE_COMMAND} --build . --config Release) + run_cmake_command(create-${type}-${platform}-install ${CMAKE_COMMAND} --install . --config Release) +endfunction() + +function(create_libraries type) + create_library(${type} macos Darwin "${macos_archs_2}") + create_library(${type} ios iOS "arm64") + create_library(${type} tvos tvOS "arm64") + create_library(${type} watchos watchOS "armv7k\\\\;arm64_32") + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 15) + create_library(${type} visionos visionOS "arm64") + endif() +endfunction() + +function(create_xcframework name type platforms) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/create-xcframework-${name}-build) + set(args) + foreach(platform IN LISTS platforms) + if(type STREQUAL "framework") + list(APPEND args -framework ${RunCMake_BINARY_DIR}/create-${type}-${platform}-build/install/lib/mylib.framework) + else() + list(APPEND args -library ${RunCMake_BINARY_DIR}/create-${type}-${platform}-build/install/lib/libmylib.a -headers ${RunCMake_SOURCE_DIR}/mylib/include) + endif() + endforeach() + run_cmake_command(create-xcframework-${name} xcodebuild -create-xcframework ${args} -output ${RunCMake_TEST_BINARY_DIR}/mylib.xcframework) +endfunction() + +function(create_executable name xcfname system_name archs) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/create-executable-${name}-build) + run_cmake_with_options(create-executable-${name} -DCMAKE_SYSTEM_NAME=${system_name} -DCMAKE_OSX_ARCHITECTURES=${archs} -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-${xcfname}-build/mylib.xcframework) + + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(create-executable-${name}-build ${CMAKE_COMMAND} --build . --config Release) +endfunction() + +function(create_executables name type) + create_executable(${name}-macos ${type} Darwin "${macos_archs_2}") + create_executable(${name}-ios ${type} iOS "arm64") + create_executable(${name}-tvos ${type} tvOS "arm64") + create_executable(${name}-watchos ${type} watchOS "armv7k\\\\;arm64_32") + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 15) + create_executable(${name}-visionos ${type} visionOS "arm64") + endif() +endfunction() + +set(xcframework_platforms macos ios tvos watchos) +if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 15) + list(APPEND xcframework_platforms visionos) +endif() +if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12) + set(macos_archs_1 "x86_64\\;arm64") + set(macos_archs_2 "x86_64\\\\;arm64") +else() + set(macos_archs_1 "x86_64") + set(macos_archs_2 "x86_64") +endif() + +create_libraries(library) +create_libraries(framework) +create_xcframework(library library "${xcframework_platforms}") +create_xcframework(framework framework "${xcframework_platforms}") +create_xcframework(incomplete framework "tvos;watchos") +create_executables(library library) +create_executables(framework framework) +run_cmake_with_options(create-executable-incomplete -DCMAKE_SYSTEM_NAME=Darwin "-DCMAKE_OSX_ARCHITECTURES=${macos_archs_1}" -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-incomplete-build/mylib.xcframework) +create_executables(target-library library) +create_executables(target-framework framework) +run_cmake_with_options(create-executable-target-incomplete -DCMAKE_SYSTEM_NAME=Darwin "-DCMAKE_OSX_ARCHITECTURES=${macos_archs_1}" -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-incomplete-build/mylib.xcframework) +if(RunCMake_GENERATOR STREQUAL "Xcode" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12) + create_executables(library-link-phase library) + create_executables(framework-link-phase framework) + run_cmake_with_options(create-executable-incomplete-link-phase -DCMAKE_SYSTEM_NAME=Darwin "-DCMAKE_OSX_ARCHITECTURES=${macos_archs_1}" -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-incomplete-build/mylib.xcframework) + create_executables(target-library-link-phase library) + create_executables(target-framework-link-phase framework) + run_cmake_with_options(create-executable-target-incomplete-link-phase -DCMAKE_SYSTEM_NAME=Darwin "-DCMAKE_OSX_ARCHITECTURES=${macos_archs_1}" -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-incomplete-build/mylib.xcframework) +endif() diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-ios.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-ios.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-ios.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-ios.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-ios.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-ios.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-macos.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-macos.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-macos.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-tvos.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-tvos.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-tvos.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-visionos.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-visionos.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-visionos.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-watchos.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-watchos.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-watchos.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-macos.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-macos.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-macos.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-tvos.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-tvos.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-tvos.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-visionos.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-visionos.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-visionos.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-watchos.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-watchos.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-watchos.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase-result.txt b/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase-stderr.txt b/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase-stderr.txt new file mode 100644 index 0000000..5b43e19 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase-stderr.txt @@ -0,0 +1,11 @@ +CMake Error at create-executable\.cmake:[0-9]+ \(target_link_libraries\): + Unable to find suitable library in: + + [^ +]*/Tests/RunCMake/XcFramework/create-xcframework-incomplete-build/mylib\.xcframework/Info\.plist + + for system name "Darwin" +Call Stack \(most recent call first\): + create-executable-link-phase\.cmake:[0-9]+ \(include\) + create-executable-incomplete-link-phase\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase.cmake b/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-incomplete-result.txt b/Tests/RunCMake/XcFramework/create-executable-incomplete-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-incomplete-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/XcFramework/create-executable-incomplete-stderr.txt b/Tests/RunCMake/XcFramework/create-executable-incomplete-stderr.txt new file mode 100644 index 0000000..66b7d62 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-incomplete-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at create-executable\.cmake:[0-9]+ \(target_link_libraries\): + Unable to find suitable library in: + + [^ +]*/Tests/RunCMake/XcFramework/create-xcframework-incomplete-build/mylib\.xcframework/Info\.plist + + for system name "Darwin" +Call Stack \(most recent call first\): + create-executable-incomplete\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/XcFramework/create-executable-incomplete.cmake b/Tests/RunCMake/XcFramework/create-executable-incomplete.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-incomplete.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-ios.cmake b/Tests/RunCMake/XcFramework/create-executable-library-ios.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-ios.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-link-phase-ios.cmake b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-ios.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-ios.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-link-phase-macos.cmake b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-macos.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-macos.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-link-phase-tvos.cmake b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-tvos.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-tvos.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-link-phase-visionos.cmake b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-visionos.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-visionos.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-link-phase-watchos.cmake b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-watchos.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-watchos.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-macos.cmake b/Tests/RunCMake/XcFramework/create-executable-library-macos.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-macos.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-tvos.cmake b/Tests/RunCMake/XcFramework/create-executable-library-tvos.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-tvos.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-visionos.cmake b/Tests/RunCMake/XcFramework/create-executable-library-visionos.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-visionos.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-watchos.cmake b/Tests/RunCMake/XcFramework/create-executable-library-watchos.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-watchos.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-link-phase.cmake b/Tests/RunCMake/XcFramework/create-executable-link-phase.cmake new file mode 100644 index 0000000..9884781 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-link-phase.cmake @@ -0,0 +1,2 @@ +include(create-executable.cmake) +set_property(TARGET myexe PROPERTY XCODE_LINK_BUILD_PHASE_MODE "KNOWN_LOCATION") diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-ios.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-ios.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-ios.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-ios.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-ios.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-ios.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-macos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-macos.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-macos.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-tvos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-tvos.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-tvos.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-visionos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-visionos.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-visionos.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-watchos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-watchos.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-watchos.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-macos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-macos.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-macos.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-tvos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-tvos.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-tvos.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-visionos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-visionos.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-visionos.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-watchos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-watchos.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-watchos.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase-result.txt b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase-stderr.txt b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase-stderr.txt new file mode 100644 index 0000000..1308933 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase-stderr.txt @@ -0,0 +1,11 @@ +CMake Error at create-executable-target\.cmake:[0-9]+ \(target_link_libraries\): + Unable to find suitable library in: + + [^ +]*/Tests/RunCMake/XcFramework/create-xcframework-incomplete-build/mylib\.xcframework/Info\.plist + + for system name "Darwin" +Call Stack \(most recent call first\): + create-executable-target-link-phase\.cmake:[0-9]+ \(include\) + create-executable-target-incomplete-link-phase\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase.cmake b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-incomplete-result.txt b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/XcFramework/create-executable-target-incomplete-stderr.txt b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-stderr.txt new file mode 100644 index 0000000..716b17d --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at create-executable-target\.cmake:[0-9]+ \(target_link_libraries\): + Unable to find suitable library in: + + [^ +]*/Tests/RunCMake/XcFramework/create-xcframework-incomplete-build/mylib\.xcframework/Info\.plist + + for system name "Darwin" +Call Stack \(most recent call first\): + create-executable-target-incomplete\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-incomplete.cmake b/Tests/RunCMake/XcFramework/create-executable-target-incomplete.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-incomplete.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-ios.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-ios.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-ios.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-ios.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-ios.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-ios.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-macos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-macos.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-macos.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-tvos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-tvos.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-tvos.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-visionos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-visionos.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-visionos.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-watchos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-watchos.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-watchos.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-macos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-macos.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-macos.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-tvos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-tvos.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-tvos.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-visionos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-visionos.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-visionos.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-watchos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-watchos.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-watchos.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-link-phase.cmake b/Tests/RunCMake/XcFramework/create-executable-target-link-phase.cmake new file mode 100644 index 0000000..9c0b0d5 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-link-phase.cmake @@ -0,0 +1,2 @@ +include(create-executable-target.cmake) +set_property(TARGET myexe PROPERTY XCODE_LINK_BUILD_PHASE_MODE "KNOWN_LOCATION") diff --git a/Tests/RunCMake/XcFramework/create-executable-target.cmake b/Tests/RunCMake/XcFramework/create-executable-target.cmake new file mode 100644 index 0000000..0cc356c --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target.cmake @@ -0,0 +1,21 @@ +enable_language(C) + +if(CMAKE_SYSTEM_NAME STREQUAL "iOS") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") +endif() + +add_library(mylib IMPORTED STATIC) +set_property(TARGET mylib PROPERTY IMPORTED_LOCATION ${MYLIB_LIBRARY}) + +add_executable(myexe myexe/myexe.c) +target_link_libraries(myexe PRIVATE mylib) diff --git a/Tests/RunCMake/XcFramework/create-executable.cmake b/Tests/RunCMake/XcFramework/create-executable.cmake new file mode 100644 index 0000000..6706b9f --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable.cmake @@ -0,0 +1,18 @@ +enable_language(C) + +if(CMAKE_SYSTEM_NAME STREQUAL "iOS") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") +endif() + +add_executable(myexe myexe/myexe.c) +target_link_libraries(myexe PRIVATE ${MYLIB_LIBRARY}) diff --git a/Tests/RunCMake/XcFramework/create-framework-ios.cmake b/Tests/RunCMake/XcFramework/create-framework-ios.cmake new file mode 100644 index 0000000..8b7df9b --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-framework-ios.cmake @@ -0,0 +1 @@ +include(create-framework.cmake) diff --git a/Tests/RunCMake/XcFramework/create-framework-macos.cmake b/Tests/RunCMake/XcFramework/create-framework-macos.cmake new file mode 100644 index 0000000..8b7df9b --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-framework-macos.cmake @@ -0,0 +1 @@ +include(create-framework.cmake) diff --git a/Tests/RunCMake/XcFramework/create-framework-tvos.cmake b/Tests/RunCMake/XcFramework/create-framework-tvos.cmake new file mode 100644 index 0000000..8b7df9b --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-framework-tvos.cmake @@ -0,0 +1 @@ +include(create-framework.cmake) diff --git a/Tests/RunCMake/XcFramework/create-framework-visionos.cmake b/Tests/RunCMake/XcFramework/create-framework-visionos.cmake new file mode 100644 index 0000000..8b7df9b --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-framework-visionos.cmake @@ -0,0 +1 @@ +include(create-framework.cmake) diff --git a/Tests/RunCMake/XcFramework/create-framework-watchos.cmake b/Tests/RunCMake/XcFramework/create-framework-watchos.cmake new file mode 100644 index 0000000..8b7df9b --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-framework-watchos.cmake @@ -0,0 +1 @@ +include(create-framework.cmake) diff --git a/Tests/RunCMake/XcFramework/create-framework.cmake b/Tests/RunCMake/XcFramework/create-framework.cmake new file mode 100644 index 0000000..f4406e6 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-framework.cmake @@ -0,0 +1,3 @@ +set(CMAKE_FRAMEWORK ON) +include(create-library-common.cmake) +install(FILES mylib/include/mylib/mylib.h DESTINATION lib/mylib.framework/Headers) diff --git a/Tests/RunCMake/XcFramework/create-library-common.cmake b/Tests/RunCMake/XcFramework/create-library-common.cmake new file mode 100644 index 0000000..958660d --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-library-common.cmake @@ -0,0 +1,12 @@ +enable_language(C) + +if(CMAKE_SYSTEM_NAME STREQUAL "iOS") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") +endif() + +add_library(mylib STATIC mylib/mylib.c) +install(TARGETS mylib DESTINATION lib) diff --git a/Tests/RunCMake/XcFramework/create-library-ios.cmake b/Tests/RunCMake/XcFramework/create-library-ios.cmake new file mode 100644 index 0000000..a9f5dee --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-library-ios.cmake @@ -0,0 +1 @@ +include(create-library.cmake) diff --git a/Tests/RunCMake/XcFramework/create-library-macos.cmake b/Tests/RunCMake/XcFramework/create-library-macos.cmake new file mode 100644 index 0000000..a9f5dee --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-library-macos.cmake @@ -0,0 +1 @@ +include(create-library.cmake) diff --git a/Tests/RunCMake/XcFramework/create-library-tvos.cmake b/Tests/RunCMake/XcFramework/create-library-tvos.cmake new file mode 100644 index 0000000..a9f5dee --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-library-tvos.cmake @@ -0,0 +1 @@ +include(create-library.cmake) diff --git a/Tests/RunCMake/XcFramework/create-library-visionos.cmake b/Tests/RunCMake/XcFramework/create-library-visionos.cmake new file mode 100644 index 0000000..a9f5dee --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-library-visionos.cmake @@ -0,0 +1 @@ +include(create-library.cmake) diff --git a/Tests/RunCMake/XcFramework/create-library-watchos.cmake b/Tests/RunCMake/XcFramework/create-library-watchos.cmake new file mode 100644 index 0000000..a9f5dee --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-library-watchos.cmake @@ -0,0 +1 @@ +include(create-library.cmake) diff --git a/Tests/RunCMake/XcFramework/create-library.cmake b/Tests/RunCMake/XcFramework/create-library.cmake new file mode 100644 index 0000000..f2a5249 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-library.cmake @@ -0,0 +1 @@ +include(create-library-common.cmake) diff --git a/Tests/RunCMake/XcFramework/myexe/myexe.c b/Tests/RunCMake/XcFramework/myexe/myexe.c new file mode 100644 index 0000000..d04efbd --- /dev/null +++ b/Tests/RunCMake/XcFramework/myexe/myexe.c @@ -0,0 +1,7 @@ +#include <mylib/mylib.h> + +int main(void) +{ + mylib(); + return 0; +} diff --git a/Tests/RunCMake/XcFramework/mylib/include/mylib/mylib.h b/Tests/RunCMake/XcFramework/mylib/include/mylib/mylib.h new file mode 100644 index 0000000..1de07aa --- /dev/null +++ b/Tests/RunCMake/XcFramework/mylib/include/mylib/mylib.h @@ -0,0 +1,3 @@ +#pragma once + +extern void mylib(void); diff --git a/Tests/RunCMake/XcFramework/mylib/mylib.c b/Tests/RunCMake/XcFramework/mylib/mylib.c new file mode 100644 index 0000000..4489684 --- /dev/null +++ b/Tests/RunCMake/XcFramework/mylib/mylib.c @@ -0,0 +1,3 @@ +void mylib(void) +{ +} |