[PATCH] D15004: cmake: Use custom target to compile timeit/fpcmp

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 25 19:46:36 PST 2015


MatzeB created this revision.
MatzeB added reviewers: jmolloy, rengolin, beanz.
MatzeB added a subscriber: llvm-commits.

When cross compiling the testsuite we still need to compile timeit/fpcmp
for the host machine. These two files are extremely simple C files so adding a custom
command that just runs "cc timeit.c -o timeit" should do the trick.

http://reviews.llvm.org/D15004

Files:
  tools/CMakeLists.txt

Index: tools/CMakeLists.txt
===================================================================
--- tools/CMakeLists.txt
+++ tools/CMakeLists.txt
@@ -1,6 +1,13 @@
 add_executable(timeit-target timeit.c)
 
-# FIXME: These need to be host-compiled, if we're cross compiling.
 # FIXME: Replicate Makefile.tools's logic for determining whether to use fpcmp/fpcmp.sh
-add_executable(fpcmp fpcmp.c)
-add_executable(timeit timeit.c)
+set(TEST_SUITE_HOST_CC "cc" CACHE STRING "C compiler targetting the host")
+mark_as_advanced(TEST_SUITE_HOST_CC)
+add_custom_target(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
+  COMMAND ${TEST_SUITE_HOST_CC} ${CMAKE_CURRENT_SOURCE_DIR}/timeit.c -o ${CMAKE_CURRENT_BINARY_DIR}/timeit
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/timeit.c
+)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15004.41205.patch
Type: text/x-patch
Size: 906 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151126/5afe1738/attachment.bin>


More information about the llvm-commits mailing list