mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
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
76 lines
1.8 KiB
CMake
76 lines
1.8 KiB
CMake
project(cafPdmScripting_UnitTests)
|
|
|
|
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
|
|
# related to TR1
|
|
add_definitions(-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)
|
|
endif()
|
|
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR} # required for 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
|
|
)
|
|
endif()
|
|
|
|
target_link_libraries(
|
|
${PROJECT_NAME} PRIVATE cafPdmScripting ${QT_LIBRARIES} ${THREAD_LIBRARY}
|
|
)
|
|
|
|
source_group("" FILES ${PROJECT_FILES})
|
|
|
|
# Copy Qt Dlls
|
|
if(Qt5Core_FOUND)
|
|
foreach(qtlib ${QT_LIBRARIES})
|
|
add_custom_command(
|
|
TARGET ${PROJECT_NAME}
|
|
POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${qtlib}>
|
|
$<TARGET_FILE_DIR:${PROJECT_NAME}>
|
|
)
|
|
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)
|