[test-suite] r258280 - tools/CMakeLists: Use a macro for common code, fix custom_command output
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 19 19:20:01 PST 2016
Author: matze
Date: Tue Jan 19 21:20:00 2016
New Revision: 258280
URL: http://llvm.org/viewvc/llvm-project?rev=258280&view=rev
Log:
tools/CMakeLists: Use a macro for common code, fix custom_command output
Remove the explicit ${CMAKE_CURRENT_BINARY_DIR}/ prefix from the
add_custom_command OUTPUT part, fixes ninja warnings for me.
Differential Revision: http://reviews.llvm.org/D16153
Modified:
test-suite/trunk/tools/CMakeLists.txt
Modified: test-suite/trunk/tools/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/tools/CMakeLists.txt?rev=258280&r1=258279&r2=258280&view=diff
==============================================================================
--- test-suite/trunk/tools/CMakeLists.txt (original)
+++ test-suite/trunk/tools/CMakeLists.txt Tue Jan 19 21:20:00 2016
@@ -9,15 +9,14 @@ add_executable(timeit-target ${CMAKE_CUR
set(TEST_SUITE_HOST_CC "cc" CACHE STRING "C compiler targetting the host")
mark_as_advanced(TEST_SUITE_HOST_CC)
-add_custom_target(fpcmp-host
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/fpcmp)
-add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/fpcmp
- COMMAND ${TEST_SUITE_HOST_CC} ${CMAKE_CURRENT_SOURCE_DIR}/fpcmp.c -o ${CMAKE_CURRENT_BINARY_DIR}/fpcmp
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/fpcmp.c
-)
-add_custom_target(timeit-host
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/timeit)
-add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/timeit
- COMMAND ${TEST_SUITE_HOST_CC} ${CMAKE_CURRENT_SOURCE_DIR}/timeit.c -o ${CMAKE_CURRENT_BINARY_DIR}/timeit
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/timeit.c
-)
+macro(llvm_add_host_executable targetname exename sourcefile)
+ add_custom_command(OUTPUT ${exename}
+ COMMAND ${TEST_SUITE_HOST_CC} ${CMAKE_CURRENT_SOURCE_DIR}/${sourcefile} -o ${CMAKE_CURRENT_BINARY_DIR}/${exename}
+ COMMENT "[TEST_SUITE_HOST_CC] Building host executable ${exename}"
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${sourcefile}
+ )
+ add_custom_target(${targetname} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${exename})
+endmacro()
+
+llvm_add_host_executable(fpcmp-host fpcmp fpcmp.c)
+llvm_add_host_executable(timeit-host timeit timeit.c)
More information about the llvm-commits
mailing list