]> git.lyx.org Git - features.git/blobdiff - CMakeLists.txt
Amend b280fed1: 3rdparty/dtl: Use preprocessor value on Windows
[features.git] / CMakeLists.txt
index 202e341745a1337e0f5a07a2099ba4f005049853..cf1c930cc789886734155acb8fa0f423bdd83388 100644 (file)
@@ -139,6 +139,11 @@ 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)
+if (NOT CMAKE_VERSION VERSION_LESS "3.17")
+LYX_OPTION(ENABLE_VALGRIND_TESTS  "Enable for tests involving valgrind" OFF ALL)
+else()
+unset(LYX_ENABLE_VALGRIND_TESTS CACHE)
+endif()
 LYX_OPTION(ASAN             "Use address sanitizer" OFF ALL)
 #LYX_COMBO(USE_FILEDIALOG    "Use native or QT file dialog" QT NATIVE)
 LYX_COMBO(USE_QT            "Use Qt version as frontend" AUTO QT4 QT5)
@@ -146,6 +151,7 @@ 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_DTL     "OFF := Build 3rdparty commands dt2dv and dv2dt" 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_COMBO(EXTERNAL_MYTHES   "OFF := Build 3rdparty lib mytheslib" AUTO OFF ON)
@@ -179,6 +185,12 @@ if(help OR HELP)
 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_DMG)
        set(LYX_BUNDLE ON)
@@ -275,7 +287,7 @@ 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
@@ -393,6 +405,7 @@ foreach(_c_l ${_config_lines} )
                set(LYX_DATE "${CMAKE_MATCH_1}")
        endif()
 endforeach(_c_l)
+unset(_config_lines)
 
 FIND_PROGRAM(LYX_GITVERSION git)
 #message(STATUS "gitversion = ${LYX_GITVERSION}")
@@ -868,6 +881,10 @@ else()
   add_subdirectory(3rdparty/zlib)
 endif()
 
+if(NOT LYX_EXTERNAL_DTL)
+  add_subdirectory(3rdparty/dtl)
+endif()
+
 if(LYX_USE_STD_REGEX)
   # Set only include path.
   # Use internal boost, which is known to exist
@@ -1068,7 +1085,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,20 +1102,26 @@ 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}")