2010-01-30 11:34:28 +00:00
|
|
|
|
2006-09-15 17:05:20 +00:00
|
|
|
# This file is part of LyX, the document processor.
|
|
|
|
# Licence details can be found in the file COPYING.
|
|
|
|
#
|
2011-01-10 23:24:00 +00:00
|
|
|
# Copyright (c) 2006-2011 Peter Kümmel, <syntheticpp@gmx.net>
|
|
|
|
# Copyright (c) 2008-2011 Kornel Benko, <Kornel.Benko@berlin.de>
|
2010-05-26 09:49:06 +00:00
|
|
|
|
2006-09-15 17:05:20 +00:00
|
|
|
|
2010-07-06 19:47:16 +00:00
|
|
|
cmake_minimum_required(VERSION 2.6.4)
|
2006-11-24 15:10:16 +00:00
|
|
|
|
2008-05-24 21:22:36 +00:00
|
|
|
if(COMMAND cmake_policy)
|
|
|
|
cmake_policy(SET CMP0003 OLD)
|
2010-09-02 06:59:58 +00:00
|
|
|
cmake_policy(SET CMP0005 OLD)
|
2010-07-10 20:20:54 +00:00
|
|
|
endif()
|
2008-05-24 21:22:36 +00:00
|
|
|
|
2011-05-24 18:36:27 +00:00
|
|
|
#needed to distinguish fron trunk, so we can install both simultaneously
|
|
|
|
set(LYX_PROJECT lyx20)
|
2010-07-10 20:20:54 +00:00
|
|
|
project(${LYX_PROJECT})
|
2007-12-02 10:29:25 +00:00
|
|
|
|
2009-12-03 21:58:44 +00:00
|
|
|
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
|
2009-11-07 11:19:57 +00:00
|
|
|
|
2011-01-10 22:49:12 +00:00
|
|
|
# Supress regeneration
|
|
|
|
set(CMAKE_SUPPRESS_REGENERATION FALSE)
|
|
|
|
|
2010-07-06 19:47:16 +00:00
|
|
|
# where to look first for cmake modules,
|
|
|
|
# before ${CMAKE_ROOT}/Modules is checked
|
2006-06-11 11:57:25 +00:00
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
|
2011-05-24 19:18:12 +00:00
|
|
|
|
|
|
|
if(UNIX)
|
|
|
|
FIND_PROGRAM(DPKG_ARCHITECTURE_EXECUTABLE dpkg-architecture)
|
|
|
|
if(DPKG_ARCHITECTURE_EXECUTABLE)
|
|
|
|
EXECUTE_PROCESS(COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH OUTPUT_VARIABLE ARCH_TRIPLET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if(ARCH_TRIPLET)
|
|
|
|
set(SYSTEM_LIB_DIRS /usr/lib /usr/lib/${ARCH_TRIPLET} /usr/local/lib)
|
|
|
|
else()
|
|
|
|
set(SYSTEM_LIB_DIRS /usr/lib /usr/local/lib)
|
|
|
|
endif()
|
|
|
|
|
2010-07-06 19:47:16 +00:00
|
|
|
include(LyXMacros)
|
|
|
|
|
2010-07-07 22:26:36 +00:00
|
|
|
|
|
|
|
# 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, ...
|
2011-01-22 09:27:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
LYX_OPTION_INIT()
|
2010-07-18 21:01:44 +00:00
|
|
|
|
2011-01-22 11:48:39 +00:00
|
|
|
# Options for all compilers/systems
|
2010-07-18 20:47:59 +00:00
|
|
|
LYX_OPTION(CPACK "Use the CPack management (Implies LYX_INSTALL option)" OFF ALL)
|
2010-07-18 21:01:44 +00:00
|
|
|
LYX_OPTION(INSTALL "Build install projects/rules (implies a bunch of other options)" OFF ALL)
|
2010-07-07 22:26:36 +00:00
|
|
|
LYX_OPTION(NLS "Use nls" OFF ALL)
|
|
|
|
LYX_OPTION(ASPELL "Require aspell" OFF ALL)
|
2010-07-17 22:24:08 +00:00
|
|
|
LYX_OPTION(ENCHANT "Require Enchant" OFF ALL)
|
2010-07-18 06:47:01 +00:00
|
|
|
LYX_OPTION(HUNSPELL "Require Hunspell" OFF ALL)
|
2010-12-19 22:54:45 +00:00
|
|
|
LYX_OPTION(DEVEL_VERSION "Build developer version" OFF ALL)
|
2011-01-22 10:53:54 +00:00
|
|
|
LYX_OPTION(RELEASE "Build release version, build debug when disabled" ON ALL)
|
2010-07-14 11:58:21 +00:00
|
|
|
LYX_OPTION(PACKAGE_SUFFIX "Use version suffix for packaging" ON ALL)
|
2011-01-22 10:53:54 +00:00
|
|
|
LYX_OPTION(PCH "Use precompiled headers" OFF ALL)
|
2010-07-07 22:26:36 +00:00
|
|
|
LYX_OPTION(MERGE_FILES "Merge source files into one compilation unit" OFF ALL)
|
2010-12-07 00:13:16 +00:00
|
|
|
LYX_OPTION(MERGE_REBUILD "Rebuild generated files from merged files build" OFF ALL)
|
2011-01-22 11:35:50 +00:00
|
|
|
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)
|
2010-07-07 22:26:36 +00:00
|
|
|
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)
|
2011-01-22 11:35:50 +00:00
|
|
|
|
|
|
|
# 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)
|
2011-01-30 10:23:29 +00:00
|
|
|
LYX_OPTION(CONFIGURE_CHECKS "Also run configure checks for MSVC" OFF MSVC)
|
2011-02-15 09:46:14 +00:00
|
|
|
LYX_OPTION(DEPENDENCIES_DOWNLOAD "Download dependencies for MSVC 10" OFF MSVC)
|
2010-07-07 22:26:36 +00:00
|
|
|
|
2011-01-22 11:48:39 +00:00
|
|
|
# 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)
|
|
|
|
else()
|
|
|
|
set(LYX_MERGE_REBUILD OFF)
|
|
|
|
endif()
|
|
|
|
|
2011-02-14 22:04:58 +00:00
|
|
|
if(LYX_DEPENDENCIES_DOWNLOAD)
|
2011-01-30 10:23:29 +00:00
|
|
|
message(STATUS)
|
2011-02-14 22:04:58 +00:00
|
|
|
set(LYX_DEPENDENCIES_DIR ${CMAKE_BINARY_DIR}/msvc2010-deps)
|
|
|
|
message(STATUS "Using downloaded dependencies in ${LYX_DEPENDENCIES_DIR}")
|
2011-12-06 19:50:59 +00:00
|
|
|
set(deps_files lyx20-deps-msvc2010-x86.zip)
|
2011-11-26 10:04:14 +00:00
|
|
|
set(deps_server http://downloads.sourceforge.net/project/lyx/Win_installers/Dependencies)
|
2011-02-14 22:04:58 +00:00
|
|
|
foreach(it ${deps_files})
|
2011-01-30 10:23:29 +00:00
|
|
|
set(already_downloaded already_downloaded-NOTFOUND CACHE PATH "downloaded" FORCE)
|
2011-02-14 22:04:58 +00:00
|
|
|
find_file(already_downloaded ${it} "${LYX_DEPENDENCIES_DIR}/download")
|
2011-01-30 10:23:29 +00:00
|
|
|
if(NOT already_downloaded)
|
|
|
|
message(STATUS "Downloading ${it} ...")
|
2011-11-26 10:04:14 +00:00
|
|
|
file(DOWNLOAD ${deps_server}/${it} ${LYX_DEPENDENCIES_DIR}/download/${it} SHOW_PROGRESS)
|
2011-02-14 22:04:58 +00:00
|
|
|
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${LYX_DEPENDENCIES_DIR}/download/${it}
|
|
|
|
WORKING_DIRECTORY ${LYX_DEPENDENCIES_DIR})
|
2011-01-30 10:23:29 +00:00
|
|
|
endif()
|
|
|
|
endforeach()
|
2011-02-14 22:04:58 +00:00
|
|
|
set(GNUWIN32_DIR ${LYX_DEPENDENCIES_DIR}/deps20)
|
2011-01-30 10:23:29 +00:00
|
|
|
endif()
|
2011-01-22 11:48:39 +00:00
|
|
|
|
|
|
|
|
2010-07-06 19:47:16 +00:00
|
|
|
message(STATUS)
|
|
|
|
|
2007-08-28 17:07:02 +00:00
|
|
|
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
|
2010-01-30 11:34:28 +00:00
|
|
|
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
|
2006-09-21 10:50:27 +00:00
|
|
|
|
2010-07-06 19:47:16 +00:00
|
|
|
|
2009-12-03 21:58:44 +00:00
|
|
|
|
2010-06-30 14:30:10 +00:00
|
|
|
if(UNIX OR MINGW)
|
2010-09-02 06:59:58 +00:00
|
|
|
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()
|
2010-06-30 08:47:41 +00:00
|
|
|
else()
|
2010-09-02 06:59:58 +00:00
|
|
|
if(MSVC10)
|
|
|
|
set(LYX_USE_TR1 1)
|
2011-03-02 21:28:36 +00:00
|
|
|
#set(LYX_USE_TR1_REGEX 1) #TODO should we use it in ECMAScript mode?
|
2010-09-02 06:59:58 +00:00
|
|
|
endif()
|
2010-06-30 08:47:41 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2006-10-19 21:35:44 +00:00
|
|
|
set(VERSION_INFO "CMake Build")
|
2009-01-26 18:42:02 +00:00
|
|
|
|
|
|
|
# Try to get some informations from configure.ac
|
|
|
|
|
2010-09-02 06:59:58 +00:00
|
|
|
include(LyXPaths) #called here to define the needed TOP_SRC_DIR-variable
|
2009-01-26 18:42:02 +00:00
|
|
|
file(STRINGS "${TOP_SRC_DIR}/configure.ac" _config_lines)
|
|
|
|
|
2009-02-10 22:21:39 +00:00
|
|
|
if(WIN32)
|
2010-09-02 06:59:58 +00:00
|
|
|
set(USE_WINDOWS_PACKAGING 1)
|
2009-02-10 22:21:39 +00:00
|
|
|
elseif(APPLE)
|
2010-09-02 06:59:58 +00:00
|
|
|
set(USE_MACOSX_PACKAGING 1)
|
2009-02-10 22:21:39 +00:00
|
|
|
else()
|
2010-09-02 06:59:58 +00:00
|
|
|
set(USE_POSIX_PACKAGING 1)
|
2009-02-10 22:21:39 +00:00
|
|
|
endif()
|
|
|
|
|
2009-01-26 18:42:02 +00:00
|
|
|
macro(setstripped _varname _value)
|
2010-09-02 06:59:58 +00:00
|
|
|
string(STRIP ${_value} _v)
|
|
|
|
if(USE_POSIX_PACKAGING)
|
|
|
|
string(TOLOWER ${_v} ${_varname})
|
|
|
|
else()
|
|
|
|
set(${_varname} ${_v})
|
|
|
|
endif()
|
2009-01-26 18:42:02 +00:00
|
|
|
endmacro(setstripped)
|
|
|
|
|
|
|
|
foreach(_c_l ${_config_lines} )
|
2010-09-02 06:59:58 +00:00
|
|
|
if(_c_l MATCHES "^AC_INIT\\(\([^,]+\),\([^,]+\), *\\[\([^,]+\)\\] *,\(.*\)")
|
|
|
|
setstripped(PACKAGE_BASE ${CMAKE_MATCH_1})
|
|
|
|
setstripped(PACKAGE_VERSION ${CMAKE_MATCH_2})
|
|
|
|
setstripped(PACKAGE_BUGREPORT ${CMAKE_MATCH_3})
|
2012-07-17 09:19:22 +00:00
|
|
|
if(PACKAGE_VERSION MATCHES "^\([0-9]+\)\\.\([0-9]+\)\(\\.\([0-9]+\)\)?.*$")
|
2010-09-02 06:59:58 +00:00
|
|
|
set(LYX_MAJOR_VERSION ${CMAKE_MATCH_1})
|
|
|
|
set(LYX_MINOR_VERSION ${CMAKE_MATCH_2})
|
2012-07-17 09:19:22 +00:00
|
|
|
set(LYX_REVISION_VERSION ${CMAKE_MATCH_4})
|
2010-09-02 06:59:58 +00:00
|
|
|
set(LYX_DIR_VER "LYX_DIR_${CMAKE_MATCH_1}${CMAKE_MATCH_2}x")
|
|
|
|
set(LYX_USERDIR_VER "LYX_USERDIR_${CMAKE_MATCH_1}${CMAKE_MATCH_2}x")
|
|
|
|
set(LYX_INSTALL_SUFFIX "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if(_c_l MATCHES "^AC_SUBST\\( *LYX_DATE *, *\\[\\\"(.*)\\\"\\].*")
|
|
|
|
set(LYX_DATE "${CMAKE_MATCH_1}")
|
|
|
|
endif()
|
2009-01-26 18:42:02 +00:00
|
|
|
endforeach(_c_l)
|
2006-09-21 10:51:50 +00:00
|
|
|
|
2010-07-09 08:39:25 +00:00
|
|
|
|
2010-09-01 14:20:04 +00:00
|
|
|
if (LYX_INSTALL_PREFIX)
|
2011-01-09 00:55:40 +00:00
|
|
|
set(CMAKE_INSTALL_PREFIX ${LYX_INSTALL_PREFIX} CACHE PATH "LyX user's choice install prefix" FORCE)
|
2010-09-01 14:20:04 +00:00
|
|
|
set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
|
|
|
endif()
|
2011-03-14 23:26:28 +00:00
|
|
|
set(LYX_INSTALL_PREFIX ${LYX_INSTALL_PREFIX} CACHE PATH "LyX user's choice install prefix" FORCE)
|
2010-09-01 14:20:04 +00:00
|
|
|
|
2010-07-09 08:39:25 +00:00
|
|
|
if(LYX_PACKAGE_SUFFIX)
|
2010-09-02 06:59:58 +00:00
|
|
|
set(PACKAGE ${PACKAGE_BASE}${LYX_INSTALL_SUFFIX})
|
2010-07-06 19:47:16 +00:00
|
|
|
else()
|
2010-09-02 06:59:58 +00:00
|
|
|
set(PACKAGE ${PACKAGE_BASE})
|
2010-07-09 08:39:25 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(LYX_PROGRAM_SUFFIX)
|
2010-09-02 06:59:58 +00:00
|
|
|
set(PROGRAM_SUFFIX "${LYX_INSTALL_SUFFIX}")
|
2010-07-09 08:39:25 +00:00
|
|
|
else()
|
2010-09-02 06:59:58 +00:00
|
|
|
set(PROGRAM_SUFFIX "")
|
2009-02-08 12:20:31 +00:00
|
|
|
endif()
|
|
|
|
|
2010-06-30 14:30:10 +00:00
|
|
|
|
2009-01-05 19:13:20 +00:00
|
|
|
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
2010-09-02 06:59:58 +00:00
|
|
|
# see http://www.cmake.org/pipermail/cmake/2006-October/011559.html
|
|
|
|
if (UNIX)
|
|
|
|
# don't use the default "/usr/local"
|
|
|
|
# but respect the user-choice on the command-line
|
|
|
|
if(LYX_INSTALL_SUFFIX)
|
|
|
|
set(CMAKE_INSTALL_PREFIX "/usr/local/lyx${LYX_INSTALL_SUFFIX}" CACHE PATH "LyX default install prefix" FORCE)
|
|
|
|
else()
|
|
|
|
set(CMAKE_INSTALL_PREFIX "/usr/local/${LYX_PROJECT}" CACHE PATH "LyX default install prefix" FORCE)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if(WIN32)
|
2011-01-22 15:14:47 +00:00
|
|
|
set(CMAKE_INSTALL_PREFIX LYX_INSTALLED CACHE PATH "LyX default install prefix" FORCE)
|
2010-09-02 06:59:58 +00:00
|
|
|
endif()
|
2010-09-01 14:20:04 +00:00
|
|
|
endif()
|
2009-01-05 19:13:20 +00:00
|
|
|
|
2010-05-26 09:49:06 +00:00
|
|
|
if (WIN32)
|
2010-09-02 06:59:58 +00:00
|
|
|
set(LYX_DATA_SUBDIR "Resources/" CACHE STRING "Subdirectory for all lyx-system-data" FORCE)
|
2010-05-26 09:49:06 +00:00
|
|
|
else()
|
2010-09-02 06:59:58 +00:00
|
|
|
set(LYX_DATA_SUBDIR "" CACHE STRING "Subdirectory for all lyx-system-data" FORCE)
|
2010-05-26 09:49:06 +00:00
|
|
|
endif()
|
|
|
|
|
2008-12-28 13:35:29 +00:00
|
|
|
set(LYX_ABS_INSTALLED_DATADIR "${CMAKE_INSTALL_PREFIX}")
|
|
|
|
set(LYX_LOCALEDIR "locale")
|
2010-07-14 15:30:31 +00:00
|
|
|
set(LYX_ABS_INSTALLED_LOCALEDIR "${LYX_ABS_INSTALLED_DATADIR}/${LYX_DATA_SUBDIR}${LYX_LOCALEDIR}")
|
2008-12-28 13:35:29 +00:00
|
|
|
set(LYX_ABS_TOP_SRCDIR "${TOP_SRC_DIR}")
|
2007-08-28 17:07:02 +00:00
|
|
|
|
|
|
|
|
2006-09-03 23:50:16 +00:00
|
|
|
if(NOT GROUP_CODE)
|
|
|
|
#set(GROUP_CODE "The Golden Code")
|
|
|
|
set(GROUP_CODE flat)
|
2007-08-28 17:07:02 +00:00
|
|
|
endif()
|
2006-09-03 17:51:53 +00:00
|
|
|
|
2007-04-23 16:52:27 +00:00
|
|
|
# lyx's source files
|
2007-04-26 12:06:02 +00:00
|
|
|
set(LYX_CPP_FILES *.cpp)
|
2007-04-23 16:52:27 +00:00
|
|
|
set(LYX_HPP_FILES *.h)
|
2010-01-26 12:40:51 +00:00
|
|
|
set(LYX_MOC_FILES moc_*.cpp)
|
2007-04-23 16:52:27 +00:00
|
|
|
|
2010-07-06 19:47:16 +00:00
|
|
|
|
2006-09-03 23:50:16 +00:00
|
|
|
include(ProjectSourceGroup)
|
2006-06-11 11:57:25 +00:00
|
|
|
|
2007-03-25 22:03:59 +00:00
|
|
|
|
2010-07-06 19:47:16 +00:00
|
|
|
if(LYX_PROFILE)
|
2007-03-26 18:50:41 +00:00
|
|
|
set(CMAKE_BUILD_TYPE Profile CACHE TYPE STRING FORCE)
|
2011-08-20 06:20:52 +00:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
|
2007-08-28 17:07:02 +00:00
|
|
|
endif()
|
|
|
|
|
2010-07-06 19:47:16 +00:00
|
|
|
if(LYX_RELEASE)
|
2011-01-22 10:53:54 +00:00
|
|
|
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build release version" FORCE)
|
|
|
|
else()
|
|
|
|
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build debug version" FORCE)
|
2007-08-28 17:07:02 +00:00
|
|
|
endif()
|
2007-03-25 22:03:59 +00:00
|
|
|
|
2011-01-13 14:31:02 +00:00
|
|
|
# When shared libs are supported enable this option
|
|
|
|
#LYX_OPTION(SHARED_LIBRARIES "Build shared libraries" OFF ALL)
|
2010-07-06 19:47:16 +00:00
|
|
|
if(LYX_SHARED_LIBRARIES)
|
2007-03-27 18:26:36 +00:00
|
|
|
set(library_type SHARED)
|
2007-08-28 17:07:02 +00:00
|
|
|
else()
|
2007-03-27 18:26:36 +00:00
|
|
|
set(library_type STATIC)
|
2007-08-28 17:07:02 +00:00
|
|
|
endif()
|
2007-03-25 22:03:59 +00:00
|
|
|
|
2008-04-19 09:19:30 +00:00
|
|
|
if(NOT MSVC)
|
2010-09-02 06:59:58 +00:00
|
|
|
if(NOT LYX_QUIET)
|
|
|
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
2007-08-28 17:07:02 +00:00
|
|
|
endif()
|
2010-09-02 08:28:34 +00:00
|
|
|
set(LYX_CXX_FLAGS "-Wall -Wunused-parameter")
|
2010-09-02 06:59:58 +00:00
|
|
|
if(LYX_STDLIB_DEBUG)
|
2007-03-25 22:03:59 +00:00
|
|
|
set(LYX_CXX_FLAGS "${LYX_CXX_FLAGS} -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC")
|
2007-08-28 17:07:02 +00:00
|
|
|
endif()
|
2010-09-02 06:59:58 +00:00
|
|
|
if(LYX_CONCEPT_CHECKS)
|
2007-03-25 22:03:59 +00:00
|
|
|
set(LYX_CXX_FLAGS "${LYX_CXX_FLAGS} -D_GLIBCPP_CONCEPT_CHECKS")
|
2007-08-28 17:07:02 +00:00
|
|
|
endif()
|
2010-09-02 06:59:58 +00:00
|
|
|
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)
|
2008-04-19 12:00:53 +00:00
|
|
|
if(MINGW)
|
2010-09-02 06:59:58 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${LYX_CXX_FLAGS} -O2 -DNDEBUG" CACHE TYPE STRING FORCE)
|
2008-04-19 12:00:53 +00:00
|
|
|
else()
|
2010-09-02 06:59:58 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${LYX_CXX_FLAGS} -O3 -DNDEBUG" CACHE TYPE STRING FORCE)
|
2008-04-19 12:00:53 +00:00
|
|
|
endif()
|
2010-09-02 06:59:58 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE} -pg" CACHE TYPE STRING FORCE)
|
2007-08-28 17:07:02 +00:00
|
|
|
endif()
|
2006-06-15 15:11:25 +00:00
|
|
|
|
2006-06-20 09:57:19 +00:00
|
|
|
|
2006-10-21 08:35:47 +00:00
|
|
|
find_package(Qt4 REQUIRED)
|
2010-07-18 09:46:46 +00:00
|
|
|
find_package(ICONV REQUIRED)
|
2006-06-11 11:57:25 +00:00
|
|
|
find_package(ZLIB REQUIRED)
|
|
|
|
|
2010-07-18 09:46:46 +00:00
|
|
|
include_directories(${CMAKE_BINARY_DIR} ${TOP_SRC_DIR}/src)
|
|
|
|
|
2010-07-06 19:47:16 +00:00
|
|
|
if(LYX_ASPELL)
|
2006-06-11 11:57:25 +00:00
|
|
|
find_package(ASPELL)
|
2010-07-17 22:24:08 +00:00
|
|
|
include_directories(${ASPELL_INCLUDE_DIR})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(LYX_ENCHANT)
|
|
|
|
find_package(Enchant REQUIRED)
|
|
|
|
include_directories(${ENCHANT_INCLUDE_DIR})
|
2007-08-28 17:07:02 +00:00
|
|
|
endif()
|
2006-06-11 11:57:25 +00:00
|
|
|
|
2010-07-18 06:47:01 +00:00
|
|
|
if(LYX_HUNSPELL)
|
|
|
|
find_package(Hunspell REQUIRED)
|
|
|
|
include_directories(${HUNSPELL_INCLUDE_DIR})
|
|
|
|
endif()
|
2008-04-19 08:47:33 +00:00
|
|
|
|
2010-07-18 07:38:00 +00:00
|
|
|
if(LYX_NLS)
|
2011-03-27 20:13:47 +00:00
|
|
|
FIND_PROGRAM(LYX_PYTHON_EXECUTABLE python HINTS ${GNUWIN32_DIR}/python)
|
2010-07-18 07:38:00 +00:00
|
|
|
if(${LYX_PYTHON_EXECUTABLE} MATCHES "-NOTFOUND")
|
|
|
|
message(FATAL_ERROR "Python 2.6 needed!")
|
|
|
|
endif()
|
|
|
|
find_package(LyXGettext REQUIRED)
|
|
|
|
include_directories(${TOP_SRC_DIR}/po)
|
2010-07-18 09:46:46 +00:00
|
|
|
add_subdirectory(po)
|
2010-07-18 07:38:00 +00:00
|
|
|
endif()
|
|
|
|
|
2011-01-22 10:53:54 +00:00
|
|
|
if(LYX_EXTERNAL_LIBINTL)
|
2008-04-19 08:47:33 +00:00
|
|
|
find_package(Libintl REQUIRED)
|
2010-07-18 09:46:46 +00:00
|
|
|
add_definitions(-DHAVE_GETTEXT) #TODO move to config.h
|
|
|
|
else()
|
|
|
|
add_subdirectory(intl)
|
|
|
|
endif()
|
|
|
|
|
2011-01-22 10:53:54 +00:00
|
|
|
if(LYX_EXTERNAL_BOOST)
|
2010-07-18 09:46:46 +00:00
|
|
|
message(STATUS "Searching for boost")
|
|
|
|
find_package(Boost COMPONENTS signals regex) #TODO could REQUIRED be used
|
|
|
|
if(Boost_FOUND)
|
|
|
|
message(STATUS "Boost found")
|
|
|
|
message(STATUS "Boost-libs = ${Boost_LIBRARIES}")
|
|
|
|
set(Lyx_Boost_Libraries ${Boost_LIBRARIES})
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Boost not found" ${Boost_ERROR_REASON})
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
if(LYX_USE_TR1_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)
|
2008-04-19 08:47:33 +00:00
|
|
|
endif()
|
|
|
|
|
2010-07-06 19:47:16 +00:00
|
|
|
|
2010-01-22 18:40:49 +00:00
|
|
|
|
2010-07-06 19:47:16 +00:00
|
|
|
|
2006-11-14 10:06:07 +00:00
|
|
|
if(WIN32)
|
2011-01-22 10:53:54 +00:00
|
|
|
if(NOT LYX_CONSOLE)
|
2006-11-14 10:06:07 +00:00
|
|
|
set(WIN32_CONSOLE WIN32)
|
|
|
|
set(LYX_QTMAIN_LIBRARY ${QT_QTMAIN_LIBRARY})
|
2007-08-28 17:07:02 +00:00
|
|
|
endif()
|
2008-04-19 10:17:40 +00:00
|
|
|
if(MSVC)
|
2009-04-15 07:28:37 +00:00
|
|
|
add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DNOMINMAX)
|
2008-04-19 10:17:40 +00:00
|
|
|
# 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()
|
|
|
|
add_definitions(-DWINVER=0x0500)
|
|
|
|
endif()
|
2007-08-28 17:07:02 +00:00
|
|
|
endif()
|
2006-11-14 10:06:07 +00:00
|
|
|
|
2009-02-21 22:41:30 +00:00
|
|
|
message(STATUS "")
|
2009-01-26 18:42:02 +00:00
|
|
|
foreach(_v PACKAGE PACKAGE_VERSION
|
2010-09-02 06:59:58 +00:00
|
|
|
PROGRAM_SUFFIX LYX_DATE LYX_DIR_VER LYX_USERDIR_VER
|
|
|
|
LYX_ABS_TOP_SRCDIR
|
|
|
|
LYX_ABS_INSTALLED_DATADIR LYX_ABS_INSTALLED_LOCALEDIR LYX_INSTALL_SUFFIX)
|
|
|
|
if(NOT DEFINED ${_v})
|
|
|
|
message(FATAL_ERROR "${_v} not defined")
|
|
|
|
endif()
|
|
|
|
string(SUBSTRING "${_v} " 0 28 _v1)
|
|
|
|
message(STATUS "----- ${_v1}: ${${_v}}")
|
2009-01-26 18:42:02 +00:00
|
|
|
endforeach(_v)
|
2009-02-21 22:41:30 +00:00
|
|
|
message(STATUS "")
|
2006-11-14 10:06:07 +00:00
|
|
|
|
2006-11-24 15:10:16 +00:00
|
|
|
|
2011-01-22 10:53:54 +00:00
|
|
|
if(LYX_PCH)
|
2011-01-22 11:23:27 +00:00
|
|
|
# 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)
|
2009-12-03 21:58:44 +00:00
|
|
|
configure_file(${CMAKE_SOURCE_DIR}/pcheaders.h ${CMAKE_BINARY_DIR}/pcheaders.h)
|
|
|
|
configure_file(${CMAKE_SOURCE_DIR}/config.cpp.cmake ${CMAKE_BINARY_DIR}/config_pch.cpp)
|
2009-12-19 20:18:46 +00:00
|
|
|
add_definitions(-DLYX_ENABLE_PCH)
|
2009-12-03 21:58:44 +00:00
|
|
|
|
2011-01-22 11:23:27 +00:00
|
|
|
if(MSVC)
|
2009-12-03 21:58:44 +00:00
|
|
|
macro(lyx_add_msvc_pch name_)
|
|
|
|
set_source_files_properties(${${name_}_sources} PROPERTIES
|
|
|
|
COMPILE_FLAGS "/Yuconfig.h /Fp\$(IntDir)/config.pch")
|
|
|
|
set_source_files_properties(${CMAKE_BINARY_DIR}/config_pch.cpp PROPERTIES
|
|
|
|
COMPILE_FLAGS "/Ycconfig.h /Fp\$(IntDir)/config.pch")
|
|
|
|
set(${name_}_sources ${${name_}_sources} ${CMAKE_BINARY_DIR}/config_pch.cpp
|
|
|
|
${CMAKE_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_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /DLYX_PCH_STL /DLYX_PCH_BOOST")
|
|
|
|
endmacro(lyx_add_msvc_pch)
|
|
|
|
macro(lyx_add_gcc_pch name_)
|
|
|
|
endmacro()
|
|
|
|
else()
|
|
|
|
macro(lyx_add_msvc_pch name_)
|
|
|
|
endmacro()
|
|
|
|
macro(lyx_add_gcc_pch name_)
|
2010-09-02 06:59:58 +00:00
|
|
|
add_definitions(-DLYX_PCH_STL -DLYX_PCH_BOOST -DLYX_PCH_QT4)
|
2009-12-03 21:58:44 +00:00
|
|
|
ADD_PRECOMPILED_HEADER(${name_} ${CMAKE_BINARY_DIR}/config_pch.cpp ${CMAKE_BINARY_DIR}/config.h.gch)
|
|
|
|
endmacro()
|
|
|
|
endif()
|
2007-08-28 17:07:02 +00:00
|
|
|
else()
|
2006-10-23 13:32:46 +00:00
|
|
|
macro(lyx_add_msvc_pch)
|
|
|
|
endmacro(lyx_add_msvc_pch)
|
2009-12-03 21:58:44 +00:00
|
|
|
macro(lyx_add_gcc_pch name_)
|
|
|
|
endmacro()
|
2007-08-28 17:07:02 +00:00
|
|
|
endif()
|
2006-10-23 13:32:46 +00:00
|
|
|
|
2009-04-15 07:28:37 +00:00
|
|
|
if(MSVC)
|
2010-07-17 22:24:08 +00:00
|
|
|
if(LYX_VLD)
|
2010-09-02 06:59:58 +00:00
|
|
|
set(LYX_LEAK_DETECTION 1 CACHE TYPE STRING FORCE)
|
|
|
|
set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
|
|
|
|
set(LYX_VLD_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../Win32/vld)
|
|
|
|
include(${LYX_VLD_PATH}/tools/cmake/vld.cmake)
|
2010-07-17 22:24:08 +00:00
|
|
|
endif()
|
2007-12-02 11:17:01 +00:00
|
|
|
|
2010-07-14 15:30:31 +00:00
|
|
|
if(LYX_WALL)
|
2006-11-29 22:36:43 +00:00
|
|
|
# Use the highest warning level
|
|
|
|
set(CMAKE_CXX_WARNING_LEVEL 4 CACHE TYPE STRING FORCE)
|
2009-04-15 07:28:37 +00:00
|
|
|
|
2006-11-29 22:36:43 +00:00
|
|
|
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
2007-08-28 17:07:02 +00:00
|
|
|
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
|
|
else()
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
|
|
|
|
endif()
|
2009-04-15 07:28:37 +00:00
|
|
|
|
2006-11-29 22:36:43 +00:00
|
|
|
if(CMAKE_C_FLAGS MATCHES "/W[0-4]")
|
2007-08-28 17:07:02 +00:00
|
|
|
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
|
|
|
else()
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
|
|
|
|
endif()
|
2009-04-15 07:28:37 +00:00
|
|
|
|
2006-12-30 13:53:34 +00:00
|
|
|
# add here warnings which should produce an error /weXXXX
|
2007-08-28 17:07:02 +00:00
|
|
|
set(MSVC_W_ERROR "/we4101 /we4189")
|
2006-12-30 13:53:34 +00:00
|
|
|
# add here warnings which should be disabled /wdXXXX
|
2010-04-22 11:19:49 +00:00
|
|
|
set(MSVC_W_DISABLE "/wd4288 /wd4355 /wd4800 /wd4996 /wd4311 /wd4312 /wd4505 /wd4267 /wd4512 /wd4245 /wd4127 /wd4180 /wd4231")
|
2009-04-15 07:28:37 +00:00
|
|
|
|
2010-09-02 06:59:58 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Wp64 ${MSVC_W_ERROR} ${MSVC_W_DISABLE}")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Wp64 ${MSVC_W_ERROR} ${MSVC_W_DISABLE}")
|
|
|
|
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /Wp64 ${MSVC_W_ERROR} ${MSVC_W_DISABLE}")
|
2009-04-15 07:28:37 +00:00
|
|
|
|
|
|
|
else()
|
2006-11-29 22:36:43 +00:00
|
|
|
set(CMAKE_CXX_WARNING_LEVEL 3 CACHE TYPE STRING FORCE)
|
2009-04-15 07:28:37 +00:00
|
|
|
|
2006-12-30 13:53:34 +00:00
|
|
|
# add here warnings which should produce an error /weXXXX
|
2007-08-28 17:07:02 +00:00
|
|
|
set(MSVC_W_ERROR "/we4101 /we4189")
|
2006-12-30 13:53:34 +00:00
|
|
|
# add here warnings which should be disabled /wdXXXX
|
2010-04-22 11:19:49 +00:00
|
|
|
set(MSVC_W_DISABLE "/wd4288 /wd4355 /wd4800 /wd4996 /wd4267 /wd4180 /wd4231")
|
2009-04-15 07:28:37 +00:00
|
|
|
|
2010-09-02 06:59:58 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${MSVC_W_ERROR} ${MSVC_W_DISABLE}")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${MSVC_W_ERROR} ${MSVC_W_DISABLE}")
|
|
|
|
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${MSVC_W_ERROR} ${MSVC_W_DISABLE}")
|
2009-04-15 07:28:37 +00:00
|
|
|
|
2007-08-28 17:07:02 +00:00
|
|
|
endif()
|
2010-09-02 06:59:58 +00:00
|
|
|
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-")
|
2009-04-15 07:28:37 +00:00
|
|
|
|
2009-02-21 22:41:30 +00:00
|
|
|
message(STATUS "----- Warning level : ${CMAKE_CXX_WARNING_LEVEL} ${WARNING_LEVEL_MESSAGE}")
|
|
|
|
message(STATUS "----- Warnings as errors : ${MSVC_W_ERROR}")
|
|
|
|
message(STATUS "----- Warnings disabled : ${MSVC_W_DISABLE}")
|
|
|
|
message(STATUS "")
|
2007-08-28 17:07:02 +00:00
|
|
|
endif()
|
2006-11-29 22:36:43 +00:00
|
|
|
|
2008-12-28 13:35:29 +00:00
|
|
|
|
2010-07-06 05:42:45 +00:00
|
|
|
if(LYX_DEBUG_GLIBC)
|
2010-09-02 06:59:58 +00:00
|
|
|
set(_GLIBCXX_DEBUG 1)
|
2010-03-01 11:06:13 +00:00
|
|
|
endif()
|
|
|
|
|
2010-07-06 05:42:45 +00:00
|
|
|
if(LYX_DEBUG_GLIBC_PEDANTIC)
|
2010-09-02 06:59:58 +00:00
|
|
|
set(_GLIBCXX_DEBUG_PEDANTIC 1)
|
2010-03-01 11:06:13 +00:00
|
|
|
endif()
|
|
|
|
|
2007-12-02 10:29:25 +00:00
|
|
|
# compiler tests, config.h generation
|
2011-01-22 11:23:27 +00:00
|
|
|
if(MSVC AND NOT LYX_CONFIGURE_CHECKS)
|
2008-04-19 09:08:29 +00:00
|
|
|
configure_file(configCompiler.h.msvc ${CMAKE_BINARY_DIR}/configCompiler.h)
|
|
|
|
else()
|
2007-12-02 10:29:25 +00:00
|
|
|
include(ConfigureChecks.cmake)
|
|
|
|
configure_file(configCompiler.h.cmake ${CMAKE_BINARY_DIR}/configCompiler.h)
|
|
|
|
endif()
|
2009-05-09 06:57:25 +00:00
|
|
|
|
2007-08-28 20:47:42 +00:00
|
|
|
configure_file(config.h.cmake ${CMAKE_BINARY_DIR}/config.h)
|
2006-10-19 21:35:44 +00:00
|
|
|
|
2006-06-11 11:57:25 +00:00
|
|
|
|
|
|
|
add_subdirectory(src)
|
2009-01-18 14:45:57 +00:00
|
|
|
add_subdirectory(lyx2lyx)
|
|
|
|
add_subdirectory(scripts)
|
2010-07-18 09:46:46 +00:00
|
|
|
|
2008-12-28 13:35:29 +00:00
|
|
|
|
2010-07-06 05:42:45 +00:00
|
|
|
if(LYX_INSTALL)
|
2011-05-24 18:36:27 +00:00
|
|
|
if(${LYX_PYTHON_EXECUTABLE} MATCHES "-NOTFOUND")
|
|
|
|
message(STATUS "Python required to create doc!")
|
2011-05-19 07:48:41 +00:00
|
|
|
else()
|
|
|
|
add_subdirectory(man)
|
|
|
|
add_subdirectory(doc)
|
2010-07-18 09:46:46 +00:00
|
|
|
endif()
|
2009-11-07 11:19:57 +00:00
|
|
|
include(../Install)
|
|
|
|
endif()
|
2007-05-02 20:59:48 +00:00
|
|
|
|
2010-07-18 09:46:46 +00:00
|
|
|
|
2011-01-22 09:27:06 +00:00
|
|
|
message(STATUS)
|
|
|
|
message(STATUS "Build options, switch LYX_* variables by -DLYX_*=1 or 0:")
|
|
|
|
message(STATUS)
|
|
|
|
LYX_OPTION_LIST_ALL()
|
|
|
|
|
|
|
|
|
2010-09-02 06:59:58 +00:00
|
|
|
set(CPACK_PACKAGE_VERSION_MAJOR "${LYX_MAJOR_VERSION}")
|
|
|
|
set(CPACK_PACKAGE_VERSION_MINOR "${LYX_MINOR_VERSION}")
|
2012-07-17 09:19:22 +00:00
|
|
|
set(CPACK_PACKAGE_VERSION_PATCH "${LYX_REVISION_VERSION}")
|
2009-02-15 15:38:32 +00:00
|
|
|
FILE(STRINGS "${TOP_SRC_DIR}/development/cmake/LyX_summary.txt" CPACK_PACKAGE_DESCRIPTION_SUMMARY)
|
2009-02-13 21:37:08 +00:00
|
|
|
|
2011-01-22 12:38:54 +00:00
|
|
|
set(CPACK_SOURCE_GENERATOR TGZ ZIP TBZ2)
|
|
|
|
set(CPACK_SOURCE_INSTALLED_DIRECTORIES "${TOP_SRC_DIR};/") # http://www.mail-archive.com/cmake@cmake.org/msg33720.html
|
|
|
|
|
2010-09-02 06:59:58 +00:00
|
|
|
set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${LYX_INSTALL_SUFFIX}")
|
2011-02-10 22:44:59 +00:00
|
|
|
|
|
|
|
set(CPACK_SOURCE_GENERATOR TGZ ZIP TBZ2)
|
|
|
|
set(CPACK_SOURCE_INSTALLED_DIRECTORIES "${TOP_SRC_DIR};/") # http://www.mail-archive.com/cmake@cmake.org/msg33720.html
|
2009-02-15 10:43:06 +00:00
|
|
|
#
|
|
|
|
# needed by rpm
|
2010-09-02 11:50:05 +00:00
|
|
|
set(CPACK_SET_DESTDIR "ON")
|
2009-02-25 07:42:50 +00:00
|
|
|
FILE(READ "${TOP_SRC_DIR}/development/cmake/LyX_license.txt" CPACK_RPM_PACKAGE_LICENSE)
|
2010-09-02 06:59:58 +00:00
|
|
|
set(CPACK_RPM_PACKAGE_GROUP "Applications/Publishing")
|
|
|
|
set(CPACK_RPM_PACKAGE_VENDOR "The LyX team")
|
2009-02-15 10:43:06 +00:00
|
|
|
#
|
|
|
|
# the next ones are needed by deb
|
2010-09-02 06:59:58 +00:00
|
|
|
set(CPACK_PACKAGE_CONTACT "${PACKAGE_BUGREPORT}")
|
|
|
|
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${LYX_PROJECT}-${LYX_INSTALL_SUFFIX}")
|
2009-04-15 07:28:37 +00:00
|
|
|
|
|
|
|
# This is experimental, valid on _my_ system (Kornel)
|
2010-09-02 06:59:58 +00:00
|
|
|
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqtgui4 (>= 4.4.3-0)")
|
|
|
|
if(ASPELL_FOUND)
|
|
|
|
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libaspell15 (>= 0.60.6-1),${CPACK_DEBIAN_PACKAGE_DEPENDS}")
|
|
|
|
endif()
|
2010-09-01 09:41:14 +00:00
|
|
|
if(ENCHANT_FOUND)
|
2010-09-02 06:59:58 +00:00
|
|
|
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libenchant1c2a (>= 1.6.0-0),${CPACK_DEBIAN_PACKAGE_DEPENDS}")
|
|
|
|
endif()
|
2011-01-22 10:53:54 +00:00
|
|
|
if(LYX_EXTERNAL_BOOST)
|
2010-09-02 06:59:58 +00:00
|
|
|
if(Boost_FOUND)
|
2010-10-03 12:31:27 +00:00
|
|
|
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-regex1.40.0 (>= 1.40.0-4),libboost-signals1.40.0 (>= 1.40.0-4),${CPACK_DEBIAN_PACKAGE_DEPENDS}")
|
2010-09-02 06:59:58 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
2009-02-15 15:38:32 +00:00
|
|
|
#
|
2009-04-15 07:28:37 +00:00
|
|
|
# for the next ones, cpack insists on data with values in some file
|
2010-09-02 06:59:58 +00:00
|
|
|
set(CPACK_PACKAGE_DESCRIPTION_FILE "${TOP_SRC_DIR}/development/cmake/LyX_description.txt")
|
|
|
|
set(CPACK_RESOURCE_FILE_LICENSE "${TOP_SRC_DIR}/development/cmake/LyX_license.txt")
|
2009-02-25 07:42:50 +00:00
|
|
|
|
|
|
|
# Find the revision number and use it as the release in rpm-package-build.
|
|
|
|
# This way we may omit the otherwise needed "--force" parameter when
|
|
|
|
# installing from that rpm package.
|
2010-07-06 19:47:16 +00:00
|
|
|
FIND_PROGRAM(LYX_SVNVERSION svnversion)
|
|
|
|
#message(STATUS "svnversion = ${LYX_SVNVERSION}")
|
|
|
|
if(NOT ${LYX_SVNVERSION} MATCHES "-NOTFOUND")
|
2010-09-02 06:59:58 +00:00
|
|
|
EXECUTE_PROCESS(COMMAND ${LYX_SVNVERSION} WORKING_DIRECTORY "${TOP_SRC_DIR}" OUTPUT_VARIABLE CPACK_RPM_PACKAGE_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
# We use this value also to set the package-patch-value
|
|
|
|
if(CPACK_RPM_PACKAGE_RELEASE MATCHES "^\([0-9]+\)")
|
|
|
|
set(CPACK_PACKAGE_VERSION_PATCH ${CMAKE_MATCH_1})
|
|
|
|
endif()
|
2009-04-15 07:28:37 +00:00
|
|
|
endif()
|
2009-02-25 07:42:50 +00:00
|
|
|
|
2009-02-15 15:38:32 +00:00
|
|
|
# we do not have a readme or welcome data,
|
|
|
|
# so we do not provide infofiles for
|
|
|
|
# CPACK_RESOURCE_FILE_README and CPACK_RESOURCE_FILE_WELCOME
|
2009-02-13 21:37:08 +00:00
|
|
|
|
2011-02-10 22:44:59 +00:00
|
|
|
if(LYX_CPACK)
|
|
|
|
include(CPack)
|
|
|
|
endif()
|
2009-11-07 11:19:57 +00:00
|
|
|
|
2009-02-13 21:37:08 +00:00
|
|
|
#Now it is possible to create some packages
|
|
|
|
# cd <BuildDir>
|
|
|
|
# make package
|
2009-04-15 07:28:37 +00:00
|
|
|
#############################################################################################
|
|
|
|
# So, e.g. for variables
|
|
|
|
# CMAKE_PROJECT_NAME : lyx
|
|
|
|
# CPACK_PACKAGE_VERSION_MAJOR : 2
|
|
|
|
# CPACK_PACKAGE_VERSION_MINOR : 0
|
|
|
|
# CPACK_PACKAGE_VERSION_PATCH : 1
|
|
|
|
# CMAKE_SYSTEM_NAME : Linux
|
|
|
|
# CPACK_BINARY_DEB:BOOL : ON
|
|
|
|
#
|
|
|
|
# the package name builds as "lyx-2.0.1-Linux.deb"
|
|
|
|
#
|
2009-02-13 21:37:08 +00:00
|
|
|
############################## rpm ################################### deb ##################
|
|
|
|
# create # cpack -G RPM --config CPackConfig.cmake # cpack -G DEB --config CPackConfig.cmake
|
2009-04-15 07:28:37 +00:00
|
|
|
# creates =># lyx-2.0.1-Linux.rpm # lyx-2.0.1-Linux.deb
|
2009-02-13 21:37:08 +00:00
|
|
|
# list # rpm -qlp lyx-2.0.1-Linux.rpm # dpkg-deb -c lyx-2.0.1-Linux.deb
|
|
|
|
# install # rpm -U lyx-2.0.1-Linux.rpm # dpkg -i lyx-2.0.1-Linux.deb
|
|
|
|
#
|
2010-07-06 19:47:16 +00:00
|
|
|
message(STATUS)
|