summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/tests
diff options
context:
space:
mode:
authorGeorge Karpenkov <ekarpenkov@apple.com>2017-07-27 18:40:38 +0000
committerGeorge Karpenkov <ekarpenkov@apple.com>2017-07-27 18:40:38 +0000
commitfa4969a72758e98246cb7ee4e8178bca5dd5250a (patch)
treed4cdf466a4af3dc0c59f1aa4fe009259698f1d29 /lib/sanitizer_common/tests
parent861f5212c5583d72b48c528657bffc5aafe2a7c0 (diff)
[sanitizers] Sanitizer tests CMake clean up
This patch addresses two issues: Most of the time, hacks with `if/else` in order to get support for multi-configuration builds are superfluous. The variable `CMAKE_CFG_INTDIR` was created precisely for this purpose: it expands to `.` on all single-configuration builds, and to a configuration name otherwise. The `if/else` hacks for the library name generation should also not be done, as CMake has `TARGET_FILE` generator expression precisely for this purpose, as it expands to the exact filename of the resulting target. Differential Revision: https://reviews.llvm.org/D35952 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309306 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/tests')
-rw-r--r--lib/sanitizer_common/tests/CMakeLists.txt17
1 files changed, 2 insertions, 15 deletions
diff --git a/lib/sanitizer_common/tests/CMakeLists.txt b/lib/sanitizer_common/tests/CMakeLists.txt
index 2acedd0ef..5c107babe 100644
--- a/lib/sanitizer_common/tests/CMakeLists.txt
+++ b/lib/sanitizer_common/tests/CMakeLists.txt
@@ -127,16 +127,7 @@ function(get_sanitizer_common_lib_for_arch arch lib lib_name)
set(tgt_name "RTSanitizerCommon.test.${arch}")
endif()
set(${lib} "${tgt_name}" PARENT_SCOPE)
- if(CMAKE_CONFIGURATION_TYPES)
- set(configuration_path "${CMAKE_CFG_INTDIR}/")
- else()
- set(configuration_path "")
- endif()
- if(NOT MSVC)
- set(${lib_name} "${configuration_path}lib${tgt_name}.a" PARENT_SCOPE)
- else()
- set(${lib_name} "${configuration_path}${tgt_name}.lib" PARENT_SCOPE)
- endif()
+ set(${lib_name} $<TARGET_FILE:${tgt_name}> PARENT_SCOPE)
endfunction()
# Sanitizer_common unit tests testsuite.
@@ -164,11 +155,7 @@ macro(add_sanitizer_tests_for_arch arch)
set(SANITIZER_TEST_OBJECTS)
foreach(source ${SANITIZER_TEST_SOURCES})
get_filename_component(basename ${source} NAME)
- if(CMAKE_CONFIGURATION_TYPES)
- set(output_obj "${CMAKE_CFG_INTDIR}/${basename}.${arch}.o")
- else()
- set(output_obj "${basename}.${arch}.o")
- endif()
+ set(output_obj "${CMAKE_CFG_INTDIR}/${basename}.${arch}.o")
clang_compile(${output_obj} ${source}
CFLAGS ${SANITIZER_TEST_CFLAGS_COMMON} ${TARGET_FLAGS}
DEPS ${SANITIZER_TEST_COMPILE_DEPS})