Caf build fixes for CEE_USE_QT5

This commit is contained in:
Gaute Lindkvist 2019-05-31 10:22:30 +02:00
parent db97951a80
commit 5365f4dd7d
17 changed files with 50 additions and 73 deletions

View File

@ -9,7 +9,9 @@ if (MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11))
endif()
# Qt
option(CEE_USE_QT5 "Use Qt5" OFF)
if (NOT DEFINED(CEE_USE_QT5))
option(CEE_USE_QT5 "Use Qt5" OFF)
endif(NOT DEFINED(CEE_USE_QT5))
if (CEE_USE_QT5)
find_package(Qt5 COMPONENTS REQUIRED Core Gui OpenGL Widgets)

View File

@ -12,8 +12,6 @@ set( MOC_HEADER_FILES
cafMessagePanel.h
)
option(CEE_USE_QT5 "Use Qt5" OFF)
if (CEE_USE_QT5)
find_package(Qt5 COMPONENTS REQUIRED Core Gui Widgets OpenGL)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL)

View File

@ -9,8 +9,6 @@ set( MOC_HEADER_FILES
cafPopupMenuButton.h
)
option(CEE_USE_QT5 "Use Qt5" OFF)
if (CEE_USE_QT5)
find_package(Qt5 COMPONENTS REQUIRED Core Gui Widgets)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets)

View File

@ -10,8 +10,6 @@ set (MOC_HEADER_FILES
)
# Qt
option(CEE_USE_QT5 "Use Qt5" OFF)
if (CEE_USE_QT5)
find_package(Qt5 COMPONENTS REQUIRED Core Gui Widgets)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets)

View File

@ -3,8 +3,6 @@ cmake_minimum_required (VERSION 2.8.12)
project (cafPdmCvf)
# Qt
option(CEE_USE_QT5 "Use Qt5" OFF)
if (CEE_USE_QT5)
find_package(Qt5 COMPONENTS REQUIRED Core Gui Widgets)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets)

View File

@ -3,8 +3,6 @@ cmake_minimum_required (VERSION 2.8.12)
project (cafProjectDataModel)
# Qt
option(CEE_USE_QT5 "Use Qt5" OFF)
if (CEE_USE_QT5)
find_package(Qt5 COMPONENTS REQUIRED Core Gui Widgets)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets)

View File

@ -2,8 +2,6 @@ cmake_minimum_required (VERSION 2.8.12)
project (cafPdmCore)
# Qt
option(CEE_USE_QT5 "Use Qt5" OFF)
if (CEE_USE_QT5)
find_package(Qt5 COMPONENTS REQUIRED Core)
set(QT_LIBRARIES Qt5::Core)

View File

@ -2,13 +2,18 @@ cmake_minimum_required (VERSION 2.8.12)
project ( cafPdmCore_UnitTests )
find_package(Qt5Core CONFIG QUIET)
if (Qt5Core_FOUND)
find_package(Qt5 CONFIG REQUIRED Core Gui Widgets)
# Qt
if (NOT DEFINED(CEE_USE_QT5))
option(CEE_USE_QT5 "Use Qt5" OFF)
endif(NOT DEFINED(CEE_USE_QT5))
if (CEE_USE_QT5)
find_package(Qt5 COMPONENTS REQUIRED Core Gui Widgets)
set(QT_LIBRARIES Qt5::Core Qt5::Widgets Qt5::Gui)
else()
find_package(Qt4 COMPONENTS QtCore QtGui REQUIRED)
find_package(Qt4 COMPONENTS REQUIRED QtCore QtGui)
include(${QT_USE_FILE})
endif(Qt5Core_FOUND)
endif(CEE_USE_QT5)
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
@ -57,7 +62,7 @@ target_link_libraries ( ${PROJECT_NAME}
)
# Copy Qt Dlls
if (Qt5Core_FOUND)
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}>
@ -65,16 +70,12 @@ if (Qt5Core_FOUND)
endforeach(qtlib)
# Copy Qt Dlls
else()
# Copy Qt Dlls
if (MSVC)
set (QTLIBLIST QtCore QtGui )
set (QTLIBLIST QtCore QtGui)
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(Qt5Core_FOUND)
endif(CEE_USE_QT5)

View File

@ -11,8 +11,6 @@ set (MOC_HEADER_FILES
)
# Qt
option(CEE_USE_QT5 "Use Qt5" OFF)
if (CEE_USE_QT5)
find_package(Qt5 COMPONENTS REQUIRED Core Gui Widgets)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets)

View File

