Merge branch 'cmake-guiRememberAdvancedCheckbox' into dev/strict-mode

Conflicts:
	Source/QtDialog/CMakeSetupDialog.cxx
This commit is contained in:
Brad King 2010-12-17 10:31:19 -05:00
commit 9bcaff02ff
143 changed files with 3180 additions and 1762 deletions

6
.gitattributes vendored
View File

@ -12,3 +12,9 @@ configure crlf=input
*.dsw -crlf *.dsw -crlf
*.sln -crlf *.sln -crlf
*.vcproj -crlf *.vcproj -crlf
*.c whitespace=tab-in-indent
*.h whitespace=tab-in-indent
*.cxx whitespace=tab-in-indent
*.txt whitespace=tab-in-indent
*.cmake whitespace=tab-in-indent

View File

@ -180,6 +180,18 @@ MACRO(CMAKE_SETUP_TESTING)
ENDMACRO(CMAKE_SETUP_TESTING) ENDMACRO(CMAKE_SETUP_TESTING)
MACRO(CMAKE_SET_TARGET_FOLDER tgt folder)
# Really, I just want this to be an "if(TARGET ${tgt})" ...
# but I'm not sure that our min req'd., CMake 2.4.5 can handle
# that... so I'm just activating this for now, with a version
# compare, and only for MSVC builds.
IF(MSVC)
IF(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.8)
SET_PROPERTY(TARGET "${tgt}" PROPERTY FOLDER "${folder}")
ENDIF()
ENDIF()
ENDMACRO(CMAKE_SET_TARGET_FOLDER)
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
# a macro to build the utilities used by CMake # a macro to build the utilities used by CMake
@ -199,6 +211,16 @@ MACRO (CMAKE_BUILD_UTILITIES)
SET(KWSYS_HEADER_ROOT ${CMake_BINARY_DIR}/Source) SET(KWSYS_HEADER_ROOT ${CMake_BINARY_DIR}/Source)
SET(KWSYS_INSTALL_DOC_DIR "${CMake_DOC_DEST}") SET(KWSYS_INSTALL_DOC_DIR "${CMake_DOC_DEST}")
ADD_SUBDIRECTORY(Source/kwsys) ADD_SUBDIRECTORY(Source/kwsys)
SET(kwsys_folder "Utilities/KWSys")
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE} "${kwsys_folder}")
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}_c "${kwsys_folder}")
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}EncodeExecutable "${kwsys_folder}")
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}ProcessFwd9x "${kwsys_folder}")
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestDynload "${kwsys_folder}")
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestProcess "${kwsys_folder}")
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestsC "${kwsys_folder}")
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestsCxx "${kwsys_folder}")
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestSharedForward "${kwsys_folder}")
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# Setup third-party libraries. # Setup third-party libraries.
@ -228,6 +250,7 @@ MACRO (CMAKE_BUILD_UTILITIES)
SET(CMAKE_ZLIB_INCLUDES) SET(CMAKE_ZLIB_INCLUDES)
SET(CMAKE_ZLIB_LIBRARIES cmzlib) SET(CMAKE_ZLIB_LIBRARIES cmzlib)
ADD_SUBDIRECTORY(Utilities/cmzlib) ADD_SUBDIRECTORY(Utilities/cmzlib)
CMAKE_SET_TARGET_FOLDER(cmzlib "Utilities/3rdParty")
ENDIF(CMAKE_USE_SYSTEM_ZLIB) ENDIF(CMAKE_USE_SYSTEM_ZLIB)
#--------------------------------------------------------------------- #---------------------------------------------------------------------
@ -254,6 +277,8 @@ MACRO (CMAKE_BUILD_UTILITIES)
SET(CMAKE_CURL_TEST_URL "${CMAKE_TESTS_CDASH_SERVER}/user.php") SET(CMAKE_CURL_TEST_URL "${CMAKE_TESTS_CDASH_SERVER}/user.php")
ENDIF(CMAKE_TESTS_CDASH_SERVER) ENDIF(CMAKE_TESTS_CDASH_SERVER)
ADD_SUBDIRECTORY(Utilities/cmcurl) ADD_SUBDIRECTORY(Utilities/cmcurl)
CMAKE_SET_TARGET_FOLDER(cmcurl "Utilities/3rdParty")
CMAKE_SET_TARGET_FOLDER(LIBCURL "Utilities/3rdParty")
ENDIF(CMAKE_USE_SYSTEM_CURL) ENDIF(CMAKE_USE_SYSTEM_CURL)
#--------------------------------------------------------------------- #---------------------------------------------------------------------
@ -262,6 +287,7 @@ MACRO (CMAKE_BUILD_UTILITIES)
"${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmcompress") "${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmcompress")
SET(CMAKE_COMPRESS_LIBRARIES "cmcompress") SET(CMAKE_COMPRESS_LIBRARIES "cmcompress")
ADD_SUBDIRECTORY(Utilities/cmcompress) ADD_SUBDIRECTORY(Utilities/cmcompress)
CMAKE_SET_TARGET_FOLDER(cmcompress "Utilities/3rdParty")
IF(CMAKE_USE_SYSTEM_BZIP2) IF(CMAKE_USE_SYSTEM_BZIP2)
FIND_PACKAGE(BZip2) FIND_PACKAGE(BZip2)
ELSE() ELSE()
@ -269,6 +295,7 @@ MACRO (CMAKE_BUILD_UTILITIES)
"${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmbzip2") "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmbzip2")
SET(BZIP2_LIBRARIES cmbzip2) SET(BZIP2_LIBRARIES cmbzip2)
ADD_SUBDIRECTORY(Utilities/cmbzip2) ADD_SUBDIRECTORY(Utilities/cmbzip2)
CMAKE_SET_TARGET_FOLDER(cmbzip2 "Utilities/3rdParty")
ENDIF() ENDIF()
#--------------------------------------------------------------------- #---------------------------------------------------------------------
@ -293,6 +320,7 @@ MACRO (CMAKE_BUILD_UTILITIES)
SET(BUILD_ARCHIVE_WITHIN_CMAKE TRUE) SET(BUILD_ARCHIVE_WITHIN_CMAKE TRUE)
ADD_DEFINITIONS(-DLIBARCHIVE_STATIC) ADD_DEFINITIONS(-DLIBARCHIVE_STATIC)
ADD_SUBDIRECTORY(Utilities/cmlibarchive) ADD_SUBDIRECTORY(Utilities/cmlibarchive)
CMAKE_SET_TARGET_FOLDER(cmlibarchive "Utilities/3rdParty")
SET(CMAKE_TAR_LIBRARIES cmlibarchive ${BZIP2_LIBRARIES}) SET(CMAKE_TAR_LIBRARIES cmlibarchive ${BZIP2_LIBRARIES})
ENDIF(CMAKE_USE_SYSTEM_LIBARCHIVE) ENDIF(CMAKE_USE_SYSTEM_LIBARCHIVE)
@ -310,6 +338,7 @@ MACRO (CMAKE_BUILD_UTILITIES)
SET(CMAKE_EXPAT_INCLUDES) SET(CMAKE_EXPAT_INCLUDES)
SET(CMAKE_EXPAT_LIBRARIES cmexpat) SET(CMAKE_EXPAT_LIBRARIES cmexpat)
ADD_SUBDIRECTORY(Utilities/cmexpat) ADD_SUBDIRECTORY(Utilities/cmexpat)
CMAKE_SET_TARGET_FOLDER(cmexpat "Utilities/3rdParty")
ENDIF(CMAKE_USE_SYSTEM_EXPAT) ENDIF(CMAKE_USE_SYSTEM_EXPAT)
#--------------------------------------------------------------------- #---------------------------------------------------------------------
@ -553,6 +582,10 @@ ADD_SUBDIRECTORY(Source)
ADD_SUBDIRECTORY(Utilities) ADD_SUBDIRECTORY(Utilities)
ADD_SUBDIRECTORY(Tests) ADD_SUBDIRECTORY(Tests)
CMAKE_SET_TARGET_FOLDER(CMakeLibTests "Tests")
CMAKE_SET_TARGET_FOLDER(cmw9xcom "Utilities/Win9xCompat")
CMAKE_SET_TARGET_FOLDER(documentation "Documentation")
# add a test # add a test
ADD_TEST(SystemInformationNew "${CMAKE_CMAKE_COMMAND}" ADD_TEST(SystemInformationNew "${CMAKE_CMAKE_COMMAND}"
--system-information -G "${CMAKE_TEST_GENERATOR}" ) --system-information -G "${CMAKE_TEST_GENERATOR}" )

View File

@ -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 # The following functions are provided by this module:
# on the Mac and bundle-like directories on any OS. # fixup_bundle
# # copy_and_fixup_bundle
# The following functions are provided by this script: # verify_app
# get_bundle_main_executable # get_bundle_main_executable
# get_dotapp_dir # get_dotapp_dir
# get_bundle_and_executable # get_bundle_and_executable
@ -15,14 +17,119 @@
# copy_resolved_item_into_bundle # copy_resolved_item_into_bundle
# copy_resolved_framework_into_bundle # copy_resolved_framework_into_bundle
# fixup_bundle_item # fixup_bundle_item
# fixup_bundle
# copy_and_fixup_bundle
# verify_bundle_prerequisites # verify_bundle_prerequisites
# verify_bundle_symlinks # verify_bundle_symlinks
# verify_app
#
# Requires CMake 2.6 or greater because it uses function, break and # Requires CMake 2.6 or greater because it uses function, break and
# PARENT_SCOPE. Also depends on GetPrerequisites.cmake. # 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. # 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") 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) function(get_bundle_main_executable bundle result_var)
set(result "error: '${bundle}/Contents/Info.plist' file does not exist") 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) 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) function(get_dotapp_dir exe dotapp_dir_var)
set(s "${exe}") set(s "${exe}")
@ -156,13 +249,6 @@ function(get_dotapp_dir exe dotapp_dir_var)
endfunction(get_dotapp_dir) 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) function(get_bundle_and_executable app bundle_var executable_var valid_var)
set(valid 0) set(valid 0)
@ -216,11 +302,6 @@ function(get_bundle_and_executable app bundle_var executable_var valid_var)
endfunction(get_bundle_and_executable) 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) function(get_bundle_all_executables bundle exes_var)
set(exes "") set(exes "")
@ -236,15 +317,6 @@ function(get_bundle_all_executables bundle exes_var)
endfunction(get_bundle_all_executables) 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) function(get_item_key item key_var)
get_filename_component(item_name "${item}" NAME) get_filename_component(item_name "${item}" NAME)
if(WIN32) if(WIN32)
@ -255,14 +327,6 @@ function(get_item_key item key_var)
endfunction(get_item_key) 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) function(clear_bundle_keys keys_var)
foreach(key ${${keys_var}}) foreach(key ${${keys_var}})
set(${key}_ITEM PARENT_SCOPE) set(${key}_ITEM PARENT_SCOPE)
@ -276,11 +340,6 @@ function(clear_bundle_keys keys_var)
endfunction(clear_bundle_keys) 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) function(set_bundle_key_values keys_var context item exepath dirs copyflag)
get_filename_component(item_name "${item}" NAME) 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) 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) function(get_bundle_keys app libs dirs keys_var)
set(${keys_var} PARENT_SCOPE) 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...) # but that do not show up in otool -L output...)
# #
foreach(lib ${libs}) 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 "") set(prereqs "")
get_prerequisites("${lib}" prereqs 1 1 "${exepath}" "${dirs}") 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) 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) function(copy_resolved_item_into_bundle resolved_item resolved_embedded_item)
if(WIN32) if(WIN32)
# ignore case on Windows # 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) 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) function(copy_resolved_framework_into_bundle resolved_item resolved_embedded_item)
if(WIN32) if(WIN32)
# ignore case on Windows # 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) 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) function(fixup_bundle_item resolved_embedded_item exepath dirs)
# This item's key is "ikey": # 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 "") endif(NOT "${${rkey}_EMBEDDED_ITEM}" STREQUAL "")
endforeach(pr) 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 # Change this item's id and all of its references in one call
# to install_name_tool: # to install_name_tool:
# #
@ -530,19 +557,6 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs)
endfunction(fixup_bundle_item) 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) function(fixup_bundle app libs dirs)
message(STATUS "fixup_bundle") message(STATUS "fixup_bundle")
message(STATUS " app='${app}'") message(STATUS " app='${app}'")
@ -617,23 +631,12 @@ function(fixup_bundle app libs dirs)
endfunction(fixup_bundle) 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) function(copy_and_fixup_bundle src dst libs dirs)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${src}" "${dst}") execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${src}" "${dst}")
fixup_bundle("${dst}" "${libs}" "${dirs}") fixup_bundle("${dst}" "${libs}" "${dirs}")
endfunction(copy_and_fixup_bundle) 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) function(verify_bundle_prerequisites bundle result_var info_var)
set(result 1) set(result 1)
set(info "") set(info "")
@ -695,12 +698,6 @@ function(verify_bundle_prerequisites bundle result_var info_var)
endfunction(verify_bundle_prerequisites) 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) function(verify_bundle_symlinks bundle result_var info_var)
set(result 1) set(result 1)
set(info "") set(info "")
@ -714,11 +711,6 @@ function(verify_bundle_symlinks bundle result_var info_var)
endfunction(verify_bundle_symlinks) 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) function(verify_app app)
set(verified 0) set(verified 0)
set(info "") set(info "")

View File

@ -21,8 +21,8 @@ IF(CMAKE_COMPILER_IS_MINGW)
SET(MINGW 1) SET(MINGW 1)
ENDIF(CMAKE_COMPILER_IS_MINGW) ENDIF(CMAKE_COMPILER_IS_MINGW)
SET(CMAKE_CXX_COMPILER_ID_RUN 1) 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_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) 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 30)
SET(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) SET(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1)

View File

@ -47,17 +47,17 @@ IF(CMAKE_HOST_UNIX)
IF(CMAKE_UNAME) IF(CMAKE_UNAME)
EXEC_PROGRAM(uname ARGS -s OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_NAME) EXEC_PROGRAM(uname ARGS -s OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_NAME)
EXEC_PROGRAM(uname ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION) 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 EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR
RETURN_VALUE val) 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 EXEC_PROGRAM(uname ARGS -p OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR
RETURN_VALUE val) RETURN_VALUE val)
IF("${val}" GREATER 0) IF("${val}" GREATER 0)
EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR
RETURN_VALUE val) RETURN_VALUE val)
ENDIF("${val}" GREATER 0) 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 # check the return of the last uname -m or -p
IF("${val}" GREATER 0) IF("${val}" GREATER 0)
SET(CMAKE_HOST_SYSTEM_PROCESSOR "unknown") SET(CMAKE_HOST_SYSTEM_PROCESSOR "unknown")

View File

@ -52,6 +52,94 @@ IF(CMAKE_GENERATOR MATCHES "Makefiles")
ENDIF(DEFINED CMAKE_RULE_MESSAGES) ENDIF(DEFINED CMAKE_RULE_MESSAGES)
ENDIF(CMAKE_GENERATOR MATCHES "Makefiles") 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 # Set a variable to indicate whether the value of CMAKE_INSTALL_PREFIX
# was initialized by the block below. This is useful for user # was initialized by the block below. This is useful for user
# projects to change the default prefix while still allowing the # projects to change the default prefix while still allowing the
@ -65,23 +153,11 @@ IF(CMAKE_HOST_UNIX)
SET(CMAKE_INSTALL_PREFIX "/usr/local" SET(CMAKE_INSTALL_PREFIX "/usr/local"
CACHE PATH "Install path prefix, prepended onto install directories.") CACHE PATH "Install path prefix, prepended onto install directories.")
ELSE(CMAKE_HOST_UNIX) ELSE(CMAKE_HOST_UNIX)
IF("$ENV{ProgramFiles}" MATCHES "^$") GetDefaultWindowsPrefixBase(CMAKE_GENERIC_PROGRAM_FILES)
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 "^$")
SET(CMAKE_INSTALL_PREFIX SET(CMAKE_INSTALL_PREFIX
"${CMAKE_GENERIC_PROGRAM_FILES}/${PROJECT_NAME}" "${CMAKE_GENERIC_PROGRAM_FILES}/${PROJECT_NAME}"
CACHE PATH "Install path prefix, prepended onto install directories.") CACHE PATH "Install path prefix, prepended onto install directories.")
SET(CMAKE_GENERIC_PROGRAM_FILES) 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) ENDIF(CMAKE_HOST_UNIX)
MARK_AS_ADVANCED( MARK_AS_ADVANCED(

View File

@ -83,13 +83,12 @@
# May be used to set RPM packages that are obsoleted by this one. # May be used to set RPM packages that are obsoleted by this one.
# CPACK_RPM_PACKAGE_RELOCATABLE # CPACK_RPM_PACKAGE_RELOCATABLE
# Mandatory : NO # Mandatory : NO
# Default : - # Default : CPACK_PACKAGE_RELOCATABLE
# If this variable is set to TRUE or ON CPackRPM will try # If this variable is set to TRUE or ON CPackRPM will try
# to build a relocatable RPM package. A relocatable RPM may # to build a relocatable RPM package. A relocatable RPM may
# be installed using rpm --prefix or --relocate in order to # be installed using rpm --prefix or --relocate in order to
# install it at an alternate place see rpm(8). # install it at an alternate place see rpm(8).
# Note that currently this may fail if the package contains # Note that currently this may fail if CPACK_SET_DESTDIR is set to ON.
# files installed with absolute path or CPACK_SET_DESTDIR is set to ON.
# If CPACK_SET_DESTDIR is set then you will get a warning message # 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 # but if there is file installed with absolute path you'll get
# unexpected behavior. # unexpected behavior.
@ -331,15 +330,18 @@ ELSE(CPACK_RPM_COMPRESSION_TYPE)
SET(CPACK_RPM_COMPRESSION_TYPE_TMP "") SET(CPACK_RPM_COMPRESSION_TYPE_TMP "")
ENDIF(CPACK_RPM_COMPRESSION_TYPE) 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_RELOCATABLE)
if(CPACK_RPM_PACKAGE_DEBUG) 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) endif(CPACK_RPM_PACKAGE_DEBUG)
if(CPACK_SET_DESTDIR) if(CPACK_SET_DESTDIR AND (NOT CPACK_SET_DESTDIR STREQUAL "I_ON"))
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.") 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) else(CPACK_SET_DESTDIR AND (NOT CPACK_SET_DESTDIR STREQUAL "I_ON"))
set(CPACK_RPM_PACKAGE_PREFIX ${CPACK_PACKAGING_INSTALL_PREFIX}) 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) endif(CPACK_RPM_PACKAGE_RELOCATABLE)
# check if additional fields for RPM spec header are given # 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}" WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}"
OUTPUT_VARIABLE CPACK_RPM_INSTALL_FILES) 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 # 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") SET(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}.spec")
@ -547,6 +577,7 @@ fi
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
${CPACK_RPM_INSTALL_FILES} ${CPACK_RPM_INSTALL_FILES}
${CPACK_RPM_ABSOLUTE_INSTALL_FILES}
%changelog %changelog
\@CPACK_RPM_SPEC_CHANGELOG\@ \@CPACK_RPM_SPEC_CHANGELOG\@

View File

@ -228,8 +228,10 @@ IF(BUILD_TESTING)
ENDIF(NOT BUILDNAME) ENDIF(NOT BUILDNAME)
# the build command # the build command
BUILD_COMMAND(MAKECOMMAND CONFIGURATION "\${CTEST_CONFIGURATION_TYPE}") BUILD_COMMAND(MAKECOMMAND_DEFAULT_VALUE
SET(MAKECOMMAND ${MAKECOMMAND} CACHE STRING "Command to build the project") 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 # the default build configuration the ctest build handler will use
# if there is no -C arg given to ctest: # if there is no -C arg given to ctest:

View File

@ -65,6 +65,7 @@ IF(NOT _CTEST_TARGETS_ADDED)
${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode} ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}
) )
SET_PROPERTY(TARGET ${mode} PROPERTY RULE_LAUNCH_CUSTOM "") SET_PROPERTY(TARGET ${mode} PROPERTY RULE_LAUNCH_CUSTOM "")
SET_PROPERTY(TARGET ${mode} PROPERTY FOLDER "CTestDashboardTargets")
ENDFOREACH(mode) ENDFOREACH(mode)
# For Makefile generators add more granular targets. # For Makefile generators add more granular targets.
@ -79,6 +80,7 @@ IF(NOT _CTEST_TARGETS_ADDED)
${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}${testtype} ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}${testtype}
) )
SET_PROPERTY(TARGET ${mode}${testtype} PROPERTY RULE_LAUNCH_CUSTOM "") SET_PROPERTY(TARGET ${mode}${testtype} PROPERTY RULE_LAUNCH_CUSTOM "")
SET_PROPERTY(TARGET ${mode}${testtype} PROPERTY FOLDER "CTestDashboardTargets")
ENDFOREACH(testtype) ENDFOREACH(testtype)
ENDFOREACH(mode) ENDFOREACH(mode)
ENDIF("${CMAKE_GENERATOR}" MATCHES Make) ENDIF("${CMAKE_GENERATOR}" MATCHES Make)

View File

