1
1

cmake: Fix extract_symbols COPY_TO

Moved the symbols list formatting to the ExtractSymbols.cmake.  The
resulting list of symbols is sorted and printed in a more readable way
(one symbol per line).  Fixed the script to copy the generated symbols.

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Этот коммит содержится в:
Anderson Toshiyuki Sasaki 2018-08-28 18:27:47 +02:00 коммит произвёл Andreas Schneider
родитель 5b07c1aa2c
Коммит ca925588b0
2 изменённых файлов: 18 добавлений и 7 удалений

Просмотреть файл

@ -85,4 +85,8 @@ endforeach()
list(REMOVE_DUPLICATES symbols)
file(WRITE ${OUTPUT_PATH} "${symbols}")
list(SORT symbols)
string(REPLACE ";" "\n" symbols_list "${symbols}")
file(WRITE ${OUTPUT_PATH} "${symbols_list}")

Просмотреть файл

@ -94,7 +94,8 @@
# Where the target ``symbols`` has its property ``LIST_FILE`` set to the path to
# a file containing::
#
# ``symbol1;symbol2``
# ``symbol1``
# ``symbol2``
#
# This example would result in the symbol version script to be created in
# ``${CMAKE_CURRENT_BINARY_DIR}/lib.map`` containing the provided symbols.
@ -213,7 +214,8 @@
# Will result in a file ``lib.symbols.list`` in ``${CMAKE_CURRENT_BINARY_DIR}``
# containing::
#
# ``exported_func1;exported_func2``
# ``exported_func1``
# ``exported_func2``
#
# Search for python which is required
@ -314,7 +316,7 @@ function(get_file_list _TARGET_NAME)
if (DEFINED _get_files_list_COPY_TO)
# Copy the generated file back to the COPY_TO
add_custom_target(copy_${TARGET_NAME} ALL
add_custom_target(copy_${_TARGET_NAME} ALL
COMMAND
${CMAKE_COMMAND} -E copy_if_different
${_FILES_LIST_OUTPUT_PATH} ${_get_files_list_COPY_TO}
@ -376,9 +378,14 @@ function(extract_symbols _TARGET_NAME)
)
if (DEFINED _extract_symbols_COPY_TO)
file(READ "${_SYMBOLS_OUTPUT_PATH}" SYMBOL_CONTENT)
string(REPLACE ";" "\n" SYMBOL_CONTENT_NEW "${SYMBOL_CONTENT}")
file(WRITE "${_extract_symbols_COPY_TO}" "${SYMBOL_CONTENT_NEW}")
# Copy the generated file back to the COPY_TO
add_custom_target(copy_${_TARGET_NAME} ALL
COMMAND
${CMAKE_COMMAND} -E copy_if_different
${_SYMBOLS_OUTPUT_PATH} ${_extract_symbols_COPY_TO}
DEPENDS "${_TARGET_NAME}"
COMMENT "Copying ${_TARGET_NAME} to ${_extract_symbols_COPY_TO}"
)
endif()
endfunction()