Merge branch 'ImprovedDotSupport2' into dev/strict-mode

Conflicts:
	Source/cmake.cxx
This commit is contained in:
Brad King 2010-12-17 10:32:01 -05:00
commit ad25a968b9
40 changed files with 1210 additions and 649 deletions

View File

@ -180,15 +180,33 @@ MACRO(CMAKE_SETUP_TESTING)
ENDMACRO(CMAKE_SETUP_TESTING) ENDMACRO(CMAKE_SETUP_TESTING)
# Provide a way for Visual Studio Express users to turn OFF the new FOLDER
# organization feature. Default to ON for non-Express users. Express users must
# explicitly turn off this option to build CMake in the Express IDE...
#
OPTION(CMAKE_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON)
MARK_AS_ADVANCED(CMAKE_USE_FOLDERS)
#-----------------------------------------------------------------------
# a macro that only sets the FOLDER target property if it's
# "appropriate"
#-----------------------------------------------------------------------
MACRO(CMAKE_SET_TARGET_FOLDER tgt folder) MACRO(CMAKE_SET_TARGET_FOLDER tgt folder)
# Really, I just want this to be an "if(TARGET ${tgt})" ... IF(CMAKE_USE_FOLDERS)
# but I'm not sure that our min req'd., CMake 2.4.5 can handle SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
# that... so I'm just activating this for now, with a version
# compare, and only for MSVC builds. # Really, I just want this to be an "if(TARGET ${tgt})" ...
IF(MSVC) # but I'm not sure that our min req'd., CMake 2.4.5 can handle
IF(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.8) # that... so I'm just activating this for now, with a version
SET_PROPERTY(TARGET "${tgt}" PROPERTY FOLDER "${folder}") # 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() ENDIF()
ELSE()
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS OFF)
ENDIF() ENDIF()
ENDMACRO(CMAKE_SET_TARGET_FOLDER) ENDMACRO(CMAKE_SET_TARGET_FOLDER)

View File

@ -26,6 +26,8 @@ ELSE(UNIX)
SET(CMAKE_C_OUTPUT_EXTENSION .obj) SET(CMAKE_C_OUTPUT_EXTENSION .obj)
ENDIF(UNIX) ENDIF(UNIX)
SET(_INCLUDED_FILE 0)
# Load compiler-specific information. # Load compiler-specific information.
IF(CMAKE_C_COMPILER_ID) IF(CMAKE_C_COMPILER_ID)
INCLUDE(Compiler/${CMAKE_C_COMPILER_ID}-C OPTIONAL) INCLUDE(Compiler/${CMAKE_C_COMPILER_ID}-C OPTIONAL)

View File

@ -26,6 +26,8 @@ ELSE(UNIX)
SET(CMAKE_CXX_OUTPUT_EXTENSION .obj) SET(CMAKE_CXX_OUTPUT_EXTENSION .obj)
ENDIF(UNIX) ENDIF(UNIX)
SET(_INCLUDED_FILE 0)
# Load compiler-specific information. # Load compiler-specific information.
IF(CMAKE_CXX_COMPILER_ID) IF(CMAKE_CXX_COMPILER_ID)
INCLUDE(Compiler/${CMAKE_CXX_COMPILER_ID}-CXX OPTIONAL) INCLUDE(Compiler/${CMAKE_CXX_COMPILER_ID}-CXX OPTIONAL)

View File

@ -23,8 +23,8 @@
# =========================== # ===========================
#============================================================================= #=============================================================================
# Copyright 2009 Kitware, Inc. # Copyright 2009-2010 Kitware, Inc.
# Copyright 2009 Philip Lowman <philip@yhbt.com> # Copyright 2009-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.
@ -47,6 +47,8 @@ function(_DetermineVSServicePackFromCompiler _OUT_VAR _cl_version)
set(_version "vc90") set(_version "vc90")
elseif(${_cl_version} VERSION_EQUAL "15.00.30729.01") elseif(${_cl_version} VERSION_EQUAL "15.00.30729.01")
set(_version "vc90sp1") set(_version "vc90sp1")
elseif(${_cl_version} VERSION_EQUAL "16.00.30319.01")
set(_version "vc100")
else() else()
set(_version "") set(_version "")
endif() endif()

View File

@ -16,6 +16,8 @@
# It also loads the available platform file for the system-compiler # It also loads the available platform file for the system-compiler
# if it exists. # if it exists.
SET(_INCLUDED_FILE 0)
# Load compiler-specific information. # Load compiler-specific information.
IF(CMAKE_Fortran_COMPILER_ID) IF(CMAKE_Fortran_COMPILER_ID)
INCLUDE(Compiler/${CMAKE_Fortran_COMPILER_ID}-Fortran OPTIONAL) INCLUDE(Compiler/${CMAKE_Fortran_COMPILER_ID}-Fortran OPTIONAL)

View File

@ -62,7 +62,43 @@
# Default : - # Default : -
# May be set when invoking cpack in order to trace debug informations # May be set when invoking cpack in order to trace debug informations
# during CPackDeb run. # during CPackDeb run.
# CPACK_DEBIAN_PACKAGE_PREDEPENDS
# Mandatory : NO
# Default : -
# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
# This field is like Depends, except that it also forces dpkg to complete installation of
# the packages named before even starting the installation of the package which declares
# the pre-dependency.
# CPACK_DEBIAN_PACKAGE_ENHANCES
# Mandatory : NO
# Default : -
# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
# This field is similar to Suggests but works in the opposite direction.
# It is used to declare that a package can enhance the functionality of another package.
# CPACK_DEBIAN_PACKAGE_BREAKS
# Mandatory : NO
# Default : -
# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
# When one binary package declares that it breaks another, dpkg will refuse to allow the
# package which declares Breaks be installed unless the broken package is deconfigured first,
# and it will refuse to allow the broken package to be reconfigured.
# CPACK_DEBIAN_PACKAGE_CONFLICTS
# Mandatory : NO
# Default : -
# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
# When one binary package declares a conflict with another using a Conflicts field,
# dpkg will refuse to allow them to be installed on the system at the same time.
# CPACK_DEBIAN_PACKAGE_PROVIDES
# Mandatory : NO
# Default : -
# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
# A virtual package is one which appears in the Provides control field of another package.
# CPACK_DEBIAN_PACKAGE_REPLACES
# Mandatory : NO
# Default : -
# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
# Packages can declare in their control file that they should overwrite
# files in certain other packages, or completely replace other packages.
#============================================================================= #=============================================================================
# Copyright 2007-2009 Kitware, Inc. # Copyright 2007-2009 Kitware, Inc.

View File

