-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
112 lines (94 loc) · 3.81 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
cmake_minimum_required (VERSION 2.8.11)
project(webmod C CXX Fortran)
# set version numbers
set(WEBMOD_VERSION_MAJOR "1")
set(WEBMOD_VERSION_MINOR "0")
set(WEBMOD_VERSION_PATCH "0")
set(WEBMOD_REVISION "9000")
# CPack
set(CPACK_PACKAGE_NAME "webmod")
set(CPACK_PACKAGE_VERSION_MAJOR ${WEBMOD_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${WEBMOD_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${WEBMOD_VERSION_PATCH})
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${WEBMOD_REVISION}-x64")
if(WIN32)
set(CPACK_GENERATOR ZIP)
else()
set(CPACK_GENERATOR TGZ)
endif()
INCLUDE(CPack)
# use absolute paths
if(NOT DEFINED WEBMOD_USE_ABSOLUTE_PATHS)
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(WEBMOD_USE_ABSOLUTE_PATHS TRUE CACHE BOOL "substitute absolute paths in scripts")
else()
set(WEBMOD_USE_ABSOLUTE_PATHS FALSE CACHE BOOL "substitute absolute paths in scripts")
endif()
endif()
mark_as_advanced(WEBMOD_USE_ABSOLUTE_PATHS)
# set default windows installation path
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND WIN32)
GetDefaultWindowsPrefixBase(CMAKE_GENERIC_PROGRAM_FILES)
SET(CMAKE_INSTALL_PREFIX "${CMAKE_GENERIC_PROGRAM_FILES}/USGS/${PROJECT_NAME}-${CPACK_PACKAGE_VERSION}-${WEBMOD_REVISION}" CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
endif()
# overide docdir on windows
if(WIN32 AND NOT CMAKE_INSTALL_DOCDIR)
set(CMAKE_INSTALL_DOCDIR "" CACHE PATH "documentation root (doc)")
set(CMAKE_INSTALL_DOCDIR "doc")
endif()
# overide projdir on windows
if(WIN32 AND NOT CMAKE_INSTALL_PROJDIR)
set(CMAKE_INSTALL_PROJDIR "" CACHE PATH "projects root (projects)")
set(CMAKE_INSTALL_PROJDIR "projects")
endif()
# make prefix absolute
if (NOT IS_ABSOLUTE ${CMAKE_INSTALL_PREFIX})
get_filename_component(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_PREFIX}" ABSOLUTE)
endif()
# retrieve default install locations
include(GNUInstallDirs)
# CMAKE_INSTALL_PROJDIR (based on GNUInstallDirs.cmake)
if(NOT CMAKE_INSTALL_PROJDIR)
set(CMAKE_INSTALL_PROJDIR "" CACHE PATH "projects root (DATAROOTDIR/doc/PROJECT_NAME/projects)")
set(CMAKE_INSTALL_PROJDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}/projects")
endif()
mark_as_advanced(CMAKE_INSTALL_PROJDIR)
# CMAKE_INSTALL_FULL_PROJDIR (based on GNUInstallDirs.cmake)
if (NOT IS_ABSOLUTE ${CMAKE_INSTALL_PROJDIR})
get_filename_component(absProjDir "${CMAKE_INSTALL_PREFIX}" ABSOLUTE)
set(CMAKE_INSTALL_FULL_PROJDIR "${absProjDir}/${CMAKE_INSTALL_PROJDIR}")
else()
set(CMAKE_INSTALL_FULL_PROJDIR "${CMAKE_INSTALL_PROJDIR}")
endif()
# Disable shared libraries on windows
# see https://support2.microsoft.com/default.aspx?scid=KB;EN-US;168958
# and https://msdn.microsoft.com/query/dev11.query?appId=Dev11IDEF1&l=EN-US&k=k(C4251);&rd=true
if (WIN32)
set(LIB_TYPE STATIC)
else()
if(NOT DEFINED BUILD_SHARED_LIBS)
option(BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
set(LIB_TYPE STATIC)
endif()
endif()
if (BUILD_SHARED_LIBS)
set(LIB_TYPE SHARED)
endif()
# IPHREEQC_ENABLE_MODULE (must be enabled for webmod)
set(IPHREEQC_ENABLE_MODULE ON CACHE INTERNAL "doc" FORCE)
# Disable deprecation warnings for standard C and STL functions in VS2005
# and later
if(MSVC_VERSION EQUAL 1400 OR MSVC_VERSION GREATER 1400)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
endif(MSVC_VERSION EQUAL 1400 OR MSVC_VERSION GREATER 1400)
# tests
enable_testing()
# subdirs
add_subdirectory(IPhreeqcMMS)
add_subdirectory(mmf_c)
add_subdirectory(webmod.d)
add_subdirectory(Tests)
add_subdirectory(doc)
add_subdirectory(lib)