summaryrefslogtreecommitdiffstats
path: root/llvm/cmake
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2015-09-10 17:18:51 +0000
committerJordan Rose <jordan_rose@apple.com>2015-09-10 17:18:51 +0000
commit3d75297056987b74a3a766ea24d21c55b7fdaf66 (patch)
tree69650163baeca03166a041be46325a1b53655740 /llvm/cmake
parentd209500fd5ef7defaccf91b2cc544eafe595c53f (diff)
downloadbcm5719-llvm-3d75297056987b74a3a766ea24d21c55b7fdaf66.tar.gz
bcm5719-llvm-3d75297056987b74a3a766ea24d21c55b7fdaf66.zip
[CMake] Fix Xcode build with LLVM_ENABLE_OBJLIB.
This amends chapuni's r246156 to handle an Xcode quirk, one even called out in the CMake documentation: Some native build systems may not like targets that have only object files, so consider adding at least one real source file to any target that references $<TARGET_OBJECTS:objlib>. I've limited the scope of this hack to Xcode for now. llvm-svn: 247305
Diffstat (limited to 'llvm/cmake')
-rw-r--r--llvm/cmake/dummy.cpp1
-rw-r--r--llvm/cmake/modules/AddLLVM.cmake6
2 files changed, 7 insertions, 0 deletions
diff --git a/llvm/cmake/dummy.cpp b/llvm/cmake/dummy.cpp
new file mode 100644
index 00000000000..c4e7e953687
--- /dev/null
+++ b/llvm/cmake/dummy.cpp
@@ -0,0 +1 @@
+typedef int dummy;
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 840a860b016..8ec6311c3bf 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -590,6 +590,12 @@ macro(add_llvm_executable name)
add_windows_version_resource_file(ALL_FILES ${ALL_FILES})
+ if(XCODE)
+ # Note: the dummy.cpp source file provides no definitions. However,
+ # it forces Xcode to properly link the static library.
+ list(APPEND ALL_FILES "${LLVM_SOURCE_DIR}/cmake/dummy.cpp")
+ endif()
+
if( EXCLUDE_FROM_ALL )
add_executable(${name} EXCLUDE_FROM_ALL ${ALL_FILES})
else()
OpenPOWER on IntegriCloud