diff options
93 files changed, 1589 insertions, 911 deletions
diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index 1a46688..9eee655 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -1,3 +1,7 @@ +SET(CTEST_CUSTOM_ERROR_MATCH + ${CTEST_CUSTOM_ERROR_MATCH} + "ERROR:") + SET(CTEST_CUSTOM_WARNING_EXCEPTION ${CTEST_CUSTOM_WARNING_EXCEPTION} "xtree.[0-9]+. : warning C4702: unreachable code" @@ -44,6 +48,7 @@ SET(CTEST_CUSTOM_WARNING_EXCEPTION "cc-3968 CC: WARNING File.*" # "implicit" truncation by static_cast "ld: warning: directory not found for option .-(F|L)" "warning.*This version of Mac OS X is unsupported" + "clang.*: warning: argument unused during compilation: .-g" # Ignore clang's summary warning, assuming prior text has matched some # other warning expression: diff --git a/Docs/cmake-mode.el b/Docs/cmake-mode.el index 4418bfa..9517455 100644 --- a/Docs/cmake-mode.el +++ b/Docs/cmake-mode.el @@ -68,9 +68,9 @@ set the path with these commands: "\\|" "[ \t\r\n]" "\\)*")) (defconst cmake-regex-block-open - "^\\(IF\\|MACRO\\|FOREACH\\|ELSE\\|ELSEIF\\|WHILE\\|FUNCTION\\)$") + "^\\([iI][fF]\\|[mM][aA][cC][rR][oO]\\|[fF][oO][rR][eE][aA][cC][hH]\\|[eE][lL][sS][eE]\\|[eE][lL][sS][eE][iI][fF]\\|[wW][hH][iI][lL][eE]\\|[fF][uU][nN][cC][tT][iI][oO][nN]\\)$") (defconst cmake-regex-block-close - "^[ \t]*\\(ENDIF\\|ENDFOREACH\\|ENDMACRO\\|ELSE\\|ELSEIF\\|ENDWHILE\\|ENDFUNCTION\\)[ \t]*(") + "^[ \t]*\\([eE][nN][dD][iI][fF]\\|[eE][nN][dD][fF][oO][rR][eE][aA][cC][hH]\\|[eE][nN][dD][mM][aA][cC][rR][oO]\\|[eE][lL][sS][eE]\\|[eE][lL][sS][eE][iI][fF]\\|[eE][nN][dD][wW][hH][iI][lL][eE]\\|[eE][nN][dD][fF][uU][nN][cC][tT][iI][oO][nN]\\)[ \t]*(") ;------------------------------------------------------------------------------ diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake index ddb79fb..abd9100 100644 --- a/Modules/CMakeAddFortranSubdirectory.cmake +++ b/Modules/CMakeAddFortranSubdirectory.cmake @@ -50,7 +50,7 @@ include(CheckLanguage) include(ExternalProject) include(CMakeParseArguments) -function(_setup_mingw_config_and_build source_dir) +function(_setup_mingw_config_and_build source_dir build_dir) # Look for a MinGW gfortran. find_program(MINGW_GFORTRAN NAMES gfortran @@ -91,11 +91,11 @@ function(_setup_mingw_config_and_build source_dir) string(REPLACE "\\" "\\\\" MINGW_PATH "${MINGW_PATH}") configure_file( ${_MS_MINGW_SOURCE_DIR}/CMakeAddFortranSubdirectory/config_mingw.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/config_mingw.cmake + ${build_dir}/config_mingw.cmake @ONLY) configure_file( ${_MS_MINGW_SOURCE_DIR}/CMakeAddFortranSubdirectory/build_mingw.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/build_mingw.cmake + ${build_dir}/build_mingw.cmake @ONLY) endfunction() @@ -144,15 +144,15 @@ function(cmake_add_fortran_subdirectory subdir) endif() endforeach() # create build and configure wrapper scripts - _setup_mingw_config_and_build(${source_dir}) + _setup_mingw_config_and_build("${source_dir}" "${build_dir}") # create the external project externalproject_add(${project_name}_build SOURCE_DIR ${source_dir} BINARY_DIR ${build_dir} CONFIGURE_COMMAND ${CMAKE_COMMAND} - -P ${CMAKE_CURRENT_BINARY_DIR}/config_mingw.cmake + -P ${build_dir}/config_mingw.cmake BUILD_COMMAND ${CMAKE_COMMAND} - -P ${CMAKE_CURRENT_BINARY_DIR}/build_mingw.cmake + -P ${build_dir}/build_mingw.cmake INSTALL_COMMAND "" ) # make the external project always run make with each build 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/CMakeExpandImportedTargets.cmake b/Modules/CMakeExpandImportedTargets.cmake new file mode 100644 index 0000000..fba071a --- /dev/null +++ b/Modules/CMakeExpandImportedTargets.cmake @@ -0,0 +1,129 @@ +# CMAKE_EXPAND_IMPORTED_TARGETS(<var> LIBRARIES lib1 lib2...libN +# [CONFIGURATION <config>] ) +# +# CMAKE_EXPAND_IMPORTED_TARGETS() takes a list of libraries and replaces +# all imported targets contained in this list with their actual file paths +# of the referenced libraries on disk, including the libraries from their +# link interfaces. +# If a CONFIGURATION is given, it uses the respective configuration of the +# imported targets if it exists. If no CONFIGURATION is given, it uses +# the first configuration from ${CMAKE_CONFIGURATION_TYPES} if set, otherwise +# ${CMAKE_BUILD_TYPE}. +# This macro is used by all Check*.cmake files which use +# TRY_COMPILE() or TRY_RUN() and support CMAKE_REQUIRED_LIBRARIES , so that +# these checks support imported targets in CMAKE_REQUIRED_LIBRARIES: +# cmake_expand_imported_targets(expandedLibs LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} +# CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}" ) + + +#============================================================================= +# Copyright 2012 Kitware, Inc. +# Copyright 2009-2012 Alexander Neundorf <neundorf@kde.org> +# +# 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.) + +include(CMakeParseArguments) + +function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT ) + + set(options ) + set(oneValueArgs CONFIGURATION ) + set(multiValueArgs LIBRARIES ) + + cmake_parse_arguments(CEIT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(CEIT_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unknown keywords given to CMAKE_EXPAND_IMPORTED_TARGETS(): \"${CEIT_UNPARSED_ARGUMENTS}\"") + endif() + + if(NOT CEIT_CONFIGURATION) + if(CMAKE_CONFIGURATION_TYPES) + list(GET CMAKE_CONFIGURATION_TYPES 0 CEIT_CONFIGURATION) + else() + set(CEIT_CONFIGURATION ${CMAKE_BUILD_TYPE}) + endif() + endif() + + # handle imported library targets + + set(_CCSR_REQ_LIBS ${CEIT_LIBRARIES}) + + set(_CHECK_FOR_IMPORTED_TARGETS TRUE) + set(_CCSR_LOOP_COUNTER 0) + while(_CHECK_FOR_IMPORTED_TARGETS) + math(EXPR _CCSR_LOOP_COUNTER "${_CCSR_LOOP_COUNTER} + 1 ") + set(_CCSR_NEW_REQ_LIBS ) + set(_CHECK_FOR_IMPORTED_TARGETS FALSE) + foreach(_CURRENT_LIB ${_CCSR_REQ_LIBS}) + get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS) + if (_importedConfigs) +# message(STATUS "Detected imported target ${_CURRENT_LIB}") + # Ok, so this is an imported target. + # First we get the imported configurations. + # Then we get the location of the actual library on disk of the first configuration. + # then we'll get its link interface libraries property, + # iterate through it and replace all imported targets we find there + # with there actual location. + + # guard against infinite loop: abort after 100 iterations ( 100 is arbitrary chosen) + if ("${_CCSR_LOOP_COUNTER}" LESS 100) + set(_CHECK_FOR_IMPORTED_TARGETS TRUE) +# else ("${_CCSR_LOOP_COUNTER}" LESS 1) +# message(STATUS "********* aborting loop, counter : ${_CCSR_LOOP_COUNTER}") + endif ("${_CCSR_LOOP_COUNTER}" LESS 100) + + # if one of the imported configurations equals ${CMAKE_TRY_COMPILE_CONFIGURATION}, + # use it, otherwise simply use the first one: + list(FIND _importedConfigs "${CEIT_CONFIGURATION}" _configIndexToUse) + if("${_configIndexToUse}" EQUAL -1) + set(_configIndexToUse 0) + endif("${_configIndexToUse}" EQUAL -1) + list(GET _importedConfigs ${_configIndexToUse} _importedConfigToUse) + + get_target_property(_importedLocation "${_CURRENT_LIB}" IMPORTED_LOCATION_${_importedConfigToUse}) + get_target_property(_linkInterfaceLibs "${_CURRENT_LIB}" IMPORTED_LINK_INTERFACE_LIBRARIES_${_importedConfigToUse} ) + + list(APPEND _CCSR_NEW_REQ_LIBS "${_importedLocation}") +# message(STATUS "Appending lib ${_CURRENT_LIB} as ${_importedLocation}") + if(_linkInterfaceLibs) + foreach(_currentLinkInterfaceLib ${_linkInterfaceLibs}) +# message(STATUS "Appending link interface lib ${_currentLinkInterfaceLib}") + if(_currentLinkInterfaceLib) + list(APPEND _CCSR_NEW_REQ_LIBS "${_currentLinkInterfaceLib}" ) + endif(_currentLinkInterfaceLib) + endforeach(_currentLinkInterfaceLib "${_linkInterfaceLibs}") + endif(_linkInterfaceLibs) + else(_importedConfigs) + # "Normal" libraries are just used as they are. + list(APPEND _CCSR_NEW_REQ_LIBS "${_CURRENT_LIB}" ) +# message(STATUS "Appending lib directly: ${_CURRENT_LIB}") + endif(_importedConfigs) + endforeach(_CURRENT_LIB ${_CCSR_REQ_LIBS}) + + set(_CCSR_REQ_LIBS ${_CCSR_NEW_REQ_LIBS} ) + endwhile(_CHECK_FOR_IMPORTED_TARGETS) + + # Finally we iterate once more over all libraries. This loop only removes + # all remaining imported target names (there shouldn't be any left anyway). + set(_CCSR_NEW_REQ_LIBS ) + foreach(_CURRENT_LIB ${_CCSR_REQ_LIBS}) + get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS) + if (NOT _importedConfigs) + list(APPEND _CCSR_NEW_REQ_LIBS "${_CURRENT_LIB}" ) +# message(STATUS "final: appending ${_CURRENT_LIB}") + else (NOT _importedConfigs) +# message(STATUS "final: skipping ${_CURRENT_LIB}") + endif (NOT _importedConfigs) + endforeach(_CURRENT_LIB ${_CCSR_REQ_LIBS}) +# message(STATUS "setting -${_RESULT}- to -${_CCSR_NEW_REQ_LIBS}-") + set(${_RESULT} "${_CCSR_NEW_REQ_LIBS}" PARENT_SCOPE) + +endfunction() 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 8a44991..b506711 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -53,231 +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.* -##end -# -# The following variables are specific to the DragNDrop installers -# built on Mac OS X: -# -# CPACK_DMG_VOLUME_NAME - The volume name of the generated disk -# image. Defaults to CPACK_PACKAGE_FILE_NAME. -# -# 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_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_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_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_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_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.) -# -# The following variable is specific to installers build on Mac OS X -# using PackageMaker: -# -# 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_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 # @@ -413,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 3ac4ea8..0da51e3 100644 --- a/Modules/CPackBundle.cmake +++ b/Modules/CPackBundle.cmake @@ -1,25 +1,36 @@ +##section Variables specific to CPack Bundle generator +##end +##module # - 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 # -# CPACK_BUNDLE_NAME - The name of the generated bundle. This -# appears in the OSX finder as the bundle name. Required. +##variable +# CPACK_BUNDLE_NAME - The name of the generated bundle. This +# appears in the OSX finder as the bundle name. Required. +##end # -# 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. +##variable +# 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 # -# 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. +##variable +# 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 # -# 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. +##variable +# 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 #============================================================================= # Copyright 2006-2009 Kitware, Inc. diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake index 016cb8c..1598703 100644 --- a/Modules/CPackComponent.cmake +++ b/Modules/CPackComponent.cmake @@ -1,4 +1,4 @@ -##section Variables common to all CPack generators +##section Variables concerning CPack Components ##end ##module # - Build binary and source package installers @@ -25,6 +25,51 @@ # CPack commands: ##end # +##variable +# CPACK_COMPONENTS_ALL - The list of component to install. +# +# The default value of this variable is computed by CPack +# and contains all components defined by the project. The +# user may set it to only include the specified components. +##end +# +##variable +# CPACK_<GENNAME>_COMPONENT_INSTALL - Enable/Disable component install for +# CPack generator <GENNAME>. +# +# Each CPack Generator (RPM, DEB, ARCHIVE, NSIS, DMG, etc...) has a legacy +# default behavior. e.g. RPM builds monolithic whereas NSIS builds component. +# One can change the default behavior by setting this variable to 0/1 or OFF/ON. +##end +##variable +# CPACK_COMPONENTS_GROUPING - Specify how components are grouped for multi-package +# component-aware CPack generators. +# +# Some generators like RPM or ARCHIVE family (TGZ, ZIP, ...) generates several +# packages files when asked for component packaging. They group the component +# differently depending on the value of this variable: +# - ONE_PER_GROUP (default): creates one package file per component group +# - ALL_COMPONENTS_IN_ONE : creates a single package with all (requested) component +# - IGNORE : creates one package per component, i.e. IGNORE component group +# One can specify different grouping for different CPack generator by using +# a CPACK_PROJECT_CONFIG_FILE. +##end +##variable +# CPACK_COMPONENT_<compName>_DISPLAY_NAME - The name to be displayed for a component. +##end +##variable +# CPACK_COMPONENT_<compName>_DESCRIPTION - The description of a component. +##end +##variable +# CPACK_COMPONENT_<compName>_GROUP - The group of a component. +##end +##variable +# CPACK_COMPONENT_<compName>_DEPENDS - The dependencies (list of components) +# on which this component depends. +##end +##variable +# CPACK_COMPONENT_<compName>_REQUIRED - True is this component is required. +##end ##macro # cpack_add_component - Describes a CPack installation component # named by the COMPONENT argument to a CMake INSTALL command. 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 new file mode 100644 index 0000000..e866bab --- /dev/null +++ b/Modules/CPackDMG.cmake @@ -0,0 +1,70 @@ +##section Variables specific to CPack DragNDrop generator +##end +##module +# - DragNDrop CPack generator (Mac OS X). +# The following variables are specific to the DragNDrop installers +# built on Mac OS X: +##end +# +##variable +# 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. +##end +# +##variable +# 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 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.) +##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.) +##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.) +##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/CPackDeb.cmake b/Modules/CPackDeb.cmake index 0916843..fe81dc9 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -1,4 +1,4 @@ -##section Variables specific to a CPack generator +##section Variables specific to CPack Debian (DEB) generator ##end ##module # - The builtin (binary) CPack Deb generator (Unix only) diff --git a/Modules/CPackNSIS.cmake b/Modules/CPackNSIS.cmake index d9dab53..97179d7 100644 --- a/Modules/CPackNSIS.cmake +++ b/Modules/CPackNSIS.cmake @@ -1,70 +1,112 @@ +##section Variables specific to CPack NSIS generator +##end +##module # - CPack NSIS generator specific options # # The following variables are specific to the graphical installers built # on Windows using the Nullsoft Installation System. +##end # +##variable # CPACK_PACKAGE_INSTALL_REGISTRY_KEY - Registry key used when # installing this project. +##end # +##variable # CPACK_NSIS_INSTALL_ROOT - The default installation directory presented # to the end user by the NSIS installer is under this root dir. The full # directory presented to the end user is: # ${CPACK_NSIS_INSTALL_ROOT}/${CPACK_PACKAGE_INSTALL_DIRECTORY} +##end # +##variable # CPACK_NSIS_MUI_ICON - The icon file (.ico) for the generated # install program. +##end # +##variable # CPACK_NSIS_MUI_UNIICON - The icon file (.ico) for the generated # uninstall program. +##end # +##variable # CPACK_PACKAGE_ICON - A branding image that will be displayed inside # the installer. +##end # +##variable # CPACK_NSIS_EXTRA_INSTALL_COMMANDS - Extra NSIS commands that will # be added to the install Section. +##end # +##variable # CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS - Extra NSIS commands that will # be added to the uninstall Section. +##end # +##variable # CPACK_NSIS_COMPRESSOR - The arguments that will be passed to the # NSIS SetCompressor command. +##end # +##variable # CPACK_NSIS_MODIFY_PATH - If this is set to "ON", then an extra page # will appear in the installer that will allow the user to choose # whether the program directory should be added to the system PATH # variable. +##end # +##variable # CPACK_NSIS_DISPLAY_NAME - The display name string that appears in # the Windows Add/Remove Program control panel +##end # +##variable # CPACK_NSIS_PACKAGE_NAME - The title displayed at the top of the # installer. +##end # +##variable # CPACK_NSIS_INSTALLED_ICON_NAME - A path to the executable that # contains the installer icon. +##end # +##variable # CPACK_NSIS_HELP_LINK - URL to a web site providing assistance in # installing your application. +##end # +##variable # CPACK_NSIS_URL_INFO_ABOUT - URL to a web site providing more # information about your application. +##end # +##variable # CPACK_NSIS_CONTACT - Contact information for questions and comments # about the installation process. +##end # +##variable # CPACK_NSIS_CREATE_ICONS_EXTRA - Additional NSIS commands for # creating start menu shortcuts. +##end # +##variable # CPACK_NSIS_DELETE_ICONS_EXTRA -Additional NSIS commands to # uninstall start menu shortcuts. +##end # +##variable # CPACK_NSIS_EXECUTABLES_DIRECTORY - Creating NSIS start menu links # assumes that they are in 'bin' unless this variable is set. # For example, you would set this to 'exec' if your executables are # in an exec directory. +##end # +##variable # CPACK_NSIS_MUI_FINISHPAGE_RUN - Specify an executable to add an option # to run on the finish page of the NSIS installer. +##end #============================================================================= # Copyright 2006-2009 Kitware, Inc. diff --git a/Modules/CPackPackageMaker.cmake b/Modules/CPackPackageMaker.cmake new file mode 100644 index 0000000..45ba465 --- /dev/null +++ b/Modules/CPackPackageMaker.cmake @@ -0,0 +1,35 @@ +##section Variables specific to CPack PackageMaker generator +##end +##module +# - 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. +##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/CPackRPM.cmake b/Modules/CPackRPM.cmake index f76e91e..442d7c4 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -1,4 +1,4 @@ -##section Variables specific to a CPack generator +##section Variables specific to CPack RPM generator ##end ##module # - The builtin (binary) CPack RPM generator (Unix only) @@ -183,7 +183,7 @@ # The refered script file(s) will be read and directly # put after the %pre or %preun section # If CPACK_RPM_COMPONENT_INSTALL is set to ON the (un)install script for -# each component can be overriden with +# each component can be overridden with # CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE and # CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE # One may verify which scriptlet has been included with @@ -198,7 +198,7 @@ # The refered script file(s) will be read and directly # put after the %post or %postun section # If CPACK_RPM_COMPONENT_INSTALL is set to ON the (un)install script for -# each component can be overriden with +# each component can be overridden with # CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE and # CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE # One may verify which scriptlet has been included with @@ -209,7 +209,7 @@ # CPACK_RPM_<COMPONENT>_USER_FILELIST # Mandatory : NO # Default : - -# May be used to explicitely specify %(<directive>) file line +# May be used to explicitly specify %(<directive>) file line # in the spec file. Like %config(noreplace) or any other directive # that be found in the %files section. Since CPackRPM is generating # the list of files (and directories) the user specified files of 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/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake index d59fe55..2669336 100644 --- a/Modules/CheckCSourceCompiles.cmake +++ b/Modules/CheckCSourceCompiles.cmake @@ -24,6 +24,9 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") + + MACRO(CHECK_C_SOURCE_COMPILES SOURCE VAR) IF("${VAR}" MATCHES "^${VAR}$") SET(_FAIL_REGEX) @@ -40,8 +43,10 @@ MACRO(CHECK_C_SOURCE_COMPILES SOURCE VAR) SET(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") IF(CMAKE_REQUIRED_LIBRARIES) + # this one translates potentially used imported library targets to their files on disk + CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") ELSE(CMAKE_REQUIRED_LIBRARIES) SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) ENDIF(CMAKE_REQUIRED_LIBRARIES) diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake index 764c756..feee93a 100644 --- a/Modules/CheckCSourceRuns.cmake +++ b/Modules/CheckCSourceRuns.cmake @@ -24,13 +24,18 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") + + MACRO(CHECK_C_SOURCE_RUNS SOURCE VAR) IF("${VAR}" MATCHES "^${VAR}$") - SET(MACRO_CHECK_FUNCTION_DEFINITIONS + SET(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") IF(CMAKE_REQUIRED_LIBRARIES) + # this one translates potentially used imported library targets to their files on disk + CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") ELSE(CMAKE_REQUIRED_LIBRARIES) SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) ENDIF(CMAKE_REQUIRED_LIBRARIES) @@ -61,7 +66,7 @@ MACRO(CHECK_C_SOURCE_RUNS SOURCE VAR) IF("${${VAR}_EXITCODE}" EQUAL 0) SET(${VAR} 1 CACHE INTERNAL "Test ${VAR}") MESSAGE(STATUS "Performing Test ${VAR} - Success") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n" "${OUTPUT}\n" "Return value: ${${VAR}}\n" @@ -74,7 +79,7 @@ MACRO(CHECK_C_SOURCE_RUNS SOURCE VAR) ENDIF(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN") MESSAGE(STATUS "Performing Test ${VAR} - Failed") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing C SOURCE FILE Test ${VAR} failed with the following output:\n" "${OUTPUT}\n" "Return value: ${${VAR}_EXITCODE}\n" 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/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake index 0491b37..7f7336e 100644 --- a/Modules/CheckCXXSourceCompiles.cmake +++ b/Modules/CheckCXXSourceCompiles.cmake @@ -24,6 +24,9 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") + + MACRO(CHECK_CXX_SOURCE_COMPILES SOURCE VAR) IF("${VAR}" MATCHES "^${VAR}$") SET(_FAIL_REGEX) @@ -41,8 +44,10 @@ MACRO(CHECK_CXX_SOURCE_COMPILES SOURCE VAR) SET(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") IF(CMAKE_REQUIRED_LIBRARIES) + # this one translates potentially used imported library targets to their files on disk + CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") ELSE(CMAKE_REQUIRED_LIBRARIES) SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES) ENDIF(CMAKE_REQUIRED_LIBRARIES) diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake index ace60d1..cd68d57 100644 --- a/Modules/CheckCXXSourceRuns.cmake +++ b/Modules/CheckCXXSourceRuns.cmake @@ -24,13 +24,18 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") + + MACRO(CHECK_CXX_SOURCE_RUNS SOURCE VAR) IF("${VAR}" MATCHES "^${VAR}$") - SET(MACRO_CHECK_FUNCTION_DEFINITIONS + SET(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") IF(CMAKE_REQUIRED_LIBRARIES) + # this one translates potentially used imported library targets to their files on disk + CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") ELSE(CMAKE_REQUIRED_LIBRARIES) SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES) ENDIF(CMAKE_REQUIRED_LIBRARIES) @@ -62,9 +67,9 @@ MACRO(CHECK_CXX_SOURCE_RUNS SOURCE VAR) IF("${${VAR}_EXITCODE}" EQUAL 0) SET(${VAR} 1 CACHE INTERNAL "Test ${VAR}") MESSAGE(STATUS "Performing Test ${VAR} - Success") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n" - "${OUTPUT}\n" + "${OUTPUT}\n" "Return value: ${${VAR}}\n" "Source file was:\n${SOURCE}\n") ELSE("${${VAR}_EXITCODE}" EQUAL 0) @@ -75,9 +80,9 @@ MACRO(CHECK_CXX_SOURCE_RUNS SOURCE VAR) ENDIF(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN") MESSAGE(STATUS "Performing Test ${VAR} - Failed") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n" - "${OUTPUT}\n" + "${OUTPUT}\n" "Return value: ${${VAR}_EXITCODE}\n" "Source file was:\n${SOURCE}\n") ENDIF("${${VAR}_EXITCODE}" EQUAL 0) diff --git a/Modules/CheckFortranFunctionExists.cmake b/Modules/CheckFortranFunctionExists.cmake index 6e932d0..abec9f7 100644 --- a/Modules/CheckFortranFunctionExists.cmake +++ b/Modules/CheckFortranFunctionExists.cmake @@ -22,12 +22,17 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") + + macro(CHECK_FORTRAN_FUNCTION_EXISTS FUNCTION VARIABLE) if(NOT DEFINED ${VARIABLE}) message(STATUS "Looking for Fortran ${FUNCTION}") if(CMAKE_REQUIRED_LIBRARIES) + # this one translates potentially used imported library targets to their files on disk + cmake_expand_imported_targets(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") else(CMAKE_REQUIRED_LIBRARIES) set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) endif(CMAKE_REQUIRED_LIBRARIES) @@ -50,13 +55,13 @@ macro(CHECK_FORTRAN_FUNCTION_EXISTS FUNCTION VARIABLE) if(${VARIABLE}) set(${VARIABLE} 1 CACHE INTERNAL "Have Fortran function ${FUNCTION}") message(STATUS "Looking for Fortran ${FUNCTION} - found") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the Fortran ${FUNCTION} exists passed with the following output:\n" "${OUTPUT}\n\n") else(${VARIABLE}) message(STATUS "Looking for Fortran ${FUNCTION} - not found") set(${VARIABLE} "" CACHE INTERNAL "Have Fortran function ${FUNCTION}") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the Fortran ${FUNCTION} exists failed with the following output:\n" "${OUTPUT}\n\n") endif(${VARIABLE}) diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake index 0ba36d9..8c469f0 100644 --- a/Modules/CheckFunctionExists.cmake +++ b/Modules/CheckFunctionExists.cmake @@ -27,14 +27,19 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") + + MACRO(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) IF("${VARIABLE}" MATCHES "^${VARIABLE}$") - SET(MACRO_CHECK_FUNCTION_DEFINITIONS + SET(MACRO_CHECK_FUNCTION_DEFINITIONS "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}") MESSAGE(STATUS "Looking for ${FUNCTION}") IF(CMAKE_REQUIRED_LIBRARIES) + # this one translates potentially used imported library targets to their files on disk + CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") SET(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") ELSE(CMAKE_REQUIRED_LIBRARIES) SET(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) ENDIF(CMAKE_REQUIRED_LIBRARIES) @@ -55,13 +60,13 @@ MACRO(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) IF(${VARIABLE}) SET(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}") MESSAGE(STATUS "Looking for ${FUNCTION} - found") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the function ${FUNCTION} exists passed with the following output:\n" "${OUTPUT}\n\n") ELSE(${VARIABLE}) MESSAGE(STATUS "Looking for ${FUNCTION} - not found") SET(${VARIABLE} "" CACHE INTERNAL "Have function ${FUNCTION}") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the function ${FUNCTION} exists failed with the following output:\n" "${OUTPUT}\n\n") ENDIF(${VARIABLE}) diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake index caf4f4c..59fca0a 100644 --- a/Modules/CheckLibraryExists.cmake +++ b/Modules/CheckLibraryExists.cmake @@ -26,21 +26,26 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") + + MACRO(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE) IF("${VARIABLE}" MATCHES "^${VARIABLE}$") - SET(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION + SET(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}") MESSAGE(STATUS "Looking for ${FUNCTION} in ${LIBRARY}") SET(CHECK_LIBRARY_EXISTS_LIBRARIES ${LIBRARY}) IF(CMAKE_REQUIRED_LIBRARIES) - SET(CHECK_LIBRARY_EXISTS_LIBRARIES - ${CHECK_LIBRARY_EXISTS_LIBRARIES} ${CMAKE_REQUIRED_LIBRARIES}) + # this one translates potentially used imported library targets to their files on disk + CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") + SET(CHECK_LIBRARY_EXISTS_LIBRARIES + ${CHECK_LIBRARY_EXISTS_LIBRARIES} ${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}) ENDIF(CMAKE_REQUIRED_LIBRARIES) TRY_COMPILE(${VARIABLE} ${CMAKE_BINARY_DIR} ${CMAKE_ROOT}/Modules/CheckFunctionExists.c COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} - CMAKE_FLAGS + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_LIBRARY_EXISTS_DEFINITION} -DLINK_DIRECTORIES:STRING=${LOCATION} "-DLINK_LIBRARIES:STRING=${CHECK_LIBRARY_EXISTS_LIBRARIES}" @@ -49,14 +54,14 @@ MACRO(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE) IF(${VARIABLE}) MESSAGE(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - found") SET(${VARIABLE} 1 CACHE INTERNAL "Have library ${LIBRARY}") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the function ${FUNCTION} exists in the ${LIBRARY} " "passed with the following output:\n" "${OUTPUT}\n\n") ELSE(${VARIABLE}) MESSAGE(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - not found") SET(${VARIABLE} "" CACHE INTERNAL "Have library ${LIBRARY}") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the function ${FUNCTION} exists in the ${LIBRARY} " "failed with the following output:\n" "${OUTPUT}\n\n") diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake index 244b9b5..63d4242 100644 --- a/Modules/CheckPrototypeDefinition.cmake +++ b/Modules/CheckPrototypeDefinition.cmake @@ -34,8 +34,11 @@ # License text for the above reference.) # +include("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") + get_filename_component(__check_proto_def_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) + function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIABLE) if ("${_VARIABLE}" MATCHES "^${_VARIABLE}$") @@ -43,8 +46,10 @@ function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIAB set(CHECK_PROTOTYPE_DEFINITION_FLAGS ${CMAKE_REQUIRED_FLAGS}) if (CMAKE_REQUIRED_LIBRARIES) + # this one translates potentially used imported library targets to their files on disk + cmake_expand_imported_targets(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") set(CHECK_PROTOTYPE_DEFINITION_LIBS - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") else(CMAKE_REQUIRED_LIBRARIES) set(CHECK_PROTOTYPE_DEFINITION_LIBS) endif(CMAKE_REQUIRED_LIBRARIES) diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake index 515319d..e6e677d 100644 --- a/Modules/CheckSymbolExists.cmake +++ b/Modules/CheckSymbolExists.cmake @@ -35,6 +35,9 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") + + MACRO(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE) _CHECK_SYMBOL_EXISTS("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c" "${SYMBOL}" "${FILES}" "${VARIABLE}" ) ENDMACRO(CHECK_SYMBOL_EXISTS) @@ -44,8 +47,10 @@ MACRO(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE) SET(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n") SET(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS}) IF(CMAKE_REQUIRED_LIBRARIES) + # this one translates potentially used imported library targets to their files on disk + CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") SET(CHECK_SYMBOL_EXISTS_LIBS - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") ELSE(CMAKE_REQUIRED_LIBRARIES) SET(CHECK_SYMBOL_EXISTS_LIBS) ENDIF(CMAKE_REQUIRED_LIBRARIES) diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake index 5d5c931..1717718 100644 --- a/Modules/CheckTypeSize.cmake +++ b/Modules/CheckTypeSize.cmake @@ -47,6 +47,7 @@ # License text for the above reference.) include(CheckIncludeFile) +include("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") cmake_policy(PUSH) cmake_minimum_required(VERSION 2.6 FATAL_ERROR) @@ -76,6 +77,10 @@ function(__check_type_size_impl type var map builtin) endforeach() # Perform the check. + + # this one translates potentially used imported library targets to their files on disk + cmake_expand_imported_targets(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") + set(src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${var}.c) set(bin ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${var}.bin) configure_file(${__check_type_size_dir}/CheckTypeSize.c.in ${src} @ONLY) @@ -84,7 +89,7 @@ function(__check_type_size_impl type var map builtin) CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${CMAKE_REQUIRED_FLAGS}" "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}" - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}" + "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}" OUTPUT_VARIABLE output COPY_FILE ${bin} ) diff --git a/Modules/CheckVariableExists.cmake b/Modules/CheckVariableExists.cmake index 9832891..7d6c794 100644 --- a/Modules/CheckVariableExists.cmake +++ b/Modules/CheckVariableExists.cmake @@ -1,6 +1,6 @@ # - Check if the variable exists. # CHECK_VARIABLE_EXISTS(VAR VARIABLE) -# +# # VAR - the name of the variable # VARIABLE - variable to store the result # @@ -26,14 +26,19 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") + + MACRO(CHECK_VARIABLE_EXISTS VAR VARIABLE) IF("${VARIABLE}" MATCHES "^${VARIABLE}$") - SET(MACRO_CHECK_VARIABLE_DEFINITIONS + SET(MACRO_CHECK_VARIABLE_DEFINITIONS "-DCHECK_VARIABLE_EXISTS=${VAR} ${CMAKE_REQUIRED_FLAGS}") MESSAGE(STATUS "Looking for ${VAR}") IF(CMAKE_REQUIRED_LIBRARIES) + # this one translates potentially used imported library targets to their files on disk + CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") SET(CHECK_VARIABLE_EXISTS_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") ELSE(CMAKE_REQUIRED_LIBRARIES) SET(CHECK_VARIABLE_EXISTS_ADD_LIBRARIES) ENDIF(CMAKE_REQUIRED_LIBRARIES) @@ -47,13 +52,13 @@ MACRO(CHECK_VARIABLE_EXISTS VAR VARIABLE) IF(${VARIABLE}) SET(${VARIABLE} 1 CACHE INTERNAL "Have variable ${VAR}") MESSAGE(STATUS "Looking for ${VAR} - found") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the variable ${VAR} exists passed with the following output:\n" "${OUTPUT}\n\n") ELSE(${VARIABLE}) SET(${VARIABLE} "" CACHE INTERNAL "Have variable ${VAR}") MESSAGE(STATUS "Looking for ${VAR} - not found") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the variable ${VAR} exists failed with the following output:\n" "${OUTPUT}\n\n") ENDIF(${VARIABLE}) diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake index eb10cbc..cef647e 100644 --- a/Modules/FeatureSummary.cmake +++ b/Modules/FeatureSummary.cmake @@ -125,7 +125,7 @@ # # set_package_properties(LibXml2 PROPERTIES TYPE RECOMMENDED # PURPOSE "Enables HTML-import in MyWordProcessor") -# ... +# ... # set_package_properties(LibXml2 PROPERTIES TYPE OPTIONAL # PURPOSE "Enables odt-export in MyWordProcessor") # diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 9b76d90..9eadfd1 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -23,6 +23,7 @@ ########## ### List of vendors (BLA_VENDOR) valid in this module ## Goto,ATLAS PhiPACK,CXML,DXML,SunPerf,SCSL,SGIMATH,IBMESSL,Intel10_32 (intel mkl v10 32 bit),Intel10_64lp (intel mkl v10 64 bit,lp thread model, lp64 model), +## Intel10_64lp_seq (intel mkl v10 64 bit,sequential code, lp64 model), ## Intel( older versions of mkl 32 and 64 bit), ACML,ACML_MP,ACML_GPU,Apple, NAS, Generic # C/CXX should be enabled to use Intel mkl @@ -85,6 +86,7 @@ if (NOT _libdir) set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH) endif () endif () + foreach(_library ${_list}) set(_combined_name ${_combined_name}_${_library}) @@ -115,7 +117,7 @@ foreach(_library ${_list}) endforeach(_library ${_list}) if(_libraries_work) # Test this combination of libraries. - set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_threads}) + set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_thread}) # message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") if (_CHECK_FORTRAN) check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) @@ -460,117 +462,99 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") else(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) find_package(Threads REQUIRED) endif(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) - if (WIN32) + + set(BLAS_SEARCH_LIBS "") + if(BLA_F95) - if(NOT BLAS95_LIBRARIES) - check_fortran_libraries( - BLAS95_LIBRARIES - BLAS - sgemm - "" - "mkl_blas95;mkl_intel_c;mkl_intel_thread;mkl_core;libguide40" - "" - ) - endif(NOT BLAS95_LIBRARIES) - else(BLA_F95) - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - SGEMM - "" - "mkl_c_dll;mkl_intel_thread_dll;mkl_core_dll;libguide40" - "" - ) - endif(NOT BLAS_LIBRARIES) - endif(BLA_F95) - else(WIN32) - if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") - if(BLA_F95) - if(NOT BLAS95_LIBRARIES) - check_fortran_libraries( - BLAS95_LIBRARIES - BLAS - sgemm - "" - "mkl_blas95;mkl_intel;mkl_intel_thread;mkl_core;guide" - "${CMAKE_THREAD_LIBS_INIT};${LM}" - ) - endif(NOT BLAS95_LIBRARIES) - else(BLA_F95) - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "mkl_intel;mkl_intel_thread;mkl_core;guide" - "${CMAKE_THREAD_LIBS_INIT}" - "${LM}" - ) - endif(NOT BLAS_LIBRARIES) - endif(BLA_F95) - endif (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") - if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All") - if(BLA_F95) - if(NOT BLAS95_LIBRARIES) - check_fortran_libraries( - BLAS95_LIBRARIES - BLAS - sgemm - "" - "mkl_blas95;mkl_intel_lp64;mkl_intel_thread;mkl_core;guide" - "${CMAKE_THREAD_LIBS_INIT};${LM}" - ) - endif(NOT BLAS95_LIBRARIES) - else(BLA_F95) - if(NOT BLAS_LIBRARIES) + set(BLAS_mkl_SEARCH_SYMBOL SGEMM) + set(_LIBRARIES BLAS95_LIBRARIES) + if (WIN32) + list(APPEND BLAS_SEARCH_LIBS + "mkl_blas95 mkl_intel_c mkl_intel_thread mkl_core libguide40") + else (WIN32) + if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS + "mkl_blas95 mkl_intel mkl_intel_thread mkl_core guide") + endif () + if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All") + # old version + list(APPEND BLAS_SEARCH_LIBS + "mkl_blas95 mkl_intel_lp64 mkl_intel_thread mkl_core guide") + + # mkl >= 10.3 + if (CMAKE_C_COMPILER MATCHES ".+gcc.*") + list(APPEND BLAS_SEARCH_LIBS + "mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core") + set(LM "${LM};-lgomp") + else () + list(APPEND BLAS_SEARCH_LIBS + "mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core iomp5") + endif () + endif () + endif (WIN32) + if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS + "mkl_blas95_lp64 mkl_intel_lp64 mkl_sequential mkl_core") + endif () + else (BLA_F95) + set(BLAS_mkl_SEARCH_SYMBOL sgemm) + set(_LIBRARIES BLAS_LIBRARIES) + if (WIN32) + list(APPEND BLAS_SEARCH_LIBS + "mkl_c_dll mkl_intel_thread_dll mkl_core_dll libguide40") + else (WIN32) + if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS + "mkl_intel mkl_intel_thread mkl_core guide") + endif () + if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All") + + # old version + list(APPEND BLAS_SEARCH_LIBS + "mkl_intel_lp64 mkl_intel_thread mkl_core guide") + + # mkl >= 10.3 + if (CMAKE_C_COMPILER MATCHES ".+gcc.*") + list(APPEND BLAS_SEARCH_LIBS + "mkl_intel_lp64 mkl_gnu_thread mkl_core") + set(LM "${LM};-lgomp") + else () + list(APPEND BLAS_SEARCH_LIBS + "mkl_intel_lp64 mkl_intel_thread mkl_core iomp5") + endif () + endif () + + #older vesions of intel mkl libs + if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS + "mkl") + list(APPEND BLAS_SEARCH_LIBS + "mkl_ia32") + list(APPEND BLAS_SEARCH_LIBS + "mkl_em64t") + endif () + endif (WIN32) + if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS + "mkl_intel_lp64 mkl_sequential mkl_core") + endif () + endif (BLA_F95) + + foreach (IT ${BLAS_SEARCH_LIBS}) + string(REPLACE " " ";" SEARCH_LIBS ${IT}) + if (${_LIBRARIES}) + else () check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "mkl_intel_lp64;mkl_intel_thread;mkl_core;guide" - "${CMAKE_THREAD_LIBS_INIT};${LM}" - ) - endif(NOT BLAS_LIBRARIES) - endif(BLA_F95) - endif (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All") - endif (WIN32) - #older vesions of intel mkl libs - # BLAS in intel mkl library? (shared) - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "mkl;guide" - "${CMAKE_THREAD_LIBS_INIT};${LM}" - ) - endif(NOT BLAS_LIBRARIES) - #BLAS in intel mkl library? (static, 32bit) - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "mkl_ia32;guide" - "${CMAKE_THREAD_LIBS_INIT};${LM}" - ) - endif(NOT BLAS_LIBRARIES) - #BLAS in intel mkl library? (static, em64t 64bit) - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "mkl_em64t;guide" - "${CMAKE_THREAD_LIBS_INIT};${LM}" - ) - endif(NOT BLAS_LIBRARIES) + ${_LIBRARIES} + BLAS + ${BLAS_mkl_SEARCH_SYMBOL} + "" + "${SEARCH_LIBS}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" + ) + endif () + endforeach () + endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) endif (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 4d91a92..9f8d575 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -906,7 +906,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) message( FATAL_ERROR "Invalid format flag passed to CUDA_WRAP_SRCS: '${format}'. Use OBJ or PTX.") endif() - # Set up all the command line flags here, so that they can be overriden on a per target basis. + # Set up all the command line flags here, so that they can be overridden on a per target basis. set(nvcc_flags "") diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake index 6251805..e6f6702 100644 --- a/Modules/FindFreetype.cmake +++ b/Modules/FindFreetype.cmake @@ -3,6 +3,7 @@ # FREETYPE_LIBRARIES, the library to link against # FREETYPE_FOUND, if false, do not try to link to FREETYPE # FREETYPE_INCLUDE_DIRS, where to find headers. +# FREETYPE_VERSION_STRING, the version of freetype found (since CMake 2.8.8) # This is the concatenation of the paths: # FREETYPE_INCLUDE_DIR_ft2build # FREETYPE_INCLUDE_DIR_freetype2 @@ -77,10 +78,33 @@ IF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2) ENDIF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2) SET(FREETYPE_LIBRARIES "${FREETYPE_LIBRARY}") +IF(FREETYPE_INCLUDE_DIR_freetype2 AND EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h") + FILE(STRINGS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h" freetype_version_str + REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$") + + UNSET(FREETYPE_VERSION_STRING) + FOREACH(VPART MAJOR MINOR PATCH) + FOREACH(VLINE ${freetype_version_str}) + IF(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}") + STRING(REGEX REPLACE "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$" "\\1" + FREETYPE_VERSION_PART "${VLINE}") + IF(FREETYPE_VERSION_STRING) + SET(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_STRING}.${FREETYPE_VERSION_PART}") + ELSE(FREETYPE_VERSION_STRING) + SET(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_PART}") + ENDIF(FREETYPE_VERSION_STRING) + UNSET(FREETYPE_VERSION_PART) + ENDIF() + ENDFOREACH(VLINE) + ENDFOREACH(VPART) +ENDIF(FREETYPE_INCLUDE_DIR_freetype2 AND EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h") + + # handle the QUIETLY and REQUIRED arguments and set FREETYPE_FOUND to TRUE if # all listed variables are TRUE INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Freetype DEFAULT_MSG FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS) - +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Freetype + REQUIRED_VARS FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS + VERSION_VAR FREETYPE_VERSION_STRING) MARK_AS_ADVANCED(FREETYPE_LIBRARY FREETYPE_INCLUDE_DIR_freetype2 FREETYPE_INCLUDE_DIR_ft2build) diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake index af88997..8205779 100644 --- a/Modules/FindGLUT.cmake +++ b/Modules/FindGLUT.cmake @@ -64,25 +64,23 @@ ELSE (WIN32) ENDIF (WIN32) -SET( GLUT_FOUND "NO" ) -IF(GLUT_INCLUDE_DIR) - IF(GLUT_glut_LIBRARY) - # Is -lXi and -lXmu required on all platforms that have it? - # If not, we need some way to figure out what platform we are on. - SET( GLUT_LIBRARIES - ${GLUT_glut_LIBRARY} - ${GLUT_Xmu_LIBRARY} - ${GLUT_Xi_LIBRARY} - ${GLUT_cocoa_LIBRARY} - ) - SET( GLUT_FOUND "YES" ) - - #The following deprecated settings are for backwards compatibility with CMake1.4 - SET (GLUT_LIBRARY ${GLUT_LIBRARIES}) - SET (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR}) +INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLUT REQUIRED_VARS GLUT_glut_LIBRARY GLUT_INCLUDE_DIR) + +IF (GLUT_FOUND) + # Is -lXi and -lXmu required on all platforms that have it? + # If not, we need some way to figure out what platform we are on. + SET( GLUT_LIBRARIES + ${GLUT_glut_LIBRARY} + ${GLUT_Xmu_LIBRARY} + ${GLUT_Xi_LIBRARY} + ${GLUT_cocoa_LIBRARY} + ) - ENDIF(GLUT_glut_LIBRARY) -ENDIF(GLUT_INCLUDE_DIR) + #The following deprecated settings are for backwards compatibility with CMake1.4 + SET (GLUT_LIBRARY ${GLUT_LIBRARIES}) + SET (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR}) +ENDIF(GLUT_FOUND) MARK_AS_ADVANCED( GLUT_INCLUDE_DIR diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake index 635090b..6dbc026 100644 --- a/Modules/FindGettext.cmake +++ b/Modules/FindGettext.cmake @@ -61,6 +61,17 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gettext INCLUDE(CMakeParseArguments) +FUNCTION(_GETTEXT_GET_UNIQUE_TARGET_NAME _name _unique_name) + SET(propertyName "_GETTEXT_UNIQUE_COUNTER_${_name}") + GET_PROPERTY(currentCounter GLOBAL PROPERTY "${propertyName}") + IF(NOT currentCounter) + SET(currentCounter 1) + ENDIF() + SET(${_unique_name} "${_name}_${currentCounter}" PARENT_SCOPE) + MATH(EXPR currentCounter "${currentCounter} + 1") + SET_PROPERTY(GLOBAL PROPERTY ${propertyName} ${currentCounter} ) +ENDFUNCTION() + MACRO(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg) # make it a real variable, so we can modify it here SET(_firstPoFile "${_firstPoFileArg}") @@ -94,7 +105,15 @@ MACRO(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg) ENDFOREACH (_currentPoFile ) - ADD_CUSTOM_TARGET(translations ${_addToAll} DEPENDS ${_gmoFiles}) + IF(NOT TARGET translations) + ADD_CUSTOM_TARGET(translations) + ENDIF() + + _GETTEXT_GET_UNIQUE_TARGET_NAME(translations uniqueTargetName) + + ADD_CUSTOM_TARGET(${uniqueTargetName} ${_addToAll} DEPENDS ${_gmoFiles}) + + ADD_DEPENDENCIES(translations ${uniqueTargetName}) ENDMACRO(GETTEXT_CREATE_TRANSLATIONS ) @@ -133,11 +152,20 @@ FUNCTION(GETTEXT_PROCESS_POT_FILE _potFile) LIST(APPEND _gmoFiles ${_gmoFile}) ENDFOREACH (_lang ) + IF(NOT TARGET potfiles) + ADD_CUSTOM_TARGET(potfiles) + ENDIF() + + _GETTEXT_GET_UNIQUE_TARGET_NAME( potfiles uniqueTargetName) + IF(_parsedArguments_ALL) - ADD_CUSTOM_TARGET(potfiles ALL DEPENDS ${_gmoFiles}) + ADD_CUSTOM_TARGET(${uniqueTargetName} ALL DEPENDS ${_gmoFiles}) ELSE(_parsedArguments_ALL) - ADD_CUSTOM_TARGET(potfiles DEPENDS ${_gmoFiles}) + ADD_CUSTOM_TARGET(${uniqueTargetName} DEPENDS ${_gmoFiles}) ENDIF(_parsedArguments_ALL) + + ADD_DEPENDENCIES(potfiles ${uniqueTargetName}) + ENDFUNCTION(GETTEXT_PROCESS_POT_FILE) @@ -165,11 +193,21 @@ FUNCTION(GETTEXT_PROCESS_PO_FILES _lang) LIST(APPEND _gmoFiles ${_gmoFile}) ENDFOREACH(_current_PO_FILE) + + IF(NOT TARGET pofiles) + ADD_CUSTOM_TARGET(pofiles) + ENDIF() + + _GETTEXT_GET_UNIQUE_TARGET_NAME( pofiles uniqueTargetName) + IF(_parsedArguments_ALL) - ADD_CUSTOM_TARGET(pofiles ALL DEPENDS ${_gmoFiles}) + ADD_CUSTOM_TARGET(${uniqueTargetName} ALL DEPENDS ${_gmoFiles}) ELSE(_parsedArguments_ALL) - ADD_CUSTOM_TARGET(pofiles DEPENDS ${_gmoFiles}) + ADD_CUSTOM_TARGET(${uniqueTargetName} DEPENDS ${_gmoFiles}) ENDIF(_parsedArguments_ALL) + + ADD_DEPENDENCIES(pofiles ${uniqueTargetName}) + ENDFUNCTION(GETTEXT_PROCESS_PO_FILES) IF (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE ) 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 75523f4..0c890f5 100644 --- a/Modules/FindImageMagick.cmake +++ b/Modules/FindImageMagick.cmake @@ -169,9 +169,9 @@ FOREACH(component ${ImageMagick_FIND_COMPONENTS} LIST(APPEND ImageMagick_REQUIRED_VARS ImageMagick_${component}_EXECUTABLE) ENDIF(is_requested GREATER -1) ELSEIF(ImageMagick_${component}_EXECUTABLE) - # if no components were requested explicitely put all (default) executables + # 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/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 884266f..0ae98df 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -219,40 +219,69 @@ if (BLA_VENDOR STREQUAL "Generic" OR endif ( NOT LAPACK_LIBRARIES ) endif () #intel lapack - if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") +if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") + if (NOT WIN32) + set(LM "-lm") + endif () if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) - if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) + if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) find_PACKAGE(Threads) - else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) - find_package(Threads REQUIRED) - endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) - if (BLA_F95) - if(NOT LAPACK95_LIBRARIES) - check_lapack_libraries( - LAPACK95_LIBRARIES - LAPACK - cheev - "" - "mkl_lapack95" - "${BLAS95_LIBRARIES}" - "${CMAKE_THREAD_LIBS_INIT}" - ) - endif(NOT LAPACK95_LIBRARIES) - else(BLA_F95) - if(NOT LAPACK_LIBRARIES) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "mkl_lapack" - "${BLAS_LIBRARIES}" - "${CMAKE_THREAD_LIBS_INIT}" - ) - endif(NOT LAPACK_LIBRARIES) - endif(BLA_F95) + else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) + find_package(Threads REQUIRED) + endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) + if (BLA_F95) + if(NOT LAPACK95_LIBRARIES) + # old + check_lapack_libraries( + LAPACK95_LIBRARIES + LAPACK + cheev + "" + "mkl_lapack95" + "${BLAS95_LIBRARIES}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" + ) + endif(NOT LAPACK95_LIBRARIES) + if(NOT LAPACK95_LIBRARIES) + # new >= 10.3 + check_lapack_libraries( + LAPACK95_LIBRARIES + LAPACK + CHEEV + "" + "mkl_intel_lp64" + "${BLAS95_LIBRARIES}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" + ) + endif(NOT LAPACK95_LIBRARIES) + else(BLA_F95) + if(NOT LAPACK_LIBRARIES) + # old + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "mkl_lapack" + "${BLAS_LIBRARIES}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" + ) + endif(NOT LAPACK_LIBRARIES) + if(NOT LAPACK_LIBRARIES) + # new >= 10.3 + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "mkl_gf_lp64" + "${BLAS_LIBRARIES}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" + ) + endif(NOT LAPACK_LIBRARIES) + endif(BLA_F95) endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) - endif(BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") +endif(BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") else(BLAS_FOUND) message(STATUS "LAPACK requires BLAS") endif(BLAS_FOUND) diff --git a/Modules/FindLibXslt.cmake b/Modules/FindLibXslt.cmake index 1e42f42..dd5aac4 100644 --- a/Modules/FindLibXslt.cmake +++ b/Modules/FindLibXslt.cmake @@ -5,6 +5,7 @@ # LIBXSLT_INCLUDE_DIR - the LibXslt include directory # LIBXSLT_LIBRARIES - Link these to LibXslt # LIBXSLT_DEFINITIONS - Compiler switches required for using LibXslt +# LIBXSLT_VERSION_STRING - version of LibXslt found (since CMake 2.8.8) # Additionally, the following two variables are set (but not required for using xslt): # LIBXSLT_EXSLT_LIBRARIES - Link to these if you need to link against the exslt library # LIBXSLT_XSLTPROC_EXECUTABLE - Contains the full path to the xsltproc executable if found @@ -51,10 +52,21 @@ SET(LIBXSLT_EXSLT_LIBRARIES ${LIBXSLT_EXSLT_LIBRARY} ) FIND_PROGRAM(LIBXSLT_XSLTPROC_EXECUTABLE xsltproc) -# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if -# all listed variables are TRUE +IF(PC_LIBXSLT_VERSION) + SET(LIBXSLT_VERSION_STRING ${PC_LIBXSLT_VERSION}) +ELSEIF(LIBXSLT_INCLUDE_DIR AND EXISTS "${LIBXSLT_INCLUDE_DIR}/libxslt/xsltconfig.h") + FILE(STRINGS "${LIBXSLT_INCLUDE_DIR}/libxslt/xsltconfig.h" libxslt_version_str + REGEX "^#define[\t ]+LIBXSLT_DOTTED_VERSION[\t ]+\".*\"") + + STRING(REGEX REPLACE "^#define[\t ]+LIBXSLT_DOTTED_VERSION[\t ]+\"([^\"]*)\".*" "\\1" + LIBXSLT_VERSION_STRING "${libxslt_version_str}") + UNSET(libxslt_version_str) +ENDIF() + INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXslt DEFAULT_MSG LIBXSLT_LIBRARIES LIBXSLT_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXslt + REQUIRED_VARS LIBXSLT_LIBRARIES LIBXSLT_INCLUDE_DIR + VERSION_VAR LIBXSLT_VERSION_STRING) MARK_AS_ADVANCED(LIBXSLT_INCLUDE_DIR LIBXSLT_LIBRARIES diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index 652803c..b96a2ec 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -1,7 +1,7 @@ # - Finds OpenMP support # This module can be used to detect OpenMP support in a compiler. # If the compiler supports OpenMP, the flags required to compile with -# openmp support are set. +# openmp support are set. # # The following variables are set: # OpenMP_C_FLAGS - flags to add to the C compiler for OpenMP support @@ -13,6 +13,7 @@ #============================================================================= # Copyright 2009 Kitware, Inc. # Copyright 2008-2009 André Rigland Brodtkorb <Andre.Brodtkorb@ifi.uio.no> +# 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. @@ -24,31 +25,54 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -include(CheckCSourceCompiles) -include(CheckCXXSourceCompiles) -include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) - -set(OpenMP_C_FLAG_CANDIDATES - #Gnu - "-fopenmp" - #Microsoft Visual Studio - "/openmp" - #Intel windows - "-Qopenmp" - #Intel - "-openmp" - #Empty, if compiler automatically accepts openmp - " " - #Sun - "-xopenmp" - #HP - "+Oopenmp" - #IBM XL C/c++ - "-qsmp" - #Portland Group - "-mp" -) -set(OpenMP_CXX_FLAG_CANDIDATES ${OpenMP_C_FLAG_CANDIDATES}) +set(_OPENMP_REQUIRED_VARS) + +function(_OPENMP_FLAG_CANDIDATES LANG) + set(OpenMP_FLAG_CANDIDATES + #GNU + "-fopenmp" + #Microsoft Visual Studio + "/openmp" + #Intel windows + "-Qopenmp" + #PathScale, Intel + "-openmp" + #Empty, if compiler automatically accepts openmp + " " + #Sun + "-xopenmp" + #HP + "+Oopenmp" + #IBM XL C/c++ + "-qsmp" + #Portland Group, MIPSpro + "-mp" + ) + + set(OMP_FLAG_GNU "-fopenmp") + set(OMP_FLAG_HP "+Oopenmp") + if(WIN32) + set(OMP_FLAG_Intel "-Qopenmp") + else() + set(OMP_FLAG_Intel "-openmp") + endif() + set(OMP_FLAG_MIPSpro "-mp") + set(OMP_FLAG_MSVC "/openmp") + set(OMP_FLAG_PathScale "-openmp") + set(OMP_FLAG_PGI "-mp") + set(OMP_FLAG_SunPro "-xopenmp") + set(OMP_FLAG_XL "-qsmp") + + # Move the flag that matches the compiler to the head of the list, + # this is faster and doesn't clutter the output that much. If that + # flag doesn't work we will still try all. + if(OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID}) + list(REMOVE_ITEM OpenMP_FLAG_CANDIDATES "${OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID}}") + list(INSERT OpenMP_FLAG_CANDIDATES 0 "${OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID}}") + endif() + + set(OpenMP_${LANG}_FLAG_CANDIDATES "${OpenMP_FLAG_CANDIDATES}" PARENT_SCOPE) +endfunction(_OPENMP_FLAG_CANDIDATES) # sample openmp source code to test set(OpenMP_C_TEST_SOURCE @@ -62,53 +86,82 @@ int main() { #endif } ") -# use the same source for CXX as C for now -set(OpenMP_CXX_TEST_SOURCE ${OpenMP_C_TEST_SOURCE}) -# if these are set then do not try to find them again, -# by avoiding any try_compiles for the flags -if(DEFINED OpenMP_C_FLAGS AND DEFINED OpenMP_CXX_FLAGS) - set(OpenMP_C_FLAG_CANDIDATES) - set(OpenMP_CXX_FLAG_CANDIDATES) -endif(DEFINED OpenMP_C_FLAGS AND DEFINED OpenMP_CXX_FLAGS) # check c compiler -foreach(FLAG ${OpenMP_C_FLAG_CANDIDATES}) - set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") - set(CMAKE_REQUIRED_FLAGS "${FLAG}") - unset(OpenMP_FLAG_DETECTED CACHE) - message(STATUS "Try OpenMP C flag = [${FLAG}]") - check_c_source_compiles("${OpenMP_CXX_TEST_SOURCE}" OpenMP_FLAG_DETECTED) - set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}") - if(OpenMP_FLAG_DETECTED) - set(OpenMP_C_FLAGS_INTERNAL "${FLAG}") - break() - endif(OpenMP_FLAG_DETECTED) -endforeach(FLAG ${OpenMP_C_FLAG_CANDIDATES}) +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) + unset(OpenMP_C_FLAG_CANDIDATES) + else() + _OPENMP_FLAG_CANDIDATES("C") + include(CheckCSourceCompiles) + endif() + + foreach(FLAG ${OpenMP_C_FLAG_CANDIDATES}) + set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") + set(CMAKE_REQUIRED_FLAGS "${FLAG}") + unset(OpenMP_FLAG_DETECTED CACHE) + message(STATUS "Try OpenMP C flag = [${FLAG}]") + check_c_source_compiles("${OpenMP_C_TEST_SOURCE}" OpenMP_FLAG_DETECTED) + set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}") + if(OpenMP_FLAG_DETECTED) + set(OpenMP_C_FLAGS_INTERNAL "${FLAG}") + break() + endif(OpenMP_FLAG_DETECTED) + endforeach(FLAG ${OpenMP_C_FLAG_CANDIDATES}) + + set(OpenMP_C_FLAGS "${OpenMP_C_FLAGS_INTERNAL}" + CACHE STRING "C compiler flags for OpenMP parallization") + + list(APPEND _OPENMP_REQUIRED_VARS OpenMP_C_FLAGS) + unset(OpenMP_C_FLAG_CANDIDATES) +endif() # check cxx compiler -foreach(FLAG ${OpenMP_CXX_FLAG_CANDIDATES}) - set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") - set(CMAKE_REQUIRED_FLAGS "${FLAG}") - unset(OpenMP_FLAG_DETECTED CACHE) - message(STATUS "Try OpenMP CXX flag = [${FLAG}]") - check_cxx_source_compiles("${OpenMP_C_TEST_SOURCE}" OpenMP_FLAG_DETECTED) - set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}") - if(OpenMP_FLAG_DETECTED) - set(OpenMP_CXX_FLAGS_INTERNAL "${FLAG}") - break() - endif(OpenMP_FLAG_DETECTED) -endforeach(FLAG ${OpenMP_CXX_FLAG_CANDIDATES}) - -set(OpenMP_C_FLAGS "${OpenMP_C_FLAGS_INTERNAL}" - CACHE STRING "C compiler flags for OpenMP parallization") - -set(OpenMP_CXX_FLAGS "${OpenMP_CXX_FLAGS_INTERNAL}" - CACHE STRING "C++ compiler flags for OpenMP parallization") -# handle the standard arguments for find_package -find_package_handle_standard_args(OpenMP DEFAULT_MSG - OpenMP_C_FLAGS OpenMP_CXX_FLAGS ) - -mark_as_advanced( - OpenMP_C_FLAGS - OpenMP_CXX_FLAGS -) +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) + unset(OpenMP_CXX_FLAG_CANDIDATES) + else() + _OPENMP_FLAG_CANDIDATES("CXX") + include(CheckCXXSourceCompiles) + + # use the same source for CXX as C for now + set(OpenMP_CXX_TEST_SOURCE ${OpenMP_C_TEST_SOURCE}) + endif() + + foreach(FLAG ${OpenMP_CXX_FLAG_CANDIDATES}) + set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") + set(CMAKE_REQUIRED_FLAGS "${FLAG}") + unset(OpenMP_FLAG_DETECTED CACHE) + message(STATUS "Try OpenMP CXX flag = [${FLAG}]") + check_cxx_source_compiles("${OpenMP_CXX_TEST_SOURCE}" OpenMP_FLAG_DETECTED) + set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}") + if(OpenMP_FLAG_DETECTED) + set(OpenMP_CXX_FLAGS_INTERNAL "${FLAG}") + break() + endif(OpenMP_FLAG_DETECTED) + endforeach(FLAG ${OpenMP_CXX_FLAG_CANDIDATES}) + + set(OpenMP_CXX_FLAGS "${OpenMP_CXX_FLAGS_INTERNAL}" + CACHE STRING "C++ compiler flags for OpenMP parallization") + + list(APPEND _OPENMP_REQUIRED_VARS OpenMP_CXX_FLAGS) + unset(OpenMP_CXX_FLAG_CANDIDATES) + unset(OpenMP_CXX_TEST_SOURCE) +endif() + +if(_OPENMP_REQUIRED_VARS) + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) + + find_package_handle_standard_args(OpenMP + REQUIRED_VARS ${_OPENMP_REQUIRED_VARS}) + + mark_as_advanced(${_OPENMP_REQUIRED_VARS}) + + unset(_OPENMP_REQUIRED_VARS) +else() + message(SEND_ERROR "FindOpenMP requires C or CXX language to be enabled") +endif() 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/FindPerlLibs.cmake b/Modules/FindPerlLibs.cmake index 0ac8060..b2ffd3c 100644 --- a/Modules/FindPerlLibs.cmake +++ b/Modules/FindPerlLibs.cmake @@ -94,6 +94,7 @@ if (PERL_EXECUTABLE) ) if (NOT PERL_SITESEARCH_RESULT_VARIABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_SITESEARCH ${PERL_SITESEARCH_OUTPUT_VARIABLE}) + file(TO_CMAKE_PATH "${PERL_SITESEARCH}" PERL_SITESEARCH) endif (NOT PERL_SITESEARCH_RESULT_VARIABLE) ### PERL_SITELIB @@ -107,6 +108,7 @@ if (PERL_EXECUTABLE) ) if (NOT PERL_SITELIB_RESULT_VARIABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_SITELIB ${PERL_SITELIB_OUTPUT_VARIABLE}) + file(TO_CMAKE_PATH "${PERL_SITELIB}" PERL_SITELIB) endif (NOT PERL_SITELIB_RESULT_VARIABLE) ### PERL_VENDORARCH @@ -120,6 +122,7 @@ if (PERL_EXECUTABLE) ) if (NOT PERL_VENDORARCH_RESULT_VARIABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_VENDORARCH ${PERL_VENDORARCH_OUTPUT_VARIABLE}) + file(TO_CMAKE_PATH "${PERL_VENDORARCH}" PERL_VENDORARCH) endif (NOT PERL_VENDORARCH_RESULT_VARIABLE) ### PERL_VENDORLIB @@ -133,6 +136,7 @@ if (PERL_EXECUTABLE) ) if (NOT PERL_VENDORLIB_RESULT_VARIABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_VENDORLIB ${PERL_VENDORLIB_OUTPUT_VARIABLE}) + file(TO_CMAKE_PATH "${PERL_VENDORLIB}" PERL_VENDORLIB) endif (NOT PERL_VENDORLIB_RESULT_VARIABLE) macro(perl_adjust_darwin_lib_variable varname) @@ -173,6 +177,7 @@ if (PERL_EXECUTABLE) if (NOT PERL_ARCHLIB_RESULT_VARIABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_ARCHLIB ${PERL_ARCHLIB_OUTPUT_VARIABLE}) perl_adjust_darwin_lib_variable( ARCHLIB ) + file(TO_CMAKE_PATH "${PERL_ARCHLIB}" PERL_ARCHLIB) endif (NOT PERL_ARCHLIB_RESULT_VARIABLE) ### PERL_PRIVLIB @@ -187,28 +192,10 @@ if (PERL_EXECUTABLE) if (NOT PERL_PRIVLIB_RESULT_VARIABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_PRIVLIB ${PERL_PRIVLIB_OUTPUT_VARIABLE}) perl_adjust_darwin_lib_variable( PRIVLIB ) + file(TO_CMAKE_PATH "${PERL_PRIVLIB}" PERL_PRIVLIB) endif (NOT PERL_PRIVLIB_RESULT_VARIABLE) - - ### PERL_POSSIBLE_INCLUDE_PATHS - set(PERL_POSSIBLE_INCLUDE_PATHS - ${PERL_ARCHLIB}/CORE - /usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE - /usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE - /usr/lib/perl5/${PERL_VERSION_STRING}/CORE - /usr/lib/perl/${PERL_VERSION_STRING}/CORE - ) - - ### PERL_POSSIBLE_LIB_PATHS - set(PERL_POSSIBLE_LIB_PATHS - ${PERL_ARCHLIB}/CORE - /usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE - /usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE - /usr/lib/perl5/${PERL_VERSION_STRING}/CORE - /usr/lib/perl/${PERL_VERSION_STRING}/CORE - ) - - ### PERL_POSSIBLE_LIBRARY_NAME + ### PERL_POSSIBLE_LIBRARY_NAMES execute_process( COMMAND ${PERL_EXECUTABLE} -V:libperl @@ -218,10 +205,9 @@ if (PERL_EXECUTABLE) PERL_LIBRARY_RESULT_VARIABLE ) if (NOT PERL_LIBRARY_RESULT_VARIABLE) - foreach(_perl_lib_path ${PERL_POSSIBLE_LIB_PATHS}) - string(REGEX REPLACE "libperl='([^']+)'" "\\1" PERL_LIBRARY_OUTPUT_VARIABLE ${PERL_LIBRARY_OUTPUT_VARIABLE}) - set(PERL_POSSIBLE_LIBRARY_NAME ${PERL_POSSIBLE_LIBRARY_NAME} "${_perl_lib_path}/${PERL_LIBRARY_OUTPUT_VARIABLE}") - endforeach(_perl_lib_path ${PERL_POSSIBLE_LIB_PATHS}) + string(REGEX REPLACE "libperl='([^']+)'.*" "\\1" PERL_POSSIBLE_LIBRARY_NAMES ${PERL_LIBRARY_OUTPUT_VARIABLE}) + else (NOT PERL_LIBRARY_RESULT_VARIABLE) + set(PERL_POSSIBLE_LIBRARY_NAMES perl${PERL_VERSION_STRING} perl) endif (NOT PERL_LIBRARY_RESULT_VARIABLE) ### PERL_INCLUDE_PATH @@ -229,17 +215,23 @@ if (PERL_EXECUTABLE) NAMES perl.h PATHS - ${PERL_POSSIBLE_INCLUDE_PATHS} + ${PERL_ARCHLIB}/CORE + /usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE + /usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE + /usr/lib/perl5/${PERL_VERSION_STRING}/CORE + /usr/lib/perl/${PERL_VERSION_STRING}/CORE ) - + ### PERL_LIBRARY find_library(PERL_LIBRARY NAMES - ${PERL_POSSIBLE_LIBRARY_NAME} - perl${PERL_VERSION_STRING} - perl + ${PERL_POSSIBLE_LIBRARY_NAMES} PATHS - ${PERL_POSSIBLE_LIB_PATHS} + ${PERL_ARCHLIB}/CORE + /usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE + /usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE + /usr/lib/perl5/${PERL_VERSION_STRING}/CORE + /usr/lib/perl/${PERL_VERSION_STRING}/CORE ) endif (PERL_EXECUTABLE) @@ -254,7 +246,7 @@ find_package_handle_standard_args(PerlLibs REQUIRED_VARS PERL_LIBRARY PERL_INCLU set(PERL_INCLUDE_DIR ${PERL_INCLUDE_PATH}) set(PERL_INCLUDE_DIRS ${PERL_INCLUDE_PATH}) set(PERL_LIBRARIES ${PERL_LIBRARY}) -# For backward compatibility with CMake before 2.8.7 +# For backward compatibility with CMake before 2.8.8 set(PERL_VERSION ${PERL_VERSION_STRING}) mark_as_advanced( diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index ce58899..5d93ab1 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -13,14 +13,17 @@ # When the 'QUIET' argument is set, no status messages will be printed. # # It sets the following variables: -# PKG_CONFIG_FOUND ... true if pkg-config works on the system -# PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program -# <PREFIX>_FOUND ... set to 1 if module(s) exist +# PKG_CONFIG_FOUND ... true if pkg-config works on the system +# PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program +# PKG_CONFIG_VERSION_STRING ... the version of the pkg-config program found +# (since CMake 2.8.8) +# PKG_CONFIG_FOUND ... if pkg-config executable was found # # For the following variables two sets of values exist; first one is the # common one and has the given PREFIX. The second set contains flags # which are given out when pkgconfig was called with the '--static' # option. +# <XPREFIX>_FOUND ... set to 1 if module(s) exist # <XPREFIX>_LIBRARIES ... only the libraries (w/o the '-l') # <XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L') # <XPREFIX>_LDFLAGS ... all required linker flags @@ -89,9 +92,17 @@ set(PKG_CONFIG_VERSION 1) find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config DOC "pkg-config executable") mark_as_advanced(PKG_CONFIG_EXECUTABLE) -include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -find_package_handle_standard_args(PkgConfig DEFAULT_MSG PKG_CONFIG_EXECUTABLE) +if (PKG_CONFIG_EXECUTABLE) + execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --version + OUTPUT_VARIABLE PKG_CONFIG_VERSION_STRING + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) +endif (PKG_CONFIG_EXECUTABLE) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +find_package_handle_standard_args(PkgConfig + REQUIRED_VARS PKG_CONFIG_EXECUTABLE + VERSION_VAR PKG_CONFIG_VERSION_STRING) # Unsets the given variables macro(_pkgconfig_unset var) 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/FindQt3.cmake b/Modules/FindQt3.cmake index bacbb07..86236cc 100644 --- a/Modules/FindQt3.cmake +++ b/Modules/FindQt3.cmake @@ -183,11 +183,14 @@ ENDIF(QT_UIC_EXECUTABLE) IF (WIN32) FIND_LIBRARY(QT_QTMAIN_LIBRARY qtmain + HINTS + $ENV{QTDIR}/lib "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/lib" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/lib" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/lib" + PATHS "$ENV{ProgramFiles}/qt/lib" - $ENV{QTDIR}/lib "C:/Program Files/qt/lib" + "C:/Program Files/qt/lib" DOC "This Library is only needed by and included with Qt3 on MSWindows. It should be NOTFOUND, undefined or IGNORE otherwise." ) ENDIF (WIN32) diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake index c4adfd1..5e973e4 100644 --- a/Modules/FindRuby.cmake +++ b/Modules/FindRuby.cmake @@ -61,49 +61,44 @@ FIND_PROGRAM(RUBY_EXECUTABLE NAMES ${_RUBY_POSSIBLE_EXECUTABLE_NAMES}) IF(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR) - # query the ruby version - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['MAJOR']" - OUTPUT_VARIABLE RUBY_VERSION_MAJOR) + FUNCTION(_RUBY_CONFIG_VAR RBVAR OUTVAR) + EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['${RBVAR}']" + RESULT_VARIABLE _RUBY_SUCCESS + OUTPUT_VARIABLE _RUBY_OUTPUT + ERROR_QUIET) + IF(_RUBY_SUCCESS OR NOT _RUBY_OUTPUT) + EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['${RBVAR}']" + RESULT_VARIABLE _RUBY_SUCCESS + OUTPUT_VARIABLE _RUBY_OUTPUT + ERROR_QUIET) + ENDIF(_RUBY_SUCCESS OR NOT _RUBY_OUTPUT) + SET(${OUTVAR} "${_RUBY_OUTPUT}" PARENT_SCOPE) + ENDFUNCTION(_RUBY_CONFIG_VAR) - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['MINOR']" - OUTPUT_VARIABLE RUBY_VERSION_MINOR) - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['TEENY']" - OUTPUT_VARIABLE RUBY_VERSION_PATCH) + # query the ruby version + _RUBY_CONFIG_VAR("MAJOR" RUBY_VERSION_MAJOR) + _RUBY_CONFIG_VAR("MINOR" RUBY_VERSION_MINOR) + _RUBY_CONFIG_VAR("TEENY" RUBY_VERSION_PATCH) # query the different directories - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['archdir']" - OUTPUT_VARIABLE RUBY_ARCH_DIR) - - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['arch']" - OUTPUT_VARIABLE RUBY_ARCH) - - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['rubyhdrdir']" - OUTPUT_VARIABLE RUBY_HDR_DIR) - - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['libdir']" - OUTPUT_VARIABLE RUBY_POSSIBLE_LIB_DIR) - - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['rubylibdir']" - OUTPUT_VARIABLE RUBY_RUBY_LIB_DIR) + _RUBY_CONFIG_VAR("archdir" RUBY_ARCH_DIR) + _RUBY_CONFIG_VAR("arch" RUBY_ARCH) + _RUBY_CONFIG_VAR("rubyhdrdir" RUBY_HDR_DIR) + _RUBY_CONFIG_VAR("libdir" RUBY_POSSIBLE_LIB_DIR) + _RUBY_CONFIG_VAR("rubylibdir" RUBY_RUBY_LIB_DIR) # site_ruby - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['sitearchdir']" - OUTPUT_VARIABLE RUBY_SITEARCH_DIR) - - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['sitelibdir']" - OUTPUT_VARIABLE RUBY_SITELIB_DIR) + _RUBY_CONFIG_VAR("sitearchdir" RUBY_SITEARCH_DIR) + _RUBY_CONFIG_VAR("sitelibdir" RUBY_SITELIB_DIR) # vendor_ruby available ? EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r vendor-specific -e "print 'true'" OUTPUT_VARIABLE RUBY_HAS_VENDOR_RUBY ERROR_QUIET) IF(RUBY_HAS_VENDOR_RUBY) - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['vendorlibdir']" - OUTPUT_VARIABLE RUBY_VENDORLIB_DIR) - - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['vendorarchdir']" - OUTPUT_VARIABLE RUBY_VENDORARCH_DIR) + _RUBY_CONFIG_VAR("vendorlibdir" RUBY_VENDORLIB_DIR) + _RUBY_CONFIG_VAR("vendorarchdir" RUBY_VENDORARCH_DIR) ENDIF(RUBY_HAS_VENDOR_RUBY) # save the results in the cache so we don't have to run ruby the next time again diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake index 1735bd4..76fb3c9 100644 --- a/Modules/FindX11.cmake +++ b/Modules/FindX11.cmake @@ -20,7 +20,7 @@ # X11_XShm_INCLUDE_PATH, (in X11_Xext_LIB), X11_XShm_FOUND # X11_Xshape_INCLUDE_PATH, (in X11_Xext_LIB), X11_Xshape_FOUND # X11_xf86misc_INCLUDE_PATH, X11_Xxf86misc_LIB, X11_xf86misc_FOUND -# X11_xf86vmode_INCLUDE_PATH, X11_xf86vmode_FOUND +# X11_xf86vmode_INCLUDE_PATH, X11_Xxf86vm_LIB X11_xf86vmode_FOUND # X11_Xfixes_INCLUDE_PATH, X11_Xfixes_LIB, X11_Xfixes_FOUND # X11_Xft_INCLUDE_PATH, X11_Xft_LIB, X11_Xft_FOUND # X11_Xi_INCLUDE_PATH, X11_Xi_LIB, X11_Xi_FOUND @@ -146,6 +146,7 @@ IF (UNIX) FIND_LIBRARY(X11_XTest_LIB Xtst ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xv_LIB Xv ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xxf86misc_LIB Xxf86misc ${X11_LIB_SEARCH_PATH}) + FIND_LIBRARY(X11_Xxf86vm_LIB Xxf86vm ${X11_LIB_SEARCH_PATH}) SET(X11_LIBRARY_DIR "") IF(X11_X11_LIB) @@ -270,10 +271,10 @@ IF (UNIX) SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86misc_INCLUDE_PATH}) ENDIF (X11_xf86misc_INCLUDE_PATH AND X11_Xxf86misc_LIB) - IF (X11_xf86vmode_INCLUDE_PATH) + IF (X11_xf86vmode_INCLUDE_PATH AND X11_Xxf86vm_LIB) SET(X11_xf86vmode_FOUND TRUE) SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86vmode_INCLUDE_PATH}) - ENDIF (X11_xf86vmode_INCLUDE_PATH) + ENDIF (X11_xf86vmode_INCLUDE_PATH AND X11_Xxf86vm_LIB) IF (X11_Xcursor_INCLUDE_PATH AND X11_Xcursor_LIB) SET(X11_Xcursor_FOUND TRUE) @@ -443,6 +444,7 @@ IF (UNIX) X11_XRes_INCLUDE_PATH X11_Xxf86misc_LIB X11_xf86misc_INCLUDE_PATH + X11_Xxf86vm_LIB X11_xf86vmode_INCLUDE_PATH X11_Xi_LIB X11_Xi_INCLUDE_PATH diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index 781b6e7..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/UseJava.cmake b/Modules/UseJava.cmake index 1dfa3c0..84d0afd 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -121,7 +121,7 @@ # [VERSION TRUE|FALSE] # ) # -# Create jave documentation based on files or packages. For more +# Create java documentation based on files or packages. For more # details please read the javadoc manpage. # # There are two main signatures for create_javadoc. The first 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) # diff --git a/Source/CPack/cmCPackDocumentVariables.cxx b/Source/CPack/cmCPackDocumentVariables.cxx index 68cde78..23e99f8 100644 --- a/Source/CPack/cmCPackDocumentVariables.cxx +++ b/Source/CPack/cmCPackDocumentVariables.cxx @@ -21,12 +21,60 @@ void cmCPackDocumentVariables::DefineVariables(cmake* cm) "", false, "Variables common to all CPack generators"); - // Subsection: variables defined/used by cpack, - // which are specific to one CPack generator -// cm->DefineProperty -// ("CPACK_RPM_PACKAGE_NAME", cmProperty::VARIABLE, -// "RPM specific package name.", -// "If not specified, defaults to CPACK_PACKAGE_NAME." -// "", false, -// "Variables specific to a CPack generator"); + cm->DefineProperty + ("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", cmProperty::VARIABLE, + "Boolean toggle to include/exclude top level directory.", + "When preparing a package CPack installs the item under" + " the so-called top level directory. The purpose of" + " is to include (set to 1 or ON or TRUE) the top level directory" + " in the package or not (set to 0 or OFF or FALSE).\n" + "Each CPack generator as a built-in default value for this" + " variable. E.g. Archive generators (ZIP, TGZ, ...) includes" + " the top level whereas RPM or DEB don't. The user may override" + " the default value byt setting this variable.\n" + "There is a similar variable " + "CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY" + "which may be used to override the behavior for the component" + "packaging case which may have different default value for" + "historical (now backward compatibility) reason.", false, + "Variables common to all CPack generators"); + + cm->DefineProperty + ("CPACK_SET_DESTDIR", cmProperty::VARIABLE, + "Boolean toggle to make CPack use DESTDIR mechanism when" + " packaging.", "DESTDIR means DESTination DIRectory." + " It is commonly used by makefile " + "users in order to install software at non-default location. It a" + "basic relocation mechanism. " + "It is usually invoked like this:\n" + " make DESTDIR=/home/john install\n" + "which will install the concerned software using the" + " installation prefix, e.g. \"/usr/local\" prepended with " + "the DESTDIR value which finally gives \"/home/john/usr/local\"." + " When preparing a package CPack first installs the items to be " + "packaged in a local (to the build tree) directory by using the " + "same DESTDIR mechanism. Nevertheless, if " + "CPACK_SET_DESTDIR is set then CPack will set DESTDIR before" + " doing the local install. The most noticeable difference is" + " that without CPACK_SET_DESTDIR, CPack uses " + "CPACK_PACKAGING_INSTALL_PREFIX as a prefix whereas with " + "CPACK_SET_DESTDIR set, CPack will use CMAKE_INSTALL_PREFIX as" + " a prefix.\n" + "Manually setting CPACK_SET_DESTDIR may help (or simply be" + " necessary) if some install rules uses absolute " + "DESTINATION (see CMake INSTALL command)." + "However, starting with" + " CPack/CMake 2.8.3 RPM and DEB installers tries to handle DESTDIR" + " automatically so that it is seldom necessary for the user to set" + " it.", false, + "Variables common to all CPack generators"); + + cm->DefineProperty + ("CPACK_INSTALL_SCRIPT", cmProperty::VARIABLE, + "Extra CMake script provided by the user.", + "If set this CMake script will be executed by CPack " + "during its local [CPack-private] installation " + "which is done right before packaging the files." + " The script is not called by e.g.: make install.", false, + "Variables common to all CPack generators"); } diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index c541610..6f5055c 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -514,7 +514,6 @@ int main (int argc, char *argv[]) if ( help ) { // Construct and print requested documentation. - std::vector<cmDocumentationEntry> variables; doc.SetName("cpack"); doc.SetSection("Name",cmDocumentationName); @@ -545,7 +544,7 @@ int main (int argc, char *argv[]) { doc.GetStructuredDocFromFile( (docedIt->first).c_str(), - commands,&cminst,(docedIt->second).c_str()); + commands,&cminst); } std::map<std::string,cmDocumentationSection *> propDocs; diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 0b1c9fe..309abb1 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -555,7 +555,7 @@ int cmCTestCoverageHandler::ProcessHandler() covSumFile << "\t<File Name=\"" << cmXMLSafe(fileName) << "\" FullPath=\"" << cmXMLSafe( this->CTest->GetShortPathToFile(fullFileName.c_str())) - << "\" Covered=\"" << (tested > 0 ? "true":"false") << "\">\n" + << "\" Covered=\"" << (tested+untested > 0 ? "true":"false") << "\">\n" << "\t\t<LOCTested>" << tested << "</LOCTested>\n" << "\t\t<LOCUnTested>" << untested << "</LOCUnTested>\n" << "\t\t<PercentCoverage>"; diff --git a/Source/cmBootstrapCommands.cxx b/Source/cmBootstrapCommands.cxx index 554f452..9097a74 100644 --- a/Source/cmBootstrapCommands.cxx +++ b/Source/cmBootstrapCommands.cxx @@ -12,7 +12,7 @@ // This file is used to compile all the commands // that CMake knows about at compile time. // This is sort of a boot strapping approach since you would -// like to have CMake to build CMake. +// like to have CMake to build CMake. #include "cmCommands.h" #include "cmAddCustomCommandCommand.cxx" #include "cmAddCustomTargetCommand.cxx" @@ -38,6 +38,7 @@ #include "cmEndFunctionCommand.cxx" #include "cmEndIfCommand.cxx" #include "cmEndMacroCommand.cxx" +#include "cmEndWhileCommand.cxx" #include "cmExecProgramCommand.cxx" #include "cmExecuteProcessCommand.cxx" #include "cmExternalMakefileProjectGenerator.cxx" @@ -91,6 +92,7 @@ #include "cmTryCompileCommand.cxx" #include "cmTryRunCommand.cxx" #include "cmUnsetCommand.cxx" +#include "cmWhileCommand.cxx" void GetBootstrapCommands(std::list<cmCommand*>& commands) { @@ -111,11 +113,12 @@ void GetBootstrapCommands(std::list<cmCommand*>& commands) commands.push_back(new cmDefinePropertyCommand); commands.push_back(new cmElseCommand); commands.push_back(new cmEnableLanguageCommand); - commands.push_back(new cmEnableTestingCommand); + commands.push_back(new cmEnableTestingCommand); commands.push_back(new cmEndForEachCommand); commands.push_back(new cmEndFunctionCommand); commands.push_back(new cmEndIfCommand); commands.push_back(new cmEndMacroCommand); + commands.push_back(new cmEndWhileCommand); commands.push_back(new cmExecProgramCommand); commands.push_back(new cmExecuteProcessCommand); commands.push_back(new cmFileCommand); @@ -164,4 +167,5 @@ void GetBootstrapCommands(std::list<cmCommand*>& commands) commands.push_back(new cmTryCompileCommand); commands.push_back(new cmTryRunCommand); commands.push_back(new cmUnsetCommand); + commands.push_back(new cmWhileCommand); } diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index bb1e4e2..49ed967 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -14,7 +14,6 @@ #include "cmAuxSourceDirectoryCommand.cxx" #include "cmBuildNameCommand.cxx" #include "cmElseIfCommand.cxx" -#include "cmEndWhileCommand.cxx" #include "cmExportCommand.cxx" #include "cmExportLibraryDependencies.cxx" #include "cmFLTKWrapUICommand.cxx" @@ -34,7 +33,6 @@ #include "cmVariableRequiresCommand.cxx" #include "cmVariableWatchCommand.cxx" -#include "cmWhileCommand.cxx" #include "cmWriteFileCommand.cxx" // This one must be last because it includes windows.h and @@ -53,7 +51,6 @@ void GetPredefinedCommands(std::list<cmCommand*>& commands.push_back(new cmAuxSourceDirectoryCommand); commands.push_back(new cmBuildNameCommand); commands.push_back(new cmElseIfCommand); - commands.push_back(new cmEndWhileCommand); commands.push_back(new cmExportCommand); commands.push_back(new cmExportLibraryDependenciesCommand); commands.push_back(new cmFLTKWrapUICommand); @@ -73,7 +70,6 @@ void GetPredefinedCommands(std::list<cmCommand*>& commands.push_back(new cmUtilitySourceCommand); commands.push_back(new cmVariableRequiresCommand); commands.push_back(new cmVariableWatchCommand); - commands.push_back(new cmWhileCommand); commands.push_back(new cmWriteFileCommand); #endif } diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index edf6c35..57fd5b4 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -248,6 +248,10 @@ cmComputeLinkInformation this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator(); this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance(); + // Check whether to recognize OpenBSD-style library versioned names. + this->OpenBSD = this->Makefile->GetCMakeInstance() + ->GetPropertyAsBool("FIND_LIBRARY_USE_OPENBSD_VERSIONING"); + // The configuration being linked. this->Config = config; @@ -973,7 +977,15 @@ cmComputeLinkInformation } // Finish the list. - libext += ")$"; + libext += ")"; + + // Add an optional OpenBSD version component. + if(this->OpenBSD) + { + libext += "(\\.[0-9]+\\.[0-9]+)?"; + } + + libext += "$"; return libext; } diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index bbeed68..f60f8d3 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -128,6 +128,7 @@ private: cmsys::RegularExpression ExtractSharedLibraryName; cmsys::RegularExpression ExtractAnyLibraryName; std::string SharedRegexString; + bool OpenBSD; void AddLinkPrefix(const char* p); void AddLinkExtension(const char* e, LinkType type); std::string CreateExtensionRegex(std::vector<std::string> const& exts); diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index dca2fb3..7d84ba6 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -26,6 +26,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) const char* sourceDirectory = argv[2].c_str(); const char* projectName = 0; const char* targetName = 0; + char targetNameBuf[64]; int extraArgs = 0; // look for CMAKE_FLAGS and store them @@ -281,16 +282,20 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) cmakeFlags.push_back(flag); } + /* Use a random file name to avoid rapid creation and deletion + of the same executable name (some filesystems fail on that). */ + sprintf(targetNameBuf, "cmTryCompileExec%u", + cmSystemTools::RandomSeed()); + targetName = targetNameBuf; + /* Put the executable at a known location (for COPY_FILE). */ fprintf(fout, "SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n", this->BinaryDirectory.c_str()); /* Create the actual executable. */ - fprintf(fout, "ADD_EXECUTABLE(cmTryCompileExec \"%s\")\n",source.c_str()); - fprintf(fout, - "TARGET_LINK_LIBRARIES(cmTryCompileExec ${LINK_LIBRARIES})\n"); + fprintf(fout, "ADD_EXECUTABLE(%s \"%s\")\n", targetName, source.c_str()); + fprintf(fout, "TARGET_LINK_LIBRARIES(%s ${LINK_LIBRARIES})\n",targetName); fclose(fout); projectName = "CMAKE_TRY_COMPILE"; - targetName = "cmTryCompileExec"; // if the source is not in CMakeTmp if(source.find("CMakeTmp") == source.npos) { diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index f3125ce..a31dd01 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -915,7 +915,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm) cm->DefineProperty ("BORLAND", cmProperty::VARIABLE, - "True of the borland compiler is being used.", + "True if the borland compiler is being used.", "This is set to true if the Borland compiler is being used.",false, "Variables That Describe the System"); diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 02f69f1..904a157 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -16,6 +16,7 @@ #include <cmsys/Directory.hxx> #include <cmsys/Glob.hxx> +#include <algorithm> //---------------------------------------------------------------------------- static const char *cmDocumentationStandardOptions[][3] = @@ -741,10 +742,20 @@ void cmDocumentation::addCPackStandardDocSections() this->VariableSections.push_back( "Variables common to all CPack generators"); - this->VariableSections.push_back( - "Variables specific to a CPack generator"); } +void cmDocumentation::addAutomaticVariableSections(const std::string& section) +{ + std::vector<std::string>::iterator it; + it = std::find(this->VariableSections.begin(), + this->VariableSections.end(), + section); + /* if the section does not exist then add it */ + if (it==this->VariableSections.end()) + { + this->VariableSections.push_back(section); + } +} //---------------------------------------------------------------------------- int cmDocumentation::getDocumentedModulesListInDir( std::string path, @@ -818,8 +829,7 @@ static void trim(std::string& s) int cmDocumentation::GetStructuredDocFromFile( const char* fname, std::vector<cmDocumentationEntry>& commands, - cmake* cm, - const char *docSection) + cmake* cm) { typedef enum sdoce { SDOC_NONE, SDOC_MODULE, SDOC_MACRO, SDOC_FUNCTION, SDOC_VARIABLE, @@ -835,6 +845,7 @@ int cmDocumentation::GetStructuredDocFromFile( { return nbDocItemFound; } + std::string section; std::string name; std::string full; std::string brief; @@ -886,6 +897,8 @@ int cmDocumentation::GetStructuredDocFromFile( { docCtxIdx++; docContextStack[docCtxIdx]=SDOC_SECTION; + // 10 is the size of '##section' + 1 + section = line.substr(10,std::string::npos); /* drop the rest of the line */ line = ""; newCtx = true; @@ -900,11 +913,12 @@ int cmDocumentation::GetStructuredDocFromFile( brief.c_str(),full.c_str())); break; case SDOC_VARIABLE: + this->addAutomaticVariableSections(section); cm->DefineProperty (name.c_str(), cmProperty::VARIABLE, brief.c_str(), full.c_str(),false, - docSection); + section.c_str()); break; case SDOC_MODULE: /* not implemented */ diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index 00dba1a..11bef16 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -147,6 +147,9 @@ public: /** Add the CPack standard documentation section(s) */ void addCPackStandardDocSections(); + /** Add automatic variables sections */ + void addAutomaticVariableSections(const std::string& section); + /** * Retrieve the list of documented module located in * path which match the globing expression globExpr. @@ -185,8 +188,7 @@ public: */ int GetStructuredDocFromFile(const char* fname, std::vector<cmDocumentationEntry>& commands, - cmake* cm, - const char *docSection); + cmake* cm); private: void SetForm(Form f); void SetDocName(const char* docname); diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 38002ec..6e246e6 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -392,10 +392,6 @@ void cmExtraCodeBlocksGenerator make.c_str(), makefile, compiler.c_str()); } break; - // ignore these: - case cmTarget::INSTALL_FILES: - case cmTarget::INSTALL_PROGRAMS: - case cmTarget::INSTALL_DIRECTORY: default: break; } diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 07549e9..c8c86c7 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -1045,10 +1045,6 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const } } break; - // ignore these: - case cmTarget::INSTALL_FILES: - case cmTarget::INSTALL_PROGRAMS: - case cmTarget::INSTALL_DIRECTORY: default: break; } diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 6df5ab3..3f14fa1 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -12,6 +12,7 @@ #include "cmFileCommand.h" #include "cmake.h" #include "cmHexFileConverter.h" +#include "cmInstallType.h" #include "cmFileTimeComparison.h" #include "cmCryptoHash.h" @@ -1690,7 +1691,7 @@ struct cmFileInstaller: public cmFileCopier { cmFileInstaller(cmFileCommand* command): cmFileCopier(command, "INSTALL"), - InstallType(cmTarget::INSTALL_FILES), + InstallType(cmInstallType_FILES), Optional(false), DestDirLength(0) { @@ -1711,7 +1712,7 @@ struct cmFileInstaller: public cmFileCopier } protected: - cmTarget::TargetType InstallType; + cmInstallType InstallType; bool Optional; int DestDirLength; std::string Rename; @@ -1745,7 +1746,7 @@ protected: virtual bool Install(const char* fromFile, const char* toFile) { // Support installing from empty source to make a directory. - if(this->InstallType == cmTarget::INSTALL_DIRECTORY && !*fromFile) + if(this->InstallType == cmInstallType_DIRECTORY && !*fromFile) { return this->InstallDirectory(fromFile, toFile, MatchProperties()); } @@ -1767,14 +1768,14 @@ protected: // Add execute permissions based on the target type. switch(this->InstallType) { - case cmTarget::SHARED_LIBRARY: - case cmTarget::MODULE_LIBRARY: + case cmInstallType_SHARED_LIBRARY: + case cmInstallType_MODULE_LIBRARY: if(this->Makefile->IsOn("CMAKE_INSTALL_SO_NO_EXE")) { break; } - case cmTarget::EXECUTABLE: - case cmTarget::INSTALL_PROGRAMS: + case cmInstallType_EXECUTABLE: + case cmInstallType_PROGRAMS: this->FilePermissions |= mode_owner_execute; this->FilePermissions |= mode_group_execute; this->FilePermissions |= mode_world_execute; @@ -1796,8 +1797,8 @@ bool cmFileInstaller::Parse(std::vector<std::string> const& args) if(!this->Rename.empty()) { - if(this->InstallType != cmTarget::INSTALL_FILES && - this->InstallType != cmTarget::INSTALL_PROGRAMS) + if(this->InstallType != cmInstallType_FILES && + this->InstallType != cmInstallType_PROGRAMS) { this->FileCommand->SetError("INSTALL option RENAME may be used " "only with FILES or PROGRAMS."); @@ -1936,31 +1937,31 @@ bool cmFileInstaller { if ( stype == "EXECUTABLE" ) { - this->InstallType = cmTarget::EXECUTABLE; + this->InstallType = cmInstallType_EXECUTABLE; } else if ( stype == "FILE" ) { - this->InstallType = cmTarget::INSTALL_FILES; + this->InstallType = cmInstallType_FILES; } else if ( stype == "PROGRAM" ) { - this->InstallType = cmTarget::INSTALL_PROGRAMS; + this->InstallType = cmInstallType_PROGRAMS; } else if ( stype == "STATIC_LIBRARY" ) { - this->InstallType = cmTarget::STATIC_LIBRARY; + this->InstallType = cmInstallType_STATIC_LIBRARY; } else if ( stype == "SHARED_LIBRARY" ) { - this->InstallType = cmTarget::SHARED_LIBRARY; + this->InstallType = cmInstallType_SHARED_LIBRARY; } else if ( stype == "MODULE" ) { - this->InstallType = cmTarget::MODULE_LIBRARY; + this->InstallType = cmInstallType_MODULE_LIBRARY; } else if ( stype == "DIRECTORY" ) { - this->InstallType = cmTarget::INSTALL_DIRECTORY; + this->InstallType = cmInstallType_DIRECTORY; } else { diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 2fa2cca..a726849 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -354,13 +354,23 @@ void cmFindLibraryHelper::RegexFromList(std::string& out, //---------------------------------------------------------------------------- bool cmFindLibraryHelper::HasValidSuffix(std::string const& name) { - // Check if the given name ends in a valid library suffix. for(std::vector<std::string>::const_iterator si = this->Suffixes.begin(); si != this->Suffixes.end(); ++si) { - std::string const& suffix = *si; - if(name.length() > suffix.length() && - name.substr(name.size()-suffix.length()) == suffix) + std::string suffix = *si; + if(name.length() <= suffix.length()) + { + continue; + } + // Check if the given name ends in a valid library suffix. + if(name.substr(name.size()-suffix.length()) == suffix) + { + return true; + } + // Check if a valid library suffix is somewhere in the name, + // this may happen e.g. for versioned shared libraries: libfoo.so.2 + suffix += "."; + if(name.find(suffix) != name.npos) { return true; } diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx index 7c56ad7..00f5419 100644 --- a/Source/cmFindProgramCommand.cxx +++ b/Source/cmFindProgramCommand.cxx @@ -175,6 +175,8 @@ std::string cmFindProgramCommand::GetBundleExecutable(std::string bundlePath) // And finally to a c++ string executable = bundlePath + "/Contents/MacOS/" + std::string(buffer); + // Only release CFURLRef if it's not null + CFRelease( executableURL ); } // Any CF objects returned from functions with "create" or @@ -182,7 +184,6 @@ std::string cmFindProgramCommand::GetBundleExecutable(std::string bundlePath) CFRelease( bundlePathCFS ); CFRelease( bundleURL ); CFRelease( appBundle ); - CFRelease( executableURL ); #endif return executable; diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx index ab32f94..ddf7d08 100644 --- a/Source/cmInstallDirectoryGenerator.cxx +++ b/Source/cmInstallDirectoryGenerator.cxx @@ -42,7 +42,7 @@ cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os, { // Write code to install the directories. const char* no_rename = 0; - this->AddInstallRule(os, cmTarget::INSTALL_DIRECTORY, + this->AddInstallRule(os, cmInstallType_DIRECTORY, this->Directories, this->Optional, this->FilePermissions.c_str(), diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 69e3f2c..28a19d7 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -16,7 +16,6 @@ #include "cmake.h" #include "cmInstallTargetGenerator.h" #include "cmGeneratedFileStream.h" -#include "cmTarget.h" #include "cmMakefile.h" #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" @@ -186,7 +185,7 @@ cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os, files.push_back(i->second); std::string config_test = this->CreateConfigTest(i->first.c_str()); os << indent << "IF(" << config_test << ")\n"; - this->AddInstallRule(os, cmTarget::INSTALL_FILES, files, false, + this->AddInstallRule(os, cmInstallType_FILES, files, false, this->FilePermissions.c_str(), 0, 0, 0, indent.Next()); os << indent << "ENDIF(" << config_test << ")\n"; @@ -225,6 +224,6 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os, // Install the main export file. std::vector<std::string> files; files.push_back(this->MainImportFile); - this->AddInstallRule(os, cmTarget::INSTALL_FILES, files, false, + this->AddInstallRule(os, cmInstallType_FILES, files, false, this->FilePermissions.c_str(), 0, 0, 0, indent); } diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index 28f055f..ec02bc7 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -11,8 +11,6 @@ ============================================================================*/ #include "cmInstallFilesGenerator.h" -#include "cmTarget.h" - //---------------------------------------------------------------------------- cmInstallFilesGenerator ::cmInstallFilesGenerator(std::vector<std::string> const& files, @@ -43,8 +41,8 @@ void cmInstallFilesGenerator::GenerateScriptActions(std::ostream& os, const char* no_dir_permissions = 0; this->AddInstallRule(os, (this->Programs - ? cmTarget::INSTALL_PROGRAMS - : cmTarget::INSTALL_FILES), + ? cmInstallType_PROGRAMS + : cmInstallType_FILES), this->Files, this->Optional, this->FilePermissions.c_str(), no_dir_permissions, diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx index d7505dc..807168e 100644 --- a/Source/cmInstallGenerator.cxx +++ b/Source/cmInstallGenerator.cxx @@ -12,7 +12,6 @@ #include "cmInstallGenerator.h" #include "cmSystemTools.h" -#include "cmTarget.h" //---------------------------------------------------------------------------- cmInstallGenerator @@ -35,7 +34,7 @@ cmInstallGenerator void cmInstallGenerator ::AddInstallRule( std::ostream& os, - int type, + cmInstallType type, std::vector<std::string> const& files, bool optional /* = false */, const char* permissions_file /* = 0 */, @@ -49,14 +48,13 @@ void cmInstallGenerator std::string stype; switch(type) { - case cmTarget::INSTALL_DIRECTORY:stype = "DIRECTORY"; break; - case cmTarget::INSTALL_PROGRAMS: stype = "PROGRAM"; break; - case cmTarget::EXECUTABLE: stype = "EXECUTABLE"; break; - case cmTarget::STATIC_LIBRARY: stype = "STATIC_LIBRARY"; break; - case cmTarget::SHARED_LIBRARY: stype = "SHARED_LIBRARY"; break; - case cmTarget::MODULE_LIBRARY: stype = "MODULE"; break; - case cmTarget::INSTALL_FILES: - default: stype = "FILE"; break; + case cmInstallType_DIRECTORY: stype = "DIRECTORY"; break; + case cmInstallType_PROGRAMS: stype = "PROGRAM"; break; + case cmInstallType_EXECUTABLE: stype = "EXECUTABLE"; break; + case cmInstallType_STATIC_LIBRARY: stype = "STATIC_LIBRARY"; break; + case cmInstallType_SHARED_LIBRARY: stype = "SHARED_LIBRARY"; break; + case cmInstallType_MODULE_LIBRARY: stype = "MODULE"; break; + case cmInstallType_FILES: stype = "FILE"; break; } os << indent; std::string dest = this->GetInstallDestination(); diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h index aa9a47c..c89ab8a 100644 --- a/Source/cmInstallGenerator.h +++ b/Source/cmInstallGenerator.h @@ -12,6 +12,7 @@ #ifndef cmInstallGenerator_h #define cmInstallGenerator_h +#include "cmInstallType.h" #include "cmScriptGenerator.h" class cmLocalGenerator; @@ -29,7 +30,7 @@ public: virtual ~cmInstallGenerator(); void AddInstallRule( - std::ostream& os, int type, + std::ostream& os, cmInstallType type, std::vector<std::string> const& files, bool optional = false, const char* permissions_file = 0, diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index ac1c949..c74dda0 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -82,8 +82,22 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, std::vector<std::string> filesFrom; std::vector<std::string> filesTo; std::string literal_args; - cmTarget::TargetType type = this->Target->GetType(); - if(type == cmTarget::EXECUTABLE) + cmTarget::TargetType targetType = this->Target->GetType(); + cmInstallType type = cmInstallType(); + switch(targetType) + { + case cmTarget::EXECUTABLE: type = cmInstallType_EXECUTABLE; break; + case cmTarget::STATIC_LIBRARY: type = cmInstallType_STATIC_LIBRARY; break; + case cmTarget::SHARED_LIBRARY: type = cmInstallType_SHARED_LIBRARY; break; + case cmTarget::MODULE_LIBRARY: type = cmInstallType_MODULE_LIBRARY; break; + case cmTarget::UTILITY: + case cmTarget::GLOBAL_TARGET: + case cmTarget::UNKNOWN_LIBRARY: + this->Target->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR, + "cmInstallTargetGenerator created with non-installable target."); + return; + } + if(targetType == cmTarget::EXECUTABLE) { // There is a bug in cmInstallCommand if this fails. assert(this->NamelinkMode == NamelinkModeNone); @@ -110,7 +124,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, } // An import library looks like a static library. - type = cmTarget::STATIC_LIBRARY; + type = cmInstallType_STATIC_LIBRARY; } else { @@ -121,7 +135,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, if(this->Target->IsAppBundleOnApple()) { // Install the whole app bundle directory. - type = cmTarget::INSTALL_DIRECTORY; + type = cmInstallType_DIRECTORY; literal_args += " USE_SOURCE_PERMISSIONS"; from1 += ".app"; @@ -173,7 +187,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, } // An import library looks like a static library. - type = cmTarget::STATIC_LIBRARY; + type = cmInstallType_STATIC_LIBRARY; } else if(this->Target->IsFrameworkOnApple()) { @@ -181,7 +195,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, assert(this->NamelinkMode == NamelinkModeNone); // Install the whole framework directory. - type = cmTarget::INSTALL_DIRECTORY; + type = cmInstallType_DIRECTORY; literal_args += " USE_SOURCE_PERMISSIONS"; std::string from1 = fromDirConfig + targetName + ".framework"; diff --git a/Source/cmInstallType.h b/Source/cmInstallType.h new file mode 100644 index 0000000..a837368 --- /dev/null +++ b/Source/cmInstallType.h @@ -0,0 +1,29 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2012 Kitware, Inc., Insight Software Consortium + + 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. +============================================================================*/ +#ifndef cmInstallType_h +#define cmInstallType_h + +/** + * Enumerate types known to file(INSTALL). + */ +enum cmInstallType +{ + cmInstallType_EXECUTABLE, + cmInstallType_STATIC_LIBRARY, + cmInstallType_SHARED_LIBRARY, + cmInstallType_MODULE_LIBRARY, + cmInstallType_FILES, + cmInstallType_PROGRAMS, + cmInstallType_DIRECTORY +}; + +#endif diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index ffbeb48..dc8d1c4 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1902,24 +1902,13 @@ bool cmLocalGenerator::GetRealDependency(const char* inName, case cmTarget::SHARED_LIBRARY: case cmTarget::MODULE_LIBRARY: case cmTarget::UNKNOWN_LIBRARY: - { - // Get the location of the target's output file and depend on it. - if(const char* location = target->GetLocation(config)) - { - dep = location; - return true; - } - } - break; + dep = target->GetLocation(config); + return true; case cmTarget::UTILITY: case cmTarget::GLOBAL_TARGET: // A utility target has no file on which to depend. This was listed // only to get the target-level dependency. return false; - case cmTarget::INSTALL_FILES: - case cmTarget::INSTALL_PROGRAMS: - case cmTarget::INSTALL_DIRECTORY: - break; } } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index ae5596b..da99eb9 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -43,12 +43,6 @@ const char* cmTarget::GetTargetTypeName(TargetType targetType) return "UTILITY"; case cmTarget::GLOBAL_TARGET: return "GLOBAL_TARGET"; - case cmTarget::INSTALL_FILES: - return "INSTALL_FILES"; - case cmTarget::INSTALL_PROGRAMS: - return "INSTALL_PROGRAMS"; - case cmTarget::INSTALL_DIRECTORY: - return "INSTALL_DIRECTORY"; case cmTarget::UNKNOWN_LIBRARY: return "UNKNOWN_LIBRARY"; } @@ -1047,10 +1041,10 @@ void cmTarget::DefineProperties(cmake *cm) "Can be set to one or more UUIDs recognized by Visual Studio " "to indicate the type of project. This value is copied " "verbatim into the generated project file. Example for a " - "managed C++ unit testing project: \"" - "{3AC096D0-A1C2-E12C-1390-A8335801FDAB};" - "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\". UUIDs are " - "semicolon-delimited."); + "managed C++ unit testing project:\n" + " {3AC096D0-A1C2-E12C-1390-A8335801FDAB};" + "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\n" + "UUIDs are semicolon-delimited."); cm->DefineProperty ("VS_GLOBAL_KEYWORD", cmProperty::TARGET, "Visual Studio project keyword.", @@ -1184,16 +1178,6 @@ void cmTarget::DefineProperties(cmake *cm) void cmTarget::SetType(TargetType type, const char* name) { this->Name = name; - if(type == cmTarget::INSTALL_FILES || - type == cmTarget::INSTALL_PROGRAMS || - type == cmTarget::INSTALL_DIRECTORY) - { - this->Makefile-> - IssueMessage(cmake::INTERNAL_ERROR, - "SetType called on cmTarget for INSTALL_FILES, " - "INSTALL_PROGRAMS, or INSTALL_DIRECTORY "); - return; - } // only add dependency information for library targets this->TargetTypeValue = type; if(this->TargetTypeValue >= STATIC_LIBRARY diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 59f0184..f4b6955 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -60,7 +60,6 @@ public: cmTarget(); enum TargetType { EXECUTABLE, STATIC_LIBRARY, SHARED_LIBRARY, MODULE_LIBRARY, UTILITY, GLOBAL_TARGET, - INSTALL_FILES, INSTALL_PROGRAMS, INSTALL_DIRECTORY, UNKNOWN_LIBRARY}; static const char* GetTargetTypeName(TargetType targetType); enum CustomCommandType { PRE_BUILD, PRE_LINK, POST_BUILD }; diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx index 7eafda2..4000345 100644 --- a/Source/cmWhileCommand.cxx +++ b/Source/cmWhileCommand.cxx @@ -25,7 +25,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, else if (!cmSystemTools::Strucmp(lff.Name.c_str(),"endwhile")) { // if this is the endwhile for this while loop then execute - if (!this->Depth) + if (!this->Depth) { // Remove the function blocker for this scope or bail. cmsys::auto_ptr<cmFunctionBlocker> @@ -33,16 +33,16 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, if(!fb.get()) { return false; } std::string errorString; - + std::vector<std::string> expandedArguments; mf.ExpandArguments(this->Args, expandedArguments); cmake::MessageType messageType; - bool isTrue = + bool isTrue = cmIfCommand::IsTrue(expandedArguments,errorString, &mf, messageType); while (isTrue) - { + { if (errorString.size()) { std::string err = "had incorrect arguments: "; @@ -86,7 +86,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, } expandedArguments.clear(); mf.ExpandArguments(this->Args, expandedArguments); - isTrue = + isTrue = cmIfCommand::IsTrue(expandedArguments,errorString, &mf, messageType); } @@ -101,7 +101,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, // record the command this->Functions.push_back(lff); - + // always return true return true; } @@ -123,7 +123,7 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile& ) } bool cmWhileCommand -::InvokeInitialPass(const std::vector<cmListFileArgument>& args, +::InvokeInitialPass(const std::vector<cmListFileArgument>& args, cmExecutionStatus &) { if(args.size() < 1) @@ -131,12 +131,12 @@ bool cmWhileCommand this->SetError("called with incorrect number of arguments"); return false; } - + // create a function blocker cmWhileFunctionBlocker *f = new cmWhileFunctionBlocker(); f->Args = args; this->Makefile->AddFunctionBlocker(f); - + return true; } diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index c80c53f..4c91b5c 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -15,7 +15,7 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) # KWSys version date month component. Format is MM. -SET(KWSYS_DATE_STAMP_MONTH 02) +SET(KWSYS_DATE_STAMP_MONTH 03) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 17) +SET(KWSYS_DATE_STAMP_DAY 02) diff --git a/Templates/CPackConfig.cmake.in b/Templates/CPackConfig.cmake.in index 7150feb..79b8d93 100644 --- a/Templates/CPackConfig.cmake.in +++ b/Templates/CPackConfig.cmake.in @@ -1,29 +1,12 @@ # This file will be configured to contain variables for CPack. These variables # should be set in the CMake list file of the project before CPack module is -# included. Example variables are: -# CPACK_GENERATOR - Generator used to create package -# CPACK_INSTALL_CMAKE_PROJECTS - For each project (path, name, component) -# CPACK_CMAKE_GENERATOR - CMake Generator used for the projects -# CPACK_INSTALL_COMMANDS - Extra commands to install components -# CPACK_INSTALLED_DIRECTORIES - Extra directories to install -# CPACK_PACKAGE_DESCRIPTION_FILE - Description file for the package -# CPACK_PACKAGE_DESCRIPTION_SUMMARY - Summary of the package -# CPACK_PACKAGE_EXECUTABLES - List of pairs of executables and labels -# CPACK_PACKAGE_FILE_NAME - Name of the package generated -# CPACK_PACKAGE_ICON - Icon used for the package -# CPACK_PACKAGE_INSTALL_DIRECTORY - Name of directory for the installer -# CPACK_PACKAGE_NAME - Package project name -# CPACK_PACKAGE_VENDOR - Package project vendor -# CPACK_PACKAGE_VERSION - Package project version -# CPACK_PACKAGE_VERSION_MAJOR - Package project version (major) -# CPACK_PACKAGE_VERSION_MINOR - Package project version (minor) -# CPACK_PACKAGE_VERSION_PATCH - Package project version (patch) - -# There are certain generator specific ones - -# NSIS Generator: -# CPACK_PACKAGE_INSTALL_REGISTRY_KEY - Name of the registry key for the installer -# CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS - Extra commands used during uninstall -# CPACK_NSIS_EXTRA_INSTALL_COMMANDS - Extra commands used during install +# included. The list of available CPACK_xxx variables and their associated +# documentation may be obtained using +# cpack --help-variable-list +# +# Some variables are common to all generators (e.g. CPACK_PACKAGE_NAME) +# and some are specific to a generator +# (e.g. CPACK_NSIS_EXTRA_INSTALL_COMMANDS). The generator specific variables +# usually begin with CPACK_<GENNAME>_xxxx. @_CPACK_OTHER_VARIABLES_@ diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 3a1453b..00cac94 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -16,6 +16,11 @@ MACRO(ADD_TEST_MACRO NAME COMMAND) LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${dir}") ENDMACRO(ADD_TEST_MACRO) +MACRO(REGEX_ESCAPE_STRING _OUT _IN) + # Escape special regex metacharacters with a backslash + string(REGEX REPLACE "([$^.[|*+?()]|])" "\\\\\\1" ${_OUT} "${_IN}") +ENDMACRO(REGEX_ESCAPE_STRING _OUT _IN) + INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CheckFortran.cmake) # Fake a user home directory to avoid polluting the real one. @@ -586,6 +591,14 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ set(CTEST_package_X11_TEST ${CTEST_TEST_CPACK}) set(CTEST_RUN_CPackComponentsForAll ${CTEST_TEST_CPACK}) + if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT CMAKE_CURRENT_BINARY_DIR MATCHES ".* .*") + find_program(RPMBUILD NAMES rpmbuild) + endif(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT CMAKE_CURRENT_BINARY_DIR MATCHES ".* .*") + # Do not try to build RPM + if (NOT RPMBUILD) + set(CPACK_BINARY_RPM OFF) + endif(NOT RPMBUILD) + find_program(NSIS_MAKENSIS_EXECUTABLE NAMES makensis PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS] DOC "makensis program location" @@ -1639,9 +1652,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ -S "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir1/test1.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir1/testOut1.log" ) + REGEX_ESCAPE_STRING(CTEST_TEST_ESCAPED_SOURCE_DIR "${CMake_SOURCE_DIR}") SET_TESTS_PROPERTIES(CTestTestConfigFileInBuildDir1 PROPERTIES DEPENDS CTestTestNoBuild PASS_REGULAR_EXPRESSION - "Reading ctest configuration file: ${CMake_SOURCE_DIR}.Tests.CTestTestConfigFileInBuildDir.CTestConfig.cmake") + "Reading ctest configuration file: ${CTEST_TEST_ESCAPED_SOURCE_DIR}.Tests.CTestTestConfigFileInBuildDir.CTestConfig.cmake") CONFIGURE_FILE( "${CMake_SOURCE_DIR}/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in" @@ -1655,10 +1669,11 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ -S "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/test2.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/testOut2.log" ) + REGEX_ESCAPE_STRING(CTEST_TEST_ESCAPED_BINARY_DIR "${CMake_BINARY_DIR}") SET_TESTS_PROPERTIES(CTestTestConfigFileInBuildDir2 PROPERTIES DEPENDS CTestTestNoBuild REQUIRED_FILES ${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/CTestConfig.cmake PASS_REGULAR_EXPRESSION - "Reading ctest configuration file: ${CMake_BINARY_DIR}.Tests.CTestTestConfigFileInBuildDir2.CTestConfig.cmake") + "Reading ctest configuration file: ${CTEST_TEST_ESCAPED_BINARY_DIR}.Tests.CTestTestConfigFileInBuildDir2.CTestConfig.cmake") # Use macro, not function so that build can still be driven by CMake 2.4. # After 2.6 is required, this could be a function without the extra 'set' diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index f76f0d9..9257fcc 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -16,16 +16,16 @@ macro(do_find MODULE_NAME) endmacro(do_find) # It is only possible to use either Qt3 or Qt4 in one project. -# Since FindQt will complain if both are found we explicitely -# filter out this and FindQt3. FindKDE3 also depends on Qt3 and +# Since FindQt will complain if both are found we explicitly request Qt4 here +# and filter out FindQt3. FindKDE3 also depends on Qt3 and # is therefore also blocked +set(DESIRED_QT_VERSION 4) set(NO_QT4_MODULES "Qt3" "KDE3") # These modules are named Find*.cmake, but are nothing that works in # find_package(). set(NO_FIND_MODULES "PackageHandleStandardArgs" "PackageMessage") -set(DESIRED_QT_VERSION 4) foreach(FIND_MODULE ${FIND_MODULES}) string(REGEX REPLACE ".*/Find(.*)\\.cmake$" "\\1" MODULE_NAME "${FIND_MODULE}") @@ -48,8 +48,9 @@ endif (NOT QT4_FOUND) # If any of these modules reported that it was found a version number should have been # reported. set(VERSIONS_REQUIRED - ALSA BISON BZIP2 CUPS CURL DOXYGEN EXPAT FLEX GETTEXT GIF GIT - ImageMagick JASPER LibArchive LIBXML2 PERL PostgreSQL SWIG TIFF ZLIB) + ALSA BISON BZIP2 CUPS CURL DOXYGEN EXPAT FLEX FREETYPE GETTEXT GIF GIT + ImageMagick JASPER LibArchive LIBXML2 LIBXSLT PERL PKG_CONFIG PostgreSQL + SWIG TIFF ZLIB) foreach(VTEST ${VERSIONS_REQUIRED}) if (${VTEST}_FOUND) diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index b505019..ec3ad39 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -199,7 +199,9 @@ CONFIGURE_FILE( ${Complex_SOURCE_DIR}/Library/dummy ${Complex_BINARY_DIR}/Library/dummylib.lib COPYONLY IMMEDIATE) -FOREACH (ext ${CMAKE_SHLIB_SUFFIX};.so;.a;.sl) +FOREACH (ext ${CMAKE_SHLIB_SUFFIX};.so;.a;.sl + ${CMAKE_SHARED_LIBRARY_SUFFIX}.2 + ${CMAKE_STATIC_LIBRARY_SUFFIX}.2) CONFIGURE_FILE( ${Complex_SOURCE_DIR}/Library/dummy ${Complex_BINARY_DIR}/Library/libdummylib${ext} @@ -216,6 +218,34 @@ FIND_LIBRARY(FIND_DUMMY_LIB PATHS ${Complex_BINARY_DIR}/Library DOC "find dummy lib") +# This doesn't work for platforms that have a shared library and an import +# library, like Windows with .dll and .lib. Limit is to ".so" now because it's +# known to work there. +IF(CMAKE_SHARED_LIBRARY_SUFFIX STREQUAL ".so") + FIND_LIBRARY(FIND_DUMMY_SHLIB_VERSIONED + NAMES libdummylib${CMAKE_SHARED_LIBRARY_SUFFIX}.2 + PATHS ${Complex_BINARY_DIR}/Library + DOC "find versioned dummy shared lib" + NO_DEFAULT_PATH) + + IF(NOT FIND_DUMMY_SHLIB_VERSIONED MATCHES "/libdummylib${CMAKE_SHARED_LIBRARY_SUFFIX}.2") + MESSAGE(SEND_ERROR "FIND_DUMMY_SHLIB_VERSIONED is not set correctly: " + "${FIND_DUMMY_SHLIB_VERSIONED}") + ENDIF() +ENDIF() + +# Static library, should work everywhere +FIND_LIBRARY(FIND_DUMMY_STLIB_VERSIONED + NAMES libdummylib${CMAKE_STATIC_LIBRARY_SUFFIX}.2 + PATHS ${Complex_BINARY_DIR}/Library + DOC "find versioned dummy static lib" + NO_DEFAULT_PATH) + +IF(NOT FIND_DUMMY_STLIB_VERSIONED MATCHES "/libdummylib${CMAKE_STATIC_LIBRARY_SUFFIX}.2") + MESSAGE(SEND_ERROR "FIND_DUMMY_STLIB_VERSIONED is not set correctly: " + "${FIND_DUMMY_STLIB_VERSIONED}") +ENDIF() + # # Test SET_SOURCE_FILES_PROPERTIES # diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index e65e362..a21e1b0 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -137,3 +137,14 @@ add_library(imp_lib1 STATIC imp_lib1.c) target_link_libraries(imp_lib1 exp_testLib2) add_library(imp_lib1b STATIC imp_lib1.c) target_link_libraries(imp_lib1b bld_testLib2) + +#----------------------------------------------------------------------------- +# Test that handling imported targets, including transitive dependencies, +# works in CheckFunctionExists (...and hopefully all other try_compile() checks +include(CheckFunctionExists) +unset(HAVE_TESTLIB1_FUNCTION CACHE) +set(CMAKE_REQUIRED_LIBRARIES exp_testLib2) +check_function_exists(testLib1 HAVE_TESTLIB1_FUNCTION) +if (NOT HAVE_TESTLIB1_FUNCTION) + message(SEND_ERROR "Using imported target testLib2 in check_function_exists() failed !") +endif() diff --git a/Tests/README b/Tests/README new file mode 100644 index 0000000..9b0f5c1 --- /dev/null +++ b/Tests/README @@ -0,0 +1,34 @@ +If you think about adding a new testcase then here is a small checklist you +can run through to find a proper place for it. Go through the list from the +beginning and stop once you find something that matches your tests needs, +i.e. if you will test a module and only need the configure mode use the +instructions from section 2, not 3. + +1. Your testcase can run in CMake script mode, i.e. "cmake -P something" + +Put your test in Tests/CMakeTests/ directory as a .cmake.in file. It will be +put into the test binary directory by configure_file(... @ONLY) and run from +there. Use the AddCMakeTest() macro in Tests/CMakeTests/CMakeLists.txt to add +your test to the test runs. + +2. Your test needs CMake to run in configure mode, but will not build anything + +This includes tests that will build something using try_compile() and friends, +but nothing that expects add_executable(), add_library(), or add_test() to run. + +If this matches your test you should put it into the Tests/CMakeOnly/ directory. +Create a subdirectory named like your test and write the CMakeLists.txt you +need into that subdirectory. Use the add_CMakeOnly_test() macro from +Tests/CMakeOnly/CMakeLists.txt to add your test to the test runs. + +3. If you are testing something from the Modules directory + +Put your test in the Tests/Modules/ directory. Create a subdirectory there +named after your test. Use the ADD_TEST_MACRO macro from Tests/CMakeLists.txt +to add your test to the test run. If you have put your stuff in +Tests/Modules/Foo then you call it using ADD_TEST_MACRO(Module.Foo Foo). + +4. You are doing other stuff. + +Find a good place ;) In doubt mail to cmake-developers@cmake.org and ask for +advise. diff --git a/Utilities/KWIML/ABI.h.in b/Utilities/KWIML/ABI.h.in index e95a4ff..e85a1c5 100644 --- a/Utilities/KWIML/ABI.h.in +++ b/Utilities/KWIML/ABI.h.in @@ -380,7 +380,15 @@ suppression macro @KWIML@_ABI_NO_VERIFY was defined. #elif defined(__m68k__) || defined(M68000) # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG -/* MIPS */ +/* MIPSel (MIPS little endian) */ +#elif defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE + +/* MIPSeb (MIPS big endian) */ +#elif defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG + +/* MIPS (fallback, big endian) */ #elif defined(__mips) || defined(__mips__) || defined(__MIPS__) # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index 1d50914..29ce25d6 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -33,12 +33,7 @@ INCLUDE (CheckIncludeFile) INCLUDE (CheckIncludeFiles) INCLUDE (CheckLibraryExists) INCLUDE (CheckSymbolExists) -IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4 - AND CMake_SOURCE_DIR) - INCLUDE (${CMake_SOURCE_DIR}/Modules/CheckTypeSize.cmake) -ELSE() - INCLUDE (CheckTypeSize) -ENDIF() +INCLUDE (CheckTypeSize) SET(libCurl_SRCS # amigaos.c - does not build on AmigaOS @@ -139,7 +134,7 @@ ENDIF(WIN32) # does, it appends library to the list. SET(CURL_LIBS "") MACRO(CHECK_LIBRARY_EXISTS_CONCAT LIBRARY SYMBOL VARIABLE) - CHECK_LIBRARY_EXISTS("${LIBRARY};${CURL_LIBS}" ${SYMBOL} "" + CHECK_LIBRARY_EXISTS("${LIBRARY};${CURL_LIBS}" ${SYMBOL} "" ${VARIABLE}) IF(${VARIABLE}) SET(CURL_LIBS ${CURL_LIBS} ${LIBRARY}) @@ -180,7 +175,7 @@ IF(CMAKE_USE_OPENSSL) SET(USE_SSLEAY TRUE) SET(USE_OPENSSL TRUE) IF(WIN32) - FIND_PATH(SSLINCLUDE openssl/crypto.h + FIND_PATH(SSLINCLUDE openssl/crypto.h PATHS c:/hoffman/Tools/openssl_w32vc6-0.9.8g/inc32) INCLUDE_DIRECTORIES(${SSLINCLUDE}) FIND_LIBRARY(LIBEAY NAMES libeay32) @@ -226,7 +221,7 @@ IF(HAVE_FEATURES_H) getenv.c hash.c http.c - if2ip.c + if2ip.c mprintf.c multi.c sendf.c @@ -292,9 +287,9 @@ ENDIF(NOT CURL_SPECIAL_LIBZ) CHECK_INCLUDE_FILE_CONCAT("sys/socket.h" HAVE_SYS_SOCKET_H) CHECK_INCLUDE_FILE_CONCAT("netinet/in.h" HAVE_NETINET_IN_H) CHECK_INCLUDE_FILE_CONCAT("net/if.h" HAVE_NET_IF_H) -CHECK_INCLUDE_FILE_CONCAT("netinet/if_ether.h" +CHECK_INCLUDE_FILE_CONCAT("netinet/if_ether.h" HAVE_NETINET_IF_ETHER_H) -CHECK_INCLUDE_FILE_CONCAT("netinet/tcp.h" +CHECK_INCLUDE_FILE_CONCAT("netinet/tcp.h" HAVE_NETINET_TCP_H) CHECK_INCLUDE_FILE_CONCAT("sys/select.h" HAVE_SYS_SELECT_H) CHECK_INCLUDE_FILE_CONCAT("utime.h" HAVE_UTIME_H) @@ -426,7 +421,7 @@ IF(CMAKE_USE_OPENSSL) CHECK_SYMBOL_EXISTS(RAND_status "${CURL_INCLUDES}" HAVE_RAND_STATUS) CHECK_SYMBOL_EXISTS(RAND_screen "${CURL_INCLUDES}" HAVE_RAND_SCREEN) CHECK_SYMBOL_EXISTS(RAND_egd "${CURL_INCLUDES}" HAVE_RAND_EGD) - CHECK_SYMBOL_EXISTS(CRYPTO_cleanup_all_ex_data "${CURL_INCLUDES}" + CHECK_SYMBOL_EXISTS(CRYPTO_cleanup_all_ex_data "${CURL_INCLUDES}" HAVE_CRYPTO_CLEANUP_ALL_EX_DATA) ENDIF(CMAKE_USE_OPENSSL) CHECK_SYMBOL_EXISTS(gmtime_r "${CURL_INCLUDES}" HAVE_GMTIME_R) @@ -490,7 +485,7 @@ ENDIF(NOT HAVE_SIGSETJMP) # For other curl specific tests, use this macro. MACRO(CURL_INTERNAL_TEST CURL_TEST) IF("${CURL_TEST}" MATCHES "^${CURL_TEST}$") - SET(MACRO_CHECK_FUNCTION_DEFINITIONS + SET(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${CURL_TEST} ${CMAKE_REQUIRED_FLAGS}") IF(CMAKE_REQUIRED_LIBRARIES) SET(CURL_TEST_ADD_LIBRARIES @@ -507,18 +502,18 @@ MACRO(CURL_INTERNAL_TEST CURL_TEST) IF(${CURL_TEST}) SET(${CURL_TEST} 1 CACHE INTERNAL "Curl test ${FUNCTION}") MESSAGE(STATUS "Performing Curl Test ${CURL_TEST} - Success") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing Curl Test ${CURL_TEST} passed with the following output:\n" "${OUTPUT}\n") ELSE(${CURL_TEST}) MESSAGE(STATUS "Performing Curl Test ${CURL_TEST} - Failed") SET(${CURL_TEST} "" CACHE INTERNAL "Curl test ${FUNCTION}") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing Curl Test ${CURL_TEST} failed with the following output:\n" "${OUTPUT}\n") ENDIF(${CURL_TEST}) ENDIF("${CURL_TEST}" MATCHES "^${CURL_TEST}$") -ENDMACRO(CURL_INTERNAL_TEST) +ENDMACRO(CURL_INTERNAL_TEST) # Do curl specific tests #OPTION(CURL_HAVE_DISABLED_NONBLOCKING "Disable non-blocking socket detection" OFF) @@ -532,7 +527,7 @@ IF(NOT CURL_HAVE_DISABLED_NONBLOCKING) HAVE_SO_NONBLOCK ) ENDIF(NOT CURL_HAVE_DISABLED_NONBLOCKING) -FOREACH(CURL_TEST +FOREACH(CURL_TEST ${CURL_NONBLOCKING_TESTS} TIME_WITH_SYS_TIME HAVE_O_NONBLOCKHAVE_GETHOSTBYADDR_R_5 @@ -632,12 +627,12 @@ SET(CMAKE_REQUIRED_FLAGS) # Check for nonblocking SET(HAVE_DISABLED_NONBLOCKING 1) -IF(HAVE_FIONBIO OR +IF(HAVE_FIONBIO OR HAVE_IOCTLSOCKET OR HAVE_IOCTLSOCKET_CASE OR HAVE_O_NONBLOCK) SET(HAVE_DISABLED_NONBLOCKING) -ENDIF(HAVE_FIONBIO OR +ENDIF(HAVE_FIONBIO OR HAVE_IOCTLSOCKET OR HAVE_IOCTLSOCKET_CASE OR HAVE_O_NONBLOCK) diff --git a/cmake.1 b/cmake.1 deleted file mode 100644 index c7695b4..0000000 --- a/cmake.1 +++ /dev/null @@ -1,112 +0,0 @@ -.\" Hey, EMACS: -*- nroff -*- -.\" First parameter, NAME, should be all caps -.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection -.\" other parameters are allowed: see man(7), man(1) -.TH CMAKE 1 "August 8, 2002" -.\" Please adjust this date whenever revising the manpage. -.\" -.\" Some roff macros, for reference: -.\" .nh disable hyphenation -.\" .hy enable hyphenation -.\" .ad l left justify -.\" .ad b justify to both left and right margins -.\" .nf disable filling -.\" .fi enable filling -.\" .br insert line break -.\" .sp <n> insert n+1 empty lines -.\" for manpage-specific macros, see man(7) -.SH NAME -cmake \- Cross-platform Makefile generator. -.SH SYNOPSIS -.B cmake -.RI < path-to-source > " " [ options ] -.br -.B ccmake -.RI < path-to-source > -.br -.B ctest -.RI [ -R " " < regex > ] -.br -.B cmaketest -.RI < test-src-dir > " " < test-bin-dir > " " < test-executable > -.SH DESCRIPTION - -This manual page documents briefly the \fBcmake\fP, \fBccmake\fP, -\fBctest\fP and \fBcmaketest\fP commands. It is not intended to aid -authors of CMakeLists.txt files or to describe all advanced options -available. For full documentation, please visit -\fBhttp://www.cmake.org\fP. - -.PP -.\" TeX users may be more comfortable with the \fB<whatever>\fP and -.\" \fI<whatever>\fP escape sequences to invode bold face and italics, -.\" respectively. - -CMake provides developers with a means of building their project on -multiple platforms while writing only one build system configuration. -The developer writes a set of CMakeLists.txt files that are read by -CMake and used to generate a native build system for the current -environment. On unix platforms, Makefiles are generated. - -.PP - -\fBcmake\fP is used to generate the makefiles for a project from its -source. The first argument should specify a path to the source tree. -The current directory will be used as the build tree for the project. -Both in-source and out-of-source builds are supported, but -out-of-source builds are preferred. CMake provides functionality for -tailoring the build to user preferences through settings in the cmake -cache. Options may be set interactively using the -i option (or -\fBccmake\fP). Once CMake has generated the makefiles in the build -tree, one may use the standard \fBmake\fP tool to build the project. - -.PP - -\fBccmake\fP provides a curses interface front-end for \fBcmake\fP. -The interface allows users to interactively configure the build -options stored in the cmake cache. This is the preferred interface -for interactive builds. Build scripts should use \fBcmake\fP -directly. - -.PP - -\fBctest\fP runs tests found in the project's build tree after it has -been compiled and displays a summary of test results. Use the -R -option to specify a regular expression of test names to match. - -\fBcmaketest\fP is provided to simplify project testing scripts. It -allows a CMake project to be compiled and tested from a single command -line. - -.SH OPTIONS - -.TP -.B \-\-help -Available for \fBcmake\fP , \fBccmake\fP and \fBcmaketest\fP. -.br -Show version number and summary of options. - -.TP -.B -R regex -Available for \fBctest\fP. -.br -Run only tests matching the given regular expression. - -.TP -.B -i -Available for \fBcmake\fP. -.br -Run cmake in an interactive wizard mode to configure the build. - -.SH SEE ALSO -.BR Dart (1), -.BR VTK (1). - -.SH MAILING LIST -For help using cmake, a mailing list is provided at -\fBcmake@www.cmake.org\fP. Please first read the full documentation -at \fBhttp://www.cmake.org\fP before posting questions to the list. - -.SH AUTHOR -This manual page was written by CMake authors at Kitware -<kitware@kitware.com>. |