package/opencv: fix build failure on x86
[buildroot-gz.git] / package / clapack / clapack-0003-cmake-do-not-try-to-run-arithchk-when-cross-compilin.patch
blobcd9828ff38cb61c13de5d0bf42fb0407d9ed91f9
1 From a2f0669fac1f8e7183b15cf7d14f0e99a2d8b012 Mon Sep 17 00:00:00 2001
2 From: Samuel Martin <s.martin49@gmail.com>
3 Date: Sat, 11 Jan 2014 21:47:39 +0100
4 Subject: [PATCH 3/6] cmake: do not try to run arithchk when cross-compiling to
5 generate sources
7 Instead, use a predefined arith.h if provided, or generate a default one.
9 The arithchk binary is still built (but not installed) to allow the user to
10 run it on its target and use it; so then allowing to build an optimized
11 blas library.
13 Signed-off-by: Samuel Martin <s.martin49@gmail.com>
14 ---
15 F2CLIBS/libf2c/CMakeLists.txt | 38 ++++++++++++++++++++++++++++----------
16 1 file changed, 28 insertions(+), 10 deletions(-)
18 diff --git a/F2CLIBS/libf2c/CMakeLists.txt b/F2CLIBS/libf2c/CMakeLists.txt
19 index f98d66a..45a0804 100644
20 --- a/F2CLIBS/libf2c/CMakeLists.txt
21 +++ b/F2CLIBS/libf2c/CMakeLists.txt
22 @@ -38,17 +38,35 @@ set(TIME dtime_.c etime_.c)
24 # For INTEGER*8 support (which requires system-dependent adjustments to
25 # f2c.h), add ${QINT} to the OFILES assignment below...
26 -add_executable(arithchk arithchk.c)
27 -if(UNIX)
28 - target_link_libraries(arithchk m)
29 +if(CMAKE_CROSSCOMPILING)
30 + if(ARITH_H)
31 + message(STATUS "Using the user-defined '${ARITH_H}' as arith.h header.")
32 + configure_file("${ARITH_H}" "${CMAKE_CURRENT_BINARY_DIR}/arith.h" COPYONLY)
33 + else()
34 + message(STATUS "No user-defined arith.h header.")
35 + if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/arith.h")
36 + message(WARNING "Generating the default non-optimized 'arith.h' header.
38 +To generate and provide a custom arith.h header:
39 +run the cross-compiled arithchk binary on your target,
40 +and use its output to fill your custom arith.h header.")
41 + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/arith.h"
42 + "/* default, not optimized arith.h */")
43 + endif()
44 + endif()
45 +else()
46 + add_executable(arithchk arithchk.c)
47 + if(UNIX)
48 + target_link_libraries(arithchk m)
49 + endif()
50 + set_target_properties(arithchk PROPERTIES COMPILE_DEFINITIONS
51 + "NO_FPINIT;NO_LONG_LONG")
52 + ADD_CUSTOM_COMMAND(
53 + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/arith.h
54 + COMMAND arithchk > ${CMAKE_CURRENT_BINARY_DIR}/arith.h
55 + DEPENDS arithchk
56 + )
57 endif()
58 -set_target_properties(arithchk PROPERTIES COMPILE_DEFINITIONS
59 - "NO_FPINIT;NO_LONG_LONG")
60 -ADD_CUSTOM_COMMAND(
61 - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/arith.h
62 - COMMAND arithchk > ${CMAKE_CURRENT_BINARY_DIR}/arith.h
63 - DEPENDS arithchk
64 - )
67 set(OFILES ${MISC} ${POW} ${CX} ${DCX} ${REAL} ${DBL} ${INT}
68 --
69 1.8.5.3