WSL/SLF GitLab Repository

CMakeLists.txt 17.3 KB
Newer Older
1
2
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/tools/cmake/")
3
4
5

# Version of library
SET(VERSION_MAJOR 2 CACHE INTERNAL "")
6
SET(VERSION_MINOR 3 CACHE INTERNAL "")
7
SET(VERSION_PATCH 0 CACHE INTERNAL "")
8
9
10
11

SET(POPCC popcc)
SET(LIBPREFIX "lib") #make sure ALL plugins are libXXX for ALL plateforms
SET(CMAKE_IMPORT_LIBRARY_PREFIX "lib") #for Visual C++ import libraries
12
13
14
15
16

PROJECT(meteoio)
ADD_SUBDIRECTORY(meteoio/plugins)
ADD_SUBDIRECTORY(meteoio/meteolaws)
ADD_SUBDIRECTORY(meteoio/meteofilters)
Mathias Bavay's avatar
Mathias Bavay committed
17
ADD_SUBDIRECTORY(meteoio)
18
19

###########################################################
20
#platform specific. First, compiler specific flags, then system specific flags
21
#SET(DEBUG_ARITHM ON CACHE BOOL "Force crash the application when doing an arithmetic exception")
22
OPTION( BUILD_SHARED_LIBS "Set to ON to build dynamic libraries" ON )
23
24
INCLUDE("${CMAKE_MODULE_PATH}/BuildVersion.cmake")
BuildVersion()
25

26
27
28
29
30
31
32
33
34
35
IF(MSVC)
	#SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "limited configs"  FORCE)
	SET(WARNINGS "/W4")
	#SET(EXTRA_WARNINGS "/Wp64") #/Wall
	SET(OPTIM "/O2 /DNDEBUG /MD /DNOSAFECHECKS")
	SET(ARCH_OPTIM "/arch:SSE2")
	SET(ARCH_SAFE "")
	SET(DEBUG "/Z7 /Od /D__DEBUG /MDd")
	LIST(APPEND CFLAGS " /D_CRT_SECURE_NO_WARNINGS /EHsc") #Za: strict ansi EHsc: handle c++ exceptions
	SET(_VERSION "/D_VERSION=\\\"${_versionString}\\\"")
36
37
38
	IF(BUILD_SHARED_LIBS)
		ADD_DEFINITIONS(/DMIO_DLL)
	ENDIF(BUILD_SHARED_LIBS)
39
40
ELSE(MSVC)
	#we consider that all other compilers support "-" options and silently ignore what they don't know
41
42
	SET(WARNINGS "-Wall")
	SET(PROFILING "-pg -fprofile-arcs")
43
	SET(DEEP_WARNINGS "-Wunused-value -Wshadow -Wpointer-arith -Wconversion -Wpadded -Winline -Wdisabled-optimization") #-Wfloat-equal
44
45
46
	IF(POPC)
		SET(EXTRA_WARNINGS "-Wextra -Wno-ignored-qualifiers")
	ELSE(POPC)
47
		SET(EXTRA_WARNINGS "-Wextra -pedantic") #-Weffc++
48
	ENDIF(POPC)
49
50
	IF(CMAKE_COMPILER_IS_GNUCXX)
		SET(EXTRA_WARNINGS "${EXTRA_WARNINGS} -ansi")
51
52
53
		IF(WIN32) #for gcc on windows
			SET(CMAKE_SHARED_LINKER_FLAGS "--enable-auto-import")
		ENDIF(WIN32)
54
	ENDIF(CMAKE_COMPILER_IS_GNUCXX)
55
	SET(OPTIM "-g -O3 -DNDEBUG -DNOSAFECHECKS")
56
57
58
59
60
61
	EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
	IF (GCC_VERSION VERSION_GREATER 4.2 OR GCC_VERSION VERSION_EQUAL 4.2)
		SET(ARCH_OPTIM  "-march=native -mtune=native")
	ENDIF()
	SET(ARCH_SAFE  "")
	SET(DEBUG "-g3 -O0 -D__DEBUG")
62
	SET(_VERSION "-D_VERSION=\\\"${_versionString}\\\"")
63
64
65
	IF(BUILD_SHARED_LIBS)
		ADD_DEFINITIONS(-DMIO_DLL)
	ENDIF(BUILD_SHARED_LIBS)
66
67
ENDIF(MSVC)

68
69
IF(UNIX)
	IF(APPLE)
70
		SET(PLATFORM "-DAPPLE")
