WSL/SLF GitLab Repository

CMakeLists.txt 18.1 KB
Newer Older
1
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
2
3
#SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/tools/cmake/")
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/tools/cmake/")
4

5
PROJECT(meteoio)
6
7
# Version of library
SET(VERSION_MAJOR 2 CACHE INTERNAL "")
8
SET(VERSION_MINOR 4 CACHE INTERNAL "")
9
SET(VERSION_PATCH 3 CACHE INTERNAL "")
10
11
12

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

###########################################################
15
#platform specific. First, compiler specific flags, then system specific flags
16
17
18
19
20
21
OPTION(BUILD_SHARED_LIBS "Set to ON to build dynamic libraries" ON)
IF(WIN32)
	SET(BUILD_STATIC_LIBS ON) #otherwise the lib files are not generated
ELSE(WIN32)
	OPTION(BUILD_STATIC_LIBS "Set to ON to build static libraries" OFF)
ENDIF(WIN32)
22
INCLUDE("${CMAKE_SOURCE_DIR}/tools/cmake/BuildVersion.cmake")
23
BuildVersion()
24

25
26
IF(MSVC)
	#SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "limited configs"  FORCE)
27
	SET(WARNINGS "/W4 /D_CRT_SECURE_NO_WARNINGS /EHsc") #Za: strict ansi EHsc: handle c++ exceptions
28
29
30
31
32
33
	#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")
	SET(_VERSION "/D_VERSION=\\\"${_versionString}\\\"")
34
35
36
	IF(BUILD_SHARED_LIBS)
		ADD_DEFINITIONS(/DMIO_DLL)
	ENDIF(BUILD_SHARED_LIBS)
37
38
39
	IF(GUI_EXCEPTIONS)
		SET(MSG_BOX "/DMESG_BOX")
	ENDIF(GUI_EXCEPTIONS)
40
41
ELSE(MSVC)
	#we consider that all other compilers support "-" options and silently ignore what they don't know
42
	SET(WARNINGS "-Wall -Wno-long-long")
43
	SET(PROFILING "-pg -fprofile-arcs")
44
	SET(DEEP_WARNINGS "-Wunused-value -Wshadow -Wpointer-arith -Wconversion -Winline -Wdisabled-optimization") #-Wfloat-equal -Wpadded
Mathias Bavay's avatar
Mathias Bavay committed
45
	SET(EXTRA_WARNINGS "-Wextra -pedantic -Weffc++ ${DEEP_WARNINGS}") #-Weffc++
46
47
	IF(CMAKE_COMPILER_IS_GNUCXX AND NOT ANDROID)
		SET(EXTRA_WARNINGS "${EXTRA_WARNINGS} -ansi") #Android does not like ansi...
48
49
50
		IF(WIN32) #for gcc on windows
			SET(CMAKE_SHARED_LINKER_FLAGS "--enable-auto-import")
		ENDIF(WIN32)
51
	ENDIF(CMAKE_COMPILER_IS_GNUCXX AND NOT ANDROID)
52
	SET(OPTIM "-g -O3 -DNDEBUG -DNOSAFECHECKS") #-flto for gcc>4.5?
53
54
55
56
57
58
	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")
59
	SET(_VERSION "-D_VERSION=\\\"${_versionString}\\\"")
60
61
62
	#IF(BUILD_SHARED_LIBS)
	#	ADD_DEFINITIONS(-DMIO_DLL)
	#ENDIF(BUILD_SHARED_LIBS)
63
64
ENDIF(MSVC)

65
66
#The following pre-processor variables are automatically defined:
# __linux, __GNUC__, __CYGWIN__, _WIN32, __MINGW32__, __APPLE__
67
68
IF(UNIX)
	IF(APPLE)
69
		SET(DLL_EXT "dylib*")
70
		SET(STAT_EXT "a")
71
72
		SET(EXTRA_WARNINGS "${EXTRA_WARNINGS} -Wno-sign-conversion") #for now, keep clang quiet
		SET(CMAKE_SHARED_LINKER_FLAGS "-framework CoreFoundation")
73
74
		#set(CMAKE_OSX_SYSROOT iphoneos2.2.1) #for IOS
		#set(CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_BIT)) #for IOS