@ -3,8 +3,6 @@ cmake_minimum_required (VERSION 2.8.12)
project (cafPdmXml)
# Qt
option(CEE_USE_QT5 "Use Qt5" OFF)
if (CEE_USE_QT5)
find_package(Qt5 COMPONENTS REQUIRED Core Xml)
set(QT_LIBRARIES Qt5::Core Qt5::Xml)

View File

@ -2,13 +2,17 @@ cmake_minimum_required (VERSION 2.8.12)
project ( cafPdmXml_UnitTests )
find_package(Qt5Core CONFIG QUIET)
if (Qt5Core_FOUND)
find_package(Qt5 CONFIG REQUIRED Core Xml)
if (NOT DEFINED(CEE_USE_QT5))
option(CEE_USE_QT5 "Use Qt5" OFF)
endif(NOT DEFINED(CEE_USE_QT5))
if (CEE_USE_QT5)
find_package(Qt5 COMPONENTS REQUIRED Core Xml)
set(QT_LIBRARIES Qt5::Core Qt5::Xml)
else()
find_package(Qt4 COMPONENTS QtCore QtXml REQUIRED)
find_package(Qt4 COMPONENTS REQUIRED QtCore QtXml)
include(${QT_USE_FILE})
endif(Qt5Core_FOUND)
endif(CEE_USE_QT5)
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
@ -49,18 +53,13 @@ if (Qt5Core_FOUND)
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)
set (QTLIBLIST QtCore QtXml)
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(Qt5Core_FOUND)

View File

@ -3,7 +3,9 @@ cmake_minimum_required (VERSION 2.8.12)
project ( cafProjectDataModel_UnitTests )
# Qt
option(CEE_USE_QT5 "Use Qt5" OFF)
if (NOT DEFINED(CEE_USE_QT5))
option(CEE_USE_QT5 "Use Qt5" OFF)
endif(NOT DEFINED(CEE_USE_QT5))
if (CEE_USE_QT5)
find_package(Qt5 COMPONENTS REQUIRED Core Xml Gui)
@ -53,18 +55,13 @@ if (CEE_USE_QT5)
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 QtXml)
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)

View File

@ -20,7 +20,9 @@ set( QRC_FILES
textedit.qrc
)
option(CEE_USE_QT5 "Use Qt5" OFF)
if (NOT DEFINED(CEE_USE_QT5))
option(CEE_USE_QT5 "Use Qt5" OFF)
endif(NOT DEFINED(CEE_USE_QT5))
if (CEE_USE_QT5)
find_package(Qt5 COMPONENTS REQUIRED Core Gui Widgets OpenGL)
@ -66,10 +68,6 @@ add_executable ( ${PROJECT_NAME}
${QRC_FILES_CPP}
)
if (Qt5Core_FOUND)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::OpenGL Qt5::Widgets)
endif()
set (TAP_LINK_LIBRARIES
cafUserInterface
)

View File

@ -46,8 +46,6 @@ set (MOC_HEADER_FILES
cafPdmUiPickableLineEditor.h
)
option(CEE_USE_QT5 "Use Qt5" OFF)
if (CEE_USE_QT5)
find_package(Qt5 COMPONENTS REQUIRED Core Gui Widgets)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets)

View File

@ -9,8 +9,6 @@ set( MOC_HEADER_FILES
cafViewer.h
)
option(CEE_USE_QT5 "Use Qt5" OFF)
if (CEE_USE_QT5)
find_package(Qt5 COMPONENTS REQUIRED Core Gui Widgets OpenGL)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL)

View File

@ -6,8 +6,6 @@ project (cafVizExtensions)
find_package( OpenGL )
# Qt
option(CEE_USE_QT5 "Use Qt5" OFF)
if (CEE_USE_QT5)
find_package(Qt5 COMPONENTS REQUIRED Core Gui Widgets OpenGL)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL)

View File

@ -2,13 +2,15 @@ cmake_minimum_required (VERSION 2.8.12)
project (TestCafAndVizFwk)
find_package(Qt5 CONFIG COMPONENTS Core)
if (Qt5Core_FOUND)
find_package(Qt5 CONFIG REQUIRED Core Gui OpenGL Widgets)
option(CEE_USE_QT5 "Use Qt5" OFF)
if (CEE_USE_QT5)
find_package(Qt5 COMPONENTS REQUIRED Core Gui OpenGL Widgets)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::OpenGL Qt5::Widgets)
else()
find_package(Qt4 COMPONENTS QtCore QtGui QtMain QtOpenGL REQUIRED)
find_package(Qt4 COMPONENTS QtCore QtGui QtMain QtOpenGl REQUIRED)
include(${QT_USE_FILE})
endif(Qt5Core_FOUND)
endif(CEE_USE_QT5)
# Libraries
add_subdirectory(AppFwk/cafProjectDataModel/cafPdmCore)