1# cmake/modules/plplot.cmake
2#
3# Copyright (C) 2006-2018 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 all configuration variables for PLplot.
21
22# The "certain devices" I have in mind at the moment are wxwidgets and wingcc since both
23# of those devices simply show a blank screen rather than the plot actively being rendered when -np is
24# used.  So once those -np issues are fixed for wxwidgets and wingcc, this option will no longer
25# be necessary.
26
27option(PAUSE_CERTAIN_INTERACTIVE_DEVICES "Experimental option to drop the -np option for interactive tests of certain devices where -np is currently not implemented well" OFF)
28
29option(ADD_SPECIAL_CONSISTENCY_CHECKING "Add extra source-tree consistency checking targets that require special tools" OFF)
30
31# option(DROP_GTK_PLUS_2_BUILDS "Drop builds of gtk+2-only targets that clash with gtk+3 dependencies" OFF)
32set(DROP_GTK_PLUS_2_BUILDS ON CACHE BOOL "Drop builds of gtk+2-only targets that clash with gtk+3 dependencies" FORCE)
33
34# target that depends on all check targets.
35add_custom_target(check_all)
36
37# libraries are all shared by default
38option(BUILD_SHARED_LIBS "Build shared libraries" ON)
39
40# CYGWIN eliminated here because .a suffix is not sufficient to guarantee a
41# static library on that platform.
42if(UNIX AND NOT CYGWIN AND NOT BUILD_SHARED_LIBS)
43  option(FORCE_EXTERNAL_STATIC "Force external UNIX libraries to be static" OFF)
44else(UNIX AND NOT CYGWIN AND NOT BUILD_SHARED_LIBS)
45  set(FORCE_EXTERNAL_STATIC OFF CACHE BOOL "Force external UNIX libraries to be static" FORCE)
46endif(UNIX AND NOT CYGWIN AND NOT BUILD_SHARED_LIBS)
47
48if(FORCE_EXTERNAL_STATIC)
49  # All find_library commands append this suffix to the searched name so
50  # this always forces find_library to find only the Unix static library
51  # if it exists or fail if it doesn't exist.
52  set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
53endif(FORCE_EXTERNAL_STATIC)
54
55if(BUILD_SHARED_LIBS)
56  # OFF means shared libraries (but never static libraries) are
57  # transitively linked by default by CMake and also by pkg-config (used
58  # to generate compile and link flags for the traditional build and
59  # test system of the installed examples).
60  if(WIN32_OR_CYGWIN)
61    option(NON_TRANSITIVE "Option to use non-transitive linking" OFF)
62  else(WIN32_OR_CYGWIN)
63    option(NON_TRANSITIVE "Option to use non-transitive linking" ON)
64  endif(WIN32_OR_CYGWIN)
65else(BUILD_SHARED_LIBS)
66  set(NON_TRANSITIVE OFF CACHE BOOL "Option to use non-transitive linking" FORCE)
67endif(BUILD_SHARED_LIBS)
68
69# Color maps (discrete and continuous) to use by default
70if(NOT DEFAULT_CMAP0_FILE)
71  set(DEFAULT_CMAP0_FILE "cmap0_default.pal")
72endif(NOT DEFAULT_CMAP0_FILE)
73
74if(NOT DEFAULT_CMAP1_FILE)
75  set(DEFAULT_CMAP1_FILE "cmap1_default.pal")
76endif(NOT DEFAULT_CMAP1_FILE)
77
78# Deprecated functions are not included by default. Set to ON if you
79# require this for backwards compatibility.
80option(PL_DEPRECATED "Include support for deprecated functions" OFF)
81
82# Set to ON if want to use general fill_intersection_polygon approach
83# rather than the traditional code to fill the intersection of a
84# polygon with the clipping limits.
85
86option(USE_FILL_INTERSECTION_POLYGON "use fill_intersection_polygon" OFF)
87
88# Need these modules to do subsequent checks.
89include(CheckIncludeFile)
90include(CheckIncludeFiles)
91include(CheckFunctionExists)
92include(CheckSymbolExists)
93include(CheckPrototypeExists)
94# Required for the cmake_push_check_state and cmake_pop_check_state
95# macros used to store and retrieve CMAKE_REQUIRED_* variables used in
96# conjunction with some of the CMake check_* functions that we call.
97include(CMakePushCheckState)
98
99# Include some useful functions that Plplot requires.
100include(plplot_functions)
101
102# =======================================================================
103# Compilation and build options (PLFLT, install locations, and rpath)
104# Note, must come before java since that depends on, e.g., LIB_DIR.
105# =======================================================================
106
107# WIN32_OR_CYGWIN covers CYGWIN as well (and possibly MINGW, but we will make sure).
108if(WIN32_OR_CYGWIN OR MINGW)
109  set(EXEEXT .exe)
110endif(WIN32_OR_CYGWIN OR MINGW)
111
112include(double)
113include(instdirs)
114include(rpath)
115
116# Common CMakeLists.txt files are used to build the examples in the build
117# tree and also to build the installed examples by the new CMake-based build
118# system devoted to that purpose. Set this fundamental identification to
119# distinguish the two cases.
120set(CORE_BUILD ON)
121
122option(BUILD_TEST "Compile examples in the build tree and enable ctest" OFF)
123
124# Use bash when available for ctest and install tree test support
125find_program(SH_EXECUTABLE bash)
126find_program(SH_EXECUTABLE win-bash)
127if(SH_EXECUTABLE)
128  set(HAVE_BASH ON)
129else(SH_EXECUTABLE)
130  find_program(SH_EXECUTABLE sh)
131endif(SH_EXECUTABLE)
132message(STATUS "SH_EXECUTABLE = ${SH_EXECUTABLE}")
133
134if(NOT SH_EXECUTABLE)
135   message(STATUS
136   "WARNING: bash shell not found, ctest will not work properly"
137   )
138endif(NOT SH_EXECUTABLE)
139
140option(PREBUILD_DIST "Pre-build all components required for distribution" OFF)
141if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
142  set(
143  PREBUILD_DIST OFF CACHE INTERNAL
144  "Pre-build all components required for distribution"
145  )
146endif(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
147
148# create a devpackage file
149option(DEVPAK "Create DevPackage" NO)
150if(DEVPAK AND NOT WIN32_OR_CYGWIN)
151  message( STATUS "DevPackage only available for Win32. Set DEVPAK to OFF." )
152  set(DEVPAK OFF)
153endif(DEVPAK AND NOT WIN32_OR_CYGWIN)
154if(DEVPAK AND BUILD_TEST)
155  message( STATUS "Examples are not build for DevPackage. Set BUILD_TEST to OFF." )
156  set(BUILD_TEST OFF)
157endif(DEVPAK AND BUILD_TEST)
158
159
160# =======================================================================
161# Headers
162# =======================================================================
163
164# AC_HEADER_STDC is gross overkill since the current PLplot code only uses
165# this for whether or not atexit can be used.  But implement the full suite
166# of AC_HEADER_STDC checks to keep the cmake version in synch with autotools
167# and just in case some PLplot developer assumes the complete check for
168# standard headers is done for a future programming change.
169#
170# From info autoconf....
171# Define STDC_HEADERS if the system has ANSI C header files.
172# Specifically, this macro checks for stdlib.h', stdarg.h',
173# string.h', and float.h'; if the system has those, it probably
174# has the rest of the ANSI C header files.  This macro also checks
175# whether string.h' declares memchr' (and thus presumably the
176# other mem' functions), whether stdlib.h' declare free' (and
177# thus presumably malloc' and other related functions), and whether
178# the ctype.h' macros work on characters with the high bit set, as
179# ANSI C requires.
180
181message(STATUS "Checking whether system has ANSI C header files")
182check_include_files("stdlib.h;stdarg.h;string.h;float.h" StandardHeadersExist)
183if(StandardHeadersExist)
184  check_prototype_exists(memchr string.h memchrExists)
185  if(memchrExists)
186    check_prototype_exists(free stdlib.h freeExists)
187    if(freeExists)
188      include(TestForHighBitCharacters)
189      if(CMAKE_HIGH_BIT_CHARACTERS)
190        message(STATUS "ANSI C header files - found")
191        set(STDC_HEADERS 1 CACHE INTERNAL "System has ANSI C header files")
192      endif(CMAKE_HIGH_BIT_CHARACTERS)
193    endif(freeExists)
194  endif(memchrExists)
195endif(StandardHeadersExist)
196if(NOT STDC_HEADERS)
197  message(STATUS "ANSI C header files - not found")
198  set(STDC_HEADERS 0 CACHE INTERNAL "System has ANSI C header files")
199endif(NOT STDC_HEADERS)
200
201# AC_CHECK_HEADERS(unistd.h termios.h stdint.h)
202check_include_files(unistd.h PL_HAVE_UNISTD_H)
203check_include_files(termios.h HAVE_TERMIOS_H)
204check_include_files(stdint.h PL_HAVE_STDINT_H)
205check_include_file(crt_externs.h HAVE_CRT_EXTERNS_H)
206
207# AC_HEADER_SYS_WAIT
208include(TestForStandardHeaderwait)
209
210# Reasonable approximation to AC_HEADER_DIRENT without the SCO stuff.
211include(CheckDIRSymbolExists)
212check_dirsymbol_exists("sys/types.h;dirent.h" HAVE_DIRENT_H)
213if(NOT HAVE_DIRENT_H)
214  check_dirsymbol_exists("sys/types.h;sys/ndir.h" HAVE_SYS_NDIR_H)
215  if(NOT HAVE_SYS_NDIR_H)
216    check_dirsymbol_exists("sys/types.h;sys/dir.h" HAVE_SYS_DIR_H)
217    if(NOT HAVE_SYS_DIR_H)
218      check_dirsymbol_exists("sys/types.h;ndir.h" HAVE_NDIR_H)
219      if(NOT HAVE_NDIR_H AND UNIX)
220        message(FATAL_ERROR
221        "FATAL_ERROR for plplot.cmake: "
222        "DIR symbol must be defined by Unix system headers."
223        )
224      endif(NOT HAVE_NDIR_H AND UNIX)
225    endif(NOT HAVE_SYS_DIR_H)
226  endif(NOT HAVE_SYS_NDIR_H)
227endif(NOT HAVE_DIRENT_H)
228# Note the above tests #include <sys/types.h> to follow how
229# AC_HEADER_DIRENT does its testing.  Therefore, always do our
230# own #defines that way for the cmake build system.  Note, this
231# sys/types.h requirement occurs for Mac OS X and possibly other systems.
232# It is possible it will go away in the future, but we will follow whatever
233# is done by AC_HEADER_DIRENT here until that changes.
234set(NEED_SYS_TYPE_H ON)
235
236#=======================================================================
237# Typedefs
238#=======================================================================
239
240# In the past, some X11 headers required "caddr_t" even on systems that
241# claimed POSIX.1 compliance, which was illegal.  This made it impossible
242# to compile programs that included X11 headers if _POSIX_SOURCE was
243# defined.  We used to work around this potential problem by just defining
244# caddr_t to 'char *' on all systems (unless it is set already), whether
245# it was needed or not. Now we ignore the issue because we don't expect
246# such broken X behaviour any more and because this kind of argument list
247# for AC_CHECK_TYPE is now deprecated in the autoconf documentation.
248
249# Do not implement the equivalent of this since commented out in the ABS
250# system.
251# AC_CHECK_TYPE(caddr_t, char *)
252
253# Test signal handler return type (mimics AC_TYPE_SIGNAL)
254include(TestSignalType)
255
256include(CheckFunctionExists)
257check_function_exists(popen HAVE_POPEN)
258check_function_exists(usleep PL_HAVE_USLEEP)
259check_function_exists(nanosleep PL_HAVE_NANOSLEEP)
260check_function_exists(mkstemp PL_HAVE_MKSTEMP)
261check_function_exists(mkdtemp PL_HAVE_MKDTEMP)
262check_function_exists(mkfifo PL_HAVE_MKFIFO)
263check_function_exists(unlink PL_HAVE_UNLINK)
264check_function_exists(_NSGetArgc HAVE_NSGETARGC)
265
266# Check for FP functions, including underscored version which
267# are sometimes all that is available on windows
268
269check_symbol_exists(isfinite "math.h" HAVE_ISFINITE_SYMBOL)
270check_symbol_exists(finite "math.h" HAVE_FINITE_SYMBOL)
271if(HAVE_ISFINITE_SYMBOL)
272  set(PL_HAVE_ISFINITE ON)
273else(HAVE_ISFINITE_SYMBOL)
274  if(HAVE_FINITE_SYMBOL)
275    set(PL_HAVE_FINITE ON)
276  else(HAVE_FINITE_SYMBOL)
277    check_function_exists(finite HAVE_FINITE_FUNCTION)
278    if(HAVE_FINITE_FUNCTION)
279      set(PL_HAVE_FINITE ON)
280    else(HAVE_FINITE_FUNCTION)
281      check_symbol_exists(_finite "math.h" HAVE__FINITE_SYMBOL)
282      if(HAVE__FINITE_SYMBOL)
283        set(PL__HAVE_FINITE ON)
284      else(HAVE__FINITE_SYMBOL)
285        check_function_exists(_finite HAVE__FINITE_FUNCTION)
286        if(HAVE__FINITE_FUNCTION)
287          set(PL__HAVE_FINITE ON)
288        endif(HAVE__FINITE_FUNCTION)
289      endif(HAVE__FINITE_SYMBOL)
290    endif(HAVE_FINITE_FUNCTION)
291  endif(HAVE_FINITE_SYMBOL)
292endif(HAVE_ISFINITE_SYMBOL)
293if(PL_HAVE_FINITE)
294  set(PL_HAVE_ISFINITE ON)
295endif(PL_HAVE_FINITE)
296if(PL__HAVE_FINITE)
297  set(PL_HAVE_ISFINITE ON)
298endif(PL__HAVE_FINITE)
299
300check_symbol_exists(isnan "math.h" HAVE_ISNAN_SYMBOL)
301if(HAVE_ISNAN_SYMBOL)
302  set(PL_HAVE_ISNAN ON)
303else(HAVE_ISNAN_SYMBOL)
304  check_function_exists(isnan HAVE_ISNAN_FUNCTION)
305  if(HAVE_ISNAN_FUNCTION)
306    set(PL_HAVE_ISNAN ON)
307  else(HAVE_ISNAN_FUNCTION)
308    check_symbol_exists(_isnan "math.h" HAVE__ISNAN_SYMBOL)
309    if(HAVE__ISNAN_SYMBOL)
310      set(PL__HAVE_ISNAN ON)
311    else(HAVE__ISNAN_SYMBOL)
312      check_function_exists(_isnan HAVE__ISNAN_FUNCTION)
313      if(HAVE__ISNAN_FUNCTION)
314        set(PL__HAVE_ISNAN ON)
315      endif(HAVE__ISNAN_FUNCTION)
316    endif(HAVE__ISNAN_SYMBOL)
317  endif(HAVE_ISNAN_FUNCTION)
318endif(HAVE_ISNAN_SYMBOL)
319if(PL__HAVE_ISNAN)
320  set(PL_HAVE_ISNAN ON)
321endif(PL__HAVE_ISNAN)
322
323check_symbol_exists(isinf "math.h" HAVE_ISINF_SYMBOL)
324if(HAVE_ISINF_SYMBOL)
325  set(PL_HAVE_ISINF ON)
326else(HAVE_ISINF_SYMBOL)
327  check_function_exists(isinf HAVE_ISINF_FUNCTION)
328  if(HAVE_ISINF_FUNCTION)
329    set(PL_HAVE_ISINF ON)
330  else(HAVE_ISINF_FUNCTION)
331    check_symbol_exists(_isinf "math.h" HAVE__ISINF_SYMBOL)
332    if(HAVE__ISINF_SYMBOL)
333      set(PL__HAVE_ISINF ON)
334    else(HAVE__ISINF_SYMBOL)
335      check_function_exists(_isinf HAVE__ISINF_FUNCTION)
336      if(HAVE__ISINF_FUNCTION)
337        set(PL__HAVE_ISINF ON)
338      endif(HAVE__ISINF_FUNCTION)
339    endif(HAVE__ISINF_SYMBOL)
340  endif(HAVE_ISINF_FUNCTION)
341endif(HAVE_ISINF_SYMBOL)
342if(PL__HAVE_ISINF)
343  set(PL_HAVE_ISINF ON)
344endif(PL__HAVE_ISINF)
345
346
347check_symbol_exists(snprintf stdio.h PL_HAVE_SNPRINTF)
348if(NOT PL_HAVE_SNPRINTF)
349  check_symbol_exists(_snprintf stdio.h _PL_HAVE_SNPRINTF)
350  set(PL_HAVE_SNPRINTF ${_PL_HAVE_SNPRINTF} CACHE INTERNAL "Have function _sprintf")
351endif(NOT PL_HAVE_SNPRINTF)
352
353# =======================================================================
354# Language bindings
355# =======================================================================
356
357# Find swig.  Required for python, java and Lua bindings.
358# N.B. all version tests done below need experimental FindSWIG.cmake which
359# is currently carried in this directory by PLplot, but which eventually
360# should get into CMake.
361find_package(SWIG)
362if(SWIG_FOUND)
363  message(STATUS "SWIG_VERSION = ${SWIG_VERSION}")
364  if(${SWIG_VERSION} VERSION_LESS "1.3.22")
365    message(STATUS "WARNING: swig version too old.  SWIG_FOUND set to OFF")
366    set(SWIG_FOUND OFF)
367  endif(${SWIG_VERSION} VERSION_LESS "1.3.22")
368endif(SWIG_FOUND)
369
370if(SWIG_FOUND)
371  if(${SWIG_VERSION} VERSION_LESS "1.3.30")
372    set(SWIG_JAVA_NOPGCPP OFF)
373  else(${SWIG_VERSION} VERSION_LESS "1.3.30")
374    set(SWIG_JAVA_NOPGCPP ON)
375  endif(${SWIG_VERSION} VERSION_LESS "1.3.30")
376endif(SWIG_FOUND)
377
378if(SWIG_FOUND)
379  # Do not use "include(${SWIG_USE_FILE})" here since we want the option of
380  # using a locally modified version of UseSWIG.cmake if that exists rather
381  # than the official system version of that file.
382  include(UseSWIG)
383endif(SWIG_FOUND)
384
385# Find Perl.  Required in several places in the build system (e.g.,
386# tcl and docbook).  Also check for XML::Parser and XML::DOM which
387# are also used several places in the build system.
388find_package(Perl)
389if(PERL_FOUND)
390    include(CheckPerlModules)
391    check_perl_modules(PERL_XML_PARSER XML::Parser)
392    check_perl_modules(PERL_XML_DOM XML::DOM)
393endif(PERL_FOUND)
394
395# =======================================================================
396# MATH_LIB must be defined (or not) before pkg-config.
397# =======================================================================
398
399# On windows systems the math library is not separated so do not specify
400# it unless you are on a non-windows system.
401if(NOT WIN32_OR_CYGWIN)
402  find_library(MATH_LIB NAMES m PATHS /usr/local/lib /usr/lib)
403  if(NOT MATH_LIB)
404    message(FATAL_ERROR "Cannot find required math library")
405  endif(NOT MATH_LIB)
406endif(NOT WIN32_OR_CYGWIN)
407
408# Temporary workaround for language support that is required
409# for all language bindings.
410include(language_support)
411
412# C++ language support and binding
413include(c++)
414
415# =======================================================================
416# pkg-config support as well as macros to put link flags in standard
417# *.pc (pkg-config) form as well as standard fullpath form used by cmake.
418# Must come after c++ is enabled (just above).
419# =======================================================================
420include(pkg-config)
421
422# Find X headers, libraries, and library directory (required by xwin and
423# cairo device drivers and also everything that is Tk related).
424find_package(X11)
425
426# Convert X11_LIBRARIES to full pathname in all cases (2.4 and 2.6).
427cmake_link_flags(X11_LIBRARIES "${X11_LIBRARIES}")
428
429if(X11_INCLUDE_DIR)
430  # remove duplicates in the X11_INCLUDE_DIR list since those screw up
431  # certain of our modules and also slow down compilation if any of
432  # those duplicates leak through to the compile -I options.
433  list(SORT X11_INCLUDE_DIR)
434  set(copy_X11_INCLUDE_DIR ${X11_INCLUDE_DIR})
435  set(listindex 0)
436  set(listindexplus 1)
437  foreach(copy_listelement ${copy_X11_INCLUDE_DIR})
438    # need to get list elements corresponding to list indices.
439    list(LENGTH X11_INCLUDE_DIR listlength)
440    if(listindexplus LESS ${listlength})
441      list(GET X11_INCLUDE_DIR ${listindex} listelement)
442      list(GET X11_INCLUDE_DIR ${listindexplus} listelementplus)
443    else(listindexplus LESS ${listlength})
444      set(listelement)
445      set(listelementplus)
446    endif(listindexplus LESS ${listlength})
447    if(copy_listelement STREQUAL "${listelement}" AND
448    copy_listelement STREQUAL "${listelementplus}"
449    )
450      list(REMOVE_AT X11_INCLUDE_DIR ${listindex})
451    else(copy_listelement STREQUAL "${listelement}" AND
452    copy_listelement STREQUAL "${listelementplus}"
453    )
454      # update list indices
455      math(EXPR listindex "${listindex} + 1")
456      math(EXPR listindexplus "${listindex} + 1")
457    endif(copy_listelement STREQUAL "${listelement}" AND
458    copy_listelement STREQUAL "${listelementplus}"
459    )
460  endforeach(copy_listelement ${copy_X11_INCLUDE_DIR})
461  string(REGEX REPLACE ";" " -I" X11_COMPILE_FLAGS "-I${X11_INCLUDE_DIR}")
462endif(X11_INCLUDE_DIR)
463message(STATUS "X11_FOUND = ${X11_FOUND}")
464message(STATUS "X11_INCLUDE_DIR = ${X11_INCLUDE_DIR}")
465message(STATUS "X11_COMPILE_FLAGS = ${X11_COMPILE_FLAGS}")
466message(STATUS "X11_LIBRARIES = ${X11_LIBRARIES}")
467
468option(DEFAULT_NO_BINDINGS
469"All language bindings are disabled by default"
470OFF
471)
472
473# Individual language support (beyond C and C++)
474include(fortran)
475include(java)
476include(python)
477include(octave)
478# tcl-related must come after c++ and fortran because of use of filter_rpath
479include(tcl-related)
480include(ada)
481# OCaml support is included after the check for output drivers in order to
482# check for extcairo support.
483#include(ocaml)
484include(lua)
485include(d)
486
487# =======================================================================
488# Option to change to static run-time support for Microsoft C and
489# C++ compilers.  This method should only work after those
490# compilers are enabled (C is already enabled for the whole project
491# and C++ should be enabled above).
492# =======================================================================
493if(WIN32_OR_CYGWIN AND NOT MINGW)
494  # MinGW excluded because it does not enable a static runtime according
495  # to http://lists-archives.com/mingw-users/00126-mingw-msvc-md-mt-ml.html .
496  option(STATIC_RUNTIME "Set Windows non-MinGW compiler static runtime linkage if requested" OFF)
497  if(STATIC_RUNTIME)
498    set(flag_vars
499      CMAKE_C_FLAGS
500      CMAKE_C_FLAGS_DEBUG
501      CMAKE_C_FLAGS_RELEASE
502      CMAKE_C_FLAGS_MINSIZEREL
503      CMAKE_C_FLAGS_RELWITHDEBINFO
504      CMAKE_CXX_FLAGS
505      CMAKE_CXX_FLAGS_DEBUG
506      CMAKE_CXX_FLAGS_RELEASE
507      CMAKE_CXX_FLAGS_MINSIZEREL
508      CMAKE_CXX_FLAGS_RELWITHDEBINFO
509      )
510
511    foreach(flag_var ${flag_vars})
512      if(${flag_var} MATCHES "/MD")
513	string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
514	set(${flag_var} "${${flag_var}}" CACHE STRING "Flags used by the compiler" FORCE)
515      endif(${flag_var} MATCHES "/MD")
516    endforeach(flag_var ${flag_vars})
517  endif(STATIC_RUNTIME)
518endif(WIN32_OR_CYGWIN AND NOT MINGW)
519
520# =======================================================================
521# additional library support
522# =======================================================================
523# shapelib must come after c++ and fortran because of use of filter_rpath
524# Support for shapelib library for reading shapefile map data
525include(shapelib)
526include(freetype)
527# csiro must come after MATH_LIB is defined (or not).
528# csiro must come after c++ and fortran because of use of filter_rpath
529include(csiro)
530
531
532# =======================================================================
533# libpango support
534# =======================================================================
535include(pango)
536
537# =======================================================================
538# Device drivers
539# =======================================================================
540# drivers must come after c++ and fortran because of use of filter_rpath
541include(drivers)
542
543# test_diff must come after drivers
544include(test_diff)
545
546# =======================================================================
547# OCaml support (after drivers to check for extcairo)
548# =======================================================================
549include(ocaml)
550
551# =======================================================================
552# Miscellaneous other features - including docbook documentation
553# =======================================================================
554include(docbook)
555include(doxygen)
556include(summary)
557
558# Calculate permissions that should be used for shared objects that
559# are created by custom commands to be consistent with the permissions
560# automatically used for shared objects created as targets.  The
561# result (whether execute permissions are set) depends on
562# CMAKE_INSTALL_SO_NO_EXE that is set in
563# $prefix/share/cmake-2.8/Modules/Platform/Linux.cmake, where $prefix
564# is the installation prefix for cmake itself, and the value depends
565# on Linux platform.
566if(CMAKE_INSTALL_SO_NO_EXE)
567  # Permissions for shared objects are (rw-r--r--).
568  set(SO_PERMISSIONS
569    OWNER_READ
570    OWNER_WRITE
571    GROUP_READ
572    WORLD_READ
573    )
574else(CMAKE_INSTALL_SO_NO_EXE)
575  # Permissions for shared objects are (rwxr-xr-x).
576  set(SO_PERMISSIONS
577    OWNER_READ
578    OWNER_WRITE
579    OWNER_EXECUTE
580    GROUP_READ
581    GROUP_EXECUTE
582    WORLD_READ
583    WORLD_EXECUTE
584    )
585endif(CMAKE_INSTALL_SO_NO_EXE)
586
587
588
589