71
		SET(DLL_EXT "dylib*")
72
		SET(STAT_EXT "a")
73
	ELSE(APPLE)
74
75
76
77
78
		IF(CYGWIN)
			SET(PLATFORM "-DLINUX -DCYGWIN")
		ELSE(CYGWIN)
			SET(PLATFORM "-DLINUX")
		ENDIF(CYGWIN)
79
		SET(DLL_EXT "so*")
80
		SET(STAT_EXT "a")
81
82
83
	ENDIF(APPLE)
ELSE(UNIX)
	IF(WIN32)
84
85
86
		SET(PLATFORM "-D_WIN32")
		SET(DLL_EXT "dll")
		SET(STAT_EXT "a")
87
88
89
	ENDIF(WIN32)
ENDIF(UNIX)

90
IF(NOT CMAKE_BUILD_TYPE)
91
	SET(CMAKE_BUILD_TYPE "release" CACHE STRING "Choose the type of build, options are: debug release coverage " FORCE)
92
93
	SET(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE})
ENDIF(NOT CMAKE_BUILD_TYPE)
94
95

###########################################################
96
97
#targets providing SETs of compiler options
IF(NOT DEST)
98
	SET(DEST "safe" CACHE STRING "Choose safe, optimized, hera" FORCE)
99
ENDIF(NOT DEST)
100

101
102
103
IF (DEST STREQUAL "hera")
	SET(ARCH  "-march=amdfam10")
ENDIF(DEST STREQUAL "hera")
104

105
106
107
IF (DEST STREQUAL "safe")
	SET(ARCH  "${ARCH_SAFE}")
ENDIF(DEST STREQUAL "safe")
108
109

IF(DEST STREQUAL "optimized")
110
	SET(ARCH  "${ARCH_OPTIM}")
111
112
ENDIF(DEST STREQUAL "optimized")

113
#build for use with POPC in parallel objects
114
115
SET(POPC OFF CACHE BOOL "Compile for POPC ON or OFF")

116
###########################################################
117
#finally, SET compile flags
118
IF(POPC)
119
	#SET(POPC_FLAGS "-cxxmain -Dcerr=\\\"cout\\\"")
120
	SET(POPC_FLAGS "-cxxmain")
121
ENDIF(POPC)
122
SET(CMAKE_CXX_FLAGS "${POPC_FLAGS} ${_VERSION} ${ARCH} ${CFLAGS} ${PLATFORM}" CACHE STRING "" FORCE)
123
124
SET(CMAKE_CXX_FLAGS_RELEASE "${OPTIM}" CACHE STRING "" FORCE)
SET(CMAKE_CXX_FLAGS_DEBUG "${DEBUG} ${WARNINGS} ${EXTRA_WARNINGS}" CACHE STRING "" FORCE)
125

126
127
MESSAGE(STATUS "DEBUG CXXFLAGS  : ${CMAKE_CXX_FLAGS_DEBUG}")
MESSAGE(STATUS "RELEASE CXXFLAGS: ${CMAKE_CXX_FLAGS_RELEASE}")
128
129
###########################################################
#plugins
130
SET(PLUGIN_A3DIO ON CACHE BOOL "Compilation A3DIO ON or OFF")
131
132
133
SET(PLUGIN_ARCIO ON CACHE BOOL "Compilation ARCIO ON or OFF")
SET(PLUGIN_ARPSIO ON CACHE BOOL "Compilation ARPSIO ON or OFF")
SET(PLUGIN_BORMAIO OFF CACHE BOOL "Compilation BORMAIO ON or OFF")
134
SET(PLUGIN_COSMOXMLIO OFF CACHE BOOL "Compilation COSMOXMLIO ON or OFF")
135
136
SET(PLUGIN_GEOTOPIO ON CACHE BOOL "Compilation GEOTOPIO ON or OFF")
SET(PLUGIN_GRASSIO ON CACHE BOOL "Compilation GRASSIO ON or OFF")
137
SET(PLUGIN_GRIBIO OFF CACHE BOOL "Compilation GRIBIO ON or OFF")
138
SET(PLUGIN_GSNIO OFF CACHE BOOL "Compilation GSNIO ON or OFF")
139
SET(PLUGIN_IMISIO OFF CACHE BOOL "Compilation IMISIO ON or OFF")
140
141
142
143
SET(PLUGIN_PGMIO ON CACHE BOOL "Compilation PGMIO ON or OFF")
SET(PLUGIN_PNGIO OFF CACHE BOOL "Compilation PNGIO ON or OFF")
SET(PLUGIN_SMETIO ON CACHE BOOL "Compilation SMETIO ON or OFF")
SET(PLUGIN_SNIO ON CACHE BOOL "Compilation SNIO ON or OFF")
144
145
146
147
148
149
SET(PROJ4 OFF CACHE BOOL "Use PROJ4 for the class MapProj ON or OFF")

