JKQtPlotter/cmake/jkqtplotter_common_qtsettings.cmake

53 lines
1.9 KiB
CMake
Raw Normal View History

# Instruct CMake to run moc+rcc+uic automatically when needed.
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets Svg Xml OpenGL REQUIRED)
if(${QT_VERSION_MAJOR} VERSION_GREATER_EQUAL "6")
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS OpenGLWidgets)
endif()
if(NOT ${JKQtPlotter_BUILD_FORCE_NO_PRINTER_SUPPORT})
find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS PrintSupport)
else()
message(STATUS "WARNING: not searching for Qt${QT_VERSION_MAJOR}::PrintSupport, because JKQtPlotter_BUILD_FORCE_NO_PRINTER_SUPPORT=${JKQtPlotter_BUILD_FORCE_NO_PRINTER_SUPPORT}")
endif()
set(JKQtPlotter_HAS_NO_PRINTER_SUPPORT FALSE)
2022-07-19 20:42:41 +08:00
set(JKQTPLOTTER_PRINTSUPPORT_LIBSTRING "PrintSupport")
if(JKQtPlotter_BUILD_FORCE_NO_PRINTER_SUPPORT)
set(JKQtPlotter_HAS_NO_PRINTER_SUPPORT TRUE)
2022-07-19 20:42:41 +08:00
set(JKQTPLOTTER_PRINTSUPPORT_LIBSTRING "")
else()
if(TARGET Qt${QT_VERSION_MAJOR}::PrintSupport)
else()
set(JKQtPlotter_HAS_NO_PRINTER_SUPPORT TRUE)
2022-07-19 20:42:41 +08:00
set(JKQTPLOTTER_PRINTSUPPORT_LIBSTRING "")
endif()
if(${QT_VERSION_MAJOR} VERSION_LESS "5" )
set(JKQtPlotter_HAS_NO_PRINTER_SUPPORT FALSE)
2022-07-19 20:42:41 +08:00
set(JKQTPLOTTER_PRINTSUPPORT_LIBSTRING "PrintSupport")
endif()
endif()
2022-07-19 20:42:41 +08:00
if(${QT_VERSION_MAJOR} VERSION_LESS "6")
set(JKQtPlotter_QT_CXX_STANDARD 11)
set(JKQtPlotter_QT_CXX_STANDARD_REQUIRED TRUE)
set(JKQtPlotter_QT_CXX_COMPILE_FEATURE cxx_std_11)
else()
set(JKQtPlotter_QT_CXX_STANDARD 17)
set(JKQtPlotter_QT_CXX_STANDARD_REQUIRED TRUE)
set(JKQtPlotter_QT_CXX_COMPILE_FEATURE cxx_std_17)
endif()
if (JKQtPlotter_ENABLED_CXX20)
set(JKQtPlotter_QT_CXX_STANDARD 20)
set(JKQtPlotter_QT_CXX_STANDARD_REQUIRED TRUE)
set(JKQtPlotter_QT_CXX_COMPILE_FEATURE cxx_std_20)
endif(JKQtPlotter_ENABLED_CXX20)
set(JKQtPlotter_QT_BINDIR $<TARGET_FILE_DIR:Qt${QT_VERSION_MAJOR}::qmake>) # ${QT_DIR}../../../../bin