forked from USEPA/Stormwater-Management-Model
-
Notifications
You must be signed in to change notification settings - Fork 77
/
CMakeLists.txt
94 lines (70 loc) · 2.36 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
#
# CMakeLists.txt - CMake configuration file for swmm-solver
#
# Created: July 11, 2019
# Modified: Aug 16, 2022
#
# Authors: Michael E. Tryby
# US EPA ORD/CESER
#
################################################################################
################## CMAKELISTS FOR SWMM-SOLVER PROJECT ####################
################################################################################
cmake_minimum_required (VERSION 3.13)
# Disable in-source builds (they are messy)
if("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
message(FATAL_ERROR "In-source builds are disabled.")
endif()
project(swmm-solver
VERSION 5.2.4
LANGUAGES C CXX
)
# Append local dir to module search path
# list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
# Sets the position independent code property for all targets
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Sets default install prefix when cmakecache is initialized for first time
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "..." FORCE)
endif()
# Define install locations (will be prepended by install prefix)
set(TOOL_DIST "bin")
set(INCLUDE_DIST "include")
set(LIBRARY_DIST "lib")
set(CONFIG_DIST "cmake")
# Define build options
option(BUILD_TESTS "Build component tests (requires Boost)" OFF)
option(BUILD_DOCS "Build toolkit docs (requires Doxygen)" OFF)
option(BUILD_DEF "Builds library with def file interface" OFF)
# Added option to statically link libraries to address GitHub Ubuntu 20.04 symbol errors (issue #340)
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
# Add project subdirectories
if(BUILD_DOCS)
add_subdirectory(docs)
endif()
add_subdirectory(src/outfile)
add_subdirectory(src/solver)
add_subdirectory(src/run)
add_subdirectory(src/shared)
if(BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()
# Create install rules for vcruntime.dll, msvcp.dll, vcomp.dll etc.
if(OpenMP_FOUND)
set(CMAKE_INSTALL_OPENMP_LIBRARIES TRUE)
endif()
include(InstallRequiredSystemLibraries)
# Create install target for License and Contributors files
install(
FILES
"LICENSE"
"CONTRIBUTORS"
DESTINATION
"."
)
# Configure CPack driven installer package
set(CPACK_GENERATOR "ZIP;TGZ")
set(CPACK_PACKAGE_VENDOR "OWA")
set(CPACK_ARCHIVE_FILE_NAME "swmm")
include(CPack)