aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorAnderson Toshiyuki Sasaki <ansasaki@redhat.com>2018-08-28 18:27:47 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-08-29 19:04:44 +0200
commitca925588b0c0e397d44b3f907736f2943450bdbf (patch)
tree072854c50b699c8b69cef95229ec93c6315af0b2 /cmake
parent5b07c1aa2c024898abf50fe93f170c9a5068571a (diff)
downloadlibssh-ca925588b0c0e397d44b3f907736f2943450bdbf.tar.gz
libssh-ca925588b0c0e397d44b3f907736f2943450bdbf.tar.xz
libssh-ca925588b0c0e397d44b3f907736f2943450bdbf.zip
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>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/ExtractSymbols.cmake6
-rw-r--r--cmake/Modules/FindABIMap.cmake19
2 files changed, 18 insertions, 7 deletions
diff --git a/cmake/Modules/ExtractSymbols.cmake b/cmake/Modules/ExtractSymbols.cmake
index d37778e1..f7829334 100644
--- a/cmake/Modules/ExtractSymbols.cmake
+++ b/cmake/Modules/ExtractSymbols.cmake
@@ -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}")
diff --git a/cmake/Modules/FindABIMap.cmake b/cmake/Modules/FindABIMap.cmake
index 7396c2fd..9579f91e 100644
--- a/cmake/Modules/FindABIMap.cmake
+++ b/cmake/Modules/FindABIMap.cmake
@@ -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()