File: CMakeLists.txt

package info (click to toggle)
netcdf-fortran 4.5.3%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 7,456 kB
  • sloc: fortran: 25,848; f90: 20,793; sh: 4,609; ansic: 1,729; makefile: 585; pascal: 292; xml: 173
file content (69 lines) | stat: -rw-r--r-- 2,058 bytes parent folder | download
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
59
60
61
62
63
64
65
66
67
68
69
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

SET(CMAKE_VERBOSE_MAKEFILE OFF)
SET(CMAKE_BUILD_TYPE "RelWithDebInfo")
SET(CMAKE_INCLUDE_CURRENT_DIR ON)

# Process these files with m4.
SET(m4_SOURCES test_get test_put)
foreach (f ${m4_SOURCES})
		   GEN_m4(${f})
endforeach(f)

SET(nf_test_SOURCES
  f03lib_f_interfaces.f90 test_get.F test_put.F nf_error.F nf_test.F
  test_read.F test_write.F util.F f03lib.c tests.inc)

SET(tst_int64_SOURCES tst_int64.F)

SET(TESTS nf_test tst_int64)
IF (BUILD_V2)
  SET(check_PROGRAMS tst_f77_v2)
  SET(tst_f77_v2_SOURCES tst_f77_v2.F)
  SET(TESTS ${TESTS} tst_f77_v2)

# This is the fortran v2 test. It depends on the utilities being built
# to generate its input file.
  SET(check_PROGRAMS ${check_PROGRAMS} ftest)
  SET(TESTS ${TESTS} ftest)
  SET(ftest_SOURCES ftest.F f03lib.c)
ENDIF(BUILD_V2)

FIND_LIBRARY(NETCDF_C_LIBRARY NAMES netcdf libnetcdf)
FIND_PATH(NETCDF_C_INCLUDE_DIR netcdf.h)
IF(NOT NETCDF_C_LIBRARY)
  MESSAGE(FATAL_ERROR "Cannot find netCDF C library, needed for netCDF Fortran tests.")
ENDIF()

# Need a copy of ref_fills.nc for ftest
execute_process(COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/ref_fills.nc
  ${CMAKE_CURRENT_BINARY_DIR}/fills.nc)

# Create pre-compiled tests.
FOREACH(t ${TESTS})
  ADD_EXECUTABLE(${t} ${${t}_SOURCES})
  TARGET_LINK_LIBRARIES(${t} netcdff)
  ADD_TEST(${t} ${t})
ENDFOREACH()

# Copy test scripts in to current directory.
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)
FILE(COPY ${COPY_FILES}
	  DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/
	  FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE)

# Add script-based tests.
FOREACH(t ${SCRIPT_TESTS})
  add_sh_test(nf_test ${t})
ENDFOREACH()


# test_get.F and test_put.f need to be distributed, so that the user
# need not have m4. fills.nc is used by test program ftest.
SET (EXTRA_DIST test_get.F test_put.F fills.cdl create_fills.sh
   ref_fills.nc)

# Cleaning up files created during the process.
SET (CLEANFILES scratch.nc test.nc copy.nc fills.nc tst_*.nc ftst_*.nc)

SET (MAINTAINERCLEANFILES test_get.F test_put.F)