mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4448 Clean up Qt5-detection CVF
This commit is contained in:
@@ -12,16 +12,6 @@ endif()
|
||||
|
||||
find_package(OpenGL)
|
||||
|
||||
if (CEE_USE_QT5)
|
||||
find_package(Qt5 COMPONENTS Core Gui OpenGL Widgets REQUIRED)
|
||||
else()
|
||||
find_package(Qt4 COMPONENTS QtCore QtGui QtOpenGL REQUIRED)
|
||||
include(${QT_USE_FILE})
|
||||
if (QT4_FOUND)
|
||||
message(STATUS "Found Qt4")
|
||||
endif(QT4_FOUND)
|
||||
endif(CEE_USE_QT5)
|
||||
|
||||
include_directories(${LibCore_SOURCE_DIR})
|
||||
include_directories(${LibGeometry_SOURCE_DIR})
|
||||
include_directories(${LibRender_SOURCE_DIR})
|
||||
@@ -31,7 +21,6 @@ include_directories(${LibUtilities_SOURCE_DIR})
|
||||
|
||||
set(CEE_LIBS LibUtilities LibGuiQt LibViewing LibRender LibGeometry LibIo LibCore)
|
||||
|
||||
|
||||
set(CEE_SOURCE_FILES
|
||||
QMVFactory.cpp
|
||||
QMVMain.cpp
|
||||
@@ -45,37 +34,37 @@ QMVMainWindow.h
|
||||
QMVWidget.h
|
||||
)
|
||||
|
||||
# Run MOC on the headers
|
||||
add_definitions(-DCVF_USING_CMAKE)
|
||||
set(MOC_SOURCE_FILES)
|
||||
# Qt
|
||||
if (CEE_USE_QT5)
|
||||
find_package(Qt5 COMPONENTS REQUIRED Core Gui Widgets OpenGL)
|
||||
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL)
|
||||
qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES} )
|
||||
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::OpenGL Qt5::Widgets)
|
||||
else()
|
||||
find_package(Qt4 COMPONENTS QtCore QtGui QtOpenGl REQUIRED)
|
||||
include(${QT_USE_FILE})
|
||||
qt4_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES} )
|
||||
endif(CEE_USE_QT5)
|
||||
|
||||
# Run MOC on the headers
|
||||
add_definitions(-DCVF_USING_CMAKE)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${CEE_SOURCE_FILES} ${MOC_SOURCE_FILES})
|
||||
target_link_libraries(${PROJECT_NAME} ${CEE_LIBS} ${OPENGL_LIBRARIES} ${QT_LIBRARIES})
|
||||
|
||||
if (CEE_USE_QT5)
|
||||
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}>
|
||||
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)
|
||||
# Copy Qt Dlls
|
||||
else()
|
||||
# Copy Qt Dlls
|
||||
if (MSVC)
|
||||
set (QTLIBLIST QtCore QtGui QtOpenGl)
|
||||
foreach (qtlib ${QTLIBLIST})
|
||||
|
||||
# Debug
|
||||
execute_process(COMMAND cmake -E copy_if_different ${QT_BINARY_DIR}/${qtlib}d4.dll ${CMAKE_BINARY_DIR}/Debug/${qtlib}d4.dll)
|
||||
|
||||
# Release
|
||||
execute_process(COMMAND cmake -E copy_if_different ${QT_BINARY_DIR}/${qtlib}4.dll ${CMAKE_BINARY_DIR}/Release/${qtlib}4.dll)
|
||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${QT_BINARY_DIR}/$<IF:$<CONFIG:Debug>,${qtlib}d4.dll,${qtlib}4.dll> $<TARGET_FILE_DIR:${PROJECT_NAME}>
|
||||
)
|
||||
endforeach( qtlib )
|
||||
endif(MSVC)
|
||||
endif(CEE_USE_QT5)
|
||||
endif(CEE_USE_QT5)
|
||||
|
||||
Reference in New Issue
Block a user