summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2015-07-13 13:19:05 +0800
committerIru Cai <mytbk920423@gmail.com>2015-07-13 13:19:05 +0800
commitb806d39091b432389e906146b10f16aa707cae17 (patch)
tree9c09641cbedcc25a12b26300d55b7fd39ffb1eb1 /CMakeLists.txt
parent2cd2984086f726856126d878e943b9870cef293d (diff)
downloadfqterm-b806d39091b432389e906146b10f16aa707cae17.tar.xz
Qt4 and Qt5 in one CMakeList: CMakeLists.txt{,.linux}
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt72
1 files changed, 43 insertions, 29 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ed6cede..b8d3dd2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,7 @@ project(fqterm)
set(FQTERM_VERSION "0.9.8")
-cmake_minimum_required( VERSION 2.4.2 FATAL_ERROR )
+cmake_minimum_required( VERSION 2.8.11 FATAL_ERROR )
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
@@ -22,19 +22,31 @@ include(GetGitRevisionDescription)
git_describe(MCGGIT_WC_REVISION)
message("Git revision: " ${MCGGIT_WC_REVISION})
-find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork QtScript QtXml REQUIRED)
-IF(APPLE)
-ELSE(APPLE)
-include(${QT_USE_FILE})
-ENDIF(APPLE)
-
-qt4_add_translation(fqterm_qm_files
- ${CMAKE_SOURCE_DIR}/res/dict/fqterm_zh_CN.ts
- ${CMAKE_SOURCE_DIR}/res/dict/ui_zh_CN.ts
- ${CMAKE_SOURCE_DIR}/res/dict/protocol_zh_CN.ts
- ${CMAKE_SOURCE_DIR}/res/dict/common_zh_CN.ts
-)
-
+SET(USE_QT5 OFF CACHE PATH "Do the Qt5 build")
+
+IF(USE_QT5)
+ set(CMAKE_INCLUDE_CURRENT_DIR ON)
+ set(CMAKE_AUTOMOC ON)
+ find_package(Qt5Core REQUIRED)
+ find_package(Qt5Widgets REQUIRED)
+ find_package(Qt5LinguistTools REQUIRED)
+ qt5_add_translation(fqterm_qm_files
+ ${CMAKE_SOURCE_DIR}/res/dict/fqterm_zh_CN.ts
+ ${CMAKE_SOURCE_DIR}/res/dict/ui_zh_CN.ts
+ ${CMAKE_SOURCE_DIR}/res/dict/protocol_zh_CN.ts
+ ${CMAKE_SOURCE_DIR}/res/dict/common_zh_CN.ts
+ )
+ELSE(USE_QT5)
+ find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork QtScript QtXml REQUIRED)
+ include(${QT_USE_FILE})
+ qt4_add_translation(fqterm_qm_files
+ ${CMAKE_SOURCE_DIR}/res/dict/fqterm_zh_CN.ts
+ ${CMAKE_SOURCE_DIR}/res/dict/ui_zh_CN.ts
+ ${CMAKE_SOURCE_DIR}/res/dict/protocol_zh_CN.ts
+ ${CMAKE_SOURCE_DIR}/res/dict/common_zh_CN.ts
+ )
+ENDIF(USE_QT5)
+
add_custom_target(fqterm_qm_target
DEPENDS ${fqterm_qm_files}
)
@@ -47,21 +59,23 @@ else (PYTHONLIBS_FOUND)
SET(PYTHON_LIB)
endif (PYTHONLIBS_FOUND)
-IF(WIN32)
- FILE(READ ${QT_LIBRARY_DIR}/QtCore.prl FQ_CORE_QT_CONFIG)
-ELSE(WIN32)
- IF(APPLE)
- FILE(READ ${QT_LIBRARY_DIR}/QtCore.framework/QtCore.prl FQ_CORE_QT_CONFIG)
- ELSE(APPLE)
- FILE(READ ${QT_LIBRARY_DIR}/libQtCore.prl FQ_CORE_QT_CONFIG)
- ENDIF(APPLE)
-ENDIF(WIN32)
-
-IF(NOT FQ_CORE_QT_CONFIG MATCHES "static")
- SET(FQTERM_USE_STATIC_QT false)
-ELSE(NOT FQ_CORE_QT_CONFIG MATCHES "static")
- SET(FQTERM_USE_STATIC_QT true)
-ENDIF(NOT FQ_CORE_QT_CONFIG MATCHES "static")
+if (NOT USE_QT5)
+ IF(WIN32)
+ FILE(READ ${QT_LIBRARY_DIR}/QtCore.prl FQ_CORE_QT_CONFIG)
+ ELSE(WIN32)
+ IF(APPLE)
+ FILE(READ ${QT_LIBRARY_DIR}/QtCore.framework/QtCore.prl FQ_CORE_QT_CONFIG)
+ ELSE(APPLE)
+ FILE(READ ${QT_LIBRARY_DIR}/libQtCore.prl FQ_CORE_QT_CONFIG)
+ ENDIF(APPLE)
+ ENDIF(WIN32)
+
+ IF(NOT FQ_CORE_QT_CONFIG MATCHES "static")
+ SET(FQTERM_USE_STATIC_QT false)
+ ELSE(NOT FQ_CORE_QT_CONFIG MATCHES "static")
+ SET(FQTERM_USE_STATIC_QT true)
+ ENDIF(NOT FQ_CORE_QT_CONFIG MATCHES "static")
+endif(NOT USE_QT5)
SET(SUB_CMAKELIST "UNKNOWN")