-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
86 lines (68 loc) · 2.75 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
## Do NOT edit this file unless you really know what you are doing
cmake_minimum_required(VERSION 3.16)
cmake_policy(SET CMP0076 NEW)
set(CMAKE_COLOR_DIAGNOSTICS ON)
set(CMAKE_COLOR_MAKEFILE ON)
## Set project name
project(geophysics-netcdf-programs VERSION 1.0 DESCRIPTION "Various utility programs for GA's NetCDF geophysical data format" LANGUAGES CXX C)
message(STATUS "Configuring geophysics-netcdf-programs")
include(cmake/Message-Functions.cmake)
include(cmake/Check-Functions.cmake)
# Set options
option(WITH_MPI "Build with MPI support" ON)
option(WITH_NETCDF "Build with NetCDF support" ON)
option(WITH_GDAL "Build with GDAL support" ON)
option(WITH_CGAL "Build with CGAL support" ON)
reportvar(WITH_MPI)
reportvar(WITH_NETCDF)
reportvar(WITH_GDAL)
reportvar(WITH_CGAL)
reportvar(CMAKE_VERSION)
reportvar(CMAKE_SYSTEM_NAME)
reportvar(CMAKE_BUILD_TYPE)
set(CMAKE_EXECUTABLE_SUFFIX_C ".exe")
set(CMAKE_EXECUTABLE_SUFFIX_CXX ".exe")
# Include the project level options and flags
include(cmake/Typical-Compiler-Options.cmake)
# Find Configure the external packages
#This is where the NetCDF C++ src code is located if it is not installed and has to be built from source
set(NETCDFCXX_SRC_DIR submodules/netcdf-cxx4/cxx4)
include(cmake/Configure-External-Packages.cmake)
if(${WITH_GDAL} AND GDAL_FOUND)
add_compile_definitions(ENABLE_GDAL)
endif()
if(${WITH_CGAL} AND CGAL_FOUND)
add_compile_definitions(ENABLE_CGAL)
endif()
#######################################
### Add the build targets
# Add the project include directories, which don't have their own CMakelists.txt
include_directories(src/)
# Add the cpp-utils submodule
add_subdirectory(submodules/cpp-utils EXCLUDE_FROM_ALL)
# Add the geophysics-netcdf submodule
add_subdirectory(submodules/geophysics-netcdf EXCLUDE_FROM_ALL)
# Add the executables
set(target aseggdf2netcdf)
add_executable(${target} src/${target}.cpp)
target_link_libraries(${target} PRIVATE cpp-utils)
target_link_libraries(${target} PRIVATE geophysics-netcdf)
install(TARGETS ${target} OPTIONAL)
set(target intrepid2netcdf)
add_executable(${target} src/${target}.cpp)
target_link_libraries(${target} PRIVATE cpp-utils)
target_link_libraries(${target} PRIVATE geophysics-netcdf)
install(TARGETS ${target} OPTIONAL)
set(target geophysicsnc2shape)
add_executable(${target} src/${target}.cpp)
target_link_libraries(${target} PRIVATE cpp-utils)
target_link_libraries(${target} PRIVATE geophysics-netcdf)
install(TARGETS ${target} OPTIONAL)
set(target test_geophysics_netcdf)
add_executable(${target} src/${target}.cpp)
target_link_libraries(${target} PRIVATE cpp-utils)
target_link_libraries(${target} PRIVATE geophysics-netcdf)
if(${WITH_MPI})
target_compile_definitions(${target} PRIVATE ENABLE_MPI OMPI_SKIP_MPICXX)
endif()
install(TARGETS ${target} OPTIONAL)