summaryrefslogtreecommitdiffstats
path: root/compiler-rt
diff options
context:
space:
mode:
authorGeorge Karpenkov <ekarpenkov@apple.com>2017-08-15 18:32:28 +0000
committerGeorge Karpenkov <ekarpenkov@apple.com>2017-08-15 18:32:28 +0000
commitd46f17db0605a4bffe7066b689cd1c89c95e989b (patch)
treececc39b114eb23286d348eb0dbcc3f073d3fe07e /compiler-rt
parentf69b7d5c930e839de3dedf4bb56c03068946f3f5 (diff)
downloadbcm5719-llvm-d46f17db0605a4bffe7066b689cd1c89c95e989b.tar.gz
bcm5719-llvm-d46f17db0605a4bffe7066b689cd1c89c95e989b.zip
[compiler-rt CMake] CMake refactoring: create directories in helper func.
Change macro to a function, move creating test directory into `add_compiler_rt_test`. Differential Revision: https://reviews.llvm.org/D36724 llvm-svn: 310943
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/cmake/Modules/AddCompilerRT.cmake12
-rw-r--r--compiler-rt/lib/asan/tests/CMakeLists.txt5
2 files changed, 7 insertions, 10 deletions
diff --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
index 78663353c01..34afc10a440 100644
--- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -295,13 +295,15 @@ endif()
# OBJECTS <object files>
# DEPS <deps (e.g. runtime libs)>
# LINK_FLAGS <link flags>)
-macro(add_compiler_rt_test test_suite test_name)
+function(add_compiler_rt_test test_suite test_name)
cmake_parse_arguments(TEST "" "SUBDIR" "OBJECTS;DEPS;LINK_FLAGS" "" ${ARGN})
- set(output_bin ${CMAKE_CURRENT_BINARY_DIR})
+ set(output_dir ${CMAKE_CURRENT_BINARY_DIR})
if(TEST_SUBDIR)
- set(output_bin "${output_bin}/${TEST_SUBDIR}")
+ set(output_dir "${output_dir}/${TEST_SUBDIR}")
endif()
- set(output_bin "${output_bin}/${CMAKE_CFG_RESOLVED_INTDIR}${test_name}")
+ set(output_dir "${output_dir}/${CMAKE_CFG_INTDIR}")
+ file(MAKE_DIRECTORY "${output_dir}")
+ set(output_bin "${output_dir}/${test_name}")
if(MSVC)
set(output_bin "${output_bin}.exe")
endif()
@@ -329,7 +331,7 @@ macro(add_compiler_rt_test test_suite test_name)
# Make the test suite depend on the binary.
add_dependencies(${test_suite} ${test_name})
-endmacro()
+endfunction()
macro(add_compiler_rt_resource_file target_name file_name component)
set(src_file "${CMAKE_CURRENT_SOURCE_DIR}/${file_name}")
diff --git a/compiler-rt/lib/asan/tests/CMakeLists.txt b/compiler-rt/lib/asan/tests/CMakeLists.txt
index e08346ade77..a690ed42bee 100644
--- a/compiler-rt/lib/asan/tests/CMakeLists.txt
+++ b/compiler-rt/lib/asan/tests/CMakeLists.txt
@@ -224,16 +224,11 @@ macro(add_asan_tests_for_arch_and_kind arch kind cflags)
set(ASAN_INST_DYNAMIC_TEST_OBJECTS ${ASAN_INST_TEST_OBJECTS})
endif()
- # Create the 'default' folder where ASAN tests are produced.
- file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/default/${CMAKE_CFG_RESOLVED_INTDIR}")
-
add_asan_test(AsanUnitTests "Asan-${arch}${kind}-Test"
${arch} ${kind} SUBDIR "default"
OBJECTS ${ASAN_INST_TEST_OBJECTS}
LINK_FLAGS ${ASAN_UNITTEST_INSTRUMENTED_LINK_FLAGS})
if(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME)
- # Create the 'dynamic' folder where ASAN tests are produced.
- file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dynamic/${CMAKE_CFG_RESOLVED_INTDIR}")
add_asan_test(AsanDynamicUnitTests "Asan-${arch}${kind}-Dynamic-Test"
${arch} ${kind} SUBDIR "dynamic"
OpenPOWER on IntegriCloud