2008-09-22 01:08:49 +00:00
|
|
|
|
2008-09-22 18:21:51 +00:00
|
|
|
macro(target_name_of_partially_linked_object lib var)
|
|
|
|
if( MSVC )
|
|
|
|
set(${var} ${lib})
|
|
|
|
else( MSVC )
|
|
|
|
set(${var} ${lib}_pll)
|
|
|
|
endif( MSVC )
|
|
|
|
endmacro(target_name_of_partially_linked_object lib var)
|
|
|
|
|
|
|
|
|
2008-09-22 01:08:49 +00:00
|
|
|
macro(add_partially_linked_object lib)
|
|
|
|
if( MSVC )
|
|
|
|
add_llvm_library( ${lib} ${ARGN})
|
|
|
|
else( MSVC )
|
|
|
|
set(pll ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${lib}.o)
|
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib)
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib)
|
|
|
|
add_library( ${lib} STATIC ${ARGN})
|
2008-09-22 18:21:51 +00:00
|
|
|
if( LLVM_COMMON_DEPENDS )
|
|
|
|
add_dependencies( ${lib} ${LLVM_COMMON_DEPENDS} )
|
|
|
|
endif( LLVM_COMMON_DEPENDS )
|
2008-09-22 01:08:49 +00:00
|
|
|
add_custom_command(OUTPUT ${pll}
|
2008-09-22 02:33:43 +00:00
|
|
|
COMMENT "Building ${lib}.o..."
|
2008-09-22 01:08:49 +00:00
|
|
|
DEPENDS ${lib}
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib
|
|
|
|
COMMAND ar x ${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}
|
|
|
|
COMMAND ld -r *${CMAKE_CXX_OUTPUT_EXTENSION} -o ${pll}
|
|
|
|
COMMAND rm -f *${CMAKE_CXX_OUTPUT_EXTENSION}
|
|
|
|
)
|
2008-09-22 18:21:51 +00:00
|
|
|
target_name_of_partially_linked_object(${lib} tnplo)
|
|
|
|
add_custom_target(${tnplo} ALL DEPENDS ${pll})
|
2008-09-22 01:08:49 +00:00
|
|
|
set( llvm_libs ${llvm_libs} ${pll} PARENT_SCOPE)
|
2008-09-22 18:21:51 +00:00
|
|
|
set( llvm_lib_targets ${llvm_lib_targets} ${tnplo} PARENT_SCOPE )
|
2008-09-22 01:08:49 +00:00
|
|
|
endif( MSVC )
|
|
|
|
endmacro(add_partially_linked_object lib)
|