summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorGeorge Karpenkov <ekarpenkov@apple.com>2017-08-21 21:19:13 +0000
committerGeorge Karpenkov <ekarpenkov@apple.com>2017-08-21 21:19:13 +0000
commit916b56d6d731c57374e2635abaa39cdc3e8ff129 (patch)
treeb09de5a36f86113418a5e8755b536f7bcf123989 /cmake
parentbdf800ddb572949ce9cb5e27c89053a5b62b1083 (diff)
[NFC CMake] Do not relink test targets every time in compiler-rt
CMake's add_custom_target is considered to be *always* out of date. This patch changes it to a combination of add_custom_target and add_custom_command which actually tracks dependencies' timestamps. On my machine this reliably saves 6-7 seconds on each test group. This can be a large difference when debugging small tests. Differential Revision: https://reviews.llvm.org/D36912 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@311384 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/AddCompilerRT.cmake15
1 files changed, 9 insertions, 6 deletions
diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
index aa6b4a30d..9220eab84 100644
--- a/cmake/Modules/AddCompilerRT.cmake
+++ b/cmake/Modules/AddCompilerRT.cmake
@@ -368,15 +368,18 @@ function(add_compiler_rt_test test_suite test_name arch)
set(TEST_LINK_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${TEST_LINK_FLAGS}")
separate_arguments(TEST_LINK_FLAGS)
endif()
- add_custom_target(${test_name}
- COMMAND ${COMPILER_RT_TEST_COMPILER} ${TEST_OBJECTS}
- -o "${output_bin}"
+
+ add_custom_command(
+ OUTPUT "${output_bin}"
+ COMMAND ${COMPILER_RT_TEST_COMPILER} ${TEST_OBJECTS} -o "${output_bin}"
${TEST_LINK_FLAGS}
- DEPENDS ${TEST_DEPS})
- set_target_properties(${test_name} PROPERTIES FOLDER "Compiler-RT Tests")
+ DEPENDS ${TEST_DEPS}
+ )
+ add_custom_target(T${test_name} DEPENDS "${output_bin}")
+ set_target_properties(T${test_name} PROPERTIES FOLDER "Compiler-RT Tests")
# Make the test suite depend on the binary.
- add_dependencies(${test_suite} ${test_name})
+ add_dependencies(${test_suite} T${test_name})
endfunction()
macro(add_compiler_rt_resource_file target_name file_name component)