diff options
author | Craig Scott <craig.scott@crascit.com> | 2021-02-04 09:30:49 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2021-02-06 00:34:28 (GMT) |
commit | 4d46b1401f9d1624fa5afc3995844d7aebc7ccf4 (patch) | |
tree | e2396c9fab9f6c9e694ae3e281d0d28c8f6a446d /Tests/RunCMake/TargetObjects | |
parent | 1a915e89531adb426be6db6f648ef496ee8c38e8 (diff) | |
download | CMake-4d46b1401f9d1624fa5afc3995844d7aebc7ccf4.zip CMake-4d46b1401f9d1624fa5afc3995844d7aebc7ccf4.tar.gz CMake-4d46b1401f9d1624fa5afc3995844d7aebc7ccf4.tar.bz2 |
add_library(): Allow imported object libraries with multi-arch
Fixes: #21276
Diffstat (limited to 'Tests/RunCMake/TargetObjects')
4 files changed, 27 insertions, 0 deletions
diff --git a/Tests/RunCMake/TargetObjects/RunCMakeTest.cmake b/Tests/RunCMake/TargetObjects/RunCMakeTest.cmake index 30b9fee..d2b3032 100644 --- a/Tests/RunCMake/TargetObjects/RunCMakeTest.cmake +++ b/Tests/RunCMake/TargetObjects/RunCMakeTest.cmake @@ -2,3 +2,7 @@ include(RunCMake) run_cmake(NoTarget) run_cmake(NotObjlibTarget) + +if(RunCMake_GENERATOR STREQUAL "Xcode" AND "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]") + run_cmake(XcodeVariableNoGenexExpansion) +endif() diff --git a/Tests/RunCMake/TargetObjects/XcodeVariableNoGenexExpansion-result.txt b/Tests/RunCMake/TargetObjects/XcodeVariableNoGenexExpansion-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TargetObjects/XcodeVariableNoGenexExpansion-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetObjects/XcodeVariableNoGenexExpansion-stderr.txt b/Tests/RunCMake/TargetObjects/XcodeVariableNoGenexExpansion-stderr.txt new file mode 100644 index 0000000..1360015 --- /dev/null +++ b/Tests/RunCMake/TargetObjects/XcodeVariableNoGenexExpansion-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at XcodeVariableNoGenexExpansion\.cmake:9 \(file\): + Error evaluating generator expression: + + \$\<TARGET_OBJECTS:A\> + + The evaluation of the TARGET_OBJECTS generator expression is only suitable + for consumption by CMake \(limited under Xcode with multiple architectures\)\. + It is not suitable for writing out elsewhere\. +Call Stack \(most recent call first\): + CMakeLists\.txt:3 \(include\) diff --git a/Tests/RunCMake/TargetObjects/XcodeVariableNoGenexExpansion.cmake b/Tests/RunCMake/TargetObjects/XcodeVariableNoGenexExpansion.cmake new file mode 100644 index 0000000..83d7210 --- /dev/null +++ b/Tests/RunCMake/TargetObjects/XcodeVariableNoGenexExpansion.cmake @@ -0,0 +1,12 @@ +add_library(A OBJECT IMPORTED) + +# We don't actually build this example so just configure a dummy +# object file to test. It does not have to exist. +set_target_properties(A PROPERTIES + IMPORTED_OBJECTS "${CMAKE_CURRENT_BINARY_DIR}/$(CURRENT_ARCH)/does_not_exist.o" +) + +file(GENERATE + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/objects.txt + CONTENT "$<TARGET_OBJECTS:A>" +) |