summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2015-08-27 16:10:47 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2015-08-27 16:10:47 +0000
commit68027c4618270e93bc8627e78a82557fca9a7bab (patch)
tree3844ca591a6adb52b7ccf74096b0cce82af77db9 /cmake
parentff123881d2a16c3e2d28caf7e395f63804f676a4 (diff)
[CMake] OBJLIB-ize *-tblgen.
This improves dependency chain of; (LLVMSupport && LLVMTableGen) && (*.cpp in *-tblgen) && (linking *-tblgen) with; (LLVMSupport && LLVMTableGen && *.cpp) && (linking *-tblgen) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246156 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/AddLLVM.cmake13
-rw-r--r--cmake/modules/TableGen.cmake4
2 files changed, 17 insertions, 0 deletions
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
index 59c46f812c6..2e22077e812 100644
--- a/cmake/modules/AddLLVM.cmake
+++ b/cmake/modules/AddLLVM.cmake
@@ -565,6 +565,19 @@ macro(add_llvm_executable name)
llvm_process_sources( ALL_FILES ${ARGN} )
add_windows_version_resource_file(ALL_FILES ${ALL_FILES})
+ # Generate objlib
+ if(LLVM_ENABLE_OBJLIB)
+ # Generate an obj library for both targets.
+ set(obj_name "obj.${name}")
+ add_library(${obj_name} OBJECT EXCLUDE_FROM_ALL
+ ${ALL_FILES}
+ )
+ llvm_update_compile_flags(${obj_name})
+ set(ALL_FILES "$<TARGET_OBJECTS:${obj_name}>")
+
+ set_target_properties(${obj_name} PROPERTIES FOLDER "Object Libraries")
+ endif()
+
if( EXCLUDE_FROM_ALL )
add_executable(${name} EXCLUDE_FROM_ALL ${ALL_FILES})
else()
diff --git a/cmake/modules/TableGen.cmake b/cmake/modules/TableGen.cmake
index 85d720e91fd..fcb445afc58 100644
--- a/cmake/modules/TableGen.cmake
+++ b/cmake/modules/TableGen.cmake
@@ -73,6 +73,10 @@ endfunction()
macro(add_tablegen target project)
set(${target}_OLD_LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS})
set(LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS} TableGen)
+
+ # FIXME: It leaks to user, callee of add_tablegen.
+ set(LLVM_ENABLE_OBJLIB ON)
+
add_llvm_utility(${target} ${ARGN})
set(LLVM_LINK_COMPONENTS ${${target}_OLD_LLVM_LINK_COMPONENTS})