[llvm] r246156 - [CMake] OBJLIB-ize *-tblgen.
NAKAMURA Takumi via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 27 09:10:47 PDT 2015
Author: chapuni
Date: Thu Aug 27 11:10:47 2015
New Revision: 246156
URL: http://llvm.org/viewvc/llvm-project?rev=246156&view=rev
Log:
[CMake] OBJLIB-ize *-tblgen.
This improves dependency chain of;
(LLVMSupport && LLVMTableGen) && (*.cpp in *-tblgen) && (linking *-tblgen)
with;
(LLVMSupport && LLVMTableGen && *.cpp) && (linking *-tblgen)
Modified:
llvm/trunk/cmake/modules/AddLLVM.cmake
llvm/trunk/cmake/modules/TableGen.cmake
Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=246156&r1=246155&r2=246156&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
+++ llvm/trunk/cmake/modules/AddLLVM.cmake Thu Aug 27 11:10:47 2015
@@ -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()
Modified: llvm/trunk/cmake/modules/TableGen.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/TableGen.cmake?rev=246156&r1=246155&r2=246156&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/TableGen.cmake (original)
+++ llvm/trunk/cmake/modules/TableGen.cmake Thu Aug 27 11:10:47 2015
@@ -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})
More information about the llvm-commits
mailing list