forked from myElrond/flukso_checkhealth
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
138 lines (116 loc) · 5.74 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
# -*- mode: cmake; -*-
project(libflukso)
cmake_minimum_required(VERSION "2.6" FATAL_ERROR)
if(POLICY CMP0011)
cmake_policy(SET CMP0011 NEW)
endif(POLICY CMP0011)
# have the full monty in makefiles
set(CMAKE_VERBOSE_MAKEFILE true)
set(V_MAJOR 0)
set(V_MINOR 1)
set(V_PATCH 0)
# add a path where some libraries might be stored
set(CMAKE_ADDITIONAL_PATH "$ENV{CMAKE_ADDITIONAL_PATH}" CACHE PATH "Path where many locally installed libraries can be found")
###################################################################################################
# No user settings below
###################################################################################################
# Where are the additional libraries installed? Note: provide includes
# path here, subsequent checks will resolve everything else
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${CMAKE_ADDITIONAL_PATH}/include)
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${CMAKE_ADDITIONAL_PATH}/lib)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wno-non-virtual-dtor -g -fomit-frame-pointer")
set(CMAKE_CXX_FLAGS_EXPERIMENTAL "-O0 -g -ggdb -Wall -Werror -W -Wshadow")
set(CMAKE_CXX_FLAGS_EXPERIMENTAL "${CMAKE_CXX_FLAGS_EXPERIMENTAL} -Wunused-variable")
set(CMAKE_CXX_FLAGS_EXPERIMENTAL "${CMAKE_CXX_FLAGS_EXPERIMENTAL} -Wunused-parameter")
set(CMAKE_CXX_FLAGS_EXPERIMENTAL "${CMAKE_CXX_FLAGS_EXPERIMENTAL} -Wunused-function")
set(CMAKE_CXX_FLAGS_EXPERIMENTAL "${CMAKE_CXX_FLAGS_EXPERIMENTAL} -Wunused -Woverloaded-virtual")
set(CMAKE_CXX_FLAGS_EXPERIMENTAL "${CMAKE_CXX_FLAGS_EXPERIMENTAL} -Wno-system-headers")
set(CMAKE_CXX_FLAGS_EXPERIMENTAL "${CMAKE_CXX_FLAGS_EXPERIMENTAL} -Wno-non-virtual-dtor")
set(CMAKE_CXX_FLAGS_EXPERIMENTAL "${CMAKE_CXX_FLAGS_EXPERIMENTAL} -pg -fprofile-generate ")
set(CMAKE_CXX_FLAGS_EXPERIMENTAL "${CMAKE_CXX_FLAGS_EXPERIMENTAL} -fprofile-arcs -ftest-coverage")
# gprof and gcov support
set(CMAKE_CXX_FLAGS_PROFILE "-O0 -g -ggdb -W -Wreturn-type -Wno-shadow")
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_PROFILE} -Wunused-variable -Wunused-parameter")
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_PROFILE} -Wunused-function -Wunused")
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_PROFILE} -Woverloaded-virtual -Wno-system-headers")
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_PROFILE} -Wno-non-virtual-dtor -pg -fprofile-arcs")
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_PROFILE} -ftest-coverage")
# Releases are made with the release build. Optimize code.
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wno-non-virtual-dtor -Werror")
# allways set these flags
set(CMAKE_CXX_FLAGS "-Wall ")
# Check for some compiler stuff
include(CMakeBackwardCompatibilityCXX)
# We depend on boost >= 1.46.1 because of the updated filesystem
# library.
SET(Boost_ADDITIONAL_VERSIONS "1.46.1" "1.48.0" "1.48")
FIND_PACKAGE(Boost 1.46.1 COMPONENTS test_exec_monitor program_options filesystem system)
# curl library
include(FindCurl)
if (CURL_FOUND)
include_directories(${CURL_INCLUDE_DIR})
include_directories(${CURL_INCLUDE_DIRS})
link_directories(${CURL_LIBRARY_DIR})
link_libraries(${CURL_LIBRARY_SHARED})
message(STATUS "CURL: '${CURL_LIBRARY_SHARED}' -I${CURL_INCLUDE_DIR} -I${CURL_INCLUDE_DIRS}")
endif(CURL_FOUND)
include(FindKlio)
if (KLIO_FOUND)
include_directories(${KLIO_INCLUDE_DIR})
include_directories(${KLIO_INCLUDE_DIRS})
link_directories(${KLIO_LIBRARY_DIR})
link_libraries(${KLIO_LIBRARY})
message(STATUS "KLIO: '${KLIO_LIBRARY}' -I${KLIO_INCLUDE_DIR} -I${KLIO_INCLUDE_DIRS}")
endif(KLIO_FOUND)
FIND_PACKAGE(Sqlite)
include(FindPopt)
if (POPT_FOUND)
include_directories(${POPT_INCLUDE_DIR})
include_directories(${POPT_INCLUDE_DIRS})
link_directories(${POPT_LIBRARY_DIR})
#IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# # there's a broken popt library in macports right now - only do
# # dynamic linking. this version seems to be ok.
# link_libraries(${POPT_LIBRARY_SHARED})
#ELSE(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
link_libraries(${POPT_LIBRARY_SHARED})
#ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
message(STATUS "POPT: '${POPT_LIBRARY}' + '${POPT_LIBRARY_SHARED}' -I${POPT_INCLUDE_DIR} -I${POPT_INCLUDE_DIRS}")
else(POPT_FOUND)
message(STATUS "POPT: No popt library found!")
endif(POPT_FOUND)
include(FindJSON)
if (JSON_FOUND)
include_directories(${JSON_INCLUDE_DIR})
include_directories(${JSON_INCLUDE_DIRS})
link_directories(${JSON_LIBRARY_DIR})
link_libraries(${JSON_LIBRARY})
message(STATUS "JSON: '${JSON_LIBRARY}' -I${JSON_INCLUDE_DIR} -I${JSON_INCLUDE_DIRS}")
endif(JSON_FOUND)
# Reflect the package structure
add_subdirectory(libflukso)
add_subdirectory(src)
# add some files to the installation target
INSTALL(FILES README.md LICENSE DESTINATION share/doc/libflukso)
# CPACK packaging
INCLUDE(InstallRequiredSystemLibraries)
SET(CPACK_GENERATOR "STGZ;TGZ;DEB;RPM")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Flukso Tools")
SET(CPACK_PACKAGE_VENDOR "Fraunhofer ITWM")
SET(CPACK_PACKAGE_CONTACT "dalheimer@itwm.fhg.de")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
SET(CPACK_PACKAGE_VERSION_MAJOR ${V_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${V_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${V_PATCH})
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
SET(CPACK_STRIP_FILES "bin/flukso-getvalues;bin/flukso-archive")
SET(CPACK_SOURCE_STRIP_FILES TRUE)
SET(CPACK_PACKAGE_EXECUTABLES "flukso-getvalues" "Retrieve energy consumption data from a Flukso webservice")
SET(CPACK_PACKAGE_EXECUTABLES "flukso-archive" "Archive energy consumption data from a Flukso webservice")
INCLUDE(CPack)
### print some output for the user
message("")
message("***** Configuration *****")
message(" prefix: ${CMAKE_INSTALL_PREFIX}")