#some cmake specific things //HACK: should it not be in the plugin Cmake?
IF (GSOAPPP AND NOT EXISTS ${GSOAPPP})
	SET(GSOAPPP NOTFOUND CACHE FORCE)
ENDIF(GSOAPPP AND NOT EXISTS ${GSOAPPP})
150
151
152

###########################################################
#for the install target
153
FILE(GLOB hfiles "meteoio/*.h")
154
FILE(GLOB hpluginfiles "meteoio/plugins/*.h")
155
156
FILE(GLOB hlawsfiles "meteoio/meteolaws/*.h")
FILE(GLOB hfilterfiles "meteoio/meteofilters/*.h")
157
FILE(GLOB hstatsfiles "meteoio/meteostats/*.h")
158
159
160

IF(DEST MATCHES "par")
	FILE(GLOB phfiles "${CMAKE_CURRENT_SOURCE_DIR}/meteoio/*.ph")
161
162
	FILE(GLOB modules "${CMAKE_BINARY_DIR}/lib/*.module")
	INSTALL(FILES ${modules} DESTINATION lib/meteoio COMPONENT libraries)
163
164
ENDIF(DEST MATCHES "par")
INSTALL(FILES ${hfiles} ${phfiles} DESTINATION include/meteoio COMPONENT headers)
165
INSTALL(FILES ${hpluginfiles} DESTINATION include/meteoio/plugins COMPONENT headers)
166
167
INSTALL(FILES ${hlawsfiles} DESTINATION include/meteoio/meteolaws COMPONENT headers)
INSTALL(FILES ${hfilterfiles} DESTINATION include/meteoio/meteofilters COMPONENT headers)
168
INSTALL(FILES ${hstatsfiles} DESTINATION include/meteoio/meteostats COMPONENT headers)
169

170
IF(WIN32) #handle the special case of WIN32 needing import libraries
171
	FILE(GLOB_RECURSE importlibs "lib/libmeteo*.lib")
Mathias Bavay's avatar
Mathias Bavay committed
172
ENDIF(WIN32)
173
FILE(GLOB_RECURSE solibs "lib/libmeteo*.${DLL_EXT}")
174
175
FILE(GLOB_RECURSE plugins "lib/plugins/lib*.${DLL_EXT}")
FILE(GLOB_RECURSE alibs "lib/*.${STAT_EXT}")
176
177

INSTALL(FILES ${solibs} ${importlibs} ${alibs} DESTINATION lib COMPONENT libraries)
178
179
INSTALL(FILES ${plugins} DESTINATION lib/meteoio/plugins COMPONENT plugins)

