diff options
author | Brad King <brad.king@kitware.com> | 2010-12-17 15:31:19 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2010-12-17 15:31:19 (GMT) |
commit | 9bcaff02ff066e9bdd69e3e1e3134aa65c53c121 (patch) | |
tree | 2f46b8a3e84e07b51b20c70065c8a1c26ad47fd5 /Modules | |
parent | 544d0c37742a068fa07b265380315a25af3ae9f3 (diff) | |
parent | 3d13502c986e43f070366d04891c8a3da05e2cb8 (diff) | |
download | CMake-9bcaff02ff066e9bdd69e3e1e3134aa65c53c121.zip CMake-9bcaff02ff066e9bdd69e3e1e3134aa65c53c121.tar.gz CMake-9bcaff02ff066e9bdd69e3e1e3134aa65c53c121.tar.bz2 |
Merge branch 'cmake-guiRememberAdvancedCheckbox' into dev/strict-mode
Conflicts:
Source/QtDialog/CMakeSetupDialog.cxx
Diffstat (limited to 'Modules')
32 files changed, 1214 insertions, 537 deletions
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index 7690094..c7ead5b 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -1,9 +1,11 @@ -# BundleUtilities.cmake +# - Functions to help assemble a standalone bundle application. +# A collection of CMake utility functions useful for dealing with .app +# bundles on the Mac and bundle-like directories on any OS. # -# A collection of CMake utility functions useful for dealing with .app bundles -# on the Mac and bundle-like directories on any OS. -# -# The following functions are provided by this script: +# The following functions are provided by this module: +# fixup_bundle +# copy_and_fixup_bundle +# verify_app # get_bundle_main_executable # get_dotapp_dir # get_bundle_and_executable @@ -15,14 +17,119 @@ # copy_resolved_item_into_bundle # copy_resolved_framework_into_bundle # fixup_bundle_item -# fixup_bundle -# copy_and_fixup_bundle # verify_bundle_prerequisites # verify_bundle_symlinks -# verify_app -# # Requires CMake 2.6 or greater because it uses function, break and # PARENT_SCOPE. Also depends on GetPrerequisites.cmake. +# +# FIXUP_BUNDLE(<app> <libs> <dirs>) +# Fix up a bundle in-place and make it standalone, such that it can be +# drag-n-drop copied to another machine and run on that machine as long as all +# of the system libraries are compatible. +# +# Gather all the keys for all the executables and libraries in a bundle, and +# then, for each key, copy each prerequisite into the bundle. Then fix each one +# up according to its own list of prerequisites. +# +# Then clear all the keys and call verify_app on the final bundle to ensure +# that it is truly standalone. +# +# COPY_AND_FIXUP_BUNDLE(<src> <dst> <libs> <dirs>) +# Makes a copy of the bundle <src> at location <dst> and then fixes up the +# new copied bundle in-place at <dst>... +# +# VERIFY_APP(<app>) +# Verifies that an application <app> appears valid based on running analysis +# tools on it. Calls "message(FATAL_ERROR" if the application is not verified. +# +# GET_BUNDLE_MAIN_EXECUTABLE(<bundle> <result_var>) +# The result will be the full path name of the bundle's main executable file +# or an "error:" prefixed string if it could not be determined. +# +# GET_DOTAPP_DIR(<exe> <dotapp_dir_var>) +# Returns the nearest parent dir whose name ends with ".app" given the full +# path to an executable. If there is no such parent dir, then return a dir at +# the same level as the executable, named with the executable's base name and +# ending with ".app" +# +# The returned directory may or may not exist. +# +# GET_BUNDLE_AND_EXECUTABLE(<app> <bundle_var> <executable_var> <valid_var>) +# Takes either a ".app" directory name or the name of an executable +# nested inside a ".app" directory and returns the path to the ".app" +# directory in <bundle_var> and the path to its main executable in +# <executable_var> +# +# GET_BUNDLE_ALL_EXECUTABLES(<bundle> <exes_var>) +# Scans the given bundle recursively for all executable files and accumulates +# them into a variable. +# +# GET_ITEM_KEY(<item> <key_var>) +# Given a file (item) name, generate a key that should be unique considering +# the set of libraries that need copying or fixing up to make a bundle +# standalone. This is essentially the file name including extension with "." +# replaced by "_" +# +# This key is used as a prefix for CMake variables so that we can associate a +# set of variables with a given item based on its key. +# +# CLEAR_BUNDLE_KEYS(<keys_var>) +# Loop over the list of keys, clearing all the variables associated with each +# key. After the loop, clear the list of keys itself. +# +# Caller of get_bundle_keys should call clear_bundle_keys when done with list +# of keys. +# +# SET_BUNDLE_KEY_VALUES(<keys_var> <context> <item> <exepath> <dirs> +# <copyflag>) +# Add a key to the list (if necessary) for the given item. If added, +# also set all the variables associated with that key. +# +# GET_BUNDLE_KEYS(<app> <libs> <dirs> <keys_var>) +# Loop over all the executable and library files within the bundle (and given +# as extra <libs>) and accumulate a list of keys representing them. Set +# values associated with each key such that we can loop over all of them and +# copy prerequisite libs into the bundle and then do appropriate +# install_name_tool fixups. +# +# COPY_RESOLVED_ITEM_INTO_BUNDLE(<resolved_item> <resolved_embedded_item>) +# Copy a resolved item into the bundle if necessary. Copy is not necessary if +# the resolved_item is "the same as" the resolved_embedded_item. +# +# COPY_RESOLVED_FRAMEWORK_INTO_BUNDLE(<resolved_item> <resolved_embedded_item>) +# Copy a resolved framework into the bundle if necessary. Copy is not necessary +# if the resolved_item is "the same as" the resolved_embedded_item. +# +# By default, BU_COPY_FULL_FRAMEWORK_CONTENTS is not set. If you want full +# frameworks embedded in your bundles, set BU_COPY_FULL_FRAMEWORK_CONTENTS to +# ON before calling fixup_bundle. By default, +# COPY_RESOLVED_FRAMEWORK_INTO_BUNDLE copies the framework dylib itself plus +# the framework Resources directory. +# +# FIXUP_BUNDLE_ITEM(<resolved_embedded_item> <exepath> <dirs>) +# Get the direct/non-system prerequisites of the resolved embedded item. For +# each prerequisite, change the way it is referenced to the value of the +# _EMBEDDED_ITEM keyed variable for that prerequisite. (Most likely changing to +# an "@executable_path" style reference.) +# +# Also, change the id of the item being fixed up to its own _EMBEDDED_ITEM +# value. +# +# Accumulate changes in a local variable and make *one* call to +# install_name_tool at the end of the function with all the changes at once. +# +# If the BU_CHMOD_BUNDLE_ITEMS variable is set then bundle items will be +# marked writable before install_name_tool tries to change them. +# +# VERIFY_BUNDLE_PREREQUISITES(<bundle> <result_var> <info_var>) +# Verifies that the sum of all prerequisites of all files inside the bundle +# are contained within the bundle or are "system" libraries, presumed to exist +# everywhere. +# +# VERIFY_BUNDLE_SYMLINKS(<bundle> <result_var> <info_var>) +# Verifies that any symlinks found in the bundle point to other files that are +# already also in the bundle... Anything that points to an external file causes +# this function to fail the verification. #============================================================================= # Copyright 2008-2009 Kitware, Inc. @@ -44,11 +151,6 @@ get_filename_component(BundleUtilities_cmake_dir "${CMAKE_CURRENT_LIST_FILE}" PA include("${BundleUtilities_cmake_dir}/GetPrerequisites.cmake") -# get_bundle_main_executable -# -# The result will be the full path name of the bundle's main executable file -# or an "error:" prefixed string if it could not be determined. -# function(get_bundle_main_executable bundle result_var) set(result "error: '${bundle}/Contents/Info.plist' file does not exist") @@ -110,15 +212,6 @@ function(get_bundle_main_executable bundle result_var) endfunction(get_bundle_main_executable) -# get_dotapp_dir -# -# Returns the nearest parent dir whose name ends with ".app" given the full path -# to an executable. If there is no such parent dir, then return a dir at the same -# level as the executable, named with the executable's base name and ending with -# ".app" -# -# The returned directory may or may not exist. -# function(get_dotapp_dir exe dotapp_dir_var) set(s "${exe}") @@ -156,13 +249,6 @@ function(get_dotapp_dir exe dotapp_dir_var) endfunction(get_dotapp_dir) -# get_bundle_and_executable -# -# Takes either a ".app" directory name or the name of an executable -# nested inside a ".app" directory and returns the path to the ".app" -# directory in ${bundle_var} and the path to its main executable in -# ${executable_var} -# function(get_bundle_and_executable app bundle_var executable_var valid_var) set(valid 0) @@ -216,11 +302,6 @@ function(get_bundle_and_executable app bundle_var executable_var valid_var) endfunction(get_bundle_and_executable) -# get_bundle_all_executables -# -# Scans the given bundle recursively for all executable files and accumulates -# them into a variable. -# function(get_bundle_all_executables bundle exes_var) set(exes "") @@ -236,15 +317,6 @@ function(get_bundle_all_executables bundle exes_var) endfunction(get_bundle_all_executables) -# get_item_key -# -# Given a file (item) name, generate a key that should be unique considering the set of -# libraries that need copying or fixing up to make a bundle standalone. This is -# essentially the file name including extension with "." replaced by "_" -# -# This key is used as a prefix for CMake variables so that we can associate a set -# of variables with a given item based on its key. -# function(get_item_key item key_var) get_filename_component(item_name "${item}" NAME) if(WIN32) @@ -255,14 +327,6 @@ function(get_item_key item key_var) endfunction(get_item_key) -# clear_bundle_keys -# -# Loop over the list of keys, clearing all the variables associated with each -# key. After the loop, clear the list of keys itself. -# -# Caller of get_bundle_keys should call clear_bundle_keys when done with list -# of keys. -# function(clear_bundle_keys keys_var) foreach(key ${${keys_var}}) set(${key}_ITEM PARENT_SCOPE) @@ -276,11 +340,6 @@ function(clear_bundle_keys keys_var) endfunction(clear_bundle_keys) -# set_bundle_key_values -# -# Add a key to the list (if necessary) for the given item. If added, -# also set all the variables associated with that key. -# function(set_bundle_key_values keys_var context item exepath dirs copyflag) get_filename_component(item_name "${item}" NAME) @@ -336,14 +395,6 @@ function(set_bundle_key_values keys_var context item exepath dirs copyflag) endfunction(set_bundle_key_values) -# get_bundle_keys -# -# Loop over all the executable and library files within the bundle (and given as -# extra "${libs}") and accumulate a list of keys representing them. Set values -# associated with each key such that we can loop over all of them and copy -# prerequisite libs into the bundle and then do appropriate install_name_tool -# fixups. -# function(get_bundle_keys app libs dirs keys_var) set(${keys_var} PARENT_SCOPE) @@ -364,7 +415,7 @@ function(get_bundle_keys app libs dirs keys_var) # but that do not show up in otool -L output...) # foreach(lib ${libs}) - set_bundle_key_values(${keys_var} "${lib}" "${lib}" "${exepath}" "${dirs}" 1) + set_bundle_key_values(${keys_var} "${lib}" "${lib}" "${exepath}" "${dirs}" 0) set(prereqs "") get_prerequisites("${lib}" prereqs 1 1 "${exepath}" "${dirs}") @@ -406,11 +457,6 @@ function(get_bundle_keys app libs dirs keys_var) endfunction(get_bundle_keys) -# copy_resolved_item_into_bundle -# -# Copy a resolved item into the bundle if necessary. Copy is not necessary if -# the resolved_item is "the same as" the resolved_embedded_item. -# function(copy_resolved_item_into_bundle resolved_item resolved_embedded_item) if(WIN32) # ignore case on Windows @@ -434,17 +480,6 @@ function(copy_resolved_item_into_bundle resolved_item resolved_embedded_item) endfunction(copy_resolved_item_into_bundle) -# copy_resolved_framework_into_bundle -# -# Copy a resolved framework into the bundle if necessary. Copy is not necessary -# if the resolved_item is "the same as" the resolved_embedded_item. -# -# By default, BU_COPY_FULL_FRAMEWORK_CONTENTS is not set. If you want full -# frameworks embedded in your bundles, set BU_COPY_FULL_FRAMEWORK_CONTENTS to -# ON before calling fixup_bundle. By default, -# copy_resolved_framework_into_bundle copies the framework dylib itself plus -# any framework Resources. -# function(copy_resolved_framework_into_bundle resolved_item resolved_embedded_item) if(WIN32) # ignore case on Windows @@ -487,18 +522,6 @@ function(copy_resolved_framework_into_bundle resolved_item resolved_embedded_ite endfunction(copy_resolved_framework_into_bundle) -# fixup_bundle_item -# -# Get the direct/non-system prerequisites of the resolved embedded item. For each -# prerequisite, change the way it is referenced to the value of the _EMBEDDED_ITEM -# keyed variable for that prerequisite. (Most likely changing to an "@executable_path" -# style reference.) -# -# Also, change the id of the item being fixed up to its own _EMBEDDED_ITEM value. -# -# Accumulate changes in a local variable and make *one* call to install_name_tool -# at the end of the function with all the changes at once. -# function(fixup_bundle_item resolved_embedded_item exepath dirs) # This item's key is "ikey": # @@ -521,6 +544,10 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs) endif(NOT "${${rkey}_EMBEDDED_ITEM}" STREQUAL "") endforeach(pr) + if(BU_CHMOD_BUNDLE_ITEMS) + execute_process(COMMAND chmod u+w "${resolved_embedded_item}") + endif() + # Change this item's id and all of its references in one call # to install_name_tool: # @@ -530,19 +557,6 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs) endfunction(fixup_bundle_item) -# fixup_bundle -# -# Fix up a bundle in-place and make it standalone, such that it can be drag-n-drop -# copied to another machine and run on that machine as long as all of the system -# libraries are compatible. -# -# Gather all the keys for all the executables and libraries in a bundle, and then, -# for each key, copy each prerequisite into the bundle. Then fix each one up according -# to its own list of prerequisites. -# -# Then clear all the keys and call verify_app on the final bundle to ensure that -# it is truly standalone. -# function(fixup_bundle app libs dirs) message(STATUS "fixup_bundle") message(STATUS " app='${app}'") @@ -617,23 +631,12 @@ function(fixup_bundle app libs dirs) endfunction(fixup_bundle) -# copy_and_fixup_bundle -# -# Makes a copy of the bundle "src" at location "dst" and then fixes up the -# new copied bundle in-place at "dst"... -# function(copy_and_fixup_bundle src dst libs dirs) execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${src}" "${dst}") fixup_bundle("${dst}" "${libs}" "${dirs}") endfunction(copy_and_fixup_bundle) -# verify_bundle_prerequisites -# -# Verifies that the sum of all prerequisites of all files inside the bundle -# are contained within the bundle or are "system" libraries, presumed to exist -# everywhere. -# function(verify_bundle_prerequisites bundle result_var info_var) set(result 1) set(info "") @@ -695,12 +698,6 @@ function(verify_bundle_prerequisites bundle result_var info_var) endfunction(verify_bundle_prerequisites) -# verify_bundle_symlinks -# -# Verifies that any symlinks found in the bundle point to other files that are -# already also in the bundle... Anything that points to an external file causes -# this function to fail the verification. -# function(verify_bundle_symlinks bundle result_var info_var) set(result 1) set(info "") @@ -714,11 +711,6 @@ function(verify_bundle_symlinks bundle result_var info_var) endfunction(verify_bundle_symlinks) -# verify_app -# -# Verifies that an application appears valid based on running analysis tools on it. -# Calls message/FATAL_ERROR if the application is not verified. -# function(verify_app app) set(verified 0) set(info "") diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index b264da1..d7ae8d9 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -21,8 +21,8 @@ IF(CMAKE_COMPILER_IS_MINGW) SET(MINGW 1) ENDIF(CMAKE_COMPILER_IS_MINGW) SET(CMAKE_CXX_COMPILER_ID_RUN 1) -SET(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;H;o;O;obj;OBJ;def;DEF;rc;RC) -SET(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm) +SET(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) +SET(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;CPP) SET(CMAKE_CXX_LINKER_PREFERENCE 30) SET(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake index 5589dfc..0e65bce 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -47,17 +47,17 @@ IF(CMAKE_HOST_UNIX) IF(CMAKE_UNAME) EXEC_PROGRAM(uname ARGS -s OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_NAME) EXEC_PROGRAM(uname ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION) - IF(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux") + IF(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*") EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR RETURN_VALUE val) - ELSE(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux") + ELSE(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*") EXEC_PROGRAM(uname ARGS -p OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR RETURN_VALUE val) IF("${val}" GREATER 0) EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR RETURN_VALUE val) ENDIF("${val}" GREATER 0) - ENDIF(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux") + ENDIF(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*") # check the return of the last uname -m or -p IF("${val}" GREATER 0) SET(CMAKE_HOST_SYSTEM_PROCESSOR "unknown") diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index 7d2d8cd..b5d3072 100644 --- a/Modules/CMakeGenericSystem.cmake +++ b/Modules/CMakeGenericSystem.cmake @@ -52,6 +52,94 @@ IF(CMAKE_GENERATOR MATCHES "Makefiles") ENDIF(DEFINED CMAKE_RULE_MESSAGES) ENDIF(CMAKE_GENERATOR MATCHES "Makefiles") + +# GetDefaultWindowsPrefixBase +# +# Compute the base directory for CMAKE_INSTALL_PREFIX based on: +# - is this 32-bit or 64-bit Windows +# - is this 32-bit or 64-bit CMake running +# - what architecture targets will be built +# +function(GetDefaultWindowsPrefixBase var) + + # Try to guess what architecture targets will end up being built as, + # even if CMAKE_SIZEOF_VOID_P is not computed yet... We need to know + # the architecture of the targets being built to choose the right + # default value for CMAKE_INSTALL_PREFIX. + # + if("${CMAKE_GENERATOR}" MATCHES "Win64") + set(arch_hint "x64") + elseif("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8") + set(arch_hint "x64") + elseif("$ENV{LIB}" MATCHES "(amd64|ia64)") + set(arch_hint "x64") + endif() + + if(NOT arch_hint) + set(arch_hint "x86") + endif() + + # default env in a 64-bit app on Win64: + # ProgramFiles=C:\Program Files + # ProgramFiles(x86)=C:\Program Files (x86) + # ProgramW6432=C:\Program Files + # + # default env in a 32-bit app on Win64: + # ProgramFiles=C:\Program Files (x86) + # ProgramFiles(x86)=C:\Program Files (x86) + # ProgramW6432=C:\Program Files + # + # default env in a 32-bit app on Win32: + # ProgramFiles=C:\Program Files + # ProgramFiles(x86) NOT DEFINED + # ProgramW6432 NOT DEFINED + + # By default, use the ProgramFiles env var as the base value of + # CMAKE_INSTALL_PREFIX: + # + set(_PREFIX_ENV_VAR "ProgramFiles") + + if ("$ENV{ProgramW6432}" STREQUAL "") + # running on 32-bit Windows + # must be a 32-bit CMake, too... + #message("guess: this is a 32-bit CMake running on 32-bit Windows") + else() + # running on 64-bit Windows + if ("$ENV{ProgramW6432}" STREQUAL "$ENV{ProgramFiles}") + # 64-bit CMake + #message("guess: this is a 64-bit CMake running on 64-bit Windows") + if(NOT "${arch_hint}" STREQUAL "x64") + # building 32-bit targets + set(_PREFIX_ENV_VAR "ProgramFiles(x86)") + endif() + else() + # 32-bit CMake + #message("guess: this is a 32-bit CMake running on 64-bit Windows") + if("${arch_hint}" STREQUAL "x64") + # building 64-bit targets + set(_PREFIX_ENV_VAR "ProgramW6432") + endif() + endif() + endif() + + #if("${arch_hint}" STREQUAL "x64") + # message("guess: you are building a 64-bit app") + #else() + # message("guess: you are building a 32-bit app") + #endif() + + if(NOT "$ENV{${_PREFIX_ENV_VAR}}" STREQUAL "") + file(TO_CMAKE_PATH "$ENV{${_PREFIX_ENV_VAR}}" _base) + elseif(NOT "$ENV{SystemDrive}" STREQUAL "") + set(_base "$ENV{SystemDrive}/Program Files") + else() + set(_base "C:/Program Files") + endif() + + set(${var} "${_base}" PARENT_SCOPE) +endfunction() + + # Set a variable to indicate whether the value of CMAKE_INSTALL_PREFIX # was initialized by the block below. This is useful for user # projects to change the default prefix while still allowing the @@ -65,23 +153,11 @@ IF(CMAKE_HOST_UNIX) SET(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Install path prefix, prepended onto install directories.") ELSE(CMAKE_HOST_UNIX) - IF("$ENV{ProgramFiles}" MATCHES "^$") - IF("$ENV{SystemDrive}" MATCHES "^$") - SET(CMAKE_GENERIC_PROGRAM_FILES "C:/Program Files") - ELSE("$ENV{SystemDrive}" MATCHES "^$") - SET(CMAKE_GENERIC_PROGRAM_FILES "$ENV{SystemDrive}/Program Files") - ENDIF("$ENV{SystemDrive}" MATCHES "^$") - ELSE("$ENV{ProgramFiles}" MATCHES "^$") - SET(CMAKE_GENERIC_PROGRAM_FILES "$ENV{ProgramFiles}") - ENDIF("$ENV{ProgramFiles}" MATCHES "^$") + GetDefaultWindowsPrefixBase(CMAKE_GENERIC_PROGRAM_FILES) SET(CMAKE_INSTALL_PREFIX "${CMAKE_GENERIC_PROGRAM_FILES}/${PROJECT_NAME}" CACHE PATH "Install path prefix, prepended onto install directories.") SET(CMAKE_GENERIC_PROGRAM_FILES) - - # Make sure the prefix uses forward slashes. - STRING(REGEX REPLACE "\\\\" "/" - CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") ENDIF(CMAKE_HOST_UNIX) MARK_AS_ADVANCED( diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 439ab4f..3ade3aa 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -83,13 +83,12 @@ # May be used to set RPM packages that are obsoleted by this one. # CPACK_RPM_PACKAGE_RELOCATABLE # Mandatory : NO -# Default : - +# Default : CPACK_PACKAGE_RELOCATABLE # If this variable is set to TRUE or ON CPackRPM will try # to build a relocatable RPM package. A relocatable RPM may # be installed using rpm --prefix or --relocate in order to # install it at an alternate place see rpm(8). -# Note that currently this may fail if the package contains -# files installed with absolute path or CPACK_SET_DESTDIR is set to ON. +# Note that currently this may fail if CPACK_SET_DESTDIR is set to ON. # If CPACK_SET_DESTDIR is set then you will get a warning message # but if there is file installed with absolute path you'll get # unexpected behavior. @@ -331,15 +330,18 @@ ELSE(CPACK_RPM_COMPRESSION_TYPE) SET(CPACK_RPM_COMPRESSION_TYPE_TMP "") ENDIF(CPACK_RPM_COMPRESSION_TYPE) +if(CPACK_PACKAGE_RELOCATABLE) + set(CPACK_RPM_PACKAGE_RELOCATABLE TRUE) +endif(CPACK_PACKAGE_RELOCATABLE) if(CPACK_RPM_PACKAGE_RELOCATABLE) if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: Trying to build a relocatable package") + message("CPackRPM:Debug: Trying to build a relocatable package") endif(CPACK_RPM_PACKAGE_DEBUG) - if(CPACK_SET_DESTDIR) - message(SEND_ERROR "CPackRPM:Warning: CPACK_SET_DESTDIR is set while requesting a relocatable package (CPACK_RPM_PACKAGE_RELOCATABLE is set): this is not supported, the package won't be relocatable.") - else(CPACK_SET_DESTDIR) + if(CPACK_SET_DESTDIR AND (NOT CPACK_SET_DESTDIR STREQUAL "I_ON")) + message("CPackRPM:Warning: CPACK_SET_DESTDIR is set (=${CPACK_SET_DESTDIR}) while requesting a relocatable package (CPACK_RPM_PACKAGE_RELOCATABLE is set): this is not supported, the package won't be relocatable.") + else(CPACK_SET_DESTDIR AND (NOT CPACK_SET_DESTDIR STREQUAL "I_ON")) set(CPACK_RPM_PACKAGE_PREFIX ${CPACK_PACKAGING_INSTALL_PREFIX}) - endif(CPACK_SET_DESTDIR) + endif(CPACK_SET_DESTDIR AND (NOT CPACK_SET_DESTDIR STREQUAL "I_ON")) endif(CPACK_RPM_PACKAGE_RELOCATABLE) # check if additional fields for RPM spec header are given @@ -463,6 +465,34 @@ EXECUTE_PROCESS(COMMAND find -type f -o -type l WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}" OUTPUT_VARIABLE CPACK_RPM_INSTALL_FILES) +if (CPACK_ABSOLUTE_DESTINATION_FILES) + IF(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: Handling Absolute Destination Files: ${CPACK_ABSOLUTE_DESTINATION_FILES}") + ENDIF(CPACK_RPM_PACKAGE_DEBUG) + # Remove trailing space + string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST) + # Transform endline separated - string into CMake List + string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES_LIST}") + # Remove unecessary quotes + string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES_LIST}") + # Remove ABSOLUTE install file from INSTALL FILE LIST + list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${CPACK_ABSOLUTE_DESTINATION_FILES}) + # Rebuild INSTALL_FILES + set(CPACK_RPM_INSTALL_FILES "") + foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST) + set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n") + endforeach(F) + # Build ABSOLUTE_INSTALL_FILES + set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "") + foreach(F IN LISTS CPACK_ABSOLUTE_DESTINATION_FILES) + set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "${CPACK_RPM_ABSOLUTE_INSTALL_FILES}%config \"${F}\"\n") + endforeach(F) + IF(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: CPACK_RPM_ABSOLUTE_INSTALL_FILES=${CPACK_RPM_ABSOLUTE_INSTALL_FILES}") + message("CPackRPM:Debug: CPACK_RPM_INSTALL_FILES=${CPACK_RPM_INSTALL_FILES}") + ENDIF(CPACK_RPM_PACKAGE_DEBUG) +endif(CPACK_ABSOLUTE_DESTINATION_FILES) + # The name of the final spec file to be used by rpmbuild SET(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}.spec") @@ -547,6 +577,7 @@ fi %files %defattr(-,root,root,-) ${CPACK_RPM_INSTALL_FILES} +${CPACK_RPM_ABSOLUTE_INSTALL_FILES} %changelog \@CPACK_RPM_SPEC_CHANGELOG\@ diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake index e3157fa..bb76ddd 100644 --- a/Modules/CTest.cmake +++ b/Modules/CTest.cmake @@ -228,8 +228,10 @@ IF(BUILD_TESTING) ENDIF(NOT BUILDNAME) # the build command - BUILD_COMMAND(MAKECOMMAND CONFIGURATION "\${CTEST_CONFIGURATION_TYPE}") - SET(MAKECOMMAND ${MAKECOMMAND} CACHE STRING "Command to build the project") + BUILD_COMMAND(MAKECOMMAND_DEFAULT_VALUE + CONFIGURATION "\${CTEST_CONFIGURATION_TYPE}") + SET(MAKECOMMAND ${MAKECOMMAND_DEFAULT_VALUE} + CACHE STRING "Command to build the project") # the default build configuration the ctest build handler will use # if there is no -C arg given to ctest: diff --git a/Modules/CTestTargets.cmake b/Modules/CTestTargets.cmake index 835328c..e3ef86c 100644 --- a/Modules/CTestTargets.cmake +++ b/Modules/CTestTargets.cmake @@ -65,6 +65,7 @@ IF(NOT _CTEST_TARGETS_ADDED) ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode} ) SET_PROPERTY(TARGET ${mode} PROPERTY RULE_LAUNCH_CUSTOM "") + SET_PROPERTY(TARGET ${mode} PROPERTY FOLDER "CTestDashboardTargets") ENDFOREACH(mode) # For Makefile generators add more granular targets. @@ -79,6 +80,7 @@ IF(NOT _CTEST_TARGETS_ADDED) ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}${testtype} ) SET_PROPERTY(TARGET ${mode}${testtype} PROPERTY RULE_LAUNCH_CUSTOM "") + SET_PROPERTY(TARGET ${mode}${testtype} PROPERTY FOLDER "CTestDashboardTargets") ENDFOREACH(testtype) ENDFOREACH(mode) ENDIF("${CMAKE_GENERATOR}" MATCHES Make) diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake index c4a97d5..594e2e7 100644 --- a/Modules/FeatureSummary.cmake +++ b/Modules/FeatureSummary.cmake @@ -1,23 +1,100 @@ # - Macros for generating a summary of enabled/disabled features # -# PRINT_ENABLED_FEATURES() -# Print a summary of all enabled features. By default all successfull -# FIND_PACKAGE() calls will appear here, except the ones which used the -# QUIET keyword. Additional features can be added by appending an entry -# to the global ENABLED_FEATURES property. If SET_FEATURE_INFO() is -# used for that feature, the output will be much more informative. +# This module provides the macros feature_summary(), set_package_info() and +# add_feature_info(). +# For compatiblity it also still provides set_feature_info(), +# print_enabled_features() and print_disabled_features. # -# PRINT_DISABLED_FEATURES() -# Same as PRINT_ENABLED_FEATURES(), but for disabled features. It can -# be extended the same way by adding to the global property -# DISABLED_FEATURES. +# These macros can be used to generate a summary of enabled and disabled +# packages and/or feature for a build tree: # -# SET_FEATURE_INFO(NAME DESCRIPTION [URL [COMMENT] ] ) -# Use this macro to set up information about the named feature, which will -# then be displayed by PRINT_ENABLED/DISABLED_FEATURES(). -# Example: SET_FEATURE_INFO(LibXml2 "XML processing library." -# "http://xmlsoft.org/") +# -- Enabled features: +# LibXml2 (required version >= 2.4) , XML processing library. , <http://xmlsoft.org> +# PNG , A PNG image library. , <http://www.libpng.org/pub/png/> +# -- Disabled features: +# Lua51 , The Lua scripting language. , <http://www.lua.org> +# Foo , Foo provides cool stuff. # +# +# FEATURE_SUMMARY( [FILENAME <file>] +# [APPEND] +# [VAR <variable_name>] +# [DESCRIPTION "Found packages:"] +# WHAT (ALL | PACKAGES_FOUND | PACKAGES_NOT_FOUND +# | ENABLED_FEATURES | DISABLED_FEATURES] +# ) +# +# The FEATURE_SUMMARY() macro can be used to print information about enabled +# or disabled features or packages of a project. +# By default, only the names of the features/packages will be printed and their +# required version when one was specified. Use SET_FEATURE_INFO() to add more +# useful information, like e.g. a download URL for the respective package. +# +# The WHAT option is the only mandatory option. Here you specify what information +# will be printed: +# ENABLED_FEATURES: the list of all features and packages which are enabled, +# excluding the QUIET packages +# DISABLED_FEATURES: the list of all features and packages which are disabled, +# excluding the QUIET packages +# PACKAGES_FOUND: the list of all packages which have been found +# PACKAGES_NOT_FOUND: the list of all packages which have not been found +# ALL: this will give all packages which have or have not been found +# +# If a FILENAME is given, the information is printed into this file. If APPEND +# is used, it is appended to this file, otherwise the file is overwritten if +# it already existed. +# If the VAR option is used, the information is "printed" into the specified +# variable. +# If FILENAME is not used, the information is printed to the terminal. +# Using the DESCRIPTION option a description or headline can be set which will +# be printed above the actual content. +# +# Example 1, append everything to a file: +# feature_summary(WHAT ALL +# FILENAME ${CMAKE_BINARY_DIR}/all.log APPEND) +# +# Example 2, print the enabled features into the variable enabledFeaturesText: +# feature_summary(WHAT ENABLED_FEATURES +# DESCRIPTION "Enabled Features:" +# VAR enabledFeaturesText) +# message(STATUS "${enabledFeaturesText}") +# +# +# SET_PACKAGE_INFO(<name> <description> [<url> [<comment>] ] ) +# Use this macro to set up information about the named package, which can +# then be displayed via FEATURE_SUMMARY(). +# This can be done either directly in the Find-module or in the project +# which uses the module after the FIND_PACKAGE() call. +# The features for which information can be set are added automatically by the +# find_package() command. +# +# Example for setting the info for a package: +# find_package(LibXml2) +# set_package_info(LibXml2 "XML processing library." "http://xmlsoft.org/") +# +# +# ADD_FEATURE_INFO(<name> <enabled> <description>) +# Use this macro to add information about a feature with the given <name>. +# <enabled> contains whether this feature is enabled or not, <description> +# is a text descibing the feature. +# The information can be displayed using feature_summary() for ENABLED_FEATURES +# and DISABLED_FEATURES respectively. +# +# Example for setting the info for a feature: +# option(WITH_FOO "Help for foo" ON) +# add_feature_info(Foo WITH_FOO "The Foo feature provides very cool stuff.") +# +# +# The following macros are provided for compatibility with previous CMake versions: +# +# PRINT_ENABLED_FEATURES() +# Does the same as FEATURE_SUMMARY(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:") +# +# PRINT_DISABLED_FEATURES() +# Does the same as FEATURE_SUMMARY(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:") +# +# SET_FEATURE_INFO(<name> <description> [<url> [<comment>] ] ) +# Does the same as SET_PACKAGE_INFO(<name> <description> <url> <comment> ) #============================================================================= # Copyright 2007-2009 Kitware, Inc. @@ -32,47 +109,121 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FUNCTION(SET_FEATURE_INFO _name _desc) +INCLUDE(CMakeParseArguments) + + +FUNCTION(ADD_FEATURE_INFO _name _enabled _desc) + IF (${_enabled}) + SET_PROPERTY(GLOBAL APPEND PROPERTY ENABLED_FEATURES "${_name}") + ELSE () + SET_PROPERTY(GLOBAL APPEND PROPERTY DISABLED_FEATURES "${_name}") + ENDIF () + + SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_desc}" ) +ENDFUNCTION(SET_FEATURE_INFO) + + +FUNCTION(SET_FEATURE_INFO) + SET_PACKAGE_INFO(${ARGN}) +ENDFUNCTION(SET_FEATURE_INFO) + + +FUNCTION(SET_PACKAGE_INFO _name _desc) SET(_url "${ARGV2}") SET(_comment "${ARGV3}") - SET_PROPERTY(GLOBAL PROPERTY ${_name}_DESCRIPTION "${_desc}" ) + SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_desc}" ) IF(_url MATCHES ".+") - SET_PROPERTY(GLOBAL PROPERTY ${_name}_URL "${_url}" ) + SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_URL "${_url}" ) ENDIF(_url MATCHES ".+") IF(_comment MATCHES ".+") - SET_PROPERTY(GLOBAL PROPERTY ${_name}_COMMENT "${_comment}" ) + SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_COMMENT "${_comment}" ) ENDIF(_comment MATCHES ".+") -ENDFUNCTION(SET_FEATURE_INFO) +ENDFUNCTION(SET_PACKAGE_INFO) -FUNCTION(_PRINT_FEATURES _property _text) - SET(_currentFeatureText "${_text}") +FUNCTION(_FS_GET_FEATURE_SUMMARY _property _var) + SET(_currentFeatureText "") GET_PROPERTY(_EnabledFeatures GLOBAL PROPERTY ${_property}) FOREACH(_currentFeature ${_EnabledFeatures}) SET(_currentFeatureText "${_currentFeatureText}\n${_currentFeature}") - GET_PROPERTY(_info GLOBAL PROPERTY ${_currentFeature}_DESCRIPTION) + GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_REQUIRED_VERSION) + IF(_info) + SET(_currentFeatureText "${_currentFeatureText} (required version ${_info})") + ENDIF(_info) + GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_DESCRIPTION) IF(_info) SET(_currentFeatureText "${_currentFeatureText} , ${_info}") ENDIF(_info) - GET_PROPERTY(_info GLOBAL PROPERTY ${_currentFeature}_URL) + GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_URL) IF(_info) SET(_currentFeatureText "${_currentFeatureText} , <${_info}>") ENDIF(_info) - GET_PROPERTY(_info GLOBAL PROPERTY ${_currentFeature}_COMMENT) + GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_COMMENT) IF(_info) SET(_currentFeatureText "${_currentFeatureText} , ${_info}") ENDIF(_info) ENDFOREACH(_currentFeature) - MESSAGE(STATUS "${_currentFeatureText}\n") -ENDFUNCTION(_PRINT_FEATURES) + SET(${_var} "${_currentFeatureText}" PARENT_SCOPE) +ENDFUNCTION(_FS_GET_FEATURE_SUMMARY) FUNCTION(PRINT_ENABLED_FEATURES) - _PRINT_FEATURES( ENABLED_FEATURES "Enabled features:") + FEATURE_SUMMARY(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:") ENDFUNCTION(PRINT_ENABLED_FEATURES) FUNCTION(PRINT_DISABLED_FEATURES) - _PRINT_FEATURES( DISABLED_FEATURES "Disabled features:") + FEATURE_SUMMARY(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:") ENDFUNCTION(PRINT_DISABLED_FEATURES) + + +FUNCTION(FEATURE_SUMMARY) +# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...) + SET(options APPEND) + SET(oneValueArgs FILENAME VAR DESCRIPTION WHAT) + SET(multiValueArgs ) # none + + CMAKE_PARSE_ARGUMENTS(_FS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN}) + + IF(_FS_UNPARSED_ARGUMENTS) + MESSAGE(FATAL_ERROR "Unknown keywords given to FEATURE_SUMMARY(): \"${_FS_UNPARSED_ARGUMENTS}\"") + ENDIF(_FS_UNPARSED_ARGUMENTS) + + IF(NOT _FS_WHAT) + MESSAGE(FATAL_ERROR "The call to FEATURE_SUMMAY() doesn't set the required WHAT argument.") + ENDIF(NOT _FS_WHAT) + + IF( "${_FS_WHAT}" STREQUAL "ENABLED_FEATURES" + OR "${_FS_WHAT}" STREQUAL "DISABLED_FEATURES" + OR "${_FS_WHAT}" STREQUAL "PACKAGES_FOUND" + OR "${_FS_WHAT}" STREQUAL "PACKAGES_NOT_FOUND") + _FS_GET_FEATURE_SUMMARY( ${_FS_WHAT} _featureSummary) + ELSEIF("${_FS_WHAT}" STREQUAL "ALL") + _FS_GET_FEATURE_SUMMARY( PACKAGES_FOUND _tmp1) + _FS_GET_FEATURE_SUMMARY( PACKAGES_NOT_FOUND _tmp2) + SET(_featureSummary "${_tmp1}${_tmp2}") + ELSE() + MESSAGE(FATAL_ERROR "The WHAT argument of FEATURE_SUMMARY() is set to ${_FS_WHAT}, which is not a valid value.") + ENDIF() + + SET(_fullText "${_FS_DESCRIPTION}${_featureSummary}\n") + + IF(_FS_FILENAME) + IF(_FS_APPEND) + FILE(WRITE "${_FS_FILENAME}" "${_fullText}") + ELSE(_FS_APPEND) + FILE(APPEND "${_FS_FILENAME}" "${_fullText}") + ENDIF(_FS_APPEND) + + ELSE(_FS_FILENAME) + IF(NOT _FS_VAR) + MESSAGE(STATUS "${_fullText}") + ENDIF(NOT _FS_VAR) + ENDIF(_FS_FILENAME) + + IF(_FS_VAR) + SET(${_FS_VAR} "${_fullText}" PARENT_SCOPE) + ENDIF(_FS_VAR) + +ENDFUNCTION(FEATURE_SUMMARY) diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake index 0c622fb..6021b12 100644 --- a/Modules/FindBISON.cmake +++ b/Modules/FindBISON.cmake @@ -96,7 +96,7 @@ IF(BISON_EXECUTABLE) # MACRO(BISON_TARGET Name BisonInput BisonOutput) SET(BISON_TARGET_output_header "") - SET(BISON_TARGET_command_opt "") + SET(BISON_TARGET_cmdopt "") SET(BISON_TARGET_outputs "${BisonOutput}") IF(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7) MESSAGE(SEND_ERROR "Usage") diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 1a1b168..2377e10 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -17,8 +17,10 @@ # # == Using actual libraries from within Boost: == # -# set(Boost_USE_STATIC_LIBS ON) -# set(Boost_USE_MULTITHREADED ON) +# set(Boost_USE_STATIC_LIBS ON) +# set(Boost_USE_MULTITHREADED ON) +# set(Boost_USE_STATIC_RUNTIME OFF) +# set(Boost_COMPAT_STATIC_RUNTIME OFF) # find_package( Boost 1.36.0 COMPONENTS date_time filesystem system ... ) # # if(Boost_FOUND) @@ -84,6 +86,42 @@ # Boost_USE_STATIC_LIBS Can be set to ON to force the use of the static # boost libraries. Defaults to OFF. # +# Boost_NO_SYSTEM_PATHS Set to TRUE to suppress searching in system +# paths (or other locations outside of BOOST_ROOT +# or BOOST_INCLUDEDIR). Useful when specifying +# BOOST_ROOT. Defaults to OFF. +# [Since CMake 2.8.3] +# +# Boost_USE_STATIC_RUNTIME If enabled, searches for boost libraries +# linked against a static C++ standard library +# ('s' ABI tag). Defaults to OFF. +# [Since CMake 2.8.3] +# +# Boost_USE_DEBUG_PYTHON If enabled, searches for boost libraries +# compiled against a special debug build of +# Python ('y' ABI tag). Defaults to OFF. +# [Since CMake 2.8.3] +# +# Boost_USE_STLPORT If enabled, searches for boost libraries +# compiled against the STLPort standard +# library ('p' ABI tag). Defaults to OFF. +# [Since CMake 2.8.3] +# +# Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS +# If enabled, searches for boost libraries +# compiled against the deprecated STLPort +# "native iostreams" feature ('n' ABI tag). +# Defaults to OFF. +# [Since CMake 2.8.3] +# +# Boost_COMPAT_STATIC_RUNTIME Set to OFF to disable backwards compatible +# searching for libraries with the 's' ABI +# tag on WIN32 after normal searches. You +# should set this to OFF and also set +# Boost_USE_STATIC_RUNTIME appropriately. +# If not specified, defaults to ON. +# [Since CMake 2.8.3] +# # Other Variables used by this module which you may want to set. # # Boost_ADDITIONAL_VERSIONS A list of version numbers to use for searching @@ -106,11 +144,37 @@ # (e.g. "-gcc43") if FindBoost has problems finding # the proper Boost installation # +# Boost_THREADAPI When building boost.thread, sometimes the name of the +# library contains an additional "pthread" or "win32" +# string known as the threadapi. This can happen when +# compiling against pthreads on Windows or win32 threads +# on Cygwin. You may specify this variable and if set +# when FindBoost searches for the Boost threading library +# it will first try to match the threadapi you specify. +# For Example: libboost_thread_win32-mgw45-mt-1_43.a +# might be found if you specified "win32" here before +# falling back on libboost_thread-mgw45-mt-1_43.a. +# [Since CMake 2.8.3] +# +# Boost_REALPATH Resolves symbolic links for discovered boost libraries +# to assist with packaging. For example, instead of +# Boost_SYSTEM_LIBRARY_RELEASE being resolved to +# "/usr/lib/libboost_system.so" it would be +# "/usr/lib/libboost_system.so.1.42.0" instead. +# This does not affect linking and should not be +# enabled unless the user needs this information. +# [Since CMake 2.8.3] +# + + +# # These last three variables are available also as environment variables: # # BOOST_ROOT or BOOSTROOT The preferred installation prefix for searching for # Boost. Set this if the module has problems finding -# the proper Boost installation. +# the proper Boost installation. To prevent falling +# back on the system paths, set Boost_NO_SYSTEM_PATHS +# to true. # # BOOST_INCLUDEDIR Set this to the include directory of Boost, if the # module has problems finding the proper Boost installation @@ -165,7 +229,7 @@ # Copyright 2007 Wengo # Copyright 2007 Mike Jackson # Copyright 2008 Andreas Pakulat <apaku@gmx.de> -# Copyright 2008-2009 Philip Lowman <philip@yhbt.com> +# Copyright 2008-2010 Philip Lowman <philip@yhbt.com> # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -276,6 +340,28 @@ function(_Boost_MARK_COMPONENTS_FOUND _yes_or_no) endfunction() # +# Take a list of libraries with "thread" in it +# and prepend duplicates with "thread_${Boost_THREADAPI}" +# at the front of the list +# +function(_Boost_PREPEND_LIST_WITH_THREADAPI _output) + set(_orig_libnames ${ARGN}) + string(REPLACE "thread" "thread_${Boost_THREADAPI}" _threadapi_libnames ${_orig_libnames}) + set(${_output} ${_threadapi_libnames} ${_orig_libnames} PARENT_SCOPE) +endfunction() + +# +# If a library is found, replace its cache entry with its REALPATH +# +function(_Boost_SWAP_WITH_REALPATH _library _docstring) + if(${_library}) + get_filename_component(_boost_filepathreal ${${_library}} REALPATH) + unset(${_library} CACHE) + set(${_library} ${_boost_filepathreal} CACHE FILEPATH "${_docstring}") + endif() +endfunction() + +# # End functions/macros # #------------------------------------------------------------------------------- @@ -286,6 +372,9 @@ endfunction() IF(NOT DEFINED Boost_USE_MULTITHREADED) SET(Boost_USE_MULTITHREADED TRUE) ENDIF() +if(NOT DEFINED Boost_COMPAT_STATIC_RUNTIME) + set(Boost_COMPAT_STATIC_RUNTIME TRUE) +endif() if(Boost_FIND_VERSION_EXACT) # The version may appear in a directory with or without the patch @@ -366,7 +455,7 @@ IF (_boost_IN_CACHE) if(Boost_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " "boost ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION} " - "is already in the cache. For debugging messages, please clear the cache.") + "is already in the cache. To view debugging messages, please clear the cache.") endif() ELSE (_boost_IN_CACHE) # Need to search for boost @@ -380,6 +469,12 @@ ELSE (_boost_IN_CACHE) "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}") message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_USE_STATIC_RUNTIME = ${Boost_USE_STATIC_RUNTIME}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_ADDITIONAL_VERSIONS = ${Boost_ADDITIONAL_VERSIONS}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}") endif() IF(WIN32) @@ -404,7 +499,7 @@ ELSE (_boost_IN_CACHE) "-DBOOST_LIB_DIAGNOSTIC" CACHE STRING "Boost diagnostic define") ENDIF(WIN32) - SET(_boost_INCLUDE_SEARCH_DIRS + set(_boost_INCLUDE_SEARCH_DIRS_SYSTEM C:/boost/include C:/boost "$ENV{ProgramFiles}/boost/include" @@ -412,6 +507,13 @@ ELSE (_boost_IN_CACHE) /sw/local/include ) + # If Boost_ROOT was defined, gently correct the user + if(Boost_ROOT) + message("WARNING: Boost_ROOT was set which is incorrect and is being ignored. " + "You need to use BOOST_ROOT instead. " + "Also, we suggest setting Boost_NO_SYSTEM_PATHS.") + endif() + # If BOOST_ROOT was defined in the environment, use it. if (NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "") set(BOOST_ROOT $ENV{BOOST_ROOT}) @@ -449,18 +551,25 @@ ELSE (_boost_IN_CACHE) "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}") endif() - IF( BOOST_ROOT ) - SET(_boost_INCLUDE_SEARCH_DIRS - ${BOOST_ROOT}/include + if( Boost_NO_SYSTEM_PATHS) + set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH) + else() + set(_boost_INCLUDE_SEARCH_DIRS ${_boost_INCLUDE_SEARCH_DIRS_SYSTEM}) + endif() + + if( BOOST_ROOT ) + set(_boost_INCLUDE_SEARCH_DIRS + ${BOOST_ROOT}/include ${BOOST_ROOT} ${_boost_INCLUDE_SEARCH_DIRS}) - ENDIF( BOOST_ROOT ) + endif() - IF( BOOST_INCLUDEDIR ) + # prepend BOOST_INCLUDEDIR to search path if specified + if( BOOST_INCLUDEDIR ) file(TO_CMAKE_PATH ${BOOST_INCLUDEDIR} BOOST_INCLUDEDIR) - SET(_boost_INCLUDE_SEARCH_DIRS + set(_boost_INCLUDE_SEARCH_DIRS ${BOOST_INCLUDEDIR} ${_boost_INCLUDE_SEARCH_DIRS}) - ENDIF( BOOST_INCLUDEDIR ) + endif( BOOST_INCLUDEDIR ) # ------------------------------------------------------------------------ # Search for Boost include DIR @@ -486,10 +595,7 @@ ELSE (_boost_IN_CACHE) ENDIF() list(APPEND _boost_PATH_SUFFIXES "boost-${_boost_BOOSTIFIED_VERSION}") - if(WIN32) - # For BoostPro's underscores (and others?) - list(APPEND _boost_PATH_SUFFIXES "boost_${_boost_BOOSTIFIED_VERSION}") - endif() + list(APPEND _boost_PATH_SUFFIXES "boost_${_boost_BOOSTIFIED_VERSION}") ENDFOREACH(_boost_VER) @@ -507,6 +613,7 @@ ELSE (_boost_IN_CACHE) NAMES boost/config.hpp HINTS ${_boost_INCLUDE_SEARCH_DIRS} PATH_SUFFIXES ${_boost_PATH_SUFFIXES} + ${_boost_FIND_OPTIONS} ) ENDIF( NOT Boost_INCLUDE_DIR ) @@ -637,7 +744,7 @@ ELSE (_boost_IN_CACHE) endif() endif(Boost_COMPILER) - SET (_boost_MULTITHREADED "-mt") + set (_boost_MULTITHREADED "-mt") if( NOT Boost_USE_MULTITHREADED ) set (_boost_MULTITHREADED "") endif() @@ -646,32 +753,67 @@ ELSE (_boost_IN_CACHE) "_boost_MULTITHREADED = ${_boost_MULTITHREADED}") endif() - SET( _boost_STATIC_TAG "") - set( _boost_ABI_TAG "") - IF (WIN32) - IF(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" + #====================== + # Systematically build up the Boost ABI tag + # http://boost.org/doc/libs/1_41_0/more/getting_started/windows.html#library-naming + set( _boost_RELEASE_ABI_TAG "-") + set( _boost_DEBUG_ABI_TAG "-") + # Key Use this library when: + # s linking statically to the C++ standard library and + # compiler runtime support libraries. + if(Boost_USE_STATIC_RUNTIME) + set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}s") + set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}s") + endif() + # g using debug versions of the standard and runtime + # support libraries + if(WIN32) + if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc") - SET (_boost_ABI_TAG "g") - ENDIF() - IF( Boost_USE_STATIC_LIBS ) - SET( _boost_STATIC_TAG "-s") - ENDIF( Boost_USE_STATIC_LIBS ) - ENDIF(WIN32) - SET (_boost_ABI_TAG "${_boost_ABI_TAG}d") + set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g") + endif() + endif() + # y using special debug build of python + if(Boost_USE_DEBUG_PYTHON) + set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}y") + endif() + # d using a debug version of your code + set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}d") + # p using the STLport standard library rather than the + # default one supplied with your compiler + if(Boost_USE_STLPORT) + set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}p") + set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}p") + endif() + # n using the STLport deprecated "native iostreams" feature + if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS) + set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}n") + set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}n") + endif() + if(Boost_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_STATIC_TAG = ${_boost_STATIC_TAG}") + "_boost_RELEASE_ABI_TAG = ${_boost_RELEASE_ABI_TAG}") message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_ABI_TAG = ${_boost_ABI_TAG}") + "_boost_DEBUG_ABI_TAG = ${_boost_DEBUG_ABI_TAG}") endif() # ------------------------------------------------------------------------ # Begin finding boost libraries # ------------------------------------------------------------------------ - SET(_boost_LIBRARIES_SEARCH_DIRS + if(BOOST_ROOT) + set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS + ${BOOST_ROOT}/lib + ${BOOST_ROOT}/stage/lib) + endif() + set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS + ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS} ${Boost_INCLUDE_DIR}/lib ${Boost_INCLUDE_DIR}/../lib + ${Boost_INCLUDE_DIR}/stage/lib + ) + set(_boost_LIBRARY_SEARCH_DIRS_SYSTEM C:/boost/lib C:/boost "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}_${Boost_SUBMINOR_VERSION}/lib" @@ -680,67 +822,146 @@ ELSE (_boost_IN_CACHE) "$ENV{ProgramFiles}/boost" /sw/local/lib ) - IF( BOOST_ROOT ) - SET(_boost_LIBRARIES_SEARCH_DIRS - ${BOOST_ROOT}/lib - ${BOOST_ROOT}/stage/lib - ${_boost_LIBRARIES_SEARCH_DIRS}) - ENDIF( BOOST_ROOT ) + set(_boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS}) + if( Boost_NO_SYSTEM_PATHS ) + set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH) + else() + list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_SYSTEM}) + endif() - IF( BOOST_LIBRARYDIR ) + # prepend BOOST_LIBRARYDIR to search path if specified + if( BOOST_LIBRARYDIR ) file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR) - SET(_boost_LIBRARIES_SEARCH_DIRS - ${BOOST_LIBRARYDIR} ${_boost_LIBRARIES_SEARCH_DIRS}) - ENDIF( BOOST_LIBRARYDIR ) + set(_boost_LIBRARY_SEARCH_DIRS + ${BOOST_LIBRARYDIR} ${_boost_LIBRARY_SEARCH_DIRS}) + endif() if(Boost_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_LIBRARIES_SEARCH_DIRS = ${_boost_LIBRARIES_SEARCH_DIRS}") + "_boost_LIBRARY_SEARCH_DIRS = ${_boost_LIBRARY_SEARCH_DIRS}") endif() - FOREACH(COMPONENT ${Boost_FIND_COMPONENTS}) - STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT) - SET( Boost_${UPPERCOMPONENT}_LIBRARY "Boost_${UPPERCOMPONENT}_LIBRARY-NOTFOUND" ) - SET( Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE-NOTFOUND" ) - SET( Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG-NOTFOUND") - - # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES - IF( Boost_USE_STATIC_LIBS ) - SET( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - IF(WIN32) - SET(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - ELSE(WIN32) - SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - ENDIF(WIN32) - ENDIF( Boost_USE_STATIC_LIBS ) - - FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE - NAMES ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT} - HINTS ${_boost_LIBRARIES_SEARCH_DIRS} + # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES + if( Boost_USE_STATIC_LIBS ) + set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + if(WIN32) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ) + endif() + endif() + + # We want to use the tag inline below without risking double dashes + if(_boost_RELEASE_ABI_TAG) + if(${_boost_RELEASE_ABI_TAG} STREQUAL "-") + set(_boost_RELEASE_ABI_TAG "") + endif() + endif() + if(_boost_DEBUG_ABI_TAG) + if(${_boost_DEBUG_ABI_TAG} STREQUAL "-") + set(_boost_DEBUG_ABI_TAG "") + endif() + endif() + + # The previous behavior of FindBoost when Boost_USE_STATIC_LIBS was enabled + # on WIN32 was to: + # 1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found) + # 2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found) + # We maintain this behavior since changing it could break people's builds. + # To disable the ambiguous behavior, the user can + # set Boost_COMPAT_STATIC_RUNTIME to FALSE + set(_boost_STATIC_RUNTIME_WORKAROUND false) + if(Boost_COMPAT_STATIC_RUNTIME AND WIN32 AND Boost_USE_STATIC_LIBS) + if(NOT Boost_USE_STATIC_RUNTIME) + set(_boost_STATIC_RUNTIME_WORKAROUND true) + endif() + endif() + + + foreach(COMPONENT ${Boost_FIND_COMPONENTS}) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) + set( Boost_${UPPERCOMPONENT}_LIBRARY "Boost_${UPPERCOMPONENT}_LIBRARY-NOTFOUND" ) + set( Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE-NOTFOUND" ) + set( Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG-NOTFOUND") + + set( _boost_docstring_release "Boost ${COMPONENT} library (release)") + set( _boost_docstring_debug "Boost ${COMPONENT} library (debug)") + + # + # Find RELEASE libraries + # + set(_boost_RELEASE_NAMES + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT} ) + if(_boost_STATIC_RUNTIME_WORKAROUND) + set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}") + list(APPEND _boost_RELEASE_NAMES + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} ) + endif() + if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") + _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES}) + endif() + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}") + endif() + find_library(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE + NAMES ${_boost_RELEASE_NAMES} + HINTS ${_boost_LIBRARY_SEARCH_DIRS} + ${_boost_FIND_OPTIONS} + DOC "${_boost_docstring_release}" ) - FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG - NAMES ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${_boost_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}-${_boost_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}-${_boost_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_boost_ABI_TAG} - HINTS ${_boost_LIBRARIES_SEARCH_DIRS} + # + # Find DEBUG libraries + # + set(_boost_DEBUG_NAMES + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED} + ${Boost_LIB_PREFIX}boost_${COMPONENT} ) + if(_boost_STATIC_RUNTIME_WORKAROUND) + set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}") + list(APPEND _boost_DEBUG_NAMES + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} ) + endif() + if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") + _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES}) + endif() + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}") + endif() + find_library(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG + NAMES ${_boost_DEBUG_NAMES} + HINTS ${_boost_LIBRARY_SEARCH_DIRS} + ${_boost_FIND_OPTIONS} + DOC "${_boost_docstring_debug}" ) + if(Boost_REALPATH) + _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}") + _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "${_boost_docstring_debug}" ) + endif() + _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT}) - IF( Boost_USE_STATIC_LIBS ) - SET(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) - ENDIF( Boost_USE_STATIC_LIBS ) - ENDFOREACH(COMPONENT) + + endforeach(COMPONENT) + + # Restore the original find library ordering + if( Boost_USE_STATIC_LIBS ) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) + endif() # ------------------------------------------------------------------------ # End finding boost libraries # ------------------------------------------------------------------------ diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index d9b9d54..dad5709 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -514,11 +514,19 @@ set (CUDA_INCLUDE_DIRS ${CUDA_TOOLKIT_INCLUDE}) macro(FIND_LIBRARY_LOCAL_FIRST _var _names _doc) if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(_cuda_64bit_lib_dir "${CUDA_TOOLKIT_ROOT_DIR}/lib64") + # CUDA 3.2+ on Windows moved the library directoryies, so we need the new + # and old paths. + set(_cuda_64bit_lib_dir + "${CUDA_TOOLKIT_ROOT_DIR}/lib/x64" + "${CUDA_TOOLKIT_ROOT_DIR}/lib64" + ) endif() + # CUDA 3.2+ on Windows moved the library directories, so we need to new + # (lib/Win32) and the old path (lib). find_library(${_var} NAMES ${_names} PATHS ${_cuda_64bit_lib_dir} + "${CUDA_TOOLKIT_ROOT_DIR}/lib/Win32" "${CUDA_TOOLKIT_ROOT_DIR}/lib" ENV CUDA_LIB_PATH DOC ${_doc} @@ -578,9 +586,20 @@ macro(FIND_CUDA_HELPER_LIBS _name) mark_as_advanced(CUDA_${_name}_LIBRARY) endmacro(FIND_CUDA_HELPER_LIBS) +####################### +# Disable emulation for v3.1 onward +if(CUDA_VERSION VERSION_GREATER "3.0") + if(CUDA_BUILD_EMULATION) + message(FATAL_ERROR "CUDA_BUILD_EMULATION is not supported in version 3.1 and onwards. You must disable it to proceed. You have version ${CUDA_VERSION}.") + endif() +endif() + # Search for cufft and cublas libraries. -find_cuda_helper_libs(cufftemu) -find_cuda_helper_libs(cublasemu) +if(CUDA_VERSION VERSION_LESS "3.1") + # Emulation libraries aren't available in version 3.1 onward. + find_cuda_helper_libs(cufftemu) + find_cuda_helper_libs(cublasemu) +endif() find_cuda_helper_libs(cufft) find_cuda_helper_libs(cublas) diff --git a/Modules/FindCxxTest.cmake b/Modules/FindCxxTest.cmake index 759b4fd..6a66d21 100644 --- a/Modules/FindCxxTest.cmake +++ b/Modules/FindCxxTest.cmake @@ -5,20 +5,37 @@ # # INPUT Variables # -# CXXTEST_USE_PYTHON -# If true, the CXXTEST_ADD_TEST macro will use -# the Python test generator instead of Perl. +# CXXTEST_USE_PYTHON [deprecated since 1.3] +# Only used in the case both Python & Perl +# are detected on the system to control +# which CxxTest code generator is used. +# +# NOTE: In older versions of this Find Module, +# this variable controlled if the Python test +# generator was used instead of the Perl one, +# regardless of which scripting language the +# user had installed. +# +# CXXTEST_TESTGEN_ARGS (since CMake 2.8.3) +# Specify a list of options to pass to the CxxTest code +# generator. If not defined, --error-printer is +# passed. # # OUTPUT Variables # # CXXTEST_FOUND # True if the CxxTest framework was found -# CXXTEST_INCLUDE_DIR +# CXXTEST_INCLUDE_DIRS # Where to find the CxxTest include directory # CXXTEST_PERL_TESTGEN_EXECUTABLE -# The perl-based test generator. +# The perl-based test generator # CXXTEST_PYTHON_TESTGEN_EXECUTABLE -# The python-based test generator. +# The python-based test generator +# CXXTEST_TESTGEN_EXECUTABLE (since CMake 2.8.3) +# The test generator that is actually used (chosen using user preferences +# and interpreters found in the system) +# CXXTEST_TESTGEN_INTERPRETER (since CMake 2.8.3) +# The full path to the Perl or Python executable on the system # # MACROS for optional use by CMake users: # @@ -26,9 +43,11 @@ # Creates a CxxTest runner and adds it to the CTest testing suite # Parameters: # test_name The name of the test -# gen_source_file The generated source filename to be generated by CxxTest +# gen_source_file The generated source filename to be +# generated by CxxTest # input_files_to_testgen The list of header files containing the -# CxxTest::TestSuite's to be included in this runner +# CxxTest::TestSuite's to be included in +# this runner # # #============== # Example Usage: @@ -65,8 +84,8 @@ # #============================================================================= -# Copyright 2008-2009 Kitware, Inc. -# Copyright 2008-2009 Philip Lowman <philip@yhbt.com> +# Copyright 2008-2010 Kitware, Inc. +# Copyright 2008-2010 Philip Lowman <philip@yhbt.com> # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -78,6 +97,14 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +# Version 1.3 (8/19/10) (CMake 2.8.3) +# Included patch by Simone Rossetto to check if either Python or Perl +# are present in the system. Whichever intepreter that is detected +# is now used to run the test generator program. If both interpreters +# are detected, the CXXTEST_USE_PYTHON variable is obeyed. +# +# Also added support for CXXTEST_TESTGEN_ARGS, for manually specifying +# options to the CxxTest code generator. # Version 1.2 (3/2/08) # Included patch from Tyler Roscoe to have the perl & python binaries # detected based on CXXTEST_INCLUDE_DIR @@ -95,17 +122,12 @@ #============================================================= macro(CXXTEST_ADD_TEST _cxxtest_testname _cxxtest_outfname) set(_cxxtest_real_outfname ${CMAKE_CURRENT_BINARY_DIR}/${_cxxtest_outfname}) - if(CXXTEST_USE_PYTHON) - set(_cxxtest_executable ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE}) - else() - set(_cxxtest_executable ${CXXTEST_PERL_TESTGEN_EXECUTABLE}) - endif() add_custom_command( OUTPUT ${_cxxtest_real_outfname} DEPENDS ${ARGN} - COMMAND ${_cxxtest_executable} - --error-printer -o ${_cxxtest_real_outfname} ${ARGN} + COMMAND ${CXXTEST_TESTGEN_INTERPRETER} + ${CXXTEST_TESTGEN_EXECUTABLE} ${CXXTEST_TESTGEN_ARGS} -o ${_cxxtest_real_outfname} ${ARGN} ) set_source_files_properties(${_cxxtest_real_outfname} PROPERTIES GENERATED true) @@ -124,14 +146,48 @@ endmacro(CXXTEST_ADD_TEST) #============================================================= # main() #============================================================= +if(NOT DEFINED CXXTEST_TESTGEN_ARGS) + set(CXXTEST_TESTGEN_ARGS --error-printer) +endif() + +find_package(PythonInterp QUIET) +find_package(Perl QUIET) find_path(CXXTEST_INCLUDE_DIR cxxtest/TestSuite.h) -find_program(CXXTEST_PERL_TESTGEN_EXECUTABLE cxxtestgen.pl - PATHS ${CXXTEST_INCLUDE_DIR}) find_program(CXXTEST_PYTHON_TESTGEN_EXECUTABLE cxxtestgen.py - PATHS ${CXXTEST_INCLUDE_DIR}) + PATHS ${CXXTEST_INCLUDE_DIR}) +find_program(CXXTEST_PERL_TESTGEN_EXECUTABLE cxxtestgen.pl + PATHS ${CXXTEST_INCLUDE_DIR}) + +if(PYTHONINTERP_FOUND OR PERL_FOUND) + include(FindPackageHandleStandardArgs) + + if(PYTHONINTERP_FOUND AND (CXXTEST_USE_PYTHON OR NOT PERL_FOUND)) + set(CXXTEST_TESTGEN_EXECUTABLE ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE}) + set(CXXTEST_TESTGEN_INTERPRETER ${PYTHON_EXECUTABLE}) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(CxxTest DEFAULT_MSG + CXXTEST_INCLUDE_DIR CXXTEST_PYTHON_TESTGEN_EXECUTABLE) + + elseif(PERL_FOUND) + set(CXXTEST_TESTGEN_EXECUTABLE ${CXXTEST_PERL_TESTGEN_EXECUTABLE}) + set(CXXTEST_TESTGEN_INTERPRETER ${PERL_EXECUTABLE}) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(CxxTest DEFAULT_MSG + CXXTEST_INCLUDE_DIR CXXTEST_PERL_TESTGEN_EXECUTABLE) + endif() + + if(CXXTEST_FOUND) + set(CXXTEST_INCLUDE_DIRS ${CXXTEST_INCLUDE_DIR}) + endif() + +else() -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(CxxTest DEFAULT_MSG CXXTEST_INCLUDE_DIR) + set(CXXTEST_FOUND false) + if(NOT CxxTest_FIND_QUIETLY) + if(CxxTest_FIND_REQUIRED) + message(FATAL_ERROR "Neither Python nor Perl found, cannot use CxxTest, aborting!") + else() + message(STATUS "Neither Python nor Perl found, CxxTest will not be used.") + endif() + endif() -set(CXXTEST_INCLUDE_DIRS ${CXXTEST_INCLUDE_DIR}) +endif() diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake index 55b5639..d42e514 100644 --- a/Modules/FindFLEX.cmake +++ b/Modules/FindFLEX.cmake @@ -78,7 +78,11 @@ IF(FLEX_EXECUTABLE) RESULT_VARIABLE FLEX_version_result OUTPUT_STRIP_TRAILING_WHITESPACE) IF(NOT ${FLEX_version_result} EQUAL 0) - MESSAGE(SEND_ERROR "Command \"${FLEX_EXECUTABLE} --version\" failed with output:\n${FLEX_version_error}") + IF(FLEX_FIND_REQUIRED) + MESSAGE(SEND_ERROR "Command \"${FLEX_EXECUTABLE} --version\" failed with output:\n${FLEX_version_output}\n${FLEX_version_error}") + ELSE() + MESSAGE("Command \"${FLEX_EXECUTABLE} --version\" failed with output:\n${FLEX_version_output}\n${FLEX_version_error}\nFLEX_VERSION will not be available") + ENDIF() ELSE() STRING(REGEX REPLACE "^flex (.*)$" "\\1" FLEX_VERSION "${FLEX_version_output}") diff --git a/Modules/FindFLTK.cmake b/Modules/FindFLTK.cmake index 6d51277..03d4b8e 100644 --- a/Modules/FindFLTK.cmake +++ b/Modules/FindFLTK.cmake @@ -67,11 +67,6 @@ IF(APPLE) SET( FLTK_PLATFORM_DEPENDENT_LIBS "-framework Carbon -framework Cocoa -framework ApplicationServices -lz") ENDIF(APPLE) -IF(CYGWIN) - FIND_LIBRARY(FLTK_MATH_LIBRARY m) - SET( FLTK_PLATFORM_DEPENDENT_LIBS ole32 uuid comctl32 wsock32 supc++ ${FLTK_MATH_LIBRARY} -lgdi32) -ENDIF(CYGWIN) - # If FLTK_INCLUDE_DIR is already defined we assigne its value to FLTK_DIR IF(FLTK_INCLUDE_DIR) SET(FLTK_DIR ${FLTK_INCLUDE_DIR}) diff --git a/Modules/FindFLTK2.cmake b/Modules/FindFLTK2.cmake index 43409d3..436e280 100644 --- a/Modules/FindFLTK2.cmake +++ b/Modules/FindFLTK2.cmake @@ -45,10 +45,6 @@ IF(APPLE) SET( FLTK2_PLATFORM_DEPENDENT_LIBS "-framework Carbon -framework Cocoa -framework ApplicationServices -lz") ENDIF(APPLE) -IF(CYGWIN) - SET( FLTK2_PLATFORM_DEPENDENT_LIBS ole32 uuid comctl32 wsock32 supc++ -lm -lgdi32) -ENDIF(CYGWIN) - # If FLTK2_INCLUDE_DIR is already defined we assigne its value to FLTK2_DIR IF(FLTK2_INCLUDE_DIR) SET(FLTK2_DIR ${FLTK2_INCLUDE_DIR}) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index 3b99ae2..e437e1c 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -66,7 +66,13 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -# Version 1.0 (8/12/2010) +# Version 1.2 (8/30/2010) (CMake 2.8.3) +# * Merge patch for detecting gdk-pixbuf library (split off +# from core GTK in 2.21). Thanks to Vincent Untz for the patch +# and Ricardo Cruz for the heads up. +# Version 1.1 (8/19/2010) (CMake 2.8.3) +# * Add support for detecting GTK2 under macports (thanks to Gary Kramlich) +# Version 1.0 (8/12/2010) (CMake 2.8.3) # * Add support for detecting new pangommconfig.h header file # (Thanks to Sune Vuorela & the Debian Project for the patch) # * Add support for detecting fontconfig.h header @@ -150,6 +156,7 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr) atkmm-1.6 cairo cairomm-1.0 + gdk-pixbuf-2.0 gdkmm-2.4 giomm-2.4 gtk-2.0 @@ -184,6 +191,8 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr) /usr/openwin/lib /sw/include /sw/lib + /opt/local/include + /opt/local/lib $ENV{GTKMM_BASEPATH}/include $ENV{GTKMM_BASEPATH}/lib [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/include @@ -415,6 +424,9 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_INCLUDE_DIR(GTK2_GOBJECT_INCLUDE_DIR gobject/gobject.h) _GTK2_FIND_LIBRARY (GTK2_GOBJECT_LIBRARY gobject false true) + _GTK2_FIND_INCLUDE_DIR(GTK2_GDK_PIXBUF_INCLUDE_DIR gdk-pixbuf/gdk-pixbuf.h) + _GTK2_FIND_LIBRARY (GTK2_GDK_PIXBUF_LIBRARY gdk_pixbuf false true) + _GTK2_FIND_INCLUDE_DIR(GTK2_GDK_INCLUDE_DIR gdk/gdk.h) _GTK2_FIND_INCLUDE_DIR(GTK2_GDKCONFIG_INCLUDE_DIR gdkconfig.h) _GTK2_FIND_INCLUDE_DIR(GTK2_GTK_INCLUDE_DIR gtk/gtk.h) @@ -438,9 +450,6 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_INCLUDE_DIR(GTK2_ATK_INCLUDE_DIR atk/atk.h) _GTK2_FIND_LIBRARY (GTK2_ATK_LIBRARY atk false true) - #elseif(_GTK2_component STREQUAL "gdk_pixbuf") - #_GTK2_FIND_INCLUDE_DIR(GTK2_GDKPIXBUF_INCLUDE_DIR gdk-pixbuf/gdk-pixbuf.h) - #_GTK2_FIND_LIBRARY (GTK2_GDKPIXBUF_LIBRARY gdk_pixbuf false true) elseif(_GTK2_component STREQUAL "gtkmm") diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 45d6bff..9fef8f9 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -188,7 +188,7 @@ if (MPI_INCLUDE_PATH AND MPI_LIBRARY) # the cache, and we don't want to override those settings. elseif (MPI_COMPILE_CMDLINE) # Extract compile flags from the compile command line. - string(REGEX MATCHALL "(^| )-D([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_FLAGS "${MPI_COMPILE_CMDLINE}") + string(REGEX MATCHALL "(^| )-[Df]([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_FLAGS "${MPI_COMPILE_CMDLINE}") set(MPI_COMPILE_FLAGS_WORK) foreach(FLAG ${MPI_ALL_COMPILE_FLAGS}) if (MPI_COMPILE_FLAGS_WORK) diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake index c698480..cd33aa3 100644 --- a/Modules/FindPackageHandleStandardArgs.cmake +++ b/Modules/FindPackageHandleStandardArgs.cmake @@ -20,18 +20,24 @@ # The second mode is more powerful and also supports version checking: # FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME [REQUIRED_VARS <var1>...<varN>] # [VERSION_VAR <versionvar> +# [CONFIG_MODE] # [FAIL_MESSAGE "Custom failure message"] ) # # As above, if <var1> through <varN> are all valid, <UPPERCASED_NAME>_FOUND # will be set to TRUE. -# Via FAIL_MESSAGE a custom failure message can be specified, if this is not -# used, the default message will be displayed. +# After REQUIRED_VARS the variables which are required for this package are listed. # Following VERSION_VAR the name of the variable can be specified which holds # the version of the package which has been found. If this is done, this version # will be checked against the (potentially) specified required version used # in the find_package() call. The EXACT keyword is also handled. The default # messages include information about the required version and the version # which has been actually found, both if the version is ok or not. +# Use the option CONFIG_MODE if your FindXXX.cmake module is a wrapper for +# a find_package(... NO_MODULE) call, in this case all the information +# provided by the config-mode of find_package() will be evaluated +# automatically. +# Via FAIL_MESSAGE a custom failure message can be specified, if this is not +# used, the default message will be displayed. # # Example for mode 1: # @@ -53,6 +59,15 @@ # Also the version of BISON will be checked by using the version contained # in BISON_VERSION. # Since no FAIL_MESSAGE is given, the default messages will be printed. +# +# Another example for mode 2: +# +# FIND_PACKAGE(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4) +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(Automoc4 CONFIG_MODE) +# In this case, FindAutmoc4.cmake wraps a call to FIND_PACKAGE(Automoc4 NO_MODULE) +# and adds an additional search directory for automoc4. +# The following FIND_PACKAGE_HANDLE_STANDARD_ARGS() call produces a proper +# success/error message. #============================================================================= # Copyright 2007-2009 Kitware, Inc. @@ -70,12 +85,50 @@ INCLUDE(FindPackageMessage) INCLUDE(CMakeParseArguments) - -FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG _VAR1) +# internal helper macro +MACRO(_FPHSA_FAILURE_MESSAGE _msg) + IF (${_NAME}_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "${_msg}") + ELSE (${_NAME}_FIND_REQUIRED) + IF (NOT ${_NAME}_FIND_QUIETLY) + MESSAGE(STATUS "${_msg}") + ENDIF (NOT ${_NAME}_FIND_QUIETLY) + ENDIF (${_NAME}_FIND_REQUIRED) +ENDMACRO(_FPHSA_FAILURE_MESSAGE _msg) + + +# internal helper macro to generate the failure message when used in CONFIG_MODE: +MACRO(_FPHSA_HANDLE_FAILURE_CONFIG_MODE) + # <name>_CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found: + IF(${_NAME}_CONFIG) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing: ${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})") + ELSE(${_NAME}_CONFIG) + # If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version. + # List them all in the error message: + IF(${_NAME}_CONSIDERED_CONFIGS) + SET(configsText "") + LIST(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount) + MATH(EXPR configsCount "${configsCount} - 1") + FOREACH(currentConfigIndex RANGE ${configsCount}) + LIST(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename) + LIST(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version) + SET(configsText "${configsText} ${filename} (version ${version})\n") + ENDFOREACH(currentConfigIndex) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}") + + ELSE(${_NAME}_CONSIDERED_CONFIGS) + # Simple case: No Config-file was found at all: + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}") + ENDIF(${_NAME}_CONSIDERED_CONFIGS) + ENDIF(${_NAME}_CONFIG) +ENDMACRO(_FPHSA_HANDLE_FAILURE_CONFIG_MODE) + + +FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) # set up the arguments for CMAKE_PARSE_ARGUMENTS and check whether we are in # new extended or in the "old" mode: - SET(options) # none + SET(options CONFIG_MODE) SET(oneValueArgs FAIL_MESSAGE VERSION_VAR) SET(multiValueArgs REQUIRED_VARS) SET(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} ) @@ -83,11 +136,11 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG _VAR1) IF(${INDEX} EQUAL -1) SET(FPHSA_FAIL_MESSAGE ${_FIRST_ARG}) - SET(FPHSA_REQUIRED_VARS ${_VAR1} ${ARGN}) + SET(FPHSA_REQUIRED_VARS ${ARGN}) SET(FPHSA_VERSION_VAR) ELSE(${INDEX} EQUAL -1) - CMAKE_PARSE_ARGUMENTS(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${_VAR1} ${ARGN}) + CMAKE_PARSE_ARGUMENTS(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN}) IF(FPHSA_UNPARSED_ARGUMENTS) MESSAGE(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"") @@ -104,6 +157,14 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG _VAR1) SET(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}") ENDIF("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG") + # In config-mode, we rely on the variable <package>_CONFIG, which is set by find_package() + # when it successfully found the config-file, including version checking: + IF(FPHSA_CONFIG_MODE) + LIST(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG) + LIST(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS) + SET(FPHSA_VERSION_VAR ${_NAME}_VERSION) + ENDIF(FPHSA_CONFIG_MODE) + IF(NOT FPHSA_REQUIRED_VARS) MESSAGE(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()") ENDIF(NOT FPHSA_REQUIRED_VARS) @@ -111,8 +172,9 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG _VAR1) LIST(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR) STRING(TOUPPER ${_NAME} _NAME_UPPER) + STRING(TOLOWER ${_NAME} _NAME_LOWER) - # collect all variables which were not found, so they can be printed, so the + # collect all variables which were not found, so they can be printed, so the # user knows better what went wrong (#6375) SET(MISSING_VARS "") SET(DETAILS "") @@ -131,44 +193,42 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG _VAR1) # version handling: SET(VERSION_MSG "") SET(VERSION_OK TRUE) + SET(VERSION ${${FPHSA_VERSION_VAR}} ) IF (${_NAME}_FIND_VERSION) - # if the package was found, check for the version using <NAME>_FIND_VERSION - IF (${_NAME_UPPER}_FOUND) - SET(VERSION ${${FPHSA_VERSION_VAR}} ) - - IF(VERSION) - - IF(${_NAME}_FIND_VERSION_EXACT) # exact version required - IF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") - SET(VERSION_MSG " Found version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") - SET(VERSION_OK FALSE) - ELSE (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") - SET(VERSION_MSG " (found exact version \"${VERSION}\")") - ENDIF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") - - ELSE(${_NAME}_FIND_VERSION_EXACT) # minimum version specified: - IF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") - SET(VERSION_MSG " Found version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"") - SET(VERSION_OK FALSE) - ELSE ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") - SET(VERSION_MSG " (found version \"${VERSION}\", required is \"${${_NAME}_FIND_VERSION}\")") - ENDIF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") - ENDIF(${_NAME}_FIND_VERSION_EXACT) - -# Uncomment the following two lines to see to which Find-modules the VERSION_VAR keywords still need to be added: -# ELSE(VERSION) -# SET(VERSION_MSG " (WARNING: Required version is \"${${_NAME}_FIND_VERSION}\", but version of ${_NAME} is unknown)") - ENDIF(VERSION) - - # if the package was not found, but a version was given, add that to the output: - ELSE (${_NAME_UPPER}_FOUND) + IF(VERSION) + + IF(${_NAME}_FIND_VERSION_EXACT) # exact version required + IF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") + SET(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") + SET(VERSION_OK FALSE) + ELSE (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") + SET(VERSION_MSG "(found suitable exact version \"${VERSION}\")") + ENDIF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") + + ELSE(${_NAME}_FIND_VERSION_EXACT) # minimum version specified: + IF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") + SET(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"") + SET(VERSION_OK FALSE) + ELSE ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") + SET(VERSION_MSG "(found suitable version \"${VERSION}\", required is \"${${_NAME}_FIND_VERSION}\")") + ENDIF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") + ENDIF(${_NAME}_FIND_VERSION_EXACT) + + ELSE(VERSION) + + # if the package was not found, but a version was given, add that to the output: IF(${_NAME}_FIND_VERSION_EXACT) - SET(VERSION_MSG " (Required is exact version \"${${_NAME}_FIND_VERSION}\")") + SET(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")") ELSE(${_NAME}_FIND_VERSION_EXACT) - SET(VERSION_MSG " (Required is at least version \"${${_NAME}_FIND_VERSION}\")") + SET(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")") ENDIF(${_NAME}_FIND_VERSION_EXACT) - ENDIF (${_NAME_UPPER}_FOUND) + + ENDIF(VERSION) + ELSE (${_NAME}_FIND_VERSION) + IF(VERSION) + SET(VERSION_MSG "(found version \"${VERSION}\")") + ENDIF(VERSION) ENDIF (${_NAME}_FIND_VERSION) IF(VERSION_OK) @@ -182,26 +242,16 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG _VAR1) IF (${_NAME_UPPER}_FOUND) FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG}" "${DETAILS}") ELSE (${_NAME_UPPER}_FOUND) - IF(NOT VERSION_OK) - - IF (${_NAME}_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") - ELSE (${_NAME}_FIND_REQUIRED) - IF (NOT ${_NAME}_FIND_QUIETLY) - MESSAGE(STATUS "${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") - ENDIF (NOT ${_NAME}_FIND_QUIETLY) - ENDIF (${_NAME}_FIND_REQUIRED) - - ELSE(NOT VERSION_OK) - - IF (${_NAME}_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}") - ELSE (${_NAME}_FIND_REQUIRED) - IF (NOT ${_NAME}_FIND_QUIETLY) - MESSAGE(STATUS "${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}") - ENDIF (NOT ${_NAME}_FIND_QUIETLY) - ENDIF (${_NAME}_FIND_REQUIRED) - ENDIF(NOT VERSION_OK) + + IF(FPHSA_CONFIG_MODE) + _FPHSA_HANDLE_FAILURE_CONFIG_MODE() + ELSE(FPHSA_CONFIG_MODE) + IF(NOT VERSION_OK) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") + ELSE(NOT VERSION_OK) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}") + ENDIF(NOT VERSION_OK) + ENDIF(FPHSA_CONFIG_MODE) ENDIF (${_NAME_UPPER}_FOUND) diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index ed6ade6..6c97ba3 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -7,7 +7,7 @@ # #============================================================================= -# Copyright 2005-2009 Kitware, Inc. +# Copyright 2005-2010 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -20,8 +20,9 @@ # License text for the above reference.) FIND_PROGRAM(PYTHON_EXECUTABLE - NAMES python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python + NAMES python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.7\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.6\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath] diff --git a/Modules/FindSubversion.cmake b/Modules/FindSubversion.cmake index 9bad3b1..daf3d87 100644 --- a/Modules/FindSubversion.cmake +++ b/Modules/FindSubversion.cmake @@ -8,18 +8,22 @@ # The minimum required version of Subversion can be specified using the # standard syntax, e.g. FIND_PACKAGE(Subversion 1.4) # -# If the command line client executable is found the macro +# If the command line client executable is found two macros are defined: # Subversion_WC_INFO(<dir> <var-prefix>) -# is defined to extract information of a subversion working copy at -# a given location. The macro defines the following variables: +# Subversion_WC_LOG(<dir> <var-prefix>) +# Subversion_WC_INFO extracts information of a subversion working copy at +# a given location. This macro defines the following variables: # <var-prefix>_WC_URL - url of the repository (at <dir>) # <var-prefix>_WC_ROOT - root url of the repository # <var-prefix>_WC_REVISION - current revision # <var-prefix>_WC_LAST_CHANGED_AUTHOR - author of last commit # <var-prefix>_WC_LAST_CHANGED_DATE - date of last commit # <var-prefix>_WC_LAST_CHANGED_REV - revision of last commit -# <var-prefix>_WC_LAST_CHANGED_LOG - last log of base revision # <var-prefix>_WC_INFO - output of command `svn info <dir>' +# Subversion_WC_LOG retrieves the log message of the base revision of a +# subversion working copy at a given location. This macro defines the +# variable: +# <var-prefix>_LAST_CHANGED_LOG - last log of base revision # Example usage: # FIND_PACKAGE(Subversion) # IF(SUBVERSION_FOUND) @@ -74,6 +78,8 @@ IF(Subversion_SVN_EXECUTABLE) STRING(REGEX REPLACE "^(.*\n)?URL: ([^\n]+).*" "\\2" ${prefix}_WC_URL "${${prefix}_WC_INFO}") + STRING(REGEX REPLACE "^(.*\n)?Repository Root: ([^\n]+).*" + "\\2" ${prefix}_WC_ROOT "${${prefix}_WC_INFO}") STRING(REGEX REPLACE "^(.*\n)?Revision: ([^\n]+).*" "\\2" ${prefix}_WC_REVISION "${${prefix}_WC_INFO}") STRING(REGEX REPLACE "^(.*\n)?Last Changed Author: ([^\n]+).*" diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index 25d48d1..4cb7451 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -6,7 +6,7 @@ # CMAKE_USE_PTHREADS_INIT - are we using pthreads # CMAKE_HP_PTHREADS_INIT - are we using hp pthreads # For systems with multiple thread libraries, caller can set -# CMAKE_THREAD_PREFER_PTHREADS +# CMAKE_THREAD_PREFER_PTHREAD #============================================================================= # Copyright 2002-2009 Kitware, Inc. diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index 687ae7c..d991cd4 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -4,7 +4,7 @@ # modules that you will use, you need to name them as components to # the package: # -# FIND_PACKAGE(wxWidgets COMPONENTS base core ...) +# FIND_PACKAGE(wxWidgets COMPONENTS core base ...) # # There are two search branches: a windows style and a unix style. For # windows, the following variables are searched for and set to @@ -32,7 +32,14 @@ # wxWidgets_USE_UNICODE # wxWidgets_USE_UNIVERSAL # wxWidgets_USE_STATIC -# +# +# There is also a wxWidgets_CONFIG_OPTIONS variable for all other +# options that need to be passed to the wx-config utility. For +# example, to use the base toolkit found in the /usr/local path, set +# the variable (before calling the FIND_PACKAGE command) as such: +# +# SET(wxWidgets_CONFIG_OPTIONS --toolkit=base --prefix=/usr) +# # The following are set after the configuration is done for both # windows and unix style: # @@ -54,7 +61,8 @@ # wxWidgets_USE_FILE - Convenience include file. # # Sample usage: -# FIND_PACKAGE(wxWidgets COMPONENTS base core gl net) +# # Note that for MinGW users the order of libs is important! +# FIND_PACKAGE(wxWidgets COMPONENTS net gl core base) # IF(wxWidgets_FOUND) # INCLUDE(${wxWidgets_USE_FILE}) # # and for each of your dependent executable/library targets: @@ -62,7 +70,7 @@ # ENDIF(wxWidgets_FOUND) # # If wxWidgets is required (i.e., not an optional part): -# FIND_PACKAGE(wxWidgets REQUIRED base core gl net) +# FIND_PACKAGE(wxWidgets REQUIRED net gl core base) # INCLUDE(${wxWidgets_USE_FILE}) # # and for each of your dependent executable/library targets: # TARGET_LINK_LIBRARIES(<YourTarget> ${wxWidgets_LIBRARIES}) @@ -188,7 +196,7 @@ IF(EXISTS "${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake") SET(wxWidgets_USE_FILE "${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake") ELSE(EXISTS "${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake") - SET(wxWidgets_USE_FILE UsewxWidgets.cmake) + SET(wxWidgets_USE_FILE UsewxWidgets) ENDIF(EXISTS "${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake") #===================================================================== @@ -213,7 +221,7 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") IF(wxWidgets_USE_MONOLITHIC) SET(wxWidgets_FIND_COMPONENTS mono) ELSE(wxWidgets_USE_MONOLITHIC) - SET(wxWidgets_FIND_COMPONENTS base core) # this is default + SET(wxWidgets_FIND_COMPONENTS core base) # this is default ENDIF(wxWidgets_USE_MONOLITHIC) ENDIF(NOT wxWidgets_FIND_COMPONENTS) @@ -252,7 +260,7 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") # FIXME: What if both regex libs are available. regex should be # found outside the loop and only wx${LIB}${_UCD}${_DBG}. # Find wxWidgets common libraries. - FOREACH(LIB ${wxWidgets_COMMON_LIBRARIES}) + FOREACH(LIB ${wxWidgets_COMMON_LIBRARIES} scintilla) FIND_LIBRARY(WX_${LIB}${_DBG} NAMES wx${LIB}${_UCD}${_DBG} # for regex @@ -303,7 +311,8 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") MARK_AS_ADVANCED(WX_mono${_DBG}) # Find wxWidgets multilib libraries. - FOREACH(LIB core adv aui html media xrc dbgrid gl qa richtext) + FOREACH(LIB core adv aui html media xrc dbgrid gl qa richtext + stc ribbon propgrid) FIND_LIBRARY(WX_${LIB}${_DBG} NAMES wxmsw${_UNV}29${_UCD}${_DBG}_${LIB} @@ -330,7 +339,7 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") # Clear all debug or release library paths (arguments are "d" or ""). MACRO(WX_CLEAR_ALL_LIBS _DBG) # Clear wxWidgets common libraries. - FOREACH(LIB ${wxWidgets_COMMON_LIBRARIES}) + FOREACH(LIB ${wxWidgets_COMMON_LIBRARIES} scintilla) WX_CLEAR_LIB(WX_${LIB}${_DBG}) ENDFOREACH(LIB) @@ -344,7 +353,8 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") WX_CLEAR_LIB(WX_mono${_DBG}) # Clear wxWidgets multilib libraries. - FOREACH(LIB core adv aui html media xrc dbgrid gl qa richtext) + FOREACH(LIB core adv aui html media xrc dbgrid gl qa richtext + stc ribbon propgrid) WX_CLEAR_LIB(WX_${LIB}${_DBG}) ENDFOREACH(LIB) ENDMACRO(WX_CLEAR_ALL_LIBS) @@ -561,23 +571,23 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") # Get configuration parameters from the name. WX_GET_NAME_COMPONENTS(${wxWidgets_CONFIGURATION} UNV UCD DBG) - # Set wxWidgets main include directory. - IF(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h) - SET(wxWidgets_INCLUDE_DIRS ${WX_ROOT_DIR}/include) - ELSE(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h) - DBG_MSG("wxWidgets_FOUND FALSE because WX_ROOT_DIR=${WX_ROOT_DIR} has no ${WX_ROOT_DIR}/include/wx/wx.h") - SET(wxWidgets_FOUND FALSE) - ENDIF(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h) - # Set wxWidgets lib setup include directory. IF(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h) - LIST(APPEND wxWidgets_INCLUDE_DIRS + SET(wxWidgets_INCLUDE_DIRS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}) ELSE(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h) - DBG_MSG("WXWIDGET_FOUND FALSE because ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h does not exists.") + DBG_MSG("wxWidgets_FOUND FALSE because ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h does not exists.") SET(wxWidgets_FOUND FALSE) ENDIF(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h) + # Set wxWidgets main include directory. + IF(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h) + LIST(APPEND wxWidgets_INCLUDE_DIRS ${WX_ROOT_DIR}/include) + ELSE(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h) + DBG_MSG("wxWidgets_FOUND FALSE because WX_ROOT_DIR=${WX_ROOT_DIR} has no ${WX_ROOT_DIR}/include/wx/wx.h") + SET(wxWidgets_FOUND FALSE) + ENDIF(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h) + # Find wxWidgets libraries. WX_FIND_LIBS("${UNV}" "${UCD}" "${DBG}") IF(WX_USE_REL_AND_DBG) @@ -612,7 +622,8 @@ ELSE(wxWidgets_FIND_STYLE STREQUAL "win32") # MACRO(WX_CONFIG_SELECT_GET_DEFAULT) EXECUTE_PROCESS( - COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}" --selected-config + COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}" + ${wxWidgets_CONFIG_OPTIONS} --selected-config OUTPUT_VARIABLE _wx_selected_config RESULT_VARIABLE _wx_result ERROR_QUIET @@ -640,13 +651,15 @@ ELSE(wxWidgets_FIND_STYLE STREQUAL "win32") # MACRO(WX_CONFIG_SELECT_QUERY_BOOL _OPT_NAME _OPT_HELP) EXECUTE_PROCESS( - COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}" --${_OPT_NAME}=yes + COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}" + ${wxWidgets_CONFIG_OPTIONS} --${_OPT_NAME}=yes RESULT_VARIABLE _wx_result_yes OUTPUT_QUIET ERROR_QUIET ) EXECUTE_PROCESS( - COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}" --${_OPT_NAME}=no + COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}" + ${wxWidgets_CONFIG_OPTIONS} --${_OPT_NAME}=no RESULT_VARIABLE _wx_result_no OUTPUT_QUIET ERROR_QUIET @@ -672,7 +685,7 @@ ELSE(wxWidgets_FIND_STYLE STREQUAL "win32") # among multiple builds. # MACRO(WX_CONFIG_SELECT_SET_OPTIONS) - SET(wxWidgets_SELECT_OPTIONS "") + SET(wxWidgets_SELECT_OPTIONS ${wxWidgets_CONFIG_OPTIONS}) FOREACH(_opt_name debug static unicode universal) STRING(TOUPPER ${_opt_name} _upper_opt_name) IF(DEFINED wxWidgets_USE_${_upper_opt_name}) diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 17b32f6..c83da4f 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -1,14 +1,16 @@ -# GetPrerequisites.cmake -# -# This script provides functions to list the .dll, .dylib or .so files that an -# executable or shared library file depends on. (Its prerequisites.) +# - Functions to analyze and list executable file prerequisites. +# This module provides functions to list the .dll, .dylib or .so +# files that an executable or shared library file depends on. (Its +# prerequisites.) # # It uses various tools to obtain the list of required shared library files: # dumpbin (Windows) # ldd (Linux/Unix) # otool (Mac OSX) -# -# The following functions are provided by this script: +# The following functions are provided by this module: +# get_prerequisites +# list_prerequisites +# list_prerequisites_by_glob # gp_append_unique # is_file_executable # gp_item_default_embedded_path @@ -18,12 +20,91 @@ # gp_resolved_file_type # (projects can override with gp_resolved_file_type_override) # gp_file_type -# get_prerequisites -# list_prerequisites -# list_prerequisites_by_glob -# # Requires CMake 2.6 or greater because it uses function, break, return and # PARENT_SCOPE. +# +# GET_PREREQUISITES(<target> <prerequisites_var> <exclude_system> <recurse> +# <dirs>) +# Get the list of shared library files required by <target>. The list in +# the variable named <prerequisites_var> should be empty on first entry to +# this function. On exit, <prerequisites_var> will contain the list of +# required shared library files. +# +# <target> is the full path to an executable file. <prerequisites_var> is the +# name of a CMake variable to contain the results. <exclude_system> must be 0 +# or 1 indicating whether to include or exclude "system" prerequisites. If +# <recurse> is set to 1 all prerequisites will be found recursively, if set to +# 0 only direct prerequisites are listed. <exepath> is the path to the top +# level executable used for @executable_path replacment on the Mac. <dirs> is +# a list of paths where libraries might be found: these paths are searched +# first when a target without any path info is given. Then standard system +# locations are also searched: PATH, Framework locations, /usr/lib... +# +# LIST_PREREQUISITES(<target> [<recurse> [<exclude_system> [<verbose>]]]) +# Print a message listing the prerequisites of <target>. +# +# <target> is the name of a shared library or executable target or the full +# path to a shared library or executable file. If <recurse> is set to 1 all +# prerequisites will be found recursively, if set to 0 only direct +# prerequisites are listed. <exclude_system> must be 0 or 1 indicating whether +# to include or exclude "system" prerequisites. With <verbose> set to 0 only +# the full path names of the prerequisites are printed, set to 1 extra +# informatin will be displayed. +# +# LIST_PREREQUISITES_BY_GLOB(<glob_arg> <glob_exp>) +# Print the prerequisites of shared library and executable files matching a +# globbing pattern. <glob_arg> is GLOB or GLOB_RECURSE and <glob_exp> is a +# globbing expression used with "file(GLOB" or "file(GLOB_RECURSE" to retrieve +# a list of matching files. If a matching file is executable, its prerequisites +# are listed. +# +# Any additional (optional) arguments provided are passed along as the +# optional arguments to the list_prerequisites calls. +# +# GP_APPEND_UNIQUE(<list_var> <value>) +# Append <value> to the list variable <list_var> only if the value is not +# already in the list. +# +# IS_FILE_EXECUTABLE(<file> <result_var>) +# Return 1 in <result_var> if <file> is a binary executable, 0 otherwise. +# +# GP_ITEM_DEFAULT_EMBEDDED_PATH(<item> <default_embedded_path_var>) +# Return the path that others should refer to the item by when the item +# is embedded inside a bundle. +# +# Override on a per-project basis by providing a project-specific +# gp_item_default_embedded_path_override function. +# +# GP_RESOLVE_ITEM(<context> <item> <exepath> <dirs> <resolved_item_var>) +# Resolve an item into an existing full path file. +# +# Override on a per-project basis by providing a project-specific +# gp_resolve_item_override function. +# +# GP_RESOLVED_FILE_TYPE(<original_file> <file> <exepath> <dirs> <type_var>) +# Return the type of <file> with respect to <original_file>. String +# describing type of prerequisite is returned in variable named <type_var>. +# +# Use <exepath> and <dirs> if necessary to resolve non-absolute <file> +# values -- but only for non-embedded items. +# +# Possible types are: +# system +# local +# embedded +# other +# Override on a per-project basis by providing a project-specific +# gp_resolved_file_type_override function. +# +# GP_FILE_TYPE(<original_file> <file> <type_var>) +# Return the type of <file> with respect to <original_file>. String +# describing type of prerequisite is returned in variable named <type_var>. +# +# Possible types are: +# system +# local +# embedded +# other #============================================================================= # Copyright 2008-2009 Kitware, Inc. @@ -38,11 +119,6 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -# gp_append_unique list_var value -# -# Append value to the list variable ${list_var} only if the value is not -# already in the list. -# function(gp_append_unique list_var value) set(contains 0) @@ -59,12 +135,6 @@ function(gp_append_unique list_var value) endfunction(gp_append_unique) -# is_file_executable file result_var -# -# Return 1 in ${result_var} if ${file} is a binary executable. -# -# Return 0 in ${result_var} otherwise. -# function(is_file_executable file result_var) # # A file is not executable until proven otherwise: @@ -132,14 +202,6 @@ function(is_file_executable file result_var) endfunction(is_file_executable) -# gp_item_default_embedded_path item default_embedded_path_var -# -# Return the path that others should refer to the item by when the item -# is embedded inside a bundle. -# -# Override on a per-project basis by providing a project-specific -# gp_item_default_embedded_path_override function. -# function(gp_item_default_embedded_path item default_embedded_path_var) # On Windows and Linux, "embed" prerequisites in the same directory @@ -193,13 +255,6 @@ function(gp_item_default_embedded_path item default_embedded_path_var) endfunction(gp_item_default_embedded_path) -# gp_resolve_item context item exepath dirs resolved_item_var -# -# Resolve an item into an existing full path file. -# -# Override on a per-project basis by providing a project-specific -# gp_resolve_item_override function. -# function(gp_resolve_item context item exepath dirs resolved_item_var) set(resolved 0) set(resolved_item "${item}") @@ -332,23 +387,6 @@ warning: cannot resolve item '${item}' endfunction(gp_resolve_item) -# gp_resolved_file_type original_file file exepath dirs type_var -# -# Return the type of ${file} with respect to ${original_file}. String -# describing type of prerequisite is returned in variable named ${type_var}. -# -# Use ${exepath} and ${dirs} if necessary to resolve non-absolute ${file} -# values -- but only for non-embedded items. -# -# Possible types are: -# system -# local -# embedded -# other -# -# Override on a per-project basis by providing a project-specific -# gp_resolved_file_type_override function. -# function(gp_resolved_file_type original_file file exepath dirs type_var) #message(STATUS "**") @@ -445,17 +483,6 @@ function(gp_resolved_file_type original_file file exepath dirs type_var) endfunction() -# gp_file_type original_file file type_var -# -# Return the type of ${file} with respect to ${original_file}. String -# describing type of prerequisite is returned in variable named ${type_var}. -# -# Possible types are: -# system -# local -# embedded -# other -# function(gp_file_type original_file file type_var) if(NOT IS_ABSOLUTE "${original_file}") message(STATUS "warning: gp_file_type expects absolute full path for first arg original_file") @@ -470,30 +497,6 @@ function(gp_file_type original_file file type_var) endfunction(gp_file_type) -# get_prerequisites target prerequisites_var exclude_system recurse dirs -# -# Get the list of shared library files required by ${target}. The list in -# the variable named ${prerequisites_var} should be empty on first entry to -# this function. On exit, ${prerequisites_var} will contain the list of -# required shared library files. -# -# target is the full path to an executable file -# -# prerequisites_var is the name of a CMake variable to contain the results -# -# exclude_system is 0 or 1: 0 to include "system" prerequisites , 1 to -# exclude them -# -# recurse is 0 or 1: 0 for direct prerequisites only, 1 for all prerequisites -# recursively -# -# exepath is the path to the top level executable used for @executable_path -# replacment on the Mac -# -# dirs is a list of paths where libraries might be found: these paths are -# searched first when a target without any path info is given. Then standard -# system locations are also searched: PATH, Framework locations, /usr/lib... -# function(get_prerequisites target prerequisites_var exclude_system recurse exepath dirs) set(verbose 0) set(eol_char "E") @@ -631,6 +634,23 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa string(REGEX REPLACE ";" "\\\\;" candidates "${gp_cmd_ov}") string(REGEX REPLACE "\n" "${eol_char};" candidates "${candidates}") + # check for install id and remove it from list, since otool -L can include a + # reference to itself + set(gp_install_id) + if("${gp_tool}" STREQUAL "otool") + execute_process( + COMMAND otool -D ${target} + OUTPUT_VARIABLE gp_install_id_ov + ) + # second line is install name + string(REGEX REPLACE ".*:\n" "" gp_install_id "${gp_install_id_ov}") + if(gp_install_id) + # trim + string(REGEX MATCH "[^\n ].*[^\n ]" gp_install_id "${gp_install_id}") + #message("INSTALL ID is \"${gp_install_id}\"") + endif(gp_install_id) + endif("${gp_tool}" STREQUAL "otool") + # Analyze each line for file names that match the regular expression: # foreach(candidate ${candidates}) @@ -667,14 +687,18 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa # set(add_item 1) - if(${exclude_system}) + if("${item}" STREQUAL "${gp_install_id}") + set(add_item 0) + endif("${item}" STREQUAL "${gp_install_id}") + + if(add_item AND ${exclude_system}) set(type "") gp_resolved_file_type("${target}" "${item}" "${exepath}" "${dirs}" type) if("${type}" STREQUAL "system") set(add_item 0) endif("${type}" STREQUAL "system") - endif(${exclude_system}) + endif(add_item AND ${exclude_system}) if(add_item) list(LENGTH ${prerequisites_var} list_length_before_append) @@ -717,19 +741,6 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa endfunction(get_prerequisites) -# list_prerequisites target all exclude_system verbose -# -# ARGV0 (target) is the full path to an executable file -# -# optional ARGV1 (all) is 0 or 1: 0 for direct prerequisites only, -# 1 for all prerequisites recursively -# -# optional ARGV2 (exclude_system) is 0 or 1: 0 to include "system" -# prerequisites , 1 to exclude them -# -# optional ARGV3 (verbose) is 0 or 1: 0 to print only full path -# names of prerequisites, 1 to print extra information -# function(list_prerequisites target) if("${ARGV1}" STREQUAL "") set(all 1) @@ -782,17 +793,6 @@ function(list_prerequisites target) endfunction(list_prerequisites) -# list_prerequisites_by_glob glob_arg glob_exp -# -# glob_arg is GLOB or GLOB_RECURSE -# -# glob_exp is a globbing expression used with "file(GLOB" to retrieve a list -# of matching files. If a matching file is executable, its prerequisites are -# listed. -# -# Any additional (optional) arguments provided are passed along as the -# optional arguments to the list_prerequisites calls. -# function(list_prerequisites_by_glob glob_arg glob_exp) message(STATUS "=============================================================================") message(STATUS "List prerequisites of executables matching ${glob_arg} '${glob_exp}'") diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index c8bcad1..db0642e 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -235,4 +235,7 @@ SET(CMAKE_SYSTEM_APPBUNDLE_PATH /Developer/Applications) INCLUDE(Platform/UnixPaths) -LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH /sw) +LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH + /sw # Fink + /opt/local # MacPorts + ) diff --git a/Modules/Platform/HP-UX.cmake b/Modules/Platform/HP-UX.cmake index f8893d8..9d357c9 100644 --- a/Modules/Platform/HP-UX.cmake +++ b/Modules/Platform/HP-UX.cmake @@ -1,3 +1,5 @@ +SET(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib) + SET(CMAKE_SHARED_LIBRARY_SUFFIX ".sl") # .so SET(CMAKE_DL_LIBS "dld") SET(CMAKE_FIND_LIBRARY_SUFFIXES ".sl" ".so" ".a") diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake index ae3c187..5ee7ddb 100644 --- a/Modules/Platform/UnixPaths.cmake +++ b/Modules/Platform/UnixPaths.cmake @@ -51,7 +51,7 @@ LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH /usr/X11R6/include /usr/include/X11 # Other - /opt/local/include /usr/pkg/include + /usr/pkg/include /opt/csw/include /opt/include /usr/openwin/include ) @@ -64,7 +64,7 @@ LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH /usr/X11R6/lib /usr/lib/X11 # Other - /opt/local/lib /usr/pkg/lib + /usr/pkg/lib /opt/csw/lib /opt/lib /usr/openwin/lib ) diff --git a/Modules/Platform/Windows-GNU-Fortran.cmake b/Modules/Platform/Windows-GNU-Fortran.cmake index 8273a19..c66feed 100644 --- a/Modules/Platform/Windows-GNU-Fortran.cmake +++ b/Modules/Platform/Windows-GNU-Fortran.cmake @@ -1,3 +1,2 @@ include(Platform/Windows-GNU) __windows_compiler_gnu(Fortran) -set(CMAKE_Fortran_USE_RESPONSE_FILE_FOR_OBJECTS 0) diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index 79b2f80..ac635a5 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -76,7 +76,23 @@ macro(__windows_compiler_gnu lang) set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") # No -fPIC on Windows set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS ${__WINDOWS_GNU_LD_RESPONSE}) - set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "-Wl,@") + + # We prefer "@" for response files but it is not supported by gcc 3. + execute_process(COMMAND ${CMAKE_${lang}_COMPILER} --version OUTPUT_VARIABLE _ver ERROR_VARIABLE _ver) + if("${_ver}" MATCHES "\\(GCC\\) 3\\.") + if("${lang}" STREQUAL "Fortran") + # The GNU Fortran compiler reports an error: + # no input files; unwilling to write output files + # when the response file is passed with "-Wl,@". + set(CMAKE_Fortran_USE_RESPONSE_FILE_FOR_OBJECTS 0) + else() + # Use "-Wl,@" to pass the response file to the linker. + set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "-Wl,@") + endif() + elseif(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS) + # Use "@" to pass the response file to the front-end. + set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "@") + endif() # Binary link rules. set(CMAKE_${lang}_CREATE_SHARED_MODULE @@ -85,4 +101,21 @@ macro(__windows_compiler_gnu lang) "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>") set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_${lang}_COMPILER> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>") + + # Support very long lists of object files. + if("${CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG}" STREQUAL "@") + foreach(rule CREATE_SHARED_MODULE CREATE_SHARED_LIBRARY LINK_EXECUTABLE) + # The gcc/collect2/ld toolchain does not use response files + # internally so we cannot pass long object lists. Instead pass + # the object file list in a response file to the archiver to put + # them in a temporary archive. Hand the archive to the linker. + string(REPLACE "<OBJECTS>" "-Wl,--whole-archive <OBJECT_DIR>/objects.a -Wl,--no-whole-archive" + CMAKE_${lang}_${rule} "${CMAKE_${lang}_${rule}}") + set(CMAKE_${lang}_${rule} + "<CMAKE_COMMAND> -E remove -f <OBJECT_DIR>/objects.a" + "<CMAKE_AR> cr <OBJECT_DIR>/objects.a <OBJECTS>" + "${CMAKE_${lang}_${rule}}" + ) + endforeach() + endif() endmacro() diff --git a/Modules/Platform/Windows-df.cmake b/Modules/Platform/Windows-df.cmake index 753b198..f5046bf 100644 --- a/Modules/Platform/Windows-df.cmake +++ b/Modules/Platform/Windows-df.cmake @@ -10,6 +10,8 @@ ELSE(CMAKE_VERBOSE_MAKEFILE) SET(CMAKE_CL_NOLOGO "/nologo") ENDIF(CMAKE_VERBOSE_MAKEFILE) +SET(CMAKE_Fortran_MODDIR_FLAG "-module:") + SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY "link ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out:<TARGET> /dll <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake index 7fc345f..e96ebb5 100644 --- a/Modules/Platform/Windows-wcl386.cmake +++ b/Modules/Platform/Windows-wcl386.cmake @@ -12,17 +12,29 @@ ELSE(CMAKE_VERBOSE_MAKEFILE) SET(CMAKE_LIB_QUIET "-q") ENDIF(CMAKE_VERBOSE_MAKEFILE) +set(CMAKE_CREATE_WIN32_EXE "system nt_win" ) +SET(CMAKE_CREATE_CONSOLE_EXE "system nt" ) + +SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "debug all" ) +SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT "debug all" ) +SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all" ) +SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all" ) + +set (CMAKE_SHARED_LIBRARY_C_FLAGS "-bd" ) + +SET(CMAKE_RC_COMPILER "rc" ) + SET(CMAKE_BUILD_TYPE_INIT Debug) SET (CMAKE_CXX_FLAGS_INIT "-w=3 -xs") -SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-br -bm -d2") +SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-br -bm -d2") SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-br -bm -os -dNDEBUG") SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-br -bm -ot -dNDEBUG") SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-br -bm -d2 -ot -dNDEBUG") SET (CMAKE_C_FLAGS_INIT "-w=3 ") -SET (CMAKE_C_FLAGS_DEBUG_INIT "-br -bm -od") +SET (CMAKE_C_FLAGS_DEBUG_INIT "-br -bm -d2 -od") SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-br -bm -os -dNDEBUG") SET (CMAKE_C_FLAGS_RELEASE_INIT "-br -bm -ot -dNDEBUG") -SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-br -bm -ot -dNDEBUG") +SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-br -bm -d2 -ot -dNDEBUG") SET (CMAKE_C_STANDARD_LIBRARIES_INIT "library clbrdll.lib library plbrdll.lib library kernel32.lib library user32.lib library gdi32.lib library winspool.lib library comdlg32.lib library advapi32.lib library shell32.lib library ole32.lib library oleaut32.lib library uuid.lib library odbc32.lib library odbccp32.lib") SET (CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") @@ -33,6 +45,7 @@ SET(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY}) SET(CMAKE_C_LINK_EXECUTABLE "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' <LINK_FLAGS> option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") + SET(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE}) # compile a C++ file into an object file diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index 10cf1d1..700d3a2 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -129,7 +129,11 @@ MACRO (QT4_GENERATE_MOC infile outfile ) # get include dirs and flags QT4_GET_MOC_FLAGS(moc_flags) GET_FILENAME_COMPONENT(abs_infile ${infile} ABSOLUTE) - QT4_CREATE_MOC_COMMAND(${abs_infile} ${outfile} "${moc_flags}" "") + SET(_outfile "${outfile}") + IF(NOT IS_ABSOLUTE "${outfile}") + SET(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}") + ENDIF(NOT IS_ABSOLUTE "${outfile}") + QT4_CREATE_MOC_COMMAND(${abs_infile} ${_outfile} "${moc_flags}" "") SET_SOURCE_FILES_PROPERTIES(${outfile} PROPERTIES SKIP_AUTOMOC TRUE) # dont run automoc on this file ENDMACRO (QT4_GENERATE_MOC) @@ -187,10 +191,9 @@ MACRO (QT4_ADD_RESOURCES outfiles ) SET(_RC_DEPENDS) FOREACH(_RC_FILE ${_RC_FILES}) STRING(REGEX REPLACE "^<file[^>]*>" "" _RC_FILE "${_RC_FILE}") - STRING(REGEX MATCH "^/|([A-Za-z]:/)" _ABS_PATH_INDICATOR "${_RC_FILE}") - IF(NOT _ABS_PATH_INDICATOR) + IF(NOT IS_ABSOLUTE "${_RC_FILE}") SET(_RC_FILE "${rc_path}/${_RC_FILE}") - ENDIF(NOT _ABS_PATH_INDICATOR) + ENDIF(NOT IS_ABSOLUTE "${_RC_FILE}") SET(_RC_DEPENDS ${_RC_DEPENDS} "${_RC_FILE}") ENDFOREACH(_RC_FILE) ADD_CUSTOM_COMMAND(OUTPUT ${outfile} diff --git a/Modules/UsewxWidgets.cmake b/Modules/UsewxWidgets.cmake index 037b715..9ecfff0 100644 --- a/Modules/UsewxWidgets.cmake +++ b/Modules/UsewxWidgets.cmake @@ -1,15 +1,13 @@ -# - Convenience include for using wxWidgets library -# Finds if wxWidgets is installed -# and set the appropriate libs, incdirs, flags etc. -# INCLUDE_DIRECTORIES, LINK_DIRECTORIES and ADD_DEFINITIONS -# are called. +# - Convenience include for using wxWidgets library. +# Determines if wxWidgets was FOUND and sets the appropriate libs, incdirs, +# flags, etc. INCLUDE_DIRECTORIES and LINK_DIRECTORIES are called. # # USAGE -# SET( wxWidgets_USE_LIBS gl xml xrc ) # optionally: more than wx std libs -# FIND_PACKAGE(wxWidgets REQUIRED) -# INCLUDE( ${xWidgets_USE_FILE} ) -# ... add your targets here, e.g. ADD_EXECUTABLE/ ADD_LIBRARY ... -# TARGET_LINK_LIBRARIERS( <yourWxDependantTarget> ${wxWidgets_LIBRARIES}) +# # Note that for MinGW users the order of libs is important! +# FIND_PACKAGE(wxWidgets REQUIRED net gl core base) +# INCLUDE(${wxWidgets_USE_FILE}) +# # and for each of your dependant executable/library targets: +# TARGET_LINK_LIBRARIES(<YourTarget> ${wxWidgets_LIBRARIES}) # # DEPRECATED # LINK_LIBRARIES is not called in favor of adding dependencies per target. |