ctkMacroOptionUtils.cmake 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. macro(ctk_option option_prefix name doc default)
  2. option(${option_prefix}_${name} ${doc} ${default})
  3. mark_as_advanced(${option_prefix}_${name})
  4. list(APPEND ${option_prefix}S ${name})
  5. set(_logical_expr ${ARGN})
  6. if(_logical_expr AND NOT ${option_prefix}_${name})
  7. if(${ARGN})
  8. # Force the option to ON. This is okay since the
  9. # logical expression should contain a CTK_ENABLE_*
  10. # option value, which requires the current option to be ON.
  11. get_property(_doc_string CACHE ${option_prefix}_${name} PROPERTY HELPSTRING)
  12. set(${option_prefix}_${name} ON CACHE BOOL ${_doc_string} FORCE)
  13. message("Enabling [${option_prefix}_${name}] because of [${ARGN}]")
  14. endif()
  15. endif()
  16. endmacro()
  17. macro(ctk_lib_option name doc default)
  18. ctk_option(CTK_LIB ${name} ${doc} ${default} ${ARGN})
  19. endmacro()
  20. macro(ctk_plugin_option name doc default)
  21. ctk_option(CTK_PLUGIN ${name} ${doc} ${default} ${ARGN})
  22. endmacro()
  23. macro(ctk_app_option name doc default)
  24. ctk_option(CTK_APP ${name} ${doc} ${default} ${ARGN})
  25. endmacro()
  26. macro(ctk_enable_option name doc default)
  27. option(CTK_ENABLE_${name} "${doc}" ${default})
  28. if(DEFINED CTK_ENABLE_${name}_internal)
  29. if(${CTK_ENABLE_${name}} AND ${CTK_ENABLE_${name}_internal})
  30. if(NOT (${ARGN}))
  31. get_property(_doc_string CACHE CTK_ENABLE_${name} PROPERTY HELPSTRING)
  32. set(CTK_ENABLE_${name} OFF CACHE BOOL ${_doc_string} FORCE)
  33. message("Full support for [${name}] disabled")
  34. endif()
  35. endif()
  36. endif()
  37. set(CTK_ENABLE_${name}_internal ${CTK_ENABLE_${name}} CACHE INTERNAL "" FORCE)
  38. endmacro()