75

76
77
		#set a full rpath for both build & install tree
		SET(CMAKE_SKIP_BUILD_RPATH  FALSE)
78
		SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
79
80
81
82
83
		SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")

		# add the automatically determined parts of the RPATH
		# which point to directories outside the build tree to the install RPATH
		SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
84

85
86
87
88
89
		# the RPATH to be used when installing, but only if it's not a system directory
		LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
		IF("${isSystemDir}" STREQUAL "-1")
			SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
		ENDIF("${isSystemDir}" STREQUAL "-1")
90
	ELSE(APPLE)
91
		SET(DLL_EXT "so*")
92
		SET(STAT_EXT "a")
93
94
95
	ENDIF(APPLE)
ELSE(UNIX)
	IF(WIN32)
96
97
		SET(DLL_EXT "dll")
		SET(STAT_EXT "a")
98
99
100
	ENDIF(WIN32)
ENDIF(UNIX)

101
IF(NOT CMAKE_BUILD_TYPE)
102
	SET(CMAKE_BUILD_TYPE "release" CACHE STRING "Choose the type of build, options are: debug release coverage cxxflags" FORCE)
103
104
	SET(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE})
ENDIF(NOT CMAKE_BUILD_TYPE)
105
106

###########################################################
107
108
#targets providing SETs of compiler options
IF(NOT DEST)
109
	SET(DEST "safe" CACHE STRING "Choose safe, optimized, hera" FORCE)
110
ENDIF(NOT DEST)
111

112
113
114
IF (DEST STREQUAL "hera")
	SET(ARCH  "-march=amdfam10")
ENDIF(DEST STREQUAL "hera")
115

116
117
118
IF (DEST STREQUAL "safe")
	SET(ARCH  "${ARCH_SAFE}")
ENDIF(DEST STREQUAL "safe")
119
120

IF(DEST STREQUAL "optimized")
121
	SET(ARCH  "${ARCH_OPTIM}")
122
123
ENDIF(DEST STREQUAL "optimized")

124
125
#show exception messages in a graphical message box
SET(GUI_EXCEPTIONS OFF CACHE BOOL "Show a message box with exceptions texts ON or OFF")
126

127
###########################################################
128
#finally, SET compile flags
129

Mathias Bavay's avatar
Mathias Bavay committed
130
SET(CMAKE_CXX_FLAGS "${_VERSION} ${ARCH}" CACHE STRING "" FORCE)
131
132
SET(CMAKE_CXX_FLAGS_RELEASE "${OPTIM}" CACHE STRING "" FORCE)
SET(CMAKE_CXX_FLAGS_DEBUG "${DEBUG} ${WARNINGS} ${EXTRA_WARNINGS}" CACHE STRING "" FORCE)
133
134
SET(CMAKE_CXX_FLAGS_CXXFLAGS "$ENV{CXXFLAGS}" CACHE STRING "" FORCE)
MARK_AS_ADVANCED(FORCE CMAKE_CXX_FLAGS_CXXFLAGS)
135
136