@ -1,23 +1,100 @@
# - Macros for generating a summary of enabled/disabled features # - Macros for generating a summary of enabled/disabled features
# #
# 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.
#
# These macros can be used to generate a summary of enabled and disabled
# packages and/or feature for a build tree:
#
# -- 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() # PRINT_ENABLED_FEATURES()
# Print a summary of all enabled features. By default all successfull # Does the same as FEATURE_SUMMARY(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")
# 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.
# #
# PRINT_DISABLED_FEATURES() # PRINT_DISABLED_FEATURES()
# Same as PRINT_ENABLED_FEATURES(), but for disabled features. It can # Does the same as FEATURE_SUMMARY(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:")
# be extended the same way by adding to the global property
# DISABLED_FEATURES.
#
# 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/")
# #
# SET_FEATURE_INFO(<name> <description> [<url> [<comment>] ] )
# Does the same as SET_PACKAGE_INFO(<name> <description> <url> <comment> )
#============================================================================= #=============================================================================
# Copyright 2007-2009 Kitware, Inc. # Copyright 2007-2009 Kitware, Inc.
@ -32,47 +109,121 @@
# (To distribute this file outside of CMake, substitute the full # (To distribute this file outside of CMake, substitute the full
# License text for the above reference.) # License text for the above reference.)
FUNCTION(SET_FEATURE_INFO _name _desc) INCLUDE(CMakeParseArguments)
SET(_url "${ARGV2}")
SET(_comment "${ARGV3}")
SET_PROPERTY(GLOBAL PROPERTY ${_name}_DESCRIPTION "${_desc}" ) FUNCTION(ADD_FEATURE_INFO _name _enabled _desc)
IF(_url MATCHES ".+") IF (${_enabled})
SET_PROPERTY(GLOBAL PROPERTY ${_name}_URL "${_url}" ) SET_PROPERTY(GLOBAL APPEND PROPERTY ENABLED_FEATURES "${_name}")
ENDIF(_url MATCHES ".+") ELSE ()
IF(_comment MATCHES ".+") SET_PROPERTY(GLOBAL APPEND PROPERTY DISABLED_FEATURES "${_name}")
SET_PROPERTY(GLOBAL PROPERTY ${_name}_COMMENT "${_comment}" ) ENDIF ()
ENDIF(_comment MATCHES ".+")
SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_desc}" )
ENDFUNCTION(SET_FEATURE_INFO) ENDFUNCTION(SET_FEATURE_INFO)
FUNCTION(_PRINT_FEATURES _property _text) FUNCTION(SET_FEATURE_INFO)
SET(_currentFeatureText "${_text}") SET_PACKAGE_INFO(${ARGN})
ENDFUNCTION(SET_FEATURE_INFO)
FUNCTION(SET_PACKAGE_INFO _name _desc)
SET(_url "${ARGV2}")
SET(_comment "${ARGV3}")
SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_desc}" )
IF(_url MATCHES ".+")
SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_URL "${_url}" )
ENDIF(_url MATCHES ".+")
IF(_comment MATCHES ".+")
SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_COMMENT "${_comment}" )
ENDIF(_comment MATCHES ".+")
ENDFUNCTION(SET_PACKAGE_INFO)
FUNCTION(_FS_GET_FEATURE_SUMMARY _property _var)
SET(_currentFeatureText "")
GET_PROPERTY(_EnabledFeatures GLOBAL PROPERTY ${_property}) GET_PROPERTY(_EnabledFeatures GLOBAL PROPERTY ${_property})
FOREACH(_currentFeature ${_EnabledFeatures}) FOREACH(_currentFeature ${_EnabledFeatures})
SET(_currentFeatureText "${_currentFeatureText}\n${_currentFeature}") 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) IF(_info)
SET(_currentFeatureText "${_currentFeatureText} , ${_info}") SET(_currentFeatureText "${_currentFeatureText} , ${_info}")
ENDIF(_info) ENDIF(_info)
GET_PROPERTY(_info GLOBAL PROPERTY ${_currentFeature}_URL) GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_URL)
IF(_info) IF(_info)
SET(_currentFeatureText "${_currentFeatureText} , <${_info}>") SET(_currentFeatureText "${_currentFeatureText} , <${_info}>")
ENDIF(_info) ENDIF(_info)
GET_PROPERTY(_info GLOBAL PROPERTY ${_currentFeature}_COMMENT) GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_COMMENT)
IF(_info) IF(_info)
SET(_currentFeatureText "${_currentFeatureText} , ${_info}") SET(_currentFeatureText "${_currentFeatureText} , ${_info}")
ENDIF(_info) ENDIF(_info)
ENDFOREACH(_currentFeature) ENDFOREACH(_currentFeature)
MESSAGE(STATUS "${_currentFeatureText}\n") SET(${_var} "${_currentFeatureText}" PARENT_SCOPE)
ENDFUNCTION(_PRINT_FEATURES) ENDFUNCTION(_FS_GET_FEATURE_SUMMARY)
FUNCTION(PRINT_ENABLED_FEATURES) FUNCTION(PRINT_ENABLED_FEATURES)
_PRINT_FEATURES( ENABLED_FEATURES "Enabled features:") FEATURE_SUMMARY(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")
ENDFUNCTION(PRINT_ENABLED_FEATURES) ENDFUNCTION(PRINT_ENABLED_FEATURES)
FUNCTION(PRINT_DISABLED_FEATURES) FUNCTION(PRINT_DISABLED_FEATURES)
_PRINT_FEATURES( DISABLED_FEATURES "Disabled features:") FEATURE_SUMMARY(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:")
ENDFUNCTION(PRINT_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)

View File

@ -96,7 +96,7 @@ IF(BISON_EXECUTABLE)
# #
MACRO(BISON_TARGET Name BisonInput BisonOutput) MACRO(BISON_TARGET Name BisonInput BisonOutput)
SET(BISON_TARGET_output_header "") SET(BISON_TARGET_output_header "")
SET(BISON_TARGET_command_opt "") SET(BISON_TARGET_cmdopt "")
SET(BISON_TARGET_outputs "${BisonOutput}") SET(BISON_TARGET_outputs "${BisonOutput}")
IF(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7) IF(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7)
MESSAGE(SEND_ERROR "Usage") MESSAGE(SEND_ERROR "Usage")

View File

@ -19,6 +19,8 @@
# #
# set(Boost_USE_STATIC_LIBS ON) # set(Boost_USE_STATIC_LIBS ON)
# set(Boost_USE_MULTITHREADED 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 ... ) # find_package( Boost 1.36.0 COMPONENTS date_time filesystem system ... )
# #
# if(Boost_FOUND) # if(Boost_FOUND)
@ -84,6 +86,42 @@
# Boost_USE_STATIC_LIBS Can be set to ON to force the use of the static # Boost_USE_STATIC_LIBS Can be set to ON to force the use of the static
# boost libraries. Defaults to OFF. # 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. # Other Variables used by this module which you may want to set.
# #
# Boost_ADDITIONAL_VERSIONS A list of version numbers to use for searching # Boost_ADDITIONAL_VERSIONS A list of version numbers to use for searching
@ -105,12 +143,38 @@
# Boost_COMPILER Set this to the compiler suffix used by Boost # Boost_COMPILER Set this to the compiler suffix used by Boost
# (e.g. "-gcc43") if FindBoost has problems finding # (e.g. "-gcc43") if FindBoost has problems finding
# the proper Boost installation # 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: # These last three variables are available also as environment variables:
# #
# BOOST_ROOT or BOOSTROOT The preferred installation prefix for searching for # BOOST_ROOT or BOOSTROOT The preferred installation prefix for searching for
# Boost. Set this if the module has problems finding # 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 # BOOST_INCLUDEDIR Set this to the include directory of Boost, if the
# module has problems finding the proper Boost installation # module has problems finding the proper Boost installation
@ -165,7 +229,7 @@
# Copyright 2007 Wengo # Copyright 2007 Wengo
# Copyright 2007 Mike Jackson # Copyright 2007 Mike Jackson
# Copyright 2008 Andreas Pakulat <apaku@gmx.de> # 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"); # Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details. # see accompanying file Copyright.txt for details.
@ -275,6 +339,28 @@ function(_Boost_MARK_COMPONENTS_FOUND _yes_or_no)
endforeach() endforeach()
endfunction() 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 # End functions/macros
# #
@ -286,6 +372,9 @@ endfunction()
IF(NOT DEFINED Boost_USE_MULTITHREADED) IF(NOT DEFINED Boost_USE_MULTITHREADED)
SET(Boost_USE_MULTITHREADED TRUE) SET(Boost_USE_MULTITHREADED TRUE)
ENDIF() ENDIF()
if(NOT DEFINED Boost_COMPAT_STATIC_RUNTIME)
set(Boost_COMPAT_STATIC_RUNTIME TRUE)
endif()
if(Boost_FIND_VERSION_EXACT) if(Boost_FIND_VERSION_EXACT)
# The version may appear in a directory with or without the patch # The version may appear in a directory with or without the patch
@ -366,7 +455,7 @@ IF (_boost_IN_CACHE)
if(Boost_DEBUG) if(Boost_DEBUG)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
"boost ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION} " "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() endif()
ELSE (_boost_IN_CACHE) ELSE (_boost_IN_CACHE)
# Need to search for boost # Need to search for boost
@ -380,6 +469,12 @@ ELSE (_boost_IN_CACHE)
"Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}") "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}")
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
"Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}") "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() endif()
IF(WIN32) IF(WIN32)
@ -404,7 +499,7 @@ ELSE (_boost_IN_CACHE)
"-DBOOST_LIB_DIAGNOSTIC" CACHE STRING "Boost diagnostic define") "-DBOOST_LIB_DIAGNOSTIC" CACHE STRING "Boost diagnostic define")
ENDIF(WIN32) ENDIF(WIN32)
SET(_boost_INCLUDE_SEARCH_DIRS set(_boost_INCLUDE_SEARCH_DIRS_SYSTEM
C:/boost/include C:/boost/include
C:/boost C:/boost
"$ENV{ProgramFiles}/boost/include" "$ENV{ProgramFiles}/boost/include"
@ -412,6 +507,13 @@ ELSE (_boost_IN_CACHE)
/sw/local/include /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 BOOST_ROOT was defined in the environment, use it.
if (NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "") if (NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "")
set(BOOST_ROOT $ENV{BOOST_ROOT}) set(BOOST_ROOT $ENV{BOOST_ROOT})
@ -449,18 +551,25 @@ ELSE (_boost_IN_CACHE)
"_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}") "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
endif() endif()
IF( BOOST_ROOT ) if( Boost_NO_SYSTEM_PATHS)
SET(_boost_INCLUDE_SEARCH_DIRS 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}/include
${BOOST_ROOT} ${BOOST_ROOT}
${_boost_INCLUDE_SEARCH_DIRS}) ${_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) file(TO_CMAKE_PATH ${BOOST_INCLUDEDIR} BOOST_INCLUDEDIR)
SET(_boost_INCLUDE_SEARCH_DIRS set(_boost_INCLUDE_SEARCH_DIRS
${BOOST_INCLUDEDIR} ${_boost_INCLUDE_SEARCH_DIRS}) ${BOOST_INCLUDEDIR} ${_boost_INCLUDE_SEARCH_DIRS})
ENDIF( BOOST_INCLUDEDIR ) endif( BOOST_INCLUDEDIR )
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
# Search for Boost include DIR # Search for Boost include DIR
@ -486,10 +595,7 @@ ELSE (_boost_IN_CACHE)
ENDIF() ENDIF()
list(APPEND _boost_PATH_SUFFIXES "boost-${_boost_BOOSTIFIED_VERSION}") 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}") list(APPEND _boost_PATH_SUFFIXES "boost_${_boost_BOOSTIFIED_VERSION}")
endif()
ENDFOREACH(_boost_VER) ENDFOREACH(_boost_VER)
@ -507,6 +613,7 @@ ELSE (_boost_IN_CACHE)
NAMES boost/config.hpp NAMES boost/config.hpp
HINTS ${_boost_INCLUDE_SEARCH_DIRS} HINTS ${_boost_INCLUDE_SEARCH_DIRS}
PATH_SUFFIXES ${_boost_PATH_SUFFIXES} PATH_SUFFIXES ${_boost_PATH_SUFFIXES}
${_boost_FIND_OPTIONS}
) )
ENDIF( NOT Boost_INCLUDE_DIR ) ENDIF( NOT Boost_INCLUDE_DIR )
@ -637,7 +744,7 @@ ELSE (_boost_IN_CACHE)
endif() endif()
endif(Boost_COMPILER) endif(Boost_COMPILER)
SET (_boost_MULTITHREADED "-mt") set (_boost_MULTITHREADED "-mt")
if( NOT Boost_USE_MULTITHREADED ) if( NOT Boost_USE_MULTITHREADED )
set (_boost_MULTITHREADED "") set (_boost_MULTITHREADED "")
endif() endif()
@ -646,32 +753,67 @@ ELSE (_boost_IN_CACHE)
"_boost_MULTITHREADED = ${_boost_MULTITHREADED}") "_boost_MULTITHREADED = ${_boost_MULTITHREADED}")
endif() endif()
SET( _boost_STATIC_TAG "") #======================
set( _boost_ABI_TAG "") # Systematically build up the Boost ABI tag
IF (WIN32) # http://boost.org/doc/libs/1_41_0/more/getting_started/windows.html#library-naming
IF(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" 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") OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
SET (_boost_ABI_TAG "g") set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g")
ENDIF() endif()
IF( Boost_USE_STATIC_LIBS ) endif()
SET( _boost_STATIC_TAG "-s") # y using special debug build of python
ENDIF( Boost_USE_STATIC_LIBS ) if(Boost_USE_DEBUG_PYTHON)
ENDIF(WIN32) set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}y")
SET (_boost_ABI_TAG "${_boost_ABI_TAG}d") 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) if(Boost_DEBUG)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 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} ] " 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() endif()
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
# Begin finding boost libraries # 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}/../lib ${Boost_INCLUDE_DIR}/../lib
${Boost_INCLUDE_DIR}/stage/lib
)
set(_boost_LIBRARY_SEARCH_DIRS_SYSTEM
C:/boost/lib C:/boost/lib
C:/boost C:/boost
"$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}_${Boost_SUBMINOR_VERSION}/lib" "$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" "$ENV{ProgramFiles}/boost"
/sw/local/lib /sw/local/lib
) )
IF( BOOST_ROOT ) set(_boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS})
SET(_boost_LIBRARIES_SEARCH_DIRS if( Boost_NO_SYSTEM_PATHS )
${BOOST_ROOT}/lib set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH)
${BOOST_ROOT}/stage/lib else()
${_boost_LIBRARIES_SEARCH_DIRS}) list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_SYSTEM})
ENDIF( BOOST_ROOT ) endif()
IF( BOOST_LIBRARYDIR ) # prepend BOOST_LIBRARYDIR to search path if specified
if( BOOST_LIBRARYDIR )
file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR) file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR)
SET(_boost_LIBRARIES_SEARCH_DIRS set(_boost_LIBRARY_SEARCH_DIRS
${BOOST_LIBRARYDIR} ${_boost_LIBRARIES_SEARCH_DIRS}) ${BOOST_LIBRARYDIR} ${_boost_LIBRARY_SEARCH_DIRS})
ENDIF( BOOST_LIBRARYDIR ) endif()
if(Boost_DEBUG) if(Boost_DEBUG)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " 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() 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 # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
IF( Boost_USE_STATIC_LIBS ) if( Boost_USE_STATIC_LIBS )
SET( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
IF(WIN32) if(WIN32)
SET(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
ELSE(WIN32) else()
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) set(CMAKE_FIND_LIBRARY_SUFFIXES .a )
ENDIF(WIN32) endif()
ENDIF( Boost_USE_STATIC_LIBS ) endif()
FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE # We want to use the tag inline below without risking double dashes
NAMES ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${Boost_LIB_VERSION} if(_boost_RELEASE_ABI_TAG)
${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}-${Boost_LIB_VERSION} if(${_boost_RELEASE_ABI_TAG} STREQUAL "-")
${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}-${Boost_LIB_VERSION} set(_boost_RELEASE_ABI_TAG "")
${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}-${Boost_LIB_VERSION} 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 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}${_boost_MULTITHREADED}
${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG} ${Boost_LIB_PREFIX}boost_${COMPONENT} )
${Boost_LIB_PREFIX}boost_${COMPONENT} if(_boost_STATIC_RUNTIME_WORKAROUND)
HINTS ${_boost_LIBRARIES_SEARCH_DIRS} 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}"
) )
FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG if(Boost_REALPATH)
NAMES ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${_boost_ABI_TAG}-${Boost_LIB_VERSION} _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}")
${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}-${Boost_LIB_VERSION} _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "${_boost_docstring_debug}" )
${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}-${_boost_ABI_TAG}-${Boost_LIB_VERSION} endif()
${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}
)
_Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT}) _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT})
IF( Boost_USE_STATIC_LIBS )
SET(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) endforeach(COMPONENT)
ENDIF( Boost_USE_STATIC_LIBS )
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 # End finding boost libraries
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------

View File

@ -514,11 +514,19 @@ set (CUDA_INCLUDE_DIRS ${CUDA_TOOLKIT_INCLUDE})
macro(FIND_LIBRARY_LOCAL_FIRST _var _names _doc) macro(FIND_LIBRARY_LOCAL_FIRST _var _names _doc)
if(CMAKE_SIZEOF_VOID_P EQUAL 8) 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() 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} find_library(${_var}
NAMES ${_names} NAMES ${_names}
PATHS ${_cuda_64bit_lib_dir} PATHS ${_cuda_64bit_lib_dir}
"${CUDA_TOOLKIT_ROOT_DIR}/lib/Win32"
"${CUDA_TOOLKIT_ROOT_DIR}/lib" "${CUDA_TOOLKIT_ROOT_DIR}/lib"
ENV CUDA_LIB_PATH ENV CUDA_LIB_PATH
DOC ${_doc} DOC ${_doc}
@ -578,9 +586,20 @@ macro(FIND_CUDA_HELPER_LIBS _name)
mark_as_advanced(CUDA_${_name}_LIBRARY) mark_as_advanced(CUDA_${_name}_LIBRARY)
endmacro(FIND_CUDA_HELPER_LIBS) 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. # Search for cufft and cublas libraries.
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(cufftemu)
find_cuda_helper_libs(cublasemu) find_cuda_helper_libs(cublasemu)
endif()
find_cuda_helper_libs(cufft) find_cuda_helper_libs(cufft)
find_cuda_helper_libs(cublas) find_cuda_helper_libs(cublas)

View File

@ -5,20 +5,37 @@
# #
# INPUT Variables # INPUT Variables
# #
# CXXTEST_USE_PYTHON # CXXTEST_USE_PYTHON [deprecated since 1.3]
# If true, the CXXTEST_ADD_TEST macro will use # Only used in the case both Python & Perl
# the Python test generator instead of 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 # OUTPUT Variables
# #
# CXXTEST_FOUND # CXXTEST_FOUND
# True if the CxxTest framework was found # True if the CxxTest framework was found
# CXXTEST_INCLUDE_DIR # CXXTEST_INCLUDE_DIRS
# Where to find the CxxTest include directory # Where to find the CxxTest include directory
# CXXTEST_PERL_TESTGEN_EXECUTABLE # CXXTEST_PERL_TESTGEN_EXECUTABLE
# The perl-based test generator. # The perl-based test generator
# CXXTEST_PYTHON_TESTGEN_EXECUTABLE # 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: # MACROS for optional use by CMake users:
# #
@ -26,9 +43,11 @@
# Creates a CxxTest runner and adds it to the CTest testing suite # Creates a CxxTest runner and adds it to the CTest testing suite
# Parameters: # Parameters:
# test_name The name of the test # 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 # 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: # Example Usage:
@ -65,8 +84,8 @@
# #
#============================================================================= #=============================================================================
# Copyright 2008-2009 Kitware, Inc. # Copyright 2008-2010 Kitware, Inc.
# 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"); # Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details. # see accompanying file Copyright.txt for details.
@ -78,6 +97,14 @@
# (To distribute this file outside of CMake, substitute the full # (To distribute this file outside of CMake, substitute the full
# License text for the above reference.) # 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) # Version 1.2 (3/2/08)
# Included patch from Tyler Roscoe to have the perl & python binaries # Included patch from Tyler Roscoe to have the perl & python binaries
# detected based on CXXTEST_INCLUDE_DIR # detected based on CXXTEST_INCLUDE_DIR
@ -95,17 +122,12 @@
#============================================================= #=============================================================
macro(CXXTEST_ADD_TEST _cxxtest_testname _cxxtest_outfname) macro(CXXTEST_ADD_TEST _cxxtest_testname _cxxtest_outfname)
set(_cxxtest_real_outfname ${CMAKE_CURRENT_BINARY_DIR}/${_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( add_custom_command(
OUTPUT ${_cxxtest_real_outfname} OUTPUT ${_cxxtest_real_outfname}
DEPENDS ${ARGN} DEPENDS ${ARGN}
COMMAND ${_cxxtest_executable} COMMAND ${CXXTEST_TESTGEN_INTERPRETER}
--error-printer -o ${_cxxtest_real_outfname} ${ARGN} ${CXXTEST_TESTGEN_EXECUTABLE} ${CXXTEST_TESTGEN_ARGS} -o ${_cxxtest_real_outfname} ${ARGN}
) )
set_source_files_properties(${_cxxtest_real_outfname} PROPERTIES GENERATED true) set_source_files_properties(${_cxxtest_real_outfname} PROPERTIES GENERATED true)
@ -124,14 +146,48 @@ endmacro(CXXTEST_ADD_TEST)
#============================================================= #=============================================================
# main() # 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_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 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) include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CxxTest DEFAULT_MSG CXXTEST_INCLUDE_DIR)
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}) set(CXXTEST_INCLUDE_DIRS ${CXXTEST_INCLUDE_DIR})
endif()
else()
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()
endif()

View File

@ -78,7 +78,11 @@ IF(FLEX_EXECUTABLE)
RESULT_VARIABLE FLEX_version_result RESULT_VARIABLE FLEX_version_result
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
IF(NOT ${FLEX_version_result} EQUAL 0) 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() ELSE()
STRING(REGEX REPLACE "^flex (.*)$" "\\1" STRING(REGEX REPLACE "^flex (.*)$" "\\1"
FLEX_VERSION "${FLEX_version_output}") FLEX_VERSION "${FLEX_version_output}")

View File

@ -67,11 +67,6 @@ IF(APPLE)
SET( FLTK_PLATFORM_DEPENDENT_LIBS "-framework Carbon -framework Cocoa -framework ApplicationServices -lz") SET( FLTK_PLATFORM_DEPENDENT_LIBS "-framework Carbon -framework Cocoa -framework ApplicationServices -lz")
ENDIF(APPLE) 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 is already defined we assigne its value to FLTK_DIR
IF(FLTK_INCLUDE_DIR) IF(FLTK_INCLUDE_DIR)
SET(FLTK_DIR ${FLTK_INCLUDE_DIR}) SET(FLTK_DIR ${FLTK_INCLUDE_DIR})

View File

@ -45,10 +45,6 @@ IF(APPLE)
SET( FLTK2_PLATFORM_DEPENDENT_LIBS "-framework Carbon -framework Cocoa -framework ApplicationServices -lz") SET( FLTK2_PLATFORM_DEPENDENT_LIBS "-framework Carbon -framework Cocoa -framework ApplicationServices -lz")
ENDIF(APPLE) 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 is already defined we assigne its value to FLTK2_DIR
IF(FLTK2_INCLUDE_DIR) IF(FLTK2_INCLUDE_DIR)
SET(FLTK2_DIR ${FLTK2_INCLUDE_DIR}) SET(FLTK2_DIR ${FLTK2_INCLUDE_DIR})

View File

@ -66,7 +66,13 @@
# (To distribute this file outside of CMake, substitute the full # (To distribute this file outside of CMake, substitute the full
# License text for the above reference.) # 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 # * Add support for detecting new pangommconfig.h header file
# (Thanks to Sune Vuorela & the Debian Project for the patch) # (Thanks to Sune Vuorela & the Debian Project for the patch)
# * Add support for detecting fontconfig.h header # * Add support for detecting fontconfig.h header
@ -150,6 +156,7 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr)
atkmm-1.6 atkmm-1.6
cairo cairo
cairomm-1.0 cairomm-1.0
gdk-pixbuf-2.0
gdkmm-2.4 gdkmm-2.4
giomm-2.4 giomm-2.4
gtk-2.0 gtk-2.0
@ -184,6 +191,8 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr)
/usr/openwin/lib /usr/openwin/lib
/sw/include /sw/include
/sw/lib /sw/lib
/opt/local/include
/opt/local/lib
$ENV{GTKMM_BASEPATH}/include $ENV{GTKMM_BASEPATH}/include
$ENV{GTKMM_BASEPATH}/lib $ENV{GTKMM_BASEPATH}/lib
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/include [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_INCLUDE_DIR(GTK2_GOBJECT_INCLUDE_DIR gobject/gobject.h)
_GTK2_FIND_LIBRARY (GTK2_GOBJECT_LIBRARY gobject false true) _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_GDK_INCLUDE_DIR gdk/gdk.h)
_GTK2_FIND_INCLUDE_DIR(GTK2_GDKCONFIG_INCLUDE_DIR gdkconfig.h) _GTK2_FIND_INCLUDE_DIR(GTK2_GDKCONFIG_INCLUDE_DIR gdkconfig.h)
_GTK2_FIND_INCLUDE_DIR(GTK2_GTK_INCLUDE_DIR gtk/gtk.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_INCLUDE_DIR(GTK2_ATK_INCLUDE_DIR atk/atk.h)
_GTK2_FIND_LIBRARY (GTK2_ATK_LIBRARY atk false true) _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") elseif(_GTK2_component STREQUAL "gtkmm")

View File

@ -188,7 +188,7 @@ if (MPI_INCLUDE_PATH AND MPI_LIBRARY)
# the cache, and we don't want to override those settings. # the cache, and we don't want to override those settings.
elseif (MPI_COMPILE_CMDLINE) elseif (MPI_COMPILE_CMDLINE)
# Extract compile flags from the compile command line. # 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) set(MPI_COMPILE_FLAGS_WORK)
foreach(FLAG ${MPI_ALL_COMPILE_FLAGS}) foreach(FLAG ${MPI_ALL_COMPILE_FLAGS})
if (MPI_COMPILE_FLAGS_WORK) if (MPI_COMPILE_FLAGS_WORK)

View File

@ -20,18 +20,24 @@
# The second mode is more powerful and also supports version checking: # The second mode is more powerful and also supports version checking:
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME [REQUIRED_VARS <var1>...<varN>] # FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME [REQUIRED_VARS <var1>...<varN>]
# [VERSION_VAR <versionvar> # [VERSION_VAR <versionvar>
# [CONFIG_MODE]
# [FAIL_MESSAGE "Custom failure message"] ) # [FAIL_MESSAGE "Custom failure message"] )
# #
# As above, if <var1> through <varN> are all valid, <UPPERCASED_NAME>_FOUND # As above, if <var1> through <varN> are all valid, <UPPERCASED_NAME>_FOUND
# will be set to TRUE. # will be set to TRUE.
# Via FAIL_MESSAGE a custom failure message can be specified, if this is not # After REQUIRED_VARS the variables which are required for this package are listed.
# used, the default message will be displayed.
# Following VERSION_VAR the name of the variable can be specified which holds # 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 # 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 # will be checked against the (potentially) specified required version used
# in the find_package() call. The EXACT keyword is also handled. The default # in the find_package() call. The EXACT keyword is also handled. The default
# messages include information about the required version and the version # messages include information about the required version and the version
# which has been actually found, both if the version is ok or not. # 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: # Example for mode 1:
# #
@ -53,6 +59,15 @@
# Also the version of BISON will be checked by using the version contained # Also the version of BISON will be checked by using the version contained
# in BISON_VERSION. # in BISON_VERSION.
# Since no FAIL_MESSAGE is given, the default messages will be printed. # 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. # Copyright 2007-2009 Kitware, Inc.
@ -70,12 +85,50 @@
INCLUDE(FindPackageMessage) INCLUDE(FindPackageMessage)
INCLUDE(CMakeParseArguments) INCLUDE(CMakeParseArguments)
# 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)
FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG _VAR1)
# 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 # set up the arguments for CMAKE_PARSE_ARGUMENTS and check whether we are in
# new extended or in the "old" mode: # new extended or in the "old" mode:
SET(options) # none SET(options CONFIG_MODE)
SET(oneValueArgs FAIL_MESSAGE VERSION_VAR) SET(oneValueArgs FAIL_MESSAGE VERSION_VAR)
SET(multiValueArgs REQUIRED_VARS) SET(multiValueArgs REQUIRED_VARS)
SET(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} ) 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) IF(${INDEX} EQUAL -1)
SET(FPHSA_FAIL_MESSAGE ${_FIRST_ARG}) SET(FPHSA_FAIL_MESSAGE ${_FIRST_ARG})
SET(FPHSA_REQUIRED_VARS ${_VAR1} ${ARGN}) SET(FPHSA_REQUIRED_VARS ${ARGN})
SET(FPHSA_VERSION_VAR) SET(FPHSA_VERSION_VAR)
ELSE(${INDEX} EQUAL -1) 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) IF(FPHSA_UNPARSED_ARGUMENTS)
MESSAGE(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${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}") SET(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}")
ENDIF("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG") 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) IF(NOT FPHSA_REQUIRED_VARS)
MESSAGE(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()") MESSAGE(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()")
ENDIF(NOT FPHSA_REQUIRED_VARS) ENDIF(NOT FPHSA_REQUIRED_VARS)
@ -111,6 +172,7 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG _VAR1)
LIST(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR) LIST(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR)
STRING(TOUPPER ${_NAME} _NAME_UPPER) 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) # user knows better what went wrong (#6375)
@ -131,44 +193,42 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG _VAR1)
# version handling: # version handling:
SET(VERSION_MSG "") SET(VERSION_MSG "")
SET(VERSION_OK TRUE) SET(VERSION_OK TRUE)
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}} ) SET(VERSION ${${FPHSA_VERSION_VAR}} )
IF (${_NAME}_FIND_VERSION)
IF(VERSION) IF(VERSION)
IF(${_NAME}_FIND_VERSION_EXACT) # exact version required IF(${_NAME}_FIND_VERSION_EXACT) # exact version required
IF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") IF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}")
SET(VERSION_MSG " Found version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") SET(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"")
SET(VERSION_OK FALSE) SET(VERSION_OK FALSE)
ELSE (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") ELSE (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}")
SET(VERSION_MSG " (found exact version \"${VERSION}\")") SET(VERSION_MSG "(found suitable exact version \"${VERSION}\")")
ENDIF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") ENDIF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}")
ELSE(${_NAME}_FIND_VERSION_EXACT) # minimum version specified: ELSE(${_NAME}_FIND_VERSION_EXACT) # minimum version specified:
IF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") IF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}")
SET(VERSION_MSG " Found version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"") SET(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"")
SET(VERSION_OK FALSE) SET(VERSION_OK FALSE)
ELSE ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") ELSE ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}")
SET(VERSION_MSG " (found version \"${VERSION}\", required is \"${${_NAME}_FIND_VERSION}\")") SET(VERSION_MSG "(found suitable version \"${VERSION}\", required is \"${${_NAME}_FIND_VERSION}\")")
ENDIF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") ENDIF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}")
ENDIF(${_NAME}_FIND_VERSION_EXACT) 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)
# 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: # if the package was not found, but a version was given, add that to the output:
ELSE (${_NAME_UPPER}_FOUND)
IF(${_NAME}_FIND_VERSION_EXACT) 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) 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}_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) ENDIF (${_NAME}_FIND_VERSION)
IF(VERSION_OK) IF(VERSION_OK)
@ -182,26 +242,16 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG _VAR1)
IF (${_NAME_UPPER}_FOUND) IF (${_NAME_UPPER}_FOUND)
FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG}" "${DETAILS}") FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG}" "${DETAILS}")
ELSE (${_NAME_UPPER}_FOUND) ELSE (${_NAME_UPPER}_FOUND)
IF(FPHSA_CONFIG_MODE)
_FPHSA_HANDLE_FAILURE_CONFIG_MODE()
ELSE(FPHSA_CONFIG_MODE)
IF(NOT VERSION_OK) IF(NOT VERSION_OK)
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})")
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) ELSE(NOT VERSION_OK)
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}")
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) ENDIF(NOT VERSION_OK)
ENDIF(FPHSA_CONFIG_MODE)
ENDIF (${_NAME_UPPER}_FOUND) ENDIF (${_NAME_UPPER}_FOUND)

View File

@ -7,7 +7,7 @@
# #
#============================================================================= #=============================================================================
# Copyright 2005-2009 Kitware, Inc. # Copyright 2005-2010 Kitware, Inc.
# #
# Distributed under the OSI-approved BSD License (the "License"); # Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details. # see accompanying file Copyright.txt for details.
@ -20,8 +20,9 @@
# License text for the above reference.) # License text for the above reference.)
FIND_PROGRAM(PYTHON_EXECUTABLE 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 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.6\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]

View File

