source: CMakeLists.txt@ 01a620f

Last change on this file since 01a620f was 16cceaa, checked in by Joachim Langenbach <joachim.langenbach@…>, 11 years ago
  • Added php-slim as an external (to use it, if enabled by the user; s. WITH_LOCAL_PHPSLIM variable in CMakeLists.txt)
    • Added CMake structure

Signed-off-by: Joachim Langenbach <joachim.langenbach@…>

  • Property mode set to 100644
File size: 5.0 KB
Line 
1######################
2#
3# Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
4#
5# This library is free software; you can redistribute it and/or
6# modify it under the terms of the GNU Lesser General Public
7# License as published by the Free Software Foundation; either
8# version 2.1 of the License, or (at your option) any later version.
9#
10# This library is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# Lesser General Public License for more details.
14#
15# You should have received a copy of the GNU Lesser General Public
16# License along with this library; if not, write to the Free Software
17# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18# MA 02110-1301 USA.
19#
20######################
21
22CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
23
24SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
25
26PROJECT(siweather)
27
28SET(TARGET_VERSION_MAJOR 0 )
29SET(TARGET_VERSION_MINOR 1 )
30SET(${PROJECT_NAME}_PATCH_LEVEL 0 )
31SET(${PROJECT_NAME}_VERSION
32 "${TARGET_VERSION_MAJOR}.${TARGET_VERSION_MINOR}.${${PROJECT_NAME}_PATCH_LEVEL}" )
33SET(VERSION ${${PROJECT_NAME}_VERSION})
34
35INCLUDE(CTest)
36
37OPTION(BUILD_DEBUG "Build in debug mode" OFF)
38OPTION(WITH_WEBSERVICE "Build webservice" ON)
39OPTION(WITH_WEBCLIENT "Build web client" OFF)
40OPTION(WITH_CLIENT "Build client (runs on the weather station)" OFF)
41OPTION(WITH_LOCAL_PHPSLIM "Install PHP slim from this repository" OFF)
42
43SET(BUILD_DEBUG_WANTED ${BUILD_DEBUG})
44SET(WITH_WEBSERVICE_WANTED ${WITH_WEBSERVICE})
45SET(WITH_WEBCLIENT_WANTED ${WITH_WEBCLIENT})
46SET(WITH_CLIENT_WANTED ${WITH_CLIENT})
47SET(WITH_LOCAL_PHPSLIM_WANTED ${WITH_LOCAL_PHPSLIM})
48
49# enable automatic moc by CMAKE
50SET(CMAKE_AUTOMOC ON)
51
52SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -fPIC")
53IF(NOT APPLE)
54 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
55ENDIF(NOT APPLE)
56IF(MSVC)
57 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_NO_EXCEPTIONS -Zc:wchar_t-")
58ELSE(MSVC)
59 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -DQT_NO_EXCEPTIONS -fno-check-new -fno-common")
60ENDIF(MSVC)
61IF(NOT WIN32 AND NOT APPLE)
62# SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--fatal-warnings -lc --disable-auto-import")
63 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--fatal-warnings -lc")
64 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi")
65ENDIF(NOT WIN32 AND NOT APPLE)
66IF(BUILD_DEBUG AND NOT MSVC)
67 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
68 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
69ENDIF(BUILD_DEBUG AND NOT MSVC)
70ADD_DEFINITIONS(${QT_DEFINITIONS})
71
72# directory to install binaries
73SET(bin_DIR ${CMAKE_INSTALL_PREFIX}/bin)
74IF(WIN32)
75 SET(bin_DIR .)
76ENDIF(WIN32)
77
78# shared library directory ($LIB_INSTALL_DIR)
79# and directory for plugins, translations, ... ($share_DIR)
80IF(NOT WIN32)
81 SET(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib/" CACHE STRING "Where to install the library files to")
82ENDIF(NOT WIN32)
83SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
84IF(UNIX)
85 SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
86 SET(share_DIR ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME})
87 SET(man_DIR ${CMAKE_INSTALL_PREFIX}/share/man)
88ELSE(UNIX)
89 SET(LIB_INSTALL_DIR ${bin_DIR})
90 SET(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
91 SET(share_DIR ${bin_DIR})
92 SET(man_DIR ${bin_DIR}/man)
93ENDIF(UNIX)
94# directory to install language files
95SET(qm_DIR ${share_DIR}/lang)
96#directory to install rcc files
97SET(rcc_DIR ${share_DIR}/rcc)
98# directory to install dependency files
99SET(depends_DIR ${share_DIR}/depends)
100SET(apidocs_DIR ${share_DIR}/apidocs)
101SET(pkgconfig_DIR ${LIB_INSTALL_DIR}/pkgconfig/)
102SET(WEB_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/htdocs)
103
104ADD_SUBDIRECTORY(src)
105ADD_SUBDIRECTORY(externals)
106
107# printing chosen configuration
108MESSAGE("######################################################")
109MESSAGE("")
110MESSAGE("CONFIGURATION")
111MESSAGE("")
112MESSAGE("CMAKE_SHARED_LINKER_FLAGS: ${CMAKE_SHARED_LINKER_FLAGS}")
113MESSAGE("CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
114MESSAGE("CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
115MESSAGE("")
116MESSAGE("OPTIONS:")
117MESSAGE(" Name Wanted Used")
118MESSAGE(" BUILD_DEBUG: ${BUILD_DEBUG_WANTED} ${BUILD_DEBUG}")
119MESSAGE(" WITH_WEBSERVICE: ${WITH_WEBSERVICE_WANTED} ${WITH_WEBSERVICE}")
120MESSAGE(" WITH_WEBCLIENT: ${WITH_WEBCLIENT_WANTED} ${WITH_WEBCLIENT}")
121MESSAGE(" WITH_CLIENT: ${WITH_CLIENT_WANTED} ${WITH_CLIENT}")
122MESSAGE(" WITH_LOCAL_PHPSLIM: ${WITH_LOCAL_PHPSLIM_WANTED} ${WITH_LOCAL_PHPSLIM}")
123MESSAGE("")
124MESSAGE("######################################################")
Note: See TracBrowser for help on using the repository browser.