#Add subdirectory, so they can inherit all variables defined above
137
ADD_SUBDIRECTORY(meteoio/dataClasses)
138
ADD_SUBDIRECTORY(meteoio/plugins)
139
140
ADD_SUBDIRECTORY(meteoio/meteoLaws)
ADD_SUBDIRECTORY(meteoio/meteoFilters)
141
ADD_SUBDIRECTORY(meteoio)
142
143
###########################################################
#plugins
144
SET(PLUGIN_A3DIO ON CACHE BOOL "Compilation A3DIO ON or OFF")
Mathias Bavay's avatar
Mathias Bavay committed
145
SET(PLUGIN_ALPUG ON CACHE BOOL "Compilation ALPUG ON or OFF")
146
147
148
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")
149
SET(PLUGIN_COSMOXMLIO OFF CACHE BOOL "Compilation COSMOXMLIO ON or OFF")
150
151
SET(PLUGIN_GEOTOPIO ON CACHE BOOL "Compilation GEOTOPIO ON or OFF")
SET(PLUGIN_GRASSIO ON CACHE BOOL "Compilation GRASSIO ON or OFF")
152
SET(PLUGIN_GRIBIO OFF CACHE BOOL "Compilation GRIBIO ON or OFF")
153
SET(PLUGIN_GSNIO OFF CACHE BOOL "Compilation GSNIO ON or OFF")
154
SET(PLUGIN_IMISIO OFF CACHE BOOL "Compilation IMISIO ON or OFF")
155
SET(PLUGIN_NETCDFIO OFF CACHE BOOL "Compilation NETCDFIO ON or OFF")
156
157
SET(PLUGIN_PGMIO ON CACHE BOOL "Compilation PGMIO ON or OFF")
SET(PLUGIN_PNGIO OFF CACHE BOOL "Compilation PNGIO ON or OFF")
158
SET(PLUGIN_PSQLIO OFF CACHE BOOL "Compilation PSQLIO ON or OFF")
159
160
SET(PLUGIN_SMETIO ON CACHE BOOL "Compilation SMETIO ON or OFF")
SET(PLUGIN_SNIO ON CACHE BOOL "Compilation SNIO ON or OFF")
161
SET(PLUGIN_SASEIO OFF CACHE BOOL "Compilation SASEIO ON or OFF")
162
SET(PROJ4 OFF CACHE BOOL "Use PROJ4 for the class MapProj ON or OFF")
163
SET(DATA_QA OFF CACHE BOOL "Data Quality Assurance outputs ON or OFF")
164

165
166
###########################################################
#for the install target
167
FILE(GLOB hfiles "meteoio/*.h")
168
FILE(GLOB hdatafiles "meteoio/dataClasses/*.h")
169
FILE(GLOB hpluginfiles "meteoio/plugins/*.h")
170
171
172
173
174
175
FILE(GLOB hlawsfiles "meteoio/meteoLaws/*.h")
FILE(GLOB hfilterfiles "meteoio/meteoFilters/*.h")
FILE(GLOB hstatsfiles "meteoio/meteoStats/*.h")

INSTALL(FILES ${hfiles} DESTINATION include/meteoio COMPONENT headers)
INSTALL(FILES ${hdatafiles} DESTINATION include/meteoio/dataClasses COMPONENT headers)
176
INSTALL(FILES ${hpluginfiles} DESTINATION include/meteoio/plugins COMPONENT headers)
177
178
179
INSTALL(FILES ${hlawsfiles} DESTINATION include/meteoio/meteoLaws COMPONENT headers)
INSTALL(FILES ${hfilterfiles} DESTINATION include/meteoio/meteoFilters COMPONENT headers)
INSTALL(FILES ${hstatsfiles} DESTINATION include/meteoio/meteoStats COMPONENT headers)
180

181
182
183
184
185
IF(WIN32) #only having it in meteoio/CMake... is not enough...
	FILE(GLOB_RECURSE importlibs "lib/libmeteo*.lib")
	FILE(GLOB_RECURSE dlls "lib/libmeteo*.dll")
	INSTALL(FILES ${dlls} ${importlibs} DESTINATION lib COMPONENT libraries)
ENDIF(WIN32)
Mathias Bavay's avatar
Mathias Bavay committed
186
187
188
189
IF(APPLE) #only having it in meteoio/CMake... is not enough...
	FILE(GLOB_RECURSE dlls "lib/libmeteo*.dylib")
	INSTALL(FILES ${dlls} DESTINATION lib COMPONENT libraries)
ENDIF(APPLE)
190

