Skip to content
Snippets Groups Projects
Commit 04360904 authored by hluk's avatar hluk
Browse files

Build with Qt 5 by default

parent 7e7a3623
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@ endif()
OPTION(PEDANTIC "Enable all compiler warnings" OFF)
# Options (cmake -LH)
OPTION(WITH_QT5 "Qt5 support" OFF)
OPTION(WITH_QT5 "Use Qt 5 (disable to use Qt 4 instead)" ON)
OPTION(WITH_TESTS "Run test cases from command line" ${COPYQ_DEBUG})
OPTION(WITH_PLUGINS "Compile plugins" ON)
# Linux-specific options
......@@ -32,26 +32,23 @@ endif()
set(CMAKE_AUTOMOC ON)
# If Qt4 unavailable use Qt5.
if (NOT WITH_QT5)
if (WITH_QT5)
cmake_minimum_required(VERSION 2.8.8)
find_package(Qt5Widgets)
if (NOT Qt5Widgets_FOUND)
message(FATAL_ERROR "Qt 5 is unavailable. To compile with Qt 4 use -DWITH_QT5=OFF.")
endif()
message(STATUS "Building with Qt 5.")
else()
find_package(Qt4)
if (NOT QT4_FOUND)
# Try different executable name.
set(QT_QMAKE_EXECUTABLE "qmake-qt4")
find_package(Qt4)
if (NOT QT4_FOUND)
message(FATAL_ERROR
"Qt 4 is unavailable. To compile with Qt 5 use -DWITH_QT5=TRUE.\n"
"Note: Qt version 5.0.2 and earlier can be unstable on some systems.")
message(FATAL_ERROR "Qt 4 is unavailable. To compile with Qt 5 use -DWITH_QT5=ON.")
endif()
endif()
endif()
if (WITH_QT5)
cmake_minimum_required(VERSION 2.8.8)
find_package(Qt5Widgets REQUIRED)
message(STATUS "Building with Qt 5.")
else()
message(STATUS "Building with Qt 4.")
endif()
......
cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release -G "%CMAKE_GENERATOR%" -DWITH_QT5=ON -DWITH_TESTS=ON
cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release -G "%CMAKE_GENERATOR%" -DWITH_TESTS=ON
......@@ -7,7 +7,6 @@ INSTALL_PREFIX=$(readlink -f "$INSTALL_PREFIX")
cmake_args=(
-DWITH_TESTS=TRUE
-DWITH_QT5=TRUE
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX"
..
)
......
......@@ -10,7 +10,13 @@ cd build
# Configure.
if [ "$CC" == "gcc" ]; then
# GCC build generates coverage.
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_CXX_FLAGS=--coverage -DCMAKE_C_FLAGS=--coverage ..
cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_COMPILER=$COMPILER \
-DCMAKE_CXX_FLAGS=--coverage \
-DCMAKE_C_FLAGS=--coverage \
-DWITH_QT5=OFF \
..
else
qmake CONFIG+=debug QMAKE_CXX=$COMPILER QMAKE_CXXFLAGS="-std=c++11" ..
fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment