🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.8 KiB

  1. macro(SET_OPTION _NAME _DESC)
  2. list(APPEND ALLOPTIONS ${_NAME})
  3. if(${ARGC} EQUAL 3)
  4. set(_DEFLT ${ARGV2})
  5. else()
  6. set(_DEFLT OFF)
  7. endif()
  8. option(${_NAME} ${_DESC} ${_DEFLT})
  9. endmacro()
  10. macro(DEP_OPTION _NAME _DESC _DEFLT _DEPTEST _FAILDFLT)
  11. list(APPEND ALLOPTIONS ${_NAME})
  12. cmake_dependent_option(${_NAME} ${_DESC} ${_DEFLT} ${_DEPTEST} ${_FAILDFLT})
  13. endmacro()
  14. macro(OPTION_STRING _NAME _DESC _VALUE)
  15. list(APPEND ALLOPTIONS ${_NAME})
  16. set(${_NAME} ${_VALUE} CACHE STRING "${_DESC}")
  17. set(HAVE_${_NAME} ${_VALUE})
  18. ENDMACRO()
  19. # Message Output
  20. macro(MESSAGE_WARN _TEXT)
  21. message(STATUS "*** WARNING: ${_TEXT}")
  22. endmacro()
  23. macro(MESSAGE_ERROR _TEXT)
  24. message(FATAL_ERROR "*** ERROR: ${_TEXT}")
  25. endmacro()
  26. macro(MESSAGE_BOOL_OPTION _NAME _VALUE)
  27. if(${_VALUE})
  28. message(STATUS " ${_NAME}:\tON")
  29. else()
  30. message(STATUS " ${_NAME}:\tOFF")
  31. endif()
  32. endmacro()
  33. macro(MESSAGE_TESTED_OPTION _NAME)
  34. set(_REQVALUE ${${_NAME}})
  35. set(_PAD " ")
  36. if(${ARGC} EQUAL 2)
  37. set(_PAD ${ARGV1})
  38. endif()
  39. if(NOT HAVE_${_NAME})
  40. set(HAVE_${_NAME} OFF)
  41. elseif("${HAVE_${_NAME}}" MATCHES "1|TRUE|YES|Y")
  42. set(HAVE_${_NAME} ON)
  43. endif()
  44. message(STATUS " ${_NAME}${_PAD}(Wanted: ${_REQVALUE}): ${HAVE_${_NAME}}")
  45. endmacro()
  46. macro(LISTTOSTR _LIST _OUTPUT)
  47. if(${ARGC} EQUAL 3)
  48. # prefix for each element
  49. set(_LPREFIX ${ARGV2})
  50. else()
  51. set(_LPREFIX "")
  52. endif()
  53. # Do not use string(REPLACE ";" " ") here to avoid messing up list
  54. # entries
  55. foreach(_ITEM ${${_LIST}})
  56. set(${_OUTPUT} "${_LPREFIX}${_ITEM} ${${_OUTPUT}}")
  57. endforeach()
  58. endmacro()
  59. macro(CHECK_OBJC_SOURCE_COMPILES SOURCE VAR)
  60. set(PREV_REQUIRED_DEFS "${CMAKE_REQUIRED_DEFINITIONS}")
  61. set(CMAKE_REQUIRED_DEFINITIONS "-x objective-c ${PREV_REQUIRED_DEFS}")
  62. CHECK_C_SOURCE_COMPILES(${SOURCE} ${VAR})
  63. set(CMAKE_REQUIRED_DEFINITIONS "${PREV_REQUIRED_DEFS}")
  64. endmacro()