efc427fdce
This adds a cmake module, FindABIMap, which looks for abimap and provides functions to generate a symbol version linker script. The module can be included using find_package(ABIMap). This also adds the option to compile with symbol versioning. The symbol list is obtained from the header files by filtering those marked with the LIBSSH_API modifier. Such symbols are used as input to generate the version script used by the linker. The version script is automatically updated as new symbols marked with LIBSSH_API are added to the header files. If any symbol is removed, the build will fail due to break in the ABI. Symbol versioning is enabled by default if abimap has been found. It is disabled in non-UNIX platforms. It can be disabled by passing "-DWITH_SYMBOL_VERSIONING=OFF" option to cmake. Pair-Programmed-With: Andreas Schneider <asn@cryptomilk.org> Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
60 строки
1.5 KiB
CMake
60 строки
1.5 KiB
CMake
#
|
|
# Copyright (c) 2018 Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
|
|
#
|
|
# Redistribution and use is allowed according to the terms of the New
|
|
# BSD license.
|
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
|
#
|
|
|
|
#.rst:
|
|
# GetFilesList
|
|
# ------------
|
|
#
|
|
# This is a helper script for FindABImap.cmake.
|
|
#
|
|
# Search in the provided directories for files matching the provided pattern.
|
|
# The list of files is then written to the output file.
|
|
#
|
|
# Expected defined variables
|
|
# --------------------------
|
|
#
|
|
# ``DIRECTORIES``:
|
|
# Required, expects a list of directories paths.
|
|
#
|
|
# ``FILES_PATTERNS``:
|
|
# Required, expects a list of patterns to be used to search files
|
|
#
|
|
# ``OUTPUT_PATH``:
|
|
# Required, expects the output file path.
|
|
|
|
if (NOT DEFINED DIRECTORIES)
|
|
message(SEND_ERROR "DIRECTORIES not defined")
|
|
endif()
|
|
|
|
if (NOT DEFINED FILES_PATTERNS)
|
|
message(SEND_ERROR "FILES_PATTERNS not defined")
|
|
endif()
|
|
|
|
if (NOT DEFINED OUTPUT_PATH)
|
|
message(SEND_ERROR "OUTPUT_PATH not defined")
|
|
endif()
|
|
|
|
string(REPLACE " " ";" DIRECTORIES_LIST "${DIRECTORIES}")
|
|
string(REPLACE " " ";" FILES_PATTERNS_LIST "${FILES_PATTERNS}")
|
|
|
|
# Create the list of expressions for the files
|
|
set(glob_expressions)
|
|
foreach(dir ${DIRECTORIES_LIST})
|
|
foreach(exp ${FILES_PATTERNS_LIST})
|
|
list(APPEND glob_expressions
|
|
"${dir}/${exp}"
|
|
)
|
|
endforeach()
|
|
endforeach()
|
|
|
|
# Create the list of files
|
|
file(GLOB files ${glob_expressions})
|
|
|
|
# Write to the output
|
|
file(WRITE ${OUTPUT_PATH} "${files}")
|