mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-12-25 10:01:38 +08:00
modified CMakeLists.txt to match Qt6
This commit is contained in:
parent
052fc27cfb
commit
8835febb96
@ -4,4 +4,5 @@ set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
find_package(Qt5 5.0 REQUIRED Core Gui Widgets PrintSupport Svg Xml OpenGL)
|
||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui Widgets PrintSupport Svg Xml OpenGL REQUIRED)
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets PrintSupport Svg Xml OpenGL REQUIRED)
|
||||
|
@ -1,7 +1,7 @@
|
||||
function(jkqtplotter_deployqt TARGET_NAME)
|
||||
#use windeploy
|
||||
if (WIN32)
|
||||
get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION)
|
||||
get_target_property(_qmake_executable Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION)
|
||||
get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
|
||||
find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${_qt_bin_dir}")
|
||||
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${_qt_bin_dir}")
|
||||
|
@ -13,7 +13,9 @@ set(CMAKE_CXX_STANDARD 11)
|
||||
#set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||
|
||||
# Configure project for usage of Qt5
|
||||
find_package(Qt5 COMPONENTS Core Gui Widgets PrintSupport Svg Xml OpenGl REQUIRED)
|
||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui Widgets PrintSupport Svg Xml OpenGl REQUIRED)
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets PrintSupport Svg Xml OpenGL REQUIRED)
|
||||
|
||||
|
||||
# include JKQTPlotter
|
||||
find_package(JKQTPlotterLib REQUIRED)
|
||||
@ -32,10 +34,10 @@ endif()
|
||||
|
||||
# add the example executable
|
||||
add_executable(${EXENAME} WIN32 simpletest.cpp)
|
||||
# ... link against Qt5 and JKQTPlotterLib
|
||||
# ... link against Qt5/6 and JKQTPlotterLib
|
||||
# (you could use JKQTPlotterSharedLib if you don't want to link againast the
|
||||
# static version, but against the shared/DLL version).
|
||||
target_link_libraries(${EXENAME} Qt5::Core Qt5::Widgets Qt5::Gui Qt5::PrintSupport Qt5::Svg Qt5::Xml JKQTPlotterLib)
|
||||
target_link_libraries(${EXENAME} Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::PrintSupport Qt${QT_VERSION_MAJOR}::Svg Qt${QT_VERSION_MAJOR}::Xml JKQTPlotterLib)
|
||||
|
||||
# Installation
|
||||
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
@ -15,9 +15,9 @@ set(UIS )
|
||||
add_executable(${EXENAME} WIN32 ${SOURCES} ${HEADERS} ${RESOURCES} ${UIS})
|
||||
target_include_directories(${EXENAME} PRIVATE ../../lib)
|
||||
if(JKQtPlotter_BUILD_STATIC_LIBS)
|
||||
target_link_libraries(${EXENAME} JKQTPlotterLib Qt5::PrintSupport Qt5::Xml)
|
||||
target_link_libraries(${EXENAME} JKQTPlotterLib Qt${QT_VERSION_MAJOR}::PrintSupport Qt${QT_VERSION_MAJOR}::Xml)
|
||||
elseif(JKQtPlotter_BUILD_SHARED_LIBS)
|
||||
target_link_libraries(${EXENAME} JKQTPlotterSharedLib Qt5::PrintSupport Qt5::Xml)
|
||||
target_link_libraries(${EXENAME} JKQTPlotterSharedLib Qt${QT_VERSION_MAJOR}::PrintSupport Qt${QT_VERSION_MAJOR}::Xml)
|
||||
endif()
|
||||
|
||||
|
||||
|
@ -14,8 +14,8 @@ message( STATUS "Using compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILE
|
||||
message( STATUS "Architecture: ${CMAKE_CXX_LIBRARY_ARCHITECTURE} / ${CMAKE_LIBRARY_ARCHITECTURE}" )
|
||||
message( STATUS "System Name: ${CMAKE_SYSTEM_NAME}" )
|
||||
message( STATUS "Processor Name: ${CMAKE_SYSTEM_PROCESSOR}" )
|
||||
message( STATUS "Using Qt: ${Qt5_VERSION}" )
|
||||
message( STATUS " [at ${Qt5_DIR}]" )
|
||||
message( STATUS "Using Qt: ${QT_VERSION}" )
|
||||
message( STATUS " [at ${QT_DIR}]" )
|
||||
if(JKQtPlotter_BUILD_INCLUDE_XITS_FONTS)
|
||||
message( STATUS "Using XITS fonts" )
|
||||
endif(JKQtPlotter_BUILD_INCLUDE_XITS_FONTS)
|
||||
|
@ -97,7 +97,7 @@ if(JKQtPlotter_BUILD_SHARED_LIBS)
|
||||
add_library(${libsh_name} SHARED ${SOURCES} ${HEADERS} )
|
||||
set_property(TARGET ${libsh_name} PROPERTY VERSION "${PROJECT_VERSION}")
|
||||
set_property(TARGET ${libsh_name} PROPERTY OUTPUT_NAME "${libsh_name_decorated}")
|
||||
target_link_libraries(${libsh_name} PUBLIC Qt5::Core Qt5::Gui Qt5::Xml Qt5::Widgets Qt5::PrintSupport)
|
||||
target_link_libraries(${libsh_name} PUBLIC Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Xml Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::PrintSupport)
|
||||
target_compile_definitions(${libsh_name} PUBLIC JKQTCOMMON_LIB_IN_DLL)
|
||||
target_compile_definitions(${libsh_name} PRIVATE JKQTCOMMON_LIB_EXPORT_LIBRARY)
|
||||
set_property(TARGET ${libsh_name} PROPERTY CXX_STANDARD 11)
|
||||
@ -140,7 +140,7 @@ if(JKQtPlotter_BUILD_STATIC_LIBS)
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/../>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
target_link_libraries(${lib_name} PUBLIC Qt5::Core Qt5::Gui Qt5::Xml Qt5::Widgets Qt5::PrintSupport)
|
||||
target_link_libraries(${lib_name} PUBLIC Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Xml Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::PrintSupport)
|
||||
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Version.cmake
|
||||
VERSION ${PROJECT_VERSION}
|
||||
COMPATIBILITY AnyNewerVersion )
|
||||
|
@ -6,8 +6,9 @@
|
||||
#
|
||||
|
||||
|
||||
# package requires Qt 5
|
||||
find_package(Qt5 5.0 REQUIRED Core Gui Widgets PrintSupport Svg Xml OpenGL)
|
||||
# package requires Qt 5/6
|
||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui Widgets PrintSupport Svg Xml OpenGL REQUIRED)
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets PrintSupport Svg Xml OpenGL REQUIRED)
|
||||
|
||||
# include auto-generated targets.cmake file
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@JKQTP_CURRENT_TARGET_FILENAME@")
|
@ -39,7 +39,7 @@ if(JKQtPlotter_BUILD_SHARED_LIBS)
|
||||
add_library(${libsh_name} SHARED ${SOURCES} ${RESOURCES} ${HEADERS})
|
||||
set_property(TARGET ${libsh_name} PROPERTY VERSION "${PROJECT_VERSION}")
|
||||
set_property(TARGET ${libsh_name} PROPERTY OUTPUT_NAME "${libsh_name_decorated}")
|
||||
target_link_libraries(${libsh_name} PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport Qt5::OpenGL JKQTCommonSharedLib)
|
||||
target_link_libraries(${libsh_name} PUBLIC Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::PrintSupport Qt${QT_VERSION_MAJOR}::OpenGL JKQTCommonSharedLib)
|
||||
target_compile_definitions(${libsh_name} PUBLIC JKQTFASTPLOTTER_LIB_IN_DLL)
|
||||
set_property(TARGET ${libsh_name} PROPERTY CXX_STANDARD 11)
|
||||
set_property(TARGET ${libsh_name} PROPERTY CXX_STANDARD_REQUIRED TRUE)
|
||||
@ -78,7 +78,7 @@ if(JKQtPlotter_BUILD_STATIC_LIBS)
|
||||
target_compile_definitions(${lib_name} PUBLIC NOMINMAX)
|
||||
endif()
|
||||
target_compile_features(${lib_name} PUBLIC cxx_std_11)
|
||||
target_link_libraries(${lib_name} PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport Qt5::OpenGL JKQTCommonLib)
|
||||
target_link_libraries(${lib_name} PUBLIC Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::PrintSupport Qt${QT_VERSION_MAJOR}::OpenGL JKQTCommonLib)
|
||||
target_include_directories(${lib_name} PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/../>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
|
@ -6,8 +6,9 @@
|
||||
#
|
||||
|
||||
|
||||
# package requires Qt 5
|
||||
find_package(Qt5 5.0 REQUIRED Core Gui Widgets PrintSupport Svg Xml OpenGL)
|
||||
# package requires Qt 5/6
|
||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui Widgets PrintSupport Svg Xml OpenGL REQUIRED)
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets PrintSupport Svg Xml OpenGL REQUIRED)
|
||||
find_package(JKQTCommon@JKQTP_CURRENT_TARGET_SHAREDPART@Lib REQUIRED PATHS ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_MODULE_PATH})
|
||||
|
||||
# include auto-generated targets.cmake file
|
||||
|
@ -44,7 +44,7 @@ if(JKQtPlotter_BUILD_SHARED_LIBS)
|
||||
add_library(${libsh_name} SHARED ${SOURCES} ${RESOURCES} ${HEADERS} )
|
||||
set_property(TARGET ${libsh_name} PROPERTY VERSION "${PROJECT_VERSION}")
|
||||
set_property(TARGET ${libsh_name} PROPERTY OUTPUT_NAME "${libsh_name_decorated}")
|
||||
target_link_libraries(${libsh_name} PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport JKQTCommonSharedLib)
|
||||
target_link_libraries(${libsh_name} PUBLIC Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::PrintSupport JKQTCommonSharedLib)
|
||||
target_compile_definitions(${libsh_name} PUBLIC JKQTMATHTEXT_LIB_IN_DLL)
|
||||
target_compile_definitions(${libsh_name} PRIVATE JKQTMATHTEXT_LIB_EXPORT_LIBRARY)
|
||||
set_property(TARGET ${libsh_name} PROPERTY CXX_STANDARD 11)
|
||||
@ -89,7 +89,7 @@ if(JKQtPlotter_BUILD_STATIC_LIBS)
|
||||
if(JKQtPlotter_BUILD_INCLUDE_XITS_FONTS)
|
||||
target_compile_definitions(${lib_name} PRIVATE JKQTMATHTEXT_COMPILED_WITH_XITS)
|
||||
endif(JKQtPlotter_BUILD_INCLUDE_XITS_FONTS)
|
||||
target_link_libraries(${lib_name} PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport JKQTCommonLib)
|
||||
target_link_libraries(${lib_name} PUBLIC Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::PrintSupport JKQTCommonLib)
|
||||
target_include_directories(${lib_name} PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/../>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
|
@ -6,8 +6,10 @@
|
||||
#
|
||||
|
||||
|
||||
# package requires Qt 5
|
||||
find_package(Qt5 5.0 REQUIRED Core Gui Widgets PrintSupport Svg Xml OpenGL)
|
||||
# package requires Qt 5/6
|
||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui Widgets PrintSupport Svg Xml OpenGL REQUIRED)
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets PrintSupport Svg Xml OpenGL REQUIRED)
|
||||
|
||||
find_package(JKQTCommon@JKQTP_CURRENT_TARGET_SHAREDPART@Lib REQUIRED PATHS ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_MODULE_PATH})
|
||||
|
||||
# include auto-generated targets.cmake file
|
||||
|
@ -201,7 +201,7 @@ if(JKQtPlotter_BUILD_SHARED_LIBS)
|
||||
)
|
||||
set_property(TARGET ${libsh_name} PROPERTY VERSION "${PROJECT_VERSION}")
|
||||
set_property(TARGET ${libsh_name} PROPERTY OUTPUT_NAME "${libsh_name_decorated}")
|
||||
target_link_libraries(${libsh_name} PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport Qt5::Svg Qt5::Xml JKQTCommonSharedLib JKQTMathTextSharedLib)
|
||||
target_link_libraries(${libsh_name} PUBLIC Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::PrintSupport Qt${QT_VERSION_MAJOR}::Svg Qt${QT_VERSION_MAJOR}::Xml JKQTCommonSharedLib JKQTMathTextSharedLib)
|
||||
set_property(TARGET ${libsh_name} PROPERTY CXX_STANDARD 11)
|
||||
set_property(TARGET ${libsh_name} PROPERTY CXX_STANDARD_REQUIRED TRUE)
|
||||
target_compile_features(${libsh_name} PUBLIC cxx_std_11)
|
||||
@ -244,7 +244,7 @@ if(JKQtPlotter_BUILD_STATIC_LIBS)
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/../>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
target_link_libraries(${lib_name} PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport Qt5::Svg Qt5::Xml JKQTCommonLib JKQTMathTextLib)
|
||||
target_link_libraries(${lib_name} PUBLIC Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::PrintSupport Qt${QT_VERSION_MAJOR}::Svg Qt${QT_VERSION_MAJOR}::Xml JKQTCommonLib JKQTMathTextLib)
|
||||
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Version.cmake
|
||||
VERSION ${PROJECT_VERSION}
|
||||
COMPATIBILITY AnyNewerVersion )
|
||||
@ -295,7 +295,7 @@ if(JKQtPlotter_BUILD_STATIC_LIBS)
|
||||
DESTINATION lib/cmake )
|
||||
endif(JKQtPlotter_BUILD_STATIC_LIBS)
|
||||
|
||||
install(FILES ${HEADERS_BASE}
|
||||
install(FILES ${HEADERS}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}
|
||||
COMPONENT Headers)
|
||||
|
||||
@ -312,5 +312,5 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_Readme.txt" DESTINATION d
|
||||
install(FILES "${PROJECT_SOURCE_DIR}/LICENSE" DESTINATION doc/JKQtPlotter RENAME "${lib_name}_LICENSE.txt" )
|
||||
|
||||
|
||||
#get_target_property(printsupp_inc Qt5::PrintSupport INTERFACE_INCLUDE_DIRECTORIES)
|
||||
#message("Qt5::PrintSupport::INTERFACE_INCLUDE_DIRECTORIES = ${printsupp_inc}")
|
||||
#get_target_property(printsupp_inc Qt${QT_VERSION_MAJOR}::PrintSupport INTERFACE_INCLUDE_DIRECTORIES)
|
||||
#message("Qt${QT_VERSION_MAJOR}::PrintSupport::INTERFACE_INCLUDE_DIRECTORIES = ${printsupp_inc}")
|
||||
|
@ -5,8 +5,9 @@
|
||||
# Copyright: (c) Jan Krieger <jan@jkrieger.de>
|
||||
#
|
||||
|
||||
# package requires Qt 5
|
||||
find_package(Qt5 5.0 REQUIRED Core Gui Widgets PrintSupport Svg Xml OpenGL)
|
||||
# package requires Qt 5/6
|
||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui Widgets PrintSupport Svg Xml OpenGL REQUIRED)
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets PrintSupport Svg Xml OpenGL REQUIRED)
|
||||
find_package(JKQTCommon@JKQTP_CURRENT_TARGET_SHAREDPART@Lib REQUIRED PATHS ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_MODULE_PATH})
|
||||
find_package(JKQTMathText@JKQTP_CURRENT_TARGET_SHAREDPART@Lib REQUIRED PATHS ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_MODULE_PATH})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user