@ -548,16 +548,16 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
# We do only save CPack installed tree in _prepr # We do only save CPack installed tree in _prepr
# and then restore it in build. # and then restore it in build.
%prep %prep
mv $RPM_BUILD_ROOT \@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot mv $RPM_BUILD_ROOT \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\"
#p build #p build
%install %install
if [ -e $RPM_BUILD_ROOT ]; if [ -e $RPM_BUILD_ROOT ];
then then
mv \@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot/* $RPM_BUILD_ROOT mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot/*\" $RPM_BUILD_ROOT
else else
mv \@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot $RPM_BUILD_ROOT mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT
fi fi
%clean %clean

View File

@ -597,8 +597,7 @@ function(_ep_get_build_command name step cmd_var)
# CMake project. Select build command based on generator. # CMake project. Select build command based on generator.
get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR) get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR)
if("${CMAKE_GENERATOR}" MATCHES "Make" AND if("${CMAKE_GENERATOR}" MATCHES "Make" AND
("${cmake_generator}" STREQUAL "${CMAKE_GENERATOR}" OR ("${cmake_generator}" MATCHES "Make" OR NOT cmake_generator))
NOT cmake_generator))
# The project uses the same Makefile generator. Use recursive make. # The project uses the same Makefile generator. Use recursive make.
set(cmd "$(MAKE)") set(cmd "$(MAKE)")
if(step STREQUAL "INSTALL") if(step STREQUAL "INSTALL")
@ -985,8 +984,15 @@ function(_ep_add_download_command name)
get_filename_component(src_name "${source_dir}" NAME) get_filename_component(src_name "${source_dir}" NAME)
get_filename_component(work_dir "${source_dir}" PATH) get_filename_component(work_dir "${source_dir}" PATH)
set(comment "Performing download step (SVN checkout) for '${name}'") set(comment "Performing download step (SVN checkout) for '${name}'")
set(svn_user_pw_args "")
if(svn_username)
set(svn_user_pw_args ${svn_user_pw_args} "--username=${svn_username}")
endif()
if(svn_password)
set(svn_user_pw_args ${svn_user_pw_args} "--password=${svn_password}")
endif()
set(cmd ${Subversion_SVN_EXECUTABLE} co ${svn_repository} ${svn_revision} set(cmd ${Subversion_SVN_EXECUTABLE} co ${svn_repository} ${svn_revision}
--username=${svn_username} --password=${svn_password} ${src_name}) ${svn_user_pw_args} ${src_name})
list(APPEND depends ${stamp_dir}/${name}-svninfo.txt) list(APPEND depends ${stamp_dir}/${name}-svninfo.txt)
elseif(git_repository) elseif(git_repository)
find_package(Git) find_package(Git)
@ -1125,8 +1131,15 @@ function(_ep_add_update_command name)
get_property(svn_revision TARGET ${name} PROPERTY _EP_SVN_REVISION) get_property(svn_revision TARGET ${name} PROPERTY _EP_SVN_REVISION)
get_property(svn_username TARGET ${name} PROPERTY _EP_SVN_USERNAME) get_property(svn_username TARGET ${name} PROPERTY _EP_SVN_USERNAME)
get_property(svn_password TARGET ${name} PROPERTY _EP_SVN_PASSWORD) get_property(svn_password TARGET ${name} PROPERTY _EP_SVN_PASSWORD)
set(svn_user_pw_args "")
if(svn_username)
set(svn_user_pw_args ${svn_user_pw_args} "--username=${svn_username}")
endif()
if(svn_password)
set(svn_user_pw_args ${svn_user_pw_args} "--password=${svn_password}")
endif()
set(cmd ${Subversion_SVN_EXECUTABLE} up ${svn_revision} set(cmd ${Subversion_SVN_EXECUTABLE} up ${svn_revision}
--username=${svn_username} --password=${svn_password}) ${svn_user_pw_args})
set(always 1) set(always 1)
elseif(git_repository) elseif(git_repository)
if(NOT GIT_EXECUTABLE) if(NOT GIT_EXECUTABLE)

View File

@ -20,7 +20,6 @@
# 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_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)
@ -94,7 +93,10 @@
# #
# Boost_USE_STATIC_RUNTIME If enabled, searches for boost libraries # Boost_USE_STATIC_RUNTIME If enabled, searches for boost libraries
# linked against a static C++ standard library # linked against a static C++ standard library
# ('s' ABI tag). Defaults to OFF. # ('s' ABI tag). This option should be set to
# ON or OFF because the default behavior
# if not specified is platform dependent
# for backwards compatibility.
# [Since CMake 2.8.3] # [Since CMake 2.8.3]
# #
# Boost_USE_DEBUG_PYTHON If enabled, searches for boost libraries # Boost_USE_DEBUG_PYTHON If enabled, searches for boost libraries
@ -114,14 +116,6 @@
# Defaults to OFF. # Defaults to OFF.
# [Since CMake 2.8.3] # [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
@ -372,9 +366,6 @@ 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
@ -868,11 +859,11 @@ ELSE (_boost_IN_CACHE)
# 1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found) # 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) # 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. # We maintain this behavior since changing it could break people's builds.
# To disable the ambiguous behavior, the user can # To disable the ambiguous behavior, the user need only
# set Boost_COMPAT_STATIC_RUNTIME to FALSE # set Boost_USE_STATIC_RUNTIME either ON or OFF.
set(_boost_STATIC_RUNTIME_WORKAROUND false) set(_boost_STATIC_RUNTIME_WORKAROUND false)
if(Boost_COMPAT_STATIC_RUNTIME AND WIN32 AND Boost_USE_STATIC_LIBS) if(WIN32 AND Boost_USE_STATIC_LIBS)
if(NOT Boost_USE_STATIC_RUNTIME) if(NOT DEFINED Boost_USE_STATIC_RUNTIME)
set(_boost_STATIC_RUNTIME_WORKAROUND true) set(_boost_STATIC_RUNTIME_WORKAROUND true)
endif() endif()
endif() endif()

View File

@ -612,8 +612,10 @@ else()
endif() endif()
######################## ########################
# Look for the SDK stuff # Look for the SDK stuff. As of CUDA 3.0 NVSDKCUDA_ROOT has been replaced with
# NVSDKCOMPUTE_ROOT with the old CUDA C contents moved into the C subdirectory
find_path(CUDA_SDK_ROOT_DIR common/inc/cutil.h find_path(CUDA_SDK_ROOT_DIR common/inc/cutil.h
"$ENV{NVSDKCOMPUTE_ROOT}/C"
"$ENV{NVSDKCUDA_ROOT}" "$ENV{NVSDKCUDA_ROOT}"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Installed Products\\NVIDIA SDK 10\\Compute;InstallDir]" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Installed Products\\NVIDIA SDK 10\\Compute;InstallDir]"
"/Developer/GPU\ Computing/C" "/Developer/GPU\ Computing/C"
@ -941,8 +943,8 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
# we convert the strings to lists (like we want). # we convert the strings to lists (like we want).
if(CUDA_PROPAGATE_HOST_FLAGS) if(CUDA_PROPAGATE_HOST_FLAGS)
# nvcc chokes on -g3, so replace it with -g # nvcc chokes on -g3 in versions previous to 3.0, so replace it with -g
if(CMAKE_COMPILER_IS_GNUCC) if(CMAKE_COMPILER_IS_GNUCC AND CUDA_VERSION VERSION_LESS "3.0")
string(REPLACE "-g3" "-g" _cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}") string(REPLACE "-g3" "-g" _cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}")
else() else()
set(_cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}") set(_cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}")

View File

@ -293,7 +293,7 @@ else()
# If the HDF5 include directory was found, open H5pubconf.h to determine if # If the HDF5 include directory was found, open H5pubconf.h to determine if
# HDF5 was compiled with parallel IO support # HDF5 was compiled with parallel IO support
set( HDF5_IS_PARALLEL FALSE ) set( HDF5_IS_PARALLEL FALSE )
foreach( _dir HDF5_INCLUDE_DIRS ) foreach( _dir IN LISTS HDF5_INCLUDE_DIRS )
if( EXISTS "${_dir}/H5pubconf.h" ) if( EXISTS "${_dir}/H5pubconf.h" )
file( STRINGS "${_dir}/H5pubconf.h" file( STRINGS "${_dir}/H5pubconf.h"
HDF5_HAVE_PARALLEL_DEFINE HDF5_HAVE_PARALLEL_DEFINE

View File

@ -81,6 +81,7 @@ set(_MPI_PACKAGE_DIR
lib/openmpi lib/openmpi
"MPICH/SDK" "MPICH/SDK"
"Microsoft Compute Cluster Pack" "Microsoft Compute Cluster Pack"
"Microsoft HPC Pack 2008 R2"
) )
set(_MPI_PREFIX_PATH) set(_MPI_PREFIX_PATH)
@ -306,7 +307,7 @@ else (MPI_COMPILE_CMDLINE)
# No MPI compiler to interogate so attempt to find everything with find functions. # No MPI compiler to interogate so attempt to find everything with find functions.
find_path(MPI_INCLUDE_PATH mpi.h find_path(MPI_INCLUDE_PATH mpi.h
HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH} HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
PATH_SUFFIXES include PATH_SUFFIXES include Inc
) )
# Decide between 32-bit and 64-bit libraries for Microsoft's MPI # Decide between 32-bit and 64-bit libraries for Microsoft's MPI

View File

@ -27,7 +27,7 @@ INCLUDE(CMakeFindFrameworks)
# Search for the python framework on Apple. # Search for the python framework on Apple.
CMAKE_FIND_FRAMEWORKS(Python) CMAKE_FIND_FRAMEWORKS(Python)
FOREACH(_CURRENT_VERSION 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5) FOREACH(_CURRENT_VERSION 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5)
STRING(REPLACE "." "" _CURRENT_VERSION_NO_DOTS ${_CURRENT_VERSION}) STRING(REPLACE "." "" _CURRENT_VERSION_NO_DOTS ${_CURRENT_VERSION})
IF(WIN32) IF(WIN32)
FIND_LIBRARY(PYTHON_DEBUG_LIBRARY FIND_LIBRARY(PYTHON_DEBUG_LIBRARY

View File

@ -242,6 +242,7 @@
# QT_LIBRARY_DIR Path to "lib" of Qt4 # QT_LIBRARY_DIR Path to "lib" of Qt4
# QT_PLUGINS_DIR Path to "plugins" for Qt4 # QT_PLUGINS_DIR Path to "plugins" for Qt4
# QT_TRANSLATIONS_DIR Path to "translations" of Qt4 # QT_TRANSLATIONS_DIR Path to "translations" of Qt4
# QT_IMPORTS_DIR Path to "imports" of Qt4
# QT_DOC_DIR Path to "doc" of Qt4 # QT_DOC_DIR Path to "doc" of Qt4
# QT_MKSPECS_DIR Path to "mkspecs" of Qt4 # QT_MKSPECS_DIR Path to "mkspecs" of Qt4
# #
@ -445,6 +446,14 @@ MACRO (_QT4_ADJUST_LIB_VARS _camelCaseBasename)
MARK_AS_ADVANCED(QT_${basename}_LIBRARY QT_${basename}_LIBRARY_RELEASE QT_${basename}_LIBRARY_DEBUG QT_${basename}_INCLUDE_DIR) MARK_AS_ADVANCED(QT_${basename}_LIBRARY QT_${basename}_LIBRARY_RELEASE QT_${basename}_LIBRARY_DEBUG QT_${basename}_INCLUDE_DIR)
ENDMACRO (_QT4_ADJUST_LIB_VARS) ENDMACRO (_QT4_ADJUST_LIB_VARS)
function(_QT4_QUERY_QMAKE VAR RESULT)
exec_program(${QT_QMAKE_EXECUTABLE} ARGS "-query ${VAR}" RETURN_VALUE return_code OUTPUT_VARIABLE output )
if(NOT return_code)
file(TO_CMAKE_PATH "${output}" output)
set(${RESULT} ${output} PARENT_SCOPE)
endif(NOT return_code)
endfunction(_QT4_QUERY_QMAKE)
SET(QT4_INSTALLED_VERSION_TOO_OLD FALSE) SET(QT4_INSTALLED_VERSION_TOO_OLD FALSE)
@ -470,7 +479,7 @@ IF (QT_QMAKE_EXECUTABLE)
SET(QT4_QMAKE_FOUND FALSE) SET(QT4_QMAKE_FOUND FALSE)
EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION) _qt4_query_qmake(QT_VERSION QTVERSION)
# check for qt3 qmake and then try and find qmake4 or qmake-qt4 in the path # check for qt3 qmake and then try and find qmake4 or qmake-qt4 in the path
IF("${QTVERSION}" MATCHES "Unknown") IF("${QTVERSION}" MATCHES "Unknown")
@ -482,8 +491,7 @@ IF (QT_QMAKE_EXECUTABLE)
DOC "The qmake executable for the Qt installation to use" DOC "The qmake executable for the Qt installation to use"
) )
IF(QT_QMAKE_EXECUTABLE) IF(QT_QMAKE_EXECUTABLE)
EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} _qt4_query_qmake(QT_VERSION QTVERSION)
ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION)
ENDIF(QT_QMAKE_EXECUTABLE) ENDIF(QT_QMAKE_EXECUTABLE)
ENDIF("${QTVERSION}" MATCHES "Unknown") ENDIF("${QTVERSION}" MATCHES "Unknown")
@ -559,9 +567,7 @@ IF (QT4_QMAKE_FOUND)
# ask qmake for the mkspecs directory # ask qmake for the mkspecs directory
# we do this first because QT_LIBINFIX might be set # we do this first because QT_LIBINFIX might be set
IF (NOT QT_MKSPECS_DIR OR QT_QMAKE_CHANGED) IF (NOT QT_MKSPECS_DIR OR QT_QMAKE_CHANGED)
EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} _qt4_query_qmake(QMAKE_MKSPECS qt_mkspecs_dirs)
ARGS "-query QMAKE_MKSPECS"
OUTPUT_VARIABLE qt_mkspecs_dirs )
# do not replace : on windows as it might be a drive letter # do not replace : on windows as it might be a drive letter
# and windows should already use ; as a separator # and windows should already use ; as a separator
IF(NOT WIN32) IF(NOT WIN32)
@ -592,11 +598,7 @@ IF (QT4_QMAKE_FOUND)
# ask qmake for the library dir as a hint, then search for QtCore library and use that as a reference for finding the # ask qmake for the library dir as a hint, then search for QtCore library and use that as a reference for finding the
# others and for setting QT_LIBRARY_DIR # others and for setting QT_LIBRARY_DIR
IF (NOT QT_QTCORE_LIBRARY OR QT_QMAKE_CHANGED) IF (NOT QT_QTCORE_LIBRARY OR QT_QMAKE_CHANGED)
EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} _qt4_query_qmake(QT_INSTALL_LIBS QT_LIBRARY_DIR_TMP)
ARGS "-query QT_INSTALL_LIBS"
OUTPUT_VARIABLE QT_LIBRARY_DIR_TMP )
# make sure we have / and not \ as qmake gives on windows
FILE(TO_CMAKE_PATH "${QT_LIBRARY_DIR_TMP}" QT_LIBRARY_DIR_TMP)
SET(QT_QTCORE_LIBRARY_RELEASE NOTFOUND) SET(QT_QTCORE_LIBRARY_RELEASE NOTFOUND)
SET(QT_QTCORE_LIBRARY_DEBUG NOTFOUND) SET(QT_QTCORE_LIBRARY_DEBUG NOTFOUND)
FIND_LIBRARY(QT_QTCORE_LIBRARY_RELEASE FIND_LIBRARY(QT_QTCORE_LIBRARY_RELEASE
@ -649,21 +651,13 @@ IF (QT4_QMAKE_FOUND)
# ask qmake for the binary dir # ask qmake for the binary dir
IF (NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED) IF (NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED)
EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} _qt4_query_qmake(QT_INSTALL_BINS qt_bins)
ARGS "-query QT_INSTALL_BINS" SET(QT_BINARY_DIR ${qt_bins} CACHE INTERNAL "" FORCE)
OUTPUT_VARIABLE qt_bins )
# make sure we have / and not \ as qmake gives on windows
FILE(TO_CMAKE_PATH "${qt_bins}" qt_bins)
SET(QT_BINARY_DIR ${qt_bins} CACHE INTERNAL "" FORCE)
ENDIF (NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED) ENDIF (NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED)
# ask qmake for the include dir # ask qmake for the include dir
IF (QT_LIBRARY_DIR AND (NOT QT_QTCORE_INCLUDE_DIR OR NOT QT_HEADERS_DIR OR QT_QMAKE_CHANGED)) IF (QT_LIBRARY_DIR AND (NOT QT_QTCORE_INCLUDE_DIR OR NOT QT_HEADERS_DIR OR QT_QMAKE_CHANGED))
EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} _qt4_query_qmake(QT_INSTALL_HEADERS qt_headers)
ARGS "-query QT_INSTALL_HEADERS"
OUTPUT_VARIABLE qt_headers )
# make sure we have / and not \ as qmake gives on windows
FILE(TO_CMAKE_PATH "${qt_headers}" qt_headers)
SET(QT_QTCORE_INCLUDE_DIR NOTFOUND) SET(QT_QTCORE_INCLUDE_DIR NOTFOUND)
FIND_PATH(QT_QTCORE_INCLUDE_DIR QtCore FIND_PATH(QT_QTCORE_INCLUDE_DIR QtCore
HINTS ${qt_headers} HINTS ${qt_headers}
@ -703,22 +697,14 @@ IF (QT4_QMAKE_FOUND)
# ask qmake for the documentation directory # ask qmake for the documentation directory
IF (QT_LIBRARY_DIR AND NOT QT_DOC_DIR OR QT_QMAKE_CHANGED) IF (QT_LIBRARY_DIR AND NOT QT_DOC_DIR OR QT_QMAKE_CHANGED)
EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} _qt4_query_qmake(QT_INSTALL_DOCS qt_doc_dir)
ARGS "-query QT_INSTALL_DOCS"
OUTPUT_VARIABLE qt_doc_dir )
# make sure we have / and not \ as qmake gives on windows
FILE(TO_CMAKE_PATH "${qt_doc_dir}" qt_doc_dir)
SET(QT_DOC_DIR ${qt_doc_dir} CACHE PATH "The location of the Qt docs" FORCE) SET(QT_DOC_DIR ${qt_doc_dir} CACHE PATH "The location of the Qt docs" FORCE)
ENDIF (QT_LIBRARY_DIR AND NOT QT_DOC_DIR OR QT_QMAKE_CHANGED) ENDIF (QT_LIBRARY_DIR AND NOT QT_DOC_DIR OR QT_QMAKE_CHANGED)
# ask qmake for the plugins directory # ask qmake for the plugins directory
IF (QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR OR QT_QMAKE_CHANGED) IF (QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR OR QT_QMAKE_CHANGED)
EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} _qt4_query_qmake(QT_INSTALL_PLUGINS qt_plugins_dir)
ARGS "-query QT_INSTALL_PLUGINS"
OUTPUT_VARIABLE qt_plugins_dir )
# make sure we have / and not \ as qmake gives on windows
FILE(TO_CMAKE_PATH "${qt_plugins_dir}" qt_plugins_dir)
SET(QT_PLUGINS_DIR NOTFOUND) SET(QT_PLUGINS_DIR NOTFOUND)
foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH}) foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH})
set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/plugins") set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/plugins")
@ -730,14 +716,27 @@ IF (QT4_QMAKE_FOUND)
# ask qmake for the translations directory # ask qmake for the translations directory
IF (QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR OR QT_QMAKE_CHANGED) IF (QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR OR QT_QMAKE_CHANGED)
EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} _qt4_query_qmake(QT_INSTALL_TRANSLATIONS qt_translations_dir)
ARGS "-query QT_INSTALL_TRANSLATIONS"
OUTPUT_VARIABLE qt_translations_dir )
# make sure we have / and not \ as qmake gives on windows
FILE(TO_CMAKE_PATH "${qt_translations_dir}" qt_translations_dir)
SET(QT_TRANSLATIONS_DIR ${qt_translations_dir} CACHE PATH "The location of the Qt translations" FORCE) SET(QT_TRANSLATIONS_DIR ${qt_translations_dir} CACHE PATH "The location of the Qt translations" FORCE)
ENDIF (QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR OR QT_QMAKE_CHANGED) ENDIF (QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR OR QT_QMAKE_CHANGED)
# ask qmake for the imports directory
IF (QT_LIBRARY_DIR AND NOT QT_IMPORTS_DIR OR QT_QMAKE_CHANGED)
_qt4_query_qmake(QT_INSTALL_IMPORTS qt_imports_dir)
if(qt_imports_dir)
SET(QT_IMPORTS_DIR NOTFOUND)
foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH})
set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/imports")
endforeach(qt_cross_path)
FIND_PATH(QT_IMPORTS_DIR NAMES Qt
HINTS ${qt_cross_paths} ${qt_imports_dir}
DOC "The location of the Qt imports"
NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
mark_as_advanced(QT_IMPORTS_DIR)
endif(qt_imports_dir)
ENDIF (QT_LIBRARY_DIR AND NOT QT_IMPORTS_DIR OR QT_QMAKE_CHANGED)
# Make variables changeble to the advanced user # Make variables changeble to the advanced user
MARK_AS_ADVANCED( QT_LIBRARY_DIR QT_DOC_DIR QT_MKSPECS_DIR MARK_AS_ADVANCED( QT_LIBRARY_DIR QT_DOC_DIR QT_MKSPECS_DIR
QT_PLUGINS_DIR QT_TRANSLATIONS_DIR) QT_PLUGINS_DIR QT_TRANSLATIONS_DIR)

View File

@ -52,11 +52,18 @@ FIND_PROGRAM(Subversion_SVN_EXECUTABLE svn
MARK_AS_ADVANCED(Subversion_SVN_EXECUTABLE) MARK_AS_ADVANCED(Subversion_SVN_EXECUTABLE)
IF(Subversion_SVN_EXECUTABLE) IF(Subversion_SVN_EXECUTABLE)
# the subversion commands should be executed with the C locale, otherwise
# the message (which are parsed) may be translated, Alex
SET(_Subversion_SAVED_LC_ALL "$ENV{LC_ALL}")
SET(ENV{LC_ALL} C)
EXECUTE_PROCESS(COMMAND ${Subversion_SVN_EXECUTABLE} --version EXECUTE_PROCESS(COMMAND ${Subversion_SVN_EXECUTABLE} --version
OUTPUT_VARIABLE Subversion_VERSION_SVN OUTPUT_VARIABLE Subversion_VERSION_SVN
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
# restore the previous LC_ALL
SET(ENV{LC_ALL} ${_Subversion_SAVED_LC_ALL})
STRING(REGEX REPLACE "^(.*\n)?svn, version ([.0-9]+).*" STRING(REGEX REPLACE "^(.*\n)?svn, version ([.0-9]+).*"
"\\2" Subversion_VERSION_SVN "${Subversion_VERSION_SVN}") "\\2" Subversion_VERSION_SVN "${Subversion_VERSION_SVN}")

View File

@ -146,7 +146,7 @@ function(is_file_executable file result_var)
# If file name ends in .exe on Windows, *assume* executable: # If file name ends in .exe on Windows, *assume* executable:
# #
if(WIN32) if(WIN32 AND NOT UNIX)
if("${file_full_lower}" MATCHES "\\.exe$") if("${file_full_lower}" MATCHES "\\.exe$")
set(${result_var} 1 PARENT_SCOPE) set(${result_var} 1 PARENT_SCOPE)
return() return()
@ -156,7 +156,7 @@ function(is_file_executable file result_var)
# to determine ${result_var}. In 99%+? practical cases, the exe name # to determine ${result_var}. In 99%+? practical cases, the exe name
# match will be sufficient... # match will be sufficient...
# #
endif(WIN32) endif(WIN32 AND NOT UNIX)
# Use the information returned from the Unix shell command "file" to # Use the information returned from the Unix shell command "file" to
# determine if ${file_full} should be considered an executable file... # determine if ${file_full} should be considered an executable file...
@ -335,7 +335,7 @@ function(gp_resolve_item context item exepath dirs resolved_item_var)
# Using find_program on Windows will find dll files that are in the PATH. # Using find_program on Windows will find dll files that are in the PATH.
# (Converting simple file names into full path names if found.) # (Converting simple file names into full path names if found.)
# #
if(WIN32) if(WIN32 AND NOT UNIX)
if(NOT resolved) if(NOT resolved)
set(ri "ri-NOTFOUND") set(ri "ri-NOTFOUND")
find_program(ri "${item}" PATHS "${exepath};${dirs}" NO_DEFAULT_PATH) find_program(ri "${item}" PATHS "${exepath};${dirs}" NO_DEFAULT_PATH)
@ -347,7 +347,7 @@ function(gp_resolve_item context item exepath dirs resolved_item_var)
set(ri "ri-NOTFOUND") set(ri "ri-NOTFOUND")
endif(ri) endif(ri)
endif(NOT resolved) endif(NOT resolved)
endif(WIN32) endif(WIN32 AND NOT UNIX)
# Provide a hook so that projects can override item resolution # Provide a hook so that projects can override item resolution
# by whatever logic they choose: # by whatever logic they choose:
@ -413,7 +413,7 @@ function(gp_resolved_file_type original_file file exepath dirs type_var)
string(TOLOWER "${resolved_file}" lower) string(TOLOWER "${resolved_file}" lower)
if(UNIX) if(UNIX)
if(resolved_file MATCHES "^(/lib/|/lib32/|/lib64/|/usr/lib/|/usr/lib32/|/usr/lib64/|/usr/X11R6/)") if(resolved_file MATCHES "^(/lib/|/lib32/|/lib64/|/usr/lib/|/usr/lib32/|/usr/lib64/|/usr/X11R6/|/usr/bin/)")
set(is_system 1) set(is_system 1)
endif() endif()
endif() endif()
@ -434,7 +434,27 @@ function(gp_resolved_file_type original_file file exepath dirs type_var)
if(lower MATCHES "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)") if(lower MATCHES "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)")
set(is_system 1) set(is_system 1)
endif() endif()
endif()
if(UNIX)
# if cygwin, we can get the properly formed windows paths from cygpath
find_program(CYGPATH_EXECUTABLE cygpath)
if(CYGPATH_EXECUTABLE)
execute_process(COMMAND ${CYGPATH_EXECUTABLE} -W
OUTPUT_VARIABLE env_windir
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${CYGPATH_EXECUTABLE} -S
OUTPUT_VARIABLE env_sysdir
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(TOLOWER "${env_windir}" windir)
string(TOLOWER "${env_sysdir}" sysroot)
if(lower MATCHES "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)")
set(is_system 1)
endif()
endif(CYGPATH_EXECUTABLE)
endif(UNIX)
endif(WIN32)
if(NOT is_system) if(NOT is_system)
get_filename_component(original_path "${original_lower}" PATH) get_filename_component(original_path "${original_lower}" PATH)
@ -519,9 +539,9 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
if(APPLE) if(APPLE)
set(gp_tool "otool") set(gp_tool "otool")
endif(APPLE) endif(APPLE)
if(WIN32) if(WIN32 AND NOT UNIX) # This is how to check for cygwin, har!
set(gp_tool "dumpbin") set(gp_tool "dumpbin")
endif(WIN32) endif(WIN32 AND NOT UNIX)
endif("${gp_tool}" STREQUAL "") endif("${gp_tool}" STREQUAL "")
set(gp_tool_known 0) set(gp_tool_known 0)
@ -587,11 +607,22 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
# #
get_filename_component(gp_cmd_dir "${gp_cmd}" PATH) get_filename_component(gp_cmd_dir "${gp_cmd}" PATH)
get_filename_component(gp_cmd_dlls_dir "${gp_cmd_dir}/../../Common7/IDE" ABSOLUTE) get_filename_component(gp_cmd_dlls_dir "${gp_cmd_dir}/../../Common7/IDE" ABSOLUTE)
# Use cmake paths as a user may have a PATH element ending with a backslash.
# This will escape the list delimiter and create havoc!
if(EXISTS "${gp_cmd_dlls_dir}") if(EXISTS "${gp_cmd_dlls_dir}")
# only add to the path if it is not already in the path # only add to the path if it is not already in the path
if(NOT "$ENV{PATH}" MATCHES "${gp_cmd_dlls_dir}") set(gp_found_cmd_dlls_dir 0)
file(TO_CMAKE_PATH "$ENV{PATH}" env_path)
foreach(gp_env_path_element ${env_path})
if("${gp_env_path_element}" STREQUAL "${gp_cmd_dlls_dir}")
set(gp_found_cmd_dlls_dir 1)
endif()
endforeach(gp_env_path_element)
if(NOT gp_found_cmd_dlls_dir)
file(TO_NATIVE_PATH "${gp_cmd_dlls_dir}" gp_cmd_dlls_dir)
set(ENV{PATH} "$ENV{PATH};${gp_cmd_dlls_dir}") set(ENV{PATH} "$ENV{PATH};${gp_cmd_dlls_dir}")
endif(NOT "$ENV{PATH}" MATCHES "${gp_cmd_dlls_dir}") endif()
endif(EXISTS "${gp_cmd_dlls_dir}") endif(EXISTS "${gp_cmd_dlls_dir}")
endif("${gp_tool}" STREQUAL "dumpbin") endif("${gp_tool}" STREQUAL "dumpbin")
# #

View File

@ -183,6 +183,8 @@ SET(SRCS
cmGlobalUnixMakefileGenerator3.cxx cmGlobalUnixMakefileGenerator3.cxx
cmGlobalUnixMakefileGenerator3.h cmGlobalUnixMakefileGenerator3.h
cmGraphAdjacencyList.h cmGraphAdjacencyList.h
cmGraphVizWriter.cxx
cmGraphVizWriter.h
cmInstallGenerator.h cmInstallGenerator.h
cmInstallGenerator.cxx cmInstallGenerator.cxx
cmInstallExportGenerator.cxx cmInstallExportGenerator.cxx
@ -332,7 +334,7 @@ ENDIF (WIN32)
# create a library used by the command line and the GUI # create a library used by the command line and the GUI
ADD_LIBRARY(CMakeLib ${SRCS}) ADD_LIBRARY(CMakeLib ${SRCS})
TARGET_LINK_LIBRARIES(CMakeLib cmsys TARGET_LINK_LIBRARIES(CMakeLib cmsys
${CMAKE_EXPAT_LIBRARIES} ${CMAKE_ZLIB_LIBRARIES} ${CMAKE_EXPAT_LIBRARIES} ${CMAKE_ZLIB_LIBRARIES}
${CMAKE_TAR_LIBRARIES} ${CMAKE_COMPRESS_LIBRARIES} ${CMAKE_TAR_LIBRARIES} ${CMAKE_COMPRESS_LIBRARIES}
${CMAKE_CURL_LIBRARIES} ) ${CMAKE_CURL_LIBRARIES} )
@ -432,7 +434,7 @@ IF(CYGWIN)
CPack/cmCPackCygwinSourceGenerator.cxx CPack/cmCPackCygwinSourceGenerator.cxx
) )
ENDIF(CYGWIN) ENDIF(CYGWIN)
IF(UNIX) IF(UNIX)
SET(CPACK_SRCS ${CPACK_SRCS} SET(CPACK_SRCS ${CPACK_SRCS}
CPack/cmCPackDebGenerator.cxx CPack/cmCPackDebGenerator.cxx

View File

@ -94,6 +94,18 @@ int cmCPackDebGenerator::PackageFiles()
this->GetOption("CPACK_DEBIAN_PACKAGE_SUGGESTS"); this->GetOption("CPACK_DEBIAN_PACKAGE_SUGGESTS");
const char* debian_pkg_url = const char* debian_pkg_url =
this->GetOption("CPACK_DEBIAN_PACKAGE_HOMEPAGE"); this->GetOption("CPACK_DEBIAN_PACKAGE_HOMEPAGE");
const char* debian_pkg_predep =
this->GetOption("CPACK_DEBIAN_PACKAGE_PREDEPENDS");
const char* debian_pkg_enhances =
this->GetOption("CPACK_DEBIAN_PACKAGE_ENHANCES");
const char* debian_pkg_breaks =
this->GetOption("CPACK_DEBIAN_PACKAGE_BREAKS");
const char* debian_pkg_conflicts =
this->GetOption("CPACK_DEBIAN_PACKAGE_CONFLICTS");
const char* debian_pkg_provides =
this->GetOption("CPACK_DEBIAN_PACKAGE_PROVIDES");
const char* debian_pkg_replaces =
this->GetOption("CPACK_DEBIAN_PACKAGE_REPLACES");
{ // the scope is needed for cmGeneratedFileStream { // the scope is needed for cmGeneratedFileStream
cmGeneratedFileStream out(ctlfilename.c_str()); cmGeneratedFileStream out(ctlfilename.c_str());
@ -102,22 +114,46 @@ int cmCPackDebGenerator::PackageFiles()
out << "Section: " << debian_pkg_section << "\n"; out << "Section: " << debian_pkg_section << "\n";
out << "Priority: " << debian_pkg_priority << "\n"; out << "Priority: " << debian_pkg_priority << "\n";
out << "Architecture: " << debian_pkg_arch << "\n"; out << "Architecture: " << debian_pkg_arch << "\n";
if(debian_pkg_dep) if(debian_pkg_dep && *debian_pkg_dep)
{ {
out << "Depends: " << debian_pkg_dep << "\n"; out << "Depends: " << debian_pkg_dep << "\n";
} }
if(debian_pkg_rec) if(debian_pkg_rec && *debian_pkg_rec)
{ {
out << "Recommends: " << debian_pkg_rec << "\n"; out << "Recommends: " << debian_pkg_rec << "\n";
} }
if(debian_pkg_sug) if(debian_pkg_sug && *debian_pkg_sug)
{ {
out << "Suggests: " << debian_pkg_sug << "\n"; out << "Suggests: " << debian_pkg_sug << "\n";
} }
if(debian_pkg_url) if(debian_pkg_url && *debian_pkg_url)
{ {
out << "Homepage: " << debian_pkg_url << "\n"; out << "Homepage: " << debian_pkg_url << "\n";
} }
if (debian_pkg_predep && *debian_pkg_predep)
{
out << "Pre-Depends: " << debian_pkg_predep << "\n";
}
if (debian_pkg_enhances && *debian_pkg_enhances)
{
out << "Enhances: " << debian_pkg_enhances << "\n";
}
if (debian_pkg_breaks && *debian_pkg_breaks)
{
out << "Breaks: " << debian_pkg_breaks << "\n";
}
if (debian_pkg_conflicts && *debian_pkg_conflicts)
{
out << "Conflicts: " << debian_pkg_conflicts << "\n";
}
if (debian_pkg_provides && *debian_pkg_provides)
{
out << "Provides: " << debian_pkg_provides << "\n";
}
if (debian_pkg_replaces && *debian_pkg_replaces)
{
out << "Replaces: " << debian_pkg_replaces << "\n";
}
unsigned long totalSize = 0; unsigned long totalSize = 0;
{ {
std::string dirName = this->GetOption("CPACK_TEMPORARY_DIRECTORY"); std::string dirName = this->GetOption("CPACK_TEMPORARY_DIRECTORY");

View File

@ -264,7 +264,17 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
{ {
*this->TestHandler->LogFile << "Test time = " << buf << std::endl; *this->TestHandler->LogFile << "Test time = " << buf << std::endl;
} }
// Set the working directory to the tests directory
std::string oldpath = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::ChangeDirectory(this->TestProperties->Directory.c_str());
this->DartProcessing(); this->DartProcessing();
// restore working directory
cmSystemTools::ChangeDirectory(oldpath.c_str());
// if this is doing MemCheck then all the output needs to be put into // if this is doing MemCheck then all the output needs to be put into
// Output since that is what is parsed by cmCTestMemCheckHandler // Output since that is what is parsed by cmCTestMemCheckHandler
if(!this->TestHandler->MemCheck && started) if(!this->TestHandler->MemCheck && started)

View File

@ -289,14 +289,10 @@ void cmExtraCodeBlocksGenerator
std::string fileName = *(splitted.end()-1); std::string fileName = *(splitted.end()-1);
splitted.erase(splitted.end() - 1, splitted.end()); splitted.erase(splitted.end() - 1, splitted.end());
// We don't want paths with ".." in them
// reasons are that we don't want files outside the project
// TODO: the path should be normalized first though
// We don't want paths with CMakeFiles in them // We don't want paths with CMakeFiles in them
// or do we? // or do we?
// In speedcrunch those where purely internal // In speedcrunch those where purely internal
if (splitted.size() >= 1 if (splitted.size() >= 1
&& relative.find("..") == std::string::npos
&& relative.find("CMakeFiles") == std::string::npos) && relative.find("CMakeFiles") == std::string::npos)
{ {
tree.InsertPath(splitted, 1, fileName); tree.InsertPath(splitted, 1, fileName);

View File

@ -1873,9 +1873,10 @@ bool cmGlobalGenerator::UseFolderProperty()
return cmSystemTools::IsOn(prop); return cmSystemTools::IsOn(prop);
} }
// By default, this feature is ON: // By default, this feature is OFF, since it is not supported in the
// Visual Studio Express editions:
// //
return true; return false;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -323,7 +323,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
if (cumulativePath.empty()) if (cumulativePath.empty())
{ {
cumulativePath = *iter; cumulativePath = "CMAKE_FOLDER_GUID_" + *iter;
} }
else else
{ {
@ -431,14 +431,22 @@ void cmGlobalVisualStudio7Generator
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalVisualStudio7Generator::WriteFolders(std::ostream& fout) void cmGlobalVisualStudio7Generator::WriteFolders(std::ostream& fout)
{ {
const char *prefix = "CMAKE_FOLDER_GUID_";
const std::string::size_type skip_prefix = strlen(prefix);
std::string guidProjectTypeFolder = "2150E333-8FDC-42A3-9474-1A3956D46DE8"; std::string guidProjectTypeFolder = "2150E333-8FDC-42A3-9474-1A3956D46DE8";
for(std::map<std::string,std::set<std::string> >::iterator iter = for(std::map<std::string,std::set<std::string> >::iterator iter =
VisualStudioFolders.begin(); iter != VisualStudioFolders.end(); ++iter) VisualStudioFolders.begin(); iter != VisualStudioFolders.end(); ++iter)
{ {
std::string fullName = iter->first; std::string fullName = iter->first;
std::string guid = this->GetGUID(fullName.c_str()); std::string guid = this->GetGUID(fullName.c_str());
std::string nameOnly = cmSystemTools::GetFilenameName(fullName);
cmSystemTools::ReplaceString(fullName, "/", "\\"); cmSystemTools::ReplaceString(fullName, "/", "\\");
if (cmSystemTools::StringStartsWith(fullName.c_str(), prefix))
{
fullName = fullName.substr(skip_prefix);
}
std::string nameOnly = cmSystemTools::GetFilenameName(fullName);
fout << "Project(\"{" << fout << "Project(\"{" <<
guidProjectTypeFolder << "}\") = \"" << guidProjectTypeFolder << "}\") = \"" <<

View File

@ -69,14 +69,6 @@ public:
i.e. "Can I build Debug and Release in the same tree?" */ i.e. "Can I build Debug and Release in the same tree?" */
virtual bool IsMultiConfig() { return true; } virtual bool IsMultiConfig() { return true; }
protected:
// Does this VS version link targets to each other if there are
// dependencies in the SLN file? This was done for VS versions
// below 8.
virtual bool VSLinksDependencies() const { return true; }
virtual const char* GetIDEVersion() = 0;
struct TargetCompare struct TargetCompare
{ {
bool operator()(cmTarget const* l, cmTarget const* r) const; bool operator()(cmTarget const* l, cmTarget const* r) const;
@ -87,6 +79,14 @@ protected:
OrderedTargetDependSet(cmGlobalGenerator::TargetDependSet const&); OrderedTargetDependSet(cmGlobalGenerator::TargetDependSet const&);
}; };
protected:
// Does this VS version link targets to each other if there are
// dependencies in the SLN file? This was done for VS versions
// below 8.
virtual bool VSLinksDependencies() const { return true; }
virtual const char* GetIDEVersion() = 0;
virtual bool ComputeTargetDepends(); virtual bool ComputeTargetDepends();
class VSDependSet: public std::set<cmStdString> {}; class VSDependSet: public std::set<cmStdString> {};
class VSDependMap: public std::map<cmTarget*, VSDependSet> {}; class VSDependMap: public std::map<cmTarget*, VSDependSet> {};

