include(LyXPaths) #called here to define the needed TOP_SRC_DIR-variable
file(STRINGS "${TOP_SRC_DIR}/configure.ac" _config_lines)
+if(WIN32)
+ set(USE_WINDOWS_PACKAGING 1)
+elseif(APPLE)
+ set(USE_MACOSX_PACKAGING 1)
+else()
+ set(USE_POSIX_PACKAGING 1)
+endif()
+
macro(setstripped _varname _value)
string(STRIP ${_value} _v)
- set(${_varname} ${_v})
+ if(USE_POSIX_PACKAGING)
+ string(TOLOWER ${_v} ${_varname})
+ else()
+ set(${_varname} ${_v})
+ endif()
endmacro(setstripped)
foreach(_c_l ${_config_lines} )
- if(_c_l MATCHES "^AC_INIT\\(\([^,]+\),\([^,]+\),\([^,]+\)\(.*\)")
- setstripped(PACKAGE ${CMAKE_MATCH_1})
+ if(_c_l MATCHES "^AC_INIT\\(\([^,]+\),\([^,]+\), *\\[\([^,]+\)\\] *,\(.*\)")
+ setstripped(PACKAGE_BASE ${CMAKE_MATCH_1})
setstripped(PACKAGE_VERSION ${CMAKE_MATCH_2})
+ setstripped(PACKAGE_BUGREPORT ${CMAKE_MATCH_3})
if(PACKAGE_VERSION MATCHES "^\([0-9]+\)\\.\([0-9]+\).*$")
+ set(LYX_MAJOR_VERSION ${CMAKE_MATCH_1})
+ set(LYX_MINOR_VERSION ${CMAKE_MATCH_2})
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()
endforeach(_c_l)
-set(PROGRAM_SUFFIX "\"\"")
+if(UseVersionSuffix)
+ message(STATUS "-- Using versioned PACKAGE. Disable with -DUseVersionSuffix=0")
+ set(PACKAGE ${PACKAGE_BASE}${LYX_INSTALL_SUFFIX})
+ set(PROGRAM_SUFFIX "${LYX_INSTALL_SUFFIX}")
+else()
+ message(STATUS "-- PACKAGE not versioned, to enable use -DUseVersionSuffix=1")
+ set(PACKAGE ${PACKAGE_BASE})
+ set(PROGRAM_SUFFIX "")
+endif()
+
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
# 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
SET(CMAKE_INSTALL_PREFIX
- "/usr/local/share/lyx${LYX_INSTALL_SUFFIX}" CACHE PATH "LyX install prefix" FORCE)
+ "/usr/local/lyx${LYX_INSTALL_SUFFIX}" CACHE PATH "LyX install prefix" FORCE)
endif()
if(WIN32)
SET(CMAKE_INSTALL_PREFIX
set(LYX_ABS_TOP_SRCDIR "${TOP_SRC_DIR}")
-if(WIN32)
- set(USE_WINDOWS_PACKAGING 1)
-elseif(APPLE)
- set(USE_MACOSX_PACKAGING 1)
-else()
- set(USE_POSIX_PACKAGING 1)
-endif()
-
if(NOT GROUP_CODE)
#set(GROUP_CODE "The Golden Code")
set(GROUP_CODE flat)
add_definitions(-DHAVE_GETTEXT)
endif()
-message("")
+message(STATUS "")
if(nls OR all)
set(nls TRUE CACHE TYPE STRING)
add_definitions(-DENABLE_NLS=1)
- message("----- Building with ENABLE_NLS")
+ message(STATUS "----- Building with ENABLE_NLS")
else()
- message("----- No nls, to enable use -Dnls=1")
+ message(STATUS "----- No nls, to enable use -Dnls=1")
endif()
set(nls)
if(ASPELL_FOUND)
add_definitions(-DUSE_ASPELL=1)
- message("----- Building with USE_ASPELL")
+ message(STATUS "----- Building with USE_ASPELL")
else()
- message("----- No aspell, to get more information use -Daspell=1")
+ message(STATUS "----- No aspell, to get more information use -Daspell=1")
endif()
set(all)
set(noconsole TRUE CACHE TYPE STRING)
set(WIN32_CONSOLE WIN32)
set(LYX_QTMAIN_LIBRARY ${QT_QTMAIN_LIBRARY})
- message("----- Console disabled")
+ message(STATUS "----- Console disabled")
else()
- message("----- Console enabled, disable it with -Dnoconsole=1")
+ message(STATUS "----- Console enabled, disable it with -Dnoconsole=1")
endif()
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DNOMINMAX)
endif()
endif()
-message("")
+message(STATUS "")
foreach(_v PACKAGE PACKAGE_VERSION
PROGRAM_SUFFIX LYX_DATE LYX_DIR_VER LYX_USERDIR_VER
LYX_ABS_TOP_SRCDIR
message(FATAL_ERROR "${_v} not defined")
endif()
string(SUBSTRING "${_v} " 0 28 _v1)
- message("----- ${_v1}: ${${_v}}")
+ message(STATUS "----- ${_v1}: ${${_v}}")
endforeach(_v)
-message("")
+message(STATUS "")
add_definitions(-DBOOST_USER_CONFIG="<config.h>")
if(MSVC AND NOT disable-pch AND NOT MERGE_FILES)
- message("-----")
- message("----- using precompiled headers, disable with -Ddisable-pch=1")
- message("-----")
+ message(STATUS "-----")
+ message(STATUS "----- using precompiled headers, disable with -Ddisable-pch=1")
+ message(STATUS "-----")
configure_file(${CMAKE_SOURCE_DIR}/pcheaders.h
${CMAKE_BINARY_DIR}/pcheaders.h)
configure_file(${CMAKE_SOURCE_DIR}/config.cpp.cmake
"${CMAKE_CXX_FLAGS_MINSIZEREL} /DLYX_PCH_STL /DLYX_PCH_BOOST")
else()
if(MSVC)
- message("-----")
- message("----- precompiled headers disabled, enable with -Ddisable-pch=0")
- message("-----")
+ message(STATUS "-----")
+ message(STATUS "----- precompiled headers disabled, enable with -Ddisable-pch=0")
+ message(STATUS "-----")
endif()
set(disable-pch TRUE CACHE TYPE STRING)
macro(lyx_add_msvc_pch)
set(CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} /Wp64 ${MSVC_W_ERROR} ${MSVC_W_DISABLE}")
- set(CMAKE_CXX_FLAGS_RELEASEs
+ 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}")
endif()
- message("----- Warning level : ${CMAKE_CXX_WARNING_LEVEL} ${WARNING_LEVEL_MESSAGE}")
- message("----- Warnings as errors : ${MSVC_W_ERROR}")
- message("----- Warnings disabled : ${MSVC_W_DISABLE}")
- message("")
+ 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 "")
endif()
include(../Install)
+SET(CPACK_PACKAGE_VERSION_MAJOR "${LYX_MAJOR_VERSION}")
+SET(CPACK_PACKAGE_VERSION_MINOR "${LYX_MINOR_VERSION}")
+FILE(STRINGS "${TOP_SRC_DIR}/development/cmake/LyX_summary.txt" CPACK_PACKAGE_DESCRIPTION_SUMMARY)
+#SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A WYSIWYM (What You See Is What You Mean) document processor")
+
+SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${LYX_INSTALL_SUFFIX}")
+#
+# needed by rpm
+SET(CPACK_SET_DESTDIR "ON")
+FILE(READ "${TOP_SRC_DIR}/development/cmake/LyX_license.txt" CPACK_RPM_PACKAGE_LICENSE)
+SET(CPACK_RPM_PACKAGE_GROUP "Applications/Publishing")
+SET(CPACK_RPM_PACKAGE_VENDOR "The LyX team")
+#
+# the next ones are needed by deb
+SET(CPACK_PACKAGE_CONTACT "${PACKAGE_BUGREPORT}")
+SET(CPACK_SOURCE_PACKAGE_FILE_NAME "lyx-${LYX_INSTALL_SUFFIX}")
+#
+# for the next ones, cmake insists on data with values in some file
+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")
+
+# 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.
+FIND_PROGRAM(_svnversion svnversion)
+EXECUTE_PROCESS(COMMAND ${_svnversion} WORKING_DIRECTORY "${TOP_SRC_DIR}" OUTPUT_VARIABLE CPACK_RPM_PACKAGE_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+# 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
+
+include(CPack)
+#Now it is possible to create some packages
+# cd <BuildDir>
+# make package
+############################## rpm ################################### deb ##################
+# create # cpack -G RPM --config CPackConfig.cmake # cpack -G DEB --config CPackConfig.cmake
+# creates =># lyx-2.0.1-Linux.rpm # ==> lyx-2.0.1-Linux.deb
+# 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
+#