180
# This is at the end of the file, so that every variables
181
ADD_CUSTOM_TARGET(distclean make clean
182
183
	COMMAND cmake -E remove CMakeCache.txt CPackSourceConfig.cmake CPackConfig.cmake CTestTestfile.cmake DartConfiguration.tcl cmake_install.cmake cmake_uninstall.cmake install_manifest.txt Makefile
	COMMAND cmake -E remove "lib/plugins/lib*.${DLL_EXT}" "lib/libmeteo*.${DLL_EXT}"
184
185
	COMMAND cmake -E remove */CMakeCache.txt */CTestTestfile.cmake */cmake_install.cmake
	COMMAND cmake -E remove */*/CMakeCache.txt */*/CTestTestfile.cmake */*/cmake_install.cmake
186
	COMMAND cmake -E remove_directory CMakeFiles
187
	COMMAND cmake -E remove_directory Testing
188
	COMMAND cmake -E remove_directory meteoio/CMakeFiles
189
190
	COMMAND cmake -E remove_directory meteoio/meteofilters/CMakeFiles
	COMMAND cmake -E remove_directory meteoio/meteolaws/CMakeFiles
191
	COMMAND cmake -E remove_directory meteoio/plugins/gsn/CMakeFiles
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
	COMMAND cmake -E remove_directory meteoio/plugins/CMakeFiles
	COMMAND cmake -E remove_directory tests/CMakeFiles
	COMMAND cmake -E remove_directory tests/Testing
	COMMAND cmake -E remove_directory tests/meteo_reading_interpol/CMakeFiles
	COMMAND cmake -E remove_directory tests/meteo_reading_interpol/Testing
	COMMAND cmake -E remove_directory tests/meteo_reading_no_interpol/CMakeFiles
	COMMAND cmake -E remove_directory tests/meteo_reading_no_interpol/Testing
	COMMAND cmake -E remove_directory tests/sun/CMakeFiles
	COMMAND cmake -E remove_directory tests/sun/Testing
	COMMAND cmake -E remove tests/sun/generated_results.txt
	COMMAND cmake -E remove_directory tests/dem_reading/CMakeFiles
	COMMAND cmake -E remove_directory tests/dem_reading/Testing
	COMMAND cmake -E remove tests/dem_reading/AZI.asc tests/dem_reading/DEM.asc tests/dem_reading/SLOPE.asc
	COMMAND cmake -E remove_directory tests/2D_interpolations/CMakeFiles
	COMMAND cmake -E remove_directory tests/2D_interpolations/Testing
	COMMAND cmake -E remove tests/2D_interpolations/2009-01-19T12.00_HNW.asc tests/2D_interpolations/2009-01-19T12.00_RH.asc tests/2D_interpolations/2009-01-19T12.00_RSWR.asc tests/2D_interpolations/2009-01-19T12.00_TA.asc
)

210
211
212
213

###########################################################
#for the uninstall target
CONFIGURE_FILE(
214
215
216
	"${PROJECT_SOURCE_DIR}/tools/cmake/cmake_uninstall.cmake.in"
	"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
	IMMEDIATE @ONLY)
217

218
ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
219
220

#Build the documentation if doxygen is found
221
INCLUDE(FindDoxygen)
222
223
224
FIND_PACKAGE(Doxygen)
if (DOXYGEN_FOUND)
	ADD_CUSTOM_TARGET(documentation "doxygen" ${PROJECT_SOURCE_DIR}/meteoio/config.dox)
225
226
227
228
229
230
	GET_TARGET_PROPERTY(DOC_TARGET doc TYPE)
	IF(NOT DOC_TARGET)
		ADD_CUSTOM_TARGET(doc)
	ENDIF(NOT DOC_TARGET)
	ADD_DEPENDENCIES(doc documentation)
ENDIF (DOXYGEN_FOUND)
231
#Install the documentation if the user desires it
232
233
234
235
236
237
238
SET(INSTALL_DOC OFF CACHE BOOL "Install documentation ON or OFF")
IF(INSTALL_DOC)
	IF(WIN32)
		SET(DOC_PATH "doc")
	ELSE(WIN32)
		SET(DOC_PATH "share/doc/${CMAKE_PROJECT_NAME}")
	ENDIF(WIN32)
239
	SET(DOC_FILES License.txt meteoio/icons/icon.ico doc/SMET_specifications.pdf)
240
241
	IF (DOXYGEN_FOUND)
		INSTALL(DIRECTORY doc/html DESTINATION ${DOC_PATH} COMPONENT documentation)
242
		LIST(APPEND DOC_FILES doc/MeteoIO_doc.html)
243
244
245
	ELSE (DOXYGEN_FOUND)
		MESSAGE("Doxygen has not been found and is needed to build online documentation. Please either install doxygen or download a documentation-only package!")
	ENDIF (DOXYGEN_FOUND)
246

247
	INSTALL(FILES ${DOC_FILES} DESTINATION ${DOC_PATH} COMPONENT documentation)
Mathias Bavay's avatar
Mathias Bavay committed
248
	INSTALL(DIRECTORY "doc/examples" DESTINATION ${DOC_PATH} COMPONENT examples PATTERN ".svn" EXCLUDE)
249
ENDIF(INSTALL_DOC)
250

251
252
###########################################################
## CPACK section
253
###########################################################
254
255
SET(CPACK_PACKAGE_DESCRIPTION "Meteorological preprocessing library")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Meteorological Input/Output preprocessing library: it covers data retrieval, data filtering, data transformations and spatial interpolations. Please refer to the included documentation and the included code examples!")
256
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/Welcome.txt")
257
SET(CPACK_PACKAGE_NAME "MeteoIO")
258
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "MeteoIO")
259
260
261
262
SET(CPACK_PACKAGE_CONTACT "Mathias Bavay ")
SET(CPACK_PACKAGE_VENDOR "WSL Institute for Snow and Avalanche Research")
SET(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/meteoio/icons\\\\icon.ico")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/License.txt")
263
264
SET(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_SOURCE_DIR}/Welcome.txt")
SET(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/Readme.txt")
265
266
267
268
269
270
271
272
273
274

IF (DEST MATCHES "par")
	SET(PACKAGE_EXTRA "-par")
ENDIF(DEST MATCHES "par")
SET(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
SET(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
SET(VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
#SET(CPACK_ARCH "${CMAKE_SYSTEM_PROCESSOR}")
SET(CPACK_ARCH "i386")
275
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}${PACKAGE_EXTRA}-${VERSION}-${CPACK_ARCH}")
276
277

#installation by components for formats that support it
278
279
#SET(CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE 1)
SET(CPACK_COMPONENTS_ALL libraries headers plugins documentation examples)
280
281
282
283
284
285
286
287
288
289
290
SET(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "MeteoIO library")
SET(CPACK_COMPONENT_LIBRARIES_DESCRIPTION "The MeteoIO library itself")
SET(CPACK_COMPONENT_LIBRARIES_GROUP Runtime)
SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "Header files")
SET(CPACK_COMPONENT_HEADERS_DESCRIPTION "Necessary C++ header files for developing applications using MeteoIO")
SET(CPACK_COMPONENT_HEADERS_GROUP Development)
SET(CPACK_COMPONENT_HEADERS_DEPENDS libraries)
SET(CPACK_COMPONENT_PLUGINS_DISPLAY_NAME "Input/Output Plugins")
SET(CPACK_COMPONENT_PLUGINS_DESCRIPTION "Various plugins for supporting various data formats/protocols")
SET(CPACK_COMPONENT_PLUGINS_GROUP Runtime)
SET(CPACK_COMPONENT_PLUGINS_DEPENDS libraries)
291
292
293
IF(INSTALL_DOC)
	SET(CPACK_COMPONENT_DOCUMENTATION_DISPLAY_NAME "Documentation")
	SET(CPACK_COMPONENT_DOCUMENTATION_DESCRIPTION "Documentation of the MeteoIO usage and API both for the end user and the developer using MeteoIO in his/her application")
294
	SET(CPACK_COMPONENT_DOCUMENTATION_GROUP Docs)
295
296
297
	SET(CPACK_COMPONENT_EXAMPLES_DISPLAY_NAME "Examples")
	SET(CPACK_COMPONENT_EXAMPLES_DESCRIPTION "C++ Source code of various simple examples of applications with their example data")
	SET(CPACK_COMPONENT_EXAMPLES_DEPENDS libraries headers)
298
299
300
	SET(CPACK_COMPONENT_EXAMPLES_GROUP Docs)
	SET(CPACK_COMPONENT_DOCS_GROUP "Documentation")
	SET(CPACK_COMPONENT_GROUP_DOCS_DESCRIPTION "How to use MeteoIO as an end user and as a developer")
301
ENDIF(INSTALL_DOC)
302
303
304
305
306

SET(CPACK_COMPONENT_RUNTIME_GROUP "Runtime")
SET(CPACK_COMPONENT_GROUP_RUNTIME_DESCRIPTION "What you need to run an application based on MeteoIO")
SET(CPACK_COMPONENT_DEVELOPMENT_GROUP "Development")
SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "What you need to develop an application based on MeteoIO")
307

308
309
IF(UNIX)
	IF(APPLE)
310
		SET(CPACK_GENERATOR "PackageMaker")
311
		SET(CPACK_PACKAGING_INSTALL_PREFIX "/Applications/${CPACK_PACKAGE_NAME}")
312
	ELSE(APPLE)
313
		SET(CPACK_GENERATOR "DEB;RPM;TGZ")
314
		SET(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
315
316
317
318
319
320
		SET(CPACK_DEBIAN_PACKAGE_NAME "meteoio")
		SET(CPACK_DEBIAN_PACKAGE_SECTION "devel")
		SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libstdc++6, libproj0") #objdump -p lib/libmeteoio.so | grep NEEDED | tr -s ' ' | cut -d' ' -f3 | tr '\n' ','
		SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "i386") #dpkg --print-architecture
		SET(CPACK_RPM_PACKAGE_NAME "meteoio")
		SET(CPACK_RPM_PACKAGE_LICENSE "LPGLv3")
321
		SET(CPACK_RPM_PACKAGE_REQUIRES "libstdc++6, libproj4") #simply libproj for OpenSuse
322
323
		SET(CPACK_RPM_PACKAGE_ARCHITECTURE "i386")
		SET(CPACK_RPM_PACKAGE_GROUP "Development/Libraries")
324
325
326
	ENDIF(APPLE)
ELSE(UNIX)
	IF(WIN32)
327
328
		SET(CPACK_GENERATOR "NSIS")
		SET(CPACK_NSIS_MUI_ICON "${CPACK_PACKAGE_ICON}")
Mathias Bavay's avatar
Mathias Bavay committed
329
330
		SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}-${VERSION}")
		SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME}")
331
332
333
334
335
336
337
338
339
		IF(INSTALL_DOC)
			SET(CPACK_NSIS_MENU_LINKS
				"${DOC_PATH}/MeteoIO_doc.html" "MeteoIO documentation"
				"${DOC_PATH}/examples" "MeteoIO examples"
				"https://slfsmm.indefero.net/p/meteoio/" "Home page")
		ELSEIF(INSTALL_DOC)
			SET(CPACK_NSIS_MENU_LINKS
				"https://slfsmm.indefero.net/p/meteoio/" "Home page")
		ENDIF(INSTALL_DOC)
340
		#info for the add/uninstall software administration
341
		SET(CPACK_NSIS_INSTALLED_ICON_NAME "doc\\\\icon.ico")
342
343
344
		SET(CPACK_NSIS_URL_INFO_ABOUT "http://www.slf.ch")
		SET(CPACK_NSIS_HELP_LINK "https://slfsmm.indefero.net/p/meteoio")
		SET(CPACK_NSIS_CONTACT "Mathias.Bavay@wsl.ch")
345
346
347
348
	ENDIF(WIN32)
ENDIF(UNIX)


349
350
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${VERSION}" CACHE INTERNAL "tarball basename")
SET(CPACK_SOURCE_GENERATOR TGZ)
351
352
353
# The following components are regex's to match anywhere (unless anchored)
# in absolute path + filename to find files or directories to be excluded
# from source tarball.
354
SET(CPACK_SOURCE_IGNORE_FILES
355
356
357
358
359
360
361
362
363
364
365
366
367
	"~$"
	"\\\\.svn/"
	"/CMakeFiles/"
	"/CMakeCache*"
	"/cmake_install\\\\.cmake$"
	"/cmake_uninstall\\\\.cmake$"
	"^_CPack_.*/"
	"/CPack*"
	"\\\\.o$"
	"/m4/"
)

