X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=CMakeLists.txt;h=4a843029f26e6eb75b46a242d2456ca906f43cab;hb=c7f53afd319fc9028be74f8949cec00063972462;hp=202e341745a1337e0f5a07a2099ba4f005049853;hpb=3df9525a13de33b235d41a94cac9d2b1b8546c9b;p=lyx.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 202e341745..4a843029f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,12 +2,11 @@ # Licence details can be found in the file COPYING. # # Copyright (c) 2006-2011 Peter Kümmel, -# Copyright (c) 2008-2011 Kornel Benko, +# Copyright (c) 2008-2024 Kornel Benko, -cmake_minimum_required(VERSION 3.1.0) +cmake_minimum_required(VERSION 3.5.0) set(LYX_PROJECT LyX) - # Instruct cmake to not use gnu extensions, # this prevents the mix of '-std=c++*' and '-std=gnu++*' flags set(CMAKE_CXX_EXTENSIONS OFF) @@ -51,6 +50,9 @@ if(COMMAND cmake_policy) if(POLICY CMP0075) cmake_policy(SET CMP0075 NEW) endif() + if(POLICY CMP0077) + cmake_policy(SET CMP0077 NEW) + endif() endif() set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) @@ -75,9 +77,9 @@ if(NOT help AND NOT HELP) # 'project' triggers the searching for a compiler project(${LYX_PROJECT}) if (CMAKE_COMPILER_IS_GNUCXX) - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.0") + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9") message(STATUS "Gnu CXX compiler version = ${CMAKE_CXX_COMPILER_VERSION}") - message(STATUS "is too old, should be >= 4.0") + message(STATUS "is too old, should be >= 4.9") message(FATAL_ERROR "Exiting") endif() endif() @@ -102,6 +104,31 @@ endif() include(LyXMacros) include(LyXDestinations) +# Value of USE_POSIX_PACKAGING is needed in determineversionandbuildtype() +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) +else() + set(USE_POSIX_PACKAGING ON) +endif() + +determineversionandbuildtype("${TOP_SRC_DIR}/configure.ac" _package_list _version_list _envlist LYX_DATE LYX_BUILD_TYPE) +list(GET _package_list 0 PACKAGE_BASE) +list(GET _package_list 1 PACKAGE_VERSION) +list(GET _package_list 2 PACKAGE_BUGREPORT) +list(GET _envlist 0 LYX_DIR_VER) +list(GET _envlist 1 LYX_USERDIR_VER) +list(GET _version_list 0 LYX_VERSION) +list(GET _version_list 1 LYX_MAJOR_VERSION) +list(GET _version_list 2 LYX_MINOR_VERSION) +list(GET _version_list 3 LYX_RELEASE_LEVEL) +list(GET _version_list 4 LYX_RELEASE_PATCH) + # Usage LYX_OPTION # 1. parameter: option name without prefix 'LYX_' # 2. parameter: description @@ -115,6 +142,49 @@ include(LyXDestinations) # 4-n parameter: possible other string values LYX_OPTION_INIT() +LYX_COMBO(ENABLE_BUILD_TYPE "Allows to tweak the compiled code" AUTO release prerelease development gprof) + +if(LYX_ENABLE_BUILD_TYPE MATCHES "AUTO") + message(STATUS "Selecting build type defaults from configure.ac") +else() + set(LYX_BUILD_TYPE "${LYX_ENABLE_BUILD_TYPE}") + message(STATUS "Selecting build type defaults from LYX_ENABLE_BUILD_TYPE") +endif() + +# Select some defaults depending on LYX_BUILD_TYPE +# they can always be overwritten by the respective command line settings +# These settings are only effective on fresh(==empty) CMakeCache.txt +if(LYX_BUILD_TYPE STREQUAL "development") + set(DefaultLyxDebug ON) + set(DefaultLyxRelease OFF) + set(DefaultLyxStdlibDebug ON) + set(DefaultLyxEnableAssertions ON) + set(DefaultLyxProfile OFF) + set(DefaultExternalLibs OFF) +elseif(LYX_BUILD_TYPE STREQUAL "prerelease") + set(DefaultLyxDebug OFF) + set(DefaultLyxRelease OFF) + set(DefaultLyxStdlibDebug OFF) + set(DefaultLyxEnableAssertions OFF) + set(DefaultLyxProfile OFF) + set(DefaultExternalLibs ON) +elseif(LYX_BUILD_TYPE STREQUAL "release") + set(DefaultLyxDebug OFF) + set(DefaultLyxRelease ON) + set(DefaultLyxStdlibDebug OFF) + set(DefaultLyxEnableAssertions OFF) + set(DefaultLyxProfile OFF) + set(DefaultExternalLibs ON) +elseif(LYX_BUILD_TYPE STREQUAL "gprof") + set(DefaultLyxDebug ON) + set(DefaultLyxRelease OFF) + set(DefaultLyxStdlibDebug OFF) + set(DefaultLyxEnableAssertions OFF) + set(DefaultLyxProfile ON) + set(DefaultExternalLibs OFF) +else() + message(FATAL_ERROR "Invalid build type (${LYX_BUILD_TYPE}) encountered") +endif() # Options for all compilers/systems LYX_OPTION(CPACK "Use the CPack management (Implies LYX_INSTALL option)" OFF ALL) @@ -125,9 +195,10 @@ 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(RELEASE "Build release version, build debug when disabled" OFF ALL) -LYX_OPTION(DEBUG "Enforce debug build" OFF ALL) +LYX_OPTION(RELEASE "Build release version, build debug when disabled" ${DefaultLyxRelease} ALL) +LYX_OPTION(DEBUG "Enforce debug build" ${DefaultLyxDebug} ALL) LYX_OPTION(NO_OPTIMIZE "Don't use any optimization/debug flags" OFF ALL) +LYX_OPTION(ENABLE_ASSERTIONS "Run sanity checks in the program" ${DefaultLyxEnableAssertions} ALL) LYX_OPTION(PACKAGE_SUFFIX "Use version suffix for packaging" ON ALL) LYX_STRING(SUFFIX_VALUE "Use this string as suffix" "") LYX_OPTION(PCH "Use precompiled headers" OFF ALL) @@ -139,24 +210,33 @@ 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(ENABLE_KEYTESTS "Enable for keytests" OFF ALL) -LYX_OPTION(ASAN "Use address sanitizer" OFF ALL) +if (NOT CMAKE_VERSION VERSION_LESS "3.17") + LYX_OPTION(ENABLE_VALGRIND_TESTS "Enable for tests involving valgrind" OFF ALL) +else() + if (LYX_ENABLE_VALGRIND_TESTS) + unset(LYX_ENABLE_VALGRIND_TESTS CACHE) + endif() +endif() +LYX_COMBO(DEBUG_SANITIZE "Use sanitize check" NONE ADDRESS UNSPECIFIED) #LYX_COMBO(USE_FILEDIALOG "Use native or QT file dialog" QT NATIVE) -LYX_COMBO(USE_QT "Use Qt version as frontend" AUTO QT4 QT5) +LYX_COMBO(USE_QT "Use Qt version as frontend" AUTO QT5 QT6) LYX_COMBO(USE_IPO "Interprocedural optimization" OFF AUTO ON) #LYX_OPTION(3RDPARTY_BUILD "Build 3rdparty libs" OFF ALL) LYX_OPTION(DISABLE_CALLSTACK_PRINTING "do not print a callstack when crashing" OFF ALL) -LYX_OPTION(EXTERNAL_Z "OFF := Build 3rdparty lib zlib" ON ALL) -LYX_OPTION(EXTERNAL_ICONV "OFF := Build 3rdparty lib iconvlib" ON ALL) -LYX_OPTION(EXTERNAL_HUNSPELL "OFF := Build 3rdparty lib hunspelllib" ON ALL) +LYX_OPTION(EXTERNAL_Z "OFF := Build 3rdparty lib zlib" ${DefaultExternalLibs} ALL) +LYX_OPTION(EXTERNAL_DTL "OFF := Build 3rdparty commands dt2dv and dv2dt" ${DefaultExternalLibs} ALL) +LYX_OPTION(EXTERNAL_ICONV "OFF := Build 3rdparty lib iconvlib" ${DefaultExternalLibs} ALL) +LYX_OPTION(EXTERNAL_HUNSPELL "OFF := Build 3rdparty lib hunspelllib" ${DefaultExternalLibs} ALL) LYX_COMBO(EXTERNAL_MYTHES "OFF := Build 3rdparty lib mytheslib" AUTO OFF ON) # GCC specific -LYX_OPTION(PROFILE "Build with options for gprof" OFF GCC) -LYX_OPTION(EXTERNAL_BOOST "Use external boost" OFF GCC) +LYX_OPTION(PROFILE "Build with options for gprof" ${DefaultLyxProfile} GCC) +LYX_OPTION(EXTERNAL_BOOST "Use external boost" ${DefaultExternalLibs} 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(STDLIB_DEBUG "Use debug stdlib" OFF GCC) +LYX_OPTION(DEBUG_GLIBC_ASSERTIONS "Enable stdlib-assertions debug mode" OFF GCC) +LYX_OPTION(STDLIB_DEBUG "Use debug stdlib" ${DefaultLyxStdlibDebug} GCC) # MSVC specific LYX_OPTION(CONSOLE "Show console on Windows" ON MSVC) @@ -168,6 +248,51 @@ LYX_OPTION(DEPENDENCIES_DOWNLOAD "Download dependencies for MSVC 10" OFF MSVC) LYX_OPTION(DMG "Build as Mac bundle, needed for .dmg (experimental) " OFF MAC) LYX_OPTION(COCOA "Use Cocoa on Mac" OFF MAC) +# On Windows, download the dependencies if need be. +if(LYX_DEPENDENCIES_DOWNLOAD) + message(STATUS) + # Do not check for bitness against CMAKE_SIZEOF_VOID_P, as it relates to the bitness of the CMake executable, + # not that of the compiler. + if(MSVC_VERSION GREATER_EQUAL 1920 AND "${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" MATCHES "x64") + set(LYX_DEPENDENCIES_DIR ${TOP_BINARY_DIR}/msvc2019-deps-64) + set(deps_files lyx-windows-deps-msvc2019_64.zip) + set(deps_server http://ftp.lyx.org/pub/lyx/devel/win_deps) + set(GNUWIN32_DIR ${LYX_DEPENDENCIES_DIR}/lyx-windows-deps-msvc2019-64) + elseif(MSVC_VERSION GREATER_EQUAL 1920) + set(LYX_DEPENDENCIES_DIR ${TOP_BINARY_DIR}/msvc2019-deps) + set(deps_files lyx-windows-deps-msvc2019_32.zip) + set(deps_server http://ftp.lyx.org/pub/lyx/devel/win_deps) + set(GNUWIN32_DIR ${LYX_DEPENDENCIES_DIR}/lyx-windows-deps-msvc2019) + elseif(MSVC_VERSION GREATER_EQUAL 1900 AND NOT "${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" MATCHES "x64") + set(LYX_DEPENDENCIES_DIR ${TOP_BINARY_DIR}/msvc2015-deps) + set(deps_files lyx-windows-deps-msvc2015.zip) + set(deps_server http://ftp.lyx.org/pub/lyx/devel/win_deps) + set(GNUWIN32_DIR ${LYX_DEPENDENCIES_DIR}/lyx-windows-deps-msvc2015) + else() + message(FATAL_ERROR "error: no dependency package known for the selected MSVC version.") + 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 ${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() +endif() + +# Try to get some information from configure.ac +include(LyXPaths) + if(help OR HELP) message(STATUS) @@ -175,10 +300,29 @@ if(help OR HELP) message(STATUS) LYX_OPTION_LIST_ALL(help) message(STATUS) + unset(help CACHE) + unset(HELP CACHE) RETURN() endif() +if ("${LYX_SUFFIX_VALUE}" MATCHES "") + set(LYX_INSTALL_SUFFIX "${LYX_MAJOR_VERSION}.${LYX_MINOR_VERSION}") +else() + set(LYX_INSTALL_SUFFIX "${LYX_SUFFIX_VALUE}") +endif() + # Check option dependencies +if (LYX_ENABLE_VALGRIND_TESTS) + find_program(VALGRIND_EXECUTABLE "valgrind") + if (NOT VALGRIND_EXECUTABLE) + message(FATAL_ERROR "Cannot use valgrind tests, executable valgrind is missing. Please disable LYX_ENABLE_VALGRIND_TESTS") + endif() +endif() +if (LYX_DEBUG_GLIBC OR LYX_DEBUG_GLIBC_PEDANTIC OR LYX_STDLIB_DEBUG) + if (LYX_EXTERNAL_BOOST) + message(FATAL_ERROR "Using external boost not compatible with debug mode for stdlib") + endif() +endif() if(LYX_DMG) set(LYX_BUNDLE ON) @@ -208,40 +352,6 @@ else() set(LYX_MERGE_REBUILD OFF) endif() -if(LYX_DEPENDENCIES_DOWNLOAD) - message(STATUS) - if(MSVC14) - set(LYX_DEPENDENCIES_DIR ${TOP_BINARY_DIR}/msvc2015-deps) - set(deps_files lyx-windows-deps-msvc2015.zip) - set(deps_server http://ftp.lyx.de/LyX-Windows-Deps) - set(GNUWIN32_DIR ${LYX_DEPENDENCIES_DIR}/lyx-windows-deps-msvc2015) - elseif(MSVC10) - set(LYX_DEPENDENCIES_DIR ${TOP_BINARY_DIR}/msvc2010-deps) - set(deps_files lyx-windows-deps-msvc2010.zip) - set(deps_server http://ftp.lyx.de/LyX-Windows-Deps) - set(GNUWIN32_DIR ${LYX_DEPENDENCIES_DIR}/lyx-windows-deps-msvc2010) - else() - message(FATAL_ERROR "error: no dependency package known for the selected MSVC version.") - 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 ${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() -endif() - message(STATUS) set(EXECUTABLE_OUTPUT_PATH ${TOP_BINARY_DIR}/bin) @@ -275,17 +385,11 @@ find_package(CXX11Compiler) if(NOT CXX11COMPILER_FOUND) message(FATAL_ERROR "A C++11 compatible compiler is required.") endif() -set(LYX_GCC11_MODE) +unset(LYX_GCC11_MODE) if(UNIX OR MINGW) if (CMAKE_CXX_COMPILER_ID MATCHES "^([cC]lang|AppleClang)$") # ignore the GCC_VERSION for clang - # and use the resulting CXX11_STD_REGEX found in FindCXX11Compiler.cmake message(STATUS "Using clang") - if(CXX11_STD_REGEX) - set(LYX_USE_STD_REGEX 1) - else() - set(LYX_USE_STD_REGEX 0) - endif() else() execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpfullversion OUTPUT_VARIABLE GCC_VERSION ERROR_VARIABLE _error RESULT_VARIABLE _err OUTPUT_STRIP_TRAILING_WHITESPACE) #message(STATUS "dumpfullversion: error = ${_error}, result = ${_err}") @@ -295,14 +399,8 @@ if(UNIX OR MINGW) #message(STATUS "dumpversion: error = ${_error}, result = ${_err}") endif() message(STATUS "Using GCC version ${GCC_VERSION}") - if(GCC_VERSION VERSION_LESS 4.6) - message(FATAL_ERROR "gcc >= 4.6 is required.") - elseif(GCC_VERSION VERSION_LESS 4.9) - # 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() - set(LYX_USE_STD_REGEX 1) + if(GCC_VERSION VERSION_LESS 4.9) + message(FATAL_ERROR "gcc >= 4.9 is required.") endif() endif() set(LYX_GCC11_MODE "${CXX11_FLAG}") @@ -310,30 +408,9 @@ else() if(MSVC_VERSION LESS 1900) # Drop support for msvc versions prior to 1900 (Visual Studio 2015) message(FATAL_ERROR "Visual Studio >= 2015 is required.") - set(LYX_USE_STD_REGEX 0) - else() - set(LYX_USE_STD_REGEX 1) endif() endif() - -# Try to get some informations from configure.ac - -include(LyXPaths) -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) -else() - set(USE_POSIX_PACKAGING ON) -endif() - if(LYX_3RDPARTY_BUILD) # LYX_3RDPARTY_BUILD is not cached anymore, but for compatibility reasons # this enables the build of all 3rd_party libs @@ -343,57 +420,6 @@ if(LYX_3RDPARTY_BUILD) set(LYX_EXTERNAL_MYTHES OFF CACHE STRING "Build 3rdparty mytheslib" FORCE) endif() -macro(setstripped _varname) - if(${ARGC} GREATER 1) - string(STRIP "${ARGV1}" _v) - if (_v MATCHES "^\\[\(.+\)\\]$") - set(_v ${CMAKE_MATCH_1}) - endif() - if(USE_POSIX_PACKAGING) - string(TOLOWER ${_v} ${_varname}) - else() - set(${_varname} ${_v}) - endif() - else() - set(${_varname}) - endif() -endmacro(setstripped) - -foreach(_c_l ${_config_lines} ) - if(_c_l MATCHES "^AC_INIT\\(\([^,]+\),\([^,]+\), *\\[\([^,]+\)\\] *,\(.*\)") - # Not using CMAKE_MATCH_ directly is needed, because - # its value is now changed inside macro setstripped - set(_PB ${CMAKE_MATCH_1}) - set(_PV ${CMAKE_MATCH_2}) - set(_PBU ${CMAKE_MATCH_3}) - setstripped(PACKAGE_BASE ${_PB}) - setstripped(PACKAGE_VERSION ${_PV}) - setstripped(PACKAGE_BUGREPORT ${_PBU}) - if(PACKAGE_VERSION MATCHES "^\([0-9]+\)\\.\([0-9]+\)\(\\.\([0-9]+\)\(\\.\([0-9]+\)\)?\)?.*$") - set(LYX_MAJOR_VERSION ${CMAKE_MATCH_1}) - set(LYX_MINOR_VERSION ${CMAKE_MATCH_2}) - set(LYX_RELEASE_LEVEL ${CMAKE_MATCH_4}) - set(LYX_RELEASE_PATCH ${CMAKE_MATCH_6}) - 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") - if (NOT LYX_RELEASE_LEVEL) - set(LYX_RELEASE_LEVEL 0) - endif() - if (NOT LYX_RELEASE_PATCH) - set(LYX_RELEASE_PATCH 0) - endif() - if ("${LYX_SUFFIX_VALUE}" MATCHES "") - set(LYX_INSTALL_SUFFIX "${LYX_MAJOR_VERSION}.${LYX_MINOR_VERSION}") - else() - set(LYX_INSTALL_SUFFIX "${LYX_SUFFIX_VALUE}") - endif() - endif() - endif() - if(_c_l MATCHES "^AC_SUBST\\( *LYX_DATE *, *\\[\\\"(.*)\\\"\\].*") - set(LYX_DATE "${CMAKE_MATCH_1}") - endif() -endforeach(_c_l) - FIND_PROGRAM(LYX_GITVERSION git) #message(STATUS "gitversion = ${LYX_GITVERSION}") set(LYX_REVISION_VERSION ${LYX_RELEASE_LEVEL}) @@ -562,22 +588,27 @@ if(NOT LYX_DATA_SUBDIR) endif() endif() -set(LYX_ABS_INSTALLED_DATADIR "${CMAKE_INSTALL_PREFIX}") +set(LYX_ABS_INSTALLED_DATADIR "${CMAKE_INSTALL_PREFIX}/${LYX_DATA_SUBDIR}") get_locale_destination(LYX_LOCALEDIR) set(LYX_ABS_INSTALLED_LOCALEDIR "${CMAKE_INSTALL_PREFIX}/${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.") + set(LYX_MAN_DIR_tmp "${LYX_DATA_SUBDIR}") else() if(WIN32) - set(LYX_MAN_DIR "${CMAKE_BINARY_DIR}/usr/local/man" CACHE STRING "Install location for man pages.") + set(LYX_MAN_DIR_tmp "${CMAKE_BINARY_DIR}/usr/local/man/") elseif(UNIX) - set(LYX_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE STRING "Install location for man pages.") + set(LYX_MAN_DIR_tmp "${CMAKE_INSTALL_PREFIX}/share/man/") else() - set(LYX_MAN_DIR "${CMAKE_INSTALL_PREFIX}/man" CACHE STRING "Install location for man pages.") + set(LYX_MAN_DIR_tmp "${CMAKE_INSTALL_PREFIX}/man/") endif() endif() +if (NOT LYX_MAN_DIR_tmp EQUAL "${LYX_MAN_DIR}") + unset(LYX_MAN_DIR CACHE) + set(LYX_MAN_DIR "${LYX_MAN_DIR_tmp}" CACHE STRING "Install location for man pages.") +endif() +unset(LYX_MAN_DIR_tmp) mark_as_advanced(LYX_MAN_DIR) # The Win installer cannot be built by CMake because one needs to install plugins for NSIS @@ -629,6 +660,35 @@ else() set(LYX_DEBUG ON) endif() +set(min_qt5_version "5.6") +if(LYX_USE_QT MATCHES "AUTO") + # try qt6 first + foreach(_mod Core Gui Widgets Concurrent Svg) + find_package(Qt6${_mod} CONFIG QUIET) + if (NOT Qt6${_mod}_FOUND) + message(STATUS "Not found Qt6${_mod}, aborting use of QT6") + set(Qt6Core_FOUND OFF) + break() + else() + message(STATUS "Found Qt6${_mod}") + endif() + endforeach() + if (Qt6Core_FOUND) + set(LYX_USE_QT "QT6" CACHE STRING "Valid qt version" FORCE) + message(STATUS "Qt6Core_VERSION = ${Qt6Core_VERSION}") + else() + find_package(Qt5Core CONFIG QUIET) + if(Qt5Core_FOUND) + set(LYX_USE_QT "QT5" CACHE STRING "Valid qt version" FORCE) + message(STATUS "Qt5Core_VERSION = ${Qt5Core_VERSION}") + if(Qt5Core_VERSION VERSION_LESS ${min_qt5_version}) + message(FATAL_ERROR "No appropriate QT-version found") + endif() + else() + message(FATAL_ERROR "No appropriate QT-version found") + endif() + endif() +endif() # When shared libs are supported enable this option #LYX_OPTION(SHARED_LIBRARIES "Build shared libraries" OFF ALL) @@ -638,21 +698,72 @@ else() set(library_type STATIC) endif() -if(NOT MSVC) +if(LYX_ENABLE_ASSERTIONS) + set(LYX_CXX_FLAGS " -DENABLE_ASSERTIONS=1") +else() + set(LYX_CXX_FLAGS "") +endif() + +if (LYX_DEBUG_SANITIZE MATCHES "ADDRESS") + set(LYX_CXX_FLAGS "${LYX_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer") + 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/${_lyx} 2>&1 | ./asan_symbolize.py | c++filt ") + message(STATUS) +elseif (LYX_DEBUG_SANITIZE MATCHES "UNSPECIFIED") + set(LYX_CXX_FLAGS "${LYX_CXX_FLAGS} -fsanitize=undefined -fno-omit-frame-pointer") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined -fno-omit-frame-pointer") +endif() + +if(MSVC) + if (CXX11_FLAG MATCHES "\\+\\+([0-9]+)") + set(CMAKE_CXX_STANDARD ${CMAKE_MATCH_1}) + message(STATUS "CMAKE_CXX_STANDARD set to ${CMAKE_CXX_STANDARD}") + endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}${LYX_CXX_FLAGS}") +else() if(NOT LYX_QUIET) set(CMAKE_VERBOSE_MAKEFILE ON) endif() - set(LYX_CXX_FLAGS "-Wall -Wunused-parameter ${LYX_GCC11_MODE}") - if(LYX_CXX_FLAGS MATCHES "\\+\\+(14|11|98)") + if(LYX_GCC11_MODE MATCHES "\\+\\+([0-9][0-9])") # Thanks to Brad King # for the pointer to https://cmake.org/cmake/help/v3.6/variable/CMAKE_CXX_STANDARD.html # This allows us to use QT5.7 with recent g++ (version >= 4.9) compilers # and still use our own c++ extension tests - set(CMAKE_CXX_STANDARD ${CMAKE_MATCH_1}) - message(STATUS "CMAKE_CXX_STANDARD set to ${CMAKE_CXX_STANDARD}") + set(std_num ${CMAKE_MATCH_1}) + set(CMAKE_CXX_STANDARD ${std_num}) + else() + message(STATUS "Setting CMAKE_CXX_STANDARD 11 as fallback") + set(CMAKE_CXX_STANDARD 11) + set(LYX_GCC11_MODE "--std=c++11") + endif() + # The following setting with LYX_GCC11_MODE is needed because cmake does not honor + # CMAKE_CXX_STANDARD while performing tests like + # check_cxx_source_compiles("..." HAVE_DEF_MAKE_UNIQUE) + include(CheckCXXCompilerFlag) + unset(CHECK_WNODEPRECATEDCOPY_FLAG CACHE) + CHECK_CXX_COMPILER_FLAG("-Wdeprecated-copy" CHECK_WNODEPRECATEDCOPY_FLAG) + if(${CHECK_WNODEPRECATEDCOPY_FLAG}) + set(LYX_CXX_FLAGS "-Wall -Wextra -Wno-deprecated-copy ${LYX_GCC11_MODE}${LYX_CXX_FLAGS}") + else() + set(LYX_CXX_FLAGS "-Wall -Wextra ${LYX_GCC11_MODE}${LYX_CXX_FLAGS}") + endif() + message(STATUS "LYX_USE_QT = ${LYX_USE_QT}") + if(LYX_USE_QT MATCHES "QT6") + if (LYX_DEBUG_GLIBC OR LYX_DEBUG_GLIBC_PEDANTIC) + message(WARNING "Compiling LyX with stdlib-debug and Qt6 library may lead to crashes. Consider dropping -DLYX_DEBUG_GLIBC=ON and -DLYX_DEBUG_GLIBC_PEDANTIC=ON") + endif() endif() - if(LYX_STDLIB_DEBUG) - set(LYX_CXX_FLAGS "${LYX_CXX_FLAGS} -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC") + if(LYX_STDLIB_DEBUG OR LYX_DEBUG_GLIBC_ASSERTIONS) + set(LYX_CXX_FLAGS "${LYX_CXX_FLAGS} -D_GLIBCXX_ASSERTIONS") + endif() + if(LYX_DEBUG_GLIBC) + set(LYX_CXX_FLAGS "${LYX_CXX_FLAGS} -D_GLIBCXX_DEBUG") + endif() + if(LYX_DEBUG_GLIBC_PEDANTIC) + set(LYX_CXX_FLAGS "${LYX_CXX_FLAGS} -D_GLIBCXX_DEBUG_PEDANTIC") endif() set(CMAKE_CXX_FLAGS "${LYX_CXX_FLAGS} -fno-strict-aliasing " CACHE STRING "Set CXX flags" FORCE) set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -D_DEBUG" CACHE STRING "Set debug flags" FORCE) @@ -675,38 +786,44 @@ if(LYX_XMINGW) list(APPEND CMAKE_FIND_ROOT_PATH ${GNUWIN32_DIR}) endif() -set(min_qt5_version "5.6") -if(LYX_USE_QT MATCHES "AUTO") - # try qt5 first - find_package(Qt5Core CONFIG QUIET) - if(Qt5Core_FOUND) - set(LYX_USE_QT "QT5" CACHE STRING "Valid qt version" FORCE) - message(STATUS "Qt5Core_VERSION = ${Qt5Core_VERSION}") - if(Qt5Core_VERSION VERSION_LESS ${min_qt5_version}) - find_package(Qt4 "4.5.0" QUIET) - if(QT4_FOUND) - set(LYX_USE_QT "QT4" CACHE STRING "Valid qt version" FORCE) - endif() - endif() +set(QtCore5CompatLibrary) +set(QtCore5CompatModule) +if(LYX_USE_QT MATCHES "QT6|QT5") + if (LYX_USE_QT MATCHES "QT6") + set(QtVal "Qt6") + macro (qt_add_resources) + Qt6_add_resources(${ARGN}) + endmacro() + macro (qt_wrap_uifiles) + Qt6_wrap_ui(${ARGN}) + endmacro() else() - set(LYX_USE_QT "QT4" CACHE STRING "Valid qt version" FORCE) + set(QtVal "Qt5") + macro (qt_add_resources) + Qt5_add_resources(${ARGN}) + endmacro() + macro (qt_wrap_uifiles) + Qt5_wrap_ui(${ARGN}) + endmacro() endif() -endif() -if(LYX_USE_QT MATCHES "QT5") # set QPA_XCB if QT uses X11 - find_package(Qt5Core CONFIG REQUIRED) - if (Qt5Core_FOUND) - find_package(Qt5Widgets CONFIG REQUIRED) + find_package(${QtVal}Core CONFIG REQUIRED) + if (${QtVal}Core_FOUND) + find_package(${QtVal}Widgets CONFIG REQUIRED) if(APPLE) - find_package(Qt5MacExtras CONFIG REQUIRED) + if (LYX_USE_QT MATCHES "QT6") + find_package(${QtVal}MacExtras CONFIG QUIET) + else() + find_package(${QtVal}MacExtras CONFIG REQUIRED) + endif() endif() - find_package(Qt5X11Extras CONFIG QUIET) - find_package(Qt5WinExtras CONFIG QUIET) - set(QTVERSION ${Qt5Core_VERSION}) + find_package(${QtVal}X11Extras CONFIG QUIET) + find_package(${QtVal}WinExtras CONFIG QUIET) + set(QTVERSION ${${QtVal}Core_VERSION}) if (QTVERSION VERSION_LESS ${min_qt5_version}) message(STATUS "QTVERSION = \"${QTVERSION}\"") - message(STATUS "This version is not recommended, try either option -DLYX_USE_QT=QT4 or") - message(STATUS "install QT-Version >= \"${min_qt5_version}\"") + message(STATUS "This version is not recommended,") + message(STATUS "please install QT-Version >= \"${min_qt5_version}\"") # see thread in lyx-devel list # From: Jean-Pierre Chrétien # Date 11.03.2017 @@ -715,38 +832,28 @@ if(LYX_USE_QT MATCHES "QT5") endif() macro (qt_use_modules lyxtarget) foreach (_tg ${ARGN}) - find_package(Qt5${_tg} CONFIG REQUIRED) - target_link_libraries(${lyxtarget} Qt5::${_tg}) + find_package(${QtVal}${_tg} CONFIG REQUIRED) + target_link_libraries(${lyxtarget} ${QtVal}::${_tg}) endforeach() 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}) + set(LYX_QTMAIN_LIBRARY ${${QtVal}Core_QTMAIN_LIBRARIES}) + endif() + if (LYX_USE_QT MATCHES "QT6") + get_target_property(QT_MOC_EXECUTABLE Qt6::moc LOCATION) + #find_package(Qt6 COMPONENTS Core5Compat REQUIRED) + # We don't know why QtZlib is included, and ideally we + # would have a different fix than relying on this + # variable (which as "Private" in the name indicates, + # it might be a fragile workaround). + # See ML discussion here: + # https://www.mail-archive.com/search?l=mid&q=CAGU9VOqpkngYBumnNh%3DcuzQ585GsS7TJbhHa903nJSfy-davRg%40mail.gmail.com + list(REMOVE_ITEM Qt6Core5Compat_INCLUDE_DIRS ${_Qt6ZlibPrivate_OWN_INCLUDE_DIRS}) + include_directories(${Qt6Core5Compat_INCLUDE_DIRS}) + #set(QtCore5CompatLibrary Qt6::Core5Compat) + #set(QtCore5CompatModule Core5Compat) 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() - set(LYX_QTMAIN_LIBRARY ${QT_QTSVG_LIBRARY}) - if(WIN32) - list(APPEND LYX_QTMAIN_LIBRARY ${QT_QTMAIN_LIBRARIES}) endif() else() message(FATAL_ERROR "Unhandled value for LYX_USE_QT (${LYX_USE_QT})") @@ -765,7 +872,7 @@ set(Include_used_spellchecker) # String will be inserted into config.h if (LYX_EXTERNAL_MYTHES MATCHES "AUTO") # try system library first - find_package(MyThesLIB) + find_package(MYTHESLIB) if (MYTHESLIB_FOUND) set(LYX_EXTERNAL_MYTHES ON CACHE STRING "OFF:= Build 3rdparty mytheslib" FORCE) else() @@ -773,7 +880,7 @@ if (LYX_EXTERNAL_MYTHES MATCHES "AUTO") endif() endif() if (LYX_EXTERNAL_MYTHES MATCHES "ON") - find_package(MyThesLIB REQUIRED) + find_package(MYTHESLIB REQUIRED) else() add_subdirectory(3rdparty/mythes) endif() @@ -809,6 +916,7 @@ endforeach() if(GNUWIN32_DIR) list(APPEND CMAKE_PROGRAM_PATH "${GNUWIN32_DIR}/Python" ) + list(APPEND CMAKE_PROGRAM_PATH "${GNUWIN32_DIR}/Perl/bin" ) endif() # Search for python default version first @@ -856,6 +964,8 @@ if(LYX_NLS) endif() if(LYX_EXTERNAL_ICONV) + # Possible remnants of previous run without external iconv + file(REMOVE_RECURSE "${CMAKE_BINARY_DIR}/libiconv" "${CMAKE_BINARY_DIR}/3rdparty/libiconv") find_package(ICONV REQUIRED) else() add_subdirectory(3rdparty/libiconv) @@ -868,41 +978,19 @@ else() add_subdirectory(3rdparty/zlib) endif() -if(LYX_USE_STD_REGEX) - # Set only include path. - # Use internal boost, which is known to exist - # we don't need any libraries - set(Lyx_Boost_Libraries) - add_definitions(-DBOOST_USER_CONFIG=) - include_directories(${TOP_SRC_DIR}/3rdparty/boost) -else() - # Using boost-regex - if(LYX_EXTERNAL_BOOST) - message(STATUS "Searching for external boost") - find_package(Boost COMPONENTS regex) - 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() - # Using included boost - set(Lyx_Boost_Libraries boost_regex) - add_definitions(-DBOOST_USER_CONFIG=) - include_directories(${TOP_SRC_DIR}/3rdparty/boost) - add_subdirectory(3rdparty/boost "${TOP_BINARY_DIR}/3rdparty/boost") - endif() +if(NOT LYX_EXTERNAL_DTL) + add_subdirectory(3rdparty/dtl) endif() +# Set only include path. +# Use internal boost, which is known to exist +# we don't need any libraries +set(Lyx_Boost_Libraries) +add_definitions(-DBOOST_USER_CONFIG=) +include_directories(${TOP_SRC_DIR}/3rdparty/boost) + +include_directories(${TOP_SRC_DIR}/3rdparty/nod) + if(WIN32) if(LYX_CONSOLE) set(LYX_QTMAIN_LIBRARY) @@ -926,7 +1014,7 @@ endif() message(STATUS "") foreach(_v PACKAGE PACKAGE_VERSION - PROGRAM_SUFFIX LYX_DIR_VER LYX_USERDIR_VER + PROGRAM_SUFFIX LYX_VERSION 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}) @@ -1006,9 +1094,9 @@ if(MSVC) # add here warnings which should be disabled /wdXXXX set(MSVC_W_DISABLE "/wd4288 /wd4355 /wd4800 /wd4996 /wd4311 /wd4312 /wd4505 /wd4267 /wd4512 /wd4245 /wd4127 /wd4180 /wd4231") - 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}") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /W4 ${MSVC_W_ERROR} ${MSVC_W_DISABLE}") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /W4 ${MSVC_W_ERROR} ${MSVC_W_DISABLE}") + set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /W4 ${MSVC_W_ERROR} ${MSVC_W_DISABLE}") else() set(CMAKE_CXX_WARNING_LEVEL 3 CACHE STRING "Warning level" FORCE) @@ -1024,12 +1112,19 @@ if(MSVC) endif() - if (NOT Qt5Core_FOUND) + if (NOT (Qt5Core_FOUND OR Qt6Core_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() + if (MSVC_VERSION GREATER_EQUAL 1914) + # Ensure the __cplusplus macro is set to a sensible value. + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Zc:__cplusplus") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zc:__cplusplus") + set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /Zc:__cplusplus") + endif() + 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}") @@ -1037,14 +1132,6 @@ if(MSVC) endif() -if(LYX_DEBUG_GLIBC) - set(_GLIBCXX_DEBUG ON) -endif() - -if(LYX_DEBUG_GLIBC_PEDANTIC) - set(_GLIBCXX_DEBUG_PEDANTIC ON) -endif() - # Xcode compiler if (CMAKE_GENERATOR MATCHES Xcode) if (XCODE_VERSION VERSION_LESS "5.0") @@ -1068,7 +1155,7 @@ endif() include(${LYX_CMAKE_DIR}/ConfigureChecks.cmake) configure_file(${LYX_CMAKE_DIR}/configCompiler.h.cmake ${TOP_BINARY_DIR}/configCompiler.h) -set(opts) +unset(opts) foreach(_option ${LYX_OPTIONS}) if(${_option}_show_message) string(SUBSTRING "${_option} " 0 31 _var) @@ -1085,27 +1172,29 @@ foreach(_option ${LYX_OPTIONS}) set(opts "${opts} ${_option}(${${_option}})") endif() endforeach() -set(VERSION_INFO "CMake Build") -set(VERSION_INFO "${VERSION_INFO}\\n Host name: ${CMAKE_HOST_SYSTEM_NAME}") -set(VERSION_INFO "${VERSION_INFO}\\n Host processor: ${CMAKE_HOST_SYSTEM_PROCESSOR}") -set(VERSION_INFO "${VERSION_INFO}\\n Build flags: ${opts}") -set(VERSION_INFO "${VERSION_INFO}\\n C++ Compiler: ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER_VERSION})") -set(VERSION_INFO "${VERSION_INFO}\\n C++ Compiler flags: ${CMAKE_CXX_FLAGS}") +set(tmp_vi "CMake Build") +list(APPEND tmp_vi " Host name: ${CMAKE_HOST_SYSTEM_NAME}") +list(APPEND tmp_vi " Host processor: ${CMAKE_HOST_SYSTEM_PROCESSOR}") +list(APPEND tmp_vi " Build flags: ${opts}") +list(APPEND tmp_vi " C++ Compiler: ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER_VERSION})") +list(APPEND tmp_vi " C++ Compiler flags: ${CMAKE_CXX_FLAGS}") if (LYX_DEBUG) -set(VERSION_INFO "${VERSION_INFO}\\n C++ Compiler user flags: ${CMAKE_CXX_FLAGS_DEBUG}") +list(APPEND tmp_vi " C++ Compiler user flags: ${CMAKE_CXX_FLAGS_DEBUG}") else() -set(VERSION_INFO "${VERSION_INFO}\\n C++ Compiler user flags: ${CMAKE_CXX_FLAGS_RELEASE}") +list(APPEND tmp_vi " C++ Compiler user flags: ${CMAKE_CXX_FLAGS_RELEASE}") endif() - +list(APPEND tmp_vi " Qt version: ${QTVERSION}") +list(APPEND tmp_vi " LyX binary dir: ${CMAKE_INSTALL_PREFIX}/${LYX_UTILITIES_INSTALL_PATH}") +get_data_destination(dest_data) +list(APPEND tmp_vi " LyX files dir: ${CMAKE_INSTALL_PREFIX}/${dest_data}") +string(REPLACE ";" "\\n" VERSION_INFO "${tmp_vi}") configure_file(${LYX_CMAKE_DIR}/config.h.cmake ${TOP_BINARY_DIR}/config.h) +unset(opts) +unset(tmp_vi) if(QTVERSION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+).*") - MATH(EXPR QT4_VERSION "(${CMAKE_MATCH_1}<<16)|(${CMAKE_MATCH_2}<<8)|${CMAKE_MATCH_3}") -endif() - -if (NOT HAVE_REGEX) - set(LYX_USE_STD_REGEX 0) + MATH(EXPR QTx_VERSION "(${CMAKE_MATCH_1}<<16)|(${CMAKE_MATCH_2}<<8)|${CMAKE_MATCH_3}") endif() @@ -1118,16 +1207,6 @@ 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!") @@ -1142,6 +1221,10 @@ include(../Install) # By running the URL tests first, time can be saved when running the ctests in # parallel since the URL tests take a long time to run (e.g. 10 minutes). + +# Needed, because of perl scripts in checkurls autotests and batchtests +find_package(Perl REQUIRED) + if(LYX_ENABLE_URLTESTS) add_subdirectory(development/checkurls "${TOP_BINARY_DIR}/checkurls") endif() @@ -1207,4 +1290,10 @@ endif() # can be run last add_subdirectory(development/cmake/post_install) +string(TIMESTAMP current_date "%Y-%m-%d %H:%M") +execute_process(COMMAND ${LYX_GITVERSION} describe --tags + WORKING_DIRECTORY "${TOP_SRC_DIR}" + OUTPUT_VARIABLE current_version + OUTPUT_STRIP_TRAILING_WHITESPACE) +file(APPEND "${TOP_BINARY_DIR}/Testing/IgnoredCount" "${current_date} ${current_version} Ignored tests = ${LYX_ignored_count}\n") message(STATUS)