File: csiro.cmake

package info (click to toggle)
plplot 5.9.0-8
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 26,256 kB
  • ctags: 9,353
  • sloc: ansic: 64,079; xml: 22,799; cpp: 8,562; tcl: 8,314; perl: 4,872; python: 4,462; f90: 4,310; java: 4,090; sh: 1,481; makefile: 261; php: 102; fortran: 59; sed: 5
file content (88 lines) | stat: -rw-r--r-- 3,763 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
# cmake/modules/csiro.cmake
#
# 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 the file PLplot; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA

# Module for determining all configuration variables for the CSIRO libraries.

option(HAVE_QHULL "Enable use of the Qhull library" ON)
option(WITH_CSA "Enable use of the csa library" ON)

# This logic copied verbatim from csiro.ac for ix86 systems and alpha systems
# with two possible compilers.  In future, this logic will need to be
# expanded to a lot more cases as we gain platform experience.
set(NAN_CFLAGS ${CMAKE_C_FLAGS})
if(HAVE_QHULL OR WITH_CSA)
  if(CMAKE_SYSTEM_PROCESSOR MATCHES "i[0-9]86")
    set(NAN_CFLAGS "${NAN_CFLAGS} -mieee-fp")
  else(CMAKE_SYSTEM_PROCESSOR MATCHES "i[0-9]86")
    if(CMAKE_SYSTEM_PROCESSOR MATCHES "alpha.*")
      if(CMAKE_C_COMPILER MATCHES "gcc")
        set(NAN_CFLAGS "${NAN_CFLAGS} -mieee")
      else(CMAKE_C_COMPILER MATCHES "gcc")
        set(NAN_CFLAGS "${NAN_CFLAGS} -ieee")
      endif(CMAKE_C_COMPILER MATCHES "gcc")
    endif(CMAKE_SYSTEM_PROCESSOR MATCHES "alpha.*")
  endif(CMAKE_SYSTEM_PROCESSOR MATCHES "i[0-9]86")
  if(NOT DEFINED NaNAwareCCompiler)
    message(STATUS "Check for NaN awareness in C compiler")
    try_run(NaNAwareCCompiler COMPILE_RESULT
    ${CMAKE_BINARY_DIR}
    ${CMAKE_SOURCE_DIR}/cmake/modules/TestNaNAware.c
    CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${NAN_CFLAGS} -I${CMAKE_SOURCE_DIR}/lib/csa"
    OUTPUT_VARIABLE OUTPUT
    )
    if(NOT COMPILE_RESULT)
      set(NaNAwareCCompiler ${COMPILE_RESULT})
    endif(NOT COMPILE_RESULT)
    if(NaNAwareCCompiler)
      message(STATUS "Check for NaN awareness in C compiler - found")
      file(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log
      "Determining whether C compiler is NaN aware succeeded with "
      "the following output:\n${OUTPUT}\n\n"
      )
    else(NaNAwareCCompiler)
      message(STATUS "Check for NaN awareness in C compiler - not found")
      message(STATUS "WARNING: Setting HAVE_QHULL and WITH_CSA to OFF.")
      set(HAVE_QHULL OFF CACHE BOOL "Enable use of the Qhull library" FORCE)
      set(WITH_CSA OFF CACHE BOOL "Enable use of the csa library" FORCE)
      file(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
      "Determining whether C compiler is NaN aware failed with "
      "the following output:\n${OUTPUT}\n\n"
      )
    endif(NaNAwareCCompiler)
  endif(NOT DEFINED NaNAwareCCompiler)
endif(HAVE_QHULL OR WITH_CSA)

if(HAVE_QHULL)
  find_package(QHULL)
  if(QHULL_FOUND)
    include(CheckFunctionExists)
    set(CMAKE_REQUIRED_LIBRARIES ${QHULL_LIBRARIES})
    check_function_exists(qh_new_qhull QH_NEW_EXIST)
    set(CMAKE_REQUIRED_LIBRARIES)
    if(NOT QH_NEW_EXIST)
      message(STATUS "WARNING: function qh_new_qhull not found.  Setting HAVE_QHULL to OFF.")
      set(HAVE_QHULL OFF CACHE BOOL "Enable use of the Qhull library" FORCE)
    endif(NOT QH_NEW_EXIST)
  else(QHULL_FOUND)
    message(STATUS 
    "WARNING: qhull library not found.  Setting HAVE_QHULL to OFF."
    )
    set(HAVE_QHULL OFF CACHE BOOL "Enable use of the Qhull library" FORCE)
  endif(QHULL_FOUND)
endif(HAVE_QHULL)