File: CMakeLists.txt

package info (click to toggle)
plplot 5.10.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 26,280 kB
  • ctags: 13,512
  • 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,210; makefile: 199; lisp: 75; sed: 25; fortran: 7
file content (155 lines) | stat: -rw-r--r-- 5,589 bytes parent folder | download | duplicates (4)
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
# lib/nistcd/CMakeLists.txt for PLplot
###
### Process this file with cmake to produce Makefile
###
# Copyright (C) 2006 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

# build nistcd library (a.k.a., "cd" library put into the public domain by
# NIST) required by the PLplot cgm device.
if(PLD_cgm)
  include_directories(
  ${CMAKE_CURRENT_SOURCE_DIR}
  )
  
  set( cd_LIB_SRCS cd.c )
  set( cd_LIB_HDRS cd.h defines.h )

  # Bypass "#include <malloc.h>" in all code where it appears since
  # being too specific like this fails on some platforms (e.g., OS X), and
  # the proper form of the malloc.h include should be dragged in by 
  # ""#include stdlib.h" in any case.
  # There may be some arcane platforms where we should not define this,
  # but for now, at least, try it for all platforms.
  set( cd_ADD_DEFINES "-DNOMALLOCH" )

  if(BUILD_SHARED_LIBS)
    set_source_files_properties( ${cd_LIB_SRCS}
      PROPERTIES COMPILE_FLAGS "-DUSINGDLL ${cd_ADD_DEFINES}"
      )
  endif(BUILD_SHARED_LIBS)

  add_library( nistcd ${cd_LIB_SRCS} )
  set_target_properties(
    nistcd
    PROPERTIES
    SOVERSION ${nistcd_SOVERSION}
    VERSION ${nistcd_VERSION}
    INSTALL_NAME_DIR "${LIB_DIR}"
    )

  option(TEST_NISTCD "Test libnistcd" ON)
  if(TEST_NISTCD AND NOT CMAKE_CROSSCOMPILING)
    # build applications to test libnistcd.
    set( cd_EXE cdexpert cdmulti cdsimple cdtest cdtext color16 )
    foreach(EXE ${cd_EXE})
      add_executable( ${EXE} ${EXE}.c )
      set_source_files_properties( ${EXE}.c
        PROPERTIES COMPILE_FLAGS "${cd_ADD_DEFINES}"
        )
      target_link_libraries( ${EXE} nistcd )
      get_target_property(${EXE}_LOC ${EXE} LOCATION)
    endforeach(EXE ${cd_EXE})
    # Create tests for libnistcd.
    file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir)

    add_custom_command(
      OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdexp1.cgm
      COMMAND ${cdexpert_LOC}
      COMMAND ${CMAKE_COMMAND} -E compare_files
      ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdexp1.cgm
      ${CMAKE_CURRENT_SOURCE_DIR}/cdexp1.cgm
      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir
      DEPENDS ${cdexpert_LOC}
      )
    
    add_custom_command(
      OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdmulti.cgm
      COMMAND ${cdmulti_LOC}
      COMMAND ${CMAKE_COMMAND} -E compare_files
      ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdmulti.cgm
      ${CMAKE_CURRENT_SOURCE_DIR}/cdmulti.cgm
      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir
      DEPENDS ${cdmulti_LOC}
      )
    
    add_custom_command(
      OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdsimple.cgm
      COMMAND ${cdsimple_LOC}
      COMMAND ${CMAKE_COMMAND} -E compare_files
      ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdsimple.cgm
      ${CMAKE_CURRENT_SOURCE_DIR}/cdsimple.cgm
      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir
      DEPENDS ${cdsimple_LOC}
      )
    
    add_custom_command(
      OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdout.cgm
      COMMAND ${cdtest_LOC}
      COMMAND ${CMAKE_COMMAND} -E compare_files
      ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdout.cgm
      ${CMAKE_CURRENT_SOURCE_DIR}/cdout.cgm
      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir
      DEPENDS ${cdtest_LOC}
      )
    
    add_custom_command(
      OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdtext.cgm
      COMMAND ${cdtext_LOC}
      COMMAND ${CMAKE_COMMAND} -E compare_files
      ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdtext.cgm
      ${CMAKE_CURRENT_SOURCE_DIR}/cdtext.cgm
      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir
      DEPENDS ${cdtext_LOC}
      )
    
    add_custom_command(
      OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/color16.cgm
      COMMAND ${color16_LOC}
      COMMAND ${CMAKE_COMMAND} -E compare_files
      ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/color16.cgm
      ${CMAKE_CURRENT_SOURCE_DIR}/color16.cgm
      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir
      DEPENDS ${color16_LOC}
      )

    add_custom_target(test_nistcd ALL
      DEPENDS
      ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdexp1.cgm
      ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdmulti.cgm
      ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdsimple.cgm
      ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdout.cgm
      ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdtext.cgm
      ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/color16.cgm
      )
    
  endif(TEST_NISTCD AND NOT CMAKE_CROSSCOMPILING) 

  # install library and binaries
  install(TARGETS nistcd
    EXPORT export_plplot
    ARCHIVE DESTINATION ${LIB_DIR}
    LIBRARY DESTINATION ${LIB_DIR}
    RUNTIME DESTINATION ${BIN_DIR}
    )

  # install library header files.
  install(
    FILES ${cd_LIB_HDRS}
    DESTINATION ${INCLUDE_DIR}
    )
endif(PLD_cgm)