summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-04-14 13:30:21 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-04-14 13:30:29 (GMT)
commitf011557f0eff1fe08b54cfb30a1b74beefe37456 (patch)
treed9638f183591960b14946b2b00da999728581847 /Tests
parentd96e139f76a27c74d057cba8156cc495cf2b4151 (diff)
parent40dd46a96a5751f4a109ae555ce3b835b4c9ca68 (diff)
downloadCMake-f011557f0eff1fe08b54cfb30a1b74beefe37456.zip
CMake-f011557f0eff1fe08b54cfb30a1b74beefe37456.tar.gz
CMake-f011557f0eff1fe08b54cfb30a1b74beefe37456.tar.bz2
Merge topic 'xcode-universal'
40dd46a96a Xcode: Add tests for OBJECT library per target `OSX_ARCHITECTURES` da4ccb502b Xcode: Check for multiple `OSX_ARCHITECTURES` on target 41ba35a42b cmTarget: Add `HasKnownObjectFileLocation()` shorthand Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7154
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake9
-rw-r--r--Tests/RunCMake/ObjectLibrary/TargetOverrideMultiArch-result.txt1
-rw-r--r--Tests/RunCMake/ObjectLibrary/TargetOverrideMultiArch-stderr.txt5
-rw-r--r--Tests/RunCMake/ObjectLibrary/TargetOverrideMultiArch.cmake3
-rw-r--r--Tests/RunCMake/ObjectLibrary/TargetOverrideSingleArch.cmake3
6 files changed, 24 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index dbff293..024c388 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -352,6 +352,9 @@ if(MSVC)
add_RunCMake_test(MSVCRuntimeTypeInfo)
add_RunCMake_test(MSVCWarningFlags)
endif()
+if(XCODE_VERSION)
+ set(ObjectLibrary_ARGS -DXCODE_VERSION=${XCODE_VERSION})
+endif()
add_RunCMake_test(ObjectLibrary)
add_RunCMake_test(ParseImplicitIncludeInfo)
add_RunCMake_test(ParseImplicitLinkInfo)
diff --git a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
index 8515ba5..0e31b78 100644
--- a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
@@ -8,12 +8,21 @@ run_cmake(BadObjSource2)
if(RunCMake_GENERATOR STREQUAL "Xcode" AND "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]")
run_cmake(ImportMultiArch)
run_cmake(InstallNotSupported)
+
+ set(osx_archs $ENV{CMAKE_OSX_ARCHITECTURES})
+ list(GET osx_archs 0 osx_arch)
+ run_cmake_with_options(TargetOverrideSingleArch -Dosx_arch=${osx_arch})
else()
run_cmake(Import)
run_cmake(Install)
run_cmake(InstallLinkedObj1)
run_cmake(InstallLinkedObj2)
+
+ if(RunCMake_GENERATOR STREQUAL "Xcode" AND XCODE_VERSION VERSION_GREATER_EQUAL 13)
+ run_cmake(TargetOverrideMultiArch)
+ endif()
endif()
+
run_cmake(Export)
function (run_object_lib_build name)
diff --git a/Tests/RunCMake/ObjectLibrary/TargetOverrideMultiArch-result.txt b/Tests/RunCMake/ObjectLibrary/TargetOverrideMultiArch-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/TargetOverrideMultiArch-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/ObjectLibrary/TargetOverrideMultiArch-stderr.txt b/Tests/RunCMake/ObjectLibrary/TargetOverrideMultiArch-stderr.txt
new file mode 100644
index 0000000..eb0593c
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/TargetOverrideMultiArch-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at TargetOverrideMultiArch.cmake:[0-9]+ \(install\):
+ install TARGETS given OBJECT library "A" whose objects may not be installed
+ under Xcode with multiple architectures.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ObjectLibrary/TargetOverrideMultiArch.cmake b/Tests/RunCMake/ObjectLibrary/TargetOverrideMultiArch.cmake
new file mode 100644
index 0000000..ada77f8
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/TargetOverrideMultiArch.cmake
@@ -0,0 +1,3 @@
+add_library(A OBJECT a.c)
+set_target_properties(A PROPERTIES OSX_ARCHITECTURES "x86_64;arm64")
+install(TARGETS A DESTINATION lib)
diff --git a/Tests/RunCMake/ObjectLibrary/TargetOverrideSingleArch.cmake b/Tests/RunCMake/ObjectLibrary/TargetOverrideSingleArch.cmake
new file mode 100644
index 0000000..3f400e8
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/TargetOverrideSingleArch.cmake
@@ -0,0 +1,3 @@
+add_library(A OBJECT a.c)
+set_target_properties(A PROPERTIES OSX_ARCHITECTURES ${osx_arch})
+install(TARGETS A DESTINATION lib)