File: CMakeLists.txt

package info (click to toggle)
eccodes 2.45.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 154,404 kB
  • sloc: cpp: 162,953; ansic: 26,308; sh: 21,742; f90: 6,854; perl: 6,361; python: 5,172; java: 2,226; javascript: 1,427; yacc: 854; fortran: 543; lex: 359; makefile: 283; xml: 183; awk: 66
file content (180 lines) | stat: -rw-r--r-- 4,994 bytes parent folder | download | duplicates (2)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# examples/C/CMakeLists.txt

# Configure the file which all CMake tests will include
configure_file( include.ctest.sh.in  include.ctest.sh  @ONLY )


# Build the executables used by test scripts
#############################################
list( APPEND test_bins
      grib_nearest
      grib_set_bitmap
      grib_iterator
      grib_get_keys
      grib_print_data
      grib_set_keys
      grib_index
      grib_set_missing
      grib_keys_iterator
      grib_set_data
      grib_nearest_multiple
      grib_multi
      grib_multi_write
      grib_precision
      grib_set_pv
      grib_list
      grib_get_data
      grib_sections_copy
      grib_copy_keys
      grib_clone
      grib_copy_message
      grib_ensemble_index
      bufr_copy_data
      bufr_attributes
      bufr_clone
      bufr_expanded
      bufr_get_keys
      bufr_get_string_array
      bufr_keys_iterator
      bufr_missing
      bufr_read_header
      bufr_read_scatterometer
      bufr_read_synop
      bufr_read_temp
      bufr_read_tempf
      bufr_set_keys
      bufr_subset
      grib_values_check
      multi2
      large_grib1
      get_product_kind)

foreach( tool ${test_bins} )
    ecbuild_add_executable( TARGET    c_${tool}
                            NOINSTALL
                            SOURCES   ${tool}.c
                            LIBS      eccodes )
endforeach()

# Now add each test (shell scripts)
####################################
if( HAVE_BUILD_TOOLS )
    # Command line tools are available
    list(APPEND tests_sanity
         grib_set_data
         large_grib1
         grib_sections_copy
         grib_copy_keys
         get_product_kind_samples)
    list(APPEND tests_extra
       grib_iterator
       grib_get_keys
       grib_print_data
       grib_set_keys
       grib_keys_iterator
       grib_multi_write
       grib_precision
       grib_clone
       grib_copy_message
       grib_ensemble_index
       grib_index
       grib_set_pv
       grib_set_bitmap
       grib_list
       grib_get_data
       grib_nearest
       grib_nearest_multiple
       grib_multi
       grib_set_missing
       grib_values_check
       bufr_attributes
       bufr_copy_data
       bufr_clone
       bufr_expanded
       bufr_get_keys
       bufr_get_string_array
       bufr_keys_iterator
       bufr_missing
       bufr_read_header
       bufr_read_scatterometer
       bufr_read_synop
       bufr_read_temp
       bufr_read_tempf
       bufr_set_keys
       bufr_subset
       get_product_kind)
else()
    # No command line tools
    list(APPEND tests_sanity
        grib_set_data
        get_product_kind_samples)
    list(APPEND tests_extra
       grib_iterator
       grib_get_keys
       grib_print_data
       grib_set_keys
       grib_keys_iterator
       grib_precision
       grib_ensemble_index
       grib_set_pv
       grib_list
       grib_get_data
       grib_nearest_multiple
       grib_multi
       grib_set_missing
       bufr_attributes
       bufr_expanded
       bufr_get_keys
       bufr_get_string_array
       bufr_keys_iterator
       bufr_missing
       bufr_read_header
       bufr_read_scatterometer
       bufr_read_synop
       bufr_read_temp
       bufr_read_tempf
       bufr_set_keys
       bufr_subset
       get_product_kind)
endif()

foreach( test ${tests_sanity} )
        ecbuild_add_test( TARGET       eccodes_c_${test}
                          TYPE         SCRIPT
                          LABELS       "sanity"
                          COMMAND      ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh )
endforeach()
foreach( test ${tests_extra} )
        ecbuild_add_test( TARGET       eccodes_c_${test}
                          TYPE         SCRIPT
                          CONDITION    ENABLE_EXTRA_TESTS
                          COMMAND      ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh
                          TEST_DEPENDS eccodes_download_gribs eccodes_download_bufrs eccodes_download_bufr_refs )
endforeach()

# Tests which are conditional
#############################
if( ENABLE_EXTRA_TESTS AND HAVE_ECCODES_THREADS )
    # For POSIX threads
    list(APPEND pthread_tests grib_pthreads bufr_pthreads)
    foreach( test ${pthread_tests} )
        ecbuild_add_executable( TARGET    c_${test}
                                NOINSTALL
                                SOURCES   ${test}.c
                                LIBS      eccodes ${CMAKE_THREAD_LIBS_INIT} )
        ecbuild_add_test( TARGET       eccodes_c_${test}
                          TYPE         SCRIPT
                          COMMAND      ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh
                          TEST_DEPENDS eccodes_download_gribs eccodes_download_bufrs )
    endforeach()
endif()

# Tests with no script
######################
ecbuild_add_test(
    TARGET    eccodes_c_new_sample
    SOURCES   new_sample.c
    LIBS      eccodes
    ARGS      "out.grib"
    ENVIRONMENT "ECCODES_SAMPLES_PATH=${PROJECT_SOURCE_DIR}/samples" "ECCODES_DEFINITION_PATH=${PROJECT_SOURCE_DIR}/definitions"
)