@ -8,18 +8,22 @@
# The minimum required version of Subversion can be specified using the # The minimum required version of Subversion can be specified using the
# standard syntax, e.g. FIND_PACKAGE(Subversion 1.4) # 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>) # Subversion_WC_INFO(<dir> <var-prefix>)
# is defined to extract information of a subversion working copy at # Subversion_WC_LOG(<dir> <var-prefix>)
# a given location. The macro defines the following variables: # 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_URL - url of the repository (at <dir>)
# <var-prefix>_WC_ROOT - root url of the repository # <var-prefix>_WC_ROOT - root url of the repository
# <var-prefix>_WC_REVISION - current revision # <var-prefix>_WC_REVISION - current revision
# <var-prefix>_WC_LAST_CHANGED_AUTHOR - author of last commit # <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_DATE - date of last commit
# <var-prefix>_WC_LAST_CHANGED_REV - revision 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>' # <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: # Example usage:
# FIND_PACKAGE(Subversion) # FIND_PACKAGE(Subversion)
# IF(SUBVERSION_FOUND) # IF(SUBVERSION_FOUND)
@ -74,6 +78,8 @@ IF(Subversion_SVN_EXECUTABLE)
STRING(REGEX REPLACE "^(.*\n)?URL: ([^\n]+).*" STRING(REGEX REPLACE "^(.*\n)?URL: ([^\n]+).*"
"\\2" ${prefix}_WC_URL "${${prefix}_WC_INFO}") "\\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]+).*" STRING(REGEX REPLACE "^(.*\n)?Revision: ([^\n]+).*"
"\\2" ${prefix}_WC_REVISION "${${prefix}_WC_INFO}") "\\2" ${prefix}_WC_REVISION "${${prefix}_WC_INFO}")
STRING(REGEX REPLACE "^(.*\n)?Last Changed Author: ([^\n]+).*" STRING(REGEX REPLACE "^(.*\n)?Last Changed Author: ([^\n]+).*"

View File

@ -6,7 +6,7 @@
# CMAKE_USE_PTHREADS_INIT - are we using pthreads # CMAKE_USE_PTHREADS_INIT - are we using pthreads
# CMAKE_HP_PTHREADS_INIT - are we using hp pthreads # CMAKE_HP_PTHREADS_INIT - are we using hp pthreads
# For systems with multiple thread libraries, caller can set # For systems with multiple thread libraries, caller can set
# CMAKE_THREAD_PREFER_PTHREADS # CMAKE_THREAD_PREFER_PTHREAD
#============================================================================= #=============================================================================
# Copyright 2002-2009 Kitware, Inc. # Copyright 2002-2009 Kitware, Inc.

View File

@ -4,7 +4,7 @@
# modules that you will use, you need to name them as components to # modules that you will use, you need to name them as components to
# the package: # 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 # There are two search branches: a windows style and a unix style. For
# windows, the following variables are searched for and set to # windows, the following variables are searched for and set to
@ -33,6 +33,13 @@
# wxWidgets_USE_UNIVERSAL # wxWidgets_USE_UNIVERSAL
# wxWidgets_USE_STATIC # 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 # The following are set after the configuration is done for both
# windows and unix style: # windows and unix style:
# #
@ -54,7 +61,8 @@
# wxWidgets_USE_FILE - Convenience include file. # wxWidgets_USE_FILE - Convenience include file.
# #
# Sample usage: # 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) # IF(wxWidgets_FOUND)
# INCLUDE(${wxWidgets_USE_FILE}) # INCLUDE(${wxWidgets_USE_FILE})
# # and for each of your dependent executable/library targets: # # and for each of your dependent executable/library targets:
@ -62,7 +70,7 @@
# ENDIF(wxWidgets_FOUND) # ENDIF(wxWidgets_FOUND)
# #
# If wxWidgets is required (i.e., not an optional part): # 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}) # INCLUDE(${wxWidgets_USE_FILE})
# # and for each of your dependent executable/library targets: # # and for each of your dependent executable/library targets:
# TARGET_LINK_LIBRARIES(<YourTarget> ${wxWidgets_LIBRARIES}) # TARGET_LINK_LIBRARIES(<YourTarget> ${wxWidgets_LIBRARIES})
@ -188,7 +196,7 @@ IF(EXISTS "${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake")
SET(wxWidgets_USE_FILE SET(wxWidgets_USE_FILE
"${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake") "${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake")
ELSE(EXISTS "${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") ENDIF(EXISTS "${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake")
#===================================================================== #=====================================================================
@ -213,7 +221,7 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32")
IF(wxWidgets_USE_MONOLITHIC) IF(wxWidgets_USE_MONOLITHIC)
SET(wxWidgets_FIND_COMPONENTS mono) SET(wxWidgets_FIND_COMPONENTS mono)
ELSE(wxWidgets_USE_MONOLITHIC) 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(wxWidgets_USE_MONOLITHIC)
ENDIF(NOT wxWidgets_FIND_COMPONENTS) 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 # FIXME: What if both regex libs are available. regex should be
# found outside the loop and only wx${LIB}${_UCD}${_DBG}. # found outside the loop and only wx${LIB}${_UCD}${_DBG}.
# Find wxWidgets common libraries. # Find wxWidgets common libraries.
FOREACH(LIB ${wxWidgets_COMMON_LIBRARIES}) FOREACH(LIB ${wxWidgets_COMMON_LIBRARIES} scintilla)
FIND_LIBRARY(WX_${LIB}${_DBG} FIND_LIBRARY(WX_${LIB}${_DBG}
NAMES NAMES
wx${LIB}${_UCD}${_DBG} # for regex wx${LIB}${_UCD}${_DBG} # for regex
@ -303,7 +311,8 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32")
MARK_AS_ADVANCED(WX_mono${_DBG}) MARK_AS_ADVANCED(WX_mono${_DBG})
# Find wxWidgets multilib libraries. # 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} FIND_LIBRARY(WX_${LIB}${_DBG}
NAMES NAMES
wxmsw${_UNV}29${_UCD}${_DBG}_${LIB} 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 ""). # Clear all debug or release library paths (arguments are "d" or "").
MACRO(WX_CLEAR_ALL_LIBS _DBG) MACRO(WX_CLEAR_ALL_LIBS _DBG)
# Clear wxWidgets common libraries. # Clear wxWidgets common libraries.
FOREACH(LIB ${wxWidgets_COMMON_LIBRARIES}) FOREACH(LIB ${wxWidgets_COMMON_LIBRARIES} scintilla)
WX_CLEAR_LIB(WX_${LIB}${_DBG}) WX_CLEAR_LIB(WX_${LIB}${_DBG})
ENDFOREACH(LIB) ENDFOREACH(LIB)
@ -344,7 +353,8 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32")
WX_CLEAR_LIB(WX_mono${_DBG}) WX_CLEAR_LIB(WX_mono${_DBG})
# Clear wxWidgets multilib libraries. # 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}) WX_CLEAR_LIB(WX_${LIB}${_DBG})
ENDFOREACH(LIB) ENDFOREACH(LIB)
ENDMACRO(WX_CLEAR_ALL_LIBS) ENDMACRO(WX_CLEAR_ALL_LIBS)
@ -561,23 +571,23 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32")
# Get configuration parameters from the name. # Get configuration parameters from the name.
WX_GET_NAME_COMPONENTS(${wxWidgets_CONFIGURATION} UNV UCD DBG) WX_GET_NAME_COMPONENTS(${wxWidgets_CONFIGURATION} UNV UCD DBG)
# Set wxWidgets lib setup include directory.
IF(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h)
SET(wxWidgets_INCLUDE_DIRS
${WX_LIB_DIR}/${wxWidgets_CONFIGURATION})
ELSE(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h)
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. # Set wxWidgets main include directory.
IF(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h) IF(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h)
SET(wxWidgets_INCLUDE_DIRS ${WX_ROOT_DIR}/include) LIST(APPEND wxWidgets_INCLUDE_DIRS ${WX_ROOT_DIR}/include)
ELSE(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h) 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") 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) SET(wxWidgets_FOUND FALSE)
ENDIF(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h) 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
${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.")
SET(wxWidgets_FOUND FALSE)
ENDIF(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h)
# Find wxWidgets libraries. # Find wxWidgets libraries.
WX_FIND_LIBS("${UNV}" "${UCD}" "${DBG}") WX_FIND_LIBS("${UNV}" "${UCD}" "${DBG}")
IF(WX_USE_REL_AND_DBG) IF(WX_USE_REL_AND_DBG)
@ -612,7 +622,8 @@ ELSE(wxWidgets_FIND_STYLE STREQUAL "win32")
# #
MACRO(WX_CONFIG_SELECT_GET_DEFAULT) MACRO(WX_CONFIG_SELECT_GET_DEFAULT)
EXECUTE_PROCESS( EXECUTE_PROCESS(
COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}" --selected-config COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}"
${wxWidgets_CONFIG_OPTIONS} --selected-config
OUTPUT_VARIABLE _wx_selected_config OUTPUT_VARIABLE _wx_selected_config
RESULT_VARIABLE _wx_result RESULT_VARIABLE _wx_result
ERROR_QUIET ERROR_QUIET
@ -640,13 +651,15 @@ ELSE(wxWidgets_FIND_STYLE STREQUAL "win32")
# #
MACRO(WX_CONFIG_SELECT_QUERY_BOOL _OPT_NAME _OPT_HELP) MACRO(WX_CONFIG_SELECT_QUERY_BOOL _OPT_NAME _OPT_HELP)
EXECUTE_PROCESS( 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 RESULT_VARIABLE _wx_result_yes
OUTPUT_QUIET OUTPUT_QUIET
ERROR_QUIET ERROR_QUIET
) )
EXECUTE_PROCESS( 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 RESULT_VARIABLE _wx_result_no
OUTPUT_QUIET OUTPUT_QUIET
ERROR_QUIET ERROR_QUIET
@ -672,7 +685,7 @@ ELSE(wxWidgets_FIND_STYLE STREQUAL "win32")
# among multiple builds. # among multiple builds.
# #
MACRO(WX_CONFIG_SELECT_SET_OPTIONS) MACRO(WX_CONFIG_SELECT_SET_OPTIONS)
SET(wxWidgets_SELECT_OPTIONS "") SET(wxWidgets_SELECT_OPTIONS ${wxWidgets_CONFIG_OPTIONS})
FOREACH(_opt_name debug static unicode universal) FOREACH(_opt_name debug static unicode universal)
STRING(TOUPPER ${_opt_name} _upper_opt_name) STRING(TOUPPER ${_opt_name} _upper_opt_name)
IF(DEFINED wxWidgets_USE_${_upper_opt_name}) IF(DEFINED wxWidgets_USE_${_upper_opt_name})

View File

@ -1,14 +1,16 @@
# GetPrerequisites.cmake # - Functions to analyze and list executable file prerequisites.
# # This module provides functions to list the .dll, .dylib or .so
# This script provides functions to list the .dll, .dylib or .so files that an # files that an executable or shared library file depends on. (Its
# executable or shared library file depends on. (Its prerequisites.) # prerequisites.)
# #
# It uses various tools to obtain the list of required shared library files: # It uses various tools to obtain the list of required shared library files:
# dumpbin (Windows) # dumpbin (Windows)
# ldd (Linux/Unix) # ldd (Linux/Unix)
# otool (Mac OSX) # otool (Mac OSX)
# # The following functions are provided by this module:
# The following functions are provided by this script: # get_prerequisites
# list_prerequisites
# list_prerequisites_by_glob
# gp_append_unique # gp_append_unique
# is_file_executable # is_file_executable
# gp_item_default_embedded_path # gp_item_default_embedded_path
@ -18,12 +20,91 @@
# gp_resolved_file_type # gp_resolved_file_type
# (projects can override with gp_resolved_file_type_override) # (projects can override with gp_resolved_file_type_override)
# gp_file_type # gp_file_type
# get_prerequisites
# list_prerequisites
# list_prerequisites_by_glob
#
# Requires CMake 2.6 or greater because it uses function, break, return and # Requires CMake 2.6 or greater because it uses function, break, return and
# PARENT_SCOPE. # 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. # Copyright 2008-2009 Kitware, Inc.
@ -38,11 +119,6 @@
# (To distribute this file outside of CMake, substitute the full # (To distribute this file outside of CMake, substitute the full
# License text for the above reference.) # 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) function(gp_append_unique list_var value)
set(contains 0) set(contains 0)
@ -59,12 +135,6 @@ function(gp_append_unique list_var value)
endfunction(gp_append_unique) 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) function(is_file_executable file result_var)
# #
# A file is not executable until proven otherwise: # A file is not executable until proven otherwise:
@ -132,14 +202,6 @@ function(is_file_executable file result_var)
endfunction(is_file_executable) 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) function(gp_item_default_embedded_path item default_embedded_path_var)
# On Windows and Linux, "embed" prerequisites in the same directory # 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) 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) function(gp_resolve_item context item exepath dirs resolved_item_var)
set(resolved 0) set(resolved 0)
set(resolved_item "${item}") set(resolved_item "${item}")
@ -332,23 +387,6 @@ warning: cannot resolve item '${item}'
endfunction(gp_resolve_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) function(gp_resolved_file_type original_file file exepath dirs type_var)
#message(STATUS "**") #message(STATUS "**")
@ -445,17 +483,6 @@ function(gp_resolved_file_type original_file file exepath dirs type_var)
endfunction() 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) function(gp_file_type original_file file type_var)
if(NOT IS_ABSOLUTE "${original_file}") if(NOT IS_ABSOLUTE "${original_file}")
message(STATUS "warning: gp_file_type expects absolute full path for first arg 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) 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) function(get_prerequisites target prerequisites_var exclude_system recurse exepath dirs)
set(verbose 0) set(verbose 0)
set(eol_char "E") 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 ";" "\\\\;" candidates "${gp_cmd_ov}")
string(REGEX REPLACE "\n" "${eol_char};" candidates "${candidates}") 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: # Analyze each line for file names that match the regular expression:
# #
foreach(candidate ${candidates}) foreach(candidate ${candidates})
@ -667,14 +687,18 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
# #
set(add_item 1) 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 "") set(type "")
gp_resolved_file_type("${target}" "${item}" "${exepath}" "${dirs}" type) gp_resolved_file_type("${target}" "${item}" "${exepath}" "${dirs}" type)
if("${type}" STREQUAL "system") if("${type}" STREQUAL "system")
set(add_item 0) set(add_item 0)
endif("${type}" STREQUAL "system") endif("${type}" STREQUAL "system")
endif(${exclude_system}) endif(add_item AND ${exclude_system})
if(add_item) if(add_item)
list(LENGTH ${prerequisites_var} list_length_before_append) 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) 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) function(list_prerequisites target)
if("${ARGV1}" STREQUAL "") if("${ARGV1}" STREQUAL "")
set(all 1) set(all 1)
@ -782,17 +793,6 @@ function(list_prerequisites target)
endfunction(list_prerequisites) 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) function(list_prerequisites_by_glob glob_arg glob_exp)
message(STATUS "=============================================================================") message(STATUS "=============================================================================")
message(STATUS "List prerequisites of executables matching ${glob_arg} '${glob_exp}'") message(STATUS "List prerequisites of executables matching ${glob_arg} '${glob_exp}'")

View File

@ -235,4 +235,7 @@ SET(CMAKE_SYSTEM_APPBUNDLE_PATH
/Developer/Applications) /Developer/Applications)
INCLUDE(Platform/UnixPaths) INCLUDE(Platform/UnixPaths)
LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH /sw) LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH
/sw # Fink
/opt/local # MacPorts
)

View File

@ -1,3 +1,5 @@
SET(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib)
SET(CMAKE_SHARED_LIBRARY_SUFFIX ".sl") # .so SET(CMAKE_SHARED_LIBRARY_SUFFIX ".sl") # .so
SET(CMAKE_DL_LIBS "dld") SET(CMAKE_DL_LIBS "dld")
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".sl" ".so" ".a") SET(CMAKE_FIND_LIBRARY_SUFFIXES ".sl" ".so" ".a")

View File

@ -51,7 +51,7 @@ LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH
/usr/X11R6/include /usr/include/X11 /usr/X11R6/include /usr/include/X11
# Other # Other
/opt/local/include /usr/pkg/include /usr/pkg/include
/opt/csw/include /opt/include /opt/csw/include /opt/include
/usr/openwin/include /usr/openwin/include
) )
@ -64,7 +64,7 @@ LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH
/usr/X11R6/lib /usr/lib/X11 /usr/X11R6/lib /usr/lib/X11
# Other # Other
/opt/local/lib /usr/pkg/lib /usr/pkg/lib
/opt/csw/lib /opt/lib /opt/csw/lib /opt/lib
/usr/openwin/lib /usr/openwin/lib
) )

View File

@ -1,3 +1,2 @@
include(Platform/Windows-GNU) include(Platform/Windows-GNU)
__windows_compiler_gnu(Fortran) __windows_compiler_gnu(Fortran)
set(CMAKE_Fortran_USE_RESPONSE_FILE_FOR_OBJECTS 0)

View File

@ -76,7 +76,23 @@ macro(__windows_compiler_gnu lang)
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") # No -fPIC on Windows 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}_USE_RESPONSE_FILE_FOR_OBJECTS ${__WINDOWS_GNU_LD_RESPONSE})
# 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,@") 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. # Binary link rules.
set(CMAKE_${lang}_CREATE_SHARED_MODULE 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>") "<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 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>") "<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() endmacro()

View File

@ -10,6 +10,8 @@ ELSE(CMAKE_VERBOSE_MAKEFILE)
SET(CMAKE_CL_NOLOGO "/nologo") SET(CMAKE_CL_NOLOGO "/nologo")
ENDIF(CMAKE_VERBOSE_MAKEFILE) ENDIF(CMAKE_VERBOSE_MAKEFILE)
SET(CMAKE_Fortran_MODDIR_FLAG "-module:")
SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY 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}") "link ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out:<TARGET> /dll <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")

View File

@ -12,6 +12,18 @@ ELSE(CMAKE_VERBOSE_MAKEFILE)
SET(CMAKE_LIB_QUIET "-q") SET(CMAKE_LIB_QUIET "-q")
ENDIF(CMAKE_VERBOSE_MAKEFILE) 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_BUILD_TYPE_INIT Debug)
SET (CMAKE_CXX_FLAGS_INIT "-w=3 -xs") 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")
@ -19,10 +31,10 @@ SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-br -bm -os -dNDEBUG")
SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-br -bm -ot -dNDEBUG") SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-br -bm -ot -dNDEBUG")
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-br -bm -d2 -ot -dNDEBUG") SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-br -bm -d2 -ot -dNDEBUG")
SET (CMAKE_C_FLAGS_INIT "-w=3 ") 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_MINSIZEREL_INIT "-br -bm -os -dNDEBUG")
SET (CMAKE_C_FLAGS_RELEASE_INIT "-br -bm -ot -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_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}") 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 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}") "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}) SET(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE})
# compile a C++ file into an object file # compile a C++ file into an object file

View File

@ -129,7 +129,11 @@ MACRO (QT4_GENERATE_MOC infile outfile )
# get include dirs and flags # get include dirs and flags
QT4_GET_MOC_FLAGS(moc_flags) QT4_GET_MOC_FLAGS(moc_flags)
GET_FILENAME_COMPONENT(abs_infile ${infile} ABSOLUTE) 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 SET_SOURCE_FILES_PROPERTIES(${outfile} PROPERTIES SKIP_AUTOMOC TRUE) # dont run automoc on this file
ENDMACRO (QT4_GENERATE_MOC) ENDMACRO (QT4_GENERATE_MOC)
@ -187,10 +191,9 @@ MACRO (QT4_ADD_RESOURCES outfiles )
SET(_RC_DEPENDS) SET(_RC_DEPENDS)
FOREACH(_RC_FILE ${_RC_FILES}) FOREACH(_RC_FILE ${_RC_FILES})
STRING(REGEX REPLACE "^<file[^>]*>" "" _RC_FILE "${_RC_FILE}") STRING(REGEX REPLACE "^<file[^>]*>" "" _RC_FILE "${_RC_FILE}")
STRING(REGEX MATCH "^/|([A-Za-z]:/)" _ABS_PATH_INDICATOR "${_RC_FILE}") IF(NOT IS_ABSOLUTE "${_RC_FILE}")
IF(NOT _ABS_PATH_INDICATOR)
SET(_RC_FILE "${rc_path}/${_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}") SET(_RC_DEPENDS ${_RC_DEPENDS} "${_RC_FILE}")
ENDFOREACH(_RC_FILE) ENDFOREACH(_RC_FILE)
ADD_CUSTOM_COMMAND(OUTPUT ${outfile} ADD_CUSTOM_COMMAND(OUTPUT ${outfile}

View File

@ -1,15 +1,13 @@
# - Convenience include for using wxWidgets library # - Convenience include for using wxWidgets library.
# Finds if wxWidgets is installed # Determines if wxWidgets was FOUND and sets the appropriate libs, incdirs,
# and set the appropriate libs, incdirs, flags etc. # flags, etc. INCLUDE_DIRECTORIES and LINK_DIRECTORIES are called.
# INCLUDE_DIRECTORIES, LINK_DIRECTORIES and ADD_DEFINITIONS
# are called.
# #
# USAGE # USAGE
# SET( wxWidgets_USE_LIBS gl xml xrc ) # optionally: more than wx std libs # # Note that for MinGW users the order of libs is important!
# FIND_PACKAGE(wxWidgets REQUIRED) # FIND_PACKAGE(wxWidgets REQUIRED net gl core base)
# INCLUDE( ${xWidgets_USE_FILE} ) # INCLUDE(${wxWidgets_USE_FILE})
# ... add your targets here, e.g. ADD_EXECUTABLE/ ADD_LIBRARY ... # # and for each of your dependant executable/library targets:
# TARGET_LINK_LIBRARIERS( <yourWxDependantTarget> ${wxWidgets_LIBRARIES}) # TARGET_LINK_LIBRARIES(<YourTarget> ${wxWidgets_LIBRARIES})
# #
# DEPRECATED # DEPRECATED
# LINK_LIBRARIES is not called in favor of adding dependencies per target. # LINK_LIBRARIES is not called in favor of adding dependencies per target.

View File

@ -22,11 +22,12 @@
#include <errno.h> #include <errno.h>
#include <cmsys/SystemTools.hxx> #include <cmsys/SystemTools.hxx>
#include <cmsys/Directory.hxx>
#include <cm_libarchive.h> #include <cm_libarchive.h>
//---------------------------------------------------------------------- //----------------------------------------------------------------------
cmCPackArchiveGenerator::cmCPackArchiveGenerator(CompressType t, cmCPackArchiveGenerator::cmCPackArchiveGenerator(cmArchiveWrite::Compress t,
ArchiveType at) cmArchiveWrite::Type at)
{ {
this->Compress = t; this->Compress = t;
this->Archive = at; this->Archive = at;
@ -37,222 +38,291 @@ cmCPackArchiveGenerator::~cmCPackArchiveGenerator()
{ {
} }
static const size_t cmCPackTGZ_Data_BlockSize = 16384;
// make this an anonymous namespace so that archive.h does not
// have to be included in the .h file for this class
namespace
{
bool SetArchiveType(struct archive* a,
cmCPackArchiveGenerator::CompressType ct,
cmCPackArchiveGenerator::ArchiveType at)
{
int res = 0;
// pick the archive type
switch(at)
{
case cmCPackArchiveGenerator::TAR:
// maybe this:
res = archive_write_set_format_pax_restricted(a);
break;
case cmCPackArchiveGenerator::ZIP:
res = archive_write_set_format_zip(a);
break;
}
if(res != ARCHIVE_OK)
{
return false;
}
// pick a compression type
switch(ct)
{
case cmCPackArchiveGenerator::GZIP:
res = archive_write_set_compression_gzip(a);
break;
case cmCPackArchiveGenerator::BZIP2:
res = archive_write_set_compression_bzip2(a);
break;
case cmCPackArchiveGenerator::COMPRESS:
res = archive_write_set_compression_compress(a);
break;
case cmCPackArchiveGenerator::LZMA:
res = archive_write_set_compression_lzma(a);
break;
case cmCPackArchiveGenerator::NONE:
default:
res = archive_write_set_compression_none(a);
}
if(res != ARCHIVE_OK)
{
return false;
}
// do not pad the last block!!
res = archive_write_set_bytes_in_last_block(a, 1);
if(res != ARCHIVE_OK)
{
return false;
}
return true;
}
struct StreamData
{
StreamData(cmGeneratedFileStream* gfs,
cmCPackArchiveGenerator* ag)
{
this->GeneratedFileStream = gfs;
this->Generator = ag;
}
cmGeneratedFileStream* GeneratedFileStream;
cmCPackArchiveGenerator* Generator;
};
extern "C"
{
int OpenArchive(struct archive *, void *client_data)
{
struct StreamData *data = (StreamData*)client_data;
if(data->GeneratedFileStream &&
*data->GeneratedFileStream)
{
if(data->Generator->
GenerateHeader(data->GeneratedFileStream))
{
return ARCHIVE_OK;
}
}
return (ARCHIVE_FATAL);
}
__LA_SSIZE_T WriteArchive(struct archive *,
void *client_data,
const void *buff,
size_t n)
{
struct StreamData *data = (StreamData*)client_data;
data->GeneratedFileStream->
write(reinterpret_cast<const char*>(buff),n);
if(!data->GeneratedFileStream->bad())
{
return n;
}
return 0;
}
int CloseArchive(struct archive *, void *client_data)
{
struct StreamData *data = (StreamData*)client_data;
if(data->GeneratedFileStream->Close())
{
delete data->GeneratedFileStream;
return ARCHIVE_OK;
}
return ARCHIVE_FATAL;
}
} //extern C
} // anon name space
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int cmCPackArchiveGenerator::InitializeInternal() int cmCPackArchiveGenerator::InitializeInternal()
{ {
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1"); this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1");
return this->Superclass::InitializeInternal(); return this->Superclass::InitializeInternal();
} }
//----------------------------------------------------------------------
int cmCPackArchiveGenerator::addOneComponentToArchive(cmArchiveWrite& archive,
cmCPackComponent* component)
{
cmCPackLogger(cmCPackLog::LOG_VERBOSE, " - packaging component: "
<< component->Name
<< std::endl);
// Add the files of this component to the archive
std::string localToplevel(this->GetOption("CPACK_TEMPORARY_DIRECTORY"));
localToplevel += "/"+ component->Name;
std::string dir = cmSystemTools::GetCurrentWorkingDirectory();
// Change to local toplevel
cmSystemTools::ChangeDirectory(localToplevel.c_str());
std::vector<std::string>::const_iterator fileIt;
for (fileIt = component->Files.begin(); fileIt != component->Files.end();
++fileIt )
{
cmCPackLogger(cmCPackLog::LOG_DEBUG,"Adding file: "
<< (*fileIt) << std::endl);
archive.Add(*fileIt);
if (!archive)
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "ERROR while packaging files: "
<< archive.GetError()
<< std::endl);
return 0;
}
}
// Go back to previous dir
cmSystemTools::ChangeDirectory(dir.c_str());
return 1;
}
/*
* The macro will open/create a file 'filename'
* an declare and open the associated
* cmArchiveWrite 'archive' object.
*/
#define DECLARE_AND_OPEN_ARCHIVE(filename,archive) \
cmGeneratedFileStream gf; \
gf.Open(filename.c_str(), false, true); \
if (!GenerateHeader(&gf)) \
{ \
cmCPackLogger(cmCPackLog::LOG_ERROR, \
"Problem to generate Header for archive < " \
<< filename \
<< ">." << std::endl); \
return 0; \
} \
cmArchiveWrite archive(gf,this->Compress, this->Archive); \
if (!archive) \
{ \
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem to create archive < " \
<< filename \
<< ">. ERROR =" \
<< archive.GetError() \
<< std::endl); \
return 0; \
}
//----------------------------------------------------------------------
int cmCPackArchiveGenerator::PackageComponents(bool ignoreComponentGroup)
{
packageFileNames.clear();
// The default behavior is to have one package by component group
// unless CPACK_COMPONENTS_IGNORE_GROUP is specified.
if (!ignoreComponentGroup)
{
std::map<std::string, cmCPackComponentGroup>::iterator compGIt;
for (compGIt=this->ComponentGroups.begin();
compGIt!=this->ComponentGroups.end(); ++compGIt)
{
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Packaging component group: "
<< compGIt->first
<< std::endl);
// Begin the archive for this group
std::string packageFileName= std::string(toplevel);
packageFileName += "/"
+std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME"))
+"-"+compGIt->first + this->GetOutputExtension();
// open a block in order to automatically close archive
// at the end of the block
{
DECLARE_AND_OPEN_ARCHIVE(packageFileName,archive);
// now iterate over the component of this group
std::vector<cmCPackComponent*>::iterator compIt;
for (compIt=(compGIt->second).Components.begin();
compIt!=(compGIt->second).Components.end();
++compIt)
{
// Add the files of this component to the archive
addOneComponentToArchive(archive,*compIt);
}
}
// add the generated package to package file names list
packageFileNames.push_back(packageFileName);
}
}
// CPACK_COMPONENTS_IGNORE_GROUPS is set
// We build 1 package per component
else
{
std::map<std::string, cmCPackComponent>::iterator compIt;
for (compIt=this->Components.begin();
compIt!=this->Components.end(); ++compIt )
{
std::string localToplevel(this->GetOption("CPACK_TEMPORARY_DIRECTORY"));
std::string packageFileName = std::string(toplevel);
localToplevel += "/"+ compIt->first;
packageFileName += "/"
+std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME"))
+"-"+compIt->first + this->GetOutputExtension();
{
DECLARE_AND_OPEN_ARCHIVE(packageFileName,archive);
// Add the files of this component to the archive
addOneComponentToArchive(archive,&(compIt->second));
}
// add the generated package to package file names list
packageFileNames.push_back(packageFileName);
}
}
return 1;
}
//----------------------------------------------------------------------
int cmCPackArchiveGenerator::PackageComponentsAllInOne(bool allComponentInOne)
{
// reset the package file names
packageFileNames.clear();
packageFileNames.push_back(std::string(toplevel));
packageFileNames[0] += "/"
+std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME"))
+"-ALL" + this->GetOutputExtension();
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Packaging all groups in one package..."
"(CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE is set)"
<< std::endl);
DECLARE_AND_OPEN_ARCHIVE(packageFileNames[0],archive);
// The ALL GROUP in ONE package case
if (! allComponentInOne) {
// iterate over the component groups
std::map<std::string, cmCPackComponentGroup>::iterator compGIt;
for (compGIt=this->ComponentGroups.begin();
compGIt!=this->ComponentGroups.end(); ++compGIt)
{
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Packaging component group: "
<< compGIt->first
<< std::endl);
// now iterate over the component of this group
std::vector<cmCPackComponent*>::iterator compIt;
for (compIt=(compGIt->second).Components.begin();
compIt!=(compGIt->second).Components.end();
++compIt)
{
// Add the files of this component to the archive
addOneComponentToArchive(archive,*compIt);
}
}
}
// The ALL COMPONENT in ONE package case
else
{
std::map<std::string, cmCPackComponent>::iterator compIt;
for (compIt=this->Components.begin();compIt!=this->Components.end();
++compIt )
{
// Add the files of this component to the archive
addOneComponentToArchive(archive,&(compIt->second));
}
}
// archive goes out of scope so it will finalized and closed.
return 1;
}
//----------------------------------------------------------------------
int cmCPackArchiveGenerator::PackageFiles() int cmCPackArchiveGenerator::PackageFiles()
{ {
int res = ARCHIVE_OK;
#define CHECK_ARCHIVE_ERROR(res, msg) \
if(res != ARCHIVE_OK) \
{\
cmCPackLogger(cmCPackLog::LOG_ERROR, msg \
<< archive_error_string(a) \
<< cmSystemTools::GetLastSystemError() \
<< " " << res \
<< "\n"); \
}
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: " cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: "
<< toplevel << std::endl); << toplevel << std::endl);
// create a new archive // The default behavior is to create 1 package by component group
struct archive* a = archive_write_new(); // unless the user asked to put all COMPONENTS in a single package
// Set the compress and archive types for the archive bool allGroupInOne = (NULL !=
SetArchiveType(a, this->Compress, this->Archive); (this->GetOption(
// Open binary stream "CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE")));
cmGeneratedFileStream* gf = new cmGeneratedFileStream; bool allComponentInOne = (NULL !=
gf->Open(packageFileNames[0].c_str(), false, true); (this->GetOption(
StreamData data(gf, this); "CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE")));
// pass callbacks to archive_write_open to handle stream bool ignoreComponentGroup = ( NULL !=
res = archive_write_open(a, (this->GetOption(
&data, "CPACK_COMPONENTS_IGNORE_GROUPS")));
OpenArchive,
WriteArchive, std::string groupingType;
CloseArchive);
CHECK_ARCHIVE_ERROR(res, "archive_write_open:"); // Second way to specify grouping
// create a new disk struct if (NULL != this->GetOption("CPACK_COMPONENTS_GROUPING")) {
struct archive* disk = archive_read_disk_new(); groupingType = this->GetOption("CPACK_COMPONENTS_GROUPING");
#if !defined(_WIN32) || defined(__CYGWIN__) }
res = archive_read_disk_set_standard_lookup(disk);
#endif if (groupingType.length()>0)
CHECK_ARCHIVE_ERROR(res, "archive_read_disk_set_standard_lookup:"); {
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "["
<< this->Name << "]"
<< " requested component grouping = "<< groupingType <<std::endl);
if (groupingType == "ALL_GROUP_IN_ONE")
{
allGroupInOne = true;
}
else if (groupingType == "ALL_COMPONENT_IN_ONE")
{
allComponentInOne = true;
}
else if (groupingType == "IGNORE")
{
ignoreComponentGroup = true;
}
else
{
cmCPackLogger(cmCPackLog::LOG_WARNING, "["
<< this->Name << "]"
<< " requested component grouping type <"<< groupingType
<< "> UNKNOWN not in (ALL_GROUP_IN_ONE,"
"ALL_COMPONENT_IN_ONE,IGNORE)" <<std::endl);
}
}
// Some components were defined but NO group
// force ignoreGroups
if (this->ComponentGroups.empty() && (!this->Components.empty())
&& (!ignoreComponentGroup)) {
cmCPackLogger(cmCPackLog::LOG_WARNING, "["
<< this->Name << "]"
<< " Some Components defined but NO component group:"
<< " Ignoring component group."
<< std::endl);
ignoreComponentGroup = true;
}
// CASE 1 : COMPONENT ALL-IN-ONE package
// If ALL GROUPS or ALL COMPONENTS in ONE package has been requested
// then the package file is unique and should be open here.
if (allComponentInOne || (allGroupInOne && (!this->ComponentGroups.empty())))
{
return PackageComponentsAllInOne(allComponentInOne);
}
// CASE 2 : COMPONENT CLASSICAL package(s) (i.e. not all-in-one)
// There will be 1 package for each component group
// however one may require to ignore component group and
// in this case you'll get 1 package for each component.
else if ((!this->ComponentGroups.empty()) || (ignoreComponentGroup))
{
return PackageComponents(ignoreComponentGroup);
}
// CASE 3 : NON COMPONENT package.
DECLARE_AND_OPEN_ARCHIVE(packageFileNames[0],archive);
std::vector<std::string>::const_iterator fileIt; std::vector<std::string>::const_iterator fileIt;
std::string dir = cmSystemTools::GetCurrentWorkingDirectory(); std::string dir = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::ChangeDirectory(toplevel.c_str()); cmSystemTools::ChangeDirectory(toplevel.c_str());
for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt ) for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt )
{ {
// create a new entry for each file
struct archive_entry *entry = archive_entry_new();
// Get the relative path to the file // Get the relative path to the file
std::string rp = cmSystemTools::RelativePath(toplevel.c_str(), fileIt->c_str()); std::string rp = cmSystemTools::RelativePath(toplevel.c_str(),
// Set the name of the entry to the file name fileIt->c_str());
archive_entry_set_pathname(entry, rp.c_str()); archive.Add(rp);
res = archive_read_disk_entry_from_file(disk, entry, -1, 0); if(!archive)
CHECK_ARCHIVE_ERROR(res, "archive_read_disk_entry_from_file:");
// write entry header
res = archive_write_header(a, entry);
CHECK_ARCHIVE_ERROR(res, "archive_write_header:");
// the entry size can be 0 if it is a symlink
if(archive_entry_size(entry) > 0)
{ {
// now copy contents of file into archive a cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem while adding file< "
FILE* file = fopen(fileIt->c_str(), "rb"); << *fileIt
if(!file) << "> to archive <"
{ << packageFileNames[0] << "> .ERROR ="
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with fopen(): " << archive.GetError()
<< fileIt->c_str()
<< strerror(errno)
<< std::endl); << std::endl);
return 0; return 0;
} }
char buff[cmCPackTGZ_Data_BlockSize];
size_t len = fread(buff, 1, sizeof(buff), file);
while (len > 0)
{
size_t wlen = archive_write_data(a, buff, len);
if(wlen != len)
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "archive_write_data(): "
<< "tried to write " << len << "\n"
<< "write " << wlen << "\n");
return 0;
}
len = fread(buff, 1, sizeof(buff), file);
}
// close the file and free the entry
fclose(file);
}
archive_entry_free(entry);
} }
cmSystemTools::ChangeDirectory(dir.c_str()); cmSystemTools::ChangeDirectory(dir.c_str());
// close the archive and finish the write // The destructor of cmArchiveWrite will close and finish the write
archive_write_close(a);
archive_write_finish(a);
archive_read_finish(disk);
return 1; return 1;
} }
@ -261,3 +331,7 @@ int cmCPackArchiveGenerator::GenerateHeader(std::ostream*)
{ {
return 1; return 1;
} }
bool cmCPackArchiveGenerator::SupportsComponentInstallation() const {
return true;
}

