File: CMakeLists.txt

package info (click to toggle)
plplot 5.10.0%2Bdfsg2-0.4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 25,792 kB
  • ctags: 13,517
  • sloc: ansic: 83,001; xml: 27,081; ada: 18,878; cpp: 15,966; tcl: 11,651; python: 7,075; f90: 7,058; ml: 6,974; java: 6,665; perl: 5,029; sh: 2,208; makefile: 210; lisp: 75; sed: 25; fortran: 7
file content (570 lines) | stat: -rw-r--r-- 18,488 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
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
# plplot_test/CMakeLists.txt for PLplot
###
### Process this file with cmake to produce Makefile
###
# Copyright (C) 2006-2013 Alan W. Irwin
#
# This file is part of PLplot.
#
# PLplot is free software; you can redistribute it and/or modify
# it under the terms of the GNU Library General Public License as published
# by the Free Software Foundation; version 2 of the License.
#
# PLplot is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public License
# along with PLplot; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA

# Only set up test environment, configure test files, and install them if
# a shell is available.

if(SH_EXECUTABLE)
  set(SCRIPTS)
  set(TEST_ENVIRONMENT
    "EXAMPLES_DIR=${CMAKE_BINARY_DIR}/examples SRC_EXAMPLES_DIR=${CMAKE_SOURCE_DIR}/examples"
    )

  set(TEST_DEVICE psc CACHE STRING "device used for ctest")
  # There is no PLD_psc or PLD_psttfc and the PLD_ps and PLD_psttf
  # variables must be used instead.  All other PLD_* names correspond
  # to exact device names.  So adjust for this complicated naming
  # scheme in a general way in case some other TEST_DEVICE is chosen
  # in the future.
  if(TEST_DEVICE STREQUAL "psc")
    set(PLD_TEST_DEVICE ${PLD_ps})
  elseif(TEST_DEVICE STREQUAL "psttfc")
    set(PLD_TEST_DEVICE ${PLD_psttf})
  else(TEST_DEVICE STREQUAL "psc")
    set(PLD_TEST_DEVICE ${PLD_${TEST_DEVICE}})
  endif(TEST_DEVICE STREQUAL "psc")

  set(TEST_SCRIPT "./plplot-test.sh --verbose")
  set(TEST_SCRIPT_DEVICE "${TEST_SCRIPT} --device=${TEST_DEVICE}")

  set(JAVA_TEST_ENVIRONMENT "${TEST_ENVIRONMENT} PLPLOT_JAVA_WRAP_DIR=${CMAKE_BINARY_DIR}/bindings/java/ PLPLOT_CLASSPATH=${CMAKE_BINARY_DIR}/examples/java/plplot.jar")

  #Build-tree configuration
  set(CONFIGURED_EXAMPLES_DIR EXAMPLES_DIR)
  configure_file(
    plplot-test.sh.in
    ${CMAKE_CURRENT_BINARY_DIR}/plplot-test.sh
    @ONLY
    )

  #Install-tree configuration
  set(CONFIGURED_EXAMPLES_DIR SRC_EXAMPLES_DIR)
  configure_file(
    plplot-test.sh.in
    ${CMAKE_CURRENT_BINARY_DIR}/plplot-test.sh_install
    @ONLY
    )

  # Set up optional tests in the configured plplot-test-interactive.sh file.

  set(pkgIndex_LOCATION ${DATA_DIR})
  set(SHELL_TEST_PLTCL_STANDARD_EXAMPLES 1)
  set(SHELL_TEST_PLSERVER_STANDARD_EXAMPLES 1)
  # FIXME.  Currently plserver_runAllDemos needs work so drop it for now.
  set(SHELL_TEST_PLSERVER_RUNALLDEMOS 0)

  # All Tcl/Tk tests that use the "package require" approach only
  # work with shared libraries.
  if(BUILD_SHARED_LIBS)
    set(SHELL_TEST_TCLSH_STANDARD_EXAMPLES 1)
    # FIXME.  Currently wish_standard_examples segfaults on exit.  So
    # drop it for now.
    set(SHELL_TEST_WISH_STANDARD_EXAMPLES 0)
    # FIXME.  Currently the wish_runAllDemos needs work and also has
    # an intermittent bug (x?? not recognized as a command).
    set(SHELL_TEST_WISH_RUNALLDEMOS 0)
  else(BUILD_SHARED_LIBS)
    set(SHELL_TEST_TCLSH_STANDARD_EXAMPLES 0)
    set(SHELL_TEST_WISH_STANDARD_EXAMPLES 0)
    set(SHELL_TEST_WISH_RUNALLDEMOS 0)
  endif(BUILD_SHARED_LIBS)

  configure_file(
    plplot-test-interactive.sh.in
    ${CMAKE_CURRENT_BINARY_DIR}/plplot-test-interactive.sh
    @ONLY
    )

  configure_file(
    test_c.sh.in
    ${CMAKE_CURRENT_BINARY_DIR}/test_c.sh
    @ONLY
    )
  list(APPEND SCRIPTS test_c.sh)

  configure_file(
    test_c_interactive.sh.in
    ${CMAKE_CURRENT_BINARY_DIR}/test_c_interactive.sh
    @ONLY
    )
  list(APPEND SCRIPTS test_c_interactive.sh)

  set(test_output_files_LIST)
  set(examples_compare_DEPENDS)

  if(PLD_TEST_DEVICE)
    add_test(examples_c
      ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT_DEVICE} --front-end=c"
      )
    list(APPEND examples_compare_DEPENDS examples_c)
    list_example_files(. ${TEST_DEVICE} c output_list)
    list(APPEND test_output_files_LIST ${output_list})
  endif(PLD_TEST_DEVICE)

  if(ENABLE_cxx)
    configure_file(
      test_cxx.sh.in
      ${CMAKE_CURRENT_BINARY_DIR}/test_cxx.sh
      @ONLY
      )
    list(APPEND SCRIPTS test_cxx.sh)
    if(PLD_TEST_DEVICE)
      add_test(examples_cxx
	${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT_DEVICE} --front-end=cxx"
	)
      list(APPEND examples_compare_DEPENDS examples_cxx)
      list_example_files(. ${TEST_DEVICE} cxx output_list)
      list(APPEND test_output_files_LIST ${output_list})
    endif(PLD_TEST_DEVICE)
  endif(ENABLE_cxx)

  if(ENABLE_f95)
    configure_file(
      test_f95.sh.in
      ${CMAKE_CURRENT_BINARY_DIR}/test_f95.sh
      @ONLY
      )
    list(APPEND SCRIPTS test_f95.sh)
    if(PLD_TEST_DEVICE)
      add_test(examples_f95
	${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT_DEVICE} --front-end=f95"
	)
      list(APPEND examples_compare_DEPENDS examples_f95)
      list_example_files(. ${TEST_DEVICE} f95 output_list)
      list(APPEND test_output_files_LIST ${output_list})
    endif(PLD_TEST_DEVICE)
  endif(ENABLE_f95)

  if(ENABLE_java)
    configure_file(
      test_java.sh.in
      ${CMAKE_CURRENT_BINARY_DIR}/test_java.sh
      @ONLY
      )
    list(APPEND SCRIPTS test_java.sh)
    if(PLD_TEST_DEVICE)
      add_test(examples_java
	${SH_EXECUTABLE} -c "${JAVA_TEST_ENVIRONMENT} ${TEST_SCRIPT_DEVICE} --front-end=java"
	)
      list(APPEND examples_compare_DEPENDS examples_java)
      list_example_files(. ${TEST_DEVICE} j output_list)
      list(APPEND test_output_files_LIST ${output_list})
    endif(PLD_TEST_DEVICE)
  endif(ENABLE_java)

  if(ENABLE_octave)

    configure_file(
      test_octave_interactive.sh.in
      ${CMAKE_CURRENT_BINARY_DIR}/test_octave_interactive.sh
      @ONLY
      )
    list(APPEND SCRIPTS test_octave_interactive.sh)

    configure_file(
      test_octave.sh.in
      ${CMAKE_CURRENT_BINARY_DIR}/test_octave.sh
      @ONLY
      )
    list(APPEND SCRIPTS test_octave.sh)
    if(PLD_TEST_DEVICE)
      add_test(examples_octave
	${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT_DEVICE} --front-end=octave"
	)
      list(APPEND examples_compare_DEPENDS examples_octave)
      list_example_files(. ${TEST_DEVICE} o output_list)
      list(APPEND test_output_files_LIST ${output_list})
    endif(PLD_TEST_DEVICE)
  endif(ENABLE_octave)

  if(ENABLE_python)
    configure_file(
      test_python.sh.in
      ${CMAKE_CURRENT_BINARY_DIR}/test_python.sh
      @ONLY
      )
    list(APPEND SCRIPTS test_python.sh)
    if(PLD_TEST_DEVICE)
      add_test(examples_python
	${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT_DEVICE} --front-end=python"
	)
      list(APPEND examples_compare_DEPENDS examples_python)
      list_example_files(. ${TEST_DEVICE} p output_list)
      list(APPEND test_output_files_LIST ${output_list})
    endif(PLD_TEST_DEVICE)
  endif(ENABLE_python)

  if(ENABLE_tcl)
    get_target_property(pltcl_LOC pltcl LOCATION)
    string(REGEX REPLACE "/pltcl.*$" "" PLTCL_DIR ${pltcl_LOC})
    # Experience with MSYS bash shows that variables used to set a
    # PATH component must transform the drive-letter form to the
    # leading-slash Unix form of the PATH component.  The case of the
    # drive letter doesn't matter.  For example converting
    # z:/whatever/path ==> /z/whatever/path or /Z/whatever/path works
    # fine for MSYS bash.
    string(REGEX REPLACE "^(.):/" "/\\1/" PLTCL_DIR ${PLTCL_DIR})


    configure_file(test_tcl.sh.in
      ${CMAKE_CURRENT_BINARY_DIR}/test_tcl.sh
      @ONLY
      )
    if(PLD_TEST_DEVICE)
      add_test(examples_tcl
	${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT_DEVICE} --front-end=tcl"
	)
      list(APPEND examples_compare_DEPENDS examples_tcl)
      list_example_files(. ${TEST_DEVICE} t output_list)
      list(APPEND test_output_files_LIST ${output_list})
    endif(PLD_TEST_DEVICE)
    set(PLTCL_DIR ${BIN_DIR})
    # Transform drive-letter form to leading-slash form, see comment above.
    string(REGEX REPLACE "^(.):" "/\\1/" PLTCL_DIR ${PLTCL_DIR})

    configure_file(test_tcl.sh.in
      ${CMAKE_CURRENT_BINARY_DIR}/test_tcl.sh_install
      @ONLY
      )
  endif(ENABLE_tcl)

  if(ENABLE_pdl)
    configure_file(
      test_pdl.sh.in
      ${CMAKE_CURRENT_BINARY_DIR}/test_pdl.sh
      @ONLY
      )
    list(APPEND SCRIPTS test_pdl.sh)
    if(PLD_TEST_DEVICE)
      add_test(examples_pdl
	${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT_DEVICE} --front-end=pdl"
	)
      list(APPEND examples_compare_DEPENDS examples_pdl)
      list_example_files(. ${TEST_DEVICE} pdl output_list)
      list(APPEND test_output_files_LIST ${output_list})
    endif(PLD_TEST_DEVICE)
  endif(ENABLE_pdl)

  if(ENABLE_ada)
    configure_file(
      test_ada.sh.in
      ${CMAKE_CURRENT_BINARY_DIR}/test_ada.sh
      @ONLY
      )
    list(APPEND SCRIPTS test_ada.sh)
    if(PLD_TEST_DEVICE)
      add_test(examples_ada
	${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT_DEVICE} --front-end=ada"
	)
      list(APPEND examples_compare_DEPENDS examples_ada)
      list_example_files(. ${TEST_DEVICE} a output_list)
      list(APPEND test_output_files_LIST ${output_list})
    endif(PLD_TEST_DEVICE)
  endif(ENABLE_ada)

  if(ENABLE_ocaml)
    configure_file(
      test_ocaml.sh.in
      ${CMAKE_CURRENT_BINARY_DIR}/test_ocaml.sh
      @ONLY
      )
    list(APPEND SCRIPTS test_ocaml.sh)
    if(PLD_TEST_DEVICE)
      add_test(examples_ocaml
	${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT_DEVICE} --front-end=ocaml"
	)
      list(APPEND examples_compare_DEPENDS examples_ocaml)
      list_example_files(. ${TEST_DEVICE} ocaml output_list)
      list(APPEND test_output_files_LIST ${output_list})
    endif(PLD_TEST_DEVICE)
  endif(ENABLE_ocaml)

  if(ENABLE_lua)
    configure_file(
      test_lua.sh.in
      ${CMAKE_CURRENT_BINARY_DIR}/test_lua.sh
      @ONLY
      )
    list(APPEND SCRIPTS test_lua.sh)
    if(PLD_TEST_DEVICE)
      add_test(examples_lua
	${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT_DEVICE} --front-end=lua"
	)
      list(APPEND examples_compare_DEPENDS examples_lua)
      list_example_files(. ${TEST_DEVICE} lua output_list)
      list(APPEND test_output_files_LIST ${output_list})
    endif(PLD_TEST_DEVICE)
  endif(ENABLE_lua)

  if(ENABLE_d)
    configure_file(
      test_d.sh.in
      ${CMAKE_CURRENT_BINARY_DIR}/test_d.sh
      @ONLY
      )
    list(APPEND SCRIPTS test_d.sh)
    if(PLD_TEST_DEVICE)
      add_test(examples_d
	${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT_DEVICE} --front-end=d"
	)
      list(APPEND examples_compare_DEPENDS examples_d)
      list_example_files(. ${TEST_DEVICE} d output_list)
      list(APPEND test_output_files_LIST ${output_list})
    endif(PLD_TEST_DEVICE)
  endif(ENABLE_d)

  # Run C examples with different drivers
  if(PLD_ps)
    if (NOT TEST_DEVICE STREQUAL "psc")
      add_test(examples_psc
	${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=psc"
	)
      list_example_files(. psc c output_list)
      list(APPEND test_output_files_LIST ${output_list})
    endif(NOT TEST_DEVICE STREQUAL "psc")
  endif(PLD_ps)

  if(PLD_psttf)
    add_test(examples_psttfc
      ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=psttfc"
      )
    list_example_files(. psttfc c output_list)
    list(APPEND test_output_files_LIST ${output_list})
  endif(PLD_psttf)

  if(PLD_pstex)
    add_test(examples_pstex
      ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=pstex"
      )
    list_example_files(. pstex c output_list)
    list(APPEND test_output_files_LIST ${output_list})
  endif(PLD_pstex)

  if(PLD_png)
    add_test(examples_png
      ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=png"
      )
    list_example_files(. png c output_list)
    list(APPEND test_output_files_LIST ${output_list})
  endif(PLD_png)

  if(PLD_svg)
    add_test(examples_svg
      ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=svg"
      )
    list_example_files(. svg c output_list)
    list(APPEND test_output_files_LIST ${output_list})
  endif(PLD_svg)

  if(PLD_plmeta)
    add_test(examples_plmeta
      ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=plmeta"
      )
    list_example_files(. plmeta c output_list)
    list(APPEND test_output_files_LIST ${output_list})
  endif(PLD_plmeta)

  if(PLD_pscairo)
    add_test(examples_pscairo
      ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=pscairo"
      )
    list_example_files(. pscairo c output_list)
    list(APPEND test_output_files_LIST ${output_list})
  endif(PLD_pscairo)

  if(PLD_pngcairo)
    add_test(examples_pngcairo
      ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=pngcairo"
      )
    list_example_files(. pngcairo c output_list)
    list(APPEND test_output_files_LIST ${output_list})
  endif(PLD_pngcairo)

  if(PLD_xfig)
    add_test(examples_xfig
      ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=xfig"
      )
    list_example_files(. xfig c output_list)
    list(APPEND test_output_files_LIST ${output_list})
  endif(PLD_xfig)

  if(PLD_gif)
    add_test(examples_gif
      ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=gif"
      )
    list_example_files(. gif c output_list)
    list(APPEND test_output_files_LIST ${output_list})
  endif(PLD_gif)

  if(PLD_cgm)
    add_test(examples_cgm
      ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=cgm"
      )
    list_example_files(. cgm c output_list)
    list(APPEND test_output_files_LIST ${output_list})
  endif(PLD_cgm)

  if(PLD_bmpqt)
    add_test(examples_bmpqt
      ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=bmpqt"
      )
    list_example_files(. bmpqt c output_list)
    list(APPEND test_output_files_LIST ${output_list})
  endif(PLD_bmpqt)

  if(PLD_jpgqt)
    add_test(examples_jpgqt
      ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=jpgqt"
      )
    list_example_files(. jpgqt c output_list)
    list(APPEND test_output_files_LIST ${output_list})
  endif(PLD_jpgqt)

  if(PLD_pngqt)
    add_test(examples_pngqt
      ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=pngqt"
      )
    list_example_files(. pngqt c output_list)
    list(APPEND test_output_files_LIST ${output_list})
  endif(PLD_pngqt)

  if(PLD_ppmqt)
    add_test(examples_ppmqt
      ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=ppmqt"
      )
    list_example_files(. ppmqt c output_list)
    list(APPEND test_output_files_LIST ${output_list})
  endif(PLD_ppmqt)

  if(PLD_tiffqt)
    add_test(examples_tiffqt
      ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=tiffqt"
      )
    list_example_files(. tiffqt c output_list)
    list(APPEND test_output_files_LIST ${output_list})
  endif(PLD_tiffqt)

  if(PLD_svgqt)
    add_test(examples_svgqt
      ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=svgqt"
      )
    list_example_files(. svgqt c output_list)
    list(APPEND test_output_files_LIST ${output_list})
  endif(PLD_svgqt)

  if(PLD_epsqt)
    add_test(examples_epsqt
      ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=epsqt"
      )
    list_example_files(. epsqt c output_list)
    list(APPEND test_output_files_LIST ${output_list})
  endif(PLD_epsqt)

  if(PLD_pdfqt)
    add_test(examples_pdfqt
      ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=pdfqt"
      )
    list_example_files(. pdfqt c output_list)
    list(APPEND test_output_files_LIST ${output_list})
  endif(PLD_pdfqt)

  if(PLD_pdf)
    add_test(examples_pdf
      ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=pdf"
      )
    list_example_files(. pdf c output_list)
    list(APPEND test_output_files_LIST ${output_list})
  endif(PLD_pdf)

  if(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE)
    configure_file(
      test_diff.sh.in
      ${CMAKE_CURRENT_BINARY_DIR}/test_diff.sh
      @ONLY
      )
    list(APPEND SCRIPTS test_diff.sh)
    add_test(examples_compare
      ${SH_EXECUTABLE} -c "./test_diff.sh"
      )
    # There is a bug in 2.8.x with x < 5 where tests are run out of
    # the order in which they are declared by default.  Also, 2.8.x
    # can run repeat tests out of order due to some optimizations that
    # have been implemented.  Thus, always force examples_compare to
    # be run after the other tests it depends on.
    #message(STATUS "DEBUG: examples_compare_DEPENDS = ${examples_compare_DEPENDS}")
    set_tests_properties(examples_compare
      PROPERTIES
      DEPENDS "${examples_compare_DEPENDS}"
      )
  endif(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE)

  if(BUILD_TEST)
    # Custom target to remove everything created by ctest
    # N.B. the test_output_files_LIST is extremely long and
    # overflows the maximum line length of the shell if you
    # replace "." above with ${CMAKE_CURRENT_BINARY_DIR}
    add_custom_target(clean_ctest_plot_files
      COMMAND ${CMAKE_COMMAND} -E remove ${test_output_files_LIST}
      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
      )

  endif(BUILD_TEST)

  set(PERM_SCRIPTS
    OWNER_READ
    OWNER_WRITE
    OWNER_EXECUTE
    GROUP_READ
    GROUP_EXECUTE
    WORLD_READ
    WORLD_EXECUTE
    )

  foreach(SCRIPT ${SCRIPTS})
    install(
      FILES ${CMAKE_CURRENT_BINARY_DIR}/${SCRIPT}
      DESTINATION ${DATA_DIR}/examples
      PERMISSIONS ${PERM_SCRIPTS}
      )
  endforeach(SCRIPT ${SCRIPTS})

  install(
    FILES ${CMAKE_CURRENT_BINARY_DIR}/plplot-test.sh_install
    DESTINATION ${DATA_DIR}/examples
    PERMISSIONS ${PERM_SCRIPTS}
    RENAME plplot-test.sh
    )

  if(ENABLE_tcl)
    install(
      FILES ${CMAKE_CURRENT_BINARY_DIR}/test_tcl.sh_install
      DESTINATION ${DATA_DIR}/examples
      PERMISSIONS ${PERM_SCRIPTS}
      RENAME test_tcl.sh
      )
  endif(ENABLE_tcl)
  install(
    FILES ${CMAKE_CURRENT_BINARY_DIR}/plplot-test-interactive.sh
    DESTINATION ${DATA_DIR}/examples
    PERMISSIONS ${PERM_SCRIPTS}
    )

endif(SH_EXECUTABLE)