-if(UNIX OR MINGW)
- execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
- message(STATUS "Using GCC version ${GCC_VERSION}")
- if(NOT GCC_VERSION VERSION_LESS 4.4)
- set(LYX_USE_TR1 1)
- # GCC <= 4.5 does not support regex: there are linker errors
- # http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.tr1
- set(LYX_USE_TR1_REGEX 0)
- endif()
+
+include(LyXMacros)
+
+
+# Usage LYX_OPTION
+# 1. parameter: option name without prefix 'LYX_'
+# 2. parameter: description
+# 3. parameter: default value, ON or OFF
+# 4. parameter: system on which option is used: ALL, GCC, MSVC, ...
+
+
+LYX_OPTION_INIT()
+
+# Options for all compilers/systems
+LYX_OPTION(CPACK "Use the CPack management (Implies LYX_INSTALL option)" OFF ALL)
+LYX_OPTION(INSTALL "Build install projects/rules (implies a bunch of other options)" OFF ALL)
+LYX_OPTION(NLS "Use nls" OFF ALL)
+LYX_OPTION(ASPELL "Require aspell" OFF ALL)
+LYX_OPTION(ENCHANT "Require Enchant" OFF ALL)
+LYX_OPTION(HUNSPELL "Require Hunspell" OFF ALL)
+LYX_OPTION(DEVEL_VERSION "Build developer version" OFF ALL)
+LYX_OPTION(RELEASE "Build release version, build debug when disabled" ON ALL)
+LYX_OPTION(PACKAGE_SUFFIX "Use version suffix for packaging" ON ALL)
+LYX_OPTION(PCH "Use precompiled headers" OFF ALL)
+LYX_OPTION(MERGE_FILES "Merge source files into one compilation unit" OFF ALL)
+LYX_OPTION(MERGE_REBUILD "Rebuild generated files from merged files build" OFF ALL)
+LYX_OPTION(QUIET "Don't generate verbose makefiles" OFF ALL)
+LYX_OPTION(INSTALL_PREFIX "Install path for LyX" OFF ALL)
+LYX_OPTION(EXTERNAL_LIBINTL "Use external libintl" ON ALL)
+
+# GCC specific
+LYX_OPTION(PROFILE "Build profile version" OFF GCC)
+LYX_OPTION(EXTERNAL_BOOST "Use external boost" OFF GCC)
+LYX_OPTION(PROGRAM_SUFFIX "Append version suffix to binaries" ON GCC)
+LYX_OPTION(DEBUG_GLIBC "Enable libstdc++ debug mode" OFF GCC)
+LYX_OPTION(DEBUG_GLIBC_PEDANTIC "Enable libstdc++pedantic debug mode" OFF GCC)
+LYX_OPTION(STDLIB_DEBUG "Use debug stdlib" OFF GCC)
+LYX_OPTION(CONCEPT_CHECKS "Enable concept-checks" OFF GCC)
+
+# MSVC specific
+LYX_OPTION(CONSOLE "Show console on Windows" ON MSVC)
+LYX_OPTION(VLD "Use VLD with MSVC" OFF MSVC)
+LYX_OPTION(WALL "Enable all warnings" OFF MSVC)
+LYX_OPTION(CONFIGURE_CHECKS "Also run configure checks for MSVC" OFF MSVC)
+LYX_OPTION(DEPENDENCIES_DOWNLOAD "Download dependencies for MSVC 10" OFF MSVC)
+
+# Check option dependencies
+if(LYX_CPACK)
+ set(LYX_INSTALL ON)
+endif()
+
+if(LYX_INSTALL)
+ set(LYX_NLS ON)
+ if (WIN32)
+ set(LYX_HUNSPELL ON)
+ endif()
+ set(LYX_CONSOLE OFF)
+ set(LYX_PACKAGE_SUFFIX ON)
+ set(LYX_RELEASE ON)
+ set(LYX_PROFILE OFF)
+endif()
+
+if(LYX_MERGE_FILES)
+ set(LYX_PCH OFF)