cmake_minimum_required(VERSION 2.6.4)
+set(LYX_PROJECT LyX)
-set(LYX_PROJECT lyx)
+enable_testing()
+
+get_filename_component(lyx_dir_readme ${CMAKE_SOURCE_DIR}/README REALPATH) # Resolve symlinks
+get_filename_component(TOP_SRC_DIR ${lyx_dir_readme} PATH)
+message(STATUS "TOP_SRC_DIR = ${TOP_SRC_DIR}")
set(LYX_CMAKE_DIR "development/cmake")
-set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/${LYX_CMAKE_DIR}/modules")
+set(TOP_CMAKE_PATH "${TOP_SRC_DIR}/${LYX_CMAKE_DIR}")
+set(TOP_MODULE_PATH "${TOP_CMAKE_PATH}/modules")
+set(TOP_SCRIPT_PATH "${TOP_CMAKE_PATH}/scripts")
-get_filename_component(lyx_dir_readme ${CMAKE_SOURCE_DIR}/README ABSOLUTE)
-get_filename_component(TOP_SRC_DIR ${lyx_dir_readme} PATH)
+set(CMAKE_MODULE_PATH "${TOP_MODULE_PATH}")
set(CMAKE_PROJECT_NAME ${LYX_PROJECT})
message(STATUS)
-if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
+if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(STATUS "Building in-source")
set(TOP_BINARY_DIR "${CMAKE_BINARY_DIR}/build")
else()
set(TOP_BINARY_DIR "${CMAKE_BINARY_DIR}")
endif()
+# This directory should be used if some test uses lyx-executable
+set(LYX_TESTS_USERDIR "${TOP_BINARY_DIR}/Testing/.lyx")
+file(MAKE_DIRECTORY "${LYX_TESTS_USERDIR}")
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 OLD)
cmake_policy(SET CMP0005 OLD)
+ # Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION
+ cmake_policy(SET CMP0006 NEW)
+ if(POLICY CMP0020)
+ cmake_policy(SET CMP0020 OLD)
+ endif()
+ if(POLICY CMP0028)
+ cmake_policy(SET CMP0028 OLD)
+ endif()
+ if(POLICY CMP0043)
+ # COMPILE_DEFINITIONS are not used yet. Enable new behavior.
+ cmake_policy(SET CMP0043 NEW)
+ endif()
endif()
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})
+ # 'project' triggers the searching for a compiler
+ project(${LYX_PROJECT})
+ if (CMAKE_COMPILER_IS_GNUCXX)
+ if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.0")
+ message(STATUS "Gnu CXX compiler version = ${CMAKE_CXX_COMPILER_VERSION}")
+ message(STATUS "is too old, should be >= 4.0")
+ message(FATAL_ERROR "Exiting")
+ endif()
+ endif()
endif()
if(UNIX)
# 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()
# Options for all compilers/systems
LYX_OPTION(CPACK "Use the CPack management (Implies LYX_INSTALL option)" OFF ALL)
+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)
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)
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)
+LYX_OPTION(ASAN "Use address sanitizer" OFF ALL)
+LYX_COMBO(USE_QT "Use Qt version as frontend" QT4 QT5)
+LYX_OPTION(3RDPARTY_BUILD "Build 3rdparty libs" OFF ALL)
+LYX_COMBO(ENABLE_CXX11 "Build with options for c++11-mode" AUTO ON OFF)
# 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(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)
+LYX_OPTION(PROFILE "Build with options for gprof" OFF GCC)
# MSVC specific
-LYX_OPTION(CONSOLE "Show console on Windows" ON MSVC)
+LYX_OPTION(CONSOLE "Show console on Windows, enforce with =FORCE" 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)
# Check option dependencies
-if(LYX_CPACK)
- set(LYX_INSTALL ON)
-endif()
-
if(LYX_DMG)
set(LYX_BUNDLE ON)
set(LYX_CPACK ON)
endif()
+if(LYX_CPACK)
+ set(LYX_INSTALL ON)
+endif()
+
if(LYX_INSTALL)
set(LYX_NLS ON)
- if (WIN32)
+ if(WIN32 AND NOT MINGW)
set(LYX_HUNSPELL ON)
endif()
- set(LYX_CONSOLE OFF)
+ if(LYX_CONSOLE MATCHES "FORCE")
+ set(LYX_CONSOLE ON)
+ else()
+ set(LYX_CONSOLE OFF)
+ endif()
set(LYX_PACKAGE_SUFFIX ON)
- set(LYX_RELEASE ON)
+ if(NOT LYX_DEBUG)
+ set(LYX_RELEASE ON)
+ endif()
set(LYX_PROFILE OFF)
endif()
set(LYX_MERGE_REBUILD OFF)
endif()
+
if(LYX_DEPENDENCIES_DOWNLOAD)
message(STATUS)
- set(LYX_DEPENDENCIES_DIR ${TOP_BINARY_DIR}/msvc2010-deps)
- message(STATUS "Using downloaded dependencies in ${LYX_DEPENDENCIES_DIR}")
- set(deps_files lyx20-deps-msvc2010-x86.zip)
+ if(MSVC12)
+ set(LYX_DEPENDENCIES_DIR ${TOP_BINARY_DIR}/msvc2013-deps)
+ set(deps_files lyx-windows-deps-msvc2013.zip)
+ set(deps_server http://ftp.lyx.de/LyX-Windows-Deps)
+ set(GNUWIN32_DIR ${LYX_DEPENDENCIES_DIR}/lyx-windows-deps-msvc2013)
+ else()
+ set(LYX_DEPENDENCIES_DIR ${TOP_BINARY_DIR}/msvc2010-deps)
+ set(deps_files lyx20-deps-msvc2010-x86.zip)
+ set(deps_server http://downloads.sourceforge.net/project/lyx/Win_installers/Dependencies)
+ set(GNUWIN32_DIR ${LYX_DEPENDENCIES_DIR}/deps20)
+ endif()
+ message(STATUS "Using downloaded dependencies in ${LYX_DEPENDENCIES_DIR}")
foreach(it ${deps_files})
set(already_downloaded already_downloaded-NOTFOUND CACHE PATH "downloaded" FORCE)
find_file(already_downloaded ${it} "${LYX_DEPENDENCIES_DIR}/download")
if(NOT already_downloaded)
message(STATUS "Downloading ${it} ...")
- file(DOWNLOAD ftp://ftp.devel.lyx.org/pub/contrib/windows/${it} ${LYX_DEPENDENCIES_DIR}/download/${it} SHOW_PROGRESS)
+ file(DOWNLOAD ${deps_server}/${it} ${LYX_DEPENDENCIES_DIR}/download/${it} SHOW_PROGRESS STATUS status LOG log)
+ list(GET status 0 status_code)
+ list(GET status 1 status_string)
+ if(NOT status_code EQUAL 0)
+ file(REMOVE ${LYX_DEPENDENCIES_DIR}/${it})
+ message(FATAL_ERROR "error: downloading '${it}' failed. status_code: ${status_code}, status_string: ${status_string}. \nLog: ${log} ")
+ endif()
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${LYX_DEPENDENCIES_DIR}/download/${it}
WORKING_DIRECTORY ${LYX_DEPENDENCIES_DIR})
endif()
endforeach()
- set(GNUWIN32_DIR ${LYX_DEPENDENCIES_DIR}/deps20)
endif()
endif()
+if(LYX_ENABLE_CXX11 MATCHES "AUTO")
+ # Set to some meaningful default
+ find_package(CXX11Compiler)
+ if(NOT CXX11COMPILER_FOUND)
+ set(LYX_ENABLE_CXX11 OFF CACHE TYPE STRING FORCE)
+ else()
+ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+ execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(NOT GCC_VERSION VERSION_LESS 4.3)
+ set(LYX_ENABLE_CXX11 ON CACHE TYPE STRING FORCE)
+ else()
+ set(LYX_ENABLE_CXX11 OFF CACHE TYPE STRING FORCE)
+ endif()
+ else()
+ # Not a gnu compiler
+ if(CMAKE_CXX_COMPILER_ID MATCHES "^[cC]lang$")
+ set(LYX_ENABLE_CXX11 ON CACHE TYPE STRING FORCE)
+ else()
+ set(LYX_ENABLE_CXX11 OFF CACHE TYPE STRING FORCE)
+ endif()
+ endif()
+ endif()
+endif()
+set(LYX_GCC11_MODE)
if(UNIX OR MINGW)
- execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
+ execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
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)
+ if(GCC_VERSION VERSION_LESS 4.9)
+ # <regex> in gcc is unusable in versions less than 4.9.0
+ # see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53631
+ set(LYX_USE_STD_REGEX 0)
+ else()
+ if (LYX_ENABLE_CXX11)
+ set(LYX_USE_STD_REGEX 1)
+ endif()
endif()
-else()
- if(MSVC10)
- set(LYX_USE_TR1 1)
- #set(LYX_USE_TR1_REGEX 1) #TODO should we use it in ECMAScript mode?
+ if (LYX_ENABLE_CXX11)
+ find_package(CXX11Compiler)
+ if(NOT CXX11COMPILER_FOUND)
+ message(FATAL_ERROR "A C++11 compatible compiler is required.")
+ endif()
+ set(LYX_GCC11_MODE "${CXX11_FLAG}")
endif()
+else()
+ set(LYX_USE_STD_REGEX 0)
+# if(MSVC10)
+# set(LYX_USE_STD_REGEX 1) #TODO should we use it in ECMAScript mode?
+# endif()
endif()
file(STRINGS "${TOP_SRC_DIR}/configure.ac" _config_lines)
if(WIN32)
+ set(CMAKE_PREFIX_PATH Specify-path-to-Qt CACHE PATH "Used Qt version")
+ if(MSVC)
+ set(LYX_3RDPARTY_BUILD ON CACHE BOOL "Build 3rdparty libraries" FORCE)
+ endif()
set(USE_WINDOWS_PACKAGING ON)
elseif(APPLE)
set(USE_MACOSX_PACKAGING ON)
set(USE_POSIX_PACKAGING ON)
endif()
-macro(setstripped _varname _value)
- string(STRIP ${_value} _v)
- if(USE_POSIX_PACKAGING)
- string(TOLOWER ${_v} ${_varname})
+macro(setstripped _varname)
+ if(${ARGC} GREATER 1)
+ string(STRIP "${ARGV1}" _v)
+ if(USE_POSIX_PACKAGING)
+ string(TOLOWER ${_v} ${_varname})
+ else()
+ set(${_varname} ${_v})
+ endif()
else()
- set(${_varname} ${_v})
+ set(${_varname})
endif()
endmacro(setstripped)
endif()
endforeach(_c_l)
-# Find the revision number and for later use
-FIND_PROGRAM(LYX_SVNVERSION svnversion)
-#message(STATUS "svnversion = ${LYX_SVNVERSION}")
-if(LYX_SVNVERSION)
- EXECUTE_PROCESS(COMMAND ${LYX_SVNVERSION} WORKING_DIRECTORY "${TOP_SRC_DIR}" OUTPUT_VARIABLE LYX_PACKAGE_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE)
- # We use this value also to set the package-patch-value
- if(LYX_PACKAGE_RELEASE MATCHES "^\([0-9]+\)")
- set(LYX_REVISION_VERSION ${CMAKE_MATCH_1})
- endif()
-else()
- set(LYX_REVISION_VERSION svn) #TODO use date
+FIND_PROGRAM(LYX_GITVERSION git)
+#message(STATUS "gitversion = ${LYX_GITVERSION}")
+set(LYX_REVISION_VERSION ${LYX_PATCH_VERSION})
+if(LYX_GITVERSION)
+ if (LYX_LOCALVERSIONING)
+ # Find the revision number and for later use
+ EXECUTE_PROCESS(COMMAND ${LYX_GITVERSION} describe --match 2.0.0 HEAD
+ WORKING_DIRECTORY "${TOP_SRC_DIR}" OUTPUT_VARIABLE LYX_PACKAGE_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if (LYX_PACKAGE_RELEASE MATCHES "^2\\.0\\.0\\-\([0-9]+\)\\-.*$")
+ # We will add offset of 40000 to get appropriate value to
+ # previous svn.
+ # We use this value than also to set the package-patch-value
+ MATH(EXPR tmp_REVISION_VERSION "(${CMAKE_MATCH_1}+40000)")
+ set(LYX_REVISION_VERSION "${LYX_PATCH_VERSION}-${tmp_REVISION_VERSION}git")
+ set(ENABLE_DIST ON)
+ endif()
+ endif()
endif()
-
-if(LYX_PROGRAM_SUFFIX)
+# Set the programs (lyx, tex2lyx, etc.) suffix
+# When building an OS X bundle, we will append
+# the suffix only to the bundle, not to the programs
+set(PROGRAM_SUFFIX "")
+if(LYX_PROGRAM_SUFFIX AND NOT (APPLE AND LYX_BUNDLE))
set(PROGRAM_SUFFIX "${LYX_INSTALL_SUFFIX}")
-else()
- set(PROGRAM_SUFFIX "")
endif()
+set(_lyx "${PACKAGE_BASE}${PROGRAM_SUFFIX}")
+set(_tex2lyx tex2lyx${PROGRAM_SUFFIX})
+
+add_custom_target(lyx_version ALL
+ COMMAND ${CMAKE_COMMAND} -DTOP_SRC_DIR=${TOP_SRC_DIR} -DTOP_CMAKE_PATH=${TOP_CMAKE_PATH} -DTOP_BINARY_DIR=${TOP_BINARY_DIR} -DLYX_DATE=${LYX_DATE} -P ${TOP_SCRIPT_PATH}/LyXGetVersion.cmake
+ )
+set_target_properties(lyx_version PROPERTIES FOLDER "applications")
+# Default paths for installed utilities (tex2lyx, lyxclient, etc.)
+set(LYX_UTILITIES_INSTALL_PATH bin)
if(LYX_BUNDLE)
set(LYX_CPACK ON)
+
message(STATUS)
message(STATUS "Bundle creation is enabled (experimental):")
message(STATUS " make")
message(STATUS " make install/strip")
message(STATUS " make package")
if(APPLE)
+ set(MACOSX_BUNDLE TRUE)
+ # This sets the bundle + executable names
+ set(_lyx "${PACKAGE_BASE}${LYX_INSTALL_SUFFIX}")
+ # This sets the Info.plist executable name
+ set(osx_bundle_program_name ${_lyx})
+ # Bundle name
+ set(LYX_BUNDLE_NAME ${_lyx})
+
+ # This will contain the list of files that need to be included
+ # in the bundle and their location within the bundle
+ set(OSX_BUNDLE_FILES "${TOP_SRC_DIR}/development/MacOSX/LyX.sdef;${TOP_SRC_DIR}/development/MacOSX/LyXapp.icns;${CMAKE_BINARY_DIR}/lyxrc.dist")
+ set(OSX_BUNDLE_DIRS "Resources;Resources;Resources")
+
+ # Process Info.plist and lyxrc.dist
+ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/development/MacOSX/Info.plist.in" "${CMAKE_CURRENT_BINARY_DIR}/Info.plist")
+ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/development/MacOSX/lyxrc.dist.in" "${CMAKE_CURRENT_BINARY_DIR}/lyxrc.dist")
+
set(LYX_BUILD_BUNDLE MACOSX_BUNDLE)
- set(LYX_DATA_SUBDIR ${PACKAGE_BASE}${PROGRAM_SUFFIX}.app/Contents/Resources/ CACHE STRING "Bundle Contents dir" FORCE)
- set(MACOSX_BUNDLE_STARTUP_COMMAND ${PACKAGE_BASE}${PROGRAM_SUFFIX}.app)
+ set(LYX_DATA_SUBDIR ${LYX_BUNDLE_NAME}.app/Contents/Resources/ CACHE STRING "Bundle Contents dir" FORCE)
+
+ # Variables used by CPack
+ set(CPACK_BUNDLE_NAME ${LYX_BUNDLE_NAME})
+ set(CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_BINARY_DIR}/Info.plist")
+ set(MACOSX_BUNDLE_STARTUP_COMMAND ${LYX_BUNDLE_NAME}.app)
+
+ # Set the install paths
+ set(LYX_UTILITIES_INSTALL_PATH ${LYX_BUNDLE_NAME}.app/Contents/MacOS)
if(NOT LYX_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/LyX CACHE PATH "Mac bundle dir" FORCE)
set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
endif()
+ # Change the owner so that the install can work
+ install(CODE "set(BU_CHMOD_BUNDLE_ITEMS 1)" COMPONENT Runtime)
elseif(UNIX)
message(STATUS "To embed Qt in this bundle don't build with your system Qt:")
message(STATUS " - fix PATH so a other qmake is found by cmake")
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)
set(CMAKE_INSTALL_PREFIX "/usr/local/${LYX_PROJECT}" CACHE PATH "LyX default install prefix" FORCE)
endif()
endif()
- if(WIN32)
- set(CMAKE_INSTALL_PREFIX LYX_INSTALLED CACHE PATH "LyX default install prefix" FORCE)
- endif()
+endif()
+if(WIN32)
+ set(CMAKE_INSTALL_PREFIX LYX_INSTALLED CACHE PATH "LyX default install prefix" FORCE)
endif()
if(IS_ABSOLUTE)
set(CMAKE_INSTALL_PREFIX_ABSOLUTE ${CMAKE_INSTALL_PREFIX})
set(LYX_ABS_INSTALLED_LOCALEDIR "${LYX_ABS_INSTALLED_DATADIR}/${LYX_DATA_SUBDIR}${LYX_LOCALEDIR}")
set(LYX_ABS_TOP_SRCDIR "${TOP_SRC_DIR}")
+if(LYX_BUNDLE AND APPLE)
+ set(LYX_MAN_DIR "${LYX_DATA_SUBDIR}" CACHE STRING "Install location for man pages.")
+else()
+ if(WIN32)
+ set(LYX_MAN_DIR "${CMAKE_BINARY_DIR}/usr/local/man/man1" CACHE STRING "Install location for man pages.")
+ else()
+ set(LYX_MAN_DIR "/usr/local/man/man1" CACHE STRING "Install location for man pages.")
+ endif()
+endif()
+mark_as_advanced(LYX_MAN_DIR)
if(LYX_INSTALL AND WIN32)
message(STATUS "Configuring NSIS files")
endif()
# lyx's source files
-set(LYX_CPP_FILES *.cpp)
-set(LYX_HPP_FILES *.h)
+set(LYX_CPP_FILES [a-zA-Z]*.cpp)
+set(LYX_HPP_FILES [a-zA-Z]*.h)
set(LYX_MOC_FILES moc_*.cpp)
include(ProjectSourceGroup)
-if(LYX_PROFILE)
+if(LYX_PROFILE AND NOT MSVC)
set(CMAKE_BUILD_TYPE Profile CACHE TYPE STRING FORCE)
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg" CACHE TYPE STRING FORCE)
+ set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE} -pg")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
+else()
+ set(LYX_PROFILE OFF)
endif()
set(CMAKE_BUILD_TYPE None)
set(LYX_DEBUG OFF)
set(LYX_RELEASE OFF)
+ set(LYX_PROFILE OFF)
elseif(LYX_RELEASE)
set(CMAKE_BUILD_TYPE Release)
set(LYX_DEBUG OFF)
+ set(LYX_PROFILE OFF)
+elseif(LYX_PROFILE)
+ set(CMAKE_BUILD_TYPE Profile)
+ set(LYX_DEBUG OFF)
else()
set(CMAKE_BUILD_TYPE Debug)
set(LYX_DEBUG ON)
if(LYX_SHARED_LIBRARIES)
set(library_type SHARED)
else()
- set(library_type STATIC)
+ set(library_type STATIC)
endif()
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()
- if(LYX_CONCEPT_CHECKS)
- set(LYX_CXX_FLAGS "${LYX_CXX_FLAGS} -D_GLIBCPP_CONCEPT_CHECKS")
- endif()
set(CMAKE_CXX_FLAGS "${LYX_CXX_FLAGS} -fno-strict-aliasing " CACHE TYPE STRING FORCE)
- set(CMAKE_CXX_FLAGS_DEBUG "${LYX_CXX_FLAGS} -fno-strict-aliasing -O0 -g -D_DEBUG" CACHE TYPE STRING FORCE)
+ set(CMAKE_CXX_FLAGS_DEBUG "${LYX_CXX_FLAGS} -fno-strict-aliasing -O0 -g3 -D_DEBUG" CACHE TYPE STRING FORCE)
if(MINGW)
set(CMAKE_CXX_FLAGS_RELEASE "${LYX_CXX_FLAGS} -O2 -DNDEBUG" CACHE TYPE STRING FORCE)
else()
set(CMAKE_CXX_FLAGS_RELEASE "${LYX_CXX_FLAGS} -O3 -DNDEBUG" CACHE TYPE STRING FORCE)
endif()
- set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE} -pg" CACHE TYPE STRING FORCE)
endif()
+set(LYX_CXX_FLAGS_EXTRA "" CACHE STRING "Desired semicolon separated list of extra cxx compile flags, like '-Werror'")
+mark_as_advanced(LYX_CXX_FLAGS_EXTRA)
+if(LYX_CXX_FLAGS_EXTRA)
+ foreach(_flag ${LYX_CXX_FLAGS_EXTRA})
+ add_definitions(${_flag})
+ endforeach()
+endif()
-find_package(Qt4 REQUIRED)
+if(LYX_XMINGW)
+ list(APPEND CMAKE_FIND_ROOT_PATH ${GNUWIN32_DIR})
+endif()
+set(QPA_XCB)
+if(LYX_USE_QT MATCHES "QT5")
+ # set QPA_XCB if QT uses X11
+ find_package(Qt5Core REQUIRED)
+ if (Qt5Core_FOUND)
+ find_package(Qt5Widgets REQUIRED)
+ if(APPLE)
+ find_package(Qt5MacExtras REQUIRED)
+ endif()
+ find_package(Qt5X11Extras QUIET)
+ if(Qt5X11Extras_FOUND)
+ set(QPA_XCB 1)
+ endif()
+ find_package(Qt5WinExtras QUIET)
+ set(QTVERSION ${Qt5Core_VERSION})
+ macro (qt_use_modules)
+ qt5_use_modules(${ARGN})
+ endmacro()
+ macro (qt_add_resources)
+ qt5_add_resources(${ARGN})
+ endmacro()
+ macro (qt_wrap_uifiles)
+ qt5_wrap_ui(${ARGN})
+ endmacro()
+ message(STATUS "Found Qt-Version ${QTVERSION}")
+ if(WIN32)
+ set(LYX_QTMAIN_LIBRARY ${Qt5Core_QTMAIN_LIBRARIES})
+ endif()
+ endif()
+elseif(LYX_USE_QT MATCHES "QT4")
+ 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()
+ find_package(Qt4 "4.5.0" REQUIRED)
+ macro (qt_use_modules)
+ endmacro()
+ macro (qt_add_resources)
+ qt4_add_resources(${ARGN})
+ endmacro()
+ macro (qt_wrap_uifiles)
+ qt4_wrap_ui(${ARGN})
+ endmacro()
+ if(WIN32)
+ set(LYX_QTMAIN_LIBRARY ${QT_QTMAIN_LIBRARIES})
+ endif()
+else()
+ message(FATAL_ERROR "Unhandled value for LYX_USE_QT (${LYX_USE_QT})")
+endif()
+
+find_package(Magic)
+if(Magic_FOUND)
+ set(HAVE_MAGIC_H 1)
+endif()
include_directories(${TOP_BINARY_DIR} ${TOP_SRC_DIR}/src)
-if(LYX_ASPELL)
- find_package(ASPELL)
- include_directories(${ASPELL_INCLUDE_DIR})
-endif()
+set(Spelling_FOUND OFF)
+set(Include_used_spellchecker) # String will be inserted into config.h
-if(LYX_ENCHANT)
- find_package(Enchant REQUIRED)
- include_directories(${ENCHANT_INCLUDE_DIR})
+if(LYX_3RDPARTY_BUILD)
+ add_subdirectory(3rdparty/hunspell)
+ add_definitions(-DHUNSPELL_STATIC)
+ set(HUNSPELL_FOUND ON)
+ message(STATUS " * Hunspell:")
+ message(STATUS " - include: ${HUNSPELL_INCLUDE_DIR}")
+ message(STATUS " - library: ${HUNSPELL_LIBRARY}")
endif()
-if(LYX_HUNSPELL)
- find_package(Hunspell REQUIRED)
- include_directories(${HUNSPELL_INCLUDE_DIR})
+foreach(_spell "ASPELL" "Enchant" "Hunspell")
+ string(TOUPPER ${_spell} _upspell)
+ if (NOT ${_upspell}_FOUND)
+ find_package(${_spell})
+ endif()
+ 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(GNUWIN32_DIR)
+ list(APPEND CMAKE_PROGRAM_PATH "${GNUWIN32_DIR}/Python" )
endif()
-if(LYX_NLS)
- FIND_PROGRAM(LYX_PYTHON_EXECUTABLE python HINTS ${GNUWIN32_DIR}/python)
- if(${LYX_PYTHON_EXECUTABLE} MATCHES "-NOTFOUND")
- message(FATAL_ERROR "Python 2.6 needed!")
+find_package(PythonInterp 2.7 QUIET)
+if(PYTHONINTERP_FOUND)
+ if(PYTHON_VERSION_STRING VERSION_GREATER 2.8)
+ unset(PYTHONINTERP_FOUND)
endif()
- find_package(LyXGettext REQUIRED)
- include_directories(${TOP_SRC_DIR}/po)
- add_subdirectory(po "${TOP_BINARY_DIR}/po")
endif()
+if(NOT PYTHONINTERP_FOUND)
+ unset(PYTHON_EXECUTABLE CACHE)
+ unset(PYTHON_VERSION_MAJOR)
+ unset(PYTHON_VERSION_MINOR)
+ unset(PYTHON_VERSION_STRING)
+ find_package(PythonInterp 3.3 REQUIRED)
+endif()
+
+set(LYX_PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "Python to be used by LyX")
+
if(LYX_NLS)
- if(LYX_EXTERNAL_LIBINTL)
- find_package(Libintl REQUIRED)
- if(DEFINED LIBINTL_LIBRARIES)
- # find getext when configuring
- list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBINTL_LIBRARIES})
- # on mac use iconv also form ports
- get_filename_component(ICONV_RELATIVE_TO_LIBINTL ${LIBINTL_LIBRARIES} PATH)
- endif()
+ find_package(LyXGettext)
+ if(LYX_PYTHON_EXECUTABLE AND GETTEXT_FOUND)
+ add_subdirectory(po "${TOP_BINARY_DIR}/po")
else()
- add_subdirectory(intl "${TOP_BINARY_DIR}/intl")
+ # Install only supplied .gmo-files
+ file(GLOB _gmofiles RELATIVE "${TOP_SRC_DIR}/po" "${TOP_SRC_DIR}/po/*.gmo")
+ message(STATUS "Installing provided .gmo-files only")
+ foreach( _gmo ${_gmofiles})
+ string(REGEX REPLACE "\\.gmo$" "" _lang ${_gmo})
+ install(FILES "${TOP_SRC_DIR}/po/${_gmo}" DESTINATION ${LYX_DATA_SUBDIR}${LYX_LOCALEDIR}/${_lang}/LC_MESSAGES RENAME ${PACKAGE}.mo)
+ endforeach()
endif()
endif()
-find_package(ICONV REQUIRED)
-find_package(ZLIB REQUIRED)
+if(UNIX)
+ find_package(ICONV REQUIRED)
+ find_package(ZLIB REQUIRED)
+else()
+ if(LYX_3RDPARTY_BUILD)
+ add_subdirectory(3rdparty/libiconv)
+ set(HAVE_ICONV_CONST 1)
+ add_subdirectory(3rdparty/zlib)
+ endif()
+endif()
if(LYX_EXTERNAL_BOOST)
message(STATUS "Searching for boost")
- find_package(Boost COMPONENTS signals regex) #TODO could REQUIRED be used
+ if(LYX_USE_STD_REGEX)
+ find_package(Boost COMPONENTS signals)
+ else()
+ find_package(Boost COMPONENTS signals regex)
+ endif()
if(Boost_FOUND)
message(STATUS "Boost found")
message(STATUS "Boost-libs = ${Boost_LIBRARIES}")
set(Lyx_Boost_Libraries ${Boost_LIBRARIES})
+ if (LYX_STDLIB_DEBUG)
+ # Comment from Jean-Marc Lasgouttes:
+ # In general, system boost libraries are incompatible with
+ # the use of stdlib-debug in libstdc++. See ticket #9736 for
+ # details.
+ message(WARNING "Compiling LyX with stdlib-debug and system boost libraries may lead to crashes. Consider using '-DLYX_STDLIB_DEBUG=OFF' or using '-DLYX_EXTERNAL_BOOST=OFF'")
+ endif()
else()
message(FATAL_ERROR "Boost not found" ${Boost_ERROR_REASON})
endif()
else()
- if(LYX_USE_TR1_REGEX)
+ if(LYX_USE_STD_REGEX)
set(Lyx_Boost_Libraries boost_signals)
else()
set(Lyx_Boost_Libraries boost_signals boost_regex)
endif()
add_definitions(-DBOOST_USER_CONFIG="<config.h>")
- include_directories(${TOP_SRC_DIR}/boost)
- add_subdirectory(boost "${TOP_BINARY_DIR}/boost")
+ add_definitions(-DBOOST_SIGNALS_NO_DEPRECATION_WARNING=1)
+ include_directories(${TOP_SRC_DIR}/3rdparty/boost)
+ add_subdirectory(3rdparty/boost "${TOP_BINARY_DIR}/3rdparty/boost")
endif()
if(WIN32)
- if(NOT LYX_CONSOLE)
+ if(LYX_CONSOLE)
+ set(LYX_QTMAIN_LIBRARY)
+ else()
set(WIN32_CONSOLE WIN32)
- set(LYX_QTMAIN_LIBRARY ${QT_QTMAIN_LIBRARY})
endif()
if(MSVC)
- add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DNOMINMAX)
+ # -DPSAPI_VERSION=1 is needed to run on vista (bug 10186)
+ add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DNOMINMAX -DPSAPI_VERSION=1)
# disable checked iterators for msvc release builds to get maximum speed
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /D_SECURE_SCL=0")
else()
+ # -DPSAPI_VERSION=1 is not needed for mingw, since the mingw psapi.h
+ # does not use it and always declares the vista compatible API.
+ # If this ever changes then -DPSAPI_VERSION might be needed here as well.
add_definitions(-DWINVER=0x0500)
endif()
endif()
+# Compute qt4-version from ${QTVERSION}
+
message(STATUS "")
foreach(_v PACKAGE PACKAGE_VERSION
PROGRAM_SUFFIX LYX_DATE LYX_DIR_VER LYX_USERDIR_VER
# PCHs not supported by cmake: http://www.cmake.org/Bug/view.php?id=1260
# Not sure if it works for all non-msvc compilers
include(PCHSupport_26)
- configure_file(${TOP_SRC_DIR}/${LYX_CMAKE_DIR}/pcheaders.h ${TOP_BINARY_DIR}/pcheaders.h)
- configure_file(${TOP_SRC_DIR}/${LYX_CMAKE_DIR}/config.cpp.cmake ${TOP_BINARY_DIR}/config_pch.cpp)
+ configure_file(${TOP_CMAKE_PATH}/pcheaders.h ${TOP_BINARY_DIR}/pcheaders.h)
+ configure_file(${TOP_CMAKE_PATH}/config.cpp.cmake ${TOP_BINARY_DIR}/config_pch.cpp)
add_definitions(-DLYX_ENABLE_PCH)
if(MSVC)
COMPILE_FLAGS "/Ycconfig.h /Fp\$(IntDir)/config.pch")
set(${name_}_sources ${${name_}_sources} ${TOP_BINARY_DIR}/config_pch.cpp
${TOP_BINARY_DIR}/pcheaders.h)
- set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /DLYX_PCH_STL /DLYX_PCH_BOOST /DLYX_PCH_QT4")
- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /DLYX_PCH_STL /DLYX_PCH_BOOST /DLYX_PCH_QT4")
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /DLYX_PCH_STL /DLYX_PCH_BOOST /DLYX_PCH_QT")
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /DLYX_PCH_STL /DLYX_PCH_BOOST /DLYX_PCH_QT")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /DLYX_PCH_STL /DLYX_PCH_BOOST")
endmacro(lyx_add_msvc_pch)
macro(lyx_add_gcc_pch name_)
macro(lyx_add_msvc_pch name_)
endmacro()
macro(lyx_add_gcc_pch name_)
- add_definitions(-DLYX_PCH_STL -DLYX_PCH_BOOST -DLYX_PCH_QT4)
+ add_definitions(-DLYX_PCH_STL -DLYX_PCH_BOOST -DLYX_PCH_QT)
ADD_PRECOMPILED_HEADER(${name_} ${TOP_BINARY_DIR}/config_pch.cpp ${TOP_BINARY_DIR}/config.h.gch)
endmacro()
endif()
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${MSVC_W_ERROR} ${MSVC_W_DISABLE}")
endif()
- set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Zc:wchar_t-")
- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zc:wchar_t-")
- set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /Zc:wchar_t-")
+
+ if (NOT Qt5Core_FOUND)
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Zc:wchar_t-")
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zc:wchar_t-")
+ set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /Zc:wchar_t-")
+ endif()
message(STATUS "----- Warning level : ${CMAKE_CXX_WARNING_LEVEL} ${WARNING_LEVEL_MESSAGE}")
message(STATUS "----- Warnings as errors : ${MSVC_W_ERROR}")
set(_GLIBCXX_DEBUG_PEDANTIC ON)
endif()
+# Xcode compiler
+if (CMAKE_GENERATOR MATCHES Xcode)
+ if (XCODE_VERSION VERSION_LESS "5.0")
+ # Automatically select the Xcode compiler if not set
+ if (NOT DEFINED CMAKE_XCODE_ATTRIBUTE_GCC_VERSION)
+ # XCode >= 3.1 has gcc 4.2 (up to actual Xcode)
+ if (XCODE_VERSION VERSION_GREATER "3.1")
+ SET(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvmgcc42")
+ ENDIF(XCODE_VERSION VERSION_GREATER "3.1")
+ ENDIF(NOT DEFINED CMAKE_XCODE_ATTRIBUTE_GCC_VERSION)
+ # Print the selected compiler version
+ MESSAGE(STATUS "---- Using XCode compiler CMAKE_XCODE_ATTRIBUTE_GCC_VERSION=${CMAKE_XCODE_ATTRIBUTE_GCC_VERSION}")
+ ENDIF(XCODE_VERSION VERSION_LESS "5.0")
+ENDIF(CMAKE_GENERATOR MATCHES Xcode)
+
+if (WIN32 AND Qt5Core_FOUND)
+ set(Z_PREFIX 1)
+endif()
+
# compiler tests, config.h generation
if(MSVC AND NOT LYX_CONFIGURE_CHECKS)
configure_file(${LYX_CMAKE_DIR}/configCompiler.h.msvc ${TOP_BINARY_DIR}/configCompiler.h)
configure_file(${LYX_CMAKE_DIR}/config.h.cmake ${TOP_BINARY_DIR}/config.h)
-# Compute qt4-version from ${QTVERSION}
if(QTVERSION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+).*")
- MATH(EXPR QT4_VERSIONNUM "${CMAKE_MATCH_1}*10000+${CMAKE_MATCH_2}*100+${CMAKE_MATCH_3}")
- set(QT4_VERSION "0x${QT4_VERSIONNUM}")
+ MATH(EXPR QT4_VERSION "(${CMAKE_MATCH_1}<<16)|(${CMAKE_MATCH_2}<<8)|${CMAKE_MATCH_3}")
endif()
-add_subdirectory(src "${TOP_BINARY_DIR}/src")
-add_subdirectory(lib/lyx2lyx "${TOP_BINARY_DIR}/lyx2lyx")
-add_subdirectory(lib/scripts "${TOP_BINARY_DIR}/scripts")
+if (NOT HAVE_REGEX)
+ set(LYX_USE_STD_REGEX 0)
+endif()
+set (cmd ${CMAKE_CTEST_COMMAND})
+if (MSVC)
+ set (cmd ${cmd} -C ${CMAKE_CFG_INTDIR})
+else ()
+ set (cmd ${cmd} -C ${CMAKE_BUILD_TYPE})
+endif ()
+add_custom_target (lyx_run_tests COMMAND ${cmd})
+set_target_properties(lyx_run_tests PROPERTIES FOLDER "tests")
+
+if(LYX_ASAN)
+ set(LYX_CXX_FLAGS "-fsanitize=address -fno-omit-frame-pointer -g")
+ message(STATUS)
+ message(STATUS "Address sanitizer enabled. Usage:")
+ message(STATUS " wget https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/asan/scripts/asan_symbolize.py")
+ message(STATUS " chmod +x ./asan_symbolize.py")
+ message(STATUS " ./bin/lyx2.2 2>&1 | ./asan_symbolize.py | c++filt ")
+ message(STATUS)
+endif()
+
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)
endif()
+add_subdirectory(src "${TOP_BINARY_DIR}/src")
+add_subdirectory(lib/lyx2lyx "${TOP_BINARY_DIR}/lyx2lyx")
+add_subdirectory(lib/scripts "${TOP_BINARY_DIR}/scripts")
+add_subdirectory(lib/examples "${TOP_BINARY_DIR}/lib/examples")
add_subdirectory(sourcedoc "${TOP_BINARY_DIR}/sourcedoc")
+add_subdirectory(development/autotests "${TOP_BINARY_DIR}/autotests")
+if(LYX_ENABLE_URLTESTS)
+ add_subdirectory(development/checkurls "${TOP_BINARY_DIR}/checkurls")
+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)
message(STATUS)
message(STATUS "Building Native Language Support (LYX_NLS is set), used libraries:")
message(STATUS)
- message(STATUS " * intl")
- message(STATUS " - header : ${LIBINTL_HEADER}")
- message(STATUS " - library: ${LIBINTL_LIBRARIES}")
message(STATUS " * iconv")
- message(STATUS " - header : ${ICONV_HEADER}")
+ message(STATUS " - include: ${ICONV_INCLUDE_DIR}")
message(STATUS " - library: ${ICONV_LIBRARY}")
message(STATUS " * zlib")
- message(STATUS " - header : ${ZLIB_HEADER}")
+ message(STATUS " - include: ${ZLIB_INCLUDE_DIR}")
message(STATUS " - library: ${ZLIB_LIBRARY}")
message(STATUS)
endif()
-include("${TOP_SRC_DIR}/${LYX_CMAKE_DIR}/LyxPackaging.cmake")
+# 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")
+endif()
+
+include("${TOP_CMAKE_PATH}/LyxPackaging.cmake")
+
+if(ENABLE_DIST)
+ # Use git to create the source package
+ # git archive --format=tgz --output=/home/kornel/x.tar.gz master
+ if(UNIX)
+ set(DIST_FORMAT tgz)
+ else()
+ set(DIST_FORMAT zip)
+ endif()
+ set(DIST_NAME ${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-${CMAKE_SYSTEM_NAME}.${DIST_FORMAT})
+
+ add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${DIST_NAME}
+ COMMAND ${LYX_GITVERSION} archive --format=${DIST_FORMAT} --output=${CMAKE_CURRENT_BINARY_DIR}/${DIST_NAME} master
+ WORKING_DIRECTORY ${TOP_SRC_DIR})
+ add_custom_target(git-archive DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${DIST_NAME})
+endif()
+
+# Last directory to be included so that the fixup code (OS X)
+# can be run last
+add_subdirectory(development/cmake/post_install)
message(STATUS)