INCLUDE(CPack)
368
369
370
371
372
373
374
375

###########################################################
## CTest section
###########################################################

## Special build type configuration for Covarage Testing.
# Attantion: Coverage testing right now only works with g++ (or comercial tools)
## Add the tests itselfs
376
OPTION(BUILD_TESTING "Build the tests" OFF)
377
378
379
380
IF(BUILD_TESTING)

	# Coverage statistic rign now only supportet with GCC (GNUGXX)
	IF(CMAKE_COMPILER_IS_GNUCXX)
381
		OPTION(BUILD_TESTING_WITH_COVERAGE "Use gcc flags to make coverage tests" OFF)
382

383
384
385
386
387
388
		IF(BUILD_TESTING_WITH_COVERAGE)
			# force the correct flags to make coverage trought a build type
			SET(CMAKE_BUILD_TYPE coverage)
			SET(CMAKE_CXX_FLAGS_COVERAGE "-Wall -O0 -ftest-coverage -fprofile-arcs" CACHE STRING "" FORCE)
			SET(CMAKE_C_FLAGS_COVERAGE "-Wall -O0 -ftest-coverage -fprofile-arcs" CACHE STRING "" FORCE)
			MARK_AS_ADVANCED(FORCE CMAKE_CXX_FLAGS_COVERAGE CMAKE_C_FLAGS_COVERAGE)
389

390
391
392
			# Force debug mode, so that no optimisation is made to get "Correct" results of coverage testing
			SET(CMAKE_BUILD_TYPE "coverage" CACHE STRING "Choose the type of build, options are: debug release coverage " FORCE)
			SET(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE})
393

394
395
396
397
398
399
400
401
402
403
404
		ENDIF(BUILD_TESTING_WITH_COVERAGE)
	ENDIF(CMAKE_COMPILER_IS_GNUCXX)

	INCLUDE(CTest) # This makes ENABLE_TESTING() and gives support for Dashboard
	ADD_SUBDIRECTORY(tests)
ENDIF(BUILD_TESTING)