summaryrefslogtreecommitdiff
path: root/cmake/Modules/SanitizerUtils.cmake
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2014-03-04 08:28:43 +0000
committerAlexey Samsonov <samsonov@google.com>2014-03-04 08:28:43 +0000
commitcbac3e404c48bd0a7d63f24d01437ea8b881a834 (patch)
tree62a03273849dbb66c89ecca5b4e95d9014d16242 /cmake/Modules/SanitizerUtils.cmake
parentcb4f171307e0812a3c0707070e460116cbadd5f2 (diff)
[CMake] Fix add_sanitizer_rt_symbols on multi-config CMake generators.
Patch by Brad King. When using a multi-config generator with CMake, such as for VS or Xcode, the LOCATION target property value contains a placeholder such as "$(Configuration)" that is meant for substitution by the native build tool. The install(FILES) command does not understand this name and will not install the symbols file correctly when using these generators. Teach add_sanitizer_rt_symbols to read the more-specific target property LOCATION_<CONFIG> that has a per-configuration value and no placeholder. On single-configuration generators (Makefile, Ninja), CMAKE_BUILD_TYPE contains the name of the one configuration to be built. On multi-config generators (VS, Xcode), CMAKE_CONFIGURATION_TYPES contains the list of possible configurations. In the latter case, loop over the configs and add a configuration-specific install(FILES) rule for each one. Place the code block inside an if(TRUE) block so it can be made conditional in a following change without updating indentation. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@202796 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake/Modules/SanitizerUtils.cmake')
-rw-r--r--cmake/Modules/SanitizerUtils.cmake15
1 files changed, 14 insertions, 1 deletions
diff --git a/cmake/Modules/SanitizerUtils.cmake b/cmake/Modules/SanitizerUtils.cmake
index aa7be300c..23c6d7b19 100644
--- a/cmake/Modules/SanitizerUtils.cmake
+++ b/cmake/Modules/SanitizerUtils.cmake
@@ -25,7 +25,20 @@ macro(add_sanitizer_rt_symbols name)
add_custom_target(${name}-symbols ALL
DEPENDS ${symsfile}
SOURCES ${SANITIZER_GEN_DYNAMIC_LIST} ${ARGN})
- install(FILES ${symsfile} DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR})
+
+ if(TRUE)
+ # Per-config install location.
+ if(CMAKE_CONFIGURATION_TYPES)
+ foreach(c ${CMAKE_CONFIGURATION_TYPES})
+ get_target_property(libfile ${name} LOCATION_${c})
+ install(FILES ${libfile}.syms CONFIGURATIONS ${c}
+ DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR})
+ endforeach()
+ else()
+ get_target_property(libfile ${name} LOCATION_${CMAKE_BUILD_TYPE})
+ install(FILES ${libfile}.syms DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR})
+ endif()
+ endif()
endmacro()
# Add target to check code style for sanitizer runtimes.