View File

@ -13,34 +13,62 @@
#ifndef cmCPackArchiveGenerator_h #ifndef cmCPackArchiveGenerator_h
#define cmCPackArchiveGenerator_h #define cmCPackArchiveGenerator_h
#include "cmArchiveWrite.h"
#include "cmCPackGenerator.h" #include "cmCPackGenerator.h"
/** \class cmCPackArchiveGenerator /** \class cmCPackArchiveGenerator
* \brief A generator base for libarchive generation * \brief A generator base for libarchive generation.
* The generator itself uses the libarchive wrapper
* \ref cmArchiveWrite.
* *
*/ */
class cmCPackArchiveGenerator : public cmCPackGenerator class cmCPackArchiveGenerator : public cmCPackGenerator
{ {
public: public:
enum CompressType{ GZIP, BZIP2, COMPRESS, LZMA, NONE};
enum ArchiveType{ TAR, ZIP};
cmTypeMacro(cmCPackArchiveGenerator, cmCPackGenerator); cmTypeMacro(cmCPackArchiveGenerator, cmCPackGenerator);
/** /**
* Construct generator * Construct generator
*/ */
cmCPackArchiveGenerator(CompressType, ArchiveType); cmCPackArchiveGenerator(cmArchiveWrite::Compress, cmArchiveWrite::Type);
virtual ~cmCPackArchiveGenerator(); virtual ~cmCPackArchiveGenerator();
// Used to add a header to the archive // Used to add a header to the archive
virtual int GenerateHeader(std::ostream* os); virtual int GenerateHeader(std::ostream* os);
// component support
virtual bool SupportsComponentInstallation() const;
protected: protected:
virtual int InitializeInternal(); virtual int InitializeInternal();
/**
* Add the files belonging to the specified component
* to the provided (already opened) archive.
* @param[in,out] archive the archive object
* @param[in] component the component whose file will be added to archive
*/
int addOneComponentToArchive(cmArchiveWrite& archive,
cmCPackComponent* component);
/**
* The main package file method.
* If component install was required this
* method will call either PackageComponents or
* PackageComponentsAllInOne.
*/
int PackageFiles(); int PackageFiles();
/**
* The method used to package files when component
* install is used. This will create one
* archive for each component group.
*/
int PackageComponents(bool ignoreComponentGroup);
/**
* Special case of component install where all
* components will be put in a single installer.
*/
int PackageComponentsAllInOne(bool allComponentInOne);
virtual const char* GetOutputExtension() = 0; virtual const char* GetOutputExtension() = 0;
CompressType Compress; cmArchiveWrite::Compress Compress;
ArchiveType Archive; cmArchiveWrite::Type Archive;
}; };
#endif #endif

View File

@ -59,7 +59,7 @@ int cmCPackCygwinSourceGenerator::PackageFiles()
// skip one parent up to the cmCPackTarBZip2Generator // skip one parent up to the cmCPackTarBZip2Generator
// to create tar.bz2 file with the list of source // to create tar.bz2 file with the list of source
// files // files
this->Compress = BZIP2; this->Compress = cmArchiveWrite::CompressBZip2;
if ( !this->cmCPackTarBZip2Generator::PackageFiles() ) if ( !this->cmCPackTarBZip2Generator::PackageFiles() )
{ {
return 0; return 0;

View File

@ -43,7 +43,10 @@ cmCPackDebGenerator::~cmCPackDebGenerator()
int cmCPackDebGenerator::InitializeInternal() int cmCPackDebGenerator::InitializeInternal()
{ {
this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr"); this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr");
if (cmSystemTools::IsOff(this->GetOption("CPACK_SET_DESTDIR")))
{
this->SetOption("CPACK_SET_DESTDIR", "I_ON");
}
return this->Superclass::InitializeInternal(); return this->Superclass::InitializeInternal();
} }

View File

@ -171,7 +171,9 @@ int cmCPackGenerator::InstallProject()
std::string bareTempInstallDirectory std::string bareTempInstallDirectory
= this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY"); = this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
std::string tempInstallDirectoryStr = bareTempInstallDirectory; std::string tempInstallDirectoryStr = bareTempInstallDirectory;
bool setDestDir = cmSystemTools::IsOn(this->GetOption("CPACK_SET_DESTDIR")); bool setDestDir = cmSystemTools::IsOn(this->GetOption("CPACK_SET_DESTDIR"))
| cmSystemTools::IsInternallyOn(
this->GetOption("CPACK_SET_DESTDIR"));
if (!setDestDir) if (!setDestDir)
{ {
tempInstallDirectoryStr += this->GetPackagingInstallPrefix(); tempInstallDirectoryStr += this->GetPackagingInstallPrefix();
@ -329,6 +331,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
it != installDirectoriesVector.end(); it != installDirectoriesVector.end();
++it ) ++it )
{ {
std::list<std::pair<std::string,std::string> > symlinkedFiles;
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Find files" << std::endl); cmCPackLogger(cmCPackLog::LOG_DEBUG, "Find files" << std::endl);
cmsys::Glob gl; cmsys::Glob gl;
std::string top = it->c_str(); std::string top = it->c_str();
@ -372,7 +375,18 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
+ cmSystemTools::RelativePath(top.c_str(), gfit->c_str()); + cmSystemTools::RelativePath(top.c_str(), gfit->c_str());
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Copy file: " cmCPackLogger(cmCPackLog::LOG_DEBUG, "Copy file: "
<< inFile.c_str() << " -> " << filePath.c_str() << std::endl); << inFile.c_str() << " -> " << filePath.c_str() << std::endl);
if ( !cmSystemTools::CopyFileIfDifferent(inFile.c_str(), /* If the file is a symlink we will have to re-create it */
if ( cmSystemTools::FileIsSymlink(inFile.c_str()))
{
std::string targetFile;
std::string inFileRelative =
cmSystemTools::RelativePath(top.c_str(),inFile.c_str());
cmSystemTools::ReadSymlink(inFile.c_str(),targetFile);
symlinkedFiles.push_back(std::pair<std::string,
std::string>(targetFile,inFileRelative));
}
/* If it is not a symlink then do a plain copy */
else if ( !cmSystemTools::CopyFileIfDifferent(inFile.c_str(),
filePath.c_str()) ) filePath.c_str()) )
{ {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying file: " cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying file: "
@ -380,6 +394,36 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
return 0; return 0;
} }
} }
/* rebuild symlinks in the installed tree */
if (symlinkedFiles.size()>0)
{
std::list< std::pair<std::string,std::string> >::iterator symlinkedIt;
std::string curDir = cmSystemTools::GetCurrentWorkingDirectory();
std::string goToDir = tempDir;
goToDir += "/"+subdir;
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Change dir to: " << goToDir <<std::endl);
cmSystemTools::ChangeDirectory(goToDir.c_str());
for (symlinkedIt=symlinkedFiles.begin();
symlinkedIt != symlinkedFiles.end();
++symlinkedIt)
{
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Will create a symlink: "
<< symlinkedIt->second << "--> "
<< symlinkedIt->first << std::endl);
if (!cmSystemTools::CreateSymlink((symlinkedIt->first).c_str(),
(symlinkedIt->second).c_str()))
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot create symlink: "
<< symlinkedIt->second << "--> "
<< symlinkedIt->first << std::endl);
return 0;
}
}
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Going back to: "
<< curDir <<std::endl);
cmSystemTools::ChangeDirectory(curDir.c_str());
}
} }
} }
return 1; return 1;
@ -414,6 +458,7 @@ int cmCPackGenerator::InstallProjectViaInstallScript(
// underneath the tempInstallDirectory. The value of the project's // underneath the tempInstallDirectory. The value of the project's
// CMAKE_INSTALL_PREFIX is sent in here as the value of the // CMAKE_INSTALL_PREFIX is sent in here as the value of the
// CPACK_INSTALL_PREFIX variable. // CPACK_INSTALL_PREFIX variable.
std::string dir; std::string dir;
if (this->GetOption("CPACK_INSTALL_PREFIX")) if (this->GetOption("CPACK_INSTALL_PREFIX"))
{ {
@ -459,6 +504,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
= this->GetOption("CPACK_INSTALL_CMAKE_PROJECTS"); = this->GetOption("CPACK_INSTALL_CMAKE_PROJECTS");
const char* cmakeGenerator const char* cmakeGenerator
= this->GetOption("CPACK_CMAKE_GENERATOR"); = this->GetOption("CPACK_CMAKE_GENERATOR");
std::string absoluteDestFiles;
if ( cmakeProjects && *cmakeProjects ) if ( cmakeProjects && *cmakeProjects )
{ {
if ( !cmakeGenerator ) if ( !cmakeGenerator )
@ -643,6 +689,18 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
// value of the project's CMAKE_INSTALL_PREFIX is sent in here as // value of the project's CMAKE_INSTALL_PREFIX is sent in here as
// the value of the CPACK_INSTALL_PREFIX variable. // the value of the CPACK_INSTALL_PREFIX variable.
// //
// If DESTDIR has been 'internally set ON' this means that
// the underlying CPack specific generator did ask for that
// In this case we may overrode CPACK_INSTALL_PREFIX with
// CPACK_PACKAGING_INSTALL_PREFIX
// I know this is tricky and awkward but it's the price for
// CPACK_SET_DESTDIR backward compatibility.
if (cmSystemTools::IsInternallyOn(
this->GetOption("CPACK_SET_DESTDIR")))
{
this->SetOption("CPACK_INSTALL_PREFIX",
this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX"));
}
std::string dir; std::string dir;
if (this->GetOption("CPACK_INSTALL_PREFIX")) if (this->GetOption("CPACK_INSTALL_PREFIX"))
{ {
@ -723,6 +781,16 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
mf->AddDefinition("CMAKE_INSTALL_DO_STRIP", "1"); mf->AddDefinition("CMAKE_INSTALL_DO_STRIP", "1");
} }
int res = mf->ReadListFile(0, installFile.c_str()); int res = mf->ReadListFile(0, installFile.c_str());
if (NULL !=mf->GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) {
if (absoluteDestFiles.length()>0) {
absoluteDestFiles +=";";
}
absoluteDestFiles +=
mf->GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES");
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Got some ABSOLUTE DESTINATION FILES: "
<< absoluteDestFiles << std::endl);
}
if ( cmSystemTools::GetErrorOccuredFlag() || !res ) if ( cmSystemTools::GetErrorOccuredFlag() || !res )
{ {
return 0; return 0;
@ -730,6 +798,8 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
} }
} }
} }
this->SetOption("CPACK_ABSOLUTE_DESTINATION_FILES",
absoluteDestFiles.c_str());
return 1; return 1;
} }
@ -828,8 +898,8 @@ int cmCPackGenerator::DoPackage()
return 0; return 0;
} }
cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Compress package" << std::endl); cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Create package" << std::endl);
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Compress files to: " cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Package files to: "
<< (tempPackageFileName ? tempPackageFileName : "(NULL)") << std::endl); << (tempPackageFileName ? tempPackageFileName : "(NULL)") << std::endl);
if ( cmSystemTools::FileExists(tempPackageFileName) ) if ( cmSystemTools::FileExists(tempPackageFileName) )
{ {
@ -853,8 +923,12 @@ int cmCPackGenerator::DoPackage()
std::vector<std::string>::const_iterator it; std::vector<std::string>::const_iterator it;
for ( it = files.begin(); it != files.end(); ++ it ) for ( it = files.begin(); it != files.end(); ++ it )
{ {
std::string fileN = cmSystemTools::RelativePath(tempDirectory, // beware we cannot just use tempDirectory as before
it->c_str()); // because some generator will "CPACK_INCLUDE_TOPLEVEL_DIRECTORY"
// we really want "CPACK_TEMPORARY_DIRECTORY"
std::string fileN =
cmSystemTools::RelativePath(
this->GetOption("CPACK_TEMPORARY_DIRECTORY"), it->c_str());
// Determine which component we are in. // Determine which component we are in.
std::string componentName = fileN.substr(0, fileN.find('/')); std::string componentName = fileN.substr(0, fileN.find('/'));
@ -864,6 +938,9 @@ int cmCPackGenerator::DoPackage()
// Add this file to the list of files for the component. // Add this file to the list of files for the component.
this->Components[componentName].Files.push_back(fileN); this->Components[componentName].Files.push_back(fileN);
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Adding file <"
<<fileN<<"> to component <"
<<componentName<<">"<<std::endl);
} }
} }

View File

