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 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588
|
# cmake/modules/plplot.cmake
#
# Copyright (C) 2006-2018 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 PLplot.
# The "certain devices" I have in mind at the moment are wxwidgets and wingcc since both
# of those devices simply show a blank screen rather than the plot actively being rendered when -np is
# used. So once those -np issues are fixed for wxwidgets and wingcc, this option will no longer
# be necessary.
option(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)
option(ADD_SPECIAL_CONSISTENCY_CHECKING "Add extra source-tree consistency checking targets that require special tools" OFF)
# option(DROP_GTK_PLUS_2_BUILDS "Drop builds of gtk+2-only targets that clash with gtk+3 dependencies" OFF)
set(DROP_GTK_PLUS_2_BUILDS ON CACHE BOOL "Drop builds of gtk+2-only targets that clash with gtk+3 dependencies" FORCE)
# target that depends on all check targets.
add_custom_target(check_all)
# libraries are all shared by default
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
# CYGWIN eliminated here because .a suffix is not sufficient to guarantee a
# static library on that platform.
if(UNIX AND NOT CYGWIN AND NOT BUILD_SHARED_LIBS)
option(FORCE_EXTERNAL_STATIC "Force external UNIX libraries to be static" OFF)
else(UNIX AND NOT CYGWIN AND NOT BUILD_SHARED_LIBS)
set(FORCE_EXTERNAL_STATIC OFF CACHE BOOL "Force external UNIX libraries to be static" FORCE)
endif(UNIX AND NOT CYGWIN AND NOT BUILD_SHARED_LIBS)
if(FORCE_EXTERNAL_STATIC)
# All find_library commands append this suffix to the searched name so
# this always forces find_library to find only the Unix static library
# if it exists or fail if it doesn't exist.
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
endif(FORCE_EXTERNAL_STATIC)
if(BUILD_SHARED_LIBS)
# OFF means shared libraries (but never static libraries) are
# transitively linked by default by CMake and also by pkg-config (used
# to generate compile and link flags for the traditional build and
# test system of the installed examples).
if(WIN32_OR_CYGWIN)
option(NON_TRANSITIVE "Option to use non-transitive linking" OFF)
else(WIN32_OR_CYGWIN)
option(NON_TRANSITIVE "Option to use non-transitive linking" ON)
endif(WIN32_OR_CYGWIN)
else(BUILD_SHARED_LIBS)
set(NON_TRANSITIVE OFF CACHE BOOL "Option to use non-transitive linking" FORCE)
endif(BUILD_SHARED_LIBS)
# Color maps (discrete and continuous) to use by default
if(NOT DEFAULT_CMAP0_FILE)
set(DEFAULT_CMAP0_FILE "cmap0_default.pal")
endif(NOT DEFAULT_CMAP0_FILE)
if(NOT DEFAULT_CMAP1_FILE)
set(DEFAULT_CMAP1_FILE "cmap1_default.pal")
endif(NOT DEFAULT_CMAP1_FILE)
# Deprecated functions are not included by default. Set to ON if you
# require this for backwards compatibility.
option(PL_DEPRECATED "Include support for deprecated functions" OFF)
# Set to ON if want to use general fill_intersection_polygon approach
# rather than the traditional code to fill the intersection of a
# polygon with the clipping limits.
option(USE_FILL_INTERSECTION_POLYGON "use fill_intersection_polygon" OFF)
# Need these modules to do subsequent checks.
include(CheckIncludeFile)
include(CheckIncludeFiles)
include(CheckFunctionExists)
include(CheckSymbolExists)
include(CheckPrototypeExists)
# Required for the cmake_push_check_state and cmake_pop_check_state
# macros used to store and retrieve CMAKE_REQUIRED_* variables used in
# conjunction with some of the CMake check_* functions that we call.
include(CMakePushCheckState)
# Include some useful functions that Plplot requires.
include(plplot_functions)
# =======================================================================
# Compilation and build options (PLFLT, install locations, and rpath)
# Note, must come before java since that depends on, e.g., LIB_DIR.
# =======================================================================
# WIN32_OR_CYGWIN covers CYGWIN as well (and possibly MINGW, but we will make sure).
if(WIN32_OR_CYGWIN OR MINGW)
set(EXEEXT .exe)
endif(WIN32_OR_CYGWIN OR MINGW)
include(double)
include(instdirs)
include(rpath)
# Common CMakeLists.txt files are used to build the examples in the build
# tree and also to build the installed examples by the new CMake-based build
# system devoted to that purpose. Set this fundamental identification to
# distinguish the two cases.
set(CORE_BUILD ON)
option(BUILD_TEST "Compile examples in the build tree and enable ctest" OFF)
# Use bash when available for ctest and install tree test support
find_program(SH_EXECUTABLE bash)
find_program(SH_EXECUTABLE win-bash)
if(SH_EXECUTABLE)
set(HAVE_BASH ON)
else(SH_EXECUTABLE)
find_program(SH_EXECUTABLE sh)
endif(SH_EXECUTABLE)
message(STATUS "SH_EXECUTABLE = ${SH_EXECUTABLE}")
if(NOT SH_EXECUTABLE)
message(STATUS
"WARNING: bash shell not found, ctest will not work properly"
)
endif(NOT SH_EXECUTABLE)
option(PREBUILD_DIST "Pre-build all components required for distribution" OFF)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(
PREBUILD_DIST OFF CACHE INTERNAL
"Pre-build all components required for distribution"
)
endif(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
# create a devpackage file
option(DEVPAK "Create DevPackage" NO)
if(DEVPAK AND NOT WIN32_OR_CYGWIN)
message( STATUS "DevPackage only available for Win32. Set DEVPAK to OFF." )
set(DEVPAK OFF)
endif(DEVPAK AND NOT WIN32_OR_CYGWIN)
if(DEVPAK AND BUILD_TEST)
message( STATUS "Examples are not build for DevPackage. Set BUILD_TEST to OFF." )
set(BUILD_TEST OFF)
endif(DEVPAK AND BUILD_TEST)
# =======================================================================
# Headers
# =======================================================================
# AC_HEADER_STDC is gross overkill since the current PLplot code only uses
# this for whether or not atexit can be used. But implement the full suite
# of AC_HEADER_STDC checks to keep the cmake version in synch with autotools
# and just in case some PLplot developer assumes the complete check for
# standard headers is done for a future programming change.
#
# From info autoconf....
# Define STDC_HEADERS if the system has ANSI C header files.
# Specifically, this macro checks for stdlib.h', stdarg.h',
# string.h', and float.h'; if the system has those, it probably
# has the rest of the ANSI C header files. This macro also checks
# whether string.h' declares memchr' (and thus presumably the
# other mem' functions), whether stdlib.h' declare free' (and
# thus presumably malloc' and other related functions), and whether
# the ctype.h' macros work on characters with the high bit set, as
# ANSI C requires.
message(STATUS "Checking whether system has ANSI C header files")
check_include_files("stdlib.h;stdarg.h;string.h;float.h" StandardHeadersExist)
if(StandardHeadersExist)
check_prototype_exists(memchr string.h memchrExists)
if(memchrExists)
check_prototype_exists(free stdlib.h freeExists)
if(freeExists)
include(TestForHighBitCharacters)
if(CMAKE_HIGH_BIT_CHARACTERS)
message(STATUS "ANSI C header files - found")
set(STDC_HEADERS 1 CACHE INTERNAL "System has ANSI C header files")
endif(CMAKE_HIGH_BIT_CHARACTERS)
endif(freeExists)
endif(memchrExists)
endif(StandardHeadersExist)
if(NOT STDC_HEADERS)
message(STATUS "ANSI C header files - not found")
set(STDC_HEADERS 0 CACHE INTERNAL "System has ANSI C header files")
endif(NOT STDC_HEADERS)
# AC_CHECK_HEADERS(unistd.h termios.h stdint.h)
check_include_files(unistd.h PL_HAVE_UNISTD_H)
check_include_files(termios.h HAVE_TERMIOS_H)
check_include_files(stdint.h PL_HAVE_STDINT_H)
check_include_file(crt_externs.h HAVE_CRT_EXTERNS_H)
# AC_HEADER_SYS_WAIT
include(TestForStandardHeaderwait)
# Reasonable approximation to AC_HEADER_DIRENT without the SCO stuff.
include(CheckDIRSymbolExists)
check_dirsymbol_exists("sys/types.h;dirent.h" HAVE_DIRENT_H)
if(NOT HAVE_DIRENT_H)
check_dirsymbol_exists("sys/types.h;sys/ndir.h" HAVE_SYS_NDIR_H)
if(NOT HAVE_SYS_NDIR_H)
check_dirsymbol_exists("sys/types.h;sys/dir.h" HAVE_SYS_DIR_H)
if(NOT HAVE_SYS_DIR_H)
check_dirsymbol_exists("sys/types.h;ndir.h" HAVE_NDIR_H)
if(NOT HAVE_NDIR_H AND UNIX)
message(FATAL_ERROR
"FATAL_ERROR for plplot.cmake: "
"DIR symbol must be defined by Unix system headers."
)
endif(NOT HAVE_NDIR_H AND UNIX)
endif(NOT HAVE_SYS_DIR_H)
endif(NOT HAVE_SYS_NDIR_H)
endif(NOT HAVE_DIRENT_H)
# Note the above tests #include <sys/types.h> to follow how
# AC_HEADER_DIRENT does its testing. Therefore, always do our
# own #defines that way for the cmake build system. Note, this
# sys/types.h requirement occurs for Mac OS X and possibly other systems.
# It is possible it will go away in the future, but we will follow whatever
# is done by AC_HEADER_DIRENT here until that changes.
set(NEED_SYS_TYPE_H ON)
#=======================================================================
# Typedefs
#=======================================================================
# In the past, some X11 headers required "caddr_t" even on systems that
# claimed POSIX.1 compliance, which was illegal. This made it impossible
# to compile programs that included X11 headers if _POSIX_SOURCE was
# defined. We used to work around this potential problem by just defining
# caddr_t to 'char *' on all systems (unless it is set already), whether
# it was needed or not. Now we ignore the issue because we don't expect
# such broken X behaviour any more and because this kind of argument list
# for AC_CHECK_TYPE is now deprecated in the autoconf documentation.
# Do not implement the equivalent of this since commented out in the ABS
# system.
# AC_CHECK_TYPE(caddr_t, char *)
# Test signal handler return type (mimics AC_TYPE_SIGNAL)
include(TestSignalType)
include(CheckFunctionExists)
check_function_exists(popen HAVE_POPEN)
check_function_exists(usleep PL_HAVE_USLEEP)
check_function_exists(nanosleep PL_HAVE_NANOSLEEP)
check_function_exists(mkstemp PL_HAVE_MKSTEMP)
check_function_exists(mkdtemp PL_HAVE_MKDTEMP)
check_function_exists(mkfifo PL_HAVE_MKFIFO)
check_function_exists(unlink PL_HAVE_UNLINK)
check_function_exists(_NSGetArgc HAVE_NSGETARGC)
# Check for FP functions, including underscored version which
# are sometimes all that is available on windows
check_symbol_exists(isfinite "math.h" HAVE_ISFINITE_SYMBOL)
check_symbol_exists(finite "math.h" HAVE_FINITE_SYMBOL)
if(HAVE_ISFINITE_SYMBOL)
set(PL_HAVE_ISFINITE ON)
else(HAVE_ISFINITE_SYMBOL)
if(HAVE_FINITE_SYMBOL)
set(PL_HAVE_FINITE ON)
else(HAVE_FINITE_SYMBOL)
check_function_exists(finite HAVE_FINITE_FUNCTION)
if(HAVE_FINITE_FUNCTION)
set(PL_HAVE_FINITE ON)
else(HAVE_FINITE_FUNCTION)
check_symbol_exists(_finite "math.h" HAVE__FINITE_SYMBOL)
if(HAVE__FINITE_SYMBOL)
set(PL__HAVE_FINITE ON)
else(HAVE__FINITE_SYMBOL)
check_function_exists(_finite HAVE__FINITE_FUNCTION)
if(HAVE__FINITE_FUNCTION)
set(PL__HAVE_FINITE ON)
endif(HAVE__FINITE_FUNCTION)
endif(HAVE__FINITE_SYMBOL)
endif(HAVE_FINITE_FUNCTION)
endif(HAVE_FINITE_SYMBOL)
endif(HAVE_ISFINITE_SYMBOL)
if(PL_HAVE_FINITE)
set(PL_HAVE_ISFINITE ON)
endif(PL_HAVE_FINITE)
if(PL__HAVE_FINITE)
set(PL_HAVE_ISFINITE ON)
endif(PL__HAVE_FINITE)
check_symbol_exists(isnan "math.h" HAVE_ISNAN_SYMBOL)
if(HAVE_ISNAN_SYMBOL)
set(PL_HAVE_ISNAN ON)
else(HAVE_ISNAN_SYMBOL)
check_function_exists(isnan HAVE_ISNAN_FUNCTION)
if(HAVE_ISNAN_FUNCTION)
set(PL_HAVE_ISNAN ON)
else(HAVE_ISNAN_FUNCTION)
check_symbol_exists(_isnan "math.h" HAVE__ISNAN_SYMBOL)
if(HAVE__ISNAN_SYMBOL)
set(PL__HAVE_ISNAN ON)
else(HAVE__ISNAN_SYMBOL)
check_function_exists(_isnan HAVE__ISNAN_FUNCTION)
if(HAVE__ISNAN_FUNCTION)
set(PL__HAVE_ISNAN ON)
endif(HAVE__ISNAN_FUNCTION)
endif(HAVE__ISNAN_SYMBOL)
endif(HAVE_ISNAN_FUNCTION)
endif(HAVE_ISNAN_SYMBOL)
if(PL__HAVE_ISNAN)
set(PL_HAVE_ISNAN ON)
endif(PL__HAVE_ISNAN)
check_symbol_exists(isinf "math.h" HAVE_ISINF_SYMBOL)
if(HAVE_ISINF_SYMBOL)
set(PL_HAVE_ISINF ON)
else(HAVE_ISINF_SYMBOL)
check_function_exists(isinf HAVE_ISINF_FUNCTION)
if(HAVE_ISINF_FUNCTION)
set(PL_HAVE_ISINF ON)
else(HAVE_ISINF_FUNCTION)
check_symbol_exists(_isinf "math.h" HAVE__ISINF_SYMBOL)
if(HAVE__ISINF_SYMBOL)
set(PL__HAVE_ISINF ON)
else(HAVE__ISINF_SYMBOL)
check_function_exists(_isinf HAVE__ISINF_FUNCTION)
if(HAVE__ISINF_FUNCTION)
set(PL__HAVE_ISINF ON)
endif(HAVE__ISINF_FUNCTION)
endif(HAVE__ISINF_SYMBOL)
endif(HAVE_ISINF_FUNCTION)
endif(HAVE_ISINF_SYMBOL)
if(PL__HAVE_ISINF)
set(PL_HAVE_ISINF ON)
endif(PL__HAVE_ISINF)
check_symbol_exists(snprintf stdio.h PL_HAVE_SNPRINTF)
if(NOT PL_HAVE_SNPRINTF)
check_symbol_exists(_snprintf stdio.h _PL_HAVE_SNPRINTF)
set(PL_HAVE_SNPRINTF ${_PL_HAVE_SNPRINTF} CACHE INTERNAL "Have function _sprintf")
endif(NOT PL_HAVE_SNPRINTF)
# =======================================================================
# Language bindings
# =======================================================================
# Find swig. Required for python, java and Lua bindings.
# N.B. all version tests done below need experimental FindSWIG.cmake which
# is currently carried in this directory by PLplot, but which eventually
# should get into CMake.
find_package(SWIG)
if(SWIG_FOUND)
message(STATUS "SWIG_VERSION = ${SWIG_VERSION}")
if(${SWIG_VERSION} VERSION_LESS "1.3.22")
message(STATUS "WARNING: swig version too old. SWIG_FOUND set to OFF")
set(SWIG_FOUND OFF)
endif(${SWIG_VERSION} VERSION_LESS "1.3.22")
endif(SWIG_FOUND)
if(SWIG_FOUND)
if(${SWIG_VERSION} VERSION_LESS "1.3.30")
set(SWIG_JAVA_NOPGCPP OFF)
else(${SWIG_VERSION} VERSION_LESS "1.3.30")
set(SWIG_JAVA_NOPGCPP ON)
endif(${SWIG_VERSION} VERSION_LESS "1.3.30")
endif(SWIG_FOUND)
if(SWIG_FOUND)
# Do not use "include(${SWIG_USE_FILE})" here since we want the option of
# using a locally modified version of UseSWIG.cmake if that exists rather
# than the official system version of that file.
include(UseSWIG)
endif(SWIG_FOUND)
# Find Perl. Required in several places in the build system (e.g.,
# tcl and docbook). Also check for XML::Parser and XML::DOM which
# are also used several places in the build system.
find_package(Perl)
if(PERL_FOUND)
include(CheckPerlModules)
check_perl_modules(PERL_XML_PARSER XML::Parser)
check_perl_modules(PERL_XML_DOM XML::DOM)
endif(PERL_FOUND)
# =======================================================================
# MATH_LIB must be defined (or not) before pkg-config.
# =======================================================================
# On windows systems the math library is not separated so do not specify
# it unless you are on a non-windows system.
if(NOT WIN32_OR_CYGWIN)
find_library(MATH_LIB NAMES m PATHS /usr/local/lib /usr/lib)
if(NOT MATH_LIB)
message(FATAL_ERROR "Cannot find required math library")
endif(NOT MATH_LIB)
endif(NOT WIN32_OR_CYGWIN)
# Temporary workaround for language support that is required
# for all language bindings.
include(language_support)
# C++ language support and binding
include(c++)
# =======================================================================
# pkg-config support as well as macros to put link flags in standard
# *.pc (pkg-config) form as well as standard fullpath form used by cmake.
# Must come after c++ is enabled (just above).
# =======================================================================
include(pkg-config)
# Find X headers, libraries, and library directory (required by xwin and
# cairo device drivers and also everything that is Tk related).
find_package(X11)
# Convert X11_LIBRARIES to full pathname in all cases (2.4 and 2.6).
cmake_link_flags(X11_LIBRARIES "${X11_LIBRARIES}")
if(X11_INCLUDE_DIR)
# remove duplicates in the X11_INCLUDE_DIR list since those screw up
# certain of our modules and also slow down compilation if any of
# those duplicates leak through to the compile -I options.
list(SORT X11_INCLUDE_DIR)
set(copy_X11_INCLUDE_DIR ${X11_INCLUDE_DIR})
set(listindex 0)
set(listindexplus 1)
foreach(copy_listelement ${copy_X11_INCLUDE_DIR})
# need to get list elements corresponding to list indices.
list(LENGTH X11_INCLUDE_DIR listlength)
if(listindexplus LESS ${listlength})
list(GET X11_INCLUDE_DIR ${listindex} listelement)
list(GET X11_INCLUDE_DIR ${listindexplus} listelementplus)
else(listindexplus LESS ${listlength})
set(listelement)
set(listelementplus)
endif(listindexplus LESS ${listlength})
if(copy_listelement STREQUAL "${listelement}" AND
copy_listelement STREQUAL "${listelementplus}"
)
list(REMOVE_AT X11_INCLUDE_DIR ${listindex})
else(copy_listelement STREQUAL "${listelement}" AND
copy_listelement STREQUAL "${listelementplus}"
)
# update list indices
math(EXPR listindex "${listindex} + 1")
math(EXPR listindexplus "${listindex} + 1")
endif(copy_listelement STREQUAL "${listelement}" AND
copy_listelement STREQUAL "${listelementplus}"
)
endforeach(copy_listelement ${copy_X11_INCLUDE_DIR})
string(REGEX REPLACE ";" " -I" X11_COMPILE_FLAGS "-I${X11_INCLUDE_DIR}")
endif(X11_INCLUDE_DIR)
message(STATUS "X11_FOUND = ${X11_FOUND}")
message(STATUS "X11_INCLUDE_DIR = ${X11_INCLUDE_DIR}")
message(STATUS "X11_COMPILE_FLAGS = ${X11_COMPILE_FLAGS}")
message(STATUS "X11_LIBRARIES = ${X11_LIBRARIES}")
option(DEFAULT_NO_BINDINGS
"All language bindings are disabled by default"
OFF
)
# Individual language support (beyond C and C++)
include(fortran)
include(java)
include(python)
include(octave)
# tcl-related must come after c++ and fortran because of use of filter_rpath
include(tcl-related)
include(ada)
# OCaml support is included after the check for output drivers in order to
# check for extcairo support.
#include(ocaml)
include(lua)
include(d)
# =======================================================================
# Option to change to static run-time support for Microsoft C and
# C++ compilers. This method should only work after those
# compilers are enabled (C is already enabled for the whole project
# and C++ should be enabled above).
# =======================================================================
if(WIN32_OR_CYGWIN AND NOT MINGW)
# MinGW excluded because it does not enable a static runtime according
# to http://lists-archives.com/mingw-users/00126-mingw-msvc-md-mt-ml.html .
option(STATIC_RUNTIME "Set Windows non-MinGW compiler static runtime linkage if requested" OFF)
if(STATIC_RUNTIME)
set(flag_vars
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELWITHDEBINFO
)
foreach(flag_var ${flag_vars})
if(${flag_var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
set(${flag_var} "${${flag_var}}" CACHE STRING "Flags used by the compiler" FORCE)
endif(${flag_var} MATCHES "/MD")
endforeach(flag_var ${flag_vars})
endif(STATIC_RUNTIME)
endif(WIN32_OR_CYGWIN AND NOT MINGW)
# =======================================================================
# additional library support
# =======================================================================
# shapelib must come after c++ and fortran because of use of filter_rpath
# Support for shapelib library for reading shapefile map data
include(shapelib)
include(freetype)
# csiro must come after MATH_LIB is defined (or not).
# csiro must come after c++ and fortran because of use of filter_rpath
include(csiro)
# =======================================================================
# libpango support
# =======================================================================
include(pango)
# =======================================================================
# Device drivers
# =======================================================================
# drivers must come after c++ and fortran because of use of filter_rpath
include(drivers)
# test_diff must come after drivers
include(test_diff)
# =======================================================================
# OCaml support (after drivers to check for extcairo)
# =======================================================================
include(ocaml)
# =======================================================================
# Miscellaneous other features - including docbook documentation
# =======================================================================
include(docbook)
include(doxygen)
include(summary)
# Calculate permissions that should be used for shared objects that
# are created by custom commands to be consistent with the permissions
# automatically used for shared objects created as targets. The
# result (whether execute permissions are set) depends on
# CMAKE_INSTALL_SO_NO_EXE that is set in
# $prefix/share/cmake-2.8/Modules/Platform/Linux.cmake, where $prefix
# is the installation prefix for cmake itself, and the value depends
# on Linux platform.
if(CMAKE_INSTALL_SO_NO_EXE)
# Permissions for shared objects are (rw-r--r--).
set(SO_PERMISSIONS
OWNER_READ
OWNER_WRITE
GROUP_READ
WORLD_READ
)
else(CMAKE_INSTALL_SO_NO_EXE)
# Permissions for shared objects are (rwxr-xr-x).
set(SO_PERMISSIONS
OWNER_READ
OWNER_WRITE
OWNER_EXECUTE
GROUP_READ
GROUP_EXECUTE
WORLD_READ
WORLD_EXECUTE
)
endif(CMAKE_INSTALL_SO_NO_EXE)
|