diff options
Diffstat (limited to 'Tests/RunCMake/ObjectLibrary')
6 files changed, 29 insertions, 8 deletions
diff --git a/Tests/RunCMake/ObjectLibrary/ImportMultiArch-check.cmake b/Tests/RunCMake/ObjectLibrary/ImportMultiArch-check.cmake new file mode 100644 index 0000000..af1df78 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/ImportMultiArch-check.cmake @@ -0,0 +1,15 @@ +set(xcProjectFile "${RunCMake_TEST_BINARY_DIR}/ImportMultiArch.xcodeproj/project.pbxproj") +if(NOT EXISTS "${xcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${xcProjectFile} does not exist.") + return() +endif() + +file(READ ${xcProjectFile} pbxFileContents) +foreach(config IN ITEMS Debug Release RelWithDebInfo MinSizeRel) + set(regex "--findconfig-${config}[^ +]*\\$\\(CURRENT_ARCH\\)") + if(NOT pbxFileContents MATCHES "${regex}") + set(RunCMake_TEST_FAILED "$(CURRENT_ARCH) not preserved for config ${config}") + return() + endif() +endforeach() diff --git a/Tests/RunCMake/ObjectLibrary/ImportMultiArch.cmake b/Tests/RunCMake/ObjectLibrary/ImportMultiArch.cmake new file mode 100644 index 0000000..64029ee --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/ImportMultiArch.cmake @@ -0,0 +1,13 @@ + +add_library(A OBJECT IMPORTED) + +# We don't actually build this example so just configure dummy +# object files to test. They do not have to exist. +set_target_properties(A PROPERTIES + IMPORTED_OBJECTS "${CMAKE_CURRENT_BINARY_DIR}/$(CURRENT_ARCH)/does_not_exist.o" +) + +add_library(B SHARED $<TARGET_OBJECTS:A> b.c) + +# We use this to find the relevant lines of the project.pbx file +target_link_options(B PRIVATE --findconfig-$<CONFIG>) diff --git a/Tests/RunCMake/ObjectLibrary/ImportNotSupported-result.txt b/Tests/RunCMake/ObjectLibrary/ImportNotSupported-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/ObjectLibrary/ImportNotSupported-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/ObjectLibrary/ImportNotSupported-stderr.txt b/Tests/RunCMake/ObjectLibrary/ImportNotSupported-stderr.txt deleted file mode 100644 index 0fadac2..0000000 --- a/Tests/RunCMake/ObjectLibrary/ImportNotSupported-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -CMake Error at ImportNotSupported.cmake:[0-9]+ \(add_library\): - The OBJECT library type may not be used for IMPORTED libraries under Xcode - with multiple architectures. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/ImportNotSupported.cmake b/Tests/RunCMake/ObjectLibrary/ImportNotSupported.cmake deleted file mode 100644 index 806b44a..0000000 --- a/Tests/RunCMake/ObjectLibrary/ImportNotSupported.cmake +++ /dev/null @@ -1 +0,0 @@ -add_library(A OBJECT IMPORTED) diff --git a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake index 5ec4018..8515ba5 100644 --- a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake +++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake @@ -6,7 +6,7 @@ run_cmake(BadSourceExpression3) run_cmake(BadObjSource1) run_cmake(BadObjSource2) if(RunCMake_GENERATOR STREQUAL "Xcode" AND "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]") - run_cmake(ImportNotSupported) + run_cmake(ImportMultiArch) run_cmake(InstallNotSupported) else() run_cmake(Import) |
