]> git.lyx.org Git - lyx.git/blobdiff - CMakeLists.txt
Support for conference posters
[lyx.git] / CMakeLists.txt
index 0ceebc96a4086ab151a7b9e4120f2a1331314c4b..c626bf4251e576d57ae28cb82c84aaa1855334f9 100644 (file)
@@ -47,6 +47,19 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
 # Supress regeneration
 set(CMAKE_SUPPRESS_REGENERATION FALSE)
 
+if(LYX_XMINGW)
+    set(CMAKE_SYSTEM_NAME Windows)
+    set(TOOLNAME ${LYX_XMINGW})
+    set(TOOLCHAIN "${TOOLNAME}-")
+    set(CMAKE_C_COMPILER   "${TOOLCHAIN}gcc"     CACHE PATH "Mingw C compiler" FORCE)
+    set(CMAKE_CXX_COMPILER "${TOOLCHAIN}g++"     CACHE PATH "Mingw C++ compiler" FORCE)
+    set(CMAKE_RC_COMPILER  "${TOOLCHAIN}windres" CACHE PATH "Mingw rc compiler" FORCE)
+
+    set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
+    set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+    set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+endif()
+
 if(NOT help AND NOT HELP)
        # 'project' triggers the searching for a compiler
        project(${LYX_PROJECT})
@@ -76,6 +89,11 @@ include(LyXMacros)
 # 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()
 
@@ -100,6 +118,7 @@ LYX_OPTION(QUIET            "Don't generate verbose makefiles" OFF ALL)
 LYX_OPTION(INSTALL_PREFIX   "Install path for LyX" OFF ALL)
 LYX_OPTION(BUNDLE           "Build bundle  (experimental) " OFF ALL)
 LYX_OPTION(ENABLE_URLTESTS  "Enable for URL tests" OFF ALL)
+LYX_OPTION(ENABLE_EXPORT_TESTS "Enable for export tests" OFF ALL)
 
 # GCC specific
 LYX_OPTION(PROFILE              "Build profile version" OFF GCC)
@@ -122,6 +141,11 @@ LYX_OPTION(DEPENDENCIES_DOWNLOAD "Download dependencies for MSVC 10" OFF MSVC)
 # APPLE specific
 LYX_OPTION(DMG                   "Build as Mac bundle, needed for .dmg  (experimental) " OFF MAC)
 LYX_OPTION(COCOA                 "Use Cocoa on Mac" OFF MAC)
+if(LYX_XMINGW)
+  LYX_COMBO(USE_QT               "Use Qt version as frontend for MINGW" QT4)
+else()
+  LYX_COMBO(USE_QT               "Use Qt version as frontend" QT4 QT5)
+endif()
 
 
 if(help OR HELP)
@@ -146,7 +170,7 @@ endif()
 
 if(LYX_INSTALL)
        set(LYX_NLS ON)
-       if (WIN32)
+        if(WIN32 AND NOT MINGW)
                set(LYX_HUNSPELL ON)
        endif()
        if(LYX_CONSOLE MATCHES "FORCE")
@@ -168,6 +192,7 @@ else()
        set(LYX_MERGE_REBUILD OFF)
 endif()
 
+
 if(LYX_DEPENDENCIES_DOWNLOAD)
        message(STATUS)
        set(LYX_DEPENDENCIES_DIR ${TOP_BINARY_DIR}/msvc2010-deps)
@@ -191,6 +216,10 @@ if(LYX_DEPENDENCIES_DOWNLOAD)
                endif()
        endforeach()
        set(GNUWIN32_DIR ${LYX_DEPENDENCIES_DIR}/deps20)
+    if(MSVC12)
+        # handle error in msvc12 when linking against msvc10 libs
+        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /vd2")
+    endif()
 endif()
 
 
@@ -509,8 +538,13 @@ if(LYX_CXX_FLAGS_EXTRA)
        endforeach()
 endif()
 
-find_package(Qt5Core QUIET)
-if (Qt5Core_FOUND)
+if(LYX_XMINGW)
+    set(QT_MINGW_DIR ${LYX_QT4} CACHE PATH "Qt for Mingw" FORCE)
+    list(APPEND CMAKE_FIND_ROOT_PATH ${QT_MINGW_DIR} ${GNUWIN32_DIR})
+endif()
+if(LYX_USE_QT MATCHES "QT5")
+  find_package(Qt5Core REQUIRED)
+  if (Qt5Core_FOUND)
        find_package(Qt5Widgets REQUIRED)
         find_package(Qt5X11Extras)
        set(QTVERSION ${Qt5Core_VERSION})
@@ -523,7 +557,8 @@ if (Qt5Core_FOUND)
        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()
@@ -533,6 +568,8 @@ else()
        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)
@@ -578,6 +615,7 @@ if(LYX_NLS)
        endif()
 endif()
 
+
 find_package(ICONV REQUIRED)
 find_package(ZLIB REQUIRED)
 
@@ -791,7 +829,9 @@ if(LYX_INSTALL)
        if(${LYX_PYTHON_EXECUTABLE} MATCHES "-NOTFOUND")
                message(STATUS "Python required to create doc!")
        else()
-               add_subdirectory(${LYX_CMAKE_DIR}/man "${TOP_BINARY_DIR}/man")
+               if(UNIX)
+                       add_subdirectory(${LYX_CMAKE_DIR}/man "${TOP_BINARY_DIR}/man")
+               endif()
                add_subdirectory(${LYX_CMAKE_DIR}/doc "${TOP_BINARY_DIR}/doc")
        endif()
        include(../Install)
@@ -808,8 +848,9 @@ if(LYX_ENABLE_URLTESTS)
 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)
 
 
@@ -826,13 +867,15 @@ if(LYX_NLS)
        message(STATUS)
 endif()
 
-if(NOT Spelling_FOUND)
+# Apple has builtin native spell checker,
+# no need to warn for missing Aspell, Hunspell or Enchant
+if(NOT Spelling_FOUND AND NOT APPLE)
   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")
+  message(${_mode} "No spellcheck libraries found. LyX will be unable use spellchecking")
 endif()
 
 include("${TOP_CMAKE_PATH}/LyxPackaging.cmake")