mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
EXPORTED_SYMBOL_FILE using mingw and cmake
Summary: This is a fix for the command line syntax error while building LTO when using MinGW. Patch By: jsroemer Reviewers: rnk Reviewed By: rnk Subscribers: rnk, beanz, llvm-commits Differential Revision: http://reviews.llvm.org/D5476 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220935 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7f3bcd623e
commit
4b57390110
@ -85,27 +85,29 @@ function(add_llvm_symbol_exports target_name export_file)
|
|||||||
else()
|
else()
|
||||||
set(native_export_file "${target_name}.def")
|
set(native_export_file "${target_name}.def")
|
||||||
|
|
||||||
set(CAT "type")
|
|
||||||
if(CYGWIN)
|
|
||||||
set(CAT "cat")
|
set(CAT "cat")
|
||||||
|
set(export_file_nativeslashes ${export_file})
|
||||||
|
if(WIN32 AND NOT CYGWIN)
|
||||||
|
set(CAT "type")
|
||||||
|
# Convert ${export_file} to native format (backslashes) for "type"
|
||||||
|
# Does not use file(TO_NATIVE_PATH) as it doesn't create a native
|
||||||
|
# path but a build-system specific format (see CMake bug
|
||||||
|
# http://public.kitware.com/Bug/print_bug_page.php?bug_id=5939 )
|
||||||
|
string(REPLACE / \\ export_file_nativeslashes ${export_file})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Using ${export_file} in add_custom_command directly confuses cmd.exe.
|
|
||||||
file(TO_NATIVE_PATH ${export_file} export_file_backslashes)
|
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${native_export_file}
|
add_custom_command(OUTPUT ${native_export_file}
|
||||||
COMMAND ${CMAKE_COMMAND} -E echo "EXPORTS" > ${native_export_file}
|
COMMAND ${CMAKE_COMMAND} -E echo "EXPORTS" > ${native_export_file}
|
||||||
COMMAND ${CAT} ${export_file_backslashes} >> ${native_export_file}
|
COMMAND ${CAT} ${export_file_nativeslashes} >> ${native_export_file}
|
||||||
DEPENDS ${export_file}
|
DEPENDS ${export_file}
|
||||||
VERBATIM
|
VERBATIM
|
||||||
COMMENT "Creating export file for ${target_name}")
|
COMMENT "Creating export file for ${target_name}")
|
||||||
if(CYGWIN OR MINGW)
|
set(export_file_linker_flag "${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}")
|
||||||
set_property(TARGET ${target_name} APPEND_STRING PROPERTY
|
if(MSVC)
|
||||||
LINK_FLAGS " ${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}")
|
set(export_file_linker_flag "/DEF:${export_file_linker_flag}")
|
||||||
else()
|
|
||||||
set_property(TARGET ${target_name} APPEND_STRING PROPERTY
|
|
||||||
LINK_FLAGS " /DEF:${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}")
|
|
||||||
endif()
|
endif()
|
||||||
|
set_property(TARGET ${target_name} APPEND_STRING PROPERTY
|
||||||
|
LINK_FLAGS " ${export_file_linker_flag}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_custom_target(${target_name}_exports DEPENDS ${native_export_file})
|
add_custom_target(${target_name}_exports DEPENDS ${native_export_file})
|
||||||
|
Loading…
Reference in New Issue
Block a user