forked from NOAA-OWP/evapotranspiration
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
58 lines (40 loc) · 1.88 KB
/
CMakeLists.txt
File metadata and controls
58 lines (40 loc) · 1.88 KB
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
cmake_minimum_required(VERSION 3.12)
# Uncomment this and rebuild artifacts to enable debugging
set(CMAKE_BUILD_TYPE Debug)
project(petbmi VERSION 1.0.0 DESCRIPTION "OWP PET BMI Module Shared Library")
# PET
set(PET_LIB_NAME_CMAKE petbmi)
set(PET_LIB_DESC_CMAKE "OWP PET BMI Module Shared Library")
# Make sure these are compiled with this directive
add_compile_definitions(BMI_ACTIVE)
if(WIN32)
add_library(petbmi src/bmi_pet.c src/pet.c src/pet_serialization.cpp)
else()
add_library(petbmi SHARED src/bmi_pet.c src/pet.c src/pet_serialization.cpp)
endif()
# -----------------------------------------------------------------------------
# Find the Boost library and configure usage
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.79.0 REQUIRED COMPONENTS serialization)
target_link_libraries(petbmi PRIVATE Boost::serialization)
target_include_directories(petbmi PRIVATE include)
set_target_properties(petbmi PROPERTIES VERSION ${PROJECT_VERSION})
set_target_properties(petbmi PROPERTIES PUBLIC_HEADER include/bmi_pet.h)
target_link_libraries(petbmi PRIVATE Boost::serialization)
# --- EWTS (installed from nwm-ewts) ---
find_package(ewts CONFIG REQUIRED)
# Always use EWTS runtime logger for C
target_link_libraries(petbmi PRIVATE ewts::ewts_c)
# Built with ngen bridge
target_link_libraries(petbmi PRIVATE ewts::ewts_ngen_bridge)
target_compile_definitions(petbmi PRIVATE EWTS_HAVE_NGEN_BRIDGE)
# Code requires minimum of C99 standard to compile
set_target_properties(petbmi PROPERTIES C_STANDARD 99 C_STANDARD_REQUIRED ON)
include(GNUInstallDirs)
install(TARGETS petbmi
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
configure_file(petbmi.pc.in petbmi.pc @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/petbmi.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)