Skip to content
This repository was archived by the owner on Jan 26, 2026. It is now read-only.

Commit 4d8e2cd

Browse files
ansasakicryptomilk
authored andcommitted
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> (cherry picked from commit ca92558)
1 parent 3d0f297 commit 4d8e2cd

2 files changed

Lines changed: 18 additions & 7 deletions

File tree

cmake/Modules/ExtractSymbols.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,8 @@ endforeach()
8585

8686
list(REMOVE_DUPLICATES symbols)
8787

88-
file(WRITE ${OUTPUT_PATH} "${symbols}")
88+
list(SORT symbols)
89+
90+
string(REPLACE ";" "\n" symbols_list "${symbols}")
91+
92+
file(WRITE ${OUTPUT_PATH} "${symbols_list}")

cmake/Modules/FindABIMap.cmake

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@
9494
# Where the target ``symbols`` has its property ``LIST_FILE`` set to the path to
9595
# a file containing::
9696
#
97-
# ``symbol1;symbol2``
97+
# ``symbol1``
98+
# ``symbol2``
9899
#
99100
# This example would result in the symbol version script to be created in
100101
# ``${CMAKE_CURRENT_BINARY_DIR}/lib.map`` containing the provided symbols.
@@ -213,7 +214,8 @@
213214
# Will result in a file ``lib.symbols.list`` in ``${CMAKE_CURRENT_BINARY_DIR}``
214215
# containing::
215216
#
216-
# ``exported_func1;exported_func2``
217+
# ``exported_func1``
218+
# ``exported_func2``
217219
#
218220

219221
# Search for python which is required
@@ -314,7 +316,7 @@ function(get_file_list _TARGET_NAME)
314316

315317
if (DEFINED _get_files_list_COPY_TO)
316318
# Copy the generated file back to the COPY_TO
317-
add_custom_target(copy_${TARGET_NAME} ALL
319+
add_custom_target(copy_${_TARGET_NAME} ALL
318320
COMMAND
319321
${CMAKE_COMMAND} -E copy_if_different
320322
${_FILES_LIST_OUTPUT_PATH} ${_get_files_list_COPY_TO}
@@ -376,9 +378,14 @@ function(extract_symbols _TARGET_NAME)
376378
)
377379

378380
if (DEFINED _extract_symbols_COPY_TO)
379-
file(READ "${_SYMBOLS_OUTPUT_PATH}" SYMBOL_CONTENT)
380-
string(REPLACE ";" "\n" SYMBOL_CONTENT_NEW "${SYMBOL_CONTENT}")
381-
file(WRITE "${_extract_symbols_COPY_TO}" "${SYMBOL_CONTENT_NEW}")
381+
# Copy the generated file back to the COPY_TO
382+
add_custom_target(copy_${_TARGET_NAME} ALL
383+
COMMAND
384+
${CMAKE_COMMAND} -E copy_if_different
385+
${_SYMBOLS_OUTPUT_PATH} ${_extract_symbols_COPY_TO}
386+
DEPENDS "${_TARGET_NAME}"
387+
COMMENT "Copying ${_TARGET_NAME} to ${_extract_symbols_COPY_TO}"
388+
)
382389
endif()
383390
endfunction()
384391

0 commit comments

Comments
 (0)