File diff suppressed because it is too large Load Diff

435
Source/cmGraphVizWriter.cxx Normal file
View File

@ -0,0 +1,435 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#include "cmGraphVizWriter.h"
#include "cmMakefile.h"
#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
#include "cmGeneratedFileStream.h"
#include <memory>
static const char* getShapeForTarget(const cmTarget* target)
{
if (!target)
{
return "ellipse";
}
switch ( target->GetType() )
{
case cmTarget::EXECUTABLE:
return "house";
case cmTarget::STATIC_LIBRARY:
return "diamond";
case cmTarget::SHARED_LIBRARY:
return "polygon";
case cmTarget::MODULE_LIBRARY:
return "octagon";
default:
break;
}
return "box";
}
cmGraphVizWriter::cmGraphVizWriter(const std::vector<cmLocalGenerator*>&
localGenerators)
:GraphType("digraph")
,GraphName("GG")
,GraphHeader("node [\n fontsize = \"12\"\n];")
,GraphNodePrefix("node")
,GenerateForExecutables(true)
,GenerateForStaticLibs(true)
,GenerateForSharedLibs(true)
,GenerateForModuleLibs(true)
,LocalGenerators(localGenerators)
,HaveTargetsAndLibs(false)
{
}
void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
const char* fallbackSettingsFileName)
{
cmake cm;
cmGlobalGenerator ggi;
ggi.SetCMakeInstance(&cm);
std::auto_ptr<cmLocalGenerator> lg(ggi.CreateLocalGenerator());
cmMakefile *mf = lg->GetMakefile();
const char* inFileName = settingsFileName;
if ( !cmSystemTools::FileExists(inFileName) )
{
inFileName = fallbackSettingsFileName;
if ( !cmSystemTools::FileExists(inFileName) )
{
return;
}
}
if ( !mf->ReadListFile(0, inFileName) )
{
cmSystemTools::Error("Problem opening GraphViz options file: ",
inFileName);
return;
}
std::cout << "Reading GraphViz options file: " << inFileName << std::endl;
#define __set_if_set(var, cmakeDefinition) \
{ \
const char* value = mf->GetDefinition(cmakeDefinition); \
if ( value ) \
{ \
var = value; \
} \
}
__set_if_set(this->GraphType, "GRAPHVIZ_GRAPH_TYPE");
__set_if_set(this->GraphName, "GRAPHVIZ_GRAPH_NAME");
__set_if_set(this->GraphHeader, "GRAPHVIZ_GRAPH_HEADER");
__set_if_set(this->GraphNodePrefix, "GRAPHVIZ_NODE_PREFIX");
#define __set_bool_if_set(var, cmakeDefinition) \
{ \
const char* value = mf->GetDefinition(cmakeDefinition); \
if ( value ) \
{ \
var = mf->IsOn(cmakeDefinition); \
} \
}
__set_bool_if_set(this->GenerateForExecutables, "GRAPHVIZ_EXECUTABLES");
__set_bool_if_set(this->GenerateForStaticLibs, "GRAPHVIZ_STATIC_LIBS");
__set_bool_if_set(this->GenerateForSharedLibs, "GRAPHVIZ_SHARED_LIBS");
__set_bool_if_set(this->GenerateForModuleLibs , "GRAPHVIZ_MODULE_LIBS");
cmStdString tmpRegexString;
__set_if_set(tmpRegexString, "GRAPHVIZ_TARGET_IGNORE_REGEX");
if (tmpRegexString.size() > 0)
{
if (!this->TargetIgnoreRegex.compile(tmpRegexString.c_str()))
{
std::cerr << "Could not compile bad regex \"" << tmpRegexString << "\""
<< std::endl;
}
}
this->TargetsToIgnore.clear();
const char* ignoreTargets = mf->GetDefinition("GRAPHVIZ_IGNORE_TARGETS");
if ( ignoreTargets )
{
std::vector<std::string> ignoreTargetsVector;
cmSystemTools::ExpandListArgument(ignoreTargets,ignoreTargetsVector);
for(std::vector<std::string>::iterator itvIt = ignoreTargetsVector.begin();
itvIt != ignoreTargetsVector.end();
++ itvIt )
{
this->TargetsToIgnore.insert(itvIt->c_str());
}
}
}
void cmGraphVizWriter::WritePerTargetFiles(const char* fileName)
{
this->CollectTargetsAndLibs();
for(std::map<cmStdString, const cmTarget*>::const_iterator ptrIt =
this->TargetPtrs.begin();
ptrIt != this->TargetPtrs.end();
++ptrIt)
{
if (ptrIt->second == NULL)
{
continue;
}
if (this->GenerateForTargetType(ptrIt->second->GetType()) == false)
{
continue;
}
std::set<std::string> insertedConnections;
std::set<std::string> insertedNodes;
std::string currentFilename = fileName;
currentFilename += ".";
currentFilename += ptrIt->first;
cmGeneratedFileStream str(currentFilename.c_str());
if ( !str )
{
return;
}
std::cout << "Writing " << currentFilename << "..." << std::endl;
this->WriteHeader(str);
this->WriteConnections(ptrIt->first.c_str(),
insertedNodes, insertedConnections, str);
this->WriteFooter(str);
}
}
void cmGraphVizWriter::WriteGlobalFile(const char* fileName)
{
this->CollectTargetsAndLibs();
cmGeneratedFileStream str(fileName);
if ( !str )
{
return;
}
this->WriteHeader(str);
std::cout << "Writing " << fileName << "..." << std::endl;
std::set<std::string> insertedConnections;
std::set<std::string> insertedNodes;
for(std::map<cmStdString, const cmTarget*>::const_iterator ptrIt =
this->TargetPtrs.begin();
ptrIt != this->TargetPtrs.end();
++ptrIt)
{
if (ptrIt->second == NULL)
{
continue;
}
if (this->GenerateForTargetType(ptrIt->second->GetType()) == false)
{
continue;
}
this->WriteConnections(ptrIt->first.c_str(),
insertedNodes, insertedConnections, str);
}
this->WriteFooter(str);
}
void cmGraphVizWriter::WriteHeader(cmGeneratedFileStream& str) const
{
str << this->GraphType << " " << this->GraphName << " {" << std::endl;
str << this->GraphHeader << std::endl;
}
void cmGraphVizWriter::WriteFooter(cmGeneratedFileStream& str) const
{
str << "}" << std::endl;
}
void cmGraphVizWriter::WriteConnections(const char* targetName,
std::set<std::string>& insertedNodes,
std::set<std::string>& insertedConnections,
cmGeneratedFileStream& str) const
{
std::map<cmStdString, const cmTarget* >::const_iterator targetPtrIt =
this->TargetPtrs.find(targetName);
if (targetPtrIt == this->TargetPtrs.end()) // not found at all
{
return;
}
this->WriteNode(targetName, targetPtrIt->second, insertedNodes, str);
if (targetPtrIt->second == NULL) // it's an external library
{
return;
}
std::string myNodeName = this->TargetNamesNodes.find(targetName)->second;
const cmTarget::LinkLibraryVectorType* ll =
&(targetPtrIt->second->GetOriginalLinkLibraries());
for (cmTarget::LinkLibraryVectorType::const_iterator llit = ll->begin();
llit != ll->end();
++ llit )
{
const char* libName = llit->first.c_str();
std::map<cmStdString, cmStdString>::const_iterator libNameIt =
this->TargetNamesNodes.find(libName);
std::string connectionName = myNodeName;
connectionName += "-";
connectionName += libNameIt->second;
if (insertedConnections.find(connectionName) == insertedConnections.end())
{
insertedConnections.insert(connectionName);
this->WriteNode(libName, this->TargetPtrs.find(libName)->second,
insertedNodes, str);
str << " \"" << myNodeName.c_str() << "\" -> \""
<< libNameIt->second.c_str() << "\"";
str << " // " << targetName << " -> " << libName << std::endl;
this->WriteConnections(libName, insertedNodes, insertedConnections, str);
}
}
}
void cmGraphVizWriter::WriteNode(const char* targetName,
const cmTarget* target,
std::set<std::string>& insertedNodes,
cmGeneratedFileStream& str) const
{
if (insertedNodes.find(targetName) == insertedNodes.end())
{
insertedNodes.insert(targetName);
std::map<cmStdString, cmStdString>::const_iterator nameIt =
this->TargetNamesNodes.find(targetName);
str << " \"" << nameIt->second.c_str() << "\" [ label=\""
<< targetName << "\" shape=\"" << getShapeForTarget(target)
<< "\"];" << std::endl;
}
}
void cmGraphVizWriter::CollectTargetsAndLibs()
{
if (this->HaveTargetsAndLibs == false)
{
this->HaveTargetsAndLibs = true;
int cnt = this->CollectAllTargets();
this->CollectAllExternalLibs(cnt);
}
}
int cmGraphVizWriter::CollectAllTargets()
{
int cnt = 0;
// First pass get the list of all cmake targets
for (std::vector<cmLocalGenerator*>::const_iterator lit =
this->LocalGenerators.begin();
lit != this->LocalGenerators.end();
++ lit )
{
const cmTargets* targets = &((*lit)->GetMakefile()->GetTargets());
for ( cmTargets::const_iterator tit = targets->begin();
tit != targets->end();
++ tit )
{
const char* realTargetName = tit->first.c_str();
if(this->IgnoreThisTarget(realTargetName))
{
// Skip ignored targets
continue;
}
//std::cout << "Found target: " << tit->first.c_str() << std::endl;
cmOStringStream ostr;
ostr << this->GraphNodePrefix << cnt++;
this->TargetNamesNodes[realTargetName] = ostr.str();
this->TargetPtrs[realTargetName] = &tit->second;
}
}
return cnt;
}
int cmGraphVizWriter::CollectAllExternalLibs(int cnt)
{
// Ok, now find all the stuff we link to that is not in cmake
for (std::vector<cmLocalGenerator*>::const_iterator lit =
this->LocalGenerators.begin();
lit != this->LocalGenerators.end();
++ lit )
{
const cmTargets* targets = &((*lit)->GetMakefile()->GetTargets());
for ( cmTargets::const_iterator tit = targets->begin();
tit != targets->end();
++ tit )
{
const char* realTargetName = tit->first.c_str();
if (this->IgnoreThisTarget(realTargetName))
{
// Skip ignored targets
continue;
}
const cmTarget::LinkLibraryVectorType* ll =
&(tit->second.GetOriginalLinkLibraries());
for (cmTarget::LinkLibraryVectorType::const_iterator llit = ll->begin();
llit != ll->end();
++ llit )
{
const char* libName = llit->first.c_str();
if (this->IgnoreThisTarget(libName))
{
// Skip ignored targets
continue;
}
std::map<cmStdString, const cmTarget*>::const_iterator tarIt =
this->TargetPtrs.find(libName);
if ( tarIt == this->TargetPtrs.end() )
{
cmOStringStream ostr;
ostr << this->GraphNodePrefix << cnt++;
this->TargetNamesNodes[libName] = ostr.str();
this->TargetPtrs[libName] = NULL;
//str << " \"" << ostr.c_str() << "\" [ label=\"" << libName
//<< "\" shape=\"ellipse\"];" << std::endl;
}
}
}
}
return cnt;
}
bool cmGraphVizWriter::IgnoreThisTarget(const char* name)
{
if (this->TargetIgnoreRegex.is_valid())
{
if (this->TargetIgnoreRegex.find(name))
{
return true;
}
}
return (this->TargetsToIgnore.find(name) != this->TargetsToIgnore.end());
}
bool cmGraphVizWriter::GenerateForTargetType(cmTarget::TargetType targetType)
const
{
switch (targetType)
{
case cmTarget::EXECUTABLE:
return this->GenerateForExecutables;
case cmTarget::STATIC_LIBRARY:
return this->GenerateForStaticLibs;
case cmTarget::SHARED_LIBRARY:
return this->GenerateForSharedLibs;
case cmTarget::MODULE_LIBRARY:
return this->GenerateForModuleLibs;
default:
break;
}
return false;
}

