forked from OSchip/llvm-project
[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. llvm-svn: 202796
This commit is contained in:
parent
49be2f43c2
commit
72f17afd48
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue