From 5c32a8bdfe2f94537ec577d51c97261b2e178d2c Mon Sep 17 00:00:00 2001 From: Michael Uleysky Date: Mon, 11 Nov 2024 05:48:41 +1000 Subject: [PATCH] Added udunit2 dependency --- CMakeLists.txt | 2 +- src/CMakeLists.txt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 325d14e..892cf29 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,7 +58,7 @@ endif() add_compile_options(-Wno-deprecated-declarations) CHECK_CXX_COMPILER_FLAG(-Wno-class-memaccess COMPILER_SUPPORTS_CLASSMEMACCESS) if(COMPILER_SUPPORTS_CLASSMEMACCESS) - add_compile_options(-Wno-class-memaccess) + add_compile_options($<$:-Wno-class-memaccess>) endif() add_library(teos STATIC GSW-C/gsw_oceanographic_toolbox.c GSW-C/gsw_saar.c) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e9b095d..fd69749 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,6 +4,7 @@ set(DATALISTINC ${CMAKE_CURRENT_BINARY_DIR}/../include/datalist.h) # Include dat find_package(PkgConfig REQUIRED) find_library(netcdf netcdf REQUIRED) +find_library(udunits udunits2 REQUIRED) find_package(OpenMP REQUIRED) find_package(CURL REQUIRED) find_package(LibXml2 REQUIRED) @@ -20,7 +21,7 @@ file(GLOB srcs CONFIGURE_DEPENDS *.cpp) add_executable(${EXENAME} ${srcs} ${ACTIONLISTINC} ${SOURCELISTINC}) target_include_directories(${EXENAME} PRIVATE ../michlib/michlib ${CMAKE_CURRENT_BINARY_DIR}/../include) -target_link_libraries(${EXENAME} ${linker_options} ${netcdf} OpenMP::OpenMP_CXX CURL::libcurl ${JSONCPP_LINK_LIBRARIES} ${BLOSC_LINK_LIBRARIES} ${LIBPQ_LINK_LIBRARIES} LibXml2::LibXml2 SQLite::SQLite3 teos) +target_link_libraries(${EXENAME} ${linker_options} ${netcdf} ${udunits} OpenMP::OpenMP_CXX CURL::libcurl ${JSONCPP_LINK_LIBRARIES} ${BLOSC_LINK_LIBRARIES} ${LIBPQ_LINK_LIBRARIES} LibXml2::LibXml2 SQLite::SQLite3 teos) set_target_properties(${EXENAME} PROPERTIES POSITION_INDEPENDENT_CODE ON) install(TARGETS ${EXENAME})