@ -93,7 +93,8 @@ int cmCPackNSISGenerator::PackageFiles()
for ( sit = dirs.begin(); sit != dirs.end(); ++ sit ) for ( sit = dirs.begin(); sit != dirs.end(); ++ sit )
{ {
std::string componentName; std::string componentName;
std::string fileN = cmSystemTools::RelativePath(toplevel.c_str(), sit->c_str()); std::string fileN = cmSystemTools::RelativePath(toplevel.c_str(),
sit->c_str());
if ( fileN.empty() ) if ( fileN.empty() )
{ {
continue; continue;

View File

@ -11,6 +11,7 @@
============================================================================*/ ============================================================================*/
#include "cmCPackRPMGenerator.h" #include "cmCPackRPMGenerator.h"
#include "cmCPackLog.h" #include "cmCPackLog.h"
#include "cmSystemTools.h"
//---------------------------------------------------------------------- //----------------------------------------------------------------------
cmCPackRPMGenerator::cmCPackRPMGenerator() cmCPackRPMGenerator::cmCPackRPMGenerator()
@ -26,7 +27,10 @@ cmCPackRPMGenerator::~cmCPackRPMGenerator()
int cmCPackRPMGenerator::InitializeInternal() int cmCPackRPMGenerator::InitializeInternal()
{ {
this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr"); this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr");
if (cmSystemTools::IsOff(this->GetOption("CPACK_SET_DESTDIR")))
{
this->SetOption("CPACK_SET_DESTDIR", "I_ON");
}
return this->Superclass::InitializeInternal(); return this->Superclass::InitializeInternal();
} }

View File

@ -14,8 +14,8 @@
//---------------------------------------------------------------------- //----------------------------------------------------------------------
cmCPackTGZGenerator::cmCPackTGZGenerator() cmCPackTGZGenerator::cmCPackTGZGenerator()
:cmCPackArchiveGenerator(cmCPackArchiveGenerator::GZIP, :cmCPackArchiveGenerator(cmArchiveWrite::CompressGZip,
cmCPackArchiveGenerator::TAR) cmArchiveWrite::TypeTAR)
{ {
} }

View File

@ -13,8 +13,8 @@
#include "cmCPackTarBZip2Generator.h" #include "cmCPackTarBZip2Generator.h"
//---------------------------------------------------------------------- //----------------------------------------------------------------------
cmCPackTarBZip2Generator::cmCPackTarBZip2Generator() cmCPackTarBZip2Generator::cmCPackTarBZip2Generator()
:cmCPackArchiveGenerator(cmCPackArchiveGenerator::BZIP2, :cmCPackArchiveGenerator(cmArchiveWrite::CompressBZip2,
cmCPackArchiveGenerator::TAR) cmArchiveWrite::TypeTAR)
{ {
} }

View File

@ -14,8 +14,8 @@
//---------------------------------------------------------------------- //----------------------------------------------------------------------
cmCPackTarCompressGenerator::cmCPackTarCompressGenerator() cmCPackTarCompressGenerator::cmCPackTarCompressGenerator()
:cmCPackArchiveGenerator(cmCPackArchiveGenerator::COMPRESS, :cmCPackArchiveGenerator(cmArchiveWrite::CompressCompress,
cmCPackArchiveGenerator::TAR) cmArchiveWrite::TypeTAR)
{ {
} }

View File

@ -14,8 +14,8 @@
//---------------------------------------------------------------------- //----------------------------------------------------------------------
cmCPackZIPGenerator::cmCPackZIPGenerator() cmCPackZIPGenerator::cmCPackZIPGenerator()
:cmCPackArchiveGenerator(cmCPackArchiveGenerator::NONE, :cmCPackArchiveGenerator(cmArchiveWrite::CompressNone,
cmCPackArchiveGenerator::ZIP) cmArchiveWrite::TypeZIP)
{ {
} }

View File

@ -516,11 +516,13 @@ void cmCTestMultiProcessHandler::PrintTestList()
{ {
this->TestHandler->SetMaxIndex(this->FindMaxIndex()); this->TestHandler->SetMaxIndex(this->FindMaxIndex());
int count = 0; int count = 0;
for (PropertiesMap::iterator it = this->Properties.begin(); for (PropertiesMap::iterator it = this->Properties.begin();
it != this->Properties.end(); ++it) it != this->Properties.end(); ++it)
{ {
count++; count++;
cmCTestTestHandler::cmCTestTestProperties& p = *it->second; cmCTestTestHandler::cmCTestTestProperties& p = *it->second;
//push working dir //push working dir
std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory(); std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::ChangeDirectory(p.Directory.c_str()); cmSystemTools::ChangeDirectory(p.Directory.c_str());
@ -530,6 +532,20 @@ void cmCTestMultiProcessHandler::PrintTestList()
testRun.SetTestProperties(&p); testRun.SetTestProperties(&p);
testRun.ComputeArguments(); //logs the command in verbose mode testRun.ComputeArguments(); //logs the command in verbose mode
if(p.Labels.size()) //print the labels
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Labels:");
}
for(std::vector<std::string>::iterator label = p.Labels.begin();
label != p.Labels.end(); ++label)
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " " << *label);
}
if(p.Labels.size()) //print the labels
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl);
}
if (this->TestHandler->MemCheck) if (this->TestHandler->MemCheck)
{ {
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Memory Check"); cmCTestLog(this->CTest, HANDLER_OUTPUT, " Memory Check");
@ -548,10 +564,36 @@ void cmCTestMultiProcessHandler::PrintTestList()
//pop working dir //pop working dir
cmSystemTools::ChangeDirectory(current_dir.c_str()); cmSystemTools::ChangeDirectory(current_dir.c_str());
} }
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl << "Total Tests: " cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl << "Total Tests: "
<< this->Total << std::endl); << this->Total << std::endl);
} }
void cmCTestMultiProcessHandler::PrintLabels()
{
std::set<std::string> allLabels;
for (PropertiesMap::iterator it = this->Properties.begin();
it != this->Properties.end(); ++it)
{
cmCTestTestHandler::cmCTestTestProperties& p = *it->second;
allLabels.insert(p.Labels.begin(), p.Labels.end());
}
if(allLabels.size())
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, "All Labels:" << std::endl);
}
else
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, "No Labels Exist" << std::endl);
}
for(std::set<std::string>::iterator label = allLabels.begin();
label != allLabels.end(); ++label)
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, " " << *label << std::endl);
}
}
//--------------------------------------------------------- //---------------------------------------------------------
void cmCTestMultiProcessHandler::CheckResume() void cmCTestMultiProcessHandler::CheckResume()
{ {

View File

@ -39,6 +39,7 @@ public:
void SetParallelLevel(size_t); void SetParallelLevel(size_t);
virtual void RunTests(); virtual void RunTests();
void PrintTestList(); void PrintTestList();
void PrintLabels();
void SetPassFailVectors(std::vector<cmStdString>* passed, void SetPassFailVectors(std::vector<cmStdString>* passed,
std::vector<cmStdString>* failed) std::vector<cmStdString>* failed)

View File

@ -567,7 +567,7 @@ int cmCTestTestHandler::ProcessHandler()
if (total == 0) if (total == 0)
{ {
if ( !this->CTest->GetShowOnly() ) if ( !this->CTest->GetShowOnly() && !this->CTest->ShouldPrintLabels() )
{ {
cmCTestLog(this->CTest, ERROR_MESSAGE, "No tests were found!!!" cmCTestLog(this->CTest, ERROR_MESSAGE, "No tests were found!!!"
<< std::endl); << std::endl);
@ -1079,7 +1079,12 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
parallel->SetPassFailVectors(&passed, &failed); parallel->SetPassFailVectors(&passed, &failed);
this->TestResults.clear(); this->TestResults.clear();
parallel->SetTestResults(&this->TestResults); parallel->SetTestResults(&this->TestResults);
if(this->CTest->GetShowOnly())
if(this->CTest->ShouldPrintLabels())
{
parallel->PrintLabels();
}
else if(this->CTest->GetShowOnly())
{ {
parallel->PrintTestList(); parallel->PrintTestList();
} }

View File

@ -902,7 +902,7 @@ void cmCursesMainForm::HandleInput()
this->SearchMode = false; this->SearchMode = false;
if ( this->SearchString.size() > 0 ) if ( this->SearchString.size() > 0 )
{ {
this->JumpToCacheEntry(-1, this->SearchString.c_str()); this->JumpToCacheEntry(this->SearchString.c_str());
this->OldSearchString = this->SearchString; this->OldSearchString = this->SearchString;
} }
this->SearchString = ""; this->SearchString = "";
@ -1076,7 +1076,7 @@ void cmCursesMainForm::HandleInput()
{ {
if ( this->OldSearchString.size() > 0 ) if ( this->OldSearchString.size() > 0 )
{ {
this->JumpToCacheEntry(-1, this->OldSearchString.c_str()); this->JumpToCacheEntry(this->OldSearchString.c_str());
} }
} }
// switch advanced on/off // switch advanced on/off
@ -1191,7 +1191,7 @@ int cmCursesMainForm::LoadCache(const char *)
return r; return r;
} }
void cmCursesMainForm::JumpToCacheEntry(int idx, const char* astr) void cmCursesMainForm::JumpToCacheEntry(const char* astr)
{ {
std::string str; std::string str;
if ( astr ) if ( astr )
@ -1199,18 +1199,14 @@ void cmCursesMainForm::JumpToCacheEntry(int idx, const char* astr)
str = cmSystemTools::LowerCase(astr); str = cmSystemTools::LowerCase(astr);
} }
if ( size_t(idx) > this->NumberOfVisibleEntries ) if(str.empty())
{
return;
}
if ( idx < 0 && str.size() == 0)
{ {
return; return;
} }
FIELD* cur = current_field(this->Form); FIELD* cur = current_field(this->Form);
int start_index = field_index(cur); int start_index = field_index(cur);
int findex = start_index; int findex = start_index;
while ( (findex / 3) != idx ) for(;;)
{ {
if ( str.size() > 0 ) if ( str.size() > 0 )
{ {

View File

@ -122,9 +122,8 @@ protected:
// Remove an entry from the interface and the cache. // Remove an entry from the interface and the cache.
void RemoveEntry(const char* value); void RemoveEntry(const char* value);
// Jump to the cache value with index idx. If string str is // Jump to the cache entry whose name matches the string.
// specified, it will stop on widget that contain that string. void JumpToCacheEntry(const char* str);
void JumpToCacheEntry(int idx, const char* str);
// Copies of cache entries stored in the user interface // Copies of cache entries stored in the user interface
std::vector<cmCursesCacheEntryComposite*>* Entries; std::vector<cmCursesCacheEntryComposite*>* Entries;

View File

@ -84,6 +84,10 @@ CMakeSetupDialog::CMakeSetupDialog()
this->setGroupedView(groupView); this->setGroupedView(groupView);
this->groupedCheck->setCheckState(groupView ? Qt::Checked : Qt::Unchecked); this->groupedCheck->setCheckState(groupView ? Qt::Checked : Qt::Unchecked);
bool advancedView = settings.value("AdvancedView", false).toBool();
this->setAdvancedView(advancedView);
this->advancedCheck->setCheckState(advancedView?Qt::Checked : Qt::Unchecked);
QMenu* FileMenu = this->menuBar()->addMenu(tr("&File")); QMenu* FileMenu = this->menuBar()->addMenu(tr("&File"));
this->ReloadCacheAction = FileMenu->addAction(tr("&Reload Cache")); this->ReloadCacheAction = FileMenu->addAction(tr("&Reload Cache"));
QObject::connect(this->ReloadCacheAction, SIGNAL(triggered(bool)), QObject::connect(this->ReloadCacheAction, SIGNAL(triggered(bool)),
@ -247,6 +251,7 @@ void CMakeSetupDialog::initialize()
QObject::connect(this->SuppressDevWarningsAction, SIGNAL(triggered(bool)), QObject::connect(this->SuppressDevWarningsAction, SIGNAL(triggered(bool)),
this->CMakeThread->cmakeInstance(), SLOT(setSuppressDevWarnings(bool))); this->CMakeThread->cmakeInstance(), SLOT(setSuppressDevWarnings(bool)));
QObject::connect(this->WarnUninitializedAction, SIGNAL(triggered(bool)), QObject::connect(this->WarnUninitializedAction, SIGNAL(triggered(bool)),
this->CMakeThread->cmakeInstance(), this->CMakeThread->cmakeInstance(),
SLOT(setWarnUninitializedMode(bool))); SLOT(setWarnUninitializedMode(bool)));
@ -976,6 +981,9 @@ void CMakeSetupDialog::setGroupedView(bool v)
void CMakeSetupDialog::setAdvancedView(bool v) void CMakeSetupDialog::setAdvancedView(bool v)
{ {
this->CacheValues->setShowAdvanced(v); this->CacheValues->setShowAdvanced(v);
QSettings settings;
settings.beginGroup("Settings/StartPath");
settings.setValue("AdvancedView", v);
} }
void CMakeSetupDialog::showUserChanges() void CMakeSetupDialog::showUserChanges()

View File

@ -304,6 +304,7 @@ cmCTest::cmCTest()
this->ShowOnly = false; this->ShowOnly = false;
this->RunConfigurationScript = false; this->RunConfigurationScript = false;
this->UseHTTP10 = false; this->UseHTTP10 = false;
this->PrintLabels = false;
this->CompressTestOutput = true; this->CompressTestOutput = true;
this->ComputedCompressOutput = false; this->ComputedCompressOutput = false;
this->TestModel = cmCTest::EXPERIMENTAL; this->TestModel = cmCTest::EXPERIMENTAL;
@ -489,10 +490,6 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
return 0; return 0;
} }
// call this so that the information is cached up front
// and not the first time EndTest is called.
this->ShouldCompressTestOutput();
if ( this->ProduceXML ) if ( this->ProduceXML )
{ {
// Verify "Testing" directory exists: // Verify "Testing" directory exists:
@ -1877,6 +1874,11 @@ void cmCTest::HandleCommandLineArguments(size_t &i,
this->CompressTestOutput = false; this->CompressTestOutput = false;
} }
if(this->CheckArgument(arg, "--print-labels"))
{
this->PrintLabels = true;
}
if(this->CheckArgument(arg, "--http1.0")) if(this->CheckArgument(arg, "--http1.0"))
{ {
this->UseHTTP10 = true; this->UseHTTP10 = true;

View File

@ -210,6 +210,8 @@ public:
bool ShouldUseHTTP10() { return this->UseHTTP10; } bool ShouldUseHTTP10() { return this->UseHTTP10; }
bool ShouldPrintLabels() { return this->PrintLabels; }
bool ShouldCompressTestOutput(); bool ShouldCompressTestOutput();
std::string GetCDashVersion(); std::string GetCDashVersion();
@ -413,6 +415,7 @@ private:
bool ProduceXML; bool ProduceXML;
bool LabelSummary; bool LabelSummary;
bool UseHTTP10; bool UseHTTP10;
bool PrintLabels;
bool Failover; bool Failover;
bool BatchJobs; bool BatchJobs;

View File

@ -71,8 +71,8 @@ void cmComputeComponentGraph::TarjanVisit(int i)
this->TarjanStack.push(i); this->TarjanStack.push(i);
// Follow outgoing edges. // Follow outgoing edges.
NodeList const& nl = this->InputGraph[i]; EdgeList const& nl = this->InputGraph[i];
for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{ {
int j = *ni; int j = *ni;
@ -142,14 +142,17 @@ void cmComputeComponentGraph::TransferEdges()
for(int i=0; i < n; ++i) for(int i=0; i < n; ++i)
{ {
int i_component = this->TarjanComponents[i]; int i_component = this->TarjanComponents[i];
NodeList const& nl = this->InputGraph[i]; EdgeList const& nl = this->InputGraph[i];
for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{ {
int j = *ni; int j = *ni;
int j_component = this->TarjanComponents[j]; int j_component = this->TarjanComponents[j];
if(i_component != j_component) if(i_component != j_component)
{ {
this->ComponentGraph[i_component].push_back(j_component); // We do not attempt to combine duplicate edges, but instead
// store the inter-component edges with suitable multiplicity.
this->ComponentGraph[i_component].push_back(
cmGraphEdge(j_component, ni->IsStrong()));
} }
} }
} }

View File

@ -33,6 +33,7 @@ class cmComputeComponentGraph
public: public:
// Represent the graph with an adjacency list. // Represent the graph with an adjacency list.
typedef cmGraphNodeList NodeList; typedef cmGraphNodeList NodeList;
typedef cmGraphEdgeList EdgeList;
typedef cmGraphAdjacencyList Graph; typedef cmGraphAdjacencyList Graph;
cmComputeComponentGraph(Graph const& input); cmComputeComponentGraph(Graph const& input);
@ -41,7 +42,7 @@ public:
/** Get the adjacency list of the component graph. */ /** Get the adjacency list of the component graph. */
Graph const& GetComponentGraph() const Graph const& GetComponentGraph() const
{ return this->ComponentGraph; } { return this->ComponentGraph; }
NodeList const& GetComponentGraphEdges(int c) const EdgeList const& GetComponentGraphEdges(int c) const
{ return this->ComponentGraph[c]; } { return this->ComponentGraph[c]; }
/** Get map from component index to original node indices. */ /** Get map from component index to original node indices. */

View File

@ -285,7 +285,7 @@ cmComputeLinkDepends::AllocateLinkEntry(std::string const& item)
lei = this->LinkEntryIndex.insert(index_entry).first; lei = this->LinkEntryIndex.insert(index_entry).first;
this->EntryList.push_back(LinkEntry()); this->EntryList.push_back(LinkEntry());
this->InferredDependSets.push_back(0); this->InferredDependSets.push_back(0);
this->EntryConstraintGraph.push_back(NodeList()); this->EntryConstraintGraph.push_back(EdgeList());
return lei; return lei;
} }
@ -669,7 +669,7 @@ void cmComputeLinkDepends::CleanConstraintGraph()
cmsys_stl::sort(i->begin(), i->end()); cmsys_stl::sort(i->begin(), i->end());
// Make the edge list unique. // Make the edge list unique.
NodeList::iterator last = cmsys_stl::unique(i->begin(), i->end()); EdgeList::iterator last = cmsys_stl::unique(i->begin(), i->end());
i->erase(last, i->end()); i->erase(last, i->end());
} }
} }
@ -681,9 +681,9 @@ void cmComputeLinkDepends::DisplayConstraintGraph()
cmOStringStream e; cmOStringStream e;
for(unsigned int i=0; i < this->EntryConstraintGraph.size(); ++i) for(unsigned int i=0; i < this->EntryConstraintGraph.size(); ++i)
{ {
NodeList const& nl = this->EntryConstraintGraph[i]; EdgeList const& nl = this->EntryConstraintGraph[i];
e << "item " << i << " is [" << this->EntryList[i].Item << "]\n"; e << "item " << i << " is [" << this->EntryList[i].Item << "]\n";
for(NodeList::const_iterator j = nl.begin(); j != nl.end(); ++j) for(EdgeList::const_iterator j = nl.begin(); j != nl.end(); ++j)
{ {
e << " item " << *j << " must follow it\n"; e << " item " << *j << " must follow it\n";
} }
@ -758,10 +758,11 @@ cmComputeLinkDepends::DisplayComponents()
fprintf(stderr, " item %d [%s]\n", i, fprintf(stderr, " item %d [%s]\n", i,
this->EntryList[i].Item.c_str()); this->EntryList[i].Item.c_str());
} }
NodeList const& ol = this->CCG->GetComponentGraphEdges(c); EdgeList const& ol = this->CCG->GetComponentGraphEdges(c);
for(NodeList::const_iterator oi = ol.begin(); oi != ol.end(); ++oi) for(EdgeList::const_iterator oi = ol.begin(); oi != ol.end(); ++oi)
{ {
fprintf(stderr, " followed by Component (%d)\n", *oi); int i = *oi;
fprintf(stderr, " followed by Component (%d)\n", i);
} }
fprintf(stderr, " topo order index %d\n", fprintf(stderr, " topo order index %d\n",
this->ComponentOrder[c]); this->ComponentOrder[c]);
@ -784,8 +785,8 @@ void cmComputeLinkDepends::VisitComponent(unsigned int c)
// Visit the neighbors of the component first. // Visit the neighbors of the component first.
// Run in reverse order so the topological order will preserve the // Run in reverse order so the topological order will preserve the
// original order where there are no constraints. // original order where there are no constraints.
NodeList const& nl = this->CCG->GetComponentGraphEdges(c); EdgeList const& nl = this->CCG->GetComponentGraphEdges(c);
for(NodeList::const_reverse_iterator ni = nl.rbegin(); for(EdgeList::const_reverse_iterator ni = nl.rbegin();
ni != nl.rend(); ++ni) ni != nl.rend(); ++ni)
{ {
this->VisitComponent(*ni); this->VisitComponent(*ni);
@ -856,8 +857,8 @@ void cmComputeLinkDepends::VisitEntry(int index)
// are now pending. // are now pending.
if(completed) if(completed)
{ {
NodeList const& ol = this->CCG->GetComponentGraphEdges(component); EdgeList const& ol = this->CCG->GetComponentGraphEdges(component);
for(NodeList::const_iterator oi = ol.begin(); oi != ol.end(); ++oi) for(EdgeList::const_iterator oi = ol.begin(); oi != ol.end(); ++oi)
{ {
// This entire component is now pending no matter whether it has // This entire component is now pending no matter whether it has
// been partially seen already. // been partially seen already.

View File

@ -117,6 +117,7 @@ private:
// Ordering constraint graph adjacency list. // Ordering constraint graph adjacency list.
typedef cmGraphNodeList NodeList; typedef cmGraphNodeList NodeList;
typedef cmGraphEdgeList EdgeList;
typedef cmGraphAdjacencyList Graph; typedef cmGraphAdjacencyList Graph;
Graph EntryConstraintGraph; Graph EntryConstraintGraph;
void CleanConstraintGraph(); void CleanConstraintGraph();

View File

@ -129,7 +129,10 @@ bool cmComputeTargetDepends::Compute()
} }
// Compute the final dependency graph. // Compute the final dependency graph.
this->ComputeFinalDepends(ccg); if(!this->ComputeFinalDepends(ccg))
{
return false;
}
if(this->DebugMode) if(this->DebugMode)
{ {
this->DisplayGraph(this->FinalGraph, "final"); this->DisplayGraph(this->FinalGraph, "final");
@ -150,8 +153,8 @@ cmComputeTargetDepends::GetTargetDirectDepends(cmTarget* t,
int i = tii->second; int i = tii->second;
// Get its final dependencies. // Get its final dependencies.
NodeList const& nl = this->FinalGraph[i]; EdgeList const& nl = this->FinalGraph[i];
for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{ {
deps.insert(this->Targets[*ni]); deps.insert(this->Targets[*ni]);
} }
@ -195,15 +198,13 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
// Get the depender. // Get the depender.
cmTarget* depender = this->Targets[depender_index]; cmTarget* depender = this->Targets[depender_index];
// Keep track of dependencies already listed.
std::set<cmStdString> emitted;
// A target should not depend on itself.
emitted.insert(depender->GetName());
// Loop over all targets linked directly. // Loop over all targets linked directly.
{
cmTarget::LinkLibraryVectorType const& tlibs = cmTarget::LinkLibraryVectorType const& tlibs =
depender->GetOriginalLinkLibraries(); depender->GetOriginalLinkLibraries();
std::set<cmStdString> emitted;
// A target should not depend on itself.
emitted.insert(depender->GetName());
for(cmTarget::LinkLibraryVectorType::const_iterator lib = tlibs.begin(); for(cmTarget::LinkLibraryVectorType::const_iterator lib = tlibs.begin();
lib != tlibs.end(); ++lib) lib != tlibs.end(); ++lib)
{ {
@ -213,9 +214,14 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
this->AddTargetDepend(depender_index, lib->first.c_str(), true); this->AddTargetDepend(depender_index, lib->first.c_str(), true);
} }
} }
}
// Loop over all utility dependencies. // Loop over all utility dependencies.
{
std::set<cmStdString> const& tutils = depender->GetUtilities(); std::set<cmStdString> const& tutils = depender->GetUtilities();
std::set<cmStdString> emitted;
// A target should not depend on itself.
emitted.insert(depender->GetName());
for(std::set<cmStdString>::const_iterator util = tutils.begin(); for(std::set<cmStdString>::const_iterator util = tutils.begin();
util != tutils.end(); ++util) util != tutils.end(); ++util)
{ {
@ -226,6 +232,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
} }
} }
} }
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmComputeTargetDepends::AddTargetDepend(int depender_index, void cmComputeTargetDepends::AddTargetDepend(int depender_index,
@ -272,7 +279,8 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
int dependee_index = tii->second; int dependee_index = tii->second;
// Add this entry to the dependency graph. // Add this entry to the dependency graph.
this->InitialGraph[depender_index].push_back(dependee_index); this->InitialGraph[depender_index].push_back(
cmGraphEdge(dependee_index, !linking));
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -283,16 +291,16 @@ cmComputeTargetDepends::DisplayGraph(Graph const& graph, const char* name)
int n = static_cast<int>(graph.size()); int n = static_cast<int>(graph.size());
for(int depender_index = 0; depender_index < n; ++depender_index) for(int depender_index = 0; depender_index < n; ++depender_index)
{ {
NodeList const& nl = graph[depender_index]; EdgeList const& nl = graph[depender_index];
cmTarget* depender = this->Targets[depender_index]; cmTarget* depender = this->Targets[depender_index];
fprintf(stderr, "target %d is [%s]\n", fprintf(stderr, "target %d is [%s]\n",
depender_index, depender->GetName()); depender_index, depender->GetName());
for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{ {
int dependee_index = *ni; int dependee_index = *ni;
cmTarget* dependee = this->Targets[dependee_index]; cmTarget* dependee = this->Targets[dependee_index];
fprintf(stderr, " depends on target %d [%s]\n", dependee_index, fprintf(stderr, " depends on target %d [%s] (%s)\n", dependee_index,
dependee->GetName()); dependee->GetName(), ni->IsStrong()? "strong" : "weak");
} }
} }
fprintf(stderr, "\n"); fprintf(stderr, "\n");
@ -363,7 +371,8 @@ cmComputeTargetDepends
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
cmComputeTargetDepends cmComputeTargetDepends
::ComplainAboutBadComponent(cmComputeComponentGraph const& ccg, int c) ::ComplainAboutBadComponent(cmComputeComponentGraph const& ccg, int c,
bool strong)
{ {
// Construct the error message. // Construct the error message.
cmOStringStream e; cmOStringStream e;
@ -383,18 +392,27 @@ cmComputeTargetDepends
<< cmTarget::TargetTypeNames[depender->GetType()] << "\n"; << cmTarget::TargetTypeNames[depender->GetType()] << "\n";
// List its dependencies that are inside the component. // List its dependencies that are inside the component.
NodeList const& nl = this->InitialGraph[i]; EdgeList const& nl = this->InitialGraph[i];
for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{ {
int j = *ni; int j = *ni;
if(cmap[j] == c) if(cmap[j] == c)
{ {
cmTarget* dependee = this->Targets[j]; cmTarget* dependee = this->Targets[j];
e << " depends on \"" << dependee->GetName() << "\"\n"; e << " depends on \"" << dependee->GetName() << "\""
<< " (" << (ni->IsStrong()? "strong" : "weak") << ")\n";
} }
} }
} }
if(this->NoCycles) if(strong)
{
// Custom command executable dependencies cannot occur within a
// component of static libraries. The cycle must appear in calls
// to add_dependencies.
e << "The component contains at least one cycle consisting of strong "
<< "dependencies (created by add_dependencies) that cannot be broken.";
}
else if(this->NoCycles)
{ {
e << "The GLOBAL_DEPENDS_NO_CYCLES global property is enabled, so " e << "The GLOBAL_DEPENDS_NO_CYCLES global property is enabled, so "
<< "cyclic dependencies are not allowed even among static libraries."; << "cyclic dependencies are not allowed even among static libraries.";
@ -408,7 +426,49 @@ cmComputeTargetDepends
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void bool
cmComputeTargetDepends
::IntraComponent(std::vector<int> const& cmap, int c, int i, int* head,
std::set<int>& emitted, std::set<int>& visited)
{
if(!visited.insert(i).second)
{
// Cycle in utility depends!
return false;
}
if(emitted.insert(i).second)
{
// Honor strong intra-component edges in the final order.
EdgeList const& el = this->InitialGraph[i];
for(EdgeList::const_iterator ei = el.begin(); ei != el.end(); ++ei)
{
int j = *ei;
if(cmap[j] == c && ei->IsStrong())
{
this->FinalGraph[i].push_back(j);
if(!this->IntraComponent(cmap, c, j, head, emitted, visited))
{
return false;
}
}
}
// Prepend to a linear linked-list of intra-component edges.
if(*head >= 0)
{
this->FinalGraph[i].push_back(*head);
}
else
{
this->ComponentTail[c] = i;
}
*head = i;
}
return true;
}
//----------------------------------------------------------------------------
bool
cmComputeTargetDepends cmComputeTargetDepends
::ComputeFinalDepends(cmComputeComponentGraph const& ccg) ::ComputeFinalDepends(cmComputeComponentGraph const& ccg)
{ {
@ -420,34 +480,43 @@ cmComputeTargetDepends
this->FinalGraph.resize(0); this->FinalGraph.resize(0);
this->FinalGraph.resize(this->InitialGraph.size()); this->FinalGraph.resize(this->InitialGraph.size());
// Choose intra-component edges to linearize dependencies.
std::vector<int> const& cmap = ccg.GetComponentMap();
this->ComponentHead.resize(components.size());
this->ComponentTail.resize(components.size());
int nc = static_cast<int>(components.size());
for(int c=0; c < nc; ++c)
{
int head = -1;
std::set<int> emitted;
NodeList const& nl = components[c];
for(NodeList::const_reverse_iterator ni = nl.rbegin();
ni != nl.rend(); ++ni)
{
std::set<int> visited;
if(!this->IntraComponent(cmap, c, *ni, &head, emitted, visited))
{
// Cycle in add_dependencies within component!
this->ComplainAboutBadComponent(ccg, c, true);
return false;
}
}
this->ComponentHead[c] = head;
}
// Convert inter-component edges to connect component tails to heads. // Convert inter-component edges to connect component tails to heads.
int n = static_cast<int>(cgraph.size()); int n = static_cast<int>(cgraph.size());
for(int depender_component=0; depender_component < n; ++depender_component) for(int depender_component=0; depender_component < n; ++depender_component)
{ {
int depender_component_tail = components[depender_component].back(); int depender_component_tail = this->ComponentTail[depender_component];
NodeList const& nl = cgraph[depender_component]; EdgeList const& nl = cgraph[depender_component];
for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{ {
int dependee_component = *ni; int dependee_component = *ni;
int dependee_component_head = components[dependee_component].front(); int dependee_component_head = this->ComponentHead[dependee_component];
this->FinalGraph[depender_component_tail] this->FinalGraph[depender_component_tail]
.push_back(dependee_component_head); .push_back(dependee_component_head);
} }
} }
return true;
// Compute intra-component edges.
int nc = static_cast<int>(components.size());
for(int c=0; c < nc; ++c)
{
// Within the component each target depends on that following it.
NodeList const& nl = components[c];
NodeList::const_iterator ni = nl.begin();
int last_i = *ni;
for(++ni; ni != nl.end(); ++ni)
{
int i = *ni;
this->FinalGraph[last_i].push_back(i);
last_i = i;
}
}
} }

View File

@ -45,7 +45,7 @@ private:
void CollectTargetDepends(int depender_index); void CollectTargetDepends(int depender_index);
void AddTargetDepend(int depender_index, const char* dependee_name, void AddTargetDepend(int depender_index, const char* dependee_name,
bool linking); bool linking);
void ComputeFinalDepends(cmComputeComponentGraph const& ccg); bool ComputeFinalDepends(cmComputeComponentGraph const& ccg);
cmGlobalGenerator* GlobalGenerator; cmGlobalGenerator* GlobalGenerator;
bool DebugMode; bool DebugMode;
@ -59,6 +59,7 @@ private:
// top-level index corresponds to a depender whose dependencies are // top-level index corresponds to a depender whose dependencies are
// listed. // listed.
typedef cmGraphNodeList NodeList; typedef cmGraphNodeList NodeList;
typedef cmGraphEdgeList EdgeList;
typedef cmGraphAdjacencyList Graph; typedef cmGraphAdjacencyList Graph;
Graph InitialGraph; Graph InitialGraph;
Graph FinalGraph; Graph FinalGraph;
@ -67,7 +68,13 @@ private:
// Deal with connected components. // Deal with connected components.
void DisplayComponents(cmComputeComponentGraph const& ccg); void DisplayComponents(cmComputeComponentGraph const& ccg);
bool CheckComponents(cmComputeComponentGraph const& ccg); bool CheckComponents(cmComputeComponentGraph const& ccg);
void ComplainAboutBadComponent(cmComputeComponentGraph const& ccg, int c); void ComplainAboutBadComponent(cmComputeComponentGraph const& ccg, int c,
bool strong = false);
std::vector<int> ComponentHead;
std::vector<int> ComponentTail;
bool IntraComponent(std::vector<int> const& cmap, int c, int i, int* head,
std::set<int>& emitted, std::set<int>& visited);
}; };
#endif #endif

View File

@ -687,7 +687,8 @@ cmELFInternalImpl<Types>::GetDynamicSectionString(int tag)
// The value has been read successfully. Report it. // The value has been read successfully. Report it.
se.Position = static_cast<unsigned long>(strtab.sh_offset + first); se.Position = static_cast<unsigned long>(strtab.sh_offset + first);
se.Size = last - first; se.Size = last - first;
se.IndexInSection = static_cast<int>(di - this->DynamicSectionEntries.begin()); se.IndexInSection =
static_cast<int>(di - this->DynamicSectionEntries.begin());
return &se; return &se;
} }
} }

View File

@ -152,11 +152,10 @@ bool cmExportCommand
ebfg.SetCommand(this); ebfg.SetCommand(this);
// Compute the set of configurations exported. // Compute the set of configurations exported.
if(const char* types =
this->Makefile->GetDefinition("CMAKE_CONFIGURATION_TYPES"))
{
std::vector<std::string> configurationTypes; std::vector<std::string> configurationTypes;
cmSystemTools::ExpandListArgument(types, configurationTypes); this->Makefile->GetConfigurations(configurationTypes);
if(!configurationTypes.empty())
{
for(std::vector<std::string>::const_iterator for(std::vector<std::string>::const_iterator
ci = configurationTypes.begin(); ci = configurationTypes.begin();
ci != configurationTypes.end(); ++ci) ci != configurationTypes.end(); ++ci)
@ -164,11 +163,6 @@ bool cmExportCommand
ebfg.AddConfiguration(ci->c_str()); ebfg.AddConfiguration(ci->c_str());
} }
} }
else if(const char* config =
this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"))
{
ebfg.AddConfiguration(config);
}
else else
{ {
ebfg.AddConfiguration(""); ebfg.AddConfiguration("");

View File

@ -2571,8 +2571,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
std::vector<std::string>::const_iterator i = args.begin(); std::vector<std::string>::const_iterator i = args.begin();
if(args.size() < 3) if(args.size() < 3)
{ {
this->SetError("FILE(DOWNLOAD url file) must be called with " this->SetError("DOWNLOAD must be called with at least three arguments.");
"at least three arguments.");
return false; return false;
} }
++i; // Get rid of subcommand ++i; // Get rid of subcommand
@ -2598,8 +2597,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
} }
else else
{ {
this->SetError("FILE(DOWNLOAD url file TIMEOUT time) missing " this->SetError("DOWNLOAD missing time for TIMEOUT.");
"time for TIMEOUT.");
return false; return false;
} }
} }
@ -2608,8 +2606,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
++i; ++i;
if( i == args.end()) if( i == args.end())
{ {
this->SetError("FILE(DOWNLOAD url file LOG VAR) missing " this->SetError("DOWNLOAD missing VAR for LOG.");
"VAR for LOG.");
return false; return false;
} }
verboseLog = *i; verboseLog = *i;
@ -2619,8 +2616,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
++i; ++i;
if( i == args.end()) if( i == args.end())
{ {
this->SetError("FILE(DOWNLOAD url file STATUS VAR) missing " this->SetError("DOWNLOAD missing VAR for STATUS.");
"VAR for STATUS.");
return false; return false;
} }
statusVar = *i; statusVar = *i;
@ -2630,8 +2626,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
++i; ++i;
if( i == args.end()) if( i == args.end())
{ {
this->SetError("FILE(DOWNLOAD url file EXPECTED_MD5 sum) missing " this->SetError("DOWNLOAD missing sum value for EXPECTED_MD5.");
"sum value for EXPECTED_MD5.");
return false; return false;
} }
expectedMD5sum = cmSystemTools::LowerCase(*i); expectedMD5sum = cmSystemTools::LowerCase(*i);
@ -2654,8 +2649,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
if (!cmSystemTools::ComputeFileMD5(file.c_str(), computedMD5)) if (!cmSystemTools::ComputeFileMD5(file.c_str(), computedMD5))
{ {
this->SetError("FILE(DOWNLOAD ) error; cannot compute MD5 sum on " this->SetError("DOWNLOAD cannot compute MD5 sum on pre-existing file");
"pre-existing file");
return false; return false;
} }
@ -2698,8 +2692,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
std::ofstream fout(file.c_str(), std::ios::binary); std::ofstream fout(file.c_str(), std::ios::binary);
if(!fout) if(!fout)
{ {
this->SetError("FILE(DOWNLOAD url file TIMEOUT time) can not open " this->SetError("DOWNLOAD cannot open file for write.");
"file for write.");
return false; return false;
} }
@ -2708,8 +2701,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
curl = ::curl_easy_init(); curl = ::curl_easy_init();
if(!curl) if(!curl)
{ {
this->SetError("FILE(DOWNLOAD ) error " this->SetError("DOWNLOAD error initializing curl.");
"initializing curl.");
return false; return false;
} }
@ -2718,9 +2710,9 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); ::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
if (res != CURLE_OK) if (res != CURLE_OK)
{ {
std::string errstring = "FILE(DOWNLOAD ) error; cannot set url: "; std::string e = "DOWNLOAD cannot set url: ";
errstring += ::curl_easy_strerror(res); e += ::curl_easy_strerror(res);
this->SetError(errstring.c_str()); this->SetError(e.c_str());
return false; return false;
} }
@ -2728,10 +2720,9 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
cmFileCommandWriteMemoryCallback); cmFileCommandWriteMemoryCallback);
if (res != CURLE_OK) if (res != CURLE_OK)
{ {
std::string errstring = std::string e = "DOWNLOAD cannot set write function: ";
"FILE(DOWNLOAD ) error; cannot set write function: "; e += ::curl_easy_strerror(res);
errstring += ::curl_easy_strerror(res); this->SetError(e.c_str());
this->SetError(errstring.c_str());
return false; return false;
} }
@ -2739,10 +2730,9 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
cmFileCommandCurlDebugCallback); cmFileCommandCurlDebugCallback);
if (res != CURLE_OK) if (res != CURLE_OK)
{ {
std::string errstring = std::string e = "DOWNLOAD cannot set debug function: ";
"FILE(DOWNLOAD ) error; cannot set debug function: "; e += ::curl_easy_strerror(res);
errstring += ::curl_easy_strerror(res); this->SetError(e.c_str());
this->SetError(errstring.c_str());
return false; return false;
} }
@ -2752,27 +2742,27 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
if (res != CURLE_OK) if (res != CURLE_OK)
{ {
std::string errstring = "FILE(DOWNLOAD ) error; cannot set write data: "; std::string e = "DOWNLOAD cannot set write data: ";
errstring += ::curl_easy_strerror(res); e += ::curl_easy_strerror(res);
this->SetError(errstring.c_str()); this->SetError(e.c_str());
return false; return false;
} }
res = ::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, (void *)&chunkDebug); res = ::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, (void *)&chunkDebug);
if (res != CURLE_OK) if (res != CURLE_OK)
{ {
std::string errstring = "FILE(DOWNLOAD ) error; cannot set debug data: "; std::string e = "DOWNLOAD cannot set debug data: ";
errstring += ::curl_easy_strerror(res); e += ::curl_easy_strerror(res);
this->SetError(errstring.c_str()); this->SetError(e.c_str());
return false; return false;
} }
res = ::curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); res = ::curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
if (res != CURLE_OK) if (res != CURLE_OK)
{ {
std::string errstring = "FILE(DOWNLOAD ) error; cannot set follow-redirect option: "; std::string e = "DOWNLOAD cannot set follow-redirect option: ";
errstring += ::curl_easy_strerror(res); e += ::curl_easy_strerror(res);
this->SetError(errstring.c_str()); this->SetError(e.c_str());
return false; return false;
} }
@ -2782,9 +2772,9 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
if (res != CURLE_OK) if (res != CURLE_OK)
{ {
std::string errstring = "FILE(DOWNLOAD ) error; cannot set verbose: "; std::string e = "DOWNLOAD cannot set verbose: ";
errstring += ::curl_easy_strerror(res); e += ::curl_easy_strerror(res);
this->SetError(errstring.c_str()); this->SetError(e.c_str());
return false; return false;
} }
} }
@ -2795,9 +2785,9 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
if (res != CURLE_OK) if (res != CURLE_OK)
{ {
std::string errstring = "FILE(DOWNLOAD ) error; cannot set timeout: "; std::string e = "DOWNLOAD cannot set timeout: ";
errstring += ::curl_easy_strerror(res); e += ::curl_easy_strerror(res);
this->SetError(errstring.c_str()); this->SetError(e.c_str());
return false; return false;
} }
} }
@ -2815,9 +2805,9 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
CURLOPT_NOPROGRESS, 0); CURLOPT_NOPROGRESS, 0);
if (res != CURLE_OK) if (res != CURLE_OK)
{ {
std::string errstring = "FILE(DOWNLOAD ) error; cannot set noprogress value: "; std::string e = "DOWNLOAD cannot set noprogress value: ";
errstring += ::curl_easy_strerror(res); e += ::curl_easy_strerror(res);
this->SetError(errstring.c_str()); this->SetError(e.c_str());
return false; return false;
} }
@ -2825,9 +2815,9 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
CURLOPT_PROGRESSFUNCTION, cmFileCommandCurlProgressCallback); CURLOPT_PROGRESSFUNCTION, cmFileCommandCurlProgressCallback);
if (res != CURLE_OK) if (res != CURLE_OK)
{ {
std::string errstring = "FILE(DOWNLOAD ) error; cannot set progress function: "; std::string e = "DOWNLOAD cannot set progress function: ";
errstring += ::curl_easy_strerror(res); e += ::curl_easy_strerror(res);
this->SetError(errstring.c_str()); this->SetError(e.c_str());
return false; return false;
} }
@ -2835,9 +2825,9 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
CURLOPT_PROGRESSDATA, reinterpret_cast<void*>(&helper)); CURLOPT_PROGRESSDATA, reinterpret_cast<void*>(&helper));
if (res != CURLE_OK) if (res != CURLE_OK)
{ {
std::string errstring = "FILE(DOWNLOAD ) error; cannot set progress data: "; std::string e = "DOWNLOAD cannot set progress data: ";
errstring += ::curl_easy_strerror(res); e += ::curl_easy_strerror(res);
this->SetError(errstring.c_str()); this->SetError(e.c_str());
return false; return false;
} }
} }
@ -2871,8 +2861,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
if (!cmSystemTools::ComputeFileMD5(file.c_str(), computedMD5)) if (!cmSystemTools::ComputeFileMD5(file.c_str(), computedMD5))
{ {
this->SetError("FILE(DOWNLOAD ) error; cannot compute MD5 sum on " this->SetError("DOWNLOAD cannot compute MD5 sum on downloaded file");
"downloaded file");
return false; return false;
} }
@ -2882,8 +2871,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
if (expectedMD5sum != actualMD5sum) if (expectedMD5sum != actualMD5sum)
{ {
cmOStringStream oss; cmOStringStream oss;
oss << "FILE(DOWNLOAD ) error; expected and actual MD5 sums differ" oss << "DOWNLOAD MD5 mismatch" << std::endl
<< std::endl
<< " for file: [" << file << "]" << std::endl << " for file: [" << file << "]" << std::endl
<< " expected MD5 sum: [" << expectedMD5sum << "]" << std::endl << " expected MD5 sum: [" << expectedMD5sum << "]" << std::endl
<< " actual MD5 sum: [" << actualMD5sum << "]" << std::endl << " actual MD5 sum: [" << actualMD5sum << "]" << std::endl
@ -2913,8 +2901,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
return true; return true;
#else #else
this->SetError("FILE(DOWNLOAD ) " this->SetError("DOWNLOAD not supported by bootstrap cmake.");
"not supported in bootstrap cmake ");
return false; return false;
#endif #endif
} }