84
Source/cmGraphVizWriter.h Normal file
View File

@ -0,0 +1,84 @@
#ifndef CMGRAPHVIZWRITER_H
#define CMGRAPHVIZWRITER_H
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#include "cmStandardIncludes.h"
#include "cmLocalGenerator.h"
#include "cmGeneratedFileStream.h"
#include "cmTarget.h"
#include <cmsys/RegularExpression.hxx>
/** This class implements writing files for graphviz (dot) for graphs
* representing the dependencies between the targets in the project. */
class cmGraphVizWriter
{
public:
cmGraphVizWriter(const std::vector<cmLocalGenerator*>& localGenerators);
void ReadSettings(const char* settingsFileName,
const char* fallbackSettingsFileName);
void WritePerTargetFiles(const char* fileName);
void WriteGlobalFile(const char* fileName);
protected:
void CollectTargetsAndLibs();
int CollectAllTargets();
int CollectAllExternalLibs(int cnt);
void WriteHeader(cmGeneratedFileStream& str) const;
void WriteConnections(const char* targetName,
std::set<std::string>& insertedNodes,
std::set<std::string>& insertedConnections,
cmGeneratedFileStream& str) const;
void WriteNode(const char* targetName, const cmTarget* target,
std::set<std::string>& insertedNodes,
cmGeneratedFileStream& str) const;
void WriteFooter(cmGeneratedFileStream& str) const;
bool IgnoreThisTarget(const char* name);
bool GenerateForTargetType(cmTarget::TargetType targetType) const;
cmStdString GraphType;
cmStdString GraphName;
cmStdString GraphHeader;
cmStdString GraphNodePrefix;
bool GenerateForExecutables;
bool GenerateForStaticLibs;
bool GenerateForSharedLibs;
bool GenerateForModuleLibs;
cmsys::RegularExpression TargetIgnoreRegex;
std::set<cmStdString> TargetsToIgnore;
const std::vector<cmLocalGenerator*>& LocalGenerators;
std::map<cmStdString, const cmTarget*> TargetPtrs;
// maps from the actual target names to node names in dot:
std::map<cmStdString, cmStdString> TargetNamesNodes;
bool HaveTargetsAndLibs;
};
#endif

View File

@ -928,6 +928,14 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
// Construct a rule file associated with the first output produced. // Construct a rule file associated with the first output produced.
std::string outName = outputs[0]; std::string outName = outputs[0];
outName += ".rule"; outName += ".rule";
const char* dir =
this->LocalGenerator->GetGlobalGenerator()->
GetCMakeCFGInitDirectory();
if(dir && dir[0] == '$')
{
cmSystemTools::ReplaceString(outName, dir,
cmake::GetCMakeFilesDirectory());
}
// Check if the rule file already exists. // Check if the rule file already exists.
file = this->GetSource(outName.c_str()); file = this->GetSource(outName.c_str());
if(file && file->GetCustomCommand() && !replace) if(file && file->GetCustomCommand() && !replace)

View File

