0003-cmake-do-not-try-to-run-arithchk-when-cross-compilin.patch 2.5 KB

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