# 3. parameter: default value, ON or OFF
# 4. parameter: system on which option is used: ALL, GCC, MSVC, ...
+# Usage LYX_COMBO
+# 1. parameter: name without prefix 'LYX_'
+# 2. parameter: description
+# 3. parameter: default value
+# 4-n parameter: possible other string values
LYX_OPTION_INIT()
# APPLE specific
LYX_OPTION(DMG "Build as Mac bundle, needed for .dmg (experimental) " OFF MAC)
LYX_OPTION(COCOA "Use Cocoa on Mac" OFF MAC)
-
+LYX_COMBO(USE_QT "Use Qt version as frontend" QT4 QT5)
if(help OR HELP)
message(STATUS)
endforeach()
endif()
-find_package(Qt5Core QUIET)
-if (Qt5Core_FOUND)
+if(LYX_USE_QT MATCHES "QT5")
+ find_package(Qt5Core REQUIRED)
+ if (Qt5Core_FOUND)
find_package(Qt5Widgets REQUIRED)
+ find_package(Qt5X11Extras)
set(QTVERSION ${Qt5Core_VERSION})
macro (qt_use_modules)
qt5_use_modules(${ARGN})
macro (qt_wrap_uifiles)
qt5_wrap_ui(${ARGN})
endmacro()
-else()
+ endif()
+elseif(LYX_USE_QT MATCHES "QT4")
find_package(Qt4 "4.5.0" REQUIRED)
macro (qt_use_modules)
endmacro()
macro (qt_wrap_uifiles)
qt4_wrap_ui(${ARGN})
endmacro()
+else()
+ message(FATAL_ERROR "Unhandled value for LYX_USE_QT (${LYX_USE_QT})")
endif()
find_package(Magic)
if(LYX_ENCHANT)
find_package(Enchant REQUIRED)
include_directories(${ENCHANT_INCLUDE_DIR})
-endif()
+ endif()
if(LYX_HUNSPELL)
find_package(Hunspell REQUIRED)
include_directories(${HUNSPELL_INCLUDE_DIR})
-endif()
+ endif()
if(LYX_NLS)
FIND_PROGRAM(LYX_PYTHON_EXECUTABLE python2 python HINTS ${GNUWIN32_DIR}/python)
if(${LYX_PYTHON_EXECUTABLE} MATCHES "-NOTFOUND")
message(STATUS "Python required to create doc!")
else()
- add_subdirectory(${LYX_CMAKE_DIR}/man "${TOP_BINARY_DIR}/man")
+ add_subdirectory(${LYX_CMAKE_DIR}/man "${TOP_BINARY_DIR}/man")
add_subdirectory(${LYX_CMAKE_DIR}/doc "${TOP_BINARY_DIR}/doc")
endif()
if(NOT(LYX_BUNDLE AND APPLE))
- include(../Install)
- endif()
+ include(../Install)
+endif()
endif()
add_subdirectory(sourcedoc "${TOP_BINARY_DIR}/sourcedoc")
endif()
message(STATUS)
-message(STATUS "Build options, switch LYX_* variables by -DLYX_*=ON or OFF:")
+message(STATUS "Build params, switch LYX_* options by -DLYX_*=ON or OFF, LYX_* combos by -DLYX_*=value:")
message(STATUS)
LYX_OPTION_LIST_ALL(used)
#
-# Copyright (c) 2006-2011 Peter Kümmel, <syntheticpp@gmx.net>
+# Copyright (c) 2006-2011 Peter K�mmel, <syntheticpp@gmx.net>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
else()
lyx_add_info_files(MergedFiles ${${_list}})
endif()
-
+
set(${_file_list} ${_file_const} ${_file_touched} ${lyx_${groupname}_info_files})
foreach (_current_FILE ${${_list}})
set(LYX_${_name}_show_message ${_msg})
endmacro()
+macro(LYX_COMBO _name _description _default)
+ 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)
if(UNIX)
foreach(_option ${LYX_OPTIONS})
if(${_option}_show_message OR ${ARGV0} STREQUAL "help")
string(SUBSTRING "${_option} " 0 25 _var)
- if(${_option})
+ get_property(_prop CACHE ${_option} PROPERTY STRINGS)
+ if(_prop)
+ set(_isset ${${_option}})
+ elseif(${_option})
set(_isset ON)
else()
set(_isset OFF)