File: CMakeLists.txt

package info (click to toggle)
attica 0.4.2-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 1,044 kB
  • sloc: cpp: 8,978; makefile: 7
file content (55 lines) | stat: -rw-r--r-- 1,930 bytes parent folder | download | duplicates (2)
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
49
50
51
52
53
54
55
project(attica)
cmake_minimum_required(VERSION 2.8)

option(QT4_BUILD "Force building with Qt4 even if Qt5 is found")
if (NOT QT4_BUILD)
  find_package(Qt5Core QUIET)
endif()
if (Qt5Core_FOUND)
  message(STATUS "Building with Qt5 support")
  find_package(ECM 0.0.6 REQUIRED NO_MODULE)
  set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH})
  find_package(Qt5Transitional REQUIRED Core Network)
  include(GNUInstallDirs)
  set(LIB_DESTINATION "${CMAKE_INSTALL_LIBDIR}")
else()
  set(QT_MIN_VERSION "4.7.0")
  find_package(Qt4 REQUIRED)
  set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
  set(LIB_DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_LIBRARY_ARCHITECTURE}" CACHE STRING "Library directory name" FORCE)
endif()

if (Qt5Core_FOUND)
  set(CMAKE_LIBATTICA_VERSION_MAJOR 1)
  set(CMAKE_LIBATTICA_VERSION_MINOR 0)
  set(CMAKE_LIBATTICA_VERSION_PATCH 0)
else()
  set(CMAKE_LIBATTICA_VERSION_MAJOR 0)
  set(CMAKE_LIBATTICA_VERSION_MINOR 4)
  set(CMAKE_LIBATTICA_VERSION_PATCH 2)
endif()
set(CMAKE_LIBATTICA_VERSION_STRING  "${CMAKE_LIBATTICA_VERSION_MAJOR}.${CMAKE_LIBATTICA_VERSION_MINOR}.${CMAKE_LIBATTICA_VERSION_PATCH}")

if(NOT MSVC)
    set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -Wall -Wno-switch -O2 -g")
    set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -Wall -Wno-switch -O2")
    set(CMAKE_CXX_FLAGS_DEBUG  "${CMAKE_CXX_FLAGS} -Wall -Wno-switch -g3 -ggdb -O0" CACHE STRING "Debug options." FORCE)
endif(NOT MSVC)

add_definitions( -DQT_NO_CAST_FROM_ASCII )
add_definitions( -DQT_NO_CAST_TO_ASCII )
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)

# Enable static build
option(ATTICA_STATIC_BUILD "Build a static library" Off)

# Enable unit testing
option(ATTICA_ENABLE_TESTS "Enable tests" ON)
if (ATTICA_ENABLE_TESTS)
    enable_testing()
endif (ATTICA_ENABLE_TESTS)

set(CMAKE_INSTALL_NAME_DIR ${LIB_INSTALL_DIR})

add_subdirectory(lib)