diff options
Diffstat (limited to 'Modules')
25 files changed, 425 insertions, 280 deletions
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index b0f5eb6..06aa9bf 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -26,6 +26,12 @@ # define COMPILER_VERSION_MINOR DEC(__clang_minor__) # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__ & 0xFFFF) + #elif defined(__BORLANDC__) # define COMPILER_ID "Borland" /* __BORLANDC__ = 0xVRR */ diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index 927f7f4..95fc852 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -28,6 +28,12 @@ # define COMPILER_VERSION_MINOR DEC(__clang_minor__) # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__ & 0xFFFF) + #elif defined(__BORLANDC__) # define COMPILER_ID "Borland" /* __BORLANDC__ = 0xVRR */ diff --git a/Modules/CMakeFindPackageMode.cmake b/Modules/CMakeFindPackageMode.cmake index 4296577..59c7ba5 100644 --- a/Modules/CMakeFindPackageMode.cmake +++ b/Modules/CMakeFindPackageMode.cmake @@ -71,7 +71,8 @@ if(UNIX) # use the file utility to check whether itself is 64 bit: find_program(FILE_EXECUTABLE file) if(FILE_EXECUTABLE) - execute_process(COMMAND "${FILE_EXECUTABLE}" "${FILE_EXECUTABLE}" OUTPUT_VARIABLE fileOutput ERROR_QUIET) + get_filename_component(FILE_ABSPATH "${FILE_EXECUTABLE}" ABSOLUTE) + execute_process(COMMAND "${FILE_ABSPATH}" "${FILE_ABSPATH}" OUTPUT_VARIABLE fileOutput ERROR_QUIET) if("${fileOutput}" MATCHES "64-bit") set(CMAKE_SIZEOF_VOID_P 8) endif() diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index e0a5518..b506711 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -53,176 +53,198 @@ ##end # ##variable -# CPACK_PACKAGE_NAME - The name of the package (or application). If -# not specified, defaults to the project name. +# CPACK_PACKAGE_NAME - The name of the package (or application). If +# not specified, defaults to the project name. ##end # ##variable -# CPACK_PACKAGE_VENDOR - The name of the package vendor. (e.g., -# "Kitware"). +# CPACK_PACKAGE_VENDOR - The name of the package vendor. (e.g., +# "Kitware"). ##end # ##variable -# CPACK_PACKAGE_VERSION_MAJOR - Package major Version +# CPACK_PACKAGE_VERSION_MAJOR - Package major Version ##end # ##variable -# CPACK_PACKAGE_VERSION_MINOR - Package minor Version +# CPACK_PACKAGE_VERSION_MINOR - Package minor Version ##end # ##variable -# CPACK_PACKAGE_VERSION_PATCH - Package patch Version +# CPACK_PACKAGE_VERSION_PATCH - Package patch Version ##end # ##variable -# CPACK_PACKAGE_DESCRIPTION_FILE - A text file used to describe the -# project. Used, for example, the introduction screen of a -# CPack-generated Windows installer to describe the project. +# CPACK_PACKAGE_DESCRIPTION_FILE - A text file used to describe the +# project. Used, for example, the introduction screen of a +# CPack-generated Windows installer to describe the project. ##end # ##variable -# CPACK_PACKAGE_DESCRIPTION_SUMMARY - Short description of the -# project (only a few words). +# CPACK_PACKAGE_DESCRIPTION_SUMMARY - Short description of the +# project (only a few words). ##end # ##variable -# CPACK_PACKAGE_FILE_NAME - The name of the package file to generate, -# not including the extension. For example, cmake-2.6.1-Linux-i686. +# CPACK_PACKAGE_FILE_NAME - The name of the package file to generate, +# not including the extension. For example, cmake-2.6.1-Linux-i686. +# The default value is +# ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}. ##end # ##variable -# CPACK_PACKAGE_INSTALL_DIRECTORY - Installation directory on the -# target system, e.g., "CMake 2.5". +# CPACK_PACKAGE_INSTALL_DIRECTORY - Installation directory on the +# target system. This may be used by some CPack generators +# like NSIS to create an installation directory e.g., "CMake 2.5" +# below the installation prefix. All installed element will be +# put inside this directory. ##end # ##variable -# CPACK_PROJECT_CONFIG_FILE - File included at cpack time, once per -# generator after setting CPACK_GENERATOR to the actual generator -# being used. Allows per-generator setting of CPACK_* variables at -# cpack time. +# CPACK_PROJECT_CONFIG_FILE - CPack-time project CPack configuration +# file. This file included at cpack time, once per +# generator after CPack has set CPACK_GENERATOR to the actual generator +# being used. It allows per-generator setting of CPACK_* variables at +# cpack time. ##end # ##variable -# CPACK_RESOURCE_FILE_LICENSE - License file for the project, which -# will typically be displayed to the user (often with an explicit -# "Accept" button, for graphical installers) prior to installation. +# CPACK_RESOURCE_FILE_LICENSE - License to be embedded in the installer. It +# will typically be displayed to the user by the produced installer +# (often with an explicit "Accept" button, for graphical installers) +# prior to installation. This license file is NOT added to installed +# file but is used by some CPack generators like NSIS. If you want +# to install a license file (may be the same as this one) +# along with your project you must add an appropriate CMake INSTALL +# command in your CMakeLists.txt. ##end # ##variable -# CPACK_RESOURCE_FILE_README - ReadMe file for the project, which -# typically describes in some detail +# CPACK_RESOURCE_FILE_README - ReadMe file to be embedded in the installer. It +# typically describes in some detail the purpose of the project +# during the installation. Not all CPack generators uses +# this file. ##end # ##variable -# CPACK_RESOURCE_FILE_WELCOME - Welcome file for the project, which -# welcomes users to this installer. Typically used in the graphical -# installers on Windows and Mac OS X. +# CPACK_RESOURCE_FILE_WELCOME - Welcome file to be embedded in the +# installer. It welcomes users to this installer. +# Typically used in the graphical installers on Windows and Mac OS X. ##end # ##variable -# CPACK_MONOLITHIC_INSTALL - Disables the component-based -# installation mechanism, so that all components are always installed. +# CPACK_MONOLITHIC_INSTALL - Disables the component-based +# installation mechanism. When set the component specification is ignored +# and all installed items are put in a single "MONOLITHIC" package. +# Some CPack generators do monolithic packaging by default and +# may be asked to do component packaging by setting +# CPACK_<GENNAME>_COMPONENT_INSTALL to 1/TRUE. ##end # ##variable -# CPACK_GENERATOR - List of CPack generators to use. If not -# specified, CPack will create a set of options (e.g., -# CPACK_BINARY_NSIS) allowing the user to enable/disable individual -# generators. +# CPACK_GENERATOR - List of CPack generators to use. If not +# specified, CPack will create a set of options CPACK_BINARY_<GENNAME> (e.g., +# CPACK_BINARY_NSIS) allowing the user to enable/disable individual +# generators. This variable may be used on the command line +# as well as in: +# +# cpack -D CPACK_GENERATOR="ZIP;TGZ" /path/to/build/tree ##end # ##variable -# CPACK_OUTPUT_CONFIG_FILE - The name of the CPack configuration file -# for binary installers that will be generated by the CPack -# module. Defaults to CPackConfig.cmake. +# CPACK_OUTPUT_CONFIG_FILE - The name of the CPack binary configuration +# file. This file is the CPack configuration generated by the CPack module +# for binary installers. Defaults to CPackConfig.cmake. ##end # ##variable -# CPACK_PACKAGE_EXECUTABLES - Lists each of the executables along -# with a text label, to be used to create Start Menu shortcuts on -# Windows. For example, setting this to the list ccmake;CMake will -# create a shortcut named "CMake" that will execute the installed -# executable ccmake. +# CPACK_PACKAGE_EXECUTABLES - Lists each of the executables and associated +# text label to be used to create Start Menu shortcuts. For example, +# setting this to the list ccmake;CMake will +# create a shortcut named "CMake" that will execute the installed +# executable ccmake. Not all CPack generators use it (at least NSIS and +# OSXX11 do). ##end # ##variable -# CPACK_STRIP_FILES - List of files to be stripped. Starting with -# CMake 2.6.0 CPACK_STRIP_FILES will be a boolean variable which -# enables stripping of all files (a list of files evaluates to TRUE -# in CMake, so this change is compatible). +# CPACK_STRIP_FILES - List of files to be stripped. Starting with +# CMake 2.6.0 CPACK_STRIP_FILES will be a boolean variable which +# enables stripping of all files (a list of files evaluates to TRUE +# in CMake, so this change is compatible). ##end # # The following CPack variables are specific to source packages, and # will not affect binary packages: # ##variable -# CPACK_SOURCE_PACKAGE_FILE_NAME - The name of the source package, -# e.g., cmake-2.6.1 +# CPACK_SOURCE_PACKAGE_FILE_NAME - The name of the source package. For +# example cmake-2.6.1. ##end # ##variable -# CPACK_SOURCE_STRIP_FILES - List of files in the source tree that -# will be stripped. Starting with CMake 2.6.0 -# CPACK_SOURCE_STRIP_FILES will be a boolean variable which enables -# stripping of all files (a list of files evaluates to TRUE in CMake, -# so this change is compatible). +# CPACK_SOURCE_STRIP_FILES - List of files in the source tree that +# will be stripped. Starting with CMake 2.6.0 +# CPACK_SOURCE_STRIP_FILES will be a boolean variable which enables +# stripping of all files (a list of files evaluates to TRUE in CMake, +# so this change is compatible). ##end # ##variable -# CPACK_SOURCE_GENERATOR - List of generators used for the source -# packages. As with CPACK_GENERATOR, if this is not specified then -# CPack will create a set of options (e.g., CPACK_SOURCE_ZIP) -# allowing users to select which packages will be generated. +# CPACK_SOURCE_GENERATOR - List of generators used for the source +# packages. As with CPACK_GENERATOR, if this is not specified then +# CPack will create a set of options (e.g., CPACK_SOURCE_ZIP) +# allowing users to select which packages will be generated. ##end # ##variable -# CPACK_SOURCE_OUTPUT_CONFIG_FILE - The name of the CPack -# configuration file for source installers that will be generated by -# the CPack module. Defaults to CPackSourceConfig.cmake. +# CPACK_SOURCE_OUTPUT_CONFIG_FILE - The name of the CPack source +# configuration file. This file is the CPack configuration generated by the +# CPack module for source installers. Defaults to CPackSourceConfig.cmake. ##end # ##variable -# CPACK_SOURCE_IGNORE_FILES - Pattern of files in the source tree -# that won't be packaged when building a source package. This is a -# list of patterns, e.g., /CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~;cscope.* +# CPACK_SOURCE_IGNORE_FILES - Pattern of files in the source tree +# that won't be packaged when building a source package. This is a +# list of regular expression patterns (that must be properly escaped), +# e.g., /CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~;cscope.* ##end # # The following variables are for advanced uses of CPack: # ##variable -# CPACK_CMAKE_GENERATOR - What CMake generator should be used if the -# project is CMake project. Defaults to the value of CMAKE_GENERATOR; -# few users will want to change this setting. +# CPACK_CMAKE_GENERATOR - What CMake generator should be used if the +# project is CMake project. Defaults to the value of CMAKE_GENERATOR +# few users will want to change this setting. ##end # ##variable -# CPACK_INSTALL_CMAKE_PROJECTS - List of four values that specify -# what project to install. The four values are: Build directory, -# Project Name, Project Component, Directory. If omitted, CPack will -# build an installer that installers everything. +# CPACK_INSTALL_CMAKE_PROJECTS - List of four values that specify +# what project to install. The four values are: Build directory, +# Project Name, Project Component, Directory. If omitted, CPack will +# build an installer that installers everything. ##end # ##variable -# CPACK_SYSTEM_NAME - System name, defaults to the value of -# ${CMAKE_SYSTEM_NAME}. +# CPACK_SYSTEM_NAME - System name, defaults to the value of +# ${CMAKE_SYSTEM_NAME}. ##end # ##variable -# CPACK_PACKAGE_VERSION - Package full version, used internally. By -# default, this is built from CPACK_PACKAGE_VERSION_MAJOR, -# CPACK_PACKAGE_VERSION_MINOR, and CPACK_PACKAGE_VERSION_PATCH. +# CPACK_PACKAGE_VERSION - Package full version, used internally. By +# default, this is built from CPACK_PACKAGE_VERSION_MAJOR, +# CPACK_PACKAGE_VERSION_MINOR, and CPACK_PACKAGE_VERSION_PATCH. ##end # ##variable -# CPACK_TOPLEVEL_TAG - Directory for the installed files. +# CPACK_TOPLEVEL_TAG - Directory for the installed files. ##end # ##variable -# CPACK_INSTALL_COMMANDS - Extra commands to install components. +# CPACK_INSTALL_COMMANDS - Extra commands to install components. ##end # ##variable -# CPACK_INSTALLED_DIRECTORIES - Extra directories to install. +# CPACK_INSTALLED_DIRECTORIES - Extra directories to install. ##end # @@ -358,6 +380,12 @@ macro(cpack_optional_append _list _cond _item) endif(${_cond}) endmacro(cpack_optional_append _list _cond _item) +##variable +# CPACK_BINARY_<GENNAME> - CPack generated options for binary generators. The +# CPack.cmake module generates (when CPACK_GENERATOR is not set) +# a set of CMake options (see CMake option command) which may then be used to +# select the CPack generator(s) to be used when launching the package target. +##end # Provide options to choose generators # we might check here if the required tools for the generates exist # and set the defaults according to the results diff --git a/Modules/CPackBundle.cmake b/Modules/CPackBundle.cmake index 007fc04..0da51e3 100644 --- a/Modules/CPackBundle.cmake +++ b/Modules/CPackBundle.cmake @@ -4,33 +4,32 @@ # - CPack Bundle generator (Mac OS X) specific options # # Installers built on Mac OS X using the Bundle generator use the -# aforementioned DragNDrop variables, plus the following Bundle-specific -# parameters: +# aforementioned DragNDrop (CPACK_DMG_xxx) variables, plus +# the following Bundle-specific parameters (CPACK_BUNDLE_xxx). ##end # ##variable -# CPACK_BUNDLE_NAME - The name of the generated bundle. This -# appears in the OSX finder as the bundle name. Required. +# CPACK_BUNDLE_NAME - The name of the generated bundle. This +# appears in the OSX finder as the bundle name. Required. ##end # ##variable -# CPACK_BUNDLE_PLIST - Path to an OSX plist file that will be used -# as the Info.plist for the generated bundle. This assumes that -# the caller has generated or specified their own Info.plist file. -# Required. +# CPACK_BUNDLE_PLIST - Path to an OSX plist file that will be used +# for the generated bundle. This assumes that the caller has generated +# or specified their own Info.plist file. Required. ##end # ##variable -# CPACK_BUNDLE_ICON - Path to an OSX icns file that will be used as -# the icon for the generated bundle. This is the icon that appears -# in the OSX finder for the bundle, and in the OSX dock when the -# bundle is opened. Required. +# CPACK_BUNDLE_ICON - Path to an OSX icon file that will be used as +# the icon for the generated bundle. This is the icon that appears in the +# OSX finder for the bundle, and in the OSX dock when the bundle is opened. +# Required. ##end # ##variable -# CPACK_BUNDLE_STARTUP_SCRIPT - Path to an executable or script that -# will be run whenever an end-user double-clicks the generated bundle -# in the OSX Finder. Optional. +# CPACK_BUNDLE_STARTUP_COMMAND - Path to a startup script. This is a path to +# an executable or script that will be run whenever an end-user double-clicks +# the generated bundle in the OSX Finder. Optional. ##end #============================================================================= diff --git a/Modules/CPackCygwin.cmake b/Modules/CPackCygwin.cmake new file mode 100644 index 0000000..7ed7f67 --- /dev/null +++ b/Modules/CPackCygwin.cmake @@ -0,0 +1,33 @@ +##section Variables specific to CPack Cygwin generator +##end +##module +# - Cygwin CPack generator (Cygwin). +# The following variable is specific to installers build on +# and/or for Cygwin: +##end +# +##variable +# CPACK_CYGWIN_PATCH_NUMBER - The Cygwin patch number. +# FIXME: This documentation is incomplete. +##end +##variable +# CPACK_CYGWIN_PATCH_FILE - The Cygwin patch file. +# FIXME: This documentation is incomplete. +##end +##variable +# CPACK_CYGWIN_BUILD_SCRIPT - The Cygwin build script. +# FIXME: This documentation is incomplete. +##end + +#============================================================================= +# Copyright 2006-2012 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) diff --git a/Modules/CPackDMG.cmake b/Modules/CPackDMG.cmake index caa8dc8..e866bab 100644 --- a/Modules/CPackDMG.cmake +++ b/Modules/CPackDMG.cmake @@ -7,53 +7,53 @@ ##end # ##variable -# CPACK_DMG_VOLUME_NAME - The volume name of the generated disk -# image. Defaults to CPACK_PACKAGE_FILE_NAME. +# CPACK_DMG_VOLUME_NAME - The volume name of the generated disk +# image. Defaults to CPACK_PACKAGE_FILE_NAME. ##end # ##variable -# CPACK_DMG_FORMAT - The disk image format. Common values are UDRO -# (UDIF read-only), UDZO (UDIF zlib-compressed) or UDBZ (UDIF -# bzip2-compressed). Refer to hdiutil(1) for more information on -# other available formats. +# CPACK_DMG_FORMAT - The disk image format. Common values are UDRO +# (UDIF read-only), UDZO (UDIF zlib-compressed) or UDBZ (UDIF +# bzip2-compressed). Refer to hdiutil(1) for more information on +# other available formats. ##end # ##variable -# CPACK_DMG_DS_STORE - Path to a custom .DS_Store file which e.g. -# can be used to specify the Finder window position/geometry and -# layout (such as hidden toolbars, placement of the icons etc.). -# This file has to be generated by the Finder (either manually or -# through OSA-script) using a normal folder from which the .DS_Store -# file can then be extracted. +# CPACK_DMG_DS_STORE - Path to a custom DS_Store file. This .DS_Store +# file e.g. can be used to specify the Finder window +# position/geometry and layout (such as hidden toolbars, placement of the +# icons etc.). This file has to be generated by the Finder (either manually or +# through OSA-script) using a normal folder from which the .DS_Store +# file can then be extracted. ##end # ##variable -# CPACK_DMG_BACKGROUND_IMAGE - Path to an image file which is to be -# used as the background for the Finder Window when the disk image -# is opened. By default no background image is set. The background -# image is applied after applying the custom .DS_Store file. +# CPACK_DMG_BACKGROUND_IMAGE - Path to a background image file. This +# file will be used as the background for the Finder Window when the disk +# image is opened. By default no background image is set. The background +# image is applied after applying the custom .DS_Store file. ##end # ##variable -# CPACK_COMMAND_HDIUTIL - Path to the hdiutil(1) command used to -# operate on disk image files on Mac OS X. This variable can be used -# to override the automatically detected command (or specify its -# location if the auto-detection fails to find it.) +# CPACK_COMMAND_HDIUTIL - Path to the hdiutil(1) command used to +# operate on disk image files on Mac OS X. This variable can be used +# to override the automatically detected command (or specify its +# location if the auto-detection fails to find it.) ##end # ##variable -# CPACK_COMMAND_SETFILE - Path to the SetFile(1) command used to set -# extended attributes on files and directories on Mac OS X. This -# variable can be used to override the automatically detected -# command (or specify its location if the auto-detection fails to -# find it.) +# CPACK_COMMAND_SETFILE - Path to the SetFile(1) command used to set +# extended attributes on files and directories on Mac OS X. This +# variable can be used to override the automatically detected +# command (or specify its location if the auto-detection fails to +# find it.) ##end # ##variable -# CPACK_COMMAND_REZ - Path to the Rez(1) command used to compile -# resources on Mac OS X. This variable can be used to override the -# automatically detected command (or specify its location if the -# auto-detection fails to find it.) +# CPACK_COMMAND_REZ - Path to the Rez(1) command used to compile +# resources on Mac OS X. This variable can be used to override the +# automatically detected command (or specify its location if the +# auto-detection fails to find it.) ##end #============================================================================= diff --git a/Modules/CPackPackageMaker.cmake b/Modules/CPackPackageMaker.cmake index 8fe423c..45ba465 100644 --- a/Modules/CPackPackageMaker.cmake +++ b/Modules/CPackPackageMaker.cmake @@ -4,20 +4,21 @@ # - PackageMaker CPack generator (Mac OS X). # The following variable is specific to installers build on Mac OS X # using PackageMaker: +##end # ##variable -# CPACK_OSX_PACKAGE_VERSION - The version of Mac OS X that the -# resulting PackageMaker archive should be compatible -# with. Different versions of Mac OS X support different -# features. For example, CPack can only build component-based -# installers for Mac OS X 10.4 or newer, and can only build -# installers that download component son-the-fly for Mac OS X 10.5 -# or newer. If left blank, this value will be set to the minimum -# version of Mac OS X that supports the requested features. Set this -# variable to some value (e.g., 10.4) only if you want to guarantee -# that your installer will work on that version of Mac OS X, and -# don't mind missing extra features available in the installer -# shipping with later versions of Mac OS X. +# CPACK_OSX_PACKAGE_VERSION - The version of Mac OS X that the +# resulting PackageMaker archive should be compatible with. Different +# versions of Mac OS X support different +# features. For example, CPack can only build component-based +# installers for Mac OS X 10.4 or newer, and can only build +# installers that download component son-the-fly for Mac OS X 10.5 +# or newer. If left blank, this value will be set to the minimum +# version of Mac OS X that supports the requested features. Set this +# variable to some value (e.g., 10.4) only if you want to guarantee +# that your installer will work on that version of Mac OS X, and +# don't mind missing extra features available in the installer +# shipping with later versions of Mac OS X. ##end #============================================================================= diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake index 3618bdf..1c08c59 100644 --- a/Modules/CheckCCompilerFlag.cmake +++ b/Modules/CheckCCompilerFlag.cmake @@ -33,6 +33,7 @@ MACRO (CHECK_C_COMPILER_FLAG _FLAG _RESULT) FAIL_REGEX "unknown .*option" # Clang FAIL_REGEX "ignoring unknown option" # MSVC FAIL_REGEX "warning D9002" # MSVC, any lang + FAIL_REGEX "option .*not supported" # Intel FAIL_REGEX "[Uu]nknown option" # HP FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro FAIL_REGEX "command option .* is not recognized" # XL diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake index 134f875..6fa69b1 100644 --- a/Modules/CheckCXXCompilerFlag.cmake +++ b/Modules/CheckCXXCompilerFlag.cmake @@ -33,6 +33,7 @@ MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT) FAIL_REGEX "unknown .*option" # Clang FAIL_REGEX "ignoring unknown option" # MSVC FAIL_REGEX "warning D9002" # MSVC, any lang + FAIL_REGEX "option .*not supported" # Intel FAIL_REGEX "[Uu]nknown option" # HP FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro FAIL_REGEX "command option .* is not recognized" # XL diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake index 83f322c..8a5e9c5 100644 --- a/Modules/DeployQt4.cmake +++ b/Modules/DeployQt4.cmake @@ -82,6 +82,7 @@ include(BundleUtilities) set(DeployQt4_cmake_dir "${CMAKE_CURRENT_LIST_DIR}") +set(DeployQt4_apple_plugins_dir "PlugIns") function(write_qt4_conf qt_conf_dir qt_conf_contents) set(qt_conf_path "${qt_conf_dir}/qt.conf") @@ -130,6 +131,9 @@ function(fixup_qt4_executable executable) set(qt_conf_dir "${executable}/Contents/Resources") set(executable_path "${executable}") set(write_qt_conf TRUE) + if(NOT plugins_dir) + set(plugins_dir "${DeployQt4_apple_plugins_dir}") + endif() else() get_filename_component(executable_path "${executable}" PATH) if(NOT executable_path) @@ -141,7 +145,7 @@ function(fixup_qt4_executable executable) foreach(plugin ${qtplugins}) set(installed_plugin_path "") - install_qt4_plugin("${plugin}" "${plugins_dir}" "${executable}" 1 installed_plugin_path) + install_qt4_plugin("${plugin}" "${executable}" 1 installed_plugin_path) list(APPEND libs ${installed_plugin_path}) endforeach() @@ -166,23 +170,19 @@ function(install_qt4_plugin_path plugin executable copy installed_plugin_path_va set(component ${ARGV5}) set(configurations ${ARGV6}) if(EXISTS "${plugin}") - if(plugins_dir) - set(plugins_dir "${plugins_dir}") - else() - if(APPLE) - set(plugins_dir "PlugIns") - else() - set(plugins_dir "plugins") - endif() - endif() if(APPLE) + if(NOT plugins_dir) + set(plugins_dir "${DeployQt4_apple_plugins_dir}") + endif() set(plugins_path "${executable}/Contents/${plugins_dir}") else() - get_filename_component(executable_path "${executable}" PATH) - if(NOT executable_path) - set(executable_path ".") + get_filename_component(plugins_path "${executable}" PATH) + if(NOT plugins_path) + set(plugins_path ".") + endif() + if(plugins_dir) + set(plugins_path "${plugins_path}/${plugins_dir}") endif() - set(plugins_path "${executable_path}/${plugins_dir}") endif() set(plugin_group "") @@ -210,7 +210,7 @@ function(install_qt4_plugin_path plugin executable copy installed_plugin_path_va endif() install(FILES "${plugin}" DESTINATION "${plugins_path}" ${configurations} ${component}) endif() - set(${installed_plugin_path_var} ${${installed_path_var}} "${plugins_path}/${plugin_name}" PARENT_SCOPE) + set(${installed_plugin_path_var} "${plugins_path}/${plugin_name}" PARENT_SCOPE) endif() endfunction() @@ -220,11 +220,7 @@ function(install_qt4_plugin plugin executable copy installed_plugin_path_var) if(EXISTS "${plugin}") install_qt4_plugin_path("${plugin}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}") else() - if(QT_IS_STATIC) - string(TOUPPER "QT_${plugin}_LIBRARY" plugin_var) - else() - string(TOUPPER "QT_${plugin}_PLUGIN" plugin_var) - endif() + string(TOUPPER "QT_${plugin}_PLUGIN" plugin_var) set(plugin_release_var "${plugin_var}_RELEASE") set(plugin_debug_var "${plugin_var}_DEBUG") set(plugin_release "${${plugin_release_var}}") @@ -232,10 +228,24 @@ function(install_qt4_plugin plugin executable copy installed_plugin_path_var) if(DEFINED "${plugin_release_var}" AND DEFINED "${plugin_debug_var}" AND NOT EXISTS "${plugin_release}" AND NOT EXISTS "${plugin_debug}") message(WARNING "Qt plugin \"${plugin}\" not recognized or found.") endif() - install_qt4_plugin_path("${plugin_release}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}" "Release|RelWithDebInfo|MinSizeRel") - install_qt4_plugin_path("${plugin_debug}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}" "Debug") + if(NOT EXISTS "${${plugin_debug_var}}") + set(plugin_debug "${plugin_release}") + endif() + + if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + install_qt4_plugin_path("${plugin_release}" "${executable}" "${copy}" "${installed_plugin_path_var}_release" "${plugins_dir}" "${component}" "Release|RelWithDebInfo|MinSizeRel") + install_qt4_plugin_path("${plugin_debug}" "${executable}" "${copy}" "${installed_plugin_path_var}_debug" "${plugins_dir}" "${component}" "Debug") + + if(CMAKE_BUILD_TYPE MATCHES "^Debug$") + set(${installed_plugin_path_var} ${${installed_plugin_path_var}_debug}) + else() + set(${installed_plugin_path_var} ${${installed_plugin_path_var}_release}) + endif() + else() + install_qt4_plugin_path("${plugin_release}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}") + endif() endif() - set(installed_plugin_path_var "${installed_plugin_path_var}" PARENT_SCOPE) + set(${installed_plugin_path_var} ${${installed_plugin_path_var}} PARENT_SCOPE) endfunction() function(install_qt4_executable executable) @@ -264,16 +274,16 @@ function(install_qt4_executable executable) set(qt_plugins_dir "") endif() - if(NOT qtplugins AND QT_LIBRARIES_PLUGINS) - set(qtplugins "${QT_LIBRARIES_PLUGINS}") + if(QT_IS_STATIC) + message(WARNING "Qt built statically: not installing plugins.") + else() + foreach(plugin ${qtplugins}) + set(installed_plugin_paths "") + install_qt4_plugin("${plugin}" "${executable}" 0 installed_plugin_paths "${plugins_dir}" "${component}") + list(APPEND libs ${installed_plugin_paths}) + endforeach() endif() - foreach(plugin ${qtplugins}) - set(installed_plugin_paths "") - install_qt4_plugin("${plugin}" "${executable}" 0 installed_plugin_paths "${plugins_dir}" "${component}") - list(APPEND libs ${installed_plugin_paths}) - endforeach() - resolve_qt4_paths(libs) install(CODE diff --git a/Modules/FindGnuplot.cmake b/Modules/FindGnuplot.cmake index 3e36e4b..b8dc3f4 100644 --- a/Modules/FindGnuplot.cmake +++ b/Modules/FindGnuplot.cmake @@ -5,6 +5,8 @@ # GNUPLOT_FOUND - system has Gnuplot # GNUPLOT_EXECUTABLE - the Gnuplot executable # GNUPLOT_VERSION_STRING - the version of Gnuplot found (since CMake 2.8.8) +# +# GNUPLOT_VERSION_STRING will not work for old versions like 3.7.1. #============================================================================= # Copyright 2002-2009 Kitware, Inc. diff --git a/Modules/FindHSPELL.cmake b/Modules/FindHSPELL.cmake index 054f565..ca5709b 100644 --- a/Modules/FindHSPELL.cmake +++ b/Modules/FindHSPELL.cmake @@ -32,12 +32,15 @@ IF (HSPELL_INCLUDE_DIR) FILE(READ "${HSPELL_INCLUDE_DIR}/hspell.h" HSPELL_H) STRING(REGEX REPLACE ".*#define HSPELL_VERSION_MAJOR ([0-9]+).*" "\\1" HSPELL_VERSION_MAJOR "${HSPELL_H}") STRING(REGEX REPLACE ".*#define HSPELL_VERSION_MINOR ([0-9]+).*" "\\1" HSPELL_VERSION_MINOR "${HSPELL_H}") + SET(HSPELL_VERSION_STRING "${HSPELL_VERSION_MAJOR}.${HSPELL_VERSION_MINOR}") ENDIF() # handle the QUIETLY and REQUIRED arguments and set HSPELL_FOUND to TRUE if # all listed variables are TRUE INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(HSPELL DEFAULT_MSG HSPELL_LIBRARIES HSPELL_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(HSPELL + REQUIRED_VARS HSPELL_LIBRARIES HSPELL_INCLUDE_DIR + VERSION_VAR HSPELL_VERSION_STRING) MARK_AS_ADVANCED(HSPELL_INCLUDE_DIR HSPELL_LIBRARIES) diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake index 52d575b..f21b630 100644 --- a/Modules/FindImageMagick.cmake +++ b/Modules/FindImageMagick.cmake @@ -27,6 +27,8 @@ # ImageMagick_VERSION_STRING - the version of ImageMagick found # (since CMake 2.8.8) # +# ImageMagick_VERSION_STRING will not work for old versions like 5.2.3. +# # There are also components for the following ImageMagick APIs: # # Magick++ @@ -171,7 +173,7 @@ FOREACH(component ${ImageMagick_FIND_COMPONENTS} ELSEIF(ImageMagick_${component}_EXECUTABLE) # if no components were requested explicitly put all (default) executables # in the list - LIST(APPEND ImageMagick_DEFAULT_EXECUTABLES "${ImageMagick_${component}_EXECUTABLE}") + LIST(APPEND ImageMagick_DEFAULT_EXECUTABLES ImageMagick_${component}_EXECUTABLE) ENDIF(ImageMagick_FIND_COMPONENTS) ENDIF(component STREQUAL "Magick++") ENDFOREACH(component) diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index e1af15e..b96a2ec 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -25,11 +25,6 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -get_property(_ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) -list(FIND _ENABLED_LANGUAGES "C" _HAVE_LANGUAGE_C) -list(FIND _ENABLED_LANGUAGES "CXX" _HAVE_LANGUAGE_CXX) -unset(_ENABLED_LANGUAGES) - set(_OPENMP_REQUIRED_VARS) function(_OPENMP_FLAG_CANDIDATES LANG) @@ -93,7 +88,7 @@ int main() { ") # check c compiler -if(NOT _HAVE_LANGUAGE_C EQUAL -1) +if(CMAKE_C_COMPILER_LOADED) # if these are set then do not try to find them again, # by avoiding any try_compiles for the flags if(OpenMP_C_FLAGS) @@ -124,7 +119,7 @@ if(NOT _HAVE_LANGUAGE_C EQUAL -1) endif() # check cxx compiler -if(NOT _HAVE_LANGUAGE_CXX EQUAL -1) +if(CMAKE_CXX_COMPILER_LOADED) # if these are set then do not try to find them again, # by avoiding any try_compiles for the flags if(OpenMP_CXX_FLAGS) @@ -158,9 +153,6 @@ if(NOT _HAVE_LANGUAGE_CXX EQUAL -1) unset(OpenMP_CXX_TEST_SOURCE) endif() -unset(_HAVE_LANGUAGE_C) -unset(_HAVE_LANGUAGE_CXX) - if(_OPENMP_REQUIRED_VARS) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake index 460f0fd..52f9316 100644 --- a/Modules/FindOpenSceneGraph.cmake +++ b/Modules/FindOpenSceneGraph.cmake @@ -78,7 +78,7 @@ list(APPEND _osg_modules_to_process "osg" "OpenThreads") list(REMOVE_DUPLICATES _osg_modules_to_process) if(OpenSceneGraph_DEBUG) - message("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " + message(STATUS "[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " "Components = ${_osg_modules_to_process}") endif() @@ -93,7 +93,7 @@ endif() # Try to ascertain the version... if(OSG_INCLUDE_DIR) if(OpenSceneGraph_DEBUG) - message("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " + message(STATUS "[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " "Detected OSG_INCLUDE_DIR = ${OSG_INCLUDE_DIR}") endif() @@ -127,14 +127,14 @@ if(OSG_INCLUDE_DIR) string(REGEX REPLACE ".*#define OPENSCENEGRAPH_PATCH_VERSION[ \t]+([0-9]+).*" "\\1" _osg_VERSION_PATCH ${_osg_Version_contents}) else() - message("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " + message(WARNING "[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " "Failed to parse version number, please report this as a bug") endif() set(OPENSCENEGRAPH_VERSION "${_osg_VERSION_MAJOR}.${_osg_VERSION_MINOR}.${_osg_VERSION_PATCH}" CACHE INTERNAL "The version of OSG which was detected") if(OpenSceneGraph_DEBUG) - message("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " + message(STATUS "[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " "Detected version ${OPENSCENEGRAPH_VERSION}") endif() endif() @@ -165,7 +165,7 @@ endif() # foreach(_osg_module ${_osg_modules_to_process}) if(OpenSceneGraph_DEBUG) - message("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " + message(STATUS "[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " "Calling find_package(${_osg_module} ${_osg_required} ${_osg_quiet})") endif() find_package(${_osg_module} ${_osg_quiet}) diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index 5c1d56b..a131c5f 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -10,11 +10,14 @@ # PYTHON_VERSION_MINOR - Python minor version found e.g. 5 # PYTHON_VERSION_PATCH - Python patch version found e.g. 2 # -# Python_ADDITIONAL_VERSIONS - list of additional Python versions to search for +# The Python_ADDITIONAL_VERSIONS variable can be used to specify a list of +# version numbers that should be taken into account when searching for Python. +# You need to set this variable before calling find_package(PythonInterp). #============================================================================= # Copyright 2005-2010 Kitware, Inc. # Copyright 2011 Bjoern Ricks <bjoern.ricks@gmail.com> +# Copyright 2012 Rolf Eike Beer <eike@sf-mail.de> # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -88,24 +91,42 @@ endif() # determine python version string if(PYTHON_EXECUTABLE) - execute_process(COMMAND "${PYTHON_EXECUTABLE}" --version - ERROR_VARIABLE _VERSION + execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c + "import sys; sys.stdout.write(';'.join([str(x) for x in sys.version_info[:3]]))" + OUTPUT_VARIABLE _VERSION RESULT_VARIABLE _PYTHON_VERSION_RESULT - OUTPUT_QUIET - ERROR_STRIP_TRAILING_WHITESPACE) - if(_PYTHON_VERSION_RESULT) - execute_process(COMMAND "${PYTHON_EXECUTABLE}" -V - ERROR_VARIABLE _VERSION + ERROR_QUIET) + if(NOT _PYTHON_VERSION_RESULT) + string(REPLACE ";" "." PYTHON_VERSION_STRING "${_VERSION}") + list(GET _VERSION 0 PYTHON_VERSION_MAJOR) + list(GET _VERSION 1 PYTHON_VERSION_MINOR) + list(GET _VERSION 2 PYTHON_VERSION_PATCH) + if(PYTHON_VERSION_PATCH EQUAL 0) + # it's called "Python 2.7", not "2.7.0" + string(REGEX REPLACE "\\.0$" "" PYTHON_VERSION_STRING "${PYTHON_VERSION_STRING}") + endif() + else() + # sys.version predates sys.version_info, so use that + execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c "import sys; sys.stdout.write(sys.version)" + OUTPUT_VARIABLE _VERSION RESULT_VARIABLE _PYTHON_VERSION_RESULT - OUTPUT_QUIET - ERROR_STRIP_TRAILING_WHITESPACE) - endif(_PYTHON_VERSION_RESULT) - if(NOT _PYTHON_VERSION_RESULT AND _VERSION MATCHES "^Python [0-9]+\\.[0-9]+.*") - string(REPLACE "Python " "" PYTHON_VERSION_STRING "${_VERSION}") - string(REGEX REPLACE "^([0-9]+)\\.[0-9]+.*" "\\1" PYTHON_VERSION_MAJOR "${PYTHON_VERSION_STRING}") - string(REGEX REPLACE "^[0-9]+\\.([0-9])+.*" "\\1" PYTHON_VERSION_MINOR "${PYTHON_VERSION_STRING}") - if(PYTHON_VERSION_STRING MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+.*") - string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" PYTHON_VERSION_PATCH "${PYTHON_VERSION_STRING}") + ERROR_QUIET) + if(NOT _PYTHON_VERSION_RESULT) + string(REGEX REPLACE " .*" "" PYTHON_VERSION_STRING "${_VERSION}") + string(REGEX REPLACE "^([0-9]+)\\.[0-9]+.*" "\\1" PYTHON_VERSION_MAJOR "${PYTHON_VERSION_STRING}") + string(REGEX REPLACE "^[0-9]+\\.([0-9])+.*" "\\1" PYTHON_VERSION_MINOR "${PYTHON_VERSION_STRING}") + if(PYTHON_VERSION_STRING MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+.*") + string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" PYTHON_VERSION_PATCH "${PYTHON_VERSION_STRING}") + else() + set(PYTHON_VERSION_PATCH "0") + endif() + else() + # sys.version was first documented for Python 1.5, so assume + # this is older. + set(PYTHON_VERSION_STRING "1.4") + set(PYTHON_VERSION_MAJOR "1") + set(PYTHON_VERSION_MAJOR "4") + set(PYTHON_VERSION_MAJOR "0") endif() endif() unset(_PYTHON_VERSION_RESULT) diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index da7a1ac..fcd0838 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -7,8 +7,12 @@ # PYTHON_LIBRARIES - path to the python library # PYTHON_INCLUDE_PATH - path to where Python.h is found (deprecated) # PYTHON_INCLUDE_DIRS - path to where Python.h is found -# PYTHON_DEBUG_LIBRARIES - path to the debug library -# Python_ADDITIONAL_VERSIONS - list of additional Python versions to search for +# PYTHON_DEBUG_LIBRARIES - path to the debug library (deprecated) +# PYTHONLIBS_VERSION_STRING - version of the Python libs found (since CMake 2.8.8) +# +# The Python_ADDITIONAL_VERSIONS variable can be used to specify a list of +# version numbers that should be taken into account when searching for Python. +# You need to set this variable before calling find_package(PythonLibs). #============================================================================= # Copyright 2001-2009 Kitware, Inc. @@ -27,11 +31,42 @@ INCLUDE(CMakeFindFrameworks) # Search for the python framework on Apple. CMAKE_FIND_FRAMEWORKS(Python) +SET(_PYTHON1_VERSIONS 1.6 1.5) +SET(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0) +SET(_PYTHON3_VERSIONS 3.3 3.2 3.1 3.0) + +IF(PythonLibs_FIND_VERSION) + IF(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$") + STRING(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonLibs_FIND_VERSION}") + STRING(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}") + UNSET(_PYTHON_FIND_OTHER_VERSIONS) + IF(NOT PythonLibs_FIND_VERSION_EXACT) + FOREACH(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS}) + IF(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN) + LIST(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V}) + ENDIF() + ENDFOREACH() + ENDIF(NOT PythonLibs_FIND_VERSION_EXACT) + UNSET(_PYTHON_FIND_MAJ_MIN) + UNSET(_PYTHON_FIND_MAJ) + ELSE(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$") + SET(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonLibs_FIND_VERSION}_VERSIONS}) + ENDIF(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$") +ELSE(PythonLibs_FIND_VERSION) + SET(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS}) +ENDIF(PythonLibs_FIND_VERSION) + # Set up the versions we know about, in the order we will search. Always add # the user supplied additional versions to the front. -set(_Python_VERSIONS +SET(_Python_VERSIONS ${Python_ADDITIONAL_VERSIONS} - 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5) + ${_PYTHON_FIND_OTHER_VERSIONS} + ) + +UNSET(_PYTHON_FIND_OTHER_VERSIONS) +UNSET(_PYTHON1_VERSIONS) +UNSET(_PYTHON2_VERSIONS) +UNSET(_PYTHON3_VERSIONS) FOREACH(_CURRENT_VERSION ${_Python_VERSIONS}) STRING(REPLACE "." "" _CURRENT_VERSION_NO_DOTS ${_CURRENT_VERSION}) @@ -92,6 +127,17 @@ FOREACH(_CURRENT_VERSION ${_Python_VERSIONS}) SET(PYTHON_INCLUDE_PATH "${PYTHON_INCLUDE_DIR}" CACHE INTERNAL "Path to where Python.h is found (deprecated)") + IF(PYTHON_INCLUDE_DIR AND EXISTS "${PYTHON_INCLUDE_DIR}/patchlevel.h") + FILE(STRINGS "${PYTHON_INCLUDE_DIR}/patchlevel.h" python_version_str + REGEX "^#define[ \t]+PY_VERSION[ \t]+\"[^\"]+\"") + STRING(REGEX REPLACE "^#define[ \t]+PY_VERSION[ \t]+\"([^\"]+)\".*" "\\1" + PYTHONLIBS_VERSION_STRING "${python_version_str}") + UNSET(python_version_str) + ENDIF(PYTHON_INCLUDE_DIR AND EXISTS "${PYTHON_INCLUDE_DIR}/patchlevel.h") + + IF(PYTHON_LIBRARY AND PYTHON_INCLUDE_DIR) + BREAK() + ENDIF(PYTHON_LIBRARY AND PYTHON_INCLUDE_DIR) ENDFOREACH(_CURRENT_VERSION) MARK_AS_ADVANCED( @@ -105,13 +151,23 @@ MARK_AS_ADVANCED( # library. We now set the variables listed by the documentation for this # module. SET(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}") -SET(PYTHON_LIBRARIES "${PYTHON_LIBRARY}") SET(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}") +# These variables have been historically named in this module different from +# what SELECT_LIBRARY_CONFIGURATIONS() expects. +SET(PYTHON_LIBRARY_DEBUG "${PYTHON_DEBUG_LIBRARY}") +SET(PYTHON_LIBRARY_RELEASE "${PYTHON_LIBRARY}") +INCLUDE(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) +SELECT_LIBRARY_CONFIGURATIONS(PYTHON) +# SELECT_LIBRARY_CONFIGURATIONS() sets ${PREFIX}_FOUND if it has a library. +# Unset this, this prefix doesn't match the module prefix, they are different +# for historical reasons. +UNSET(PYTHON_FOUND) INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibs DEFAULT_MSG PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) - +FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibs + REQUIRED_VARS PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS + VERSION_VAR PYTHONLIBS_VERSION_STRING) # PYTHON_ADD_MODULE(<name> src1 src2 ... srcN) is used to build modules for python. # PYTHON_WRITE_MODULES_HEADER(<filename>) writes a header file you can include diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index f3f61f6..ce23d5d 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -18,7 +18,7 @@ # [PREFIX_NAME <prefix_name>] # ) # -# ADD_COMPILER_EXPORT_FLAGS( [FATAL_WARNINGS] ) +# ADD_COMPILER_EXPORT_FLAGS( [<output_variable>] ) # # By default GENERATE_EXPORT_HEADER() generates macro names in a file name # determined by the name of the library. The ADD_COMPILER_EXPORT_FLAGS function @@ -149,46 +149,20 @@ include(CheckCXXCompilerFlag) macro(_check_cxx_compiler_attribute _ATTRIBUTE _RESULT) check_cxx_source_compiles("${_ATTRIBUTE} int somefunc() { return 0; } int main() { return somefunc();}" ${_RESULT} - # Some compilers do not fail with a bad flag - FAIL_REGEX "unrecognized .*option" # GNU - FAIL_REGEX "ignoring unknown option" # MSVC - FAIL_REGEX "warning D9002" # MSVC, any lang - FAIL_REGEX "[Uu]nknown option" # HP - FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro - FAIL_REGEX "command option .* is not recognized" # XL ) endmacro() macro(_test_compiler_hidden_visibility) - if(CMAKE_COMPILER_IS_GNUCXX) - exec_program(${CMAKE_C_COMPILER} ARGS --version - OUTPUT_VARIABLE _gcc_version_info) - string(REGEX MATCH "[345]\\.[0-9]\\.[0-9]" - _gcc_version "${_gcc_version_info}") - # gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the - # patch level, handle this here: - if(NOT _gcc_version) - string(REGEX REPLACE ".*\\(GCC\\).* ([34]\\.[0-9]) .*" "\\1.0" - _gcc_version "${_gcc_version_info}") - endif() - - if("${_gcc_version}" VERSION_LESS "4.2") - set(GCC_TOO_OLD TRUE) - message(WARNING "GCC version older than 4.2") - endif() - endif() - - if(CMAKE_CXX_COMPILER_ID MATCHES Intel) - exec_program(${CMAKE_CXX_COMPILER} ARGS -V - OUTPUT_VARIABLE _intel_version_info) - string(REGEX REPLACE ".*Version ([0-9]+(\\.[0-9]+)+).*" "\\1" - _intel_version "${_intel_version_info}") - - if(${_intel_version} VERSION_LESS "12.0") - set(_INTEL_TOO_OLD TRUE) - message(WARNING "Intel compiler older than 12.0") - endif() + if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.2") + set(GCC_TOO_OLD TRUE) + message(WARNING "GCC version older than 4.2") + elseif(CMAKE_COMPILER_IS_GNUC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "4.2") + set(GCC_TOO_OLD TRUE) + message(WARNING "GCC version older than 4.2") + elseif(CMAKE_CXX_COMPILER_ID MATCHES Intel AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "12.0") + set(_INTEL_TOO_OLD TRUE) + message(WARNING "Intel compiler older than 12.0") endif() diff --git a/Modules/Platform/Windows-Borland-C.cmake b/Modules/Platform/Windows-Borland-C.cmake index ebb74a1..e2f76aa 100644 --- a/Modules/Platform/Windows-Borland-C.cmake +++ b/Modules/Platform/Windows-Borland-C.cmake @@ -1,2 +1 @@ -include(Platform/Windows-Borland) -__borland_language(C) +include(Platform/Windows-Embarcadero-C) diff --git a/Modules/Platform/Windows-Borland-CXX.cmake b/Modules/Platform/Windows-Borland-CXX.cmake index 1260c0e..809490f 100644 --- a/Modules/Platform/Windows-Borland-CXX.cmake +++ b/Modules/Platform/Windows-Borland-CXX.cmake @@ -1,2 +1 @@ -include(Platform/Windows-Borland) -__borland_language(CXX) +include(Platform/Windows-Embarcadero-CXX) diff --git a/Modules/Platform/Windows-Embarcadero-C.cmake b/Modules/Platform/Windows-Embarcadero-C.cmake new file mode 100644 index 0000000..607fd4e --- /dev/null +++ b/Modules/Platform/Windows-Embarcadero-C.cmake @@ -0,0 +1,3 @@ +set(_lang C) +include(Platform/Windows-Embarcadero) +__embarcadero_language(C) diff --git a/Modules/Platform/Windows-Embarcadero-CXX.cmake b/Modules/Platform/Windows-Embarcadero-CXX.cmake new file mode 100644 index 0000000..279a4de --- /dev/null +++ b/Modules/Platform/Windows-Embarcadero-CXX.cmake @@ -0,0 +1,3 @@ +set(_lang CXX) +include(Platform/Windows-Embarcadero) +__embarcadero_language(CXX) diff --git a/Modules/Platform/Windows-Borland.cmake b/Modules/Platform/Windows-Embarcadero.cmake index 5c402bd..87b3767 100644 --- a/Modules/Platform/Windows-Borland.cmake +++ b/Modules/Platform/Windows-Embarcadero.cmake @@ -1,6 +1,6 @@ #============================================================================= -# Copyright 2002-2009 Kitware, Inc. +# Copyright 2002-2012 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -13,26 +13,33 @@ # License text for the above reference.) # This module is shared by multiple languages; use include blocker. -if(__WINDOWS_BORLAND) +if(__WINDOWS_EMBARCADERO) return() endif() -set(__WINDOWS_BORLAND 1) +set(__WINDOWS_EMBARCADERO 1) SET(BORLAND 1) -# Borland target type flags (bcc32 -h -t): -# -tW GUI App (implies -U__CONSOLE__) -# -tWC Console App (implies -D__CONSOLE__=1) -# -tWD Build a DLL (implies -D__DLL__=1 -D_DLL=1) -# -tWM Enable threads (implies -D__MT__=1 -D_MT=1) -# -tWR Use DLL runtime (implies -D_RTLDLL, and '-tW' too!!) -# -# Notes: -# - The flags affect linking so we pass them to the linker. -# - The flags affect preprocessing so we pass them to the compiler. -# - Since '-tWR' implies '-tW' we use '-tWR -tW-' instead. -# - Since '-tW-' disables '-tWD' we use '-tWR -tW- -tWD' for DLLs. -set(_RTLDLL "-tWR -tW-") +if("${CMAKE_${_lang}_COMPILER_VERSION}" VERSION_LESS 6.30) + # Borland target type flags (bcc32 -h -t): + set(_tW "-tW") # -tW GUI App (implies -U__CONSOLE__) + set(_tC "-tWC") # -tWC Console App (implies -D__CONSOLE__=1) + set(_tD "-tWD") # -tWD Build a DLL (implies -D__DLL__=1 -D_DLL=1) + set(_tM "-tWM") # -tWM Enable threads (implies -D__MT__=1 -D_MT=1) + set(_tR "-tWR -tW-") # -tWR Use DLL runtime (implies -D_RTLDLL, and '-tW' too!!) + # Notes: + # - The flags affect linking so we pass them to the linker. + # - The flags affect preprocessing so we pass them to the compiler. + # - Since '-tWR' implies '-tW' we use '-tWR -tW-' instead. + # - Since '-tW-' disables '-tWD' we use '-tWR -tW- -tWD' for DLLs. +else() + set(EMBARCADERO 1) + set(_tC "-tC") # Target is a console application + set(_tD "-tD") # Target is a shared library + set(_tM "-tM") # Target is multi-threaded + set(_tR "-tR") # Target uses the dynamic RTL + set(_tW "-tW") # Target is a Windows application +endif() set(_COMPILE_C "-c") set(_COMPILE_CXX "-P -c") @@ -50,14 +57,14 @@ SET(CMAKE_FIND_LIBRARY_SUFFIXES "-bcc.lib" ".lib") SET (CMAKE_MANGLE_OBJECT_FILE_NAMES "ON") # extra flags for a win32 exe -SET(CMAKE_CREATE_WIN32_EXE "-tW" ) +SET(CMAKE_CREATE_WIN32_EXE "${_tW}" ) # extra flags for a console app -SET(CMAKE_CREATE_CONSOLE_EXE "-tWC" ) +SET(CMAKE_CREATE_CONSOLE_EXE "${_tC}" ) SET (CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel.") -SET (CMAKE_EXE_LINKER_FLAGS_INIT "-tWM -lS:10000000 -lSc:10000000 ") +SET (CMAKE_EXE_LINKER_FLAGS_INIT "${_tM} -lS:10000000 -lSc:10000000 ") SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "-v") SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "-v") SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) @@ -67,18 +74,19 @@ SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT}) -macro(__borland_language lang) - set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-tWD") + +macro(__embarcadero_language lang) + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "${_tD}") # compile a source file into an object file # place <DEFINES> outside the response file because Borland refuses # to parse quotes from the response file. set(CMAKE_${lang}_COMPILE_OBJECT - "<CMAKE_${lang}_COMPILER> ${_RTLDLL} <DEFINES> ${CMAKE_START_TEMP_FILE}-DWIN32 -o<OBJECT> <FLAGS> ${_COMPILE_${lang}} <SOURCE>${CMAKE_END_TEMP_FILE}" + "<CMAKE_${lang}_COMPILER> ${_tR} <DEFINES> ${CMAKE_START_TEMP_FILE}-DWIN32 -o<OBJECT> <FLAGS> ${_COMPILE_${lang}} <SOURCE>${CMAKE_END_TEMP_FILE}" ) set(CMAKE_${lang}_LINK_EXECUTABLE - "<CMAKE_${lang}_COMPILER> ${_RTLDLL} -e<TARGET> ${CMAKE_START_TEMP_FILE}<LINK_FLAGS> <FLAGS> <LINK_LIBRARIES> <OBJECTS>${CMAKE_END_TEMP_FILE}" + "<CMAKE_${lang}_COMPILER> ${_tR} -e<TARGET> ${CMAKE_START_TEMP_FILE}<LINK_FLAGS> <FLAGS> <LINK_LIBRARIES> <OBJECTS>${CMAKE_END_TEMP_FILE}" # "implib -c -w <TARGET_IMPLIB> <TARGET>" ) @@ -91,7 +99,7 @@ macro(__borland_language lang) # Create a module library. set(CMAKE_${lang}_CREATE_SHARED_MODULE - "<CMAKE_${lang}_COMPILER> ${_RTLDLL} -tWD ${CMAKE_START_TEMP_FILE}-e<TARGET> <LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS>${CMAKE_END_TEMP_FILE}" + "<CMAKE_${lang}_COMPILER> ${_tR} ${_tD} ${CMAKE_START_TEMP_FILE}-e<TARGET> <LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS>${CMAKE_END_TEMP_FILE}" ) # Create an import library for another target. @@ -112,7 +120,7 @@ macro(__borland_language lang) ) # Initial configuration flags. - set(CMAKE_${lang}_FLAGS_INIT "-tWM") + set(CMAKE_${lang}_FLAGS_INIT "${_tM}") set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-Od -v") set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-O1 -DNDEBUG") set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index 2a83045..ef76724 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -47,20 +47,17 @@ MACRO(SWIG_MODULE_INITIALIZE name language) SET(SWIG_MODULE_${name}_LANGUAGE "${swig_uppercase_language}") SET(SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG "${swig_lowercase_language}") - IF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xUNKNOWNx$") - MESSAGE(FATAL_ERROR "SWIG Error: Language \"${language}\" not found") - ENDIF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xUNKNOWNx$") - SET(SWIG_MODULE_${name}_REAL_NAME "${name}") - IF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xPYTHONx$") + IF("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "UNKNOWN") + MESSAGE(FATAL_ERROR "SWIG Error: Language \"${language}\" not found") + ELSEIF("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "PYTHON") # when swig is used without the -interface it will produce in the module.py # a 'import _modulename' statement, which implies having a corresponding # _modulename.so (*NIX), _modulename.pyd (Win32). SET(SWIG_MODULE_${name}_REAL_NAME "_${name}") - ENDIF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xPYTHONx$") - IF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xPERLx$") + ELSEIF("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "PERL") SET(SWIG_MODULE_${name}_EXTRA_FLAGS "-shadow") - ENDIF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xPERLx$") + ENDIF() ENDMACRO(SWIG_MODULE_INITIALIZE) # |