]> git.lyx.org Git - lyx.git/blobdiff - CMakeLists.txt
Fix wrong indentation on screen.
[lyx.git] / CMakeLists.txt
index 03b957d6a87bb751c4c55dd2c46ced8507574b31..04f3954350982644c3075950a95de7d3568d19db 100644 (file)
@@ -84,6 +84,7 @@ LYX_OPTION(CPACK            "Use the CPack management (Implies LYX_INSTALL optio
 LYX_OPTION(LOCALVERSIONING  "Add version info to created package name (only used if LYX_CPACK option set)" OFF ALL)
 LYX_OPTION(INSTALL          "Build install projects/rules (implies a bunch of other options)" OFF ALL)
 LYX_OPTION(NLS              "Enable Native Language Support (NLS)" ON ALL)
+LYX_OPTION(REQUIRE_SPELLCHECK "Abort if no spellchecker available" OFF ALL)
 LYX_OPTION(ASPELL           "Require aspell" OFF ALL)
 LYX_OPTION(ENCHANT          "Require Enchant" OFF ALL)
 LYX_OPTION(HUNSPELL         "Require Hunspell" OFF ALL)
@@ -204,8 +205,7 @@ else()
 endif()
 
 
-# Variable that hold the flags that should only be used with C++ files
-set(LYX_CXX_SPECIFIC_FLAGS)
+set(LYX_GCC11_MODE)
 if(UNIX OR MINGW)
        execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
        message(STATUS "Using GCC version ${GCC_VERSION}")
@@ -220,7 +220,7 @@ if(UNIX OR MINGW)
                if(NOT CXX11COMPILER_FOUND)
                        message(FATAL_ERROR "A C++11 compatible compiler is required.")
                endif()
-               set(LYX_CXX_SPECIFIC_FLAGS "${LYX_CXX_SPECIFIC_FLAGS} ${CXX11_FLAG}")
+               set(LYX_GCC11_MODE "${CXX11_FLAG}")
        endif()
 else()
        if(MSVC10)
@@ -374,13 +374,14 @@ if(LYX_INSTALL_PREFIX)
 endif()
 set(LYX_INSTALL_PREFIX ${LYX_INSTALL_PREFIX} CACHE PATH "LyX user's choice install prefix" FORCE)
 
+string(REGEX REPLACE "/lyx${LYX_INSTALL_SUFFIX}$" "/share" SYSTEM_DATADIR ${CMAKE_INSTALL_PREFIX})
+
 if(LYX_PACKAGE_SUFFIX)
        set(PACKAGE ${PACKAGE_BASE}${LYX_INSTALL_SUFFIX})
 else()
        set(PACKAGE ${PACKAGE_BASE})
 endif()
 
-
 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
        # see http://www.cmake.org/pipermail/cmake/2006-October/011559.html
        if (UNIX)
@@ -484,7 +485,7 @@ if(NOT MSVC)
        if(NOT LYX_QUIET)
                set(CMAKE_VERBOSE_MAKEFILE ON)
        endif()
-       set(LYX_CXX_FLAGS "-Wall -Wunused-parameter")
+       set(LYX_CXX_FLAGS "-Wall -Wunused-parameter ${LYX_GCC11_MODE}")
        if(LYX_STDLIB_DEBUG)
                set(LYX_CXX_FLAGS "${LYX_CXX_FLAGS} -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC")
        endif()
@@ -540,20 +541,25 @@ endif()
 
 include_directories(${TOP_BINARY_DIR} ${TOP_SRC_DIR}/src)
 
-if(LYX_ASPELL)
-       find_package(ASPELL REQUIRED)
-       include_directories(${ASPELL_INCLUDE_DIR})
-endif()
-
-if(LYX_ENCHANT)
-       find_package(Enchant REQUIRED)
-       include_directories(${ENCHANT_INCLUDE_DIR})
-endif()
-
-if(LYX_HUNSPELL)
-       find_package(Hunspell REQUIRED)
-       include_directories(${HUNSPELL_INCLUDE_DIR})
-endif()
+set(Spelling_FOUND OFF)
+set(Include_used_spellchecker)   # String will be inserted into config.h
+
+foreach(_spell "ASPELL" "Enchant" "Hunspell")
+  string(TOUPPER ${_spell} _upspell)
+  find_package(${_spell})
+  if (${_upspell}_FOUND)
+    include_directories(${${_upspell}_INCLUDE_DIR})
+    set(Spelling_FOUND ON)
+    message(STATUS "Building with USE_${_upspell}")
+    set(Include_used_spellchecker "${Include_used_spellchecker}#define USE_${_upspell} 1\n")
+  else()
+    if(LYX_${_upspell})
+      message(FATAL_ERROR "Required ${_spell} devel package not found")
+    else()
+      message(STATUS "${_upspell} not found, building without ${_spell} support")
+    endif()
+  endif()
+endforeach()
 
 if(LYX_NLS)
        FIND_PROGRAM(LYX_PYTHON_EXECUTABLE python2 python HINTS ${GNUWIN32_DIR}/python)
@@ -591,6 +597,7 @@ else()
                set(Lyx_Boost_Libraries boost_signals boost_regex)
        endif()
        add_definitions(-DBOOST_USER_CONFIG="<config.h>")
+       add_definitions(-DBOOST_SIGNALS_NO_DEPRECATION_WARNING=1)
        include_directories(${TOP_SRC_DIR}/boost)
        add_subdirectory(boost "${TOP_BINARY_DIR}/boost")
 endif()
@@ -818,6 +825,15 @@ if(LYX_NLS)
        message(STATUS)
 endif()
 
+if(NOT Spelling_FOUND)
+  if(LYX_REQUIRE_SPELLCHECK)
+    set(_mode "FATAL_ERROR")
+  else()
+    set(_mode "STATUS")
+  endif()
+  message(${_mode} "No spellcheck libraries found. Lyx will be unable use spellchecking")
+endif()
+
 include("${TOP_CMAKE_PATH}/LyxPackaging.cmake")
 
 if(ENABLE_DIST)