191
ADD_CUSTOM_TARGET(distclean make clean
192
	COMMAND cmake -E remove CMakeCache.txt CPackSourceConfig.cmake CPackConfig.cmake CTestTestfile.cmake DartConfiguration.tcl cmake_install.cmake cmake_uninstall.cmake install_manifest.txt Makefile
193
	COMMAND cmake -E remove "lib/libmeteo*.${DLL_EXT}" "lib/libmeteo*.${STAT_EXT}" "lib/libmeteo*.lib"
194
195
	COMMAND cmake -E remove */CMakeCache.txt */CTestTestfile.cmake */cmake_install.cmake
	COMMAND cmake -E remove */*/CMakeCache.txt */*/CTestTestfile.cmake */*/cmake_install.cmake
196
	COMMAND cmake -E remove_directory CMakeFiles
197
	COMMAND cmake -E remove_directory Testing
198
	COMMAND cmake -E remove_directory meteoio/CMakeFiles
199
200
201
	COMMAND cmake -E remove_directory meteoio/dataClasses/CMakeFiles
	COMMAND cmake -E remove_directory meteoio/meteoFilters/CMakeFiles
	COMMAND cmake -E remove_directory meteoio/meteoLaws/CMakeFiles
202
	COMMAND cmake -E remove_directory meteoio/plugins/gsn/CMakeFiles
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
	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
)

221
222
223
###########################################################
#for the uninstall target
CONFIGURE_FILE(
224
225
226
	"${PROJECT_SOURCE_DIR}/tools/cmake/cmake_uninstall.cmake.in"
	"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
	IMMEDIATE @ONLY)
227

228
ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
229
230

#Build the documentation if doxygen is found
231
INCLUDE(FindDoxygen)
232
233
FIND_PACKAGE(Doxygen)
if (DOXYGEN_FOUND)
234
	ADD_CUSTOM_TARGET(doc "doxygen" ${PROJECT_SOURCE_DIR}/meteoio/config.dox)
235
ENDIF (DOXYGEN_FOUND)
236
#Install the documentation if the user desires it
237
238
239
240
241
242
243
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)
244
	SET(DOC_FILES License.txt meteoio/icons/icon.ico doc/SMET_specifications.pdf)
245
246
	IF (DOXYGEN_FOUND)
		INSTALL(DIRECTORY doc/html DESTINATION ${DOC_PATH} COMPONENT documentation)
247
		LIST(APPEND DOC_FILES doc/MeteoIO_doc.html)
248
249
250
	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)
251

252
	INSTALL(FILES ${DOC_FILES} DESTINATION ${DOC_PATH} COMPONENT documentation)
Mathias Bavay's avatar
Mathias Bavay committed
253
	INSTALL(DIRECTORY "doc/examples" DESTINATION ${DOC_PATH} COMPONENT examples PATTERN ".svn" EXCLUDE)
254
ENDIF(INSTALL_DOC)
255

256
257
###########################################################
## CPACK section
258
###########################################################
259
260
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!")
261
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/Welcome.txt")
262
SET(CPACK_PACKAGE_NAME "MeteoIO")
263
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "MeteoIO")
264
SET(CPACK_PACKAGE_CONTACT "Mathias Bavay <Mathias.Bavay@wsl.ch>")
265
266
267
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")
268
269
SET(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_SOURCE_DIR}/Welcome.txt")
SET(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/Readme.txt")
270
271
272
273
274
275
276
277
278
279

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")
280
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}${PACKAGE_EXTRA}-${VERSION}-${CPACK_ARCH}")
281
282

#installation by components for formats that support it
283
#SET(CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE 1)
284
SET(CPACK_COMPONENTS_ALL libraries headers documentation examples)
285
286
287
288
289
290
291
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)
292
293
294
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")
295
	SET(CPACK_COMPONENT_DOCUMENTATION_GROUP Docs)
296
297
298
	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)
299
300
301
	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")
302
ENDIF(INSTALL_DOC)
303
304
305
306
307

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")
308

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


352
353
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${VERSION}" CACHE INTERNAL "tarball basename")
SET(CPACK_SOURCE_GENERATOR TGZ)
354
355
356
# 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.
357
SET(CPACK_SOURCE_IGNORE_FILES
358
359
360
361
362
363
364
365
366
367
368
369
370
	"~$"
	"\\\\.svn/"
	"/CMakeFiles/"
	"/CMakeCache*"
	"/cmake_install\\\\.cmake$"
	"/cmake_uninstall\\\\.cmake$"
	"^_CPack_.*/"
	"/CPack*"
	"\\\\.o$"
	"/m4/"
)

INCLUDE(CPack)
371
372
373
374
375
376
377
378

###########################################################
## 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
379
OPTION(BUILD_TESTING "Build the tests" OFF)
380
381
382
383
IF(BUILD_TESTING)

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

386
387
388
389
		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)
390
			MARK_AS_ADVANCED(FORCE CMAKE_CXX_FLAGS_COVERAGE)
391

392
393
394
			# 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})
395

396
397
398
399
400
401
		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)