summaryrefslogtreecommitdiff
path: root/cmake/Modules
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2014-03-04 08:32:43 +0000
committerAlexey Samsonov <samsonov@google.com>2014-03-04 08:32:43 +0000
commit6c7c03fcd071904a6215a8ac3712a3ca4f2d8bf0 (patch)
treed9405aec59f40c97cca76f2391cd9e637fdf94e1 /cmake/Modules
parentcbac3e404c48bd0a7d63f24d01437ea8b881a834 (diff)
[CMake] Port add_sanitizer_rt_symbols to CMake 3.0
Patch by Brad King. Our add_sanitizer_rt_symbols macro reads the LOCATION property of a library to compute the location of the "lib<name>.a.syms" file to generate next to the corresponding "lib<name>.a" library file. CMake 3.0 introduces policy CMP0026 to disallow reading of the LOCATION target property from non-imported targets in favor of the more powerful $<TARGET_FILE> generator expression. Teach add_sanitizer_rt_symbols to use the $<TARGET_FILE> generator expression to compute the location of the symbols file to generate with a custom command. CMake 3.0 also adds support for generator expressions to install(FILES) so use it when available to simplify installation of the symbols file of the proper configuration. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@202797 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake/Modules')
-rw-r--r--cmake/Modules/SanitizerUtils.cmake17
1 files changed, 10 insertions, 7 deletions
diff --git a/cmake/Modules/SanitizerUtils.cmake b/cmake/Modules/SanitizerUtils.cmake
index 23c6d7b19..fa98be925 100644
--- a/cmake/Modules/SanitizerUtils.cmake
+++ b/cmake/Modules/SanitizerUtils.cmake
@@ -12,21 +12,24 @@ set(SANITIZER_LINT_SCRIPT
# symbol names that should be exported as well.
# add_sanitizer_rt_symbols(<name> <files with extra symbols to export>)
macro(add_sanitizer_rt_symbols name)
- get_target_property(libfile ${name} LOCATION)
- set(symsfile "${libfile}.syms")
- add_custom_command(OUTPUT ${symsfile}
+ set(stamp ${CMAKE_CURRENT_BINARY_DIR}/${name}.syms-stamp)
+ add_custom_command(OUTPUT ${stamp}
COMMAND ${PYTHON_EXECUTABLE}
- ${SANITIZER_GEN_DYNAMIC_LIST} ${libfile} ${ARGN}
- > ${symsfile}
+ ${SANITIZER_GEN_DYNAMIC_LIST} $<TARGET_FILE:${name}> ${ARGN}
+ > $<TARGET_FILE:${name}>.syms
+ COMMAND ${CMAKE_COMMAND} -E touch ${stamp}
DEPENDS ${name} ${SANITIZER_GEN_DYNAMIC_LIST} ${ARGN}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating exported symbols for ${name}"
VERBATIM)
add_custom_target(${name}-symbols ALL
- DEPENDS ${symsfile}
+ DEPENDS ${stamp}
SOURCES ${SANITIZER_GEN_DYNAMIC_LIST} ${ARGN})
- if(TRUE)
+ if(NOT CMAKE_VERSION VERSION_LESS 3.0)
+ install(FILES $<TARGET_FILE:${name}>.syms
+ DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR})
+ else()
# Per-config install location.
if(CMAKE_CONFIGURATION_TYPES)
foreach(c ${CMAKE_CONFIGURATION_TYPES})