-
Notifications
You must be signed in to change notification settings - Fork 24
/
CMakeLists.txt
48 lines (38 loc) · 1.35 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
cmake_minimum_required(VERSION 3.0)
# Project name.
set(PROJECT qcron)
project(${PROJECT})
set(SOURCE_DIR ${CMAKE_SOURCE_DIR}/src)
set(ARCHIVE_OUTPUT_DIR ${CMAKE_SOURCE_DIR}/lib)
set(LIBRARY_OUTPUT_DIR ${CMAKE_SOURCE_DIR}/lib)
set(PUBLIC_HEADER_DIR ${CMAKE_SOURCE_DIR}/include)
if (WIN32)
set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/install)
endif()
set(${PROJECT}_INCLUDE_DIR
${SOURCE_DIR} CACHE STRING "${PROJECT} include directory")
# -Wmissing-declarations delete because it would not make Qt Resource
# Files compiles
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wredundant-decls \
-Wcast-align -Wmissing-include-dirs -Wswitch-enum -Wswitch-default \
-Wextra -Wall -Werror -Winvalid-pch -Wredundant-decls -Wformat=2 \
-Wmissing-format-attribute -Wformat-nonliteral")
option(WITH_UNIT_TESTS "enable building unit test executable" OFF)
#option(WITH_BENCHMARK "enable building benchmark executable" OFF)
# Dependencies
set(QT_COMPONENTS Core Test)
## Qt5
if (WIN32)
### Required because on Windows, FindQt5.cmake is not always available.
set (CMAKE_PREFIX_PATH ${QT_INSTALL_PATH})
endif()
### Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
### Find the Qt components.
find_package(Qt5 COMPONENTS ${QT_COMPONENTS} REQUIRED)
# Source
add_subdirectory(src)
if(WITH_UNIT_TESTS)
enable_testing()
add_subdirectory(test)
endif()