Skip to content

Commit

Permalink
compatible with both Qt5 and Qt6
Browse files Browse the repository at this point in the history
  • Loading branch information
LiangliangNan committed Dec 14, 2024
1 parent e06cff0 commit 1ccac0b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
8 changes: 5 additions & 3 deletions code/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.12)

if (APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "12.12" CACHE STRING "Minimum OS X deployment version" FORCE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version" FORCE)
message(STATUS "Minimum OS X deployment version: ${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif ()

Expand All @@ -19,7 +19,7 @@ endif()

################################################################################

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

################################################################################
Expand All @@ -40,7 +40,6 @@ set(POLYFIT_ROOT ${CMAKE_CURRENT_LIST_DIR})
set(POLYFIT_INCLUDE_DIR ${POLYFIT_ROOT} ${CMAKE_CURRENT_BINARY_DIR})
set(POLYFIT_SOURCE_DIR ${POLYFIT_ROOT})


set(POLYFIT_glpk_DIR ${POLYFIT_ROOT}/3rd_glpk)
set(POLYFIT_lpsolve_DIR ${POLYFIT_ROOT}/3rd_lpsolve)
set(POLYFIT_qglviewer_DIR ${POLYFIT_ROOT}/3rd_QGLViewer)
Expand All @@ -51,6 +50,9 @@ set(POLYFIT_glew_DIR ${POLYFIT_ROOT}/3rd_glew)
### conditionally compile certain modules depending on libraries found on the system
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)

if (POLICY CMP0167)
cmake_policy(SET CMP0167 NEW)
endif ()
find_package(Boost REQUIRED)

################################################################################
Expand Down
7 changes: 1 addition & 6 deletions code/cmake/UseQt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@
# and links to the qtmain.lib library on Windows.
# ------------------------------------------------------------------------------


# Qt6 minimum compiler version
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
Expand All @@ -67,7 +62,7 @@ set(CMAKE_AUTORCC ON)
# This will find the Qt files.
find_package(Qt6 COMPONENTS Core Widgets OpenGL OpenGLWidgets Xml QUIET)
if (Qt6_FOUND)
message(STATUS "Found Qt6 version: ${Qt5Core_VERSION}")
message(STATUS "Found Qt6 version: ${Qt6Core_VERSION}")
set(QtLibs Qt::Core Qt::Widgets Qt::OpenGL Qt::OpenGLWidgets Qt::Xml)
else()
find_package(Qt5 COMPONENTS Core Widgets OpenGL Xml QUIET)
Expand Down

0 comments on commit 1ccac0b

Please sign in to comment.