View File

@ -156,6 +156,11 @@ cmFindPackageCommand::cmFindPackageCommand()
"The full path to the configuration file is stored in the cmake " "The full path to the configuration file is stored in the cmake "
"variable <package>_CONFIG." "variable <package>_CONFIG."
"\n" "\n"
"All configuration files which have been considered by CMake while "
"searching for an installation of the package with an appropriate "
"version are stored in the cmake variable <package>_CONSIDERED_CONFIGS, "
"the associated versions in <package>_CONSIDERED_VERSIONS. "
"\n"
"If the package configuration file cannot be found CMake " "If the package configuration file cannot be found CMake "
"will generate an error describing the problem unless the QUIET " "will generate an error describing the problem unless the QUIET "
"argument is specified. If REQUIRED is specified and the package " "argument is specified. If REQUIRED is specified and the package "
@ -721,6 +726,8 @@ bool cmFindPackageCommand::FindModule(bool& found)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmFindPackageCommand::HandlePackageMode() bool cmFindPackageCommand::HandlePackageMode()
{ {
this->ConsideredConfigs.clear();
// Support old capitalization behavior. // Support old capitalization behavior.
std::string upperDir = cmSystemTools::UpperCase(this->Name); std::string upperDir = cmSystemTools::UpperCase(this->Name);
std::string upperFound = cmSystemTools::UpperCase(this->Name); std::string upperFound = cmSystemTools::UpperCase(this->Name);
@ -809,6 +816,25 @@ bool cmFindPackageCommand::HandlePackageMode()
{ {
// The variable is not set. // The variable is not set.
cmOStringStream e; cmOStringStream e;
// If there are files in ConsideredConfigs, it means that FooConfig.cmake
// have been found, but they didn't have appropriate versions.
if (this->ConsideredConfigs.size() > 0)
{
e << "Could not find a configuration file for package \""
<< this->Name << "\" that "
<< (this->VersionExact? "exactly matches" : "is compatible with")
<< " requested version \"" << this->Version << "\".\n"
<< "The following configuration files were considered but not "
"accepted:\n";
for(std::vector<ConfigFileInfo>::size_type i=0;
i<this->ConsideredConfigs.size(); i++)
{
e << " " << this->ConsideredConfigs[i].filename
<< ", version: " << this->ConsideredConfigs[i].version << "\n";
}
}
else
{
e << "Could not find "; e << "Could not find ";
if(!this->NoModule) if(!this->NoModule)
{ {
@ -839,6 +865,9 @@ bool cmFindPackageCommand::HandlePackageMode()
e << " " << *ci << "\n"; e << " " << *ci << "\n";
} }
} }
}
this->Makefile->IssueMessage( this->Makefile->IssueMessage(
this->Required? cmake::FATAL_ERROR : cmake::WARNING, e.str()); this->Required? cmake::FATAL_ERROR : cmake::WARNING, e.str());
} }
@ -897,6 +926,31 @@ bool cmFindPackageCommand::HandlePackageMode()
} }
#endif #endif
std::string consideredConfigsVar = this->Name;
consideredConfigsVar += "_CONSIDERED_CONFIGS";
std::string consideredVersionsVar = this->Name;
consideredVersionsVar += "_CONSIDERED_VERSIONS";
std::string consideredConfigFiles;
std::string consideredVersions;
const char* sep = "";
for(std::vector<ConfigFileInfo>::size_type i=0;
i<this->ConsideredConfigs.size(); i++)
{
consideredConfigFiles += sep;
consideredVersions += sep;
consideredConfigFiles += this->ConsideredConfigs[i].filename;
consideredVersions += this->ConsideredConfigs[i].version;
sep = ";";
}
this->Makefile->AddDefinition(consideredConfigsVar.c_str(),
consideredConfigFiles.c_str());
this->Makefile->AddDefinition(consideredVersionsVar.c_str(),
consideredVersions.c_str());
return result; return result;
} }
@ -1083,6 +1137,20 @@ void cmFindPackageCommand::AppendSuccessInformation()
} }
} }
// set a global property to record the required version of this package
std::string versionInfoPropName = "_CMAKE_";
versionInfoPropName += this->Name;
versionInfoPropName += "_REQUIRED_VERSION";
std::string versionInfo;
if(!this->Version.empty())
{
versionInfo = this->VersionExact ? "==" : ">=";
versionInfo += " ";
versionInfo += this->Version;
}
this->Makefile->GetCMakeInstance()->SetProperty(versionInfoPropName.c_str(),
versionInfo.c_str());
// Restore original state of "_FIND_" variables we set. // Restore original state of "_FIND_" variables we set.
this->RestoreFindDefinitions(); this->RestoreFindDefinitions();
} }
@ -1467,6 +1535,10 @@ bool cmFindPackageCommand::FindConfigFile(std::string const& dir,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmFindPackageCommand::CheckVersion(std::string const& config_file) bool cmFindPackageCommand::CheckVersion(std::string const& config_file)
{ {
bool result = false; // by default, assume the version is not ok.
bool haveResult = false;
std::string version = "unknown";
// Get the filename without the .cmake extension. // Get the filename without the .cmake extension.
std::string::size_type pos = config_file.rfind('.'); std::string::size_type pos = config_file.rfind('.');
std::string version_file_base = config_file.substr(0, pos); std::string version_file_base = config_file.substr(0, pos);
@ -1474,31 +1546,42 @@ bool cmFindPackageCommand::CheckVersion(std::string const& config_file)
// Look for foo-config-version.cmake // Look for foo-config-version.cmake
std::string version_file = version_file_base; std::string version_file = version_file_base;
version_file += "-version.cmake"; version_file += "-version.cmake";
if(cmSystemTools::FileExists(version_file.c_str(), true)) if ((haveResult == false)
&& (cmSystemTools::FileExists(version_file.c_str(), true)))
{ {
return this->CheckVersionFile(version_file); result = this->CheckVersionFile(version_file, version);
haveResult = true;
} }
// Look for fooConfigVersion.cmake // Look for fooConfigVersion.cmake
version_file = version_file_base; version_file = version_file_base;
version_file += "Version.cmake"; version_file += "Version.cmake";
if(cmSystemTools::FileExists(version_file.c_str(), true)) if ((haveResult == false)
&& (cmSystemTools::FileExists(version_file.c_str(), true)))
{ {
return this->CheckVersionFile(version_file); result = this->CheckVersionFile(version_file, version);
haveResult = true;
} }
// If no version was requested a versionless package is acceptable. // If no version was requested a versionless package is acceptable.
if(this->Version.empty()) if ((haveResult == false) && (this->Version.empty()))
{ {
return true; result = true;
haveResult = true;
} }
// No version file found. Assume the version is incompatible. ConfigFileInfo configFileInfo;
return false; configFileInfo.filename = config_file;
configFileInfo.version = version;
this->ConsideredConfigs.push_back(configFileInfo);
return result;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmFindPackageCommand::CheckVersionFile(std::string const& version_file) bool cmFindPackageCommand::CheckVersionFile(std::string const& version_file,
std::string& result_version)
{ {
// The version file will be loaded in an isolated scope. // The version file will be loaded in an isolated scope.
cmMakefile::ScopePushPop varScope(this->Makefile); cmMakefile::ScopePushPop varScope(this->Makefile);
@ -1571,6 +1654,12 @@ bool cmFindPackageCommand::CheckVersionFile(std::string const& version_file)
} }
} }
result_version = this->Makefile->GetSafeDefinition("PACKAGE_VERSION");
if (result_version.empty())
{
result_version = "unknown";
}
// Succeed if the version is suitable. // Succeed if the version is suitable.
return suitable; return suitable;
} }

View File

@ -98,7 +98,8 @@ private:
bool CheckDirectory(std::string const& dir); bool CheckDirectory(std::string const& dir);
bool FindConfigFile(std::string const& dir, std::string& file); bool FindConfigFile(std::string const& dir, std::string& file);
bool CheckVersion(std::string const& config_file); bool CheckVersion(std::string const& config_file);
bool CheckVersionFile(std::string const& version_file); bool CheckVersionFile(std::string const& version_file,
std::string& result_version);
bool SearchPrefix(std::string const& prefix); bool SearchPrefix(std::string const& prefix);
bool SearchFrameworkPrefix(std::string const& prefix_in); bool SearchFrameworkPrefix(std::string const& prefix_in);
bool SearchAppBundlePrefix(std::string const& prefix_in); bool SearchAppBundlePrefix(std::string const& prefix_in);
@ -137,6 +138,9 @@ private:
std::vector<std::string> Names; std::vector<std::string> Names;
std::vector<std::string> Configs; std::vector<std::string> Configs;
std::set<std::string> IgnoredPaths; std::set<std::string> IgnoredPaths;
struct ConfigFileInfo { std::string filename; std::string version; };
std::vector<ConfigFileInfo> ConsideredConfigs;
}; };
#endif #endif

View File

@ -863,19 +863,10 @@ void cmGlobalGenerator::Generate()
} }
// Compute the inter-target dependencies. // Compute the inter-target dependencies.
{ if(!this->ComputeTargetDepends())
cmComputeTargetDepends ctd(this);
if(!ctd.Compute())
{ {
return; return;
} }
std::vector<cmTarget*> const& targets = ctd.GetTargets();
for(std::vector<cmTarget*>::const_iterator ti = targets.begin();
ti != targets.end(); ++ti)
{
ctd.GetTargetDirectDepends(*ti, this->TargetDependencies[*ti]);
}
}
// Create a map from local generator to the complete set of targets // Create a map from local generator to the complete set of targets
// it builds by default. // it builds by default.
@ -909,6 +900,23 @@ void cmGlobalGenerator::Generate()
this->CMakeInstance->RunCheckForUnusedVariables("generation"); this->CMakeInstance->RunCheckForUnusedVariables("generation");
} }
//----------------------------------------------------------------------------
bool cmGlobalGenerator::ComputeTargetDepends()
{
cmComputeTargetDepends ctd(this);
if(!ctd.Compute())
{
return false;
}
std::vector<cmTarget*> const& targets = ctd.GetTargets();
for(std::vector<cmTarget*>::const_iterator ti = targets.begin();
ti != targets.end(); ++ti)
{
ctd.GetTargetDirectDepends(*ti, this->TargetDependencies[*ti]);
}
return true;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmGlobalGenerator::CheckTargets() bool cmGlobalGenerator::CheckTargets()
{ {
@ -1489,7 +1497,7 @@ void cmGlobalGenerator::FillLocalGeneratorToTargetMap()
// Add dependencies of the included target. An excluded // Add dependencies of the included target. An excluded
// target may still be included if it is a dependency of a // target may still be included if it is a dependency of a
// non-excluded target. // non-excluded target.
TargetDependSet & tgtdeps = this->GetTargetDirectDepends(target); TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(target);
for(TargetDependSet::const_iterator ti = tgtdeps.begin(); for(TargetDependSet::const_iterator ti = tgtdeps.begin();
ti != tgtdeps.end(); ++ti) ti != tgtdeps.end(); ++ti)
{ {
@ -1839,6 +1847,38 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
} }
} }
//----------------------------------------------------------------------------
const char* cmGlobalGenerator::GetPredefinedTargetsFolder()
{
const char* prop =
this->GetCMakeInstance()->GetProperty("PREDEFINED_TARGETS_FOLDER");
if (prop)
{
return prop;
}
return "CMakePredefinedTargets";
}
//----------------------------------------------------------------------------
bool cmGlobalGenerator::UseFolderProperty()
{
const char* prop = this->GetCMakeInstance()->GetProperty("USE_FOLDERS");
// If this property is defined, let the setter turn this on or off...
//
if (prop)
{
return cmSystemTools::IsOn(prop);
}
// By default, this feature is ON:
//
return true;
}
//----------------------------------------------------------------------------
cmTarget cmGlobalGenerator::CreateGlobalTarget( cmTarget cmGlobalGenerator::CreateGlobalTarget(
const char* name, const char* message, const char* name, const char* message,
const cmCustomCommandLines* commandLines, const cmCustomCommandLines* commandLines,
@ -1868,6 +1908,14 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(
{ {
target.AddUtility(dit->c_str()); target.AddUtility(dit->c_str());
} }
// Organize in the "predefined targets" folder:
//
if (this->UseFolderProperty())
{
target.SetProperty("FOLDER", this->GetPredefinedTargetsFolder());
}
return target; return target;
} }
@ -1881,7 +1929,7 @@ void cmGlobalGenerator::AppendDirectoryForConfig(const char*, const char*,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGlobalGenerator::TargetDependSet & cmGlobalGenerator::TargetDependSet const&
cmGlobalGenerator::GetTargetDirectDepends(cmTarget & target) cmGlobalGenerator::GetTargetDirectDepends(cmTarget & target)
{ {
return this->TargetDependencies[&target]; return this->TargetDependencies[&target];

View File

@ -238,7 +238,7 @@ public:
// what targets does the specified target depend on directly // what targets does the specified target depend on directly
// via a target_link_libraries or add_dependencies // via a target_link_libraries or add_dependencies
TargetDependSet & GetTargetDirectDepends(cmTarget & target); TargetDependSet const& GetTargetDirectDepends(cmTarget & target);
const std::map<cmStdString, std::vector<cmLocalGenerator*> >& GetProjectMap() const std::map<cmStdString, std::vector<cmLocalGenerator*> >& GetProjectMap()
const {return this->ProjectMap;} const {return this->ProjectMap;}
@ -275,6 +275,8 @@ protected:
void SetLanguageEnabledMaps(const char* l, cmMakefile* mf); void SetLanguageEnabledMaps(const char* l, cmMakefile* mf);
void FillExtensionToLanguageMap(const char* l, cmMakefile* mf); void FillExtensionToLanguageMap(const char* l, cmMakefile* mf);
virtual bool ComputeTargetDepends();
virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS(); virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS();
bool CheckTargets(); bool CheckTargets();
@ -320,6 +322,9 @@ protected:
// All targets in the entire project. // All targets in the entire project.
std::map<cmStdString,cmTarget *> TotalTargets; std::map<cmStdString,cmTarget *> TotalTargets;
virtual const char* GetPredefinedTargetsFolder();
virtual bool UseFolderProperty();
private: private:
float FirstTimeProgress; float FirstTimeProgress;
// If you add a new map here, make sure it is copied // If you add a new map here, make sure it is copied

View File

@ -40,7 +40,7 @@ void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout)
cmLocalGenerator *cmGlobalVisualStudio10Generator::CreateLocalGenerator() cmLocalGenerator *cmGlobalVisualStudio10Generator::CreateLocalGenerator()
{ {
cmLocalVisualStudio10Generator* lg = new cmLocalVisualStudio10Generator; cmLocalVisualStudio10Generator* lg = new cmLocalVisualStudio10Generator;
lg->SetPlatformName(this->PlatformName.c_str()); lg->SetPlatformName(this->GetPlatformName());
lg->SetGlobalGenerator(this); lg->SetGlobalGenerator(this);
return lg; return lg;
} }

View File

@ -16,7 +16,6 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGlobalVisualStudio10Win64Generator::cmGlobalVisualStudio10Win64Generator() cmGlobalVisualStudio10Win64Generator::cmGlobalVisualStudio10Win64Generator()
{ {
this->PlatformName = "x64";
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -27,6 +27,8 @@ public:
return cmGlobalVisualStudio10Win64Generator::GetActualName();} return cmGlobalVisualStudio10Win64Generator::GetActualName();}
static const char* GetActualName() {return "Visual Studio 10 Win64";} static const char* GetActualName() {return "Visual Studio 10 Win64";}
virtual const char* GetPlatformName() const {return "x64";}
/** Get the documentation entry for this generator. */ /** Get the documentation entry for this generator. */
virtual void GetDocumentation(cmDocumentationEntry& entry) const; virtual void GetDocumentation(cmDocumentationEntry& entry) const;

View File

@ -13,6 +13,7 @@
#include "cmLocalVisualStudio6Generator.h" #include "cmLocalVisualStudio6Generator.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmake.h" #include "cmake.h"
#include "cmGeneratedFileStream.h"
// Utility function to make a valid VS6 *.dsp filename out // Utility function to make a valid VS6 *.dsp filename out
// of a CMake target name: // of a CMake target name:
@ -274,44 +275,33 @@ void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout,
fout << "Package=<5>\n{{{\n}}}\n\n"; fout << "Package=<5>\n{{{\n}}}\n\n";
fout << "Package=<4>\n"; fout << "Package=<4>\n";
fout << "{{{\n"; fout << "{{{\n";
VSDependSet const& depends = this->VSTargetDepends[&target];
// insert Begin Project Dependency Project_Dep_Name project stuff here for(VSDependSet::const_iterator di = depends.begin();
if (target.GetType() != cmTarget::STATIC_LIBRARY) di != depends.end(); ++di)
{
cmTarget::LinkLibraryVectorType::const_iterator j, jend;
j = target.GetLinkLibraries().begin();
jend = target.GetLinkLibraries().end();
for(;j!= jend; ++j)
{
if(j->first != dspname)
{
// is the library part of this DSW ? If so add dependency
if(this->FindTarget(0, j->first.c_str()))
{ {
const char* name = di->c_str();
fout << "Begin Project Dependency\n"; fout << "Begin Project Dependency\n";
fout << "Project_Dep_Name " fout << "Project_Dep_Name " << GetVS6TargetName(name) << "\n";
<< GetVS6TargetName(j->first.c_str()) << "\n";
fout << "End Project Dependency\n"; fout << "End Project Dependency\n";
} }
}
}
}
std::set<cmStdString>::const_iterator i, end;
// write utility dependencies.
i = target.GetUtilities().begin();
end = target.GetUtilities().end();
for(;i!= end; ++i)
{
if(*i != dspname)
{
std::string depName = this->GetUtilityForTarget(target, i->c_str());
fout << "Begin Project Dependency\n";
fout << "Project_Dep_Name " << GetVS6TargetName(depName) << "\n";
fout << "End Project Dependency\n";
}
}
fout << "}}}\n\n"; fout << "}}}\n\n";
UtilityDependsMap::iterator ui = this->UtilityDepends.find(&target);
if(ui != this->UtilityDepends.end())
{
const char* uname = ui->second.c_str();
fout << "Project: \"" << uname << "\"="
<< dir << "\\" << uname << ".dsp - Package Owner=<4>\n\n";
fout <<
"Package=<5>\n{{{\n}}}\n\n"
"Package=<4>\n"
"{{{\n"
"Begin Project Dependency\n"
"Project_Dep_Name " << dspname << "\n"
"End Project Dependency\n"
"}}}\n\n";
;
}
} }
@ -367,6 +357,49 @@ void cmGlobalVisualStudio6Generator::WriteDSWHeader(std::ostream& fout)
fout << "# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\n\n"; fout << "# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\n\n";
} }
//----------------------------------------------------------------------------
std::string
cmGlobalVisualStudio6Generator::WriteUtilityDepend(cmTarget* target)
{
std::string pname = target->GetName();
pname += "_UTILITY";
pname = GetVS6TargetName(pname.c_str());
std::string fname = target->GetMakefile()->GetStartOutputDirectory();
fname += "/";
fname += pname;
fname += ".dsp";
cmGeneratedFileStream fout(fname.c_str());
fout.SetCopyIfDifferent(true);
fout <<
"# Microsoft Developer Studio Project File - Name=\""
<< pname << "\" - Package Owner=<4>\n"
"# Microsoft Developer Studio Generated Build File, Format Version 6.00\n"
"# ** DO NOT EDIT **\n"
"\n"
"# TARGTYPE \"Win32 (x86) Generic Project\" 0x010a\n"
"\n"
"CFG=" << pname << " - Win32 Debug\n"
"!MESSAGE \"" << pname << " - Win32 Debug\""
" (based on \"Win32 (x86) Generic Project\")\n"
"!MESSAGE \"" << pname << " - Win32 Release\" "
"(based on \"Win32 (x86) Generic Project\")\n"
"!MESSAGE \"" << pname << " - Win32 MinSizeRel\" "
"(based on \"Win32 (x86) Generic Project\")\n"
"!MESSAGE \"" << pname << " - Win32 RelWithDebInfo\" "
"(based on \"Win32 (x86) Generic Project\")\n"
"\n"
"# Begin Project\n"
"# Begin Target\n"
"# Name \"" << pname << " - Win32 Debug\"\n"
"# Name \"" << pname << " - Win32 Release\"\n"
"# Name \"" << pname << " - Win32 MinSizeRel\"\n"
"# Name \"" << pname << " - Win32 RelWithDebInfo\"\n"
"# End Target\n"
"# End Project\n"
;
return pname;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalVisualStudio6Generator void cmGlobalVisualStudio6Generator
::GetDocumentation(cmDocumentationEntry& entry) const ::GetDocumentation(cmDocumentationEntry& entry) const

View File

@ -96,6 +96,7 @@ private:
const char* name, const char* path, const char* name, const char* path,
const std::set<cmStdString>& dependencies); const std::set<cmStdString>& dependencies);
void WriteDSWFooter(std::ostream& fout); void WriteDSWFooter(std::ostream& fout);
virtual std::string WriteUtilityDepend(cmTarget* target);
}; };
#endif #endif

View File

