Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libcdi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mpim-sw
libcdi
Commits
62b32dce
Commit
62b32dce
authored
1 month ago
by
Mathieu Westphal
Browse files
Options
Downloads
Patches
Plain Diff
CMake: Add proper support for optional linking to netcdf and eccodes
parent
ff8e438e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!137
CMake: Fix cdi-config.cmake for CMake compatibility
,
!134
CMake: Improvements from kitware
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CMakeLists.txt
+3
-0
3 additions, 0 deletions
CMakeLists.txt
app/CMakeLists.txt
+1
-1
1 addition, 1 deletion
app/CMakeLists.txt
src/CMakeLists.txt
+1
-1
1 addition, 1 deletion
src/CMakeLists.txt
tests/CMakeLists.txt
+2
-2
2 additions, 2 deletions
tests/CMakeLists.txt
with
7 additions
and
4 deletions
CMakeLists.txt
+
3
−
0
View file @
62b32dce
...
...
@@ -17,6 +17,7 @@ if(${CDI_PTHREAD})
find_package
(
Threads REQUIRED
)
set_target_properties
(
Threads::Threads PROPERTIES THREADS_PREFER_PTHREAD_FLAG TRUE
)
list
(
APPEND cdi_compile_defs HAVE_PTHREAD=1
)
list
(
APPEND cdi_linked_libs pthread
)
endif
()
# enable default internal libs
...
...
@@ -53,6 +54,7 @@ if(${CDI_ECCODES} OR eccodes_ROOT)
if
(
${
eccodes_FOUND
}
)
list
(
APPEND cdi_compile_defs HAVE_LIBGRIB_API=
${
eccodes_FOUND
}
)
message
(
VERBOSE
"added compile definition HAVE_LIBGRIB_API=
${
eccodes_FOUND
}
"
)
list
(
APPEND cdi_linked_libs eccodes
)
else
()
message
(
WARNING
"eccodes not found, compiling without eccodes"
)
endif
()
...
...
@@ -70,6 +72,7 @@ if(${CDI_NETCDF} OR netCDF_ROOT )
HAVE_LIBGRIB_API=
${
netCDF_FOUND
}
HAVE_LIBGRIB=
${
netCDF_FOUND
}
)
list
(
APPEND cdi_linked_libs netCDF::netcdf
)
else
()
message
(
WARNING
"netcdf target not found, compiling without netcdf"
)
endif
()
...
...
This diff is collapsed.
Click to expand it.
app/CMakeLists.txt
+
1
−
1
View file @
62b32dce
...
...
@@ -7,6 +7,6 @@ target_include_directories(cdi PRIVATE
$<INSTALL_INTERFACE:include
)
target_link_libraries
(
cdi PRIVATE cdilib
netCDF::netcdf pthread
)
target_link_libraries
(
cdi PRIVATE cdilib
${
cdi_linked_libs
}
)
target_include_directories
(
cdi PRIVATE
"
${
PROJECT_BINARY_DIR
}
/src/config.h"
)
target_compile_definitions
(
cdi PRIVATE
${
cdi_netcdf_definitions
}
)
This diff is collapsed.
Click to expand it.
src/CMakeLists.txt
+
1
−
1
View file @
62b32dce
...
...
@@ -199,7 +199,7 @@ add_library(cdilib
)
target_include_directories
(
cdilib PRIVATE
"
${
PROJECT_BINARY_DIR
}
/src/config.h"
)
target_link_libraries
(
cdilib
eccodes netCDF::netcdf
)
target_link_libraries
(
cdilib
${
cdi_linked_libs
}
)
target_compile_definitions
(
cdilib PRIVATE PACKAGE_NAME=
"
${
PROJECT_NAME
}
"
VERSION=
"
${
CMAKE_PROJECT_VERSION
}
"
${
cdi_compile_defs
}
)
add_library
(
cdilib::cdilib ALIAS cdilib
)
...
...
This diff is collapsed.
Click to expand it.
tests/CMakeLists.txt
+
2
−
2
View file @
62b32dce
...
...
@@ -31,11 +31,11 @@ list(APPEND test_lib_src
add_library
(
test_lib
${
test_lib_src
}
)
target_include_directories
(
test_lib PRIVATE ../src/
)
target_link_libraries
(
test_lib PRIVATE cdilib
eccodes
)
target_link_libraries
(
test_lib PRIVATE cdilib
${
cdi_linked_libs
}
)
foreach
(
target
${
current_targets
}
)
target_include_directories
(
${
target
}
PRIVATE ../src/
)
target_link_libraries
(
${
target
}
PRIVATE cdilib test_lib
${
netCDF_LIBRARIES
}
)
target_link_libraries
(
${
target
}
PRIVATE cdilib test_lib
${
cdi_linked_libs
}
)
add_test
(
NAME
${
target
}
COMMAND
${
target
}
)
if
(
labels_
${
target
}
)
set_property
(
TEST
${
target
}
PROPERTY LABELS labels_
${
target
}
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment