commit cc6175bc96d03696dcd11bb207fc0f599a0947ab
Author: Kornel Benko <kor...@lyx.org>
Date:   Mon Jun 9 10:03:56 2014 +0200

    Cmake build: Early check for wrong combo values

diff --git a/development/cmake/modules/LyXMacros.cmake 
b/development/cmake/modules/LyXMacros.cmake
index 4332830..bcbca73 100644
--- a/development/cmake/modules/LyXMacros.cmake
+++ b/development/cmake/modules/LyXMacros.cmake
@@ -234,11 +234,19 @@ macro(LYX_OPTION _name _description _default _sys)
 endmacro()
 
 macro(LYX_COMBO _name _description _default)
-  set(LYX_${_name} ${_default} CACHE STRING "${_description}")
-  set_property(CACHE LYX_${_name} PROPERTY STRINGS ${_default} ${ARGN})
-  list(APPEND LYX_OPTIONS LYX_${_name})
-  set(LYX_${_name}_show_message ON)
-  set(LYX_${_name}_description ${_description})
+  set(_lyx_name "LYX_${_name}")
+  set(${_lyx_name} ${_default} CACHE STRING "${_description}")
+  set(_combo_list ${_default} ${ARGN})
+  set_property(CACHE ${_lyx_name} PROPERTY STRINGS ${_combo_list})
+  list(APPEND LYX_OPTIONS ${_lyx_name})
+  set(${_lyx_name}_show_message ON)
+  string(REGEX REPLACE ";" " " _use_list "${_combo_list}")
+  set(${_lyx_name}_description "${_description} (${_use_list})")
+  # Now check the value
+  list(FIND _combo_list ${${_lyx_name}} _idx)
+  if (_idx LESS 0)
+    message(FATAL_ERROR "${_lyx_name} set to \"${${_lyx_name}}\", but has to 
be only one of (${_use_list})")
+  endif()
 endmacro()
 
 macro(LYX_OPTION_LIST_ALL)

Reply via email to