mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-21 16:31:16 +00:00
1d8e4cfdb7
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56453 91177308-0d34-0410-b5e6-96231b3b80d8
36 lines
1.3 KiB
CMake
Executable File
36 lines
1.3 KiB
CMake
Executable File
|
|
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)
|
|
|
|
|
|
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})
|
|
if( LLVM_COMMON_DEPENDS )
|
|
add_dependencies( ${lib} ${LLVM_COMMON_DEPENDS} )
|
|
endif( LLVM_COMMON_DEPENDS )
|
|
add_custom_command(OUTPUT ${pll}
|
|
COMMENT "Building ${lib}.o..."
|
|
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}
|
|
)
|
|
target_name_of_partially_linked_object(${lib} tnplo)
|
|
add_custom_target(${tnplo} ALL DEPENDS ${pll})
|
|
set( llvm_libs ${llvm_libs} ${pll} PARENT_SCOPE)
|
|
set( llvm_lib_targets ${llvm_lib_targets} ${tnplo} PARENT_SCOPE )
|
|
endif( MSVC )
|
|
endmacro(add_partially_linked_object lib)
|