forked from volkszaehler/vzlogger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
175 lines (151 loc) · 5.83 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# -*- mode: cmake; -*-
project(vzlogger)
cmake_minimum_required(VERSION 2.6.2 FATAL_ERROR)
if(POLICY CMP0011)
cmake_policy(SET CMP0011 NEW)
endif(POLICY CMP0011)
set(VZLOGGER_MAJOR_VERSION 0)
set(VZLOGGER_MINOR_VERSION 3)
set(VZLOGGER_SUB_VERSION 5)
set(VERSION_SEP "-")
set(VZLOGGER_SHORT_VERSION "${VZLOGGER_MAJOR_VERSION}${VERSION_SEP}${VZLOGGER_MINOR_VERSION}")
set(VZLOGGER_VERSION "${VZLOGGER_SHORT_VERSION}${VERSION_SEP}${VZLOGGER_SUB_VERSION}")
set(VZLOGGER_RPM_VERSION "${VZLOGGER_MAJOR_VERSION}.${VZLOGGER_MINOR_VERSION}.${VZLOGGER_SUB_VERSION}")
set(VERSION_DATE "2012-02-20")
set(PACKAGE_STRING "${PROJECT_NAME} ${VZLOGGER_RPM_VERSION}")
set(VERSION "${VZLOGGER_RPM_VERSION}")
set(CMAKE_VERBOSE_MAKEFILE 1)
###########################################################
# Where are the additional libraries installed? Note: provide includes
# path here, subsequent checks will resolve everything else
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
include (UseCodeCoverage)
message("Compiling for target '${TARGET}'")
if( TARGET )
if( ${TARGET} STREQUAL "ar71xx")
include ( OpenWRT )
message("Compiling for ar71xx")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(LINK_FLAGS_RELEASE "-static")
endif( ${TARGET} STREQUAL "ar71xx")
else( TARGET )
include ( CompilerFlags )
endif( TARGET )
include ( ConfigureMacro )
# options
OPTION(ENABLE_SML
"enable support for smart messaging language (def=yes)])"
On)
OPTION(ENABLE_LOCAL
"enable support for local HTTPd (def=yes)]"
On)
OPTION(WITH_READER
"compile reader to for testing your meters (def=yes)])"
On)
# find dependencies
# libsml
if( ENABLE_SML )
include(FindSML)
if(SML_FOUND)
set(SML_SUPPORT 1)
include_directories(${SML_INCLUDE_DIR})
endif(SML_FOUND)
endif( ENABLE_SML )
if(ENABLE_LOCAL)
include(FindMicroHttpd)
if(MICROHTTPD_FOUND)
set(MICROHTTPD_SUPPORT 1)
endif(MICROHTTPD_FOUND)
endif(ENABLE_LOCAL)
IF(NOT WIN32)
include(FindThreads)
ENDIF(NOT WIN32)
# libjson
include(FindJson)
if( NOT JSON_FOUND)
message(FATAL_ERROR "libjson ist required.
Install json or call cmake -DJSON_HOME=path_to_json_install")
endif( NOT JSON_FOUND)
include_directories(${JSON_INCLUDE_DIR})
# check for curl
IF(WIN32)
add_definitions(-DCURL_STATICLIB)
include(FindCURL_WIN32)
else(WIN32)
# add_definitions(-DCURL_STATICLIB)
include(FindCurl)
include(FindGnutls)
endif(WIN32)
find_library(LIBUUID uuid)
find_library(LIBGCRYPT gcrypt)
include_directories(${CMAKE_BINARY_DIR})
include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(${CMAKE_SOURCE_DIR})
add_definitions(-DHAVE_CONFIG_HPP)
myconfigure_file(
${CMAKE_CURRENT_SOURCE_DIR}/config.hpp.in
${CMAKE_CURRENT_BINARY_DIR}/config.hpp
)
add_subdirectory(src)
# enable unit testing
include(CTest)
enable_testing()
### print some output for the user
message("")
message(" ***** Configuration parameters *****")
message(" prefix: ${CMAKE_INSTALL_PREFIX}")
message(" json: -L${JSON_LIBRARY} -I${JSON_INCLUDE_DIR}")
message(" sml: -L${SML_LIBRARY} -I${SML_INCLUDE_DIR}")
message(" microhttpd: -L${MICROHTTPD_LIBRARY} -I${MICROHTTPD_INCLUDE_DIR}")
if( NOT SML_FOUND)
message(FATAL_ERROR "libsml ist required.
Install libsml or call cmake -DSML_HOME=path_to_sml_install")
endif( NOT SML_FOUND)
if( NOT MICROHTTPD_FOUND )
message(FATAL_ERROR "microhttpd ist required.
Install microhttpd or call cmake -DMICROHTTPD_HOME=path_to_microhttpd_install")
endif( NOT MICROHTTPD_FOUND )
# add some files to the installation target
INSTALL(FILES README INSTALL COPYING DESTINATION
share/doc/vzlogger-${VZLOGGER_MAJOR_VERSION}-${VZLOGGER_MINOR_VERSION}
)
# CPACK packaging
INCLUDE(InstallRequiredSystemLibraries)
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS On)
#set(CPACK_SOURCE_GENERATOR "TGZ;TBZ2;PKG")
set(CPACK_SOURCE_GENERATOR "TGZ;TBZ2")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "volkszaehler.org ist ein freies Smart Meter (hier: intelligenter Stromzähler) im Selbstbau.")
set(CPACK_PACKAGE_VENDOR "Steffen Vogel")
set(CPACK_PACKAGE_CONTACT "Steffen Vogel <[email protected]>")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Steffen Vogel <[email protected]>")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
set(CPACK_PACKAGE_VERSION_MAJOR ${VZLOGGER_MAJOR_VERSION})
set(CPACK_PACKAGE_VERSION_MINOR ${VZLOGGER_MINOR_VERSION})
set(CPACK_PACKAGE_VERSION_PATCH ${VZLOGGER_SUB_VERSION})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}-${VZLOGGER_MAJOR_VERSION}.${VZLOGGER_MINOR_VERSION}")
set(CPACK_SOURCE_IGNORE_FILES "/CVS/;/.svn/;.swp$;.#;/#;.*~;cscope.*;build.*")
IF(WIN32 AND NOT UNIX)
set(CPACK_GENERATOR "NSIS")
set(CPACK_NSIS_PACKAGE_NAME "Gridlicense Demo Tools")
# set(CPACK_PACKAGE_EXECUTABLES "gui4" "Grid License Demo Frontend")
set(CPACK_PACKAGE_DEFAULT_LOCATION ${INSTALL_DIR})
# sure there is at least one set of four (4) backlasshes.
set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\vzlogger.exe")
set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} VZlogger")
set(CPACK_NSIS_HELP_LINK "http://volkszaehler.org/")
set(CPACK_NSIS_URL_INFO_ABOUT "http://wiki.volkszaehler.org/software/controller/vzlogger")
set(CPACK_NSIS_CONTACT "Steffen Vogel <[email protected]>")
set(CPACK_NSIS_MODIFY_PATH ON)
# set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CMAKE_PROJECT_NAME}-${EWS_VERSION}")
# set(CPACK_NSIS_MENU_LINKS "${EWS_WEBSITE}" "Homepage for ${EWS_APP_NAME}")
set(CPACK_NSIS_DEFINES " !define MUI_WELCOMEPAGE_TITLE_3LINES 1
!define MUI_FINISHPAGE_TITLE_3LINES 1")
else(WIN32 AND NOT UNIX)
#set(CPACK_SET_DESTDIR On)
set(CPACK_SOURCE_STRIP_FILES "")
set(CPACK_GENERATOR "TGZ;TBZ2;TZ;DEB;RPM")
set(CPACK_RPM_PACKAGE_RELOCATABLE 1)
set(CPACK_SYSTEM_NAME ${CMAKE_HOST_SYSTEM_PROCESSOR})
endif(WIN32 AND NOT UNIX)
include(CPack)