mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Prepare CMake to support both Qt5 andf Qt6
CEE_USE_QT6 controls if Qt6 is used. Improved install and package for Qt6, target version Qt 6.5.3 Added Qt6 to github action for AppFwkUnitTest
This commit is contained in:
@@ -1,11 +1,20 @@
|
||||
project(cafPdmScripting_UnitTests)
|
||||
|
||||
find_package(
|
||||
Qt5
|
||||
COMPONENTS
|
||||
REQUIRED Core Xml Gui
|
||||
)
|
||||
set(QT_LIBRARIES Qt5::Core Qt5::Xml Qt5::Gui Qt5::Widgets)
|
||||
if(CEE_USE_QT6)
|
||||
find_package(
|
||||
Qt6
|
||||
COMPONENTS
|
||||
REQUIRED Core Gui Widgets
|
||||
)
|
||||
qt_standard_project_setup()
|
||||
else()
|
||||
find_package(
|
||||
Qt5
|
||||
COMPONENTS
|
||||
REQUIRED Core Xml Gui
|
||||
)
|
||||
set(QT_LIBRARIES Qt5::Core Qt5::Xml Qt5::Gui)
|
||||
endif()
|
||||
|
||||
if(MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11))
|
||||
# VS 2017 : Disable warnings from from gtest code, using deprecated code
|
||||
@@ -16,12 +25,16 @@ endif()
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR} # required for gtest-all.cpp
|
||||
)
|
||||
|
||||
# add the executable
|
||||
add_executable(
|
||||
${PROJECT_NAME} cafPdmScripting_UnitTests.cpp gtest/gtest-all.cpp
|
||||
set(PROJECT_FILES cafPdmScripting_UnitTests.cpp gtest/gtest-all.cpp
|
||||
cafPdmScriptingBasicTest.cpp cafPdmFieldSerializationTest.cpp
|
||||
)
|
||||
|
||||
if(CEE_USE_QT6)
|
||||
qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES})
|
||||
else()
|
||||
add_executable(${PROJECT_NAME} ${PROJECT_FILES})
|
||||
endif(CEE_USE_QT6)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
target_compile_options(
|
||||
cafPdmScripting_UnitTests PRIVATE -Wno-delete-abstract-non-virtual-dtor
|
||||
@@ -29,7 +42,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
endif()
|
||||
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME} cafPdmScripting ${QT_LIBRARIES} ${THREAD_LIBRARY}
|
||||
${PROJECT_NAME} PRIVATE cafPdmScripting ${QT_LIBRARIES} ${THREAD_LIBRARY}
|
||||
)
|
||||
|
||||
source_group("" FILES ${PROJECT_FILES})
|
||||
@@ -45,3 +58,18 @@ if(Qt5Core_FOUND)
|
||||
)
|
||||
endforeach(qtlib)
|
||||
endif(Qt5Core_FOUND)
|
||||
|
||||
# Install
|
||||
install(
|
||||
TARGETS ${PROJECT_NAME}
|
||||
BUNDLE DESTINATION .
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
|
||||
if(CEE_USE_QT6)
|
||||
qt_generate_deploy_app_script(
|
||||
TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script
|
||||
NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS
|
||||
)
|
||||
install(SCRIPT ${deploy_script})
|
||||
endif(CEE_USE_QT6)
|
||||
|
||||
Reference in New Issue
Block a user