Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit a72d302

Browse files
committed
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247305 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 40b623b commit a72d302

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

cmake/dummy.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
typedef int dummy;

cmake/modules/AddLLVM.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,12 @@ macro(add_llvm_executable name)
590590

591591
add_windows_version_resource_file(ALL_FILES ${ALL_FILES})
592592

593+
if(XCODE)
594+
# Note: the dummy.cpp source file provides no definitions. However,
595+
# it forces Xcode to properly link the static library.
596+
list(APPEND ALL_FILES "${LLVM_SOURCE_DIR}/cmake/dummy.cpp")
597+
endif()
598+
593599
if( EXCLUDE_FROM_ALL )
594600
add_executable(${name} EXCLUDE_FROM_ALL ${ALL_FILES})
595601
else()

0 commit comments

Comments
 (0)