summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/ObjectLibrary
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2017-03-23 13:32:08 (GMT)
committerBrad King <brad.king@kitware.com>2017-04-18 15:36:10 (GMT)
commiteec93bceec5411e4409b5e3ee5dc301fca6fcbfd (patch)
tree58758ce2d61173c52559f55c0979236cafa7f969 /Tests/RunCMake/ObjectLibrary
parent93c89bc75ceee599ba7c08b8fe1ac5104942054f (diff)
downloadCMake-eec93bceec5411e4409b5e3ee5dc301fca6fcbfd.zip
CMake-eec93bceec5411e4409b5e3ee5dc301fca6fcbfd.tar.gz
CMake-eec93bceec5411e4409b5e3ee5dc301fca6fcbfd.tar.bz2
Allow OBJECT libraries to be installed, exported, and imported
Teach install() and export() to handle the actual object files. Disallow this on Xcode with multiple architectures because it still cannot be cleanly supported there. Co-Author: Brad King <brad.king@kitware.com>
Diffstat (limited to 'Tests/RunCMake/ObjectLibrary')
-rw-r--r--Tests/RunCMake/ObjectLibrary/Export-stderr.txt4
-rw-r--r--Tests/RunCMake/ObjectLibrary/ExportNotSupported-result.txt (renamed from Tests/RunCMake/ObjectLibrary/Install-result.txt)0
-rw-r--r--Tests/RunCMake/ObjectLibrary/ExportNotSupported-stderr.txt5
-rw-r--r--Tests/RunCMake/ObjectLibrary/ExportNotSupported.cmake2
-rw-r--r--Tests/RunCMake/ObjectLibrary/Import.cmake11
-rw-r--r--Tests/RunCMake/ObjectLibrary/ImportNotSupported-result.txt (renamed from Tests/RunCMake/ObjectLibrary/Import-result.txt)0
-rw-r--r--Tests/RunCMake/ObjectLibrary/ImportNotSupported-stderr.txt (renamed from Tests/RunCMake/ObjectLibrary/Import-stderr.txt)5
-rw-r--r--Tests/RunCMake/ObjectLibrary/ImportNotSupported.cmake1
-rw-r--r--Tests/RunCMake/ObjectLibrary/InstallNotSupported-result.txt (renamed from Tests/RunCMake/ObjectLibrary/Export-result.txt)0
-rw-r--r--Tests/RunCMake/ObjectLibrary/InstallNotSupported-stderr.txt (renamed from Tests/RunCMake/ObjectLibrary/Install-stderr.txt)5
-rw-r--r--Tests/RunCMake/ObjectLibrary/InstallNotSupported.cmake2
-rw-r--r--Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake12
-rw-r--r--Tests/RunCMake/ObjectLibrary/b.c4
13 files changed, 40 insertions, 11 deletions
diff --git a/Tests/RunCMake/ObjectLibrary/Export-stderr.txt b/Tests/RunCMake/ObjectLibrary/Export-stderr.txt
deleted file mode 100644
index bdadca4..0000000
--- a/Tests/RunCMake/ObjectLibrary/Export-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-CMake Error at Export.cmake:2 \(export\):
- export given OBJECT library "A" which may not be exported.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ObjectLibrary/Install-result.txt b/Tests/RunCMake/ObjectLibrary/ExportNotSupported-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/ObjectLibrary/Install-result.txt
+++ b/Tests/RunCMake/ObjectLibrary/ExportNotSupported-result.txt
diff --git a/Tests/RunCMake/ObjectLibrary/ExportNotSupported-stderr.txt b/Tests/RunCMake/ObjectLibrary/ExportNotSupported-stderr.txt
new file mode 100644
index 0000000..5420159
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/ExportNotSupported-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at ExportNotSupported.cmake:[0-9]+ \(export\):
+ export given OBJECT library "A" which may not be exported under Xcode with
+ multiple architectures.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ObjectLibrary/ExportNotSupported.cmake b/Tests/RunCMake/ObjectLibrary/ExportNotSupported.cmake
new file mode 100644
index 0000000..a3f104e
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/ExportNotSupported.cmake
@@ -0,0 +1,2 @@
+add_library(A OBJECT a.c)
+export(TARGETS A FILE AExport.cmake)
diff --git a/Tests/RunCMake/ObjectLibrary/Import.cmake b/Tests/RunCMake/ObjectLibrary/Import.cmake
index 806b44a..42f4468 100644
--- a/Tests/RunCMake/ObjectLibrary/Import.cmake
+++ b/Tests/RunCMake/ObjectLibrary/Import.cmake
@@ -1 +1,12 @@
+
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_property(TARGET A APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
+set_target_properties(A PROPERTIES
+ IMPORTED_OBJECTS_DEBUG "${CMAKE_CURRENT_BINARY_DIR}/does_not_exist.o"
+ IMPORTED_OBJECTS "${CMAKE_CURRENT_BINARY_DIR}/does_not_exist.o"
+ )
+
+add_library(B $<TARGET_OBJECTS:A> b.c)
diff --git a/Tests/RunCMake/ObjectLibrary/Import-result.txt b/Tests/RunCMake/ObjectLibrary/ImportNotSupported-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/ObjectLibrary/Import-result.txt
+++ b/Tests/RunCMake/ObjectLibrary/ImportNotSupported-result.txt
diff --git a/Tests/RunCMake/ObjectLibrary/Import-stderr.txt b/Tests/RunCMake/ObjectLibrary/ImportNotSupported-stderr.txt
index 74b496a..0fadac2 100644
--- a/Tests/RunCMake/ObjectLibrary/Import-stderr.txt
+++ b/Tests/RunCMake/ObjectLibrary/ImportNotSupported-stderr.txt
@@ -1,4 +1,5 @@
-CMake Error at Import.cmake:1 \(add_library\):
- The OBJECT library type may not be used for IMPORTED libraries.
+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
new file mode 100644
index 0000000..806b44a
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/ImportNotSupported.cmake
@@ -0,0 +1 @@
+add_library(A OBJECT IMPORTED)
diff --git a/Tests/RunCMake/ObjectLibrary/Export-result.txt b/Tests/RunCMake/ObjectLibrary/InstallNotSupported-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/ObjectLibrary/Export-result.txt
+++ b/Tests/RunCMake/ObjectLibrary/InstallNotSupported-result.txt
diff --git a/Tests/RunCMake/ObjectLibrary/Install-stderr.txt b/Tests/RunCMake/ObjectLibrary/InstallNotSupported-stderr.txt
index d2f9f4a..35a0e4f 100644
--- a/Tests/RunCMake/ObjectLibrary/Install-stderr.txt
+++ b/Tests/RunCMake/ObjectLibrary/InstallNotSupported-stderr.txt
@@ -1,4 +1,5 @@
-CMake Error at Install.cmake:2 \(install\):
- install TARGETS given OBJECT library "A" which may not be installed.
+CMake Error at InstallNotSupported.cmake:[0-9]+ \(install\):
+ install TARGETS given OBJECT library "A" which 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/InstallNotSupported.cmake b/Tests/RunCMake/ObjectLibrary/InstallNotSupported.cmake
new file mode 100644
index 0000000..c1d214b
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/InstallNotSupported.cmake
@@ -0,0 +1,2 @@
+add_library(A OBJECT a.c)
+install(TARGETS A DESTINATION lib)
diff --git a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
index e932693..fe708ce 100644
--- a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
@@ -5,9 +5,15 @@ run_cmake(BadSourceExpression2)
run_cmake(BadSourceExpression3)
run_cmake(BadObjSource1)
run_cmake(BadObjSource2)
-run_cmake(Export)
-run_cmake(Import)
-run_cmake(Install)
+if(RunCMake_GENERATOR STREQUAL "Xcode" AND "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]")
+ run_cmake(ExportNotSupported)
+ run_cmake(ImportNotSupported)
+ run_cmake(InstallNotSupported)
+else()
+ run_cmake(Export)
+ run_cmake(Import)
+ run_cmake(Install)
+endif()
run_cmake(LinkObjLHS)
run_cmake(LinkObjRHS1)
run_cmake(LinkObjRHS2)
diff --git a/Tests/RunCMake/ObjectLibrary/b.c b/Tests/RunCMake/ObjectLibrary/b.c
new file mode 100644
index 0000000..6751907
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/b.c
@@ -0,0 +1,4 @@
+int b(void)
+{
+ return 0;
+}