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
0e8861e0
Commit
0e8861e0
authored
4 weeks ago
by
Oliver Heidmann
Browse files
Options
Downloads
Patches
Plain Diff
removed usage of lists and replaced it by target specific cmake routines
parent
4c2a5cd9
No related branches found
Branches containing commit
No related tags found
1 merge request
!145
M300433/cmake improvements and cleanup 2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMakeLists.txt
+12
-12
12 additions, 12 deletions
CMakeLists.txt
src/CMakeLists.txt
+62
-52
62 additions, 52 deletions
src/CMakeLists.txt
with
74 additions
and
64 deletions
CMakeLists.txt
+
12
−
12
View file @
0e8861e0
...
...
@@ -19,36 +19,34 @@ if(${CDI_PTHREAD})
include
(
FindThreads
)
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
_link
ed
_lib
s
pthread
)
target_compile_definitions
(
cdilib PRIVATE
HAVE_PTHREAD=1
)
target
_link_lib
raries
(
cdilib
pthread
)
endif
()
# enable default internal libs
option
(
CDI_LIBGRIB
"GRIB support [default=ON]"
ON
)
if
(
${
CDI_LIBGRIB
}
)
list
(
APPEND cdi_compile_defs
HAVE_LIBGRIB=1
HAVE_LIBGRIB_API=1
)
target_compile_definitions
(
cdilib PRIVATE HAVE_LIBGRIB=1 HAVE_LIBGRIB_API=1
)
endif
()
option
(
CDI_LIBGRIBEX
"Use the CGRIBEX library [default=ON]"
ON
)
if
(
${
CDI_LIBGRIBEX
}
)
list
(
APPEND cdi_compile_defs
LIBCGRIBEX=1
)
target_compile_definitions
(
cdilib PRIVATE
LIBCGRIBEX=1
)
endif
()
option
(
CDI_EXTRA
"Use the extra library [default=ON]"
ON
)
if
(
${
CDI_EXTRA
}
)
list
(
APPEND cdi_compile_defs
HAVE_LIBEXTRA=1
)
target_compile_definitions
(
cdilib PRIVATE
HAVE_LIBEXTRA=1
)
endif
()
option
(
CDI_IEG
"Use the extra library [default=ON]"
ON
)
if
(
${
CDI_IEG
}
)
list
(
APPEND cdi_compile_defs
HAVE_LIBIEG=1
)
target_compile_definitions
(
cdilib PRIVATE
HAVE_LIBIEG=1
)
endif
()
option
(
CDI_SERVICE
"Use the extra library [default=ON]"
ON
)
if
(
${
CDI_SERVICE
}
)
list
(
APPEND cdi_compile_defs
HAVE_LIBSERVICE=1
)
target_compile_definitions
(
cdilib PRIVATE
HAVE_LIBSERVICE=1
)
endif
()
# ecCodes
...
...
@@ -56,7 +54,9 @@ option(CDI_ECCODES "Use the eccodes library [default=ON]" ON)
if
(
${
CDI_ECCODES
}
OR eccodes_ROOT
)
find_package
(
eccodes REQUIRED
)
if
(
${
eccodes_FOUND
}
)
list
(
APPEND cdi_linked_libs eccodes
)
target_compile_definitions
(
cdilib PRIVATE HAVE_LIBGRIB_API=
${
eccodes_FOUND
}
)
message
(
VERBOSE
"added compile definition HAVE_LIBGRIB_API=
${
eccodes_FOUND
}
"
)
target_link_libraries
(
cdilib eccodes
)
endif
()
endif
()
...
...
@@ -70,7 +70,7 @@ if(${CDI_NETCDF} OR netCDF_ROOT )
HAVE_LIBNC_DAP=
${
netCDF_FOUND
}
HAVE_NETCDF4=
${
netCDF_FOUND
}
)
list
(
APPEND cdi
_link
ed
_lib
s
netCDF::netcdf
)
target
_link_lib
raries
(
cdilib
netCDF::netcdf
)
endif
()
endif
()
...
...
@@ -78,7 +78,7 @@ message(VERBOSE "looking for config.h in: ${PROJECT_BINARY_DIR}/src")
#adding subdirectories
## lib and general files
list
(
APPEND cdi_compile_defs
CDI=1 CDI_SIZE_TYPE=size_t PACKAGE_NAME=
"
${
PROJECT_NAME
}
"
VERSION=
"
${
CMAKE_PROJECT_VERSION
}
"
)
target_compile_definitions
(
cdilib PRIVATE
CDI=1 CDI_SIZE_TYPE=size_t PACKAGE_NAME=
"
${
PROJECT_NAME
}
"
VERSION=
"
${
CMAKE_PROJECT_VERSION
}
"
)
add_subdirectory
(
src
)
#app
...
...
This diff is collapsed.
Click to expand it.
src/CMakeLists.txt
+
62
−
52
View file @
0e8861e0
list
(
APPEND cdi_src_files
target_sources
(
cdilib PRIVATE
async_worker.c
async_worker.h
basetime.c
...
...
@@ -139,69 +140,78 @@ list( APPEND cdi_src_files
zaxis.c
zaxis.h
)
list
(
APPEND cdi_pio_files
cdipio.h
pio.c
pio.h
pio_cdf_int.c
pio_cdf_int.h
pio_client.c
pio_client.h
pio_comm.c
pio_comm.h
pio_conf.c
pio_conf.h
pio_dbuffer.c
pio_dbuffer.h
pio_dist_grid.c
pio_dist_grid.h
pio_id_set.h
pio_idxlist_cache.c
pio_idxlist_cache.h
pio_impl.h
pio_interface.c
pio_interface.h
pio_mpi_fw_at_all.c
pio_mpi_fw_at_reblock.c
pio_mpi_fw_ordered.c
pio_mpinonb.c
pio_posixasynch.c
pio_posixfpguardsendrecv.c
pio_posixnonb.c
pio_record_send.c
pio_roles.c
pio_rpc.c
pio_rpc.h
pio_serialize.c
pio_serialize.h
pio_server.c
pio_server.h
pio_util.c
pio_util.h
pio_xmap_cache.c
pio_xmap_cache.h
)
list
(
APPEND cdi_unknown
cfortran.h
getline.c
make_fint.c
resource_unpack.c
resource_unpack.h
)
option
(
CDI_BUILD_PIO
"Build unknown sources in libcdi"
OFF
)
mark_as_advanced
(
CDI_BUILD_PIO
)
if
(
CDI_BUILD_PIO
)
target_sources
(
cdilib PRIVATE
cdipio.h
pio.c
pio.h
pio_cdf_int.c
pio_cdf_int.h
pio_client.c
pio_client.h
pio_comm.c
pio_comm.h
pio_conf.c
pio_conf.h
pio_dbuffer.c
pio_dbuffer.h
pio_dist_grid.c
pio_dist_grid.h
pio_id_set.h
pio_idxlist_cache.c
pio_idxlist_cache.h
pio_impl.h
pio_interface.c
pio_interface.h
pio_mpi_fw_at_all.c
pio_mpi_fw_at_reblock.c
pio_mpi_fw_ordered.c
pio_mpinonb.c
pio_posixasynch.c
pio_posixfpguardsendrecv.c
pio_posixnonb.c
pio_record_send.c
pio_roles.c
pio_rpc.c
pio_rpc.h
pio_serialize.c
pio_serialize.h
pio_server.c
pio_server.h
pio_util.c
pio_util.h
pio_xmap_cache.c
pio_xmap_cache.h
)
endif
()
option
(
CDI_BUILD_UNKNOWN
"Build unknown sources in libcdi"
ON
)
mark_as_advanced
(
CDI_BUILD_UNKNOWN
)
if
(
CDI_BUILD_UNKNOWN
)
list
(
APPEND cdi_src_files
${
cdi_unknown
}
)
target_sources
(
cdilib PRIVATE
cfortran.h
getline.c
make_fint.c
resource_unpack.c
resource_unpack.h
)
endif
()
# Support exporting all symbol
d
s on Windows
# Support exporting all symbols on Windows
set
(
CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON
)
set_property
(
TARGET cdilib PROPERTY CDI_INSTALL_HEADERS
${
CMAKE_CURRENT_SOURCE_DIR
}
/cdi.h
${
CMAKE_CURRENT_SOURCE_DIR
}
/calendar.h
${
CMAKE_CURRENT_SOURCE_DIR
}
/cdi_datetime.h
${
CMAKE_CURRENT_SOURCE_DIR
}
/julian_date.h
)
target_include_directories
(
cdilib PRIVATE
"
${
PROJECT_BINARY_DIR
}
/src/config.h"
)
target_link_libraries
(
cdilib
${
cdi_linked_libs
}
)
target_compile_definitions
(
cdilib PRIVATE PACKAGE_NAME=
"
${
PROJECT_NAME
}
"
VERSION=
"
${
CMAKE_PROJECT_VERSION
}
"
${
cdi_compile_defs
}
)
...
...
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