@ -111,6 +111,13 @@ void cmGlobalVisualStudio71Generator
OrderedTargetDependSet orderedProjectTargets(projectTargets); OrderedTargetDependSet orderedProjectTargets(projectTargets);
this->WriteTargetsToSolution(fout, root, orderedProjectTargets); this->WriteTargetsToSolution(fout, root, orderedProjectTargets);
bool useFolderProperty = this->UseFolderProperty();
if (useFolderProperty)
{
this->WriteFolders(fout);
}
// Write out the configurations information for the solution // Write out the configurations information for the solution
fout << "Global\n"; fout << "Global\n";
// Write out the configurations for the solution // Write out the configurations for the solution
@ -120,6 +127,15 @@ void cmGlobalVisualStudio71Generator
// Write out the configurations for all the targets in the project // Write out the configurations for all the targets in the project
this->WriteTargetConfigurations(fout, root, orderedProjectTargets); this->WriteTargetConfigurations(fout, root, orderedProjectTargets);
fout << "\tEndGlobalSection\n"; fout << "\tEndGlobalSection\n";
if (useFolderProperty)
{
// Write out project folders
fout << "\tGlobalSection(NestedProjects) = preSolution\n";
this->WriteFoldersContent(fout);
fout << "\tEndGlobalSection\n";
}
// Write the footer for the SLN file // Write the footer for the SLN file
this->WriteSLNFooter(fout); this->WriteSLNFooter(fout);
} }
@ -163,16 +179,31 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
ext = targetExt; ext = targetExt;
} }
std::string guid = this->GetGUID(dspname);
fout << project fout << project
<< dspname << "\", \"" << dspname << "\", \""
<< this->ConvertToSolutionPath(dir) << this->ConvertToSolutionPath(dir)
<< "\\" << dspname << ext << "\", \"{" << "\\" << dspname << ext << "\", \"{" << guid << "}\"\n";
<< this->GetGUID(dspname) << "}\"\n";
fout << "\tProjectSection(ProjectDependencies) = postProject\n"; fout << "\tProjectSection(ProjectDependencies) = postProject\n";
this->WriteProjectDepends(fout, dspname, dir, t); this->WriteProjectDepends(fout, dspname, dir, t);
fout << "\tEndProjectSection\n"; fout << "\tEndProjectSection\n";
fout <<"EndProject\n"; fout <<"EndProject\n";
UtilityDependsMap::iterator ui = this->UtilityDepends.find(&t);
if(ui != this->UtilityDepends.end())
{
const char* uname = ui->second.c_str();
fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""
<< uname << "\", \""
<< this->ConvertToSolutionPath(dir)
<< "\\" << uname << ".vcproj" << "\", \"{"
<< this->GetGUID(uname) << "}\"\n"
<< "\tProjectSection(ProjectDependencies) = postProject\n"
<< "\t\t{" << guid << "} = {" << guid << "}\n"
<< "\tEndProjectSection\n"
<< "EndProject\n";
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -182,51 +213,15 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
void void
cmGlobalVisualStudio71Generator cmGlobalVisualStudio71Generator
::WriteProjectDepends(std::ostream& fout, ::WriteProjectDepends(std::ostream& fout,
const char* dspname, const char*,
const char*, cmTarget& target) const char*, cmTarget& target)
{ {
#if 0 VSDependSet const& depends = this->VSTargetDepends[&target];
// Create inter-target dependencies in the solution file. For VS for(VSDependSet::const_iterator di = depends.begin();
// 7.1 and below we cannot let static libraries depend directly on di != depends.end(); ++di)
// targets to which they "link" because the librarian tool will copy
// the targets into the static library. See
// cmGlobalVisualStudioGenerator::FixUtilityDependsForTarget for a
// work-around. VS 8 and above do not have this problem.
if (!this->VSLinksDependencies() ||
target.GetType() != cmTarget::STATIC_LIBRARY);
#else
if (target.GetType() != cmTarget::STATIC_LIBRARY)
#endif
{ {
cmTarget::LinkLibraryVectorType::const_iterator j, jend; const char* name = di->c_str();
j = target.GetLinkLibraries().begin(); std::string guid = this->GetGUID(name);
jend = target.GetLinkLibraries().end();
for(;j!= jend; ++j)
{
if(j->first != dspname)
{
// is the library part of this SLN ? If so add dependency
// find target anywhere because all depend libraries are
// brought in as well
if(this->FindTarget(0, j->first.c_str()))
{
fout << "\t\t{" << this->GetGUID(j->first.c_str()) << "} = {"
<< this->GetGUID(j->first.c_str()) << "}\n";
}
}
}
}
std::set<cmStdString>::const_iterator i, end;
// write utility dependencies.
i = target.GetUtilities().begin();
end = target.GetUtilities().end();
for(;i!= end; ++i)
{
if(*i != dspname)
{
std::string name = this->GetUtilityForTarget(target, i->c_str());
std::string guid = this->GetGUID(name.c_str());
if(guid.size() == 0) if(guid.size() == 0)
{ {
std::string m = "Target: "; std::string m = "Target: ";
@ -235,11 +230,9 @@ cmGlobalVisualStudio71Generator
m += name; m += name;
cmSystemTools::Error(m.c_str()); cmSystemTools::Error(m.c_str());
} }
fout << "\t\t{" << guid << "} = {" << guid << "}\n"; fout << "\t\t{" << guid << "} = {" << guid << "}\n";
} }
} }
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Write a dsp file into the SLN file, Note, that dependencies from // Write a dsp file into the SLN file, Note, that dependencies from

View File

@ -300,6 +300,48 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
cmLocalGenerator::START_OUTPUT); cmLocalGenerator::START_OUTPUT);
this->WriteProject(fout, vcprojName, dir.c_str(), this->WriteProject(fout, vcprojName, dir.c_str(),
*target); *target);
// Create "solution folder" information from FOLDER target property
//
if (this->UseFolderProperty())
{
const char *targetFolder = target->GetProperty("FOLDER");
if (targetFolder)
{
std::vector<cmsys::String> tokens =
cmSystemTools::SplitString(targetFolder, '/', false);
std::string cumulativePath = "";
for(std::vector<cmsys::String>::iterator iter = tokens.begin();
iter != tokens.end(); ++iter)
{
if(!iter->size())
{
continue;
}
if (cumulativePath.empty())
{
cumulativePath = *iter;
}
else
{
VisualStudioFolders[cumulativePath].insert(
cumulativePath + "/" + *iter);
cumulativePath = cumulativePath + "/" + *iter;
}
this->CreateGUID(cumulativePath.c_str());
}
if (!cumulativePath.empty())
{
VisualStudioFolders[cumulativePath].insert(target->GetName());
}
}
}
} }
} }
} }
@ -327,6 +369,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetDepends(
} }
} }
//----------------------------------------------------------------------------
// Write a SLN file to the stream // Write a SLN file to the stream
void cmGlobalVisualStudio7Generator void cmGlobalVisualStudio7Generator
::WriteSLNFile(std::ostream& fout, ::WriteSLNFile(std::ostream& fout,
@ -344,6 +387,13 @@ void cmGlobalVisualStudio7Generator
OrderedTargetDependSet orderedProjectTargets(projectTargets); OrderedTargetDependSet orderedProjectTargets(projectTargets);
this->WriteTargetsToSolution(fout, root, orderedProjectTargets); this->WriteTargetsToSolution(fout, root, orderedProjectTargets);
bool useFolderProperty = this->UseFolderProperty();
if (useFolderProperty)
{
this->WriteFolders(fout);
}
// Write out the configurations information for the solution // Write out the configurations information for the solution
fout << "Global\n" fout << "Global\n"
<< "\tGlobalSection(SolutionConfiguration) = preSolution\n"; << "\tGlobalSection(SolutionConfiguration) = preSolution\n";
@ -361,6 +411,14 @@ void cmGlobalVisualStudio7Generator
this->WriteTargetDepends(fout, orderedProjectTargets); this->WriteTargetDepends(fout, orderedProjectTargets);
fout << "\tEndGlobalSection\n"; fout << "\tEndGlobalSection\n";
if (useFolderProperty)
{
// Write out project folders
fout << "\tGlobalSection(NestedProjects) = preSolution\n";
this->WriteFoldersContent(fout);
fout << "\tEndGlobalSection\n";
}
// Write out the configurations for all the targets in the project // Write out the configurations for all the targets in the project
fout << "\tGlobalSection(ProjectConfiguration) = postSolution\n"; fout << "\tGlobalSection(ProjectConfiguration) = postSolution\n";
this->WriteTargetConfigurations(fout, root, orderedProjectTargets); this->WriteTargetConfigurations(fout, root, orderedProjectTargets);
@ -370,6 +428,47 @@ void cmGlobalVisualStudio7Generator
this->WriteSLNFooter(fout); this->WriteSLNFooter(fout);
} }
//----------------------------------------------------------------------------
void cmGlobalVisualStudio7Generator::WriteFolders(std::ostream& fout)
{
std::string guidProjectTypeFolder = "2150E333-8FDC-42A3-9474-1A3956D46DE8";
for(std::map<std::string,std::set<std::string> >::iterator iter =
VisualStudioFolders.begin(); iter != VisualStudioFolders.end(); ++iter)
{
std::string fullName = iter->first;
std::string guid = this->GetGUID(fullName.c_str());
std::string nameOnly = cmSystemTools::GetFilenameName(fullName);
cmSystemTools::ReplaceString(fullName, "/", "\\");
fout << "Project(\"{" <<
guidProjectTypeFolder << "}\") = \"" <<
nameOnly << "\", \"" <<
fullName << "\", \"{" <<
guid <<
"}\"\nEndProject\n";
}
}
//----------------------------------------------------------------------------
void cmGlobalVisualStudio7Generator::WriteFoldersContent(std::ostream& fout)
{
for(std::map<std::string,std::set<std::string> >::iterator iter =
VisualStudioFolders.begin(); iter != VisualStudioFolders.end(); ++iter)
{
std::string key(iter->first);
std::string guidParent(this->GetGUID(key.c_str()));
for(std::set<std::string>::iterator it = iter->second.begin();
it != iter->second.end(); ++it)
{
std::string value(*it);
std::string guid(this->GetGUID(value.c_str()));
fout << "\t\t{" << guid << "} = {" << guidParent << "}\n";
}
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string std::string
cmGlobalVisualStudio7Generator::ConvertToSolutionPath(const char* path) cmGlobalVisualStudio7Generator::ConvertToSolutionPath(const char* path)
@ -408,6 +507,18 @@ void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout,
<< this->ConvertToSolutionPath(dir) << this->ConvertToSolutionPath(dir)
<< "\\" << dspname << ext << "\", \"{" << "\\" << dspname << ext << "\", \"{"
<< this->GetGUID(dspname) << "}\"\nEndProject\n"; << this->GetGUID(dspname) << "}\"\nEndProject\n";
UtilityDependsMap::iterator ui = this->UtilityDepends.find(&target);
if(ui != this->UtilityDepends.end())
{
const char* uname = ui->second.c_str();
fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""
<< uname << "\", \""
<< this->ConvertToSolutionPath(dir)
<< "\\" << uname << ".vcproj" << "\", \"{"
<< this->GetGUID(uname) << "}\"\n"
<< "EndProject\n";
}
} }
@ -422,59 +533,30 @@ cmGlobalVisualStudio7Generator
const char*, cmTarget& target) const char*, cmTarget& target)
{ {
int depcount = 0; int depcount = 0;
// insert Begin Project Dependency Project_Dep_Name project stuff here std::string dspguid = this->GetGUID(dspname);
if (target.GetType() != cmTarget::STATIC_LIBRARY) VSDependSet const& depends = this->VSTargetDepends[&target];
for(VSDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di)
{ {
cmTarget::LinkLibraryVectorType::const_iterator j, jend; const char* name = di->c_str();
j = target.GetLinkLibraries().begin(); std::string guid = this->GetGUID(name);
jend = target.GetLinkLibraries().end();
for(;j!= jend; ++j)
{
if(j->first != dspname)
{
// is the library part of this SLN ? If so add dependency
if(this->FindTarget(0, j->first.c_str()))
{
std::string guid = this->GetGUID(j->first.c_str());
if(guid.size() == 0) if(guid.size() == 0)
{ {
std::string m = "Target: "; std::string m = "Target: ";
m += dspname; m += target.GetName();
m += " depends on unknown target: "; m += " depends on unknown target: ";
m += j->first.c_str(); m += name;
cmSystemTools::Error(m.c_str()); cmSystemTools::Error(m.c_str());
} }
fout << "\t\t{" << this->GetGUID(dspname) << "}." fout << "\t\t{" << dspguid << "}." << depcount << " = {" << guid << "}\n";
<< depcount << " = {" << guid << "}\n";
depcount++; depcount++;
} }
}
}
}
std::set<cmStdString>::const_iterator i, end; UtilityDependsMap::iterator ui = this->UtilityDepends.find(&target);
// write utility dependencies. if(ui != this->UtilityDepends.end())
i = target.GetUtilities().begin();
end = target.GetUtilities().end();
for(;i!= end; ++i)
{ {
if(*i != dspname) const char* uname = ui->second.c_str();
{ fout << "\t\t{" << this->GetGUID(uname) << "}.0 = {" << dspguid << "}\n";
std::string name = this->GetUtilityForTarget(target, i->c_str());
std::string guid = this->GetGUID(name.c_str());
if(guid.size() == 0)
{
std::string m = "Target: ";
m += dspname;
m += " depends on unknown target: ";
m += name.c_str();
cmSystemTools::Error(m.c_str());
}
fout << "\t\t{" << this->GetGUID(dspname) << "}." << depcount << " = {"
<< guid << "}\n";
depcount++;
}
} }
} }
@ -537,6 +619,61 @@ void cmGlobalVisualStudio7Generator::WriteSLNHeader(std::ostream& fout)
fout << "Microsoft Visual Studio Solution File, Format Version 7.00\n"; fout << "Microsoft Visual Studio Solution File, Format Version 7.00\n";
} }
//----------------------------------------------------------------------------
std::string
cmGlobalVisualStudio7Generator::WriteUtilityDepend(cmTarget* target)
{
std::string pname = target->GetName();
pname += "_UTILITY";
std::string fname = target->GetMakefile()->GetStartOutputDirectory();
fname += "/";
fname += pname;
fname += ".vcproj";
cmGeneratedFileStream fout(fname.c_str());
fout.SetCopyIfDifferent(true);
this->CreateGUID(pname.c_str());
std::string guid = this->GetGUID(pname.c_str());
fout <<
"<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\n"
"<VisualStudioProject\n"
"\tProjectType=\"Visual C++\"\n"
"\tVersion=\"" << this->GetIDEVersion() << "0\"\n"
"\tName=\"" << pname << "\"\n"
"\tProjectGUID=\"{" << guid << "}\"\n"
"\tKeyword=\"Win32Proj\">\n"
"\t<Platforms><Platform Name=\"Win32\"/></Platforms>\n"
"\t<Configurations>\n"
;
for(std::vector<std::string>::iterator i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
{
fout <<
"\t\t<Configuration\n"
"\t\t\tName=\"" << *i << "|Win32\"\n"
"\t\t\tOutputDirectory=\"" << *i << "\"\n"
"\t\t\tIntermediateDirectory=\"" << pname << ".dir\\" << *i << "\"\n"
"\t\t\tConfigurationType=\"10\"\n"
"\t\t\tUseOfMFC=\"0\"\n"
"\t\t\tATLMinimizesCRunTimeLibraryUsage=\"FALSE\"\n"
"\t\t\tCharacterSet=\"2\">\n"
"\t\t</Configuration>\n"
;
}
fout <<
"\t</Configurations>\n"
"\t<Files></Files>\n"
"\t<Globals></Globals>\n"
"</VisualStudioProject>\n"
;
if(fout.Close())
{
this->FileReplacedDuringGenerate(fname);
}
return pname;
}
std::string cmGlobalVisualStudio7Generator::GetGUID(const char* name) std::string cmGlobalVisualStudio7Generator::GetGUID(const char* name)
{ {
std::string guidStoreName = name; std::string guidStoreName = name;

View File

@ -113,6 +113,7 @@ protected:
bool partOfDefaultBuild); bool partOfDefaultBuild);
virtual void WriteSLNFooter(std::ostream& fout); virtual void WriteSLNFooter(std::ostream& fout);
virtual void WriteSLNHeader(std::ostream& fout); virtual void WriteSLNHeader(std::ostream& fout);
virtual std::string WriteUtilityDepend(cmTarget* target);
virtual void AddPlatformDefinitions(cmMakefile* mf); virtual void AddPlatformDefinitions(cmMakefile* mf);
virtual void WriteTargetsToSolution( virtual void WriteTargetsToSolution(
@ -142,6 +143,10 @@ protected:
std::vector<std::string> Configurations; std::vector<std::string> Configurations;
std::map<cmStdString, cmStdString> GUIDMap; std::map<cmStdString, cmStdString> GUIDMap;
virtual void WriteFolders(std::ostream& fout);
virtual void WriteFoldersContent(std::ostream& fout);
std::map<std::string,std::set<std::string> > VisualStudioFolders;
// Set during OutputSLNFile with the name of the current project. // Set during OutputSLNFile with the name of the current project.
// There is one SLN file per project. // There is one SLN file per project.
std::string CurrentProject; std::string CurrentProject;

View File

@ -21,7 +21,7 @@ cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator()
{ {
this->FindMakeProgramFile = "CMakeVS8FindMake.cmake"; this->FindMakeProgramFile = "CMakeVS8FindMake.cmake";
this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms";
this->PlatformName = "Win32"; this->ArchitectureId = "X86";
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -30,6 +30,7 @@ cmLocalGenerator *cmGlobalVisualStudio8Generator::CreateLocalGenerator()
{ {
cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator;
lg->SetVersion8(); lg->SetVersion8();
lg->SetPlatformName(this->GetPlatformName());
lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
lg->SetGlobalGenerator(this); lg->SetGlobalGenerator(this);
return lg; return lg;
@ -55,8 +56,8 @@ void cmGlobalVisualStudio8Generator
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf) void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf)
{ {
mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "X86"); mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", this->ArchitectureId);
mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "X86"); mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", this->ArchitectureId);
mf->AddDefinition("MSVC80", "1"); mf->AddDefinition("MSVC80", "1");
} }
@ -136,6 +137,13 @@ void cmGlobalVisualStudio8Generator::AddCheckTarget()
no_working_directory, no_depends, no_working_directory, no_depends,
noCommandLines); noCommandLines);
// Organize in the "predefined targets" folder:
//
if (this->UseFolderProperty())
{
tgt->SetProperty("FOLDER", this->GetPredefinedTargetsFolder());
}
// Create a list of all stamp files for this project. // Create a list of all stamp files for this project.
std::vector<std::string> stamps; std::vector<std::string> stamps;
std::string stampList = cmake::GetCMakeFilesDirectoryPostSlash(); std::string stampList = cmake::GetCMakeFilesDirectoryPostSlash();
@ -252,8 +260,8 @@ cmGlobalVisualStudio8Generator
for(std::vector<std::string>::iterator i = this->Configurations.begin(); for(std::vector<std::string>::iterator i = this->Configurations.begin();
i != this->Configurations.end(); ++i) i != this->Configurations.end(); ++i)
{ {
fout << "\t\t" << *i << "|" << this->PlatformName << " = " << *i << "|" fout << "\t\t" << *i << "|" << this->GetPlatformName()
<< this->PlatformName << "\n"; << " = " << *i << "|" << this->GetPlatformName() << "\n";
} }
fout << "\tEndGlobalSection\n"; fout << "\tEndGlobalSection\n";
} }
@ -269,13 +277,13 @@ cmGlobalVisualStudio8Generator
i != this->Configurations.end(); ++i) i != this->Configurations.end(); ++i)
{ {
fout << "\t\t{" << guid << "}." << *i fout << "\t\t{" << guid << "}." << *i
<< "|" << this->PlatformName << ".ActiveCfg = " << "|" << this->GetPlatformName() << ".ActiveCfg = "
<< *i << "|" << this->PlatformName << "\n"; << *i << "|" << this->GetPlatformName() << "\n";
if(partOfDefaultBuild) if(partOfDefaultBuild)
{ {
fout << "\t\t{" << guid << "}." << *i fout << "\t\t{" << guid << "}." << *i
<< "|" << this->PlatformName << ".Build.0 = " << "|" << this->GetPlatformName() << ".Build.0 = "
<< *i << "|" << this->PlatformName << "\n"; << *i << "|" << this->GetPlatformName() << "\n";
} }
} }
} }

View File

@ -32,14 +32,14 @@ public:
return cmGlobalVisualStudio8Generator::GetActualName();} return cmGlobalVisualStudio8Generator::GetActualName();}
static const char* GetActualName() {return "Visual Studio 8 2005";} static const char* GetActualName() {return "Visual Studio 8 2005";}
virtual const char* GetPlatformName() const {return "Win32";}
/** Get the documentation entry for this generator. */ /** Get the documentation entry for this generator. */
virtual void GetDocumentation(cmDocumentationEntry& entry) const; virtual void GetDocumentation(cmDocumentationEntry& entry) const;
///! Create a local generator appropriate to this Global Generator ///! Create a local generator appropriate to this Global Generator
virtual cmLocalGenerator *CreateLocalGenerator(); virtual cmLocalGenerator *CreateLocalGenerator();
std::string const& GetPlatformName() const { return this->PlatformName; }
/** /**
* Override Configure and Generate to add the build-system check * Override Configure and Generate to add the build-system check
* target. * target.
@ -78,6 +78,7 @@ protected:
virtual void WriteProjectConfigurations(std::ostream& fout, virtual void WriteProjectConfigurations(std::ostream& fout,
const char* name, const char* name,
bool partOfDefaultBuild); bool partOfDefaultBuild);
std::string PlatformName; // Win32 or x64
const char* ArchitectureId;
}; };
#endif #endif

View File

@ -19,7 +19,7 @@
cmGlobalVisualStudio8Win64Generator::cmGlobalVisualStudio8Win64Generator() cmGlobalVisualStudio8Win64Generator::cmGlobalVisualStudio8Win64Generator()
{ {
this->PlatformName = "x64"; this->ArchitectureId = "x64";
} }
///! Create a local generator appropriate to this Global Generator ///! Create a local generator appropriate to this Global Generator
@ -27,7 +27,7 @@ cmLocalGenerator *cmGlobalVisualStudio8Win64Generator::CreateLocalGenerator()
{ {
cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator;
lg->SetVersion8(); lg->SetVersion8();
lg->SetPlatformName(this->PlatformName.c_str()); lg->SetPlatformName(this->GetPlatformName());
lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
lg->SetGlobalGenerator(this); lg->SetGlobalGenerator(this);
return lg; return lg;
@ -48,6 +48,4 @@ void cmGlobalVisualStudio8Win64Generator
{ {
this->cmGlobalVisualStudio8Generator::AddPlatformDefinitions(mf); this->cmGlobalVisualStudio8Generator::AddPlatformDefinitions(mf);
mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE"); mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE");
mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "x64");
mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "x64");
} }

View File

@ -33,6 +33,8 @@ public:
return cmGlobalVisualStudio8Win64Generator::GetActualName();} return cmGlobalVisualStudio8Win64Generator::GetActualName();}
static const char* GetActualName() {return "Visual Studio 8 2005 Win64";} static const char* GetActualName() {return "Visual Studio 8 2005 Win64";}
virtual const char* GetPlatformName() const {return "x64";}
/** Get the documentation entry for this generator. */ /** Get the documentation entry for this generator. */
virtual void GetDocumentation(cmDocumentationEntry& entry) const; virtual void GetDocumentation(cmDocumentationEntry& entry) const;

View File

@ -25,8 +25,8 @@ cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalVisualStudio9Generator::AddPlatformDefinitions(cmMakefile* mf) void cmGlobalVisualStudio9Generator::AddPlatformDefinitions(cmMakefile* mf)
{ {
mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "X86"); mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", this->ArchitectureId);
mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "X86"); mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", this->ArchitectureId);
mf->AddDefinition("MSVC90", "1"); mf->AddDefinition("MSVC90", "1");
} }
@ -42,6 +42,7 @@ cmLocalGenerator *cmGlobalVisualStudio9Generator::CreateLocalGenerator()
{ {
cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator;
lg->SetVersion9(); lg->SetVersion9();
lg->SetPlatformName(this->GetPlatformName());
lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
lg->SetGlobalGenerator(this); lg->SetGlobalGenerator(this);
return lg; return lg;

View File

@ -16,7 +16,7 @@
cmGlobalVisualStudio9Win64Generator::cmGlobalVisualStudio9Win64Generator() cmGlobalVisualStudio9Win64Generator::cmGlobalVisualStudio9Win64Generator()
{ {
this->PlatformName = "x64"; this->ArchitectureId = "x64";
} }
///! Create a local generator appropriate to this Global Generator ///! Create a local generator appropriate to this Global Generator
@ -24,7 +24,7 @@ cmLocalGenerator *cmGlobalVisualStudio9Win64Generator::CreateLocalGenerator()
{ {
cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator;
lg->SetVersion9(); lg->SetVersion9();
lg->SetPlatformName(this->PlatformName.c_str()); lg->SetPlatformName(this->GetPlatformName());
lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
lg->SetGlobalGenerator(this); lg->SetGlobalGenerator(this);
return lg; return lg;
@ -45,6 +45,4 @@ void cmGlobalVisualStudio9Win64Generator
{ {
cmGlobalVisualStudio9Generator::AddPlatformDefinitions(mf); cmGlobalVisualStudio9Generator::AddPlatformDefinitions(mf);
mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE"); mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE");
mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "x64");
mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "x64");
} }

View File

@ -33,6 +33,8 @@ public:
return cmGlobalVisualStudio9Win64Generator::GetActualName();} return cmGlobalVisualStudio9Win64Generator::GetActualName();}
static const char* GetActualName() {return "Visual Studio 9 2008 Win64";} static const char* GetActualName() {return "Visual Studio 9 2008 Win64";}
virtual const char* GetPlatformName() const {return "x64";}
/** Get the documentation entry for this generator. */ /** Get the documentation entry for this generator. */
virtual void GetDocumentation(cmDocumentationEntry& entry) const; virtual void GetDocumentation(cmDocumentationEntry& entry) const;

View File

