Cmake: warn when using stdlib-debug with Qt6

This commit is contained in:
Kornel Benko 2022-12-07 11:04:55 +01:00
parent a66ee4109e
commit 84ac2e51ae

View File

@ -235,6 +235,7 @@ 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(DEBUG_GLIBC_ASSERTIONS "Enable stdlib-assertions debug mode" OFF GCC)
LYX_OPTION(STDLIB_DEBUG "Use debug stdlib" ${DefaultLyxStdlibDebug} GCC)
# MSVC specific
@ -659,6 +660,26 @@ else()
set(LYX_DEBUG ON)
endif()
set(min_qt5_version "5.6")
if(LYX_USE_QT MATCHES "AUTO")
# try qt6 first
find_package(Qt6Core CONFIG QUIET)
if (Qt6Core_Found)
set(LYX_USE_QT "QT6" CACHE STRING "Valid qt version" FORCE)
message(STATUS "Qt5Core_VERSION = ${Qt5Core_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)
@ -720,15 +741,20 @@ else()
else()
set(LYX_CXX_FLAGS "-Wall -Wextra ${LYX_GCC11_MODE}${LYX_CXX_FLAGS}")
endif()
if(LYX_STDLIB_DEBUG)
set(LYX_CXX_FLAGS "${LYX_CXX_FLAGS} -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC")
else()
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()
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 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)
@ -751,27 +777,6 @@ 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 qt6 first
find_package(Qt6Core CONFIG QUIET)
if (Qt6Core_Found)
set(LYX_USE_QT "QT6" CACHE STRING "Valid qt version" FORCE)
message(STATUS "Qt5Core_VERSION = ${Qt5Core_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()
set(QtCore5CompatLibrary)
set(QtCore5CompatModule)
if(LYX_USE_QT MATCHES "QT6|QT5")