#3754 Qt4/Qt5 CMake build configuration for Nightcharts and ExpressionParser

This commit is contained in:
Gaute Lindkvist 2018-11-26 11:27:58 +01:00
parent cc672eb31b
commit 83c5f63291
2 changed files with 25 additions and 1 deletions

View File

@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8)
cmake_minimum_required (VERSION 2.8.12)
project (expressionparser)
@ -7,6 +7,14 @@ if(MSVC)
message(STATUS "MSVC: Enabled increased number of sections in object files")
endif()
find_package(Qt5Core CONFIG QUIET)
if (Qt5Core_FOUND)
find_package(Qt5 CONFIG REQUIRED Core)
else()
find_package(Qt4 COMPONENTS QtCore REQUIRED)
include(${QT_USE_FILE})
endif(Qt5Core_FOUND)
list (APPEND MAIN_SOURCE_FILES
ExpressionParser.h
ExpressionParser.cpp
@ -28,4 +36,8 @@ if(MSVC)
${CMAKE_CURRENT_SOURCE_DIR}
)
if (Qt5Core_FOUND)
target_link_libraries(${PROJECT_NAME} Qt5::Core)
endif()
source_group("" FILES ${PROJECT_FILES})

View File

@ -2,6 +2,14 @@ cmake_minimum_required (VERSION 2.8.12)
project (nightcharts)
find_package(Qt5Core CONFIG QUIET)
if (Qt5Core_FOUND)
find_package(Qt5 CONFIG REQUIRED Core Widgets)
else()
find_package(Qt4 COMPONENTS QtCore QtGui REQUIRED)
include(${QT_USE_FILE})
endif(Qt5Core_FOUND)
list (APPEND MAIN_SOURCE_FILES
nightcharts.h
nightcharts.cpp
@ -19,4 +27,8 @@ target_include_directories(${PROJECT_NAME}
${CMAKE_CURRENT_SOURCE_DIR}
)
if (Qt5Core_FOUND)
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Widgets)
endif()
source_group("" FILES ${PROJECT_FILES})