Skip to content

Commit 8d1f8fe

Browse files
committed
cmake 3.12 compat
1 parent 650bce5 commit 8d1f8fe

File tree

4 files changed

+19
-14
lines changed

4 files changed

+19
-14
lines changed

CMakeLists.txt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/netcdf.cmake)
1515

1616
set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR})
1717

18-
add_subdirectory(src)
19-
2018
# --- install
2119

2220
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
@@ -29,7 +27,6 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
2927
set(CMAKE_INSTALL_PREFIX "${HOME}/.local/nc4fortran" CACHE PATH "..." FORCE)
3028
endif()
3129

32-
install(TARGETS nc4fortran
33-
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}
34-
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX})
35-
install(FILES ${CMAKE_BINARY_DIR}/nc4fortran.mod DESTINATION ${CMAKE_INSTALL_PREFIX})
30+
# --- build
31+
32+
add_subdirectory(src)

meson.build

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,12 @@ if not meson.is_subproject()
1919
endif
2020

2121
subdir('src')
22+
23+
netcdf_interface = library('netcdf_interface',
24+
sources: nc4_src,
25+
dependencies: netcdf,
26+
install: true)
27+
28+
if not meson.is_subproject()
29+
subdir('src/tests')
30+
endif

src/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,9 @@ set_target_properties(nc4fortran PROPERTIES
66
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
77
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
88

9+
install(TARGETS nc4fortran
10+
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}
11+
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX})
12+
install(FILES ${CMAKE_BINARY_DIR}/nc4fortran.mod DESTINATION ${CMAKE_INSTALL_PREFIX})
13+
914
add_subdirectory(tests)

src/meson.build

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,2 @@
1-
netcdf_interface = library('netcdf_interface',
2-
sources: ['netcdf4_interface.f90', 'read.f90', 'reader.f90', 'write.f90', 'writer.f90', 'string_utils.f90'],
3-
dependencies: netcdf,
4-
install: true)
5-
6-
if not meson.is_subproject()
7-
subdir('tests')
8-
endif
1+
nc4_src = files('netcdf4_interface.f90', 'read.f90', 'reader.f90',
2+
'write.f90', 'writer.f90', 'string_utils.f90')

0 commit comments

Comments
 (0)