@ -56,6 +56,21 @@ void cmGlobalVisualStudioGenerator::Generate()
AddUtilityCommand("ALL_BUILD", true, no_working_dir, AddUtilityCommand("ALL_BUILD", true, no_working_dir,
no_depends, no_commands, false, no_depends, no_commands, false,
"Build all projects"); "Build all projects");
#if 0
// Can't activate this code because we want ALL_BUILD
// selected as the default "startup project" when first
// opened in Visual Studio... And if it's nested in a
// folder, then that doesn't happen.
//
// Organize in the "predefined targets" folder:
//
if (this->UseFolderProperty())
{
allBuild->SetProperty("FOLDER", this->GetPredefinedTargetsFolder());
}
#endif
// Now make all targets depend on the ALL_BUILD target // Now make all targets depend on the ALL_BUILD target
cmTargets targets; cmTargets targets;
for(std::vector<cmLocalGenerator*>::iterator i = gen.begin(); for(std::vector<cmLocalGenerator*>::iterator i = gen.begin();
@ -74,9 +89,6 @@ void cmGlobalVisualStudioGenerator::Generate()
} }
} }
// Fix utility dependencies to avoid linking to libraries.
this->FixUtilityDepends();
// Configure CMake Visual Studio macros, for this user on this version // Configure CMake Visual Studio macros, for this user on this version
// of Visual Studio. // of Visual Studio.
this->ConfigureCMakeVisualStudioMacros(); this->ConfigureCMakeVisualStudioMacros();
@ -225,129 +237,59 @@ std::string cmGlobalVisualStudioGenerator::GetUserMacrosRegKeyBase()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalVisualStudioGenerator::FixUtilityDepends() bool cmGlobalVisualStudioGenerator::ComputeTargetDepends()
{ {
// Skip for VS versions 8 and above. if(!this->cmGlobalGenerator::ComputeTargetDepends())
if(!this->VSLinksDependencies())
{ {
return; return false;
} }
std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
// For VS versions before 8: for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it)
//
// When a target that links contains a project-level dependency on a
// library target that library is automatically linked. In order to
// allow utility-style project-level dependencies that do not
// actually link we need to automatically insert an intermediate
// custom target.
//
// Here we edit the utility dependencies of a target to add the
// intermediate custom target when necessary.
for(unsigned i = 0; i < this->LocalGenerators.size(); ++i)
{ {
cmTargets* targets = std::vector<cmLocalGenerator*>& gen = it->second;
&(this->LocalGenerators[i]->GetMakefile()->GetTargets()); for(std::vector<cmLocalGenerator*>::iterator i = gen.begin();
for(cmTargets::iterator tarIt = targets->begin(); i != gen.end(); ++i)
tarIt != targets->end(); ++tarIt)
{ {
this->FixUtilityDependsForTarget(tarIt->second); cmTargets& targets = (*i)->GetMakefile()->GetTargets();
for(cmTargets::iterator ti = targets.begin();
ti != targets.end(); ++ti)
{
this->ComputeVSTargetDepends(ti->second);
} }
} }
} }
return true;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target)
cmGlobalVisualStudioGenerator::FixUtilityDependsForTarget(cmTarget& target)
{ {
// Only targets that link need to be fixed. if(this->VSTargetDepends.find(&target) != this->VSTargetDepends.end())
if(target.GetType() != cmTarget::STATIC_LIBRARY &&
target.GetType() != cmTarget::SHARED_LIBRARY &&
target.GetType() != cmTarget::MODULE_LIBRARY &&
target.GetType() != cmTarget::EXECUTABLE)
{ {
return; return;
} }
VSDependSet& vsTargetDepend = this->VSTargetDepends[&target];
#if 0 if(target.GetType() != cmTarget::STATIC_LIBRARY)
// This feature makes a mess in SLN files for VS 7.1 and below. It
// creates an extra target for every target that is "linked" by a
// static library. Without this feature static libraries do not
// wait until their "link" dependencies are built to build. This is
// not a problem 99.9% of the time, and projects that do have the
// problem can enable this work-around by using add_dependencies.
// Static libraries cannot depend directly on the targets to which
// they link because VS will copy those targets into the library
// (for VS < 8). To work around the problem we copy the
// dependencies to be utility dependencies so that the work-around
// below is used.
if(target.GetType() == cmTarget::STATIC_LIBRARY)
{ {
cmTarget::LinkLibraryVectorType const& libs = target.GetLinkLibraries(); cmTarget::LinkLibraryVectorType const& libs = target.GetLinkLibraries();
for(cmTarget::LinkLibraryVectorType::const_iterator i = libs.begin(); for(cmTarget::LinkLibraryVectorType::const_iterator j = libs.begin();
i != libs.end(); ++i) j != libs.end(); ++j)
{ {
if(cmTarget* depTarget = this->FindTarget(0, i->first.c_str(), false)) if(j->first != target.GetName() &&
this->FindTarget(0, j->first.c_str()))
{ {
target.AddUtility(depTarget->GetName()); vsTargetDepend.insert(j->first);
} }
} }
} }
#endif std::set<cmStdString> const& utils = target.GetUtilities();
for(std::set<cmStdString>::const_iterator i = utils.begin();
// Look at each utility dependency. i != utils.end(); ++i)
for(std::set<cmStdString>::const_iterator ui =
target.GetUtilities().begin();
ui != target.GetUtilities().end(); ++ui)
{ {
if(cmTarget* depTarget = this->FindTarget(0, ui->c_str())) if(*i != target.GetName())
{ {
if(depTarget->GetType() == cmTarget::STATIC_LIBRARY || std::string name = this->GetUtilityForTarget(target, i->c_str());
depTarget->GetType() == cmTarget::SHARED_LIBRARY || vsTargetDepend.insert(name);
depTarget->GetType() == cmTarget::MODULE_LIBRARY)
{
// This utility dependency will cause an attempt to link. If
// the depender does not already link the dependee we need an
// intermediate target.
if(!this->CheckTargetLinks(target, ui->c_str()))
{
this->CreateUtilityDependTarget(*depTarget);
}
}
}
}
}
//----------------------------------------------------------------------------
void
cmGlobalVisualStudioGenerator::CreateUtilityDependTarget(cmTarget& target)
{
// This target is a library on which a utility dependency exists.
// We need to create an intermediate custom target to hook up the
// dependency without causing a link.
const char* altName = target.GetProperty("ALTERNATIVE_DEPENDENCY_NAME");
if(!altName)
{
// Create the intermediate utility target.
std::string altNameStr = target.GetName();
altNameStr += "_UTILITY";
const std::vector<std::string> no_depends;
cmCustomCommandLines no_commands;
const char* no_working_dir = 0;
const char* no_comment = 0;
target.GetMakefile()->AddUtilityCommand(altNameStr.c_str(), true,
no_working_dir, no_depends,
no_commands, false, no_comment);
target.SetProperty("ALTERNATIVE_DEPENDENCY_NAME", altNameStr.c_str());
// Most targets have a GUID created in ConfigureFinalPass. Since
// that has already been called, create one for this target now.
this->CreateGUID(altNameStr.c_str());
// The intermediate target should depend on the original target.
if(cmTarget* alt = this->FindTarget(0, altNameStr.c_str()))
{
alt->AddUtility(target.GetName());
} }
} }
} }
@ -375,10 +317,28 @@ bool cmGlobalVisualStudioGenerator::CheckTargetLinks(cmTarget& target,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const char* std::string cmGlobalVisualStudioGenerator::GetUtilityDepend(cmTarget* target)
{
UtilityDependsMap::iterator i = this->UtilityDepends.find(target);
if(i == this->UtilityDepends.end())
{
std::string name = this->WriteUtilityDepend(target);
UtilityDependsMap::value_type entry(target, name);
i = this->UtilityDepends.insert(entry).first;
}
return i->second;
}
//----------------------------------------------------------------------------
std::string
cmGlobalVisualStudioGenerator::GetUtilityForTarget(cmTarget& target, cmGlobalVisualStudioGenerator::GetUtilityForTarget(cmTarget& target,
const char* name) const char* name)
{ {
if(!this->VSLinksDependencies())
{
return name;
}
// Possibly depend on an intermediate utility target to avoid // Possibly depend on an intermediate utility target to avoid
// linking. // linking.
if(target.GetType() == cmTarget::STATIC_LIBRARY || if(target.GetType() == cmTarget::STATIC_LIBRARY ||
@ -386,19 +346,19 @@ cmGlobalVisualStudioGenerator::GetUtilityForTarget(cmTarget& target,
target.GetType() == cmTarget::MODULE_LIBRARY || target.GetType() == cmTarget::MODULE_LIBRARY ||
target.GetType() == cmTarget::EXECUTABLE) target.GetType() == cmTarget::EXECUTABLE)
{ {
// The depender is a target that links. Lookup the dependee to // The depender is a target that links.
// see if it provides an alternative dependency name.
if(cmTarget* depTarget = this->FindTarget(0, name)) if(cmTarget* depTarget = this->FindTarget(0, name))
{ {
// Check for an alternative name created by FixUtilityDepends. if(depTarget->GetType() == cmTarget::STATIC_LIBRARY ||
if(const char* altName = depTarget->GetType() == cmTarget::SHARED_LIBRARY ||
depTarget->GetProperty("ALTERNATIVE_DEPENDENCY_NAME")) depTarget->GetType() == cmTarget::MODULE_LIBRARY)
{ {
// The alternative name is needed only if the depender does // This utility dependency will cause an attempt to link. If
// not really link to the dependee. // the depender does not already link the dependee we need an
// intermediate target.
if(!this->CheckTargetLinks(target, name)) if(!this->CheckTargetLinks(target, name))
{ {
return altName; return this->GetUtilityDepend(depTarget);
} }
} }
} }
@ -408,30 +368,6 @@ cmGlobalVisualStudioGenerator::GetUtilityForTarget(cmTarget& target,
return name; return name;
} }
//----------------------------------------------------------------------------
void cmGlobalVisualStudioGenerator::GetTargetSets(
TargetDependSet& projectTargets, TargetDependSet& originalTargets,
cmLocalGenerator* root, GeneratorVector const& generators
)
{
this->cmGlobalGenerator::GetTargetSets(projectTargets, originalTargets,
root, generators);
// Add alternative dependency targets created by FixUtilityDepends.
for(TargetDependSet::iterator ti = projectTargets.begin();
ti != projectTargets.end(); ++ti)
{
cmTarget* tgt = *ti;
if(const char* altName = tgt->GetProperty("ALTERNATIVE_DEPENDENCY_NAME"))
{
if(cmTarget* alt = tgt->GetMakefile()->FindTarget(altName))
{
projectTargets.insert(alt);
}
}
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
#include <windows.h> #include <windows.h>

View File

@ -61,7 +61,6 @@ public:
// return true if target is fortran only // return true if target is fortran only
bool TargetIsFortranOnly(cmTarget& t); bool TargetIsFortranOnly(cmTarget& t);
const char* GetUtilityForTarget(cmTarget& target, const char*);
/** Get the top-level registry key for this VS version. */ /** Get the top-level registry key for this VS version. */
std::string GetRegistryBase(); std::string GetRegistryBase();
@ -71,8 +70,6 @@ public:
virtual bool IsMultiConfig() { return true; } virtual bool IsMultiConfig() { return true; }
protected: protected:
void FixUtilityDepends();
// Does this VS version link targets to each other if there are // Does this VS version link targets to each other if there are
// dependencies in the SLN file? This was done for VS versions // dependencies in the SLN file? This was done for VS versions
// below 8. // below 8.
@ -90,14 +87,18 @@ protected:
OrderedTargetDependSet(cmGlobalGenerator::TargetDependSet const&); OrderedTargetDependSet(cmGlobalGenerator::TargetDependSet const&);
}; };
virtual void GetTargetSets(TargetDependSet& projectTargets, virtual bool ComputeTargetDepends();
TargetDependSet& originalTargets, class VSDependSet: public std::set<cmStdString> {};
cmLocalGenerator* root, GeneratorVector const&); class VSDependMap: public std::map<cmTarget*, VSDependSet> {};
VSDependMap VSTargetDepends;
void ComputeVSTargetDepends(cmTarget&);
bool CheckTargetLinks(cmTarget& target, const char* name); bool CheckTargetLinks(cmTarget& target, const char* name);
private: std::string GetUtilityForTarget(cmTarget& target, const char*);
void FixUtilityDependsForTarget(cmTarget& target); virtual std::string WriteUtilityDepend(cmTarget*) = 0;
void CreateUtilityDependTarget(cmTarget& target); std::string GetUtilityDepend(cmTarget* target);
typedef std::map<cmTarget*, cmStdString> UtilityDependsMap;
UtilityDependsMap UtilityDepends;
}; };
#endif #endif

View File

@ -722,28 +722,12 @@ void cmGlobalXCodeGenerator::SetCurrentLocalGenerator(cmLocalGenerator* gen)
// Select the current set of configuration types. // Select the current set of configuration types.
this->CurrentConfigurationTypes.clear(); this->CurrentConfigurationTypes.clear();
if(this->XcodeVersion > 20) this->CurrentMakefile->GetConfigurations(this->CurrentConfigurationTypes);
{
if(const char* types =
this->CurrentMakefile->GetDefinition("CMAKE_CONFIGURATION_TYPES"))
{
cmSystemTools::ExpandListArgument(types,
this->CurrentConfigurationTypes);
}
}
if(this->CurrentConfigurationTypes.empty()) if(this->CurrentConfigurationTypes.empty())
{
if(const char* buildType =
this->CurrentMakefile->GetDefinition("CMAKE_BUILD_TYPE"))
{
this->CurrentConfigurationTypes.push_back(buildType);
}
else
{ {
this->CurrentConfigurationTypes.push_back(""); this->CurrentConfigurationTypes.push_back("");
} }
} }
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
@ -2742,12 +2726,14 @@ void cmGlobalXCodeGenerator
buildSettings->AddAttribute("SDKROOT", buildSettings->AddAttribute("SDKROOT",
this->CreateString(sysroot)); this->CreateString(sysroot));
std::string archString; std::string archString;
const char* sep = "";
for( std::vector<std::string>::iterator i = for( std::vector<std::string>::iterator i =
this->Architectures.begin(); this->Architectures.begin();
i != this->Architectures.end(); ++i) i != this->Architectures.end(); ++i)
{ {
archString += sep;
archString += *i; archString += *i;
archString += " "; sep = " ";
} }
buildSettings->AddAttribute("ARCHS", buildSettings->AddAttribute("ARCHS",
this->CreateString(archString.c_str())); this->CreateString(archString.c_str()));

View File

@ -14,7 +14,27 @@
#include "cmStandardIncludes.h" #include "cmStandardIncludes.h"
/**
* Graph edge representation. Most use cases just need the
* destination vertex, so we support conversion to/from an int. We
* also store boolean to indicate whether an edge is "strong".
*/
class cmGraphEdge
{
public:
cmGraphEdge(): Dest(0), Strong(true) {}
cmGraphEdge(int n): Dest(n), Strong(true) {}
cmGraphEdge(int n, bool s): Dest(n), Strong(s) {}
cmGraphEdge(cmGraphEdge const& r): Dest(r.Dest), Strong(r.Strong) {}
operator int() const { return this->Dest; }
bool IsStrong() const { return this->Strong; }
private:
int Dest;
bool Strong;
};
struct cmGraphEdgeList: public std::vector<cmGraphEdge> {};
struct cmGraphNodeList: public std::vector<int> {}; struct cmGraphNodeList: public std::vector<int> {};
struct cmGraphAdjacencyList: public std::vector<cmGraphNodeList> {}; struct cmGraphAdjacencyList: public std::vector<cmGraphEdgeList> {};
#endif #endif

View File

@ -175,6 +175,7 @@ public:
"The EXPORT option associates the installed target files with an " "The EXPORT option associates the installed target files with an "
"export called <export-name>. " "export called <export-name>. "
"It must appear before any RUNTIME, LIBRARY, or ARCHIVE options. " "It must appear before any RUNTIME, LIBRARY, or ARCHIVE options. "
"To actually install the export file itself, call install(EXPORT). "
"See documentation of the install(EXPORT ...) signature below for " "See documentation of the install(EXPORT ...) signature below for "
"details." "details."
"\n" "\n"

View File

@ -60,6 +60,26 @@ void cmInstallGenerator
} }
os << indent; os << indent;
std::string dest = this->GetInstallDestination(); std::string dest = this->GetInstallDestination();
if (cmSystemTools::FileIsFullPath(dest.c_str()))
{
os << "list(APPEND CPACK_ABSOLUTE_DESTINATION_FILES\n";
os << indent << " \"";
for(std::vector<std::string>::const_iterator fi = files.begin();
fi != files.end(); ++fi)
{
if (fi!=files.begin()) os << ";";
os << dest << cmSystemTools::ConvertToOutputPath("/");
if (rename && *rename)
{
os << rename;
}
else
{
os << cmSystemTools::GetFilenameName(*fi);
}
}
os << "\")\n";
}
os << "FILE(INSTALL DESTINATION \"" << dest << "\" TYPE " << stype.c_str(); os << "FILE(INSTALL DESTINATION \"" << dest << "\" TYPE " << stype.c_str();
if(optional) if(optional)
{ {

View File

@ -278,16 +278,8 @@ void cmLocalGenerator::GenerateTestFiles()
// Compute the set of configurations. // Compute the set of configurations.
std::vector<std::string> configurationTypes; std::vector<std::string> configurationTypes;
if(const char* types = const char* config =
this->Makefile->GetDefinition("CMAKE_CONFIGURATION_TYPES")) this->Makefile->GetConfigurations(configurationTypes, false);
{
cmSystemTools::ExpandListArgument(types, configurationTypes);
}
const char* config = 0;
if(configurationTypes.empty())
{
config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
}
std::string file = this->Makefile->GetStartOutputDirectory(); std::string file = this->Makefile->GetStartOutputDirectory();
file += "/"; file += "/";
@ -383,16 +375,8 @@ void cmLocalGenerator::GenerateInstallRules()
// Compute the set of configurations. // Compute the set of configurations.
std::vector<std::string> configurationTypes; std::vector<std::string> configurationTypes;
if(const char* types = const char* config =
this->Makefile->GetDefinition("CMAKE_CONFIGURATION_TYPES")) this->Makefile->GetConfigurations(configurationTypes, false);
{
cmSystemTools::ExpandListArgument(types, configurationTypes);
}
const char* config = 0;
if(configurationTypes.empty())
{
config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
}
// Choose a default install configuration. // Choose a default install configuration.
const char* default_config = config; const char* default_config = config;
@ -546,19 +530,7 @@ void cmLocalGenerator::GenerateTargetManifest()
{ {
// Collect the set of configuration types. // Collect the set of configuration types.
std::vector<std::string> configNames; std::vector<std::string> configNames;
if(const char* configurationTypes = this->Makefile->GetConfigurations(configNames);
this->Makefile->GetDefinition("CMAKE_CONFIGURATION_TYPES"))
{
cmSystemTools::ExpandListArgument(configurationTypes, configNames);
}
else if(const char* buildType =
this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"))
{
if(*buildType)
{
configNames.push_back(buildType);
}
}
// Add our targets to the manifest for each configuration. // Add our targets to the manifest for each configuration.
cmTargets& targets = this->Makefile->GetTargets(); cmTargets& targets = this->Makefile->GetTargets();

View File

@ -1062,10 +1062,17 @@ cmLocalUnixMakefileGenerator3
} }
} }
} }
if (useCall && launcher.empty()) if (launcher.empty())
{
if (useCall)
{ {
cmd = "call " + cmd; cmd = "call " + cmd;
} }
else if (this->NMake && cmd[0]=='"')
{
cmd = "echo >nul && " + cmd;
}
}
commands1.push_back(cmd); commands1.push_back(cmd);
} }
} }

View File

@ -1187,7 +1187,8 @@ void cmLocalVisualStudio6Generator
extraLinkOptionsMinSizeRel += targetLinkFlags; extraLinkOptionsMinSizeRel += targetLinkFlags;
} }
if(const char* targetLinkFlags = target.GetProperty("LINK_FLAGS_RELWITHDEBINFO")) if(const char* targetLinkFlags =
target.GetProperty("LINK_FLAGS_RELWITHDEBINFO"))
{ {
extraLinkOptionsRelWithDebInfo += " "; extraLinkOptionsRelWithDebInfo += " ";
extraLinkOptionsRelWithDebInfo += targetLinkFlags; extraLinkOptionsRelWithDebInfo += targetLinkFlags;
@ -1304,7 +1305,8 @@ void cmLocalVisualStudio6Generator
optionsRelease); optionsRelease);
this->ComputeLinkOptions(target, "MinSizeRel", extraLinkOptionsMinSizeRel, this->ComputeLinkOptions(target, "MinSizeRel", extraLinkOptionsMinSizeRel,
optionsMinSizeRel); optionsMinSizeRel);
this->ComputeLinkOptions(target, "RelWithDebInfo", extraLinkOptionsRelWithDebInfo, this->ComputeLinkOptions(target, "RelWithDebInfo",
extraLinkOptionsRelWithDebInfo,
optionsRelWithDebInfo); optionsRelWithDebInfo);
} }

View File

@ -466,6 +466,8 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorLinkFlagTable[] =
{"GenerateManifest", "MANIFEST", "enable manifest generation", "TRUE", 0}, {"GenerateManifest", "MANIFEST", "enable manifest generation", "TRUE", 0},
{"LinkIncremental", "INCREMENTAL:NO", "link incremental", "1", 0}, {"LinkIncremental", "INCREMENTAL:NO", "link incremental", "1", 0},
{"LinkIncremental", "INCREMENTAL:YES", "link incremental", "2", 0}, {"LinkIncremental", "INCREMENTAL:YES", "link incremental", "2", 0},
{"EntryPointSymbol", "ENTRY:", "sets the starting address", "",
cmVS7FlagTable::UserValue},
{"IgnoreDefaultLibraryNames", "NODEFAULTLIB:", "default libs to ignore", "", {"IgnoreDefaultLibraryNames", "NODEFAULTLIB:", "default libs to ignore", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
{"IgnoreAllDefaultLibraries", "NODEFAULTLIB", "ignore all default libs", {"IgnoreAllDefaultLibraries", "NODEFAULTLIB", "ignore all default libs",
@ -480,6 +482,21 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorLinkFlagTable[] =
{"OptimizeReferences", "OPT:REF", "Eliminate unreferenced data", "2", 0}, {"OptimizeReferences", "OPT:REF", "Eliminate unreferenced data", "2", 0},
{"TargetMachine", "MACHINE:I386", "Machine x86", "1", 0}, {"TargetMachine", "MACHINE:I386", "Machine x86", "1", 0},
{"TargetMachine", "MACHINE:X86", "Machine x86", "1", 0}, {"TargetMachine", "MACHINE:X86", "Machine x86", "1", 0},
{"TargetMachine", "MACHINE:AM33", "Machine AM33", "2", 0},
{"TargetMachine", "MACHINE:ARM", "Machine ARM", "3", 0},
{"TargetMachine", "MACHINE:EBC", "Machine EBC", "4", 0},
{"TargetMachine", "MACHINE:IA64", "Machine IA64", "5", 0},
{"TargetMachine", "MACHINE:M32R", "Machine M32R", "6", 0},
{"TargetMachine", "MACHINE:MIPS", "Machine MIPS", "7", 0},
{"TargetMachine", "MACHINE:MIPS16", "Machine MIPS16", "8", 0},
{"TargetMachine", "MACHINE:MIPSFPU)", "Machine MIPSFPU", "9", 0},
{"TargetMachine", "MACHINE:MIPSFPU16", "Machine MIPSFPU16", "10", 0},
{"TargetMachine", "MACHINE:MIPSR41XX", "Machine MIPSR41XX", "11", 0},
{"TargetMachine", "MACHINE:SH3", "Machine SH3", "12", 0},
{"TargetMachine", "MACHINE:SH3DSP", "Machine SH3DSP", "13", 0},
{"TargetMachine", "MACHINE:SH4", "Machine SH4", "14", 0},
{"TargetMachine", "MACHINE:SH5", "Machine SH5", "15", 0},
{"TargetMachine", "MACHINE:THUMB", "Machine THUMB", "16", 0},
{"TargetMachine", "MACHINE:X64", "Machine x64", "17", 0}, {"TargetMachine", "MACHINE:X64", "Machine x64", "17", 0},
{"ModuleDefinitionFile", "DEF:", "add an export def file", "", {"ModuleDefinitionFile", "DEF:", "add an export def file", "",
cmVS7FlagTable::UserValue}, cmVS7FlagTable::UserValue},

View File

@ -1461,16 +1461,7 @@ void cmMakefile::InitializeFromParent()
this->SetProperty("COMPILE_DEFINITIONS", this->SetProperty("COMPILE_DEFINITIONS",
parent->GetProperty("COMPILE_DEFINITIONS")); parent->GetProperty("COMPILE_DEFINITIONS"));
std::vector<std::string> configs; std::vector<std::string> configs;
if(const char* configTypes = this->GetConfigurations(configs);
this->GetDefinition("CMAKE_CONFIGURATION_TYPES"))
{
cmSystemTools::ExpandListArgument(configTypes, configs);
}
else if(const char* buildType =
this->GetDefinition("CMAKE_BUILD_TYPE"))
{
configs.push_back(buildType);
}
for(std::vector<std::string>::const_iterator ci = configs.begin(); for(std::vector<std::string>::const_iterator ci = configs.begin();
ci != configs.end(); ++ci) ci != configs.end(); ++ci)
{ {
@ -2491,6 +2482,31 @@ void cmMakefile::AddDefaultDefinitions()
cmake::GetCMakeFilesDirectory()); cmake::GetCMakeFilesDirectory());
} }
//----------------------------------------------------------------------------
const char*
cmMakefile::GetConfigurations(std::vector<std::string>& configs,
bool single) const
{
if(this->LocalGenerator->GetGlobalGenerator()->IsMultiConfig())
{
if(const char* configTypes =
this->GetDefinition("CMAKE_CONFIGURATION_TYPES"))
{
cmSystemTools::ExpandListArgument(configTypes, configs);
}
return 0;
}
else
{
const char* buildType = this->GetDefinition("CMAKE_BUILD_TYPE");
if(single && buildType && *buildType)
{
configs.push_back(buildType);
}
return buildType;
}
}
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
/** /**
* Find a source group whose regular expression matches the filename * Find a source group whose regular expression matches the filename

View File

@ -318,6 +318,10 @@ public:
return this->ProjectName.c_str(); return this->ProjectName.c_str();
} }
/** Get the configurations to be generated. */
const char* GetConfigurations(std::vector<std::string>& configs,
bool single = true) const;
/** /**
* Set the name of the library. * Set the name of the library.
*/ */

View File

@ -345,6 +345,13 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
vars.CMTarget = this->Target; vars.CMTarget = this->Target;
vars.Language = linkLanguage; vars.Language = linkLanguage;
vars.Objects = buildObjs.c_str(); vars.Objects = buildObjs.c_str();
std::string objdir = cmake::GetCMakeFilesDirectoryPostSlash();
objdir += this->Target->GetName();
objdir += ".dir";
objdir = this->Convert(objdir.c_str(),
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::SHELL);
vars.ObjectDir = objdir.c_str();
vars.Target = targetOutPathReal.c_str(); vars.Target = targetOutPathReal.c_str();
vars.TargetPDB = targetOutPathPDB.c_str(); vars.TargetPDB = targetOutPathPDB.c_str();

View File

@ -59,7 +59,10 @@ public:
" option(<option_variable> \"help string describing option\"\n" " option(<option_variable> \"help string describing option\"\n"
" [initial value])\n" " [initial value])\n"
"Provide an option for the user to select as ON or OFF. If no " "Provide an option for the user to select as ON or OFF. If no "
"initial value is provided, OFF is used."; "initial value is provided, OFF is used.\n"
"If you have options that depend on the values of other "
"options, see the module help for CMakeDependentOption."
;
} }
/** /**

View File

@ -426,7 +426,7 @@ cmPolicies::cmPolicies()
this->DefinePolicy( this->DefinePolicy(
CMP0015, "CMP0015", CMP0015, "CMP0015",
"link_directories() treats paths relative to the source dir.", "link_directories() treats paths relative to the source dir.",
"In CMake 2.6.4 and lower the link_directories() command passed relative " "In CMake 2.8.0 and lower the link_directories() command passed relative "
"paths unchanged to the linker. " "paths unchanged to the linker. "
"In CMake 2.8.1 and above the link_directories() command prefers to " "In CMake 2.8.1 and above the link_directories() command prefers to "
"interpret relative paths with respect to CMAKE_CURRENT_SOURCE_DIR, " "interpret relative paths with respect to CMAKE_CURRENT_SOURCE_DIR, "
@ -437,6 +437,15 @@ cmPolicies::cmPolicies()
"absolute paths by appending the relative path to " "absolute paths by appending the relative path to "
"CMAKE_CURRENT_SOURCE_DIR.", "CMAKE_CURRENT_SOURCE_DIR.",
2,8,1,0, cmPolicies::WARN); 2,8,1,0, cmPolicies::WARN);
this->DefinePolicy(
CMP0016, "CMP0016",
"target_link_libraries() reports error if only argument is not a target.",
"In CMake 2.8.2 and lower the target_link_libraries() command silently "
"ignored if it was called with only one argument, and this argument "
"wasn't a valid target. "
"In CMake 2.8.3 and above it reports an error in this case.",
2,8,3,0, cmPolicies::WARN);
} }
cmPolicies::~cmPolicies() cmPolicies::~cmPolicies()

View File

@ -51,6 +51,7 @@ public:
CMP0013, // Duplicate binary directories not allowed CMP0013, // Duplicate binary directories not allowed
CMP0014, // Input directories must have CMakeLists.txt CMP0014, // Input directories must have CMakeLists.txt
CMP0015, // link_directories() treats paths relative to source dir CMP0015, // link_directories() treats paths relative to source dir
CMP0016, // target_link_libraries() fails if only argument is not a target
// Always the last entry. Useful mostly to avoid adding a comma // Always the last entry. Useful mostly to avoid adding a comma
// the last policy when adding a new one. // the last policy when adding a new one.

View File

@ -101,11 +101,11 @@ cmSourceFileLocation const& cmSourceFile::GetLocation() const
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string const& cmSourceFile::GetFullPath() std::string const& cmSourceFile::GetFullPath(std::string* error)
{ {
if(this->FullPath.empty()) if(this->FullPath.empty())
{ {
if(this->FindFullPath()) if(this->FindFullPath(error))
{ {
this->CheckExtension(); this->CheckExtension();
} }
@ -120,7 +120,7 @@ std::string const& cmSourceFile::GetFullPath() const
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmSourceFile::FindFullPath() bool cmSourceFile::FindFullPath(std::string* error)
{ {
// If thie method has already failed once do not try again. // If thie method has already failed once do not try again.
if(this->FindFullPathFailed) if(this->FindFullPathFailed)
@ -199,7 +199,14 @@ bool cmSourceFile::FindFullPath()
{ {
e << " ." << *ext; e << " ." << *ext;
} }
if(error)
{
*error = e.str();
}
else
{
this->Location.GetMakefile()->IssueMessage(cmake::FATAL_ERROR, e.str()); this->Location.GetMakefile()->IssueMessage(cmake::FATAL_ERROR, e.str());
}
this->FindFullPathFailed = true; this->FindFullPathFailed = true;
return false; return false;
} }

View File

@ -60,7 +60,7 @@ public:
* horrible interface, but is necessary for backwards * horrible interface, but is necessary for backwards
* compatibility). * compatibility).
*/ */
std::string const& GetFullPath(); std::string const& GetFullPath(std::string* error = 0);
std::string const& GetFullPath() const; std::string const& GetFullPath() const;
/** /**
@ -108,7 +108,7 @@ private:
std::string FullPath; std::string FullPath;
bool FindFullPathFailed; bool FindFullPathFailed;
bool FindFullPath(); bool FindFullPath(std::string* error);
bool TryFullPath(const char* tryPath, const char* ext); bool TryFullPath(const char* tryPath, const char* ext);
void CheckExtension(); void CheckExtension();
void CheckLanguage(std::string const& ext); void CheckLanguage(std::string const& ext);

View File

@ -283,6 +283,21 @@ void cmSystemTools::ReportLastSystemError(const char* msg)
cmSystemTools::Error(m.c_str()); cmSystemTools::Error(m.c_str());
} }
bool cmSystemTools::IsInternallyOn(const char* val)
{
if (!val)
{
return false;
}
std::basic_string<char> v = val;
for(std::basic_string<char>::iterator c = v.begin();
c != v.end(); c++)
{
*c = static_cast<char>(toupper(*c));
}
return (v == "I_ON" || v == "i_on");
}
bool cmSystemTools::IsOn(const char* val) bool cmSystemTools::IsOn(const char* val)
{ {
@ -1161,7 +1176,8 @@ bool cmSystemTools::ComputeFileMD5(const char* source, char* md5out)
// Should be efficient enough on most system: // Should be efficient enough on most system:
const int bufferSize = 4096; const int bufferSize = 4096;
char buffer[bufferSize]; char buffer[bufferSize];
unsigned char const* buffer_uc = reinterpret_cast<unsigned char const*>(buffer); unsigned char const* buffer_uc =
reinterpret_cast<unsigned char const*>(buffer);
// This copy loop is very sensitive on certain platforms with // This copy loop is very sensitive on certain platforms with
// slightly broken stream libraries (like HPUX). Normally, it is // slightly broken stream libraries (like HPUX). Normally, it is
// incorrect to not check the error condition on the fin.read() // incorrect to not check the error condition on the fin.read()
@ -1916,12 +1932,20 @@ bool extract_tar(const char* outFileName, bool verbose,
} }
if(extract) if(extract)
{ {
r = archive_write_disk_set_options(ext, ARCHIVE_EXTRACT_TIME);
if (r != ARCHIVE_OK)
{
cmSystemTools::Error(
"Problem with archive_write_disk_set_options(): ",
archive_error_string(ext));
}
r = archive_write_header(ext, entry); r = archive_write_header(ext, entry);
if (r != ARCHIVE_OK) if (r != ARCHIVE_OK)
{ {
cmSystemTools::Error("Problem with archive_write_header(): ", cmSystemTools::Error("Problem with archive_write_header(): ",
archive_error_string(a)); archive_error_string(ext));
cmSystemTools::Error("Curren file:", cmSystemTools::Error("Current file:",
archive_entry_pathname(entry)); archive_entry_pathname(entry));
} }
else else

Some files were not shown because too many files have changed in this diff Show More