@ -834,12 +834,16 @@ void cmTarget::DefineProperties(cmake *cm)
"executable with the TARGET_LINK_LIBRARIES command. " "executable with the TARGET_LINK_LIBRARIES command. "
"On all platforms a target-level dependency on the executable is " "On all platforms a target-level dependency on the executable is "
"created for targets that link to it. " "created for targets that link to it. "
"For non-DLL platforms the link rule is simply ignored since "
"the dynamic loader will automatically bind symbols when the "
"module is loaded. "
"For DLL platforms an import library will be created for the " "For DLL platforms an import library will be created for the "
"exported symbols and then used for linking. " "exported symbols and then used for linking. "
"All Windows-based systems including Cygwin are DLL platforms."); "All Windows-based systems including Cygwin are DLL platforms. "
"For non-DLL platforms that require all symbols to be resolved at "
"link time, such as Mac OS X, the module will \"link\" to the "
"executable using a flag like \"-bundle_loader\". "
"For other non-DLL platforms the link rule is simply ignored since "
"the dynamic loader will automatically bind symbols when the "
"module is loaded. "
);
cm->DefineProperty cm->DefineProperty
("Fortran_MODULE_DIRECTORY", cmProperty::TARGET, ("Fortran_MODULE_DIRECTORY", cmProperty::TARGET,

View File

@ -32,6 +32,30 @@ static std::string cmVS10EscapeXML(std::string arg)
return arg; return arg;
} }
static std::string cmVS10EscapeComment(std::string comment)
{
// MSBuild takes the CDATA of a <Message></Message> element and just
// does "echo $CDATA" with no escapes. We must encode the string.
// http://technet.microsoft.com/en-us/library/cc772462%28WS.10%29.aspx
std::string echoable;
for(std::string::iterator c = comment.begin(); c != comment.end(); ++c)
{
switch (*c)
{
case '\r': break;
case '\n': echoable += '\t'; break;
case '"': /* no break */
case '|': /* no break */
case '&': /* no break */
case '<': /* no break */
case '>': /* no break */
case '^': echoable += '^'; /* no break */
default: echoable += *c; break;
}
}
return echoable;
}
cmVisualStudio10TargetGenerator:: cmVisualStudio10TargetGenerator::
cmVisualStudio10TargetGenerator(cmTarget* target, cmVisualStudio10TargetGenerator(cmTarget* target,
cmGlobalVisualStudio10Generator* gg) cmGlobalVisualStudio10Generator* gg)
@ -125,7 +149,10 @@ void cmVisualStudio10TargetGenerator::Generate()
".vcxproj"); ".vcxproj");
if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY) if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY)
{ {
this->ComputeClOptions(); if(!this->ComputeClOptions())
{
return;
}
} }
cmMakefile* mf = this->Target->GetMakefile(); cmMakefile* mf = this->Target->GetMakefile();
std::string path = mf->GetStartOutputDirectory(); std::string path = mf->GetStartOutputDirectory();
@ -325,6 +352,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source,
} }
cmLocalVisualStudio7Generator* lg = this->LocalGenerator; cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
std::string comment = lg->ConstructComment(command); std::string comment = lg->ConstructComment(command);
comment = cmVS10EscapeComment(comment);
std::vector<std::string> *configs = std::vector<std::string> *configs =
static_cast<cmGlobalVisualStudio7Generator *> static_cast<cmGlobalVisualStudio7Generator *>
(this->GlobalGenerator)->GetConfigurations(); (this->GlobalGenerator)->GetConfigurations();
@ -347,7 +375,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source,
command.GetEscapeAllowMakeVars()) command.GetEscapeAllowMakeVars())
); );
this->WritePlatformConfigTag("Message",i->c_str(), 3); this->WritePlatformConfigTag("Message",i->c_str(), 3);
(*this->BuildFileStream ) << comment << "</Message>\n"; (*this->BuildFileStream ) << cmVS10EscapeXML(comment) << "</Message>\n";
this->WritePlatformConfigTag("Command", i->c_str(), 3); this->WritePlatformConfigTag("Command", i->c_str(), 3);
(*this->BuildFileStream ) << script << "</Command>\n"; (*this->BuildFileStream ) << script << "</Command>\n";
this->WritePlatformConfigTag("AdditionalInputs", i->c_str(), 3); this->WritePlatformConfigTag("AdditionalInputs", i->c_str(), 3);
@ -949,19 +977,23 @@ OutputLinkIncremental(std::string const& configName)
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmVisualStudio10TargetGenerator::ComputeClOptions() bool cmVisualStudio10TargetGenerator::ComputeClOptions()
{ {
std::vector<std::string> const* configs = std::vector<std::string> const* configs =
this->GlobalGenerator->GetConfigurations(); this->GlobalGenerator->GetConfigurations();
for(std::vector<std::string>::const_iterator i = configs->begin(); for(std::vector<std::string>::const_iterator i = configs->begin();
i != configs->end(); ++i) i != configs->end(); ++i)
{ {
this->ComputeClOptions(*i); if(!this->ComputeClOptions(*i))
{
return false;
}
} }
return true;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmVisualStudio10TargetGenerator::ComputeClOptions( bool cmVisualStudio10TargetGenerator::ComputeClOptions(
std::string const& configName) std::string const& configName)
{ {
// much of this was copied from here: // much of this was copied from here:
@ -984,7 +1016,7 @@ void cmVisualStudio10TargetGenerator::ComputeClOptions(
cmSystemTools::Error cmSystemTools::Error
("CMake can not determine linker language for target:", ("CMake can not determine linker language for target:",
this->Name.c_str()); this->Name.c_str());
return; return false;
} }
if(strcmp(linkLanguage, "C") == 0 || strcmp(linkLanguage, "CXX") == 0 if(strcmp(linkLanguage, "C") == 0 || strcmp(linkLanguage, "CXX") == 0
|| strcmp(linkLanguage, "Fortran") == 0) || strcmp(linkLanguage, "Fortran") == 0)
@ -1044,6 +1076,7 @@ void cmVisualStudio10TargetGenerator::ComputeClOptions(
} }
this->ClOptions[configName] = pOptions.release(); this->ClOptions[configName] = pOptions.release();
return true;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -1433,8 +1466,9 @@ void cmVisualStudio10TargetGenerator::WriteEvent(
command.GetEscapeAllowMakeVars()) command.GetEscapeAllowMakeVars())
); );
} }
comment = cmVS10EscapeComment(comment);
this->WriteString("<Message>",3); this->WriteString("<Message>",3);
(*this->BuildFileStream ) << comment << "</Message>\n"; (*this->BuildFileStream ) << cmVS10EscapeXML(comment) << "</Message>\n";
this->WriteString("<Command>", 3); this->WriteString("<Command>", 3);
(*this->BuildFileStream ) << script; (*this->BuildFileStream ) << script;
(*this->BuildFileStream ) << "</Command>" << "\n"; (*this->BuildFileStream ) << "</Command>" << "\n";
@ -1445,10 +1479,13 @@ void cmVisualStudio10TargetGenerator::WriteEvent(
void cmVisualStudio10TargetGenerator::WriteProjectReferences() void cmVisualStudio10TargetGenerator::WriteProjectReferences()
{ {
cmGlobalGenerator::TargetDependSet const& depends cmGlobalGenerator::TargetDependSet const& unordered
= this->GlobalGenerator->GetTargetDirectDepends(*this->Target); = this->GlobalGenerator->GetTargetDirectDepends(*this->Target);
typedef cmGlobalVisualStudioGenerator::OrderedTargetDependSet
OrderedTargetDependSet;
OrderedTargetDependSet depends(unordered);
this->WriteString("<ItemGroup>\n", 1); this->WriteString("<ItemGroup>\n", 1);
for( cmGlobalGenerator::TargetDependSet::const_iterator i = depends.begin(); for( OrderedTargetDependSet::const_iterator i = depends.begin();
i != depends.end(); ++i) i != depends.end(); ++i)
{ {
cmTarget* dt = *i; cmTarget* dt = *i;

View File

@ -50,8 +50,8 @@ private:
void WriteObjSources(); void WriteObjSources();
void WritePathAndIncrementalLinkOptions(); void WritePathAndIncrementalLinkOptions();
void WriteItemDefinitionGroups(); void WriteItemDefinitionGroups();
void ComputeClOptions(); bool ComputeClOptions();
void ComputeClOptions(std::string const& configName); bool ComputeClOptions(std::string const& configName);
void WriteClOptions(std::string const& config, void WriteClOptions(std::string const& config,
std::vector<std::string> const & includes); std::vector<std::string> const & includes);
void WriteRCOptions(std::string const& config, void WriteRCOptions(std::string const& config,

View File

@ -26,6 +26,7 @@
#include "cmDocumentationFormatterText.h" #include "cmDocumentationFormatterText.h"
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
# include "cmGraphVizWriter.h"
# include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback. # include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback.
# include "cmVariableWatch.h" # include "cmVariableWatch.h"
# include <cmsys/Terminal.h> # include <cmsys/Terminal.h>
@ -180,7 +181,7 @@ cmake::cmake()
this->ProgressCallback = 0; this->ProgressCallback = 0;
this->ProgressCallbackClientData = 0; this->ProgressCallbackClientData = 0;
this->ScriptMode = false; this->ScriptMode = false;
#ifdef CMAKE_BUILD_WITH_CMAKE #ifdef CMAKE_BUILD_WITH_CMAKE
this->VariableWatch = new cmVariableWatch; this->VariableWatch = new cmVariableWatch;
this->VariableWatch->AddWatch("CMAKE_WORDS_BIGENDIAN", this->VariableWatch->AddWatch("CMAKE_WORDS_BIGENDIAN",
@ -397,7 +398,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
this->DoSuppressDevWarnings = true; this->DoSuppressDevWarnings = true;
} }
else if(arg.find("-Wdev",0) == 0) else if(arg.find("-Wdev",0) == 0)
{ {
this->SuppressDevWarnings = false; this->SuppressDevWarnings = false;
this->DoSuppressDevWarnings = true; this->DoSuppressDevWarnings = true;
} }
@ -421,7 +422,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
cmsys::Glob::PatternToRegex(entryPattern.c_str(), true, true).c_str()); cmsys::Glob::PatternToRegex(entryPattern.c_str(), true, true).c_str());
//go through all cache entries and collect the vars which will be removed //go through all cache entries and collect the vars which will be removed
std::vector<std::string> entriesToDelete; std::vector<std::string> entriesToDelete;
cmCacheManager::CacheIterator it = cmCacheManager::CacheIterator it =
this->CacheManager->GetCacheIterator(); this->CacheManager->GetCacheIterator();
for ( it.Begin(); !it.IsAtEnd(); it.Next() ) for ( it.Begin(); !it.IsAtEnd(); it.Next() )
{ {
@ -437,8 +438,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
} }
// now remove them from the cache // now remove them from the cache
for(std::vector<std::string>::const_iterator currentEntry = for(std::vector<std::string>::const_iterator currentEntry =
entriesToDelete.begin(); entriesToDelete.begin();
currentEntry != entriesToDelete.end(); currentEntry != entriesToDelete.end();
++currentEntry) ++currentEntry)
{ {
@ -829,7 +830,7 @@ int cmake::AddCMakePaths()
cMakeSelf += "/cmake"; cMakeSelf += "/cmake";
std::cerr << cMakeSelf.c_str() << "\n"; std::cerr << cMakeSelf.c_str() << "\n";
} }
#endif #endif
if(!cmSystemTools::FileExists(cMakeSelf.c_str())) if(!cmSystemTools::FileExists(cMakeSelf.c_str()))
{ {
cmSystemTools::Error("CMake executable cannot be found at ", cmSystemTools::Error("CMake executable cannot be found at ",
@ -840,12 +841,12 @@ int cmake::AddCMakePaths()
this->CacheManager->AddCacheEntry this->CacheManager->AddCacheEntry
("CMAKE_COMMAND",cMakeSelf.c_str(), "Path to CMake executable.", ("CMAKE_COMMAND",cMakeSelf.c_str(), "Path to CMake executable.",
cmCacheManager::INTERNAL); cmCacheManager::INTERNAL);
// if the edit command is not yet in the cache, // if the edit command is not yet in the cache,
// or if CMakeEditCommand has been set on this object, // or if CMakeEditCommand has been set on this object,
// then set the CMAKE_EDIT_COMMAND in the cache // then set the CMAKE_EDIT_COMMAND in the cache
// This will mean that the last gui to edit the cache // This will mean that the last gui to edit the cache
// will be the one that make edit_cache uses. // will be the one that make edit_cache uses.
if(!this->GetCacheDefinition("CMAKE_EDIT_COMMAND") if(!this->GetCacheDefinition("CMAKE_EDIT_COMMAND")
|| !this->CMakeEditCommand.empty()) || !this->CMakeEditCommand.empty())
{ {
// Find and save the command to edit the cache // Find and save the command to edit the cache
@ -853,8 +854,8 @@ int cmake::AddCMakePaths()
if(!this->CMakeEditCommand.empty()) if(!this->CMakeEditCommand.empty())
{ {
editCacheCommand = cmSystemTools::GetFilenamePath(cMakeSelf) editCacheCommand = cmSystemTools::GetFilenamePath(cMakeSelf)
+ std::string("/") + std::string("/")
+ this->CMakeEditCommand + this->CMakeEditCommand
+ cmSystemTools::GetFilenameExtension(cMakeSelf); + cmSystemTools::GetFilenameExtension(cMakeSelf);
} }
if( !cmSystemTools::FileExists(editCacheCommand.c_str())) if( !cmSystemTools::FileExists(editCacheCommand.c_str()))
@ -974,7 +975,7 @@ void CMakeCommandUsage(const char* program)
errorStream errorStream
<< "cmake bootstrap\n"; << "cmake bootstrap\n";
#endif #endif
// If you add new commands, change here, // If you add new commands, change here,
// and in cmakemain.cxx in the options table // and in cmakemain.cxx in the options table
errorStream errorStream
<< "Usage: " << program << " -E [command] [arguments ...]\n" << "Usage: " << program << " -E [command] [arguments ...]\n"
@ -1129,7 +1130,7 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
return 0; return 0;
} }
#endif #endif
else if (args[1] == "make_directory" && args.size() == 3) else if (args[1] == "make_directory" && args.size() == 3)
{ {
if(!cmSystemTools::MakeDirectory(args[2].c_str())) if(!cmSystemTools::MakeDirectory(args[2].c_str()))
@ -1380,7 +1381,7 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
} }
return 0; return 0;
} }
// Command to create a symbolic link. Fails on platforms not // Command to create a symbolic link. Fails on platforms not
// supporting them. // supporting them.
else if (args[1] == "create_symlink" && args.size() == 4) else if (args[1] == "create_symlink" && args.size() == 4)
@ -1448,7 +1449,7 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
// Use the make system's VERBOSE environment variable to enable // Use the make system's VERBOSE environment variable to enable
// verbose output. This can be skipped by also setting CMAKE_NO_VERBOSE // verbose output. This can be skipped by also setting CMAKE_NO_VERBOSE
// (which is set by the Eclipse and KDevelop generators). // (which is set by the Eclipse and KDevelop generators).
bool verbose = ((cmSystemTools::GetEnv("VERBOSE") != 0) bool verbose = ((cmSystemTools::GetEnv("VERBOSE") != 0)
&& (cmSystemTools::GetEnv("CMAKE_NO_VERBOSE") == 0)); && (cmSystemTools::GetEnv("CMAKE_NO_VERBOSE") == 0));
// Create a cmake object instance to process dependencies. // Create a cmake object instance to process dependencies.
@ -1673,14 +1674,14 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
return 1; return 1;
} }
void cmake::AddExtraGenerator(const char* name, void cmake::AddExtraGenerator(const char* name,
CreateExtraGeneratorFunctionType newFunction) CreateExtraGeneratorFunctionType newFunction)
{ {
cmExternalMakefileProjectGenerator* extraGenerator = newFunction(); cmExternalMakefileProjectGenerator* extraGenerator = newFunction();
const std::vector<std::string>& supportedGlobalGenerators = const std::vector<std::string>& supportedGlobalGenerators =
extraGenerator->GetSupportedGlobalGenerators(); extraGenerator->GetSupportedGlobalGenerators();
for(std::vector<std::string>::const_iterator for(std::vector<std::string>::const_iterator
it = supportedGlobalGenerators.begin(); it = supportedGlobalGenerators.begin();
it != supportedGlobalGenerators.end(); it != supportedGlobalGenerators.end();
++it ) ++it )
@ -1708,11 +1709,11 @@ void cmake::AddDefaultExtraGenerators()
#endif #endif
#ifdef CMAKE_USE_KDEVELOP #ifdef CMAKE_USE_KDEVELOP
this->AddExtraGenerator(cmGlobalKdevelopGenerator::GetActualName(), this->AddExtraGenerator(cmGlobalKdevelopGenerator::GetActualName(),
&cmGlobalKdevelopGenerator::New); &cmGlobalKdevelopGenerator::New);
// for kdevelop also add the generator with just the name of the // for kdevelop also add the generator with just the name of the
// extra generator, since it was this way since cmake 2.2 // extra generator, since it was this way since cmake 2.2
this->ExtraGenerators[cmGlobalKdevelopGenerator::GetActualName()] this->ExtraGenerators[cmGlobalKdevelopGenerator::GetActualName()]
= &cmGlobalKdevelopGenerator::New; = &cmGlobalKdevelopGenerator::New;
#endif #endif
@ -1728,7 +1729,7 @@ void cmake::GetRegisteredGenerators(std::vector<std::string>& names)
{ {
names.push_back(i->first); names.push_back(i->first);
} }
for(RegisteredExtraGeneratorsMap::const_iterator for(RegisteredExtraGeneratorsMap::const_iterator
i = this->ExtraGenerators.begin(); i = this->ExtraGenerators.begin();
i != this->ExtraGenerators.end(); ++i) i != this->ExtraGenerators.end(); ++i)
{ {
@ -1866,7 +1867,7 @@ int cmake::DoPreConfigureChecks()
// do a sanity check on some values // do a sanity check on some values
if(this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY")) if(this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY"))
{ {
std::string cacheStart = std::string cacheStart =
this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY"); this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY");
cacheStart += "/CMakeLists.txt"; cacheStart += "/CMakeLists.txt";
std::string currentStart = this->GetHomeDirectory(); std::string currentStart = this->GetHomeDirectory();
@ -1910,13 +1911,13 @@ int cmake::HandleDeleteCacheVariables(const char* var)
cmCacheManager::CacheIterator ci = this->CacheManager->NewIterator(); cmCacheManager::CacheIterator ci = this->CacheManager->NewIterator();
std::vector<SaveCacheEntry> saved; std::vector<SaveCacheEntry> saved;
cmOStringStream warning; cmOStringStream warning;
warning warning
<< "You have changed variables that require your cache to be deleted.\n" << "You have changed variables that require your cache to be deleted.\n"
<< "Configure will be re-run and you may have to reset some variables.\n" << "Configure will be re-run and you may have to reset some variables.\n"
<< "The following variables have changed:\n"; << "The following variables have changed:\n";
for(std::vector<std::string>::iterator i = argsSplit.begin(); for(std::vector<std::string>::iterator i = argsSplit.begin();
i != argsSplit.end(); ++i) i != argsSplit.end(); ++i)
{ {
SaveCacheEntry save; SaveCacheEntry save;
save.key = *i; save.key = *i;
warning << *i << "= "; warning << *i << "= ";
@ -1930,7 +1931,7 @@ int cmake::HandleDeleteCacheVariables(const char* var)
} }
saved.push_back(save); saved.push_back(save);
} }
// remove the cache // remove the cache
this->CacheManager->DeleteCache(this->GetStartOutputDirectory()); this->CacheManager->DeleteCache(this->GetStartOutputDirectory());
// load the empty cache // load the empty cache
@ -2002,7 +2003,7 @@ int cmake::ActualConfigure()
if ( !res ) if ( !res )
{ {
this->CacheManager->AddCacheEntry this->CacheManager->AddCacheEntry
("CMAKE_HOME_DIRECTORY", ("CMAKE_HOME_DIRECTORY",
this->GetHomeDirectory(), this->GetHomeDirectory(),
"Start directory with the top level CMakeLists.txt file for this " "Start directory with the top level CMakeLists.txt file for this "
"project", "project",
@ -2012,9 +2013,9 @@ int cmake::ActualConfigure()
// no generator specified on the command line // no generator specified on the command line
if(!this->GlobalGenerator) if(!this->GlobalGenerator)
{ {
const char* genName = const char* genName =
this->CacheManager->GetCacheValue("CMAKE_GENERATOR"); this->CacheManager->GetCacheValue("CMAKE_GENERATOR");
const char* extraGenName = const char* extraGenName =
this->CacheManager->GetCacheValue("CMAKE_EXTRA_GENERATOR"); this->CacheManager->GetCacheValue("CMAKE_EXTRA_GENERATOR");
if(genName) if(genName)
{ {
@ -2036,7 +2037,7 @@ int cmake::ActualConfigure()
this->SetGlobalGenerator(new cmGlobalBorlandMakefileGenerator); this->SetGlobalGenerator(new cmGlobalBorlandMakefileGenerator);
#elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW) #elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW)
std::string installedCompiler; std::string installedCompiler;
// Try to find the newest VS installed on the computer and // Try to find the newest VS installed on the computer and
// use that as a default if -G is not specified // use that as a default if -G is not specified
std::string vsregBase = std::string vsregBase =
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\"; "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\";
@ -2100,11 +2101,11 @@ int cmake::ActualConfigure()
} }
if(!this->CacheManager->GetCacheValue("CMAKE_GENERATOR")) if(!this->CacheManager->GetCacheValue("CMAKE_GENERATOR"))
{ {
this->CacheManager->AddCacheEntry("CMAKE_GENERATOR", this->CacheManager->AddCacheEntry("CMAKE_GENERATOR",
this->GlobalGenerator->GetName(), this->GlobalGenerator->GetName(),
"Name of generator.", "Name of generator.",
cmCacheManager::INTERNAL); cmCacheManager::INTERNAL);
this->CacheManager->AddCacheEntry("CMAKE_EXTRA_GENERATOR", this->CacheManager->AddCacheEntry("CMAKE_EXTRA_GENERATOR",
this->GlobalGenerator->GetExtraGeneratorName(), this->GlobalGenerator->GetExtraGeneratorName(),
"Name of external makefile project generator.", "Name of external makefile project generator.",
cmCacheManager::INTERNAL); cmCacheManager::INTERNAL);
@ -2243,7 +2244,7 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
// set the cmake command // set the cmake command
this->CMakeCommand = args[0]; this->CMakeCommand = args[0];
if ( !this->ScriptMode ) if ( !this->ScriptMode )
{ {
// load the cache // load the cache
@ -2374,7 +2375,7 @@ void cmake::AddCacheEntry(const char* key, const char* value,
const char* helpString, const char* helpString,
int type) int type)
{ {
this->CacheManager->AddCacheEntry(key, value, this->CacheManager->AddCacheEntry(key, value,
helpString, helpString,
cmCacheManager::CacheEntryType(type)); cmCacheManager::CacheEntryType(type));
} }
@ -2489,8 +2490,8 @@ void cmake::UpdateProgress(const char *msg, float prog)
} }
} }
void cmake::GetCommandDocumentation(std::vector<cmDocumentationEntry>& v, void cmake::GetCommandDocumentation(std::vector<cmDocumentationEntry>& v,
bool withCurrentCommands, bool withCurrentCommands,
bool withCompatCommands) const bool withCompatCommands) const
{ {
for(RegisteredCommandsMap::const_iterator j = this->Commands.begin(); for(RegisteredCommandsMap::const_iterator j = this->Commands.begin();
@ -2501,7 +2502,7 @@ void cmake::GetCommandDocumentation(std::vector<cmDocumentationEntry>& v,
{ {
continue; continue;
} }
cmDocumentationEntry e((*j).second->GetName(), cmDocumentationEntry e((*j).second->GetName(),
(*j).second->GetTerseDocumentation(), (*j).second->GetTerseDocumentation(),
(*j).second->GetFullDocumentation()); (*j).second->GetFullDocumentation());
@ -2537,7 +2538,7 @@ void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v)
delete generator; delete generator;
v.push_back(e); v.push_back(e);
} }
for(RegisteredExtraGeneratorsMap::const_iterator for(RegisteredExtraGeneratorsMap::const_iterator
i = this->ExtraGenerators.begin(); i != this->ExtraGenerators.end(); ++i) i = this->ExtraGenerators.begin(); i != this->ExtraGenerators.end(); ++i)
{ {
cmDocumentationEntry e; cmDocumentationEntry e;
@ -2552,7 +2553,7 @@ void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v)
void cmake::UpdateConversionPathTable() void cmake::UpdateConversionPathTable()
{ {
// Update the path conversion table with any specified file: // Update the path conversion table with any specified file:
const char* tablepath = const char* tablepath =
this->CacheManager->GetCacheValue("CMAKE_PATH_TRANSLATION_FILE"); this->CacheManager->GetCacheValue("CMAKE_PATH_TRANSLATION_FILE");
if(tablepath) if(tablepath)
@ -2584,7 +2585,7 @@ int cmake::CheckBuildSystem()
// the make system's VERBOSE environment variable to enable verbose // the make system's VERBOSE environment variable to enable verbose
// output. This can be skipped by setting CMAKE_NO_VERBOSE (which is set // output. This can be skipped by setting CMAKE_NO_VERBOSE (which is set
// by the Eclipse and KDevelop generators). // by the Eclipse and KDevelop generators).
bool verbose = ((cmSystemTools::GetEnv("VERBOSE") != 0) bool verbose = ((cmSystemTools::GetEnv("VERBOSE") != 0)
&& (cmSystemTools::GetEnv("CMAKE_NO_VERBOSE") == 0)); && (cmSystemTools::GetEnv("CMAKE_NO_VERBOSE") == 0));
// This method will check the integrity of the build system if the // This method will check the integrity of the build system if the
@ -2593,7 +2594,7 @@ int cmake::CheckBuildSystem()
// If no file is provided for the check, we have to rerun. // If no file is provided for the check, we have to rerun.
if(this->CheckBuildSystemArgument.size() == 0) if(this->CheckBuildSystemArgument.size() == 0)
{ {
if(verbose) if(verbose)
{ {
cmOStringStream msg; cmOStringStream msg;
@ -2609,7 +2610,7 @@ int cmake::CheckBuildSystem()
if(verbose) if(verbose)
{ {
cmOStringStream msg; cmOStringStream msg;
msg << "Re-run cmake missing file: " msg << "Re-run cmake missing file: "
<< this->CheckBuildSystemArgument.c_str() << "\n"; << this->CheckBuildSystemArgument.c_str() << "\n";
cmSystemTools::Stdout(msg.str().c_str()); cmSystemTools::Stdout(msg.str().c_str());
} }
@ -2629,7 +2630,7 @@ int cmake::CheckBuildSystem()
if(verbose) if(verbose)
{ {
cmOStringStream msg; cmOStringStream msg;
msg << "Re-run cmake error reading : " msg << "Re-run cmake error reading : "
<< this->CheckBuildSystemArgument.c_str() << "\n"; << this->CheckBuildSystemArgument.c_str() << "\n";
cmSystemTools::Stdout(msg.str().c_str()); cmSystemTools::Stdout(msg.str().c_str());
} }
@ -2886,251 +2887,24 @@ void cmake::MarkCliAsUsed(const std::string& variable)
void cmake::GenerateGraphViz(const char* fileName) const void cmake::GenerateGraphViz(const char* fileName) const
{ {
cmGeneratedFileStream str(fileName); #ifdef CMAKE_BUILD_WITH_CMAKE
if ( !str ) std::auto_ptr<cmGraphVizWriter> gvWriter(
{ new cmGraphVizWriter(this->GetGlobalGenerator()->GetLocalGenerators()));
return;
}
cmake cm;
cmGlobalGenerator ggi;
ggi.SetCMakeInstance(&cm);
std::auto_ptr<cmLocalGenerator> lg(ggi.CreateLocalGenerator());
cmMakefile *mf = lg->GetMakefile();
std::string infile = this->GetHomeOutputDirectory(); std::string settingsFile = this->GetHomeOutputDirectory();
infile += "/CMakeGraphVizOptions.cmake"; settingsFile += "/CMakeGraphVizOptions.cmake";
if ( !cmSystemTools::FileExists(infile.c_str()) ) std::string fallbackSettingsFile = this->GetHomeDirectory();
{ fallbackSettingsFile += "/CMakeGraphVizOptions.cmake";
infile = this->GetHomeDirectory();
infile += "/CMakeGraphVizOptions.cmake";
if ( !cmSystemTools::FileExists(infile.c_str()) )
{
infile = "";
}
}
if ( !infile.empty() ) gvWriter->ReadSettings(settingsFile.c_str(), fallbackSettingsFile.c_str());
{
if ( !mf->ReadListFile(0, infile.c_str()) )
{
cmSystemTools::Error("Problem opening GraphViz options file: ",
infile.c_str());
return;
}
std::cout << "Read GraphViz options file: " << infile.c_str()
<< std::endl;
}
#define __set_if_not_set(var, value, cmakeDefinition) \ gvWriter->WritePerTargetFiles(fileName);
const char* var = mf->GetDefinition(cmakeDefinition); \ gvWriter->WriteGlobalFile(fileName);
if ( !var ) \
{ \
var = value; \
}
__set_if_not_set(graphType, "digraph", "GRAPHVIZ_GRAPH_TYPE");
__set_if_not_set(graphName, "GG", "GRAPHVIZ_GRAPH_NAME");
__set_if_not_set(graphHeader, "node [\n fontsize = \"12\"\n];",
"GRAPHVIZ_GRAPH_HEADER");
__set_if_not_set(graphNodePrefix, "node", "GRAPHVIZ_NODE_PREFIX");
const char* ignoreTargets = mf->GetDefinition("GRAPHVIZ_IGNORE_TARGETS");
std::set<cmStdString> ignoreTargetsSet;
if ( ignoreTargets )
{
std::vector<std::string> ignoreTargetsVector;
cmSystemTools::ExpandListArgument(ignoreTargets,ignoreTargetsVector);
std::vector<std::string>::iterator itvIt;
for ( itvIt = ignoreTargetsVector.begin();
itvIt != ignoreTargetsVector.end();
++ itvIt )
{
ignoreTargetsSet.insert(itvIt->c_str());
}
}
str << graphType << " " << graphName << " {" << std::endl; #endif
str << graphHeader << std::endl;
const cmGlobalGenerator* gg = this->GetGlobalGenerator();
const std::vector<cmLocalGenerator*>& localGenerators =
gg->GetLocalGenerators();
std::vector<cmLocalGenerator*>::const_iterator lit;
// for target deps
// 1 - cmake target
// 2 - external target
// 0 - no deps
std::map<cmStdString, int> targetDeps;
std::map<cmStdString, const cmTarget*> targetPtrs;
std::map<cmStdString, cmStdString> targetNamesNodes;
int cnt = 0;
// First pass get the list of all cmake targets
for ( lit = localGenerators.begin(); lit != localGenerators.end(); ++ lit )
{
const cmTargets* targets = &((*lit)->GetMakefile()->GetTargets());
cmTargets::const_iterator tit;
for ( tit = targets->begin(); tit != targets->end(); ++ tit )
{
const char* realTargetName = tit->first.c_str();
if ( ignoreTargetsSet.find(realTargetName) != ignoreTargetsSet.end() )
{
// Skip ignored targets
continue;
}
//std::cout << "Found target: " << tit->first.c_str() << std::endl;
cmOStringStream ostr;
ostr << graphNodePrefix << cnt++;
targetNamesNodes[realTargetName] = ostr.str();
targetPtrs[realTargetName] = &tit->second;
}
}
// Ok, now find all the stuff we link to that is not in cmake
for ( lit = localGenerators.begin(); lit != localGenerators.end(); ++ lit )
{
const cmTargets* targets = &((*lit)->GetMakefile()->GetTargets());
cmTargets::const_iterator tit;
for ( tit = targets->begin(); tit != targets->end(); ++ tit )
{
const cmTarget::LinkLibraryVectorType* ll
= &(tit->second.GetOriginalLinkLibraries());
cmTarget::LinkLibraryVectorType::const_iterator llit;
const char* realTargetName = tit->first.c_str();
if ( ignoreTargetsSet.find(realTargetName) != ignoreTargetsSet.end() )
{
// Skip ignored targets
continue;
}
if ( ll->size() > 0 )
{
targetDeps[realTargetName] = 1;
}
for ( llit = ll->begin(); llit != ll->end(); ++ llit )
{
const char* libName = llit->first.c_str();
std::map<cmStdString, cmStdString>::const_iterator tarIt
= targetNamesNodes.find(libName);
if ( ignoreTargetsSet.find(libName) != ignoreTargetsSet.end() )
{
// Skip ignored targets
continue;
}
if ( tarIt == targetNamesNodes.end() )
{
cmOStringStream ostr;
ostr << graphNodePrefix << cnt++;
targetDeps[libName] = 2;
targetNamesNodes[libName] = ostr.str();
//str << " \"" << ostr.c_str() << "\" [ label=\"" << libName
//<< "\" shape=\"ellipse\"];" << std::endl;
}
else
{
std::map<cmStdString, int>::const_iterator depIt
= targetDeps.find(libName);
if ( depIt == targetDeps.end() )
{
targetDeps[libName] = 1;
}
}
}
}
}
// Write out nodes
std::map<cmStdString, int>::const_iterator depIt;
for ( depIt = targetDeps.begin(); depIt != targetDeps.end(); ++ depIt )
{
const char* newTargetName = depIt->first.c_str();
std::map<cmStdString, cmStdString>::const_iterator tarIt
= targetNamesNodes.find(newTargetName);
if ( tarIt == targetNamesNodes.end() )
{
// We should not be here.
std::cout << __LINE__ << " Cannot find library: " << newTargetName
<< " even though it was added in the previous pass" << std::endl;
abort();
}
str << " \"" << tarIt->second.c_str() << "\" [ label=\""
<< newTargetName << "\" shape=\"";
if ( depIt->second == 1 )
{
std::map<cmStdString, const cmTarget*>::const_iterator tarTypeIt =
targetPtrs.find(newTargetName);
if ( tarTypeIt == targetPtrs.end() )
{
// We should not be here.
std::cout << __LINE__ << " Cannot find library: " << newTargetName
<< " even though it was added in the previous pass" << std::endl;
abort();
}
const cmTarget* tg = tarTypeIt->second;
switch ( tg->GetType() )
{
case cmTarget::EXECUTABLE:
str << "house";
break;
case cmTarget::STATIC_LIBRARY:
str << "diamond";
break;
case cmTarget::SHARED_LIBRARY:
str << "polygon";
break;
case cmTarget::MODULE_LIBRARY:
str << "octagon";
break;
default:
str << "box";
}
}
else
{
str << "ellipse";
}
str << "\"];" << std::endl;
}
// Now generate the connectivity
for ( lit = localGenerators.begin(); lit != localGenerators.end(); ++ lit )
{
const cmTargets* targets = &((*lit)->GetMakefile()->GetTargets());
cmTargets::const_iterator tit;
for ( tit = targets->begin(); tit != targets->end(); ++ tit )
{
std::map<cmStdString, int>::iterator dependIt
= targetDeps.find(tit->first.c_str());
if ( dependIt == targetDeps.end() )
{
continue;
}
std::map<cmStdString, cmStdString>::iterator cmakeTarIt
= targetNamesNodes.find(tit->first.c_str());
const cmTarget::LinkLibraryVectorType* ll
= &(tit->second.GetOriginalLinkLibraries());
cmTarget::LinkLibraryVectorType::const_iterator llit;
for ( llit = ll->begin(); llit != ll->end(); ++ llit )
{
const char* libName = llit->first.c_str();
std::map<cmStdString, cmStdString>::const_iterator tarIt
= targetNamesNodes.find(libName);
if ( tarIt == targetNamesNodes.end() )
{
// We should not be here.
std::cout << __LINE__ << " Cannot find library: " << libName
<< " even though it was added in the previous pass" << std::endl;
abort();
}
str << " \"" << cmakeTarIt->second.c_str() << "\" -> \""
<< tarIt->second.c_str() << "\"" << std::endl;
}
}
}
// TODO: Use dotted or something for external libraries
//str << " \"node0\":f4 -> \"node12\"[color=\"#0000ff\" style=dotted]"
//<< std::endl;
//
str << "}" << std::endl;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int cmake::SymlinkLibrary(std::vector<std::string>& args) int cmake::SymlinkLibrary(std::vector<std::string>& args)
{ {
@ -3385,7 +3159,7 @@ int cmake::ExecuteLinkScript(std::vector<std::string>& args)
void cmake::DefineProperties(cmake *cm) void cmake::DefineProperties(cmake *cm)
{ {
cm->DefineProperty cm->DefineProperty
("REPORT_UNDEFINED_PROPERTIES", cmProperty::GLOBAL, ("REPORT_UNDEFINED_PROPERTIES", cmProperty::GLOBAL,
"If set, report any undefined properties to this file.", "If set, report any undefined properties to this file.",
"If this property is set to a filename then when CMake runs " "If this property is set to a filename then when CMake runs "
"it will report any properties or variables that were accessed " "it will report any properties or variables that were accessed "
@ -3393,7 +3167,7 @@ void cmake::DefineProperties(cmake *cm)
); );
cm->DefineProperty cm->DefineProperty
("TARGET_SUPPORTS_SHARED_LIBS", cmProperty::GLOBAL, ("TARGET_SUPPORTS_SHARED_LIBS", cmProperty::GLOBAL,
"Does the target platform support shared libraries.", "Does the target platform support shared libraries.",
"TARGET_SUPPORTS_SHARED_LIBS is a boolean specifying whether the target " "TARGET_SUPPORTS_SHARED_LIBS is a boolean specifying whether the target "
"platform supports shared libraries. Basically all current general " "platform supports shared libraries. Basically all current general "
@ -3430,7 +3204,7 @@ void cmake::DefineProperties(cmake *cm)
"this list.This property is used by the macros in FeatureSummary.cmake."); "this list.This property is used by the macros in FeatureSummary.cmake.");
cm->DefineProperty cm->DefineProperty
("DISABLED_FEATURES", cmProperty::GLOBAL, ("DISABLED_FEATURES", cmProperty::GLOBAL,
"List of features which are disabled during the CMake run.", "List of features which are disabled during the CMake run.",
"List of features which are disabled during the CMake run. Be default " "List of features which are disabled during the CMake run. Be default "
"it contains the names of all packages which were not found. This is " "it contains the names of all packages which were not found. This is "
"determined using the <NAME>_FOUND variables. Packages which are " "determined using the <NAME>_FOUND variables. Packages which are "
@ -3553,7 +3327,7 @@ void cmake::DefineProperties(cmake *cm)
cm->DefineProperty cm->DefineProperty
("USE_FOLDERS", cmProperty::GLOBAL, ("USE_FOLDERS", cmProperty::GLOBAL,
"Use the FOLDER target property to organize targets into folders.", "Use the FOLDER target property to organize targets into folders.",
"If not set, CMake treats this property as ON by default. " "If not set, CMake treats this property as OFF by default. "
"CMake generators that are capable of organizing into a " "CMake generators that are capable of organizing into a "
"hierarchy of folders use the values of the FOLDER target " "hierarchy of folders use the values of the FOLDER target "
"property to name those folders. See also the documentation " "property to name those folders. See also the documentation "
@ -3580,13 +3354,13 @@ void cmake::DefineProperty(const char *name, cmProperty::ScopeType scope,
bool chained, const char *docSection) bool chained, const char *docSection)
{ {
this->PropertyDefinitions[scope].DefineProperty(name,scope,ShortDescription, this->PropertyDefinitions[scope].DefineProperty(name,scope,ShortDescription,
FullDescription, FullDescription,
docSection, docSection,
chained); chained);
} }
cmPropertyDefinition *cmake cmPropertyDefinition *cmake
::GetPropertyDefinition(const char *name, ::GetPropertyDefinition(const char *name,
cmProperty::ScopeType scope) cmProperty::ScopeType scope)
{ {
if (this->IsPropertyDefined(name,scope)) if (this->IsPropertyDefined(name,scope))
@ -3596,7 +3370,7 @@ cmPropertyDefinition *cmake
return 0; return 0;
} }
void cmake::RecordPropertyAccess(const char *name, void cmake::RecordPropertyAccess(const char *name,
cmProperty::ScopeType scope) cmProperty::ScopeType scope)
{ {
this->AccessedProperties.insert this->AccessedProperties.insert
@ -3668,13 +3442,13 @@ void cmake::ReportUndefinedPropertyAccesses(const char *filename)
{ {
if (!this->IsPropertyDefined(ap->first.c_str(),ap->second) && if (!this->IsPropertyDefined(ap->first.c_str(),ap->second) &&
aliasedProperties.find(std::pair<cmStdString,cmProperty::ScopeType> aliasedProperties.find(std::pair<cmStdString,cmProperty::ScopeType>
(ap->first,ap->second)) == (ap->first,ap->second)) ==
aliasedProperties.end()) aliasedProperties.end())
{ {
const char *scopeStr = ""; const char *scopeStr = "";
switch (ap->second) switch (ap->second)
{ {
case cmProperty::TARGET: case cmProperty::TARGET:
scopeStr = "TARGET"; scopeStr = "TARGET";
break; break;
case cmProperty::SOURCE_FILE: case cmProperty::SOURCE_FILE:
@ -3776,7 +3550,7 @@ const char *cmake::GetProperty(const char* prop, cmProperty::ScopeType scope)
} }
else if ( propname == "COMMANDS" ) else if ( propname == "COMMANDS" )
{ {
cmake::RegisteredCommandsMap::iterator cmds cmake::RegisteredCommandsMap::iterator cmds
= this->GetCommands()->begin(); = this->GetCommands()->begin();
for (unsigned int cc=0 ; cmds != this->GetCommands()->end(); ++ cmds ) for (unsigned int cc=0 ; cmds != this->GetCommands()->end(); ++ cmds )
{ {
@ -3884,14 +3658,14 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
// we have to find the module directory, so we can copy the files // we have to find the module directory, so we can copy the files
this->AddCMakePaths(); this->AddCMakePaths();
std::string modulesPath = std::string modulesPath =
this->CacheManager->GetCacheValue("CMAKE_ROOT"); this->CacheManager->GetCacheValue("CMAKE_ROOT");
modulesPath += "/Modules"; modulesPath += "/Modules";
std::string inFile = modulesPath; std::string inFile = modulesPath;
inFile += "/SystemInformation.cmake"; inFile += "/SystemInformation.cmake";
std::string outFile = destPath; std::string outFile = destPath;
outFile += "/CMakeLists.txt"; outFile += "/CMakeLists.txt";
// Copy file // Copy file
if(!cmSystemTools::cmCopyFile(inFile.c_str(), outFile.c_str())) if(!cmSystemTools::cmCopyFile(inFile.c_str(), outFile.c_str()))
{ {
@ -3899,7 +3673,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
<< "\" to \"" << outFile.c_str() << "\".\n"; << "\" to \"" << outFile.c_str() << "\".\n";
return 1; return 1;
} }
// do we write to a file or to stdout? // do we write to a file or to stdout?
if (resultFile.size() == 0) if (resultFile.size() == 0)
{ {
@ -3925,7 +3699,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
// change back to the original directory // change back to the original directory
cmSystemTools::ChangeDirectory(cwd.c_str()); cmSystemTools::ChangeDirectory(cwd.c_str());
// echo results to stdout if needed // echo results to stdout if needed
if (writeToStdout) if (writeToStdout)
{ {
@ -3946,7 +3720,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
fclose(fin); fclose(fin);
} }
} }
// clean up the directory // clean up the directory
cmSystemTools::RemoveADirectory(destPath.c_str()); cmSystemTools::RemoveADirectory(destPath.c_str());
return 0; return 0;
@ -4065,7 +3839,7 @@ int cmake::VisualStudioLink(std::vector<std::string>& args, int type)
for(std::vector<std::string>::iterator i = args.begin(); for(std::vector<std::string>::iterator i = args.begin();
i != args.end(); ++i) i != args.end(); ++i)
{ {
// check for nmake temporary files // check for nmake temporary files
if((*i)[0] == '@' && i->find("@CMakeFiles") != 0 ) if((*i)[0] == '@' && i->find("@CMakeFiles") != 0 )
{ {
std::ifstream fin(i->substr(1).c_str()); std::ifstream fin(i->substr(1).c_str());
@ -4118,7 +3892,7 @@ int cmake::VisualStudioLink(std::vector<std::string>& args, int type)
type, hasManifest, verbose); type, hasManifest, verbose);
} }
int cmake::ParseVisualStudioLinkCommand(std::vector<std::string>& args, int cmake::ParseVisualStudioLinkCommand(std::vector<std::string>& args,
std::vector<cmStdString>& command, std::vector<cmStdString>& command,
std::string& targetName) std::string& targetName)
{ {
@ -4169,7 +3943,7 @@ bool cmake::RunCommand(const char* comment,
&retCode, 0, false); &retCode, 0, false);
// always print the output of the command, unless // always print the output of the command, unless
// it is the dumb rc command banner, but if the command // it is the dumb rc command banner, but if the command
// returned an error code then print the output anyway as // returned an error code then print the output anyway as
// the banner may be mixed with some other important information. // the banner may be mixed with some other important information.
if(output.find("Resource Compiler Version") == output.npos if(output.find("Resource Compiler Version") == output.npos
|| retCode !=0) || retCode !=0)
@ -4190,12 +3964,12 @@ bool cmake::RunCommand(const char* comment,
return retCode == 0; return retCode == 0;
} }
int cmake::VisualStudioLinkIncremental(std::vector<std::string>& args, int cmake::VisualStudioLinkIncremental(std::vector<std::string>& args,
int type, bool verbose) int type, bool verbose)
{ {
// This follows the steps listed here: // This follows the steps listed here:
// http://blogs.msdn.com/zakramer/archive/2006/05/22/603558.aspx // http://blogs.msdn.com/zakramer/archive/2006/05/22/603558.aspx
// 1. Compiler compiles the application and generates the *.obj files. // 1. Compiler compiles the application and generates the *.obj files.
// 2. An empty manifest file is generated if this is a clean build and if // 2. An empty manifest file is generated if this is a clean build and if
// not the previous one is reused. // not the previous one is reused.
@ -4207,10 +3981,10 @@ int cmake::VisualStudioLinkIncremental(std::vector<std::string>& args,
// on. // on.
// 5. The manifest tool (mt.exe) is then used to generate the final // 5. The manifest tool (mt.exe) is then used to generate the final
// manifest. // manifest.
// If the final manifest is changed, then 6 and 7 are run, if not // If the final manifest is changed, then 6 and 7 are run, if not
// they are skipped, and it is done. // they are skipped, and it is done.
// 6. The resource compiler is invoked one more time. // 6. The resource compiler is invoked one more time.
// 7. Finally, the Linker does another incremental link, but since the // 7. Finally, the Linker does another incremental link, but since the
// only thing that has changed is the *.res file that contains the // only thing that has changed is the *.res file that contains the
@ -4269,7 +4043,7 @@ int cmake::VisualStudioLinkIncremental(std::vector<std::string>& args,
outputOpt += resourceFile; outputOpt += resourceFile;
rcCommand.push_back(outputOpt); rcCommand.push_back(outputOpt);
rcCommand.push_back(resourceInputFile); rcCommand.push_back(resourceInputFile);
// Run rc command to create resource // Run rc command to create resource
if(!cmake::RunCommand("RC Pass 1", rcCommand, verbose)) if(!cmake::RunCommand("RC Pass 1", rcCommand, verbose))
{ {
return -1; return -1;
@ -4279,7 +4053,7 @@ int cmake::VisualStudioLinkIncremental(std::vector<std::string>& args,
{ {
return -1; return -1;
} }
// create mt command // create mt command
std::string outArg("/out:"); std::string outArg("/out:");
outArg+= manifestFile; outArg+= manifestFile;
mtCommand.push_back("/nologo"); mtCommand.push_back("/nologo");
@ -4330,7 +4104,7 @@ int cmake::VisualStudioLinkNonIncremental(std::vector<std::string>& args,
{ {
return -1; return -1;
} }
// Run the link command as given // Run the link command as given
linkCommand.push_back("/MANIFEST"); linkCommand.push_back("/MANIFEST");
if(!cmake::RunCommand("LINK", linkCommand, verbose)) if(!cmake::RunCommand("LINK", linkCommand, verbose))
{ {
@ -4521,7 +4295,7 @@ int cmake::Build(const std::string& dir,
makeProgram = it.GetValue(); makeProgram = it.GetValue();
return gen->Build(0, dir.c_str(), return gen->Build(0, dir.c_str(),
projName.c_str(), target.c_str(), projName.c_str(), target.c_str(),
&output, &output,
makeProgram.c_str(), makeProgram.c_str(),
config.c_str(), clean, false, 0, true, config.c_str(), clean, false, 0, true,
0, nativeOptions); 0, nativeOptions);

View File

@ -21,14 +21,14 @@
// command line arguments. // command line arguments.
// 3) Load the cache by calling LoadCache (duh) // 3) Load the cache by calling LoadCache (duh)
// 4) if you are using command line arguments with -D or -C flags then // 4) if you are using command line arguments with -D or -C flags then
// call SetCacheArgs (or if for some other reason you want to modify the // call SetCacheArgs (or if for some other reason you want to modify the
// cache, do it now. // cache, do it now.
// 5) Finally call Configure // 5) Finally call Configure
// 6) Let the user change values and go back to step 5 // 6) Let the user change values and go back to step 5
// 7) call Generate // 7) call Generate
// //
// If your GUI allows the user to change the start & home directories then // If your GUI allows the user to change the start & home directories then
// you must at a minimum redo steps 2 through 7. // you must at a minimum redo steps 2 through 7.
// //
@ -50,6 +50,8 @@ class cmExternalMakefileProjectGenerator;
class cmDocumentationSection; class cmDocumentationSection;
class cmPolicies; class cmPolicies;
class cmListFileBacktrace; class cmListFileBacktrace;
class cmTarget;
class cmGeneratedFileStream;
class cmake class cmake
{ {
@ -73,14 +75,14 @@ class cmake
static const char *GetCMakeFilesDirectory() {return "/CMakeFiles";}; static const char *GetCMakeFilesDirectory() {return "/CMakeFiles";};
static const char *GetCMakeFilesDirectoryPostSlash() { static const char *GetCMakeFilesDirectoryPostSlash() {
return "CMakeFiles/";}; return "CMakeFiles/";};
//@{ //@{
/** /**
* Set/Get the home directory (or output directory) in the project. The * Set/Get the home directory (or output directory) in the project. The
* home directory is the top directory of the project. It is where * home directory is the top directory of the project. It is where
* cmake was run. Remember that CMake processes * cmake was run. Remember that CMake processes
* CMakeLists files by recursing up the tree starting at the StartDirectory * CMakeLists files by recursing up the tree starting at the StartDirectory
* and going up until it reaches the HomeDirectory. * and going up until it reaches the HomeDirectory.
*/ */
void SetHomeDirectory(const char* dir); void SetHomeDirectory(const char* dir);
const char* GetHomeDirectory() const const char* GetHomeDirectory() const
@ -100,9 +102,9 @@ class cmake
* is the directory of the CMakeLists.txt file that started the current * is the directory of the CMakeLists.txt file that started the current
* round of processing. Remember that CMake processes CMakeLists files by * round of processing. Remember that CMake processes CMakeLists files by
* recursing up the tree starting at the StartDirectory and going up until * recursing up the tree starting at the StartDirectory and going up until
* it reaches the HomeDirectory. * it reaches the HomeDirectory.
*/ */
void SetStartDirectory(const char* dir) void SetStartDirectory(const char* dir)
{ {
this->cmStartDirectory = dir; this->cmStartDirectory = dir;
cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory); cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory);
@ -158,7 +160,7 @@ class cmake
///! Return the global generator assigned to this instance of cmake ///! Return the global generator assigned to this instance of cmake
cmGlobalGenerator* GetGlobalGenerator() { return this->GlobalGenerator; } cmGlobalGenerator* GetGlobalGenerator() { return this->GlobalGenerator; }
///! Return the global generator assigned to this instance of cmake, const ///! Return the global generator assigned to this instance of cmake, const
const cmGlobalGenerator* GetGlobalGenerator() const const cmGlobalGenerator* GetGlobalGenerator() const
{ return this->GlobalGenerator; } { return this->GlobalGenerator; }
///! Return the global generator assigned to this instance of cmake ///! Return the global generator assigned to this instance of cmake
@ -169,25 +171,25 @@ class cmake
///! get the cmCachemManager used by this invocation of cmake ///! get the cmCachemManager used by this invocation of cmake
cmCacheManager *GetCacheManager() { return this->CacheManager; } cmCacheManager *GetCacheManager() { return this->CacheManager; }
///! set the cmake command this instance of cmake should use ///! set the cmake command this instance of cmake should use
void SetCMakeCommand(const char* cmd) { this->CMakeCommand = cmd; } void SetCMakeCommand(const char* cmd) { this->CMakeCommand = cmd; }
/** /**
* Given a variable name, return its value (as a string). * Given a variable name, return its value (as a string).
*/ */
const char* GetCacheDefinition(const char*) const; const char* GetCacheDefinition(const char*) const;
///! Add an entry into the cache ///! Add an entry into the cache
void AddCacheEntry(const char* key, const char* value, void AddCacheEntry(const char* key, const char* value,
const char* helpString, const char* helpString,
int type); int type);
/** /**
* Execute commands during the build process. Supports options such * Execute commands during the build process. Supports options such
* as echo, remove file etc. * as echo, remove file etc.
*/ */
static int ExecuteCMakeCommand(std::vector<std::string>&); static int ExecuteCMakeCommand(std::vector<std::string>&);
/** /**
* Get the system information and write it to the file specified * Get the system information and write it to the file specified
*/ */
int GetSystemInformation(std::vector<std::string>&); int GetSystemInformation(std::vector<std::string>&);
@ -210,17 +212,17 @@ class cmake
/** Check if a command exists. */ /** Check if a command exists. */
bool CommandExists(const char* name) const; bool CommandExists(const char* name) const;
///! Parse command line arguments ///! Parse command line arguments
void SetArgs(const std::vector<std::string>&, void SetArgs(const std::vector<std::string>&,
bool directoriesSetBefore = false); bool directoriesSetBefore = false);
///! Is this cmake running as a result of a TRY_COMPILE command ///! Is this cmake running as a result of a TRY_COMPILE command
bool GetIsInTryCompile() { return this->InTryCompile; } bool GetIsInTryCompile() { return this->InTryCompile; }
///! Is this cmake running as a result of a TRY_COMPILE command ///! Is this cmake running as a result of a TRY_COMPILE command
void SetIsInTryCompile(bool i) { this->InTryCompile = i; } void SetIsInTryCompile(bool i) { this->InTryCompile = i; }
///! Parse command line arguments that might set cache values ///! Parse command line arguments that might set cache values
bool SetCacheArgs(const std::vector<std::string>&); bool SetCacheArgs(const std::vector<std::string>&);
@ -228,9 +230,9 @@ class cmake
(const char*msg, float progress, void *); (const char*msg, float progress, void *);
/** /**
* Set the function used by GUI's to receive progress updates * Set the function used by GUI's to receive progress updates
* Function gets passed: message as a const char*, a progress * Function gets passed: message as a const char*, a progress
* amount ranging from 0 to 1.0 and client data. The progress * amount ranging from 0 to 1.0 and client data. The progress
* number provided may be negative in cases where a message is * number provided may be negative in cases where a message is
* to be displayed without any progress percentage. * to be displayed without any progress percentage.
*/ */
void SetProgressCallback(ProgressCallbackType f, void* clientData=0); void SetProgressCallback(ProgressCallbackType f, void* clientData=0);
@ -245,14 +247,14 @@ class cmake
cmVariableWatch* GetVariableWatch() { return this->VariableWatch; } cmVariableWatch* GetVariableWatch() { return this->VariableWatch; }
/** Get the documentation entries for the supported commands. /** Get the documentation entries for the supported commands.
* If withCurrentCommands is true, the documentation for the * If withCurrentCommands is true, the documentation for the
* recommended set of commands is included. * recommended set of commands is included.
* If withCompatCommands is true, the documentation for discouraged * If withCompatCommands is true, the documentation for discouraged
* (compatibility) commands is included. * (compatibility) commands is included.
* You probably don't want to set both to false. * You probably don't want to set both to false.
*/ */
void GetCommandDocumentation(std::vector<cmDocumentationEntry>& entries, void GetCommandDocumentation(std::vector<cmDocumentationEntry>& entries,
bool withCurrentCommands = true, bool withCurrentCommands = true,
bool withCompatCommands = true) const; bool withCompatCommands = true) const;
void GetPropertiesDocumentation(std::map<std::string, void GetPropertiesDocumentation(std::map<std::string,
cmDocumentationSection *>&); cmDocumentationSection *>&);
@ -279,7 +281,7 @@ class cmake
*/ */
void SetScriptMode(bool mode) { this->ScriptMode = mode; } void SetScriptMode(bool mode) { this->ScriptMode = mode; }
bool GetScriptMode() { return this->ScriptMode; } bool GetScriptMode() { return this->ScriptMode; }
///! Debug the try compile stuff by not delelting the files ///! Debug the try compile stuff by not delelting the files
bool GetDebugTryCompile(){return this->DebugTryCompile;} bool GetDebugTryCompile(){return this->DebugTryCompile;}
void DebugTryCompileOn(){this->DebugTryCompile = true;} void DebugTryCompileOn(){this->DebugTryCompile = true;}
@ -322,7 +324,7 @@ class cmake
void DefineProperty(const char *name, cmProperty::ScopeType scope, void DefineProperty(const char *name, cmProperty::ScopeType scope,
const char *ShortDescription, const char *ShortDescription,
const char *FullDescription, const char *FullDescription,
bool chain = false, bool chain = false,
const char *variableGroup = 0); const char *variableGroup = 0);
// get property definition // get property definition
@ -350,7 +352,7 @@ class cmake
} }
void SetSuppressDevWarnings(bool v) void SetSuppressDevWarnings(bool v)
{ {
this->SuppressDevWarnings = v; this->SuppressDevWarnings = v;
this->DoSuppressDevWarnings = true; this->DoSuppressDevWarnings = true;
} }
@ -372,10 +374,10 @@ protected:
cmPropertyMap Properties; cmPropertyMap Properties;
std::set<std::pair<cmStdString,cmProperty::ScopeType> > AccessedProperties; std::set<std::pair<cmStdString,cmProperty::ScopeType> > AccessedProperties;
std::map<cmProperty::ScopeType, cmPropertyDefinitionMap> std::map<cmProperty::ScopeType, cmPropertyDefinitionMap>
PropertyDefinitions; PropertyDefinitions;
typedef typedef
cmExternalMakefileProjectGenerator* (*CreateExtraGeneratorFunctionType)(); cmExternalMakefileProjectGenerator* (*CreateExtraGeneratorFunctionType)();
typedef std::map<cmStdString, typedef std::map<cmStdString,
CreateExtraGeneratorFunctionType> RegisteredExtraGeneratorsMap; CreateExtraGeneratorFunctionType> RegisteredExtraGeneratorsMap;
@ -389,15 +391,15 @@ protected:
void AddDefaultCommands(); void AddDefaultCommands();
void AddDefaultGenerators(); void AddDefaultGenerators();
void AddDefaultExtraGenerators(); void AddDefaultExtraGenerators();
void AddExtraGenerator(const char* name, void AddExtraGenerator(const char* name,
CreateExtraGeneratorFunctionType newFunction); CreateExtraGeneratorFunctionType newFunction);
cmPolicies *Policies; cmPolicies *Policies;
cmGlobalGenerator *GlobalGenerator; cmGlobalGenerator *GlobalGenerator;
cmCacheManager *CacheManager; cmCacheManager *CacheManager;
std::string cmHomeDirectory; std::string cmHomeDirectory;
std::string HomeOutputDirectory; std::string HomeOutputDirectory;
std::string cmStartDirectory; std::string cmStartDirectory;
std::string StartOutputDirectory; std::string StartOutputDirectory;
bool SuppressDevWarnings; bool SuppressDevWarnings;
bool DoSuppressDevWarnings; bool DoSuppressDevWarnings;
@ -408,7 +410,7 @@ protected:
///! Check if CMAKE_CACHEFILE_DIR is set. If it is not, delete the log file. ///! Check if CMAKE_CACHEFILE_DIR is set. If it is not, delete the log file.
/// If it is set, truncate it to 50kb /// If it is set, truncate it to 50kb
void TruncateOutputLog(const char* fname); void TruncateOutputLog(const char* fname);
/** /**
* Method called to check build system integrity at build time. * Method called to check build system integrity at build time.
* Returns 1 if CMake should rerun and 0 otherwise. * Returns 1 if CMake should rerun and 0 otherwise.
@ -431,24 +433,24 @@ protected:
static int ExecuteLinkScript(std::vector<std::string>& args); static int ExecuteLinkScript(std::vector<std::string>& args);
static int VisualStudioLink(std::vector<std::string>& args, int type); static int VisualStudioLink(std::vector<std::string>& args, int type);
static int VisualStudioLinkIncremental(std::vector<std::string>& args, static int VisualStudioLinkIncremental(std::vector<std::string>& args,
int type, int type,
bool verbose); bool verbose);
static int VisualStudioLinkNonIncremental(std::vector<std::string>& args, static int VisualStudioLinkNonIncremental(std::vector<std::string>& args,
int type, int type,
bool hasManifest, bool hasManifest,
bool verbose); bool verbose);
static int ParseVisualStudioLinkCommand(std::vector<std::string>& args, static int ParseVisualStudioLinkCommand(std::vector<std::string>& args,
std::vector<cmStdString>& command, std::vector<cmStdString>& command,
std::string& targetName); std::string& targetName);
static bool RunCommand(const char* comment, static bool RunCommand(const char* comment,
std::vector<cmStdString>& command, std::vector<cmStdString>& command,
bool verbose, bool verbose,
int* retCodeOut = 0); int* retCodeOut = 0);
cmVariableWatch* VariableWatch; cmVariableWatch* VariableWatch;
///! Find the full path to one of the cmake programs like ctest, cpack, etc. ///! Find the full path to one of the cmake programs like ctest, cpack, etc.
std::string FindCMakeProgram(const char* name) const; std::string FindCMakeProgram(const char* name) const;
private: private:
cmake(const cmake&); // Not implemented. cmake(const cmake&); // Not implemented.
void operator=(const cmake&); // Not implemented. void operator=(const cmake&); // Not implemented.
ProgressCallbackType ProgressCallback; ProgressCallbackType ProgressCallback;
@ -478,7 +480,7 @@ private:
cmFileTimeComparison* FileComparison; cmFileTimeComparison* FileComparison;
std::string GraphVizFile; std::string GraphVizFile;
std::vector<std::string> DebugConfigs; std::vector<std::string> DebugConfigs;
void UpdateConversionPathTable(); void UpdateConversionPathTable();
}; };

View File

@ -15,7 +15,7 @@
SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_YEAR 2010)
# KWSys version date month component. Format is MM. # KWSys version date month component. Format is MM.
SET(KWSYS_DATE_STAMP_MONTH 09) SET(KWSYS_DATE_STAMP_MONTH 10)
# KWSys version date day component. Format is DD. # KWSys version date day component. Format is DD.
SET(KWSYS_DATE_STAMP_DAY 28) SET(KWSYS_DATE_STAMP_DAY 31)

View File

@ -153,6 +153,9 @@ IF(BUILD_TESTING)
ADD_TEST_MACRO(ExportImport ExportImport) ADD_TEST_MACRO(ExportImport ExportImport)
ADD_TEST_MACRO(Unset Unset) ADD_TEST_MACRO(Unset Unset)
ADD_TEST_MACRO(PolicyScope PolicyScope) ADD_TEST_MACRO(PolicyScope PolicyScope)
ADD_TEST_MACRO(EmptyLibrary EmptyLibrary)
SET_TESTS_PROPERTIES(EmptyLibrary PROPERTIES
PASS_REGULAR_EXPRESSION "CMake Error: CMake can not determine linker language for target:test")
ADD_TEST_MACRO(CrossCompile CrossCompile) ADD_TEST_MACRO(CrossCompile CrossCompile)
SET_TESTS_PROPERTIES(CrossCompile PROPERTIES SET_TESTS_PROPERTIES(CrossCompile PROPERTIES
PASS_REGULAR_EXPRESSION "TRY_RUN.. invoked in cross-compiling mode") PASS_REGULAR_EXPRESSION "TRY_RUN.. invoked in cross-compiling mode")
@ -1718,7 +1721,15 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
ENDIF() ENDIF()
ENDIF() ENDIF()
IF(NOT CMAKE_TEST_GENERATOR MATCHES "Xcode") if(NOT DEFINED CTEST_RUN_Java)
if(APPLE)
set(CTEST_RUN_Java OFF)
else()
set(CTEST_RUN_Java ON)
endif()
endif()
IF(CTEST_RUN_Java)
find_package(Java QUIET) find_package(Java QUIET)
IF(JAVA_COMPILE AND JAVA_RUNTIME AND JAVA_ARCHIVE AND NOT MINGW) IF(JAVA_COMPILE AND JAVA_RUNTIME AND JAVA_ARCHIVE AND NOT MINGW)
GET_FILENAME_COMPONENT(JNIPATH ${JAVA_COMPILE} PATH) GET_FILENAME_COMPONENT(JNIPATH ${JAVA_COMPILE} PATH)
@ -1742,7 +1753,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
ENDIF("${JNI_FILE}" MATCHES "JDK1_2") ENDIF("${JNI_FILE}" MATCHES "JDK1_2")
ENDIF(JNI_H) ENDIF(JNI_H)
ENDIF(JAVA_COMPILE AND JAVA_RUNTIME AND JAVA_ARCHIVE AND NOT MINGW) ENDIF(JAVA_COMPILE AND JAVA_RUNTIME AND JAVA_ARCHIVE AND NOT MINGW)
ENDIF(NOT CMAKE_TEST_GENERATOR MATCHES "Xcode") ENDIF(CTEST_RUN_Java)
# add some cross compiler tests, for now only with makefile based generators # add some cross compiler tests, for now only with makefile based generators
IF(CMAKE_TEST_GENERATOR MATCHES "Makefiles" OR CMAKE_TEST_GENERATOR MATCHES "KDevelop") IF(CMAKE_TEST_GENERATOR MATCHES "Makefiles" OR CMAKE_TEST_GENERATOR MATCHES "KDevelop")

View File

@ -77,6 +77,11 @@ message(STATUS "")
list_prerequisites("${CMAKE_COMMAND}" 0 0 1) list_prerequisites("${CMAKE_COMMAND}" 0 0 1)
message(STATUS "") message(STATUS "")
message(STATUS "=============================================================================")
string(LENGTH "$ENV{PATH}" PATH_LENGTH_BEGIN)
message(STATUS "Begin PATH length is: ${PATH_LENGTH_BEGIN}")
message(STATUS "")
# Leave the code for these tests in here, but turn them off by default... they # Leave the code for these tests in here, but turn them off by default... they
# take longer than they're worth during development... # take longer than they're worth during development...
@ -116,11 +121,11 @@ message(STATUS "")
message(STATUS "=============================================================================") message(STATUS "=============================================================================")
message(STATUS "Test overriding 'gp_tool' with value unlikely to be found") message(STATUS "Test overriding 'gp_tool' with value unlikely to be found")
message(STATUS "") message(STATUS "")
if(WIN32 OR APPLE) if(APPLE)
set(gp_tool "ldd") set(gp_tool "dumpbin")
else(WIN32 OR APPLE) else()
set(gp_tool "otool") set(gp_tool "otool")
endif(WIN32 OR APPLE) endif()
set(gp_cmd "gp_cmd-NOTFOUND") set(gp_cmd "gp_cmd-NOTFOUND")
list_prerequisites("${CMAKE_COMMAND}" 0 0 0) list_prerequisites("${CMAKE_COMMAND}" 0 0 0)
set(gp_cmd) set(gp_cmd)
@ -139,6 +144,15 @@ foreach(v ${vs})
endforeach(v) endforeach(v)
message(STATUS "") message(STATUS "")
message(STATUS "=============================================================================")
string(LENGTH "$ENV{PATH}" PATH_LENGTH_END)
message(STATUS "Final PATH length is: ${PATH_LENGTH_END}")
if(PATH_LENGTH_END GREATER ${PATH_LENGTH_BEGIN})
message(FATAL_ERROR "list_prerequisties is endlessly appending the path of gp_tool to the PATH.")
endif()
message(STATUS "")
message(STATUS "=============================================================================") message(STATUS "=============================================================================")
message(STATUS "End of test") message(STATUS "End of test")

View File

@ -76,7 +76,8 @@ endif()
file(WRITE file(WRITE
"${CMAKE_CURRENT_BINARY_DIR}/main.cxx" "${CMAKE_CURRENT_BINARY_DIR}/main.cxx"
"int main() { return 0; }" "int main() { return 0; }
"
) )
add_executable( add_executable(

View File

@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 2.6)
project(TestEmptyLibrary)
add_subdirectory(subdir)

View File

@ -0,0 +1 @@
add_library(test test.h)

View File

@ -0,0 +1 @@
extern int dummy;

View File

@ -7,6 +7,13 @@ find_package(CVS)
find_package(Subversion) find_package(Subversion)
find_package(Git) find_package(Git)
option(ExternalProjectTest_USE_FOLDERS "Enable folder grouping in IDEs." ON)
if(ExternalProjectTest_USE_FOLDERS)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
else()
set_property(GLOBAL PROPERTY USE_FOLDERS OFF)
endif()
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER
"CMakePredefinedTargets-in-ExternalProjectTest") "CMakePredefinedTargets-in-ExternalProjectTest")
@ -61,6 +68,15 @@ ExternalProject_Add(${proj}
INSTALL_COMMAND "" INSTALL_COMMAND ""
) )
set(proj TargetNameSameAsFolder)
ExternalProject_Add(${proj}
BUILD_COMMAND ""
CONFIGURE_COMMAND ""
DOWNLOAD_COMMAND ""
INSTALL_COMMAND ""
)
set_property(TARGET ${proj} PROPERTY FOLDER "${proj}")
set(proj MinimalNoOpProject) set(proj MinimalNoOpProject)
ExternalProject_Add(${proj} ExternalProject_Add(${proj}
BUILD_COMMAND "" BUILD_COMMAND ""