[llvm] r247305 - [CMake] Fix Xcode build with LLVM_ENABLE_OBJLIB.
Jordan Rose via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 10 10:18:51 PDT 2015
Author: jrose
Date: Thu Sep 10 12:18:51 2015
New Revision: 247305
URL: http://llvm.org/viewvc/llvm-project?rev=247305&view=rev
Log:
[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.
Added:
llvm/trunk/cmake/dummy.cpp
Modified:
llvm/trunk/cmake/modules/AddLLVM.cmake
Added: llvm/trunk/cmake/dummy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/dummy.cpp?rev=247305&view=auto
==============================================================================
--- llvm/trunk/cmake/dummy.cpp (added)
+++ llvm/trunk/cmake/dummy.cpp Thu Sep 10 12:18:51 2015
@@ -0,0 +1 @@
+typedef int dummy;
Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=247305&r1=247304&r2=247305&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
+++ llvm/trunk/cmake/modules/AddLLVM.cmake Thu Sep 10 12:18:51 2015
@@ -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()
More information about the llvm-commits
mailing list