Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit d9c7484

Browse files
committed
[CMake] add_llvm_symbol_exports: Use ${native_export_file} instead of equivalent constant "symbol.*', since it is defined.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198163 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 0809dc5 commit d9c7484

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

cmake/modules/AddLLVM.cmake

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@ include(LLVM-Config)
55
function(add_llvm_symbol_exports target_name export_file)
66
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
77
set(native_export_file "symbol.exports")
8-
add_custom_command(OUTPUT symbol.exports
9-
COMMAND sed -e "s/^/_/" < ${export_file} > symbol.exports
8+
add_custom_command(OUTPUT ${native_export_file}
9+
COMMAND sed -e "s/^/_/" < ${export_file} > ${native_export_file}
1010
DEPENDS ${export_file}
1111
VERBATIM
1212
COMMENT "Creating export file for ${target_name}")
1313
set_property(TARGET ${target_name} APPEND_STRING PROPERTY
14-
LINK_FLAGS " -Wl,-exported_symbols_list,${CMAKE_CURRENT_BINARY_DIR}/symbol.exports")
14+
LINK_FLAGS " -Wl,-exported_symbols_list,${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}")
1515
elseif(LLVM_HAVE_LINK_VERSION_SCRIPT)
1616
# Gold and BFD ld require a version script rather than a plain list.
1717
set(native_export_file "symbol.exports")
1818
# FIXME: Don't write the "local:" line on OpenBSD.
19-
add_custom_command(OUTPUT symbol.exports
20-
COMMAND echo "{" > symbol.exports
21-
COMMAND grep -q "[[:alnum:]]" ${export_file} && echo " global:" >> symbol.exports || :
22-
COMMAND sed -e "s/$/;/" -e "s/^/ /" < ${export_file} >> symbol.exports
23-
COMMAND echo " local: *;" >> symbol.exports
24-
COMMAND echo "};" >> symbol.exports
19+
add_custom_command(OUTPUT ${native_export_file}
20+
COMMAND echo "{" > ${native_export_file}
21+
COMMAND grep -q "[[:alnum:]]" ${export_file} && echo " global:" >> ${native_export_file} || :
22+
COMMAND sed -e "s/$/;/" -e "s/^/ /" < ${export_file} >> ${native_export_file}
23+
COMMAND echo " local: *;" >> ${native_export_file}
24+
COMMAND echo "};" >> ${native_export_file}
2525
DEPENDS ${export_file}
2626
VERBATIM
2727
COMMENT "Creating export file for ${target_name}")
2828
set_property(TARGET ${target_name} APPEND_STRING PROPERTY
29-
LINK_FLAGS " -Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/symbol.exports")
29+
LINK_FLAGS " -Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}")
3030
else()
3131
set(native_export_file "symbol.def")
3232

@@ -38,19 +38,18 @@ function(add_llvm_symbol_exports target_name export_file)
3838
# Using ${export_file} in add_custom_command directly confuses cmd.exe.
3939
file(TO_NATIVE_PATH ${export_file} export_file_backslashes)
4040

41-
add_custom_command(OUTPUT symbol.def
42-
COMMAND ${CMAKE_COMMAND} -E echo "EXPORTS" > symbol.def
43-
COMMAND ${CAT} ${export_file_backslashes} >> symbol.def
41+
add_custom_command(OUTPUT ${native_export_file}
42+
COMMAND ${CMAKE_COMMAND} -E echo "EXPORTS" > ${native_export_file}
43+
COMMAND ${CAT} ${export_file_backslashes} >> ${native_export_file}
4444
DEPENDS ${export_file}
4545
VERBATIM
4646
COMMENT "Creating export file for ${target_name}")
4747
if(CYGWIN OR MINGW)
4848
set_property(TARGET ${target_name} APPEND_STRING PROPERTY
49-
LINK_FLAGS "${CMAKE_CURRENT_BINARY_DIR}/symbol.def")
49+
LINK_FLAGS "${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}")
5050
else()
5151
set_property(TARGET ${target_name} APPEND_STRING PROPERTY
52-
LINK_FLAGS "/DEF:${CMAKE_CURRENT_BINARY_DIR}/symbol.def")
53-
endif()
52+
LINK_FLAGS " ${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}")
5453
endif()
5554

5655
add_custom_target(${target_name}_exports DEPENDS ${native_export_file})

0 commit comments

Comments
 (0)