"Fossies" - the Fresh Open Source Software Archive

Member "plplot-5.15.0/cmake/modules/ada.cmake" (1 Jun 2019, 3371 Bytes) of package /linux/misc/plplot-5.15.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) CMake source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "ada.cmake": 5.12.0_vs_5.13.0.

    1 # cmake/modules/ada.cmake
    2 #
    3 # Copyright (C) 2007-2015 Alan W. Irwin
    4 #
    5 # This file is part of PLplot.
    6 #
    7 # PLplot is free software; you can redistribute it and/or modify
    8 # it under the terms of the GNU Library General Public License as published
    9 # by the Free Software Foundation; version 2 of the License.
   10 #
   11 # PLplot is distributed in the hope that it will be useful,
   12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
   13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   14 # GNU Library General Public License for more details.
   15 #
   16 # You should have received a copy of the GNU Library General Public License
   17 # along with the file PLplot; if not, write to the Free Software
   18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
   19 
   20 # Module for determining Ada binding configuration options
   21 
   22 if(DEFAULT_NO_BINDINGS)
   23   option(ENABLE_ada "Enable Ada binding" OFF)
   24 else(DEFAULT_NO_BINDINGS)
   25   option(ENABLE_ada "Enable Ada binding" ON)
   26 endif(DEFAULT_NO_BINDINGS)
   27 
   28 if(ENABLE_ada AND NOT PL_DOUBLE)
   29   message(STATUS "WARNING: "
   30     "Only single-precision floating point. Disabling Ada binding because of run-time errors in this case.")
   31   set(ENABLE_ada OFF CACHE BOOL "Enable Ada binding" FORCE)
   32 endif(ENABLE_ada AND NOT PL_DOUBLE)
   33 
   34 if(ENABLE_ada AND NOT PLPLOT_Ada_COMPILER_WORKS)
   35   workaround_9220(Ada PLPLOT_Ada_COMPILER_WORKS)
   36   if(NOT PLPLOT_Ada_COMPILER_WORKS)
   37     message(STATUS "WARNING: no working Ada compiler so disabling Ada binding and examples.")
   38     set(ENABLE_ada OFF CACHE BOOL "Enable Ada binding" FORCE)
   39   endif(NOT PLPLOT_Ada_COMPILER_WORKS)
   40 endif(ENABLE_ada AND NOT PLPLOT_Ada_COMPILER_WORKS)
   41 
   42 if(ENABLE_ada)
   43   # Find and check Ada compiler
   44   enable_language(Ada OPTIONAL)
   45   if(NOT CMAKE_Ada_COMPILER_WORKS)
   46     message(STATUS "WARNING: no working Ada compiler so disabling Ada binding and examples.")
   47     set(ENABLE_ada OFF CACHE BOOL "Enable Ada binding" FORCE)
   48   endif(NOT CMAKE_Ada_COMPILER_WORKS)
   49 endif(ENABLE_ada)
   50 
   51 if(ENABLE_ada)
   52   # The following two default Ada install locations follow the recommendations in
   53   # <http://www.ada-france.org/debian/debian-ada-policy.html>.
   54   set(
   55     ADA_INCLUDE_DIR
   56     ${CMAKE_INSTALL_DATADIR}/ada/adainclude/plplotada
   57     CACHE PATH "PLplot install location for (architecture-independent) Ada source files"
   58     )
   59   list(APPEND INSTALL_LOCATION_VARIABLES_LIST ADA_INCLUDE_DIR)
   60 
   61   set(
   62     ADA_LIB_DIR
   63     ${CMAKE_INSTALL_LIBDIR}/ada/adalib/plplotada
   64     CACHE PATH "PLplot install location for Ada library information files (*.ali)"
   65     )
   66   list(APPEND INSTALL_LOCATION_VARIABLES_LIST ADA_LIB_DIR)
   67 
   68   # Find the gnat version used in order to search for the right version of libgnat
   69   execute_process(COMMAND ${CMAKE_Ada_COMPILER} --version OUTPUT_VARIABLE ADA_OUTPUT)
   70   string(REGEX MATCH "gcc.* [(][^)]*[)] ([0-9]*)([.][0-9]*)[.][0-9]" ADA_OUTPUT_TRIM ${ADA_OUTPUT})
   71   set(GNATMAJVERSION ${CMAKE_MATCH_1})
   72   set(GNATVERSION ${CMAKE_MATCH_1}${CMAKE_MATCH_2})
   73   message(STATUS "gnat version = ${GNATVERSION}")
   74   find_library(GNAT_LIB NAMES gnat gnat-${GNATVERSION} gnat-${GNATMAJVERSION})
   75   if(NOT GNAT_LIB)
   76     message(STATUS "WARNING: "
   77       "gnat library not found. Disabling Ada binding")
   78     set(ENABLE_ada OFF CACHE BOOL "Enable Ada binding" FORCE)
   79   else(NOT GNAT_LIB)
   80     message(STATUS "FOUND gnat library ${GNAT_LIB}")
   81   endif(NOT GNAT_LIB)